@arcgis/common-components 5.0.0-next.124 → 5.0.0-next.125

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cdn/{55APDMBW.js → 4CRBTYNF.js} +1 -1
  2. package/dist/cdn/{AZAAF26R.js → 7Y73AHBR.js} +2 -2
  3. package/dist/cdn/{ENTPJOT6.js → BUT6HWCA.js} +2 -2
  4. package/dist/cdn/{PZ6FHP23.js → COOUHA4K.js} +2 -2
  5. package/dist/cdn/{3WEJYKZO.js → FPH7ZJDS.js} +2 -2
  6. package/dist/cdn/{AQOAXUZE.js → HU4U7MEH.js} +2 -2
  7. package/dist/cdn/{SNDFUUNP.js → KD2IJTFF.js} +123 -123
  8. package/dist/cdn/{ACMDR4DS.js → KEDP2XOF.js} +2 -2
  9. package/dist/cdn/{3ZYWH7ZS.js → KFL2TIFP.js} +2 -2
  10. package/dist/cdn/{G7VTXCKM.js → L4YABBBX.js} +2 -2
  11. package/dist/cdn/{MJW5N2GL.js → LONFK6F4.js} +1 -1
  12. package/dist/cdn/{JJ2Y4N2K.js → M5JGIZYS.js} +2 -2
  13. package/dist/cdn/{JPB2X5F2.js → MV2HPDDI.js} +2 -2
  14. package/dist/cdn/{PJISHDGP.js → PAH5NEYW.js} +2 -2
  15. package/dist/cdn/{OUHPZUAA.js → PD5SNT7N.js} +2 -2
  16. package/dist/cdn/{EA5DSTV6.js → Q3NZOH23.js} +1 -1
  17. package/dist/cdn/{GXR3BOWE.js → Q3VYXBBM.js} +2 -2
  18. package/dist/cdn/{3KIC2XOI.js → RA4N4CF3.js} +1 -1
  19. package/dist/cdn/{3PSPDXMP.js → S3P7GTZF.js} +2 -2
  20. package/dist/cdn/{EALY2PQS.js → T75EYZ5M.js} +2 -2
  21. package/dist/cdn/UIGZUM56.js +6 -0
  22. package/dist/cdn/{LIIWH5OH.js → WAUMNDLN.js} +2 -2
  23. package/dist/cdn/{X5P2Z77J.js → YGF5RNPU.js} +2 -2
  24. package/dist/cdn/index.js +2 -2
  25. package/dist/chunks/commonEnums.js +1 -1
  26. package/dist/chunks/commonFunctions.js +1 -1
  27. package/dist/chunks/resources.js +1 -1
  28. package/dist/chunks/runtime.js +1 -1
  29. package/dist/chunks/useT9n.js +1 -1
  30. package/dist/components/arcgis-ckeditor5/customElement.js +6887 -7708
  31. package/dist/components/arcgis-ckeditor5-popover/customElement.js +1 -1
  32. package/dist/components/arcgis-color-input/customElement.js +1 -1
  33. package/dist/components/arcgis-field-info/customElement.js +1 -1
  34. package/dist/components/arcgis-field-pick-list/customElement.js +1 -1
  35. package/dist/components/arcgis-histogram/customElement.js +1 -1
  36. package/dist/components/arcgis-label-input/customElement.js +1 -1
  37. package/dist/components/arcgis-picker-input/customElement.js +1 -1
  38. package/dist/components/arcgis-ramp-color/customElement.js +1 -1
  39. package/dist/components/arcgis-ramp-color-break/customElement.js +1 -1
  40. package/dist/components/arcgis-ramp-opacity/customElement.js +1 -1
  41. package/dist/components/arcgis-slider/customElement.js +1 -1
  42. package/dist/components/arcgis-slider-input/customElement.js +1 -1
  43. package/dist/components/arcgis-ticks/customElement.js +1 -1
  44. package/dist/components/arcgis-unique-values-list/customElement.js +1 -1
  45. package/dist/docs/api.json +2 -2
  46. package/dist/docs/docs.json +2 -2
  47. package/dist/docs/web-types.json +1 -1
  48. package/dist/index.js +1 -1
  49. package/dist/loader.js +1 -1
  50. package/package.json +6 -4
  51. package/dist/cdn/UBB6IHIQ.js +0 -6
@@ -1,4 +1,4 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.124 */
3
+ v5.0.0-next.125 */
4
4
  function g(n){return a(n).length>0}function a(n,t){return l(n.target,t)}function l(n,t){let e=n.assignedElements({flatten:!0});return t?e.filter(s=>s.matches(t)):e}var E=(...n)=>{let t=[];for(let s=0;s<n.length;s++){let o=n[s];if(typeof o=="string")t.push(o);else if(Array.isArray(o))t.push.apply(t,o);else if(typeof o=="object")for(let r in o)o[r]&&t.push(r)}let e=t.join(" ");return t.length=0,e},d=(n,t)=>{let e=n;for(;e;){if(e===t)return!0;if(!e.parentNode)return!1;e.parentNode instanceof ShadowRoot?e=e.parentNode.host:e=e.parentNode}return!1},b=(n,t,e)=>{let s=f(t).subscribe;return s(o=>{o.some(i=>d(n,i.target))&&e()})},c={},f=n=>{let t=n.join(","),e=c[t];if(e!==void 0)return e;let s=new Set,o=new MutationObserver(i=>s.forEach(u=>u(i)));globalThis.document&&o.observe(document.documentElement,{attributes:!0,attributeFilter:n,subtree:!0});let r={subscribe:i=>(s.add(i),()=>{s.delete(i),s.size===0&&(o.disconnect(),c[t]=void 0)})};return c[t]=r,r},h=(n,t)=>{let e=n;for(;e;){let s=e.closest?.(t);if(s)return s;let o=e.getRootNode?.();if(o===globalThis.document)return;e=o.host}};var p=n=>m(n,"dir","ltr"),m=(n,t,e)=>h(n,`[${t}]`)?.getAttribute(t)??e;export{g as a,E as b,b as c,h as d,p as e,m as f};
@@ -1,4 +1,4 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.124 */
4
- import{a as i}from"./3KIC2XOI.js";import{a as u,b as m}from"./3PSPDXMP.js";import{e as g}from"./55APDMBW.js";import{A as a,B as d,C as e,E as p,H as h,g as n,i as l,q as s,t as c,z as o}from"./UBB6IHIQ.js";var v=n`.arcgis-app-ckeditor-popover-footer{display:flex;justify-content:flex-end;margin-top:var(--calcite-space-sm);padding:0 var(--calcite-space-lg)}.arcgis-app-ckeditor-popover-container{margin:0 var(--calcite-space-md) 0 0;padding-bottom:var(--calcite-space-lg);box-shadow:val(--calcite-shadow-1)}`,r=class extends d{constructor(){super(),this.okButton=o(),this.popoverNode=o(),this._propWatcherTask=new u(this,{task:async([t])=>{if(!m(t)){console.error("[ckeditor5] Required properties are missing.");return}},args:()=>[this.refElement]}),this.guid=c(),this.intlOk="Ok",this.intlCancel="Cancel",this.arcgisCkeditor5PopoverClosed=s(),this.arcgisPopoverClosed=s(),this.listen("arcgisCreated",this.afterEditorCreated),this.listen("arcgisSourceEditingChanged",this.onSourceEditingStatusChanged)}static{this.properties={guid:0,refElement:0,intlOk:1,intlCancel:1,intlLabel:1}}static{this.styles=v}async reposition(){this.popoverNode.value?.reposition()}afterEditorCreated(t){this.editor=t.target,this.reposition(),this.requestUpdate()}onSourceEditingStatusChanged(t){this.okButton.value&&(this.okButton.value.disabled=t.detail)}render(){return this.el.classList.add("js-app-flyout"),this._propWatcherTask.render({complete:()=>l`<calcite-popover class=${e(i.popover)} dir=${g(this.el)??p} placement=leading-start open pointer-disabled .referenceElement=${this.refElement} .offsetDistance=${-Math.round(this.refElement.getBoundingClientRect().width)} offset-skidding=50 .label=${this.intlLabel??""} focus-trap-disabled trigger-disabled ${a(this.popoverNode)}><div class=${e(i.arcgisAppCkeditorPopoverContainer)}><slot></slot><div class=${e(i.arcgisAppCkeditorPopoverFooter)}><calcite-button .label=${this.intlOk} @click=${async t=>{this.okButton.value?.disabled||(t.stopPropagation(),this.arcgisCkeditor5PopoverClosed.emit({guid:this.guid,data:await this.editor?.getData()}),this.arcgisPopoverClosed.emit({guid:this.guid,data:await this.editor?.getData()}))}} ${a(this.okButton)}>${this.intlOk}</calcite-button><calcite-button appearance=outline-fill .label=${this.intlCancel} @click=${t=>{t.stopPropagation(),this.arcgisCkeditor5PopoverClosed.emit({guid:this.guid}),this.arcgisPopoverClosed.emit({guid:this.guid})}}>${this.intlCancel}</calcite-button></div></div></calcite-popover>`})}};h("arcgis-ckeditor5-popover",r);export{r as ArcgisCkeditor5Popover};
3
+ v5.0.0-next.125 */
4
+ import{a as i}from"./RA4N4CF3.js";import{a as u,b as m}from"./S3P7GTZF.js";import{e as g}from"./4CRBTYNF.js";import{A as a,B as d,C as e,E as p,H as h,g as n,i as l,q as s,t as c,z as o}from"./UIGZUM56.js";var v=n`.arcgis-app-ckeditor-popover-footer{display:flex;justify-content:flex-end;margin-top:var(--calcite-space-sm);padding:0 var(--calcite-space-lg)}.arcgis-app-ckeditor-popover-container{margin:0 var(--calcite-space-md) 0 0;padding-bottom:var(--calcite-space-lg);box-shadow:val(--calcite-shadow-1)}`,r=class extends d{constructor(){super(),this.okButton=o(),this.popoverNode=o(),this._propWatcherTask=new u(this,{task:async([t])=>{if(!m(t)){console.error("[ckeditor5] Required properties are missing.");return}},args:()=>[this.refElement]}),this.guid=c(),this.intlOk="Ok",this.intlCancel="Cancel",this.arcgisCkeditor5PopoverClosed=s(),this.arcgisPopoverClosed=s(),this.listen("arcgisCreated",this.afterEditorCreated),this.listen("arcgisSourceEditingChanged",this.onSourceEditingStatusChanged)}static{this.properties={guid:0,refElement:0,intlOk:1,intlCancel:1,intlLabel:1}}static{this.styles=v}async reposition(){this.popoverNode.value?.reposition()}afterEditorCreated(t){this.editor=t.target,this.reposition(),this.requestUpdate()}onSourceEditingStatusChanged(t){this.okButton.value&&(this.okButton.value.disabled=t.detail)}render(){return this.el.classList.add("js-app-flyout"),this._propWatcherTask.render({complete:()=>l`<calcite-popover class=${e(i.popover)} dir=${g(this.el)??p} placement=leading-start open pointer-disabled .referenceElement=${this.refElement} .offsetDistance=${-Math.round(this.refElement.getBoundingClientRect().width)} offset-skidding=50 .label=${this.intlLabel??""} focus-trap-disabled trigger-disabled ${a(this.popoverNode)}><div class=${e(i.arcgisAppCkeditorPopoverContainer)}><slot></slot><div class=${e(i.arcgisAppCkeditorPopoverFooter)}><calcite-button .label=${this.intlOk} @click=${async t=>{this.okButton.value?.disabled||(t.stopPropagation(),this.arcgisCkeditor5PopoverClosed.emit({guid:this.guid,data:await this.editor?.getData()}),this.arcgisPopoverClosed.emit({guid:this.guid,data:await this.editor?.getData()}))}} ${a(this.okButton)}>${this.intlOk}</calcite-button><calcite-button appearance=outline-fill .label=${this.intlCancel} @click=${t=>{t.stopPropagation(),this.arcgisCkeditor5PopoverClosed.emit({guid:this.guid}),this.arcgisPopoverClosed.emit({guid:this.guid})}}>${this.intlCancel}</calcite-button></div></div></calcite-popover>`})}};h("arcgis-ckeditor5-popover",r);export{r as ArcgisCkeditor5Popover};
@@ -1,4 +1,4 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.124 */
4
- import{B as l,H as e,g as r,i as a}from"./UBB6IHIQ.js";var h=r`:host{display:block;block-size:30px;inline-size:100%}:host([layout="vertical"]){writing-mode:vertical-lr}arcgis-ramp-color{block-size:inherit;inline-size:inherit}`,s=class extends l{constructor(){super(...arguments),this._rampStops=[],this.layout="horizontal",this.min=0,this.max=1,this.stops=[]}static{this.properties={layout:1,min:9,max:9,stops:0}}static{this.styles=h}willUpdate(t){if(super.willUpdate(t),t.has("stops")){let{stops:p}=this,i=[];p.forEach(c=>{let{color:o,max:m,min:n}=c;i.push({value:n,color:o},{value:m,color:o})}),this._rampStops=i}}render(){return a`<arcgis-ramp-color .layout=${this.layout} .min=${this.min} .max=${this.max} .stops=${this._rampStops}></arcgis-ramp-color>`}};e("arcgis-ramp-color-break",s);export{s as ArcgisRampColorBreak};
3
+ v5.0.0-next.125 */
4
+ import{B as l,H as e,g as r,i as a}from"./UIGZUM56.js";var h=r`:host{display:block;block-size:30px;inline-size:100%}:host([layout="vertical"]){writing-mode:vertical-lr}arcgis-ramp-color{block-size:inherit;inline-size:inherit}`,s=class extends l{constructor(){super(...arguments),this._rampStops=[],this.layout="horizontal",this.min=0,this.max=1,this.stops=[]}static{this.properties={layout:1,min:9,max:9,stops:0}}static{this.styles=h}willUpdate(t){if(super.willUpdate(t),t.has("stops")){let{stops:p}=this,i=[];p.forEach(c=>{let{color:o,max:m,min:n}=c;i.push({value:n,color:o},{value:m,color:o})}),this._rampStops=i}}render(){return a`<arcgis-ramp-color .layout=${this.layout} .min=${this.min} .max=${this.max} .stops=${this._rampStops}></arcgis-ramp-color>`}};e("arcgis-ramp-color-break",s);export{s as ArcgisRampColorBreak};
@@ -1,4 +1,4 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.124 */
4
- import{a as R,c as _}from"./3PSPDXMP.js";import{a as T}from"./PJISHDGP.js";import{b as q}from"./JJ2Y4N2K.js";import"./55APDMBW.js";import{A as D,B as A,C as F,H as L,g as C,i as m,m as N,n as $,q as E}from"./UBB6IHIQ.js";export default $arcgis.t(([G,w,y,I,P,U,k])=>{var u=(s=>(s.MISSING="missing",s.IN_PROGRESS="inProgress",s.SUCCESS="success",s.FAILED="failed",s))(u||{}),d=(s=>(s.DATE="date",s.DATE_ONLY="date-only",s.GUID="guid",s.NUMBER="number",s.OID="oid",s.STRING="string",s.TIME_ONLY="time-only",s.TIMESTAMP_OFFSET="timestamp-offset",s.UNKNOWN="unknown",s))(d||{});function g(s){return s!=null}function Z(s){return s.type==="scene"?s.associatedLayer?.url:s.url}var Y={dateStyle:"short",timeStyle:"short"},W={timeStyle:"medium"};function B(s){let{layer:e,fieldName:t}=s,i,a=_(e),r;"popupTemplate"in e&&(r=e.popupTemplate);let n=r?r.fieldInfos:[];return x(s)?.filter(o=>o.name===t).forEach(o=>{let c=!a&&n?n.filter(f=>f.fieldName===o.name):null,p=a?e.getFieldAlias(t):c?.length?c[0].label:o.alias;/^raster.(item|service)pixelvalue/iu.test(t)&&(o.type="double");let l={layerField:o,label:p||o.name};l.codedValues=j(t,s),Q(l),l.simpleFieldType&&(i=l)}),i}function x(s){let{layer:e}=s;return e.type==="imagery-tile"||e.type==="wcs"||e.type==="imagery"&&e.rasterFields.length?e.rasterFields:e.fields}async function M(s){s.statisticsStatus=u.IN_PROGRESS;let{layer:e,view:t}=s;if(e.type==="imagery-tile"||e.type==="wcs"||e.type==="stream"||e.type==="voxel")throw new Error("could not get feature count");try{return await z(e,t)}catch{return}}async function H(s){let{layer:e,view:t,fieldName:i,fieldInfo:a}=s;if(e.type==="imagery-tile"||e.type==="wcs"||e.type==="voxel")throw new Error("could not get statistics for ImageryTileLayer/WCSLayer/VoxelLayer");if(!a||a.layerField.type==="oid"||a.layerField.type==="guid"||a.layerField.type==="global-id")return{totalCount:await M(s),nullcount:0};try{let r=await P({layer:e,view:t,field:i,outStatisticTypes:{exclude:["median"]}});if(!g(r.count))throw new Error("could not get statistics");let n="sourceJSON"in e&&e.sourceJSON.maxRecordCount===r.count;if(g(r.nullcount)&&!n)return{...r,totalCount:r.count+r.nullcount};{let o=await M(s);return{...r,totalCount:o}}}catch{throw new Error("could not get statistics")}}async function J(s){let{layer:e,view:t,fieldName:i}=s;if(e.type==="imagery-tile"||e.type==="wcs"||e.type==="voxel")throw new Error("could not get unique values for ImageryLayer/ImageryTileLayer/WCSLayer/VoxelLayer");e.type==="feature"&&!e.url&&(e.outFields=["*"]);try{return await U({layer:e,view:t,field:i})}catch{throw new Error("could not get unique values")}}function Q(s){switch(s.layerField.type){case"string":s.simpleFieldType=d.STRING;break;case"date":s.simpleFieldType=d.DATE;break;case"timestamp-offset":s.simpleFieldType=d.TIMESTAMP_OFFSET;break;case"date-only":s.simpleFieldType=d.DATE_ONLY;break;case"time-only":s.simpleFieldType=d.TIME_ONLY;break;case"oid":s.simpleFieldType=d.OID;break;case"guid":case"global-id":s.simpleFieldType=d.GUID;break;case"small-integer":case"big-integer":case"integer":case"single":case"double":case"long":s.simpleFieldType=d.NUMBER;break}}function j(s,e){let{layer:t}=e;if(t.type==="subtype-sublayer"&&t.subtypeField===s){let c=t.parent?.subtypes?.find(p=>p.code===t.subtypeCode);if(c)return[{code:c.code,name:c.name}]}if(t.type!=="feature"&&t.type!=="imagery")return;let i=t.type==="feature"?t.typeIdField:void 0,a=t.type==="feature"?t.types:void 0,r,n=x(e)?.find(c=>c.name===s),o=n?.domain;return t.type==="feature"&&i&&a?(i===s?r=a.map(c=>({code:c.id,name:c.name})):(r=[],a.forEach(c=>{if(!c.domains[s]||c.domains[s].type==="inherited"){let p=o;p?.codedValues&&p.codedValues.forEach(async l=>{let f=!1;r.forEach(h=>{h.code===l.code&&(f=!0,`, ${h.name},`.includes(`, ${l.name},`)||(h.name+=`, ${l.name}`))}),f||r.push(I.clone(l))})}else c.domains[s].codedValues&&c.domains[s].codedValues.forEach(async p=>{let l=!1;r.forEach(f=>{f.code===p.code&&(l=!0,`, ${f.name},`.includes(`, ${p.name},`)||(f.name+=`, ${p.name}`))}),l||r.push(I.clone(p))})})),!r.length&&o?.codedValues&&(r=I.clone(o.codedValues))):o?.codedValues&&(r=n.domain.codedValues),r?.length?r:null}async function K(s){let{view:e,layer:t}=s;if(t.type==="imagery"||t.type==="imagery-tile"||t.type==="wcs")throw new Error("could not get feature");if(t.type==="feature"&&!t.url||t.type==="wfs"){let i=t.createQuery();i.start=0,i.num=5,i.outFields=["*"];let a=await t.queryFeatures(i);if(a.features.length)return a;throw new Error("could not get feature")}else{if(!e)return await b(s);let i;if(t.type==="subtype-sublayer"||t.type==="sublayer"){let a=t.parent;for(;["subtype-group","map-image"].includes(a.type);)a=a.parent;i=await e.whenLayerView(a)}else i=await e.whenLayerView(t);if(i.availableFields.length===t.fields.length||["stream","ogc-feature"].includes(t.type)&&i.availableFields.length>0){let a=t.createQuery();a.start=0,a.num=5,a.outFields=["*"];let r=await i.queryFeatures(a);return r.features?.length?r:await b(s)}else return await b(s)}}async function b(s){let{layer:e}=s;if(["imagery","imagery-tile","stream","ogc-feature"].includes(e.type))throw new Error("cannot get feature from service");let t=new k({where:"1=1",outFields:["*"],returnGeometry:!1});return"sourceJSON"in e&&e.sourceJSON?.advancedQueryCapabilities?.supportsPagination&&(t.num=1),await e.queryFeatures(t)}async function z(s,e){if(s.type==="feature"&&!s.url)return await X(s);if(s.type==="feature"||s.type==="csv"||s.type==="scene"||s.type==="wfs"||s.type==="geojson")return await s.queryFeatureCount();if(e&&(s.type==="stream"||s.type==="ogc-feature"))return await ee(s,e)}async function X(s){let e=s.createQuery();e.outFields=["*"];let t=await s.queryFeatures(e);if(t.features.length)return t.features.length;throw new Error("could not get feature count")}async function ee(s,e){return await(await e.whenLayerView(s)).queryFeatureCount()}var te=C`:host{height:100%}.container{padding:var(--calcite-space-xs);background-color:var(--calcite-color-foreground-1)}.title{font-weight:700;padding:5px 0}.missing,.data{color:#a9a9a9}.count{white-space:nowrap}.section{padding:var(--calcite-space-xs) 0}.statistics-row{border-top:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);padding:var(--calcite-space-xs) 0;display:flex;justify-content:space-between}.statistics-row-top-values{border-top:var(--calcite-border-width-sm) solid var(--calctie-color-border-2);padding:20px 0 var(--calcite-space-xs) 0;display:flex;justify-content:space-between}`,O=class extends A{constructor(){super(...arguments),this._messages=q({blocking:!0}),this._propWatcherTask=new R(this,{task:async([e,t])=>{let i=g(e)&&g(t);if(g(e)||N("error",this,$("layer")),g(t)||N("error",this,$("fieldName")),!i)throw new Error;await this.processProps(),this._propWatcherTask.autoRun=!1},args:()=>[this.layer,this.fieldName]}),this.oneFeatureResponseStatus=u.MISSING,this.statisticsStatus=u.MISSING,this.uniqueValuesStatus=u.MISSING,this.hideAlias=!1,this.hideNumericFormat=!1,this.hideStatistics=!1,this.arcgisComplete=E(),this.arcgisFieldInfoComplete=E()}static{this.properties={oneFeatureResponseStatus:16,oneFeatureResponse:16,statisticsStatus:16,statistics:16,uniqueValuesStatus:16,uniqueValues:16,view:0,layer:0,fieldName:1,hideAlias:5,hideNumericFormat:5,hideStatistics:5}}static{this.styles=te}async refresh(){await this.processProps(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.timeZoneHandle?.remove()}async processProps(){let{view:e,layer:t,fieldName:i,hideStatistics:a}=this;if(!t||!i)return;let r;if(t.declaredClass==="esri.layers.support.Sublayer"){let n=t;e&&await w.whenOnce(()=>!e.updating),r=await n.createFeatureLayer(),await r?.load()}this.props={view:e,layer:r??t,fieldName:i,hideStatistics:a},this.props.fieldInfo=B(this.props),t.type==="scene"&&G.request.interceptors?.push({urls:`${Z(t)}/${t.layerId}`,before(n){n.requestOptions.authMode="no-prompt"}}),this.oneFeatureResponseStatus=u.IN_PROGRESS;try{let n=await K(this.props);this.oneFeatureResponse=n,this.oneFeatureResponseStatus=u.SUCCESS}catch{this.oneFeatureResponseStatus=u.FAILED}if(t.type==="stream"){this.uniqueValuesStatus=u.FAILED,this.statisticsStatus=u.FAILED;return}if(a)this.uniqueValuesStatus=u.FAILED;else{this.uniqueValuesStatus=u.IN_PROGRESS;try{let n=await J(this.props);this.uniqueValues=n,n?.uniqueValueInfos?.length?this.uniqueValuesStatus=u.SUCCESS:this.uniqueValuesStatus=u.FAILED}catch{this.uniqueValuesStatus=u.FAILED}}if(a)this.statisticsStatus=u.FAILED;else{this.statisticsStatus=u.IN_PROGRESS;try{let n=await H(this.props);if(!g(n.totalCount)&&g(n.count)&&this.uniqueValuesStatus===u.SUCCESS){let o=this.uniqueValues?.uniqueValueInfos??[];for(let c=0;c<o.length;c++){let p=o[c];if(p.value===null){n.totalCount=p.count+n.count;break}}n.totalCount??=n.count}this.statistics=n,this.statisticsStatus=u.SUCCESS}catch{this.statisticsStatus=u.FAILED}}this.setUpTimeZoneHandle()}setUpTimeZoneHandle(){this.timeZoneHandle?.remove();let{props:e}=this,{view:t,fieldInfo:i}=e;[d.DATE,d.TIMESTAMP_OFFSET].includes(this._getStatisticsType(i))&&(this.timeZoneHandle=w.watch(()=>t?.timeZone,()=>{this.requestUpdate()}))}_getFieldTypeLabel(e){let{_messages:t}=this,i=t.fieldTypes;switch(e){case"big-integer":return i.bigInteger;case"date":return i.date;case"date-only":return i.dateOnly;case"double":return i.double;case"global-id":return i.globalId;case"guid":return i.guid;case"integer":return i.integer;case"long":return i.long;case"oid":return i.oid;case"single":return i.single;case"small-integer":return i.smallInteger;case"string":return i.string;case"time-only":return i.timeOnly;case"timestamp-offset":return i.timestampOffset;default:return i.string}}_getStatisticsType(e){switch(e.layerField.type){case"big-integer":case"double":case"integer":case"single":case"small-integer":{if(e.codedValues)return d.STRING;switch(e.layerField.valueType){case"binary":case"description":case"location-or-place-name":case"name-or-title":case"ordered-or-ranked":case"type-or-category":return d.STRING;default:return d.NUMBER}}case"date":return d.DATE;case"date-only":return d.DATE_ONLY;case"string":return d.STRING;case"time-only":return d.TIME_ONLY;case"timestamp-offset":return d.TIMESTAMP_OFFSET;default:return d.STRING}}_getFieldValueTypeCamelCase(e){switch(e.layerField.valueType){case"count-or-amount":return"countOrAmount";case"date-and-time":return"dateAndTime";case"location-or-place-name":return"locationOrPlaceName";case"name-or-title":return"nameOrTitle";case"ordered-or-ranked":return"orderedOrRanked";case"percentage-or-ratio":return"percentageOrRatio";case"type-or-category":return"typeOrCategory";case"unique-identifier":return"uniqueIdentifier";case"phone-number":return"phoneNumber";case"email-address":return"emailAddress";default:return e.layerField.valueType}}_getDisplayString(e,t){let{props:i}=this,{fieldInfo:a}=i;switch(a.simpleFieldType){case d.DATE:return this._getDateString(e,t);case d.DATE_ONLY:return this._getDateOnlyString(e,t);case d.GUID:return this._getGuidString(e);case d.NUMBER:return this._getNumberString(e,t);case d.TIME_ONLY:return this._getTimeOnlyString(e,t);case d.TIMESTAMP_OFFSET:return this._getTimestampOffsetString(e,t);default:return`${e}`}}_getDateString(e,t){let{view:i}=this.props;return i&&i.timeZone==="unknown"?y.formatDate(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:"utc"}):y.formatDate(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:i?.timeZone||"system"})}_getTimestampOffsetString(e,t){let{view:i}=this.props;return typeof e=="string"?i&&i.timeZone==="unknown"?y.formatTimestamp(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:"utc"}):y.formatTimestamp(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:i?.timeZone||"system"}):this._getDateString(e,t)}_getDateOnlyString(e,t){return y.formatDateOnly(e,this.getIntlDateTimeFormattingOptions("short-date",t))}_getTimeOnlyString(e,t){return typeof e=="string"?y.formatTimeOnly(e,this.getIntlDateTimeFormattingOptions("short-date-long-time",t)):y.formatDate(e,{...this.getIntlDateTimeFormattingOptions("long-time",{...t,isTimeOnly:!0}),timeZone:"utc"})}_getGuidString(e){return e.startsWith("{")?e:`{${e}}`}_getNumberString(e,t){let i=t?.useFieldFormatting?e:Math.round(e*100)/100;return y.formatNumber(i,this.getIntlNumberFormattingOptions(t))}_printNumValue(e,t){return g(e)?this._getNumberString(e,t):"--"}_setCompleteRef(){this.arcgisComplete.emit(),this.arcgisFieldInfoComplete.emit()}getCurrentFieldFormat(){let{props:e}=this,{layer:t,fieldName:i}=e;return(this.originalLayerSupportsFieldConfiguration()?t.getFieldConfiguration(i):void 0)?.fieldFormat}getIntlNumberFormattingOptions(e){let t=this.getCurrentFieldFormat();if(!e?.useFieldFormatting)return t?{useGrouping:["always","auto"].includes(t.useGrouping)}:y.convertNumberFormatToIntlOptions({digitSeparator:this.getPopupTemplateFieldInfo()?.format?.digitSeparator??!0});let i=t?{minimumFractionDigits:t.minimumFractionDigits,maximumFractionDigits:t.maximumFractionDigits,useGrouping:["always","auto"].includes(t.useGrouping)}:void 0;if(i)return i;let a=this.getPopupTemplateFieldInfo();return y.convertNumberFormatToIntlOptions({digitSeparator:a?.format?.digitSeparator??!0,places:a?.format?.places??2})}getIntlDateTimeFormattingOptions(e,t){let i=this.getCurrentFieldFormat();if(!t?.useFieldFormatting)return i?t?.isTimeOnly?W:Y:y.convertDateFormatToIntlOptions(e);let a=i?{dateStyle:t?.isTimeOnly?void 0:i.dateStyle??void 0,year:i.dateStyle?void 0:i.year??void 0,month:i.dateStyle?void 0:i.month??void 0,timeStyle:i.timeStyle??void 0,hourCycle:i.hour12==="never"?"h23":"h11"}:void 0;if(a)return a;let r=this.getPopupTemplateFieldInfo();return y.convertDateFormatToIntlOptions(r?.format?.dateFormat??e)}originalLayerSupportsFieldConfiguration(){let{layer:e}=this;return _(e)}getPopupTemplateFieldInfo(){let{props:e}=this,{layer:t,fieldName:i}=e;return("popupTemplate"in t?t.popupTemplate:void 0)?.fieldInfos?.find(a=>a.fieldName===i)}render(){return this._propWatcherTask.render({complete:()=>{let{props:e}=this,{fieldInfo:t}=e;return t?m`<div class="container">${this.renderFieldType()}${this.renderFieldAlias()}${this.renderFieldDescription()}${this.renderFieldValueType()}${this.renderFieldSampleValue()}${this.renderFieldNumericFormat()}${this.renderFieldStatistics()}</div>`:""},error:()=>""})}renderFieldType(){let{_messages:e,props:t}=this,{fieldInfo:i}=t,a=this._getFieldTypeLabel(i.layerField.type);return m`<div class="section"><div class="title">${e.fieldType}</div><div>${a}</div></div>`}renderFieldAlias(){let{_messages:e,props:t,hideAlias:i}=this,{fieldInfo:a}=t;return i?"":m`<div class="section"><div class="title">${e.fieldAlias}</div><div>${a.label}</div></div>`}renderFieldDescription(){let{_messages:e,props:t}=this,{layer:i}=t;if(i.type!=="feature")return"";let{fieldInfo:a}=t,r=a.layerField.description;return m`<div class="section"><div class="title">${e.fieldDescription}</div><div class=${F({missing:!r})}>${r||e.fieldDescriptionNotSet}</div></div>`}renderFieldValueType(){let{_messages:e,props:t}=this,{layer:i}=t;if(i.type!=="feature")return"";let{fieldInfo:a}=t,r=this._getFieldValueTypeCamelCase(a);return m`<div class="section"><div class="title">${e.fieldValueType}</div><div class=${F(r?"":"missing")}>${r?e.fieldValueTypes[r]:e.fieldValueTypeNotSet}</div></div>`}renderFieldSampleValue(){let{oneFeatureResponse:e,oneFeatureResponseStatus:t,statisticsStatus:i,statistics:a,uniqueValuesStatus:r,uniqueValues:n,_messages:o,props:c}=this,{layer:p,fieldName:l,fieldInfo:f}=c,{statistics:h}=o,v;if(["imagery-tile","voxel"].includes(p.type)||p.type!=="stream"&&[d.STRING,d.OID,d.GUID].includes(this._getStatisticsType(f))&&r!==u.FAILED)return"";t===u.SUCCESS?e.features.forEach(S=>{(v===void 0||v===null&&S.attributes[l]!==null)&&(v=S.attributes[l])}):i===u.SUCCESS?v=a?.min:r===u.SUCCESS&&(v=n?.uniqueValueInfos?.[0]?.value||n?.uniqueValueInfos?.[1]?.value);let V=f.codedValues;return g(v)&&(V?v=V.find(S=>v===S.code)?.name||v:v=this._getDisplayString(v,{useFieldFormatting:!0})),m`<div class="section"><div class="title">${o.fieldSampleValue}</div><div class=${F(t===u.FAILED&&i===u.FAILED&&r===u.FAILED||!g(v)?"missing":"")}>${t===u.SUCCESS||i===u.SUCCESS||r===u.SUCCESS?v?.toString()??h.allNulls:t===u.FAILED&&i===u.FAILED&&r===u.FAILED?o.fieldSampleNotAvailable:o.fieldSampleRetrieving}</div></div>`}renderFieldNumericFormat(){let{_messages:e,props:t,hideNumericFormat:i}=this,{fieldName:a,fieldInfo:r,layer:n}=t;if(i||!["double","long","single"].includes(r.layerField.type))return"";let o=this.originalLayerSupportsFieldConfiguration()?n.getFieldConfiguration(a):void 0;if(o?.fieldFormat){let{minimumFractionDigits:p,maximumFractionDigits:l}=o.fieldFormat;return m`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div>${e.fieldMinimumFractionDigits.replace("${number}",p.toString())}</div><div>${e.fieldMaximumFractionDigits.replace("${number}",l.toString())}</div></div>`}let c="popupTemplate"in n?n.popupTemplate:void 0;if(c?.fieldInfos){let p=c.fieldInfos?.filter(l=>l.fieldName===a);if(p?.length){let l=p[0];if(g(l?.format?.places)){let f=l.format.places;return m`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div>${e.fieldNumDecimalPlaces.replace("${number}",f.toString())}</div></div>`}}}return m`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div class="missing">${e.fieldDecimalPlacesNotAvailable}</div></div>`}renderFieldStatistics(){let{statisticsStatus:e,uniqueValuesStatus:t,hideStatistics:i,_messages:a,props:r}=this,{layer:n,fieldInfo:o}=r;return i?(this.arcgisComplete.emit(),this.arcgisFieldInfoComplete.emit(),""):["stream","imagery-tile","voxel"].includes(n.type)||["long"].includes(o.layerField.type)?(this.arcgisComplete.emit(),this.arcgisFieldInfoComplete.emit(),""):m`<div class="section"><div class="title">${a.fieldStatistics}</div>${!e||e===u.MISSING||e===u.IN_PROGRESS?T("field-info-statistics-content",m`<div class="missing">${a.fieldStatisticsRetrieving}</div>`):e===u.FAILED&&t!==u.SUCCESS?this.renderNoStatistics():T("field-info-statistics-content",m`<div ${D(this._setCompleteRef)}>${this.renderStatistics()}</div>`)}</div>`}renderNoStatistics(){let{_messages:e}=this;return T("field-info-statistics-content",m`<div class="missing" ${D(this._setCompleteRef)}>${e.fieldStatisticsNotAvailable}</div>`)}renderStatistics(){let{props:e}=this,{fieldInfo:t}=e;switch(this._getStatisticsType(t)){case d.NUMBER:return this.renderNumberStatistics();case d.GUID:case d.OID:case d.STRING:return this.renderStringStatistics();case d.DATE:case d.DATE_ONLY:case d.TIME_ONLY:case d.TIMESTAMP_OFFSET:return this.renderDateStatistics();default:return""}}renderNumberStatistics(){let{statistics:e,_messages:t}=this;if(!e)return this.renderNoStatistics();let{statistics:i}=t;return m`<div><div class="statistics-row"><div>${i.numberOfValues}</div><div class="data">${this._printNumValue(e.totalCount)}</div></div>${g(e.sum)?m`<div class="statistics-row"><div>${i.sumOfValues}</div><div class="data">${this._printNumValue(e.sum)}</div></div>`:null}${g(e.min)?m`<div class="statistics-row"><div>${i.minimum}</div><div class="data">${this._printNumValue(e.min)}</div></div>`:null}${g(e.max)?m`<div class="statistics-row"><div>${i.maximum}</div><div class="data">${this._printNumValue(e.max)}</div></div>`:null}${g(e.avg)?m`<div class="statistics-row"><div>${i.average}</div><div class="data">${this._printNumValue(e.avg)}</div></div>`:null}${g(e.stddev)?m`<div class="statistics-row"><div>${i.standardDeviation}</div><div class="data">${this._printNumValue(e.stddev)}</div></div>`:null}${this.renderNullValues()}</div>`}renderStringStatistics(){let{statistics:e,uniqueValuesStatus:t,_messages:i}=this,{statistics:a}=i;return m`<div><div class="statistics-row"><div>${a.numberOfValues}</div>${t!==u.SUCCESS?m`<div class="missing">--</div>`:m`<div class="data">${this._printNumValue(e?.totalCount)}</div>`}</div>${this.renderNullValues()}${this.renderTopValues()}</div>`}renderDateStatistics(){let{statistics:e,view:t,props:i,_messages:a}=this,{fieldInfo:r}=i;if(!e||!g(e.max)||!g(e.min))return this.renderNoStatistics();let{statistics:n}=a,o=e.max-e.min,c=Math.floor(o/31536e6),p=Math.floor((o-c*31536e6)/2628e6),l=Math.ceil((o-p*2628e6)/864e5);l>=30&&(p+=1,l=0);let f=c===1?n.timeSpanOptions.year:c>1?n.timeSpanOptions.years.replace("${years}",c.toString()):"";f+=c>0&&(p>0||l>0)?", ":"",f+=p===1?n.timeSpanOptions.month:p>1?n.timeSpanOptions.months.replace("${months}",p.toString()):"",f+=p>0&&l>0?", ":"",f+=l===1?n.timeSpanOptions.day:l>1?n.timeSpanOptions.days.replace("${days}",l.toString()):"";let h=r.simpleFieldType!==d.TIMESTAMP_OFFSET||!t||t.timeZone!=="unknown",v=r.simpleFieldType===d.TIME_ONLY;return m`<div><div class="statistics-row"><div>${n.numberOfValues}</div><div class="data">${this._printNumValue(e?.totalCount)}</div></div>${h&&g(e.min)?m`<div class="statistics-row"><div>${v?n.minimumTime:n.minimumDate}</div><div class="data">${this._getDisplayString(e.min)}</div></div>`:null}${h&&g(e.max)?m`<div class="statistics-row"><div>${v?n.maximumTime:n.maximumDate}</div><div class="data">${this._getDisplayString(e.max)}</div></div>`:null}${h&&g(e.avg)?m`<div class="statistics-row"><div>${v?n.averageTime:n.averageDate}</div><div class="data">${this._getDisplayString(e.avg)}</div></div>`:null}${h&&!v&&g(e.min)&&g(e.max)&&o>0?m`<div class="statistics-row"><div>${n.timespan}</div><div class="data">${f}</div></div>`:null}${this.renderNullValues()}</div>`}renderTopValues(){let{uniqueValues:e,uniqueValuesStatus:t,_messages:i,props:a}=this,{fieldInfo:r}=a,{statistics:n}=i;if(e?.uniqueValueInfos?.length){let o=e.uniqueValueInfos;o.sort((l,f)=>l.count<f.count?1:l.count>f.count?-1:0);let c=r.codedValues,p=o.filter(l=>l.value!==null).filter((l,f)=>l&&f<10).map(l=>{let f=l.value;return c?c.forEach(h=>{f===h.code&&(f=h.name)}):f=this._getDisplayString(f),m`<div class="statistics-row"><div class="data">${`${f}`}</div><div class="count">${this._printNumValue(l.count)}</div></div>`});return p.length?m`<div><div class="statistics-row-top-values"><div>${o.length>10?n.topTenValues:n.topValues}</div><div>${n.count}</div></div>${p}</div>`:""}else return m`<div><div class="statistics-row-top-values"><div>${n.topValues}</div><div>${n.count}</div></div><div class="statistics-row"><div class="missing">${t===u.FAILED?i.fieldUniqueValuesNotAvailable:i.fieldSampleRetrieving}</div></div></div>`}renderNullValues(){let{statistics:e,uniqueValues:t,_messages:i}=this,{statistics:a}=i,r=e?.nullcount;if(!g(r)&&t){let n=t.uniqueValueInfos;for(let o=0;o<n.length;o++){let c=n[o];if(c.value===null){r=c.count;break}}}return m`<div class="statistics-row"><div>${a.numberOfNulls}</div>${g(r)?m`<div class="data">${this._printNumValue(r)}</div>`:m`<div class="missing">--</div>`}</div>`}};L("arcgis-field-info",O);return O},"config","core/reactiveUtils","intl","core/lang","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/support/Query")
3
+ v5.0.0-next.125 */
4
+ import{a as R,c as _}from"./S3P7GTZF.js";import{a as T}from"./PAH5NEYW.js";import{b as q}from"./M5JGIZYS.js";import"./4CRBTYNF.js";import{A as D,B as A,C as F,H as L,g as C,i as m,m as N,n as $,q as E}from"./UIGZUM56.js";export default $arcgis.t(([G,w,y,I,P,U,k])=>{var u=(s=>(s.MISSING="missing",s.IN_PROGRESS="inProgress",s.SUCCESS="success",s.FAILED="failed",s))(u||{}),d=(s=>(s.DATE="date",s.DATE_ONLY="date-only",s.GUID="guid",s.NUMBER="number",s.OID="oid",s.STRING="string",s.TIME_ONLY="time-only",s.TIMESTAMP_OFFSET="timestamp-offset",s.UNKNOWN="unknown",s))(d||{});function g(s){return s!=null}function Z(s){return s.type==="scene"?s.associatedLayer?.url:s.url}var Y={dateStyle:"short",timeStyle:"short"},W={timeStyle:"medium"};function B(s){let{layer:e,fieldName:t}=s,i,a=_(e),r;"popupTemplate"in e&&(r=e.popupTemplate);let n=r?r.fieldInfos:[];return x(s)?.filter(o=>o.name===t).forEach(o=>{let c=!a&&n?n.filter(f=>f.fieldName===o.name):null,p=a?e.getFieldAlias(t):c?.length?c[0].label:o.alias;/^raster.(item|service)pixelvalue/iu.test(t)&&(o.type="double");let l={layerField:o,label:p||o.name};l.codedValues=j(t,s),Q(l),l.simpleFieldType&&(i=l)}),i}function x(s){let{layer:e}=s;return e.type==="imagery-tile"||e.type==="wcs"||e.type==="imagery"&&e.rasterFields.length?e.rasterFields:e.fields}async function M(s){s.statisticsStatus=u.IN_PROGRESS;let{layer:e,view:t}=s;if(e.type==="imagery-tile"||e.type==="wcs"||e.type==="stream"||e.type==="voxel")throw new Error("could not get feature count");try{return await z(e,t)}catch{return}}async function H(s){let{layer:e,view:t,fieldName:i,fieldInfo:a}=s;if(e.type==="imagery-tile"||e.type==="wcs"||e.type==="voxel")throw new Error("could not get statistics for ImageryTileLayer/WCSLayer/VoxelLayer");if(!a||a.layerField.type==="oid"||a.layerField.type==="guid"||a.layerField.type==="global-id")return{totalCount:await M(s),nullcount:0};try{let r=await P({layer:e,view:t,field:i,outStatisticTypes:{exclude:["median"]}});if(!g(r.count))throw new Error("could not get statistics");let n="sourceJSON"in e&&e.sourceJSON.maxRecordCount===r.count;if(g(r.nullcount)&&!n)return{...r,totalCount:r.count+r.nullcount};{let o=await M(s);return{...r,totalCount:o}}}catch{throw new Error("could not get statistics")}}async function J(s){let{layer:e,view:t,fieldName:i}=s;if(e.type==="imagery-tile"||e.type==="wcs"||e.type==="voxel")throw new Error("could not get unique values for ImageryLayer/ImageryTileLayer/WCSLayer/VoxelLayer");e.type==="feature"&&!e.url&&(e.outFields=["*"]);try{return await U({layer:e,view:t,field:i})}catch{throw new Error("could not get unique values")}}function Q(s){switch(s.layerField.type){case"string":s.simpleFieldType=d.STRING;break;case"date":s.simpleFieldType=d.DATE;break;case"timestamp-offset":s.simpleFieldType=d.TIMESTAMP_OFFSET;break;case"date-only":s.simpleFieldType=d.DATE_ONLY;break;case"time-only":s.simpleFieldType=d.TIME_ONLY;break;case"oid":s.simpleFieldType=d.OID;break;case"guid":case"global-id":s.simpleFieldType=d.GUID;break;case"small-integer":case"big-integer":case"integer":case"single":case"double":case"long":s.simpleFieldType=d.NUMBER;break}}function j(s,e){let{layer:t}=e;if(t.type==="subtype-sublayer"&&t.subtypeField===s){let c=t.parent?.subtypes?.find(p=>p.code===t.subtypeCode);if(c)return[{code:c.code,name:c.name}]}if(t.type!=="feature"&&t.type!=="imagery")return;let i=t.type==="feature"?t.typeIdField:void 0,a=t.type==="feature"?t.types:void 0,r,n=x(e)?.find(c=>c.name===s),o=n?.domain;return t.type==="feature"&&i&&a?(i===s?r=a.map(c=>({code:c.id,name:c.name})):(r=[],a.forEach(c=>{if(!c.domains[s]||c.domains[s].type==="inherited"){let p=o;p?.codedValues&&p.codedValues.forEach(async l=>{let f=!1;r.forEach(h=>{h.code===l.code&&(f=!0,`, ${h.name},`.includes(`, ${l.name},`)||(h.name+=`, ${l.name}`))}),f||r.push(I.clone(l))})}else c.domains[s].codedValues&&c.domains[s].codedValues.forEach(async p=>{let l=!1;r.forEach(f=>{f.code===p.code&&(l=!0,`, ${f.name},`.includes(`, ${p.name},`)||(f.name+=`, ${p.name}`))}),l||r.push(I.clone(p))})})),!r.length&&o?.codedValues&&(r=I.clone(o.codedValues))):o?.codedValues&&(r=n.domain.codedValues),r?.length?r:null}async function K(s){let{view:e,layer:t}=s;if(t.type==="imagery"||t.type==="imagery-tile"||t.type==="wcs")throw new Error("could not get feature");if(t.type==="feature"&&!t.url||t.type==="wfs"){let i=t.createQuery();i.start=0,i.num=5,i.outFields=["*"];let a=await t.queryFeatures(i);if(a.features.length)return a;throw new Error("could not get feature")}else{if(!e)return await b(s);let i;if(t.type==="subtype-sublayer"||t.type==="sublayer"){let a=t.parent;for(;["subtype-group","map-image"].includes(a.type);)a=a.parent;i=await e.whenLayerView(a)}else i=await e.whenLayerView(t);if(i.availableFields.length===t.fields.length||["stream","ogc-feature"].includes(t.type)&&i.availableFields.length>0){let a=t.createQuery();a.start=0,a.num=5,a.outFields=["*"];let r=await i.queryFeatures(a);return r.features?.length?r:await b(s)}else return await b(s)}}async function b(s){let{layer:e}=s;if(["imagery","imagery-tile","stream","ogc-feature"].includes(e.type))throw new Error("cannot get feature from service");let t=new k({where:"1=1",outFields:["*"],returnGeometry:!1});return"sourceJSON"in e&&e.sourceJSON?.advancedQueryCapabilities?.supportsPagination&&(t.num=1),await e.queryFeatures(t)}async function z(s,e){if(s.type==="feature"&&!s.url)return await X(s);if(s.type==="feature"||s.type==="csv"||s.type==="scene"||s.type==="wfs"||s.type==="geojson")return await s.queryFeatureCount();if(e&&(s.type==="stream"||s.type==="ogc-feature"))return await ee(s,e)}async function X(s){let e=s.createQuery();e.outFields=["*"];let t=await s.queryFeatures(e);if(t.features.length)return t.features.length;throw new Error("could not get feature count")}async function ee(s,e){return await(await e.whenLayerView(s)).queryFeatureCount()}var te=C`:host{height:100%}.container{padding:var(--calcite-space-xs);background-color:var(--calcite-color-foreground-1)}.title{font-weight:700;padding:5px 0}.missing,.data{color:#a9a9a9}.count{white-space:nowrap}.section{padding:var(--calcite-space-xs) 0}.statistics-row{border-top:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);padding:var(--calcite-space-xs) 0;display:flex;justify-content:space-between}.statistics-row-top-values{border-top:var(--calcite-border-width-sm) solid var(--calctie-color-border-2);padding:20px 0 var(--calcite-space-xs) 0;display:flex;justify-content:space-between}`,O=class extends A{constructor(){super(...arguments),this._messages=q({blocking:!0}),this._propWatcherTask=new R(this,{task:async([e,t])=>{let i=g(e)&&g(t);if(g(e)||N("error",this,$("layer")),g(t)||N("error",this,$("fieldName")),!i)throw new Error;await this.processProps(),this._propWatcherTask.autoRun=!1},args:()=>[this.layer,this.fieldName]}),this.oneFeatureResponseStatus=u.MISSING,this.statisticsStatus=u.MISSING,this.uniqueValuesStatus=u.MISSING,this.hideAlias=!1,this.hideNumericFormat=!1,this.hideStatistics=!1,this.arcgisComplete=E(),this.arcgisFieldInfoComplete=E()}static{this.properties={oneFeatureResponseStatus:16,oneFeatureResponse:16,statisticsStatus:16,statistics:16,uniqueValuesStatus:16,uniqueValues:16,view:0,layer:0,fieldName:1,hideAlias:5,hideNumericFormat:5,hideStatistics:5}}static{this.styles=te}async refresh(){await this.processProps(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.timeZoneHandle?.remove()}async processProps(){let{view:e,layer:t,fieldName:i,hideStatistics:a}=this;if(!t||!i)return;let r;if(t.declaredClass==="esri.layers.support.Sublayer"){let n=t;e&&await w.whenOnce(()=>!e.updating),r=await n.createFeatureLayer(),await r?.load()}this.props={view:e,layer:r??t,fieldName:i,hideStatistics:a},this.props.fieldInfo=B(this.props),t.type==="scene"&&G.request.interceptors?.push({urls:`${Z(t)}/${t.layerId}`,before(n){n.requestOptions.authMode="no-prompt"}}),this.oneFeatureResponseStatus=u.IN_PROGRESS;try{let n=await K(this.props);this.oneFeatureResponse=n,this.oneFeatureResponseStatus=u.SUCCESS}catch{this.oneFeatureResponseStatus=u.FAILED}if(t.type==="stream"){this.uniqueValuesStatus=u.FAILED,this.statisticsStatus=u.FAILED;return}if(a)this.uniqueValuesStatus=u.FAILED;else{this.uniqueValuesStatus=u.IN_PROGRESS;try{let n=await J(this.props);this.uniqueValues=n,n?.uniqueValueInfos?.length?this.uniqueValuesStatus=u.SUCCESS:this.uniqueValuesStatus=u.FAILED}catch{this.uniqueValuesStatus=u.FAILED}}if(a)this.statisticsStatus=u.FAILED;else{this.statisticsStatus=u.IN_PROGRESS;try{let n=await H(this.props);if(!g(n.totalCount)&&g(n.count)&&this.uniqueValuesStatus===u.SUCCESS){let o=this.uniqueValues?.uniqueValueInfos??[];for(let c=0;c<o.length;c++){let p=o[c];if(p.value===null){n.totalCount=p.count+n.count;break}}n.totalCount??=n.count}this.statistics=n,this.statisticsStatus=u.SUCCESS}catch{this.statisticsStatus=u.FAILED}}this.setUpTimeZoneHandle()}setUpTimeZoneHandle(){this.timeZoneHandle?.remove();let{props:e}=this,{view:t,fieldInfo:i}=e;[d.DATE,d.TIMESTAMP_OFFSET].includes(this._getStatisticsType(i))&&(this.timeZoneHandle=w.watch(()=>t?.timeZone,()=>{this.requestUpdate()}))}_getFieldTypeLabel(e){let{_messages:t}=this,i=t.fieldTypes;switch(e){case"big-integer":return i.bigInteger;case"date":return i.date;case"date-only":return i.dateOnly;case"double":return i.double;case"global-id":return i.globalId;case"guid":return i.guid;case"integer":return i.integer;case"long":return i.long;case"oid":return i.oid;case"single":return i.single;case"small-integer":return i.smallInteger;case"string":return i.string;case"time-only":return i.timeOnly;case"timestamp-offset":return i.timestampOffset;default:return i.string}}_getStatisticsType(e){switch(e.layerField.type){case"big-integer":case"double":case"integer":case"single":case"small-integer":{if(e.codedValues)return d.STRING;switch(e.layerField.valueType){case"binary":case"description":case"location-or-place-name":case"name-or-title":case"ordered-or-ranked":case"type-or-category":return d.STRING;default:return d.NUMBER}}case"date":return d.DATE;case"date-only":return d.DATE_ONLY;case"string":return d.STRING;case"time-only":return d.TIME_ONLY;case"timestamp-offset":return d.TIMESTAMP_OFFSET;default:return d.STRING}}_getFieldValueTypeCamelCase(e){switch(e.layerField.valueType){case"count-or-amount":return"countOrAmount";case"date-and-time":return"dateAndTime";case"location-or-place-name":return"locationOrPlaceName";case"name-or-title":return"nameOrTitle";case"ordered-or-ranked":return"orderedOrRanked";case"percentage-or-ratio":return"percentageOrRatio";case"type-or-category":return"typeOrCategory";case"unique-identifier":return"uniqueIdentifier";case"phone-number":return"phoneNumber";case"email-address":return"emailAddress";default:return e.layerField.valueType}}_getDisplayString(e,t){let{props:i}=this,{fieldInfo:a}=i;switch(a.simpleFieldType){case d.DATE:return this._getDateString(e,t);case d.DATE_ONLY:return this._getDateOnlyString(e,t);case d.GUID:return this._getGuidString(e);case d.NUMBER:return this._getNumberString(e,t);case d.TIME_ONLY:return this._getTimeOnlyString(e,t);case d.TIMESTAMP_OFFSET:return this._getTimestampOffsetString(e,t);default:return`${e}`}}_getDateString(e,t){let{view:i}=this.props;return i&&i.timeZone==="unknown"?y.formatDate(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:"utc"}):y.formatDate(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:i?.timeZone||"system"})}_getTimestampOffsetString(e,t){let{view:i}=this.props;return typeof e=="string"?i&&i.timeZone==="unknown"?y.formatTimestamp(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:"utc"}):y.formatTimestamp(e,{...this.getIntlDateTimeFormattingOptions("short-date-short-time",t),timeZone:i?.timeZone||"system"}):this._getDateString(e,t)}_getDateOnlyString(e,t){return y.formatDateOnly(e,this.getIntlDateTimeFormattingOptions("short-date",t))}_getTimeOnlyString(e,t){return typeof e=="string"?y.formatTimeOnly(e,this.getIntlDateTimeFormattingOptions("short-date-long-time",t)):y.formatDate(e,{...this.getIntlDateTimeFormattingOptions("long-time",{...t,isTimeOnly:!0}),timeZone:"utc"})}_getGuidString(e){return e.startsWith("{")?e:`{${e}}`}_getNumberString(e,t){let i=t?.useFieldFormatting?e:Math.round(e*100)/100;return y.formatNumber(i,this.getIntlNumberFormattingOptions(t))}_printNumValue(e,t){return g(e)?this._getNumberString(e,t):"--"}_setCompleteRef(){this.arcgisComplete.emit(),this.arcgisFieldInfoComplete.emit()}getCurrentFieldFormat(){let{props:e}=this,{layer:t,fieldName:i}=e;return(this.originalLayerSupportsFieldConfiguration()?t.getFieldConfiguration(i):void 0)?.fieldFormat}getIntlNumberFormattingOptions(e){let t=this.getCurrentFieldFormat();if(!e?.useFieldFormatting)return t?{useGrouping:["always","auto"].includes(t.useGrouping)}:y.convertNumberFormatToIntlOptions({digitSeparator:this.getPopupTemplateFieldInfo()?.format?.digitSeparator??!0});let i=t?{minimumFractionDigits:t.minimumFractionDigits,maximumFractionDigits:t.maximumFractionDigits,useGrouping:["always","auto"].includes(t.useGrouping)}:void 0;if(i)return i;let a=this.getPopupTemplateFieldInfo();return y.convertNumberFormatToIntlOptions({digitSeparator:a?.format?.digitSeparator??!0,places:a?.format?.places??2})}getIntlDateTimeFormattingOptions(e,t){let i=this.getCurrentFieldFormat();if(!t?.useFieldFormatting)return i?t?.isTimeOnly?W:Y:y.convertDateFormatToIntlOptions(e);let a=i?{dateStyle:t?.isTimeOnly?void 0:i.dateStyle??void 0,year:i.dateStyle?void 0:i.year??void 0,month:i.dateStyle?void 0:i.month??void 0,timeStyle:i.timeStyle??void 0,hourCycle:i.hour12==="never"?"h23":"h11"}:void 0;if(a)return a;let r=this.getPopupTemplateFieldInfo();return y.convertDateFormatToIntlOptions(r?.format?.dateFormat??e)}originalLayerSupportsFieldConfiguration(){let{layer:e}=this;return _(e)}getPopupTemplateFieldInfo(){let{props:e}=this,{layer:t,fieldName:i}=e;return("popupTemplate"in t?t.popupTemplate:void 0)?.fieldInfos?.find(a=>a.fieldName===i)}render(){return this._propWatcherTask.render({complete:()=>{let{props:e}=this,{fieldInfo:t}=e;return t?m`<div class="container">${this.renderFieldType()}${this.renderFieldAlias()}${this.renderFieldDescription()}${this.renderFieldValueType()}${this.renderFieldSampleValue()}${this.renderFieldNumericFormat()}${this.renderFieldStatistics()}</div>`:""},error:()=>""})}renderFieldType(){let{_messages:e,props:t}=this,{fieldInfo:i}=t,a=this._getFieldTypeLabel(i.layerField.type);return m`<div class="section"><div class="title">${e.fieldType}</div><div>${a}</div></div>`}renderFieldAlias(){let{_messages:e,props:t,hideAlias:i}=this,{fieldInfo:a}=t;return i?"":m`<div class="section"><div class="title">${e.fieldAlias}</div><div>${a.label}</div></div>`}renderFieldDescription(){let{_messages:e,props:t}=this,{layer:i}=t;if(i.type!=="feature")return"";let{fieldInfo:a}=t,r=a.layerField.description;return m`<div class="section"><div class="title">${e.fieldDescription}</div><div class=${F({missing:!r})}>${r||e.fieldDescriptionNotSet}</div></div>`}renderFieldValueType(){let{_messages:e,props:t}=this,{layer:i}=t;if(i.type!=="feature")return"";let{fieldInfo:a}=t,r=this._getFieldValueTypeCamelCase(a);return m`<div class="section"><div class="title">${e.fieldValueType}</div><div class=${F(r?"":"missing")}>${r?e.fieldValueTypes[r]:e.fieldValueTypeNotSet}</div></div>`}renderFieldSampleValue(){let{oneFeatureResponse:e,oneFeatureResponseStatus:t,statisticsStatus:i,statistics:a,uniqueValuesStatus:r,uniqueValues:n,_messages:o,props:c}=this,{layer:p,fieldName:l,fieldInfo:f}=c,{statistics:h}=o,v;if(["imagery-tile","voxel"].includes(p.type)||p.type!=="stream"&&[d.STRING,d.OID,d.GUID].includes(this._getStatisticsType(f))&&r!==u.FAILED)return"";t===u.SUCCESS?e.features.forEach(S=>{(v===void 0||v===null&&S.attributes[l]!==null)&&(v=S.attributes[l])}):i===u.SUCCESS?v=a?.min:r===u.SUCCESS&&(v=n?.uniqueValueInfos?.[0]?.value||n?.uniqueValueInfos?.[1]?.value);let V=f.codedValues;return g(v)&&(V?v=V.find(S=>v===S.code)?.name||v:v=this._getDisplayString(v,{useFieldFormatting:!0})),m`<div class="section"><div class="title">${o.fieldSampleValue}</div><div class=${F(t===u.FAILED&&i===u.FAILED&&r===u.FAILED||!g(v)?"missing":"")}>${t===u.SUCCESS||i===u.SUCCESS||r===u.SUCCESS?v?.toString()??h.allNulls:t===u.FAILED&&i===u.FAILED&&r===u.FAILED?o.fieldSampleNotAvailable:o.fieldSampleRetrieving}</div></div>`}renderFieldNumericFormat(){let{_messages:e,props:t,hideNumericFormat:i}=this,{fieldName:a,fieldInfo:r,layer:n}=t;if(i||!["double","long","single"].includes(r.layerField.type))return"";let o=this.originalLayerSupportsFieldConfiguration()?n.getFieldConfiguration(a):void 0;if(o?.fieldFormat){let{minimumFractionDigits:p,maximumFractionDigits:l}=o.fieldFormat;return m`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div>${e.fieldMinimumFractionDigits.replace("${number}",p.toString())}</div><div>${e.fieldMaximumFractionDigits.replace("${number}",l.toString())}</div></div>`}let c="popupTemplate"in n?n.popupTemplate:void 0;if(c?.fieldInfos){let p=c.fieldInfos?.filter(l=>l.fieldName===a);if(p?.length){let l=p[0];if(g(l?.format?.places)){let f=l.format.places;return m`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div>${e.fieldNumDecimalPlaces.replace("${number}",f.toString())}</div></div>`}}}return m`<div class="section"><div class="title">${e.fieldDecimalPlaces}</div><div class="missing">${e.fieldDecimalPlacesNotAvailable}</div></div>`}renderFieldStatistics(){let{statisticsStatus:e,uniqueValuesStatus:t,hideStatistics:i,_messages:a,props:r}=this,{layer:n,fieldInfo:o}=r;return i?(this.arcgisComplete.emit(),this.arcgisFieldInfoComplete.emit(),""):["stream","imagery-tile","voxel"].includes(n.type)||["long"].includes(o.layerField.type)?(this.arcgisComplete.emit(),this.arcgisFieldInfoComplete.emit(),""):m`<div class="section"><div class="title">${a.fieldStatistics}</div>${!e||e===u.MISSING||e===u.IN_PROGRESS?T("field-info-statistics-content",m`<div class="missing">${a.fieldStatisticsRetrieving}</div>`):e===u.FAILED&&t!==u.SUCCESS?this.renderNoStatistics():T("field-info-statistics-content",m`<div ${D(this._setCompleteRef)}>${this.renderStatistics()}</div>`)}</div>`}renderNoStatistics(){let{_messages:e}=this;return T("field-info-statistics-content",m`<div class="missing" ${D(this._setCompleteRef)}>${e.fieldStatisticsNotAvailable}</div>`)}renderStatistics(){let{props:e}=this,{fieldInfo:t}=e;switch(this._getStatisticsType(t)){case d.NUMBER:return this.renderNumberStatistics();case d.GUID:case d.OID:case d.STRING:return this.renderStringStatistics();case d.DATE:case d.DATE_ONLY:case d.TIME_ONLY:case d.TIMESTAMP_OFFSET:return this.renderDateStatistics();default:return""}}renderNumberStatistics(){let{statistics:e,_messages:t}=this;if(!e)return this.renderNoStatistics();let{statistics:i}=t;return m`<div><div class="statistics-row"><div>${i.numberOfValues}</div><div class="data">${this._printNumValue(e.totalCount)}</div></div>${g(e.sum)?m`<div class="statistics-row"><div>${i.sumOfValues}</div><div class="data">${this._printNumValue(e.sum)}</div></div>`:null}${g(e.min)?m`<div class="statistics-row"><div>${i.minimum}</div><div class="data">${this._printNumValue(e.min)}</div></div>`:null}${g(e.max)?m`<div class="statistics-row"><div>${i.maximum}</div><div class="data">${this._printNumValue(e.max)}</div></div>`:null}${g(e.avg)?m`<div class="statistics-row"><div>${i.average}</div><div class="data">${this._printNumValue(e.avg)}</div></div>`:null}${g(e.stddev)?m`<div class="statistics-row"><div>${i.standardDeviation}</div><div class="data">${this._printNumValue(e.stddev)}</div></div>`:null}${this.renderNullValues()}</div>`}renderStringStatistics(){let{statistics:e,uniqueValuesStatus:t,_messages:i}=this,{statistics:a}=i;return m`<div><div class="statistics-row"><div>${a.numberOfValues}</div>${t!==u.SUCCESS?m`<div class="missing">--</div>`:m`<div class="data">${this._printNumValue(e?.totalCount)}</div>`}</div>${this.renderNullValues()}${this.renderTopValues()}</div>`}renderDateStatistics(){let{statistics:e,view:t,props:i,_messages:a}=this,{fieldInfo:r}=i;if(!e||!g(e.max)||!g(e.min))return this.renderNoStatistics();let{statistics:n}=a,o=e.max-e.min,c=Math.floor(o/31536e6),p=Math.floor((o-c*31536e6)/2628e6),l=Math.ceil((o-p*2628e6)/864e5);l>=30&&(p+=1,l=0);let f=c===1?n.timeSpanOptions.year:c>1?n.timeSpanOptions.years.replace("${years}",c.toString()):"";f+=c>0&&(p>0||l>0)?", ":"",f+=p===1?n.timeSpanOptions.month:p>1?n.timeSpanOptions.months.replace("${months}",p.toString()):"",f+=p>0&&l>0?", ":"",f+=l===1?n.timeSpanOptions.day:l>1?n.timeSpanOptions.days.replace("${days}",l.toString()):"";let h=r.simpleFieldType!==d.TIMESTAMP_OFFSET||!t||t.timeZone!=="unknown",v=r.simpleFieldType===d.TIME_ONLY;return m`<div><div class="statistics-row"><div>${n.numberOfValues}</div><div class="data">${this._printNumValue(e?.totalCount)}</div></div>${h&&g(e.min)?m`<div class="statistics-row"><div>${v?n.minimumTime:n.minimumDate}</div><div class="data">${this._getDisplayString(e.min)}</div></div>`:null}${h&&g(e.max)?m`<div class="statistics-row"><div>${v?n.maximumTime:n.maximumDate}</div><div class="data">${this._getDisplayString(e.max)}</div></div>`:null}${h&&g(e.avg)?m`<div class="statistics-row"><div>${v?n.averageTime:n.averageDate}</div><div class="data">${this._getDisplayString(e.avg)}</div></div>`:null}${h&&!v&&g(e.min)&&g(e.max)&&o>0?m`<div class="statistics-row"><div>${n.timespan}</div><div class="data">${f}</div></div>`:null}${this.renderNullValues()}</div>`}renderTopValues(){let{uniqueValues:e,uniqueValuesStatus:t,_messages:i,props:a}=this,{fieldInfo:r}=a,{statistics:n}=i;if(e?.uniqueValueInfos?.length){let o=e.uniqueValueInfos;o.sort((l,f)=>l.count<f.count?1:l.count>f.count?-1:0);let c=r.codedValues,p=o.filter(l=>l.value!==null).filter((l,f)=>l&&f<10).map(l=>{let f=l.value;return c?c.forEach(h=>{f===h.code&&(f=h.name)}):f=this._getDisplayString(f),m`<div class="statistics-row"><div class="data">${`${f}`}</div><div class="count">${this._printNumValue(l.count)}</div></div>`});return p.length?m`<div><div class="statistics-row-top-values"><div>${o.length>10?n.topTenValues:n.topValues}</div><div>${n.count}</div></div>${p}</div>`:""}else return m`<div><div class="statistics-row-top-values"><div>${n.topValues}</div><div>${n.count}</div></div><div class="statistics-row"><div class="missing">${t===u.FAILED?i.fieldUniqueValuesNotAvailable:i.fieldSampleRetrieving}</div></div></div>`}renderNullValues(){let{statistics:e,uniqueValues:t,_messages:i}=this,{statistics:a}=i,r=e?.nullcount;if(!g(r)&&t){let n=t.uniqueValueInfos;for(let o=0;o<n.length;o++){let c=n[o];if(c.value===null){r=c.count;break}}}return m`<div class="statistics-row"><div>${a.numberOfNulls}</div>${g(r)?m`<div class="data">${this._printNumValue(r)}</div>`:m`<div class="missing">--</div>`}</div>`}};L("arcgis-field-info",O);return O},"config","core/reactiveUtils","intl","core/lang","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/support/Query")
@@ -1,4 +1,4 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.124 */
4
- import{a as E}from"./EA5DSTV6.js";import{a as n}from"./PJISHDGP.js";import{b as k}from"./JJ2Y4N2K.js";import{e as f}from"./55APDMBW.js";import{A as l,B as w,H as v,g as C,i,j as u,l as m,q as r,z as g}from"./UBB6IHIQ.js";function y(a,e,t){window.localStorage.setItem(a,JSON.stringify(e))}function S(a,e){let t=window.localStorage.getItem(a);return t&&e?JSON.parse(t):t}var R=C`:host,arcgis-picker-input{display:block}.color-picker-container{display:flex;flex-direction:column}.color-picker{--calcite-color-border-1: transparent;overflow-x:hidden}.preview-swatch{width:100%;height:24px}.recent-colors-container{align-items:center;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-input);display:flex;gap:var(--calcite-space-sm);height:32px;padding:0 var(--calcite-space-xs);transition:outline-offset .1s ease-in-out,outline-color .1s ease-in-out}.preview-recent-swatch{cursor:pointer}.recent-colors-container:focus,.preview-recent-swatch:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-brand);outline-offset:var(--calcite-border-width-md)}.empty-swatch{cursor:default}.end-action{display:flex}`,h=class extends w{constructor(){super(),this._messages=k(),this.actionEl=g(),this.setRecentColorElement=e=>t=>{switch(e){case 1:this.recentColor1El=t;break;case 2:this.recentColor2El=t;break;default:this.recentColor3El=t}},this.recentColors=[],this.clearable=!1,this.compact=!1,this.disabled=!1,this.placement="auto",this.storageId="arcgis-color-input-storage-colors",this.hideRecentColors=!1,this.showTransparency=!1,this.arcgisChange=r(),this.arcgisColorInputChange=r(),this.arcgisColorInputPopoverClose=r(),this.arcgisColorInputPopoverOpen=r(),this.arcgisColorInputSwatchUpdate=r(),this.arcgisInternalStoredColor=r(),this.arcgisPickerClose=r(),this.arcgisPickerOpen=r(),this.arcgisSwatchUpdate=r(),this.listenOn(document,"arcgisInternalStoredColor",this.handleUpdateRecentColors),this.listenOn(document,"arcgisRecentColorsUpdate",this.handleStoreNewRecentColor)}static{this.properties={recentColors:16,clearable:5,color:1,compact:5,disabled:5,messageOverrides:0,placement:1,popoverProps:0,storageId:1,hideRecentColors:5,showTransparency:5}}static{this.styles=R}async close(){await this.inlineInputEl?.close()}async setFocus(){await this.inlineInputEl?.setFocus()}load(){this.setRecentColorsFromStorage()}disconnectedCallback(){super.disconnectedCallback(),this.removeTooltip()}async handleOpen(){await this.colorPickerEl?.setFocus(),this.arcgisPickerOpen.emit(),this.arcgisColorInputPopoverOpen.emit()}setInlineInputRef(e){this.inlineInputEl=e}setColorPickerRef(e){e&&(this.colorPickerEl=e)}getRecentColorElement(e){switch(e){case 1:return this.recentColor1El;case 2:return this.recentColor2El;default:return this.recentColor3El}}setRecentColorsFromStorage(){let e=S(this.storageId,!0);e&&(this.recentColors=[...e])}handleSwatchClickOrKeyUp(e){if("key"in e&&e.key!=="Enter"&&e.key!=="Space")return;let t=e.currentTarget.color||void 0;this.updateColor(t),this.arcgisSwatchUpdate.emit(t),this.arcgisColorInputSwatchUpdate.emit(t),setTimeout(()=>this.recentColor1El?.focus(),200)}handleRecentColorsKeyDown(e){if(this.recentColors.length===1)return;let t=e.key,o;this.activeColorSwatchEl===this.recentColor1El?o=1:this.activeColorSwatchEl===this.recentColor2El?o=2:this.activeColorSwatchEl===this.recentColor3El&&(o=3),t==="ArrowLeft"&&(!o||o===1?this.getRecentColorElement(this.recentColors.length)?.focus():this.getRecentColorElement(o-1)?.focus()),t==="ArrowRight"&&(!o||o===this.recentColors.length?this.recentColor1El?.focus():this.getRecentColorElement(o+1)?.focus())}handleUpdateActiveSwatch(e){this.activeColorSwatchEl=e.target}handleStoreNewRecentColor(e){this.storeRecentColorToStorage(e.detail)}handleUpdateRecentColors(e){e.composedPath().includes(this.el)||this.setRecentColorsFromStorage()}handleClearColor(){this.updateColor(void 0)}updateColor(e,t=!0){e!==this.color&&(this.color=e,this.arcgisChange.emit(),this.arcgisColorInputChange.emit(),t&&this.storeRecentColorToStorage(e))}storeRecentColorToStorage(e){if(!e)return;e.length>7&&(e=e.slice(0,7));let t=[e,...this.recentColors.filter(o=>o!==e)].slice(0,3);y(this.storageId,t),this.recentColors=t,this.arcgisInternalStoredColor.emit()}handleClose(e){e.stopPropagation(),this.storeRecentColorToStorage(this.colorPickerEl?.value),this.arcgisPickerClose.emit(this.colorPickerEl?.value),this.arcgisColorInputPopoverClose.emit(this.colorPickerEl?.value)}addTooltip(e){this.removeTooltip(),this.tooltipContainerEl=document.createElement("div"),m(i`<calcite-tooltip .placement=${e.placement??"auto"} .referenceElement=${e.referenceElement} overlay-positioning=fixed open>${e.innerHTML}</calcite-tooltip>`,this.tooltipContainerEl),document.body.append(this.tooltipContainerEl)}removeTooltip(){this.tooltipContainerEl?.parentNode&&(this.tooltipContainerEl.remove(),this.tooltipContainerEl=void 0)}render(){let{compact:e,disabled:t,recentColors:o,_messages:s}=this,p=[o[0],o[1]],$=f(this.el)==="rtl";return e||p.push(o[2]),i`<arcgis-picker-input .disabled=${t} .intlDone=${s.commitColor} .heading=${s.selectColor} .label=${s.selectColor} @arcgisPopoverOpen=${this.handleOpen} @arcgisPopoverClose=${this.handleClose} .popoverProps=${this.popoverProps} ${l(this.setInlineInputRef)}><div class="color-picker-container" slot=content>${n(`color-picker${e?"--compact":""}`,i`<calcite-color-picker .clearable=${this.clearable} class="color-picker" @calciteColorPickerInput=${E(c=>{c.stopPropagation(),this.updateColor(this.colorPickerEl.value,!1)},500)} .scale=${e?"s":"m"} .storageId=${this.storageId} .alphaChannel=${this.showTransparency} .value=${this.color} ${l(this.setColorPickerRef)}></calcite-color-picker>`)}</div><div slot=preview><calcite-color-picker-swatch class="preview-swatch" .color=${this.color} scale=s></calcite-color-picker-swatch></div>${!this.hideRecentColors&&i`<div slot=content-end class="recent-colors-container" @keydown=${this.handleRecentColorsKeyDown} tabindex=-1>${p.map((c,d)=>c?n(c,i`<calcite-color-picker-swatch class="preview-recent-swatch" role=button scale=s tabindex=0 .active=${c===this.color} .color=${c} @click=${this.handleSwatchClickOrKeyUp} @keyup=${this.handleSwatchClickOrKeyUp} @focus=${this.handleUpdateActiveSwatch} ${l(this.setRecentColorElement(d+1))}></calcite-color-picker-swatch>`):this.renderEmptySwatch(`empty-swatch-${d}`))}</div>`||""}${this.clearable&&i`<div slot=content-end class="end-action"><calcite-action icon=circle-disallowed scale=s .label=${s.clearColor} .text=${s.clearColor??""} @click=${this.handleClearColor} @mouseover=${()=>this.addTooltip({referenceElement:this.actionEl.value,placement:$?"right-start":"left-start",innerHTML:s.noColor??""})} @mouseout=${()=>this.removeTooltip()} ${l(this.actionEl)}></calcite-action></div>`||""}</arcgis-picker-input>`}renderEmptySwatch(e){return n(e,i`<svg class="empty-swatch" viewBox="0 0 20 20" xmlns=http://www.w3.org/2000/svg width=20>${u`<rect width=20 height=20 fill=#f8f8f8 stroke=#000 stroke-dasharray=2 />`}</svg>`)}};v("arcgis-color-input",h);export{h as ArcgisColorInput};
3
+ v5.0.0-next.125 */
4
+ import{a as E}from"./Q3NZOH23.js";import{a as n}from"./PAH5NEYW.js";import{b as k}from"./M5JGIZYS.js";import{e as f}from"./4CRBTYNF.js";import{A as l,B as w,H as v,g as C,i,j as u,l as m,q as r,z as g}from"./UIGZUM56.js";function y(a,e,t){window.localStorage.setItem(a,JSON.stringify(e))}function S(a,e){let t=window.localStorage.getItem(a);return t&&e?JSON.parse(t):t}var R=C`:host,arcgis-picker-input{display:block}.color-picker-container{display:flex;flex-direction:column}.color-picker{--calcite-color-border-1: transparent;overflow-x:hidden}.preview-swatch{width:100%;height:24px}.recent-colors-container{align-items:center;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-input);display:flex;gap:var(--calcite-space-sm);height:32px;padding:0 var(--calcite-space-xs);transition:outline-offset .1s ease-in-out,outline-color .1s ease-in-out}.preview-recent-swatch{cursor:pointer}.recent-colors-container:focus,.preview-recent-swatch:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-brand);outline-offset:var(--calcite-border-width-md)}.empty-swatch{cursor:default}.end-action{display:flex}`,h=class extends w{constructor(){super(),this._messages=k(),this.actionEl=g(),this.setRecentColorElement=e=>t=>{switch(e){case 1:this.recentColor1El=t;break;case 2:this.recentColor2El=t;break;default:this.recentColor3El=t}},this.recentColors=[],this.clearable=!1,this.compact=!1,this.disabled=!1,this.placement="auto",this.storageId="arcgis-color-input-storage-colors",this.hideRecentColors=!1,this.showTransparency=!1,this.arcgisChange=r(),this.arcgisColorInputChange=r(),this.arcgisColorInputPopoverClose=r(),this.arcgisColorInputPopoverOpen=r(),this.arcgisColorInputSwatchUpdate=r(),this.arcgisInternalStoredColor=r(),this.arcgisPickerClose=r(),this.arcgisPickerOpen=r(),this.arcgisSwatchUpdate=r(),this.listenOn(document,"arcgisInternalStoredColor",this.handleUpdateRecentColors),this.listenOn(document,"arcgisRecentColorsUpdate",this.handleStoreNewRecentColor)}static{this.properties={recentColors:16,clearable:5,color:1,compact:5,disabled:5,messageOverrides:0,placement:1,popoverProps:0,storageId:1,hideRecentColors:5,showTransparency:5}}static{this.styles=R}async close(){await this.inlineInputEl?.close()}async setFocus(){await this.inlineInputEl?.setFocus()}load(){this.setRecentColorsFromStorage()}disconnectedCallback(){super.disconnectedCallback(),this.removeTooltip()}async handleOpen(){await this.colorPickerEl?.setFocus(),this.arcgisPickerOpen.emit(),this.arcgisColorInputPopoverOpen.emit()}setInlineInputRef(e){this.inlineInputEl=e}setColorPickerRef(e){e&&(this.colorPickerEl=e)}getRecentColorElement(e){switch(e){case 1:return this.recentColor1El;case 2:return this.recentColor2El;default:return this.recentColor3El}}setRecentColorsFromStorage(){let e=S(this.storageId,!0);e&&(this.recentColors=[...e])}handleSwatchClickOrKeyUp(e){if("key"in e&&e.key!=="Enter"&&e.key!=="Space")return;let t=e.currentTarget.color||void 0;this.updateColor(t),this.arcgisSwatchUpdate.emit(t),this.arcgisColorInputSwatchUpdate.emit(t),setTimeout(()=>this.recentColor1El?.focus(),200)}handleRecentColorsKeyDown(e){if(this.recentColors.length===1)return;let t=e.key,o;this.activeColorSwatchEl===this.recentColor1El?o=1:this.activeColorSwatchEl===this.recentColor2El?o=2:this.activeColorSwatchEl===this.recentColor3El&&(o=3),t==="ArrowLeft"&&(!o||o===1?this.getRecentColorElement(this.recentColors.length)?.focus():this.getRecentColorElement(o-1)?.focus()),t==="ArrowRight"&&(!o||o===this.recentColors.length?this.recentColor1El?.focus():this.getRecentColorElement(o+1)?.focus())}handleUpdateActiveSwatch(e){this.activeColorSwatchEl=e.target}handleStoreNewRecentColor(e){this.storeRecentColorToStorage(e.detail)}handleUpdateRecentColors(e){e.composedPath().includes(this.el)||this.setRecentColorsFromStorage()}handleClearColor(){this.updateColor(void 0)}updateColor(e,t=!0){e!==this.color&&(this.color=e,this.arcgisChange.emit(),this.arcgisColorInputChange.emit(),t&&this.storeRecentColorToStorage(e))}storeRecentColorToStorage(e){if(!e)return;e.length>7&&(e=e.slice(0,7));let t=[e,...this.recentColors.filter(o=>o!==e)].slice(0,3);y(this.storageId,t),this.recentColors=t,this.arcgisInternalStoredColor.emit()}handleClose(e){e.stopPropagation(),this.storeRecentColorToStorage(this.colorPickerEl?.value),this.arcgisPickerClose.emit(this.colorPickerEl?.value),this.arcgisColorInputPopoverClose.emit(this.colorPickerEl?.value)}addTooltip(e){this.removeTooltip(),this.tooltipContainerEl=document.createElement("div"),m(i`<calcite-tooltip .placement=${e.placement??"auto"} .referenceElement=${e.referenceElement} overlay-positioning=fixed open>${e.innerHTML}</calcite-tooltip>`,this.tooltipContainerEl),document.body.append(this.tooltipContainerEl)}removeTooltip(){this.tooltipContainerEl?.parentNode&&(this.tooltipContainerEl.remove(),this.tooltipContainerEl=void 0)}render(){let{compact:e,disabled:t,recentColors:o,_messages:s}=this,p=[o[0],o[1]],$=f(this.el)==="rtl";return e||p.push(o[2]),i`<arcgis-picker-input .disabled=${t} .intlDone=${s.commitColor} .heading=${s.selectColor} .label=${s.selectColor} @arcgisPopoverOpen=${this.handleOpen} @arcgisPopoverClose=${this.handleClose} .popoverProps=${this.popoverProps} ${l(this.setInlineInputRef)}><div class="color-picker-container" slot=content>${n(`color-picker${e?"--compact":""}`,i`<calcite-color-picker .clearable=${this.clearable} class="color-picker" @calciteColorPickerInput=${E(c=>{c.stopPropagation(),this.updateColor(this.colorPickerEl.value,!1)},500)} .scale=${e?"s":"m"} .storageId=${this.storageId} .alphaChannel=${this.showTransparency} .value=${this.color} ${l(this.setColorPickerRef)}></calcite-color-picker>`)}</div><div slot=preview><calcite-color-picker-swatch class="preview-swatch" .color=${this.color} scale=s></calcite-color-picker-swatch></div>${!this.hideRecentColors&&i`<div slot=content-end class="recent-colors-container" @keydown=${this.handleRecentColorsKeyDown} tabindex=-1>${p.map((c,d)=>c?n(c,i`<calcite-color-picker-swatch class="preview-recent-swatch" role=button scale=s tabindex=0 .active=${c===this.color} .color=${c} @click=${this.handleSwatchClickOrKeyUp} @keyup=${this.handleSwatchClickOrKeyUp} @focus=${this.handleUpdateActiveSwatch} ${l(this.setRecentColorElement(d+1))}></calcite-color-picker-swatch>`):this.renderEmptySwatch(`empty-swatch-${d}`))}</div>`||""}${this.clearable&&i`<div slot=content-end class="end-action"><calcite-action icon=circle-disallowed scale=s .label=${s.clearColor} .text=${s.clearColor??""} @click=${this.handleClearColor} @mouseover=${()=>this.addTooltip({referenceElement:this.actionEl.value,placement:$?"right-start":"left-start",innerHTML:s.noColor??""})} @mouseout=${()=>this.removeTooltip()} ${l(this.actionEl)}></calcite-action></div>`||""}</arcgis-picker-input>`}renderEmptySwatch(e){return n(e,i`<svg class="empty-swatch" viewBox="0 0 20 20" xmlns=http://www.w3.org/2000/svg width=20>${u`<rect width=20 height=20 fill=#f8f8f8 stroke=#000 stroke-dasharray=2 />`}</svg>`)}};v("arcgis-color-input",h);export{h as ArcgisColorInput};
@@ -1,4 +1,4 @@
1
1
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
2
2
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
3
- v5.0.0-next.124 */
4
- import{a as k,b as h}from"./3PSPDXMP.js";import{a as R}from"./PJISHDGP.js";import{b as B}from"./JJ2Y4N2K.js";import"./55APDMBW.js";import{A as F,B as S,H as O,g as L,i as b,m as w,n as N,q as Z,z as U}from"./UBB6IHIQ.js";export default $arcgis.t(([{formatDate:q,convertDateFormatToIntlOptions:y,formatDateOnly:K,formatTimeOnly:Q,formatTimestamp:C,formatNumber:X},Y,{clone:I}])=>{function _(i){return new Date(`1970-01-01T${i}Z`).getTime()}function M(i){return new Date(`${i} 00:00:00`).getTime()}function ee(i,e,t){let o;return e==="unknown"?o=q(i,{...y("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}):o=q(i,{...y("short-date-short-time"),timeZone:e}),o}function te(i){return i?K(i,y("short-date")):""}function ie(i){let e;return typeof i=="string"?e=Q(i,y("short-date-long-time")):e=q(i,{...y("long-time"),timeZone:"utc"}),e}function se(i,e){return typeof i=="string"?e&&"timeZone"in e&&e.timeZone==="unknown"?C(i,{...y("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}):C(i,{...y("short-date-short-time"),timeZone:e&&"timeZone"in e&&e.timeZone?e.timeZone:"system"}):e&&"timeZone"in e&&e.timeZone==="unknown"?q(i,{...y("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}):q(i,{...y("short-date-short-time"),timeZone:e&&"timeZone"in e&&e.timeZone?e.timeZone:"system"})}function A(i,e){if(i.type!=="feature"&&i.type!=="subtype-group"&&i.type!=="subtype-sublayer"&&i.type!=="imagery")return;let t;return i.fields.forEach(o=>{let s=o.name,r=o.domain;if(i.type!=="imagery"&&i.subtypeField===s){let p;i.type==="subtype-group"||i.type==="feature"?p=i.subtypes:p=i.parent.subtypes,p.forEach(l=>{i.type==="subtype-sublayer"&&i.subtypeCode!==l.code||(e.name===s&&(t=t||[],t.push({code:l.code,name:l.name})),l.domains&&Object.keys(l.domains).forEach(a=>{if(e.name===a){let n=l.domains[a];n?.type==="coded-value"&&n?.codedValues&&n.codedValues.forEach(u=>{let f=!1;t=t||[],t.forEach(c=>{c.code===u.code&&(f=!0,`| ${c.name} |`.includes(`| ${u.name} |`)||(c.name+=` | ${u.name}`))}),f||t.push({code:u.code,name:u.name})})}}))})}if(e.name===s&&(i.type==="feature"||i.type==="imagery")){let p=i.type==="feature"?i.typeIdField:void 0,l=i.type==="feature"?i.types:void 0;i.type==="feature"&&p&&l?(p===s?t=l.map(a=>({code:a.id,name:a.name})):(t=t||[],l.forEach(a=>{if(!a.domains?.[s]||a.domains[s].type==="inherited"){let n=r;n?.codedValues&&n.codedValues.forEach(u=>{let f=!1;t.forEach(c=>{c.code===u.code&&(f=!0,`| ${c.name} |`.includes(`| ${u.name} |`)||(c.name+=` | ${u.name}`))}),f||t.push(I(u))})}else a.domains?.[s]?.codedValues&&a.domains[s].codedValues.forEach(n=>{let u=!1;t.forEach(f=>{f.code===n.code&&(u=!0,`| ${f.name} |`.includes(`| ${n.name} |`)||(f.name+=` | ${n.name}`))}),u||t.push(I(n))})})),!t?.length&&r?.codedValues&&(t=I(r.codedValues))):r?.codedValues&&(t=r.codedValues)}}),t}function E(i,e){let t=e;if(t){let o="";for(let s=0;s<t.length;s++){let r=t[s];r.code==i&&(o+=(o.length?" | ":"")+r.name)}return o.length||(o=`${i}`),o}return i}function W(i){return["small-integer","big-integer","integer","single","double","long"].includes(i.type)}function P(i){switch(i.type){case"small-integer":case"big-integer":case"integer":case"single":case"double":case"long":return"number";case"blob":case"geometry":case"global-id":case"guid":case"oid":case"raster":case"xml":return;default:return i.type}}var ne=L`:host{width:100%}.container{min-height:30px}.popover-unique-list{width:100%;overflow-y:auto}.unique-values-content-list-msg{font-size:75%;margin:5px}.count{padding:0 6px;font-size:smaller;white-space:nowrap}`,D=class extends S{constructor(){super(...arguments),this.dropdownNode=U(),this._messages=B({blocking:!0}),this._propWatcherTask=new k(this,{task:async([e,t,o])=>{let s=h(e)&&h(t)||h(o);if(!h(o)&&!h(e)&&!h(t)?w("error",this,N("uniqueValues")):h(o)||(h(e)||w("error",this,N("layer")),h(t)||w("error",this,N("fieldName"))),h(e)&&h(t)&&!e.fields?.filter(r=>r.name===t))throw w("error",this,"Field could not be found."),new Error;if(!s)throw new Error;await this.processProps()},args:()=>[this.layer,this.fieldName,this.uniqueValues]}),this.initialRender=!0,this.multiple=!1,this.partialUniqueValues=!1,this.showFilterLength=10,this.arcgisChange=Z(),this.arcgisSortByChange=Z(),this.arcgisLoad=Z()}static{this.properties={initialRender:16,view:0,layer:0,fieldName:1,uniqueValues:0,numberFormatOptions:0,selectedValues:0,sortBy:1,multiple:5,partialUniqueValues:5,showFilterLength:9,maxHeight:9}}static{this.styles=ne}async setFocus(){this.listNode?.setFocus()}async getUniqueValues(){let{fieldInfo:e}=this;if(h(e?.uniqueValueInfos)){let{uniqueValueInfos:t,partialUniqueValues:o}=e;return{uniqueValues:t,partialUniqueValues:o}}}loaded(){this.layer&&this.fieldInfo&&(setTimeout(()=>this.initialRender=!1,800),this.listNode?.setFocus())}async processProps(){let{layer:e,fieldName:t,view:o}=this,s=e?.fields?.filter(r=>r.name===t)?.[0];if(h(this.uniqueValues))this.fieldInfo={layerField:s,fieldDomains:e&&s?A(e,s):void 0,simpleType:e&&s?P(s):void 0,partialUniqueValues:this.partialUniqueValues??!1,uniqueValueInfos:this.uniqueValues},this.arcgisLoad.emit();else if(e&&s){this.fieldInfo={layerField:s,fieldDomains:A(e,s),simpleType:P(s),partialUniqueValues:!1};let{fieldInfo:r}=this;try{let p=await Y({layer:e,view:o,field:t,sqlWhere:"definitionExpression"in e?e.definitionExpression??void 0:void 0,forBinning:!1}),l=W(s),a=p.uniqueValueInfos.filter(n=>h(n.value)?s.type==="string"&&!l||s.type==="guid"?n.value!=="<Null>"&&`${n.value}`.trim()!=="":(W(s)||s.type,n.value!=="<Null>"&&n.value!==""):!1);a.sort((n,u)=>n.count>u.count?-1:n.count<u.count?1:0),r.fieldDomains?.length&&r.fieldDomains.forEach(n=>{a.find(u=>u.value===n.code)||a.push({value:n.code,count:0})}),r.uniqueValueInfos=a,r.partialUniqueValues=p.uniqueValueInfos.length===2e3,this.arcgisLoad.emit()}catch(p){if(w("error",this,`uniqueValues() - ${p.message}`),this.hasFieldDomains(r)){let l=[];r.fieldDomains.forEach(a=>{l.find(n=>n.value===a.code)||l.push({value:a.code,count:void 0})})}}setTimeout(()=>{this.initialRender=!1,this.listNode?.setFocus()},800)}}setListRef(e){let{maxHeight:t}=this;this.listNode=e,t&&e?.setAttribute("style",`max-height: ${t||400}px`)}onSortMenuSelect(e){let t=e.currentTarget.selectedItems?.[0].getAttribute("data-value");this.sortBy=t||void 0,this.arcgisSortByChange.emit(t||void 0)}isSameLists(e,t){if(!e&&!t)return!0;if(!e||!t||e?.length!==t?.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}hasFieldDomains(e){return!!e.fieldDomains?.length}render(){return this._propWatcherTask.render({complete:()=>{let{fieldInfo:e,selectedValues:t,sortBy:o,multiple:s,initialRender:r,showFilterLength:p,_messages:l}=this,{fieldDomains:a,uniqueValueInfos:n,partialUniqueValues:u,layerField:f}=e,c=f?.type;if(!n?.length)return"";let x=c?["small-integer","big-integer","integer","single","double","long","oid"].includes(c):!1,z=c?["date","date-only","time-only"].includes(c):!1,H=g=>{g.sort((d,m)=>d.count<=m.count?1:-1)},j=g=>{let d=a?.length;g.sort((m,v)=>{if(!d&&x)return(typeof m.value=="string"?Number.parseFloat(m.value):m.value)-(typeof v.value=="string"?Number.parseFloat(v.value):v.value);{let $=d?E(m.value,a):m.value,V=d?E(v.value,a):v.value;return`${$}`.startsWith("_")?1:`${V}`.startsWith("_")?-1:`${$}`.localeCompare(`${V}`)}})},G=(g,d)=>{g.sort((m,v)=>{let $=d?.indexOf(m.value)??-1,V=d?.indexOf(v.value)??-1;return $===V||$>-1&&V>-1?0:$>V?-1:1})};j(n),!o||o==="count"?H(n):o==="selected"&&G(n,t);let J=n.map(g=>this.renderUniqueValue(g)),T;return u&&!r&&(T=b`<div class="unique-values-content-list-msg">${l.errors.tooManyUniqueValues}</div>`),b`<div class="container"><calcite-list .label=${l.values} class="popover-unique-list" .filterEnabled=${n.length>=p} .selectionMode=${s?"multiple":"single"} .filterPlaceholder=${l.searchValues} @calciteListChange=${g=>{let d=g.target.selectedItems.map(m=>m.value);!a&&c==="date-only"?d=d?.map(m=>M(m)):!a&&c==="time-only"?d=d?.map(m=>_(m)):c&&["date","oid","small-integer","big-integer","integer","long"].includes(c)?d=d?.map(m=>Number.parseInt(m)):c&&["single","double"].includes(c)&&(d=d?.map(m=>Number.parseFloat(m))),!this.isSameLists(d,this.selectedValues)&&(this.selectedValues=d,this.arcgisChange.emit(d))}} @calciteListFilter=${()=>{this.dropdownNode.value&&(this.dropdownNode.value.disabled=this.listNode.filteredItems.length<4)}} ${F(this.setListRef)}>${n.length>=p&&!r?this.renderSort(x,z):null}${J}</calcite-list>${T}</div>`},error:()=>""})}renderSort(e,t){let{sortBy:o,_messages:s}=this;return b`<calcite-dropdown slot=filter-actions-end placement=bottom-end overlay-positioning=fixed @calciteDropdownSelect=${this.onSortMenuSelect} ${F(this.dropdownNode)}><calcite-action slot=trigger .label=${s.sortValues} text><calcite-icon scale=s icon=sortDescending flip-rtl></calcite-icon></calcite-action><calcite-dropdown-group><calcite-dropdown-item .selected=${o==="count"||!h(o)} data-value=count>${s.sortByCount}</calcite-dropdown-item><calcite-dropdown-item .selected=${o==="name"} data-value=name>${e||t?s.sortAscending:s.sortAlphabetical}</calcite-dropdown-item><calcite-dropdown-item .selected=${o==="selected"} data-value=selected>${s.sortSelected}</calcite-dropdown-item></calcite-dropdown-group></calcite-dropdown>`}renderUniqueValue(e){let{selectedValues:t,initialRender:o,view:s,fieldInfo:r,numberFormatOptions:p}=this,{fieldDomains:l,uniqueValueInfos:a,simpleType:n}=r,u=s&&"timeZone"in s&&s.timeZone||"system",f=l?.length?E(e.value,l):n==="date"?ee(e.value,u):n==="date-only"?te(e.value):n==="time-only"?ie(e.value):n==="timestamp-offset"?se(e.value,s):typeof e.value=="number"?X(e.value,p):e.value,c=t?n==="date-only"?t.includes(l?.length?e.value:M(e.value)):n==="time-only"?t.includes(l?.length?e.value:_(e.value)):t.includes(e.value):!1;return R(`list-item_${e.value}`,b`<calcite-list-item .label=${`${f}`} .value=${`${e.value}`} .selected=${c}>${h(e.count)&&(a.length>200&&!o||a.length<=200)?b`<div class="count" slot=actions-end>${`${e.count}`}</div>`:null}</calcite-list-item>`)}};O("arcgis-unique-values-list",D);return D},"intl","smartMapping/statistics/uniqueValues","core/lang")
3
+ v5.0.0-next.125 */
4
+ import{a as k,b as h}from"./S3P7GTZF.js";import{a as R}from"./PAH5NEYW.js";import{b as B}from"./M5JGIZYS.js";import"./4CRBTYNF.js";import{A as F,B as S,H as O,g as L,i as b,m as w,n as N,q as Z,z as U}from"./UIGZUM56.js";export default $arcgis.t(([{formatDate:q,convertDateFormatToIntlOptions:y,formatDateOnly:K,formatTimeOnly:Q,formatTimestamp:C,formatNumber:X},Y,{clone:I}])=>{function _(i){return new Date(`1970-01-01T${i}Z`).getTime()}function M(i){return new Date(`${i} 00:00:00`).getTime()}function ee(i,e,t){let o;return e==="unknown"?o=q(i,{...y("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}):o=q(i,{...y("short-date-short-time"),timeZone:e}),o}function te(i){return i?K(i,y("short-date")):""}function ie(i){let e;return typeof i=="string"?e=Q(i,y("short-date-long-time")):e=q(i,{...y("long-time"),timeZone:"utc"}),e}function se(i,e){return typeof i=="string"?e&&"timeZone"in e&&e.timeZone==="unknown"?C(i,{...y("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}):C(i,{...y("short-date-short-time"),timeZone:e&&"timeZone"in e&&e.timeZone?e.timeZone:"system"}):e&&"timeZone"in e&&e.timeZone==="unknown"?q(i,{...y("short-date-short-time"),timeZone:"utc",timeZoneName:"shortOffset"}):q(i,{...y("short-date-short-time"),timeZone:e&&"timeZone"in e&&e.timeZone?e.timeZone:"system"})}function A(i,e){if(i.type!=="feature"&&i.type!=="subtype-group"&&i.type!=="subtype-sublayer"&&i.type!=="imagery")return;let t;return i.fields.forEach(o=>{let s=o.name,r=o.domain;if(i.type!=="imagery"&&i.subtypeField===s){let p;i.type==="subtype-group"||i.type==="feature"?p=i.subtypes:p=i.parent.subtypes,p.forEach(l=>{i.type==="subtype-sublayer"&&i.subtypeCode!==l.code||(e.name===s&&(t=t||[],t.push({code:l.code,name:l.name})),l.domains&&Object.keys(l.domains).forEach(a=>{if(e.name===a){let n=l.domains[a];n?.type==="coded-value"&&n?.codedValues&&n.codedValues.forEach(u=>{let f=!1;t=t||[],t.forEach(c=>{c.code===u.code&&(f=!0,`| ${c.name} |`.includes(`| ${u.name} |`)||(c.name+=` | ${u.name}`))}),f||t.push({code:u.code,name:u.name})})}}))})}if(e.name===s&&(i.type==="feature"||i.type==="imagery")){let p=i.type==="feature"?i.typeIdField:void 0,l=i.type==="feature"?i.types:void 0;i.type==="feature"&&p&&l?(p===s?t=l.map(a=>({code:a.id,name:a.name})):(t=t||[],l.forEach(a=>{if(!a.domains?.[s]||a.domains[s].type==="inherited"){let n=r;n?.codedValues&&n.codedValues.forEach(u=>{let f=!1;t.forEach(c=>{c.code===u.code&&(f=!0,`| ${c.name} |`.includes(`| ${u.name} |`)||(c.name+=` | ${u.name}`))}),f||t.push(I(u))})}else a.domains?.[s]?.codedValues&&a.domains[s].codedValues.forEach(n=>{let u=!1;t.forEach(f=>{f.code===n.code&&(u=!0,`| ${f.name} |`.includes(`| ${n.name} |`)||(f.name+=` | ${n.name}`))}),u||t.push(I(n))})})),!t?.length&&r?.codedValues&&(t=I(r.codedValues))):r?.codedValues&&(t=r.codedValues)}}),t}function E(i,e){let t=e;if(t){let o="";for(let s=0;s<t.length;s++){let r=t[s];r.code==i&&(o+=(o.length?" | ":"")+r.name)}return o.length||(o=`${i}`),o}return i}function W(i){return["small-integer","big-integer","integer","single","double","long"].includes(i.type)}function P(i){switch(i.type){case"small-integer":case"big-integer":case"integer":case"single":case"double":case"long":return"number";case"blob":case"geometry":case"global-id":case"guid":case"oid":case"raster":case"xml":return;default:return i.type}}var ne=L`:host{width:100%}.container{min-height:30px}.popover-unique-list{width:100%;overflow-y:auto}.unique-values-content-list-msg{font-size:75%;margin:5px}.count{padding:0 6px;font-size:smaller;white-space:nowrap}`,D=class extends S{constructor(){super(...arguments),this.dropdownNode=U(),this._messages=B({blocking:!0}),this._propWatcherTask=new k(this,{task:async([e,t,o])=>{let s=h(e)&&h(t)||h(o);if(!h(o)&&!h(e)&&!h(t)?w("error",this,N("uniqueValues")):h(o)||(h(e)||w("error",this,N("layer")),h(t)||w("error",this,N("fieldName"))),h(e)&&h(t)&&!e.fields?.filter(r=>r.name===t))throw w("error",this,"Field could not be found."),new Error;if(!s)throw new Error;await this.processProps()},args:()=>[this.layer,this.fieldName,this.uniqueValues]}),this.initialRender=!0,this.multiple=!1,this.partialUniqueValues=!1,this.showFilterLength=10,this.arcgisChange=Z(),this.arcgisSortByChange=Z(),this.arcgisLoad=Z()}static{this.properties={initialRender:16,view:0,layer:0,fieldName:1,uniqueValues:0,numberFormatOptions:0,selectedValues:0,sortBy:1,multiple:5,partialUniqueValues:5,showFilterLength:9,maxHeight:9}}static{this.styles=ne}async setFocus(){this.listNode?.setFocus()}async getUniqueValues(){let{fieldInfo:e}=this;if(h(e?.uniqueValueInfos)){let{uniqueValueInfos:t,partialUniqueValues:o}=e;return{uniqueValues:t,partialUniqueValues:o}}}loaded(){this.layer&&this.fieldInfo&&(setTimeout(()=>this.initialRender=!1,800),this.listNode?.setFocus())}async processProps(){let{layer:e,fieldName:t,view:o}=this,s=e?.fields?.filter(r=>r.name===t)?.[0];if(h(this.uniqueValues))this.fieldInfo={layerField:s,fieldDomains:e&&s?A(e,s):void 0,simpleType:e&&s?P(s):void 0,partialUniqueValues:this.partialUniqueValues??!1,uniqueValueInfos:this.uniqueValues},this.arcgisLoad.emit();else if(e&&s){this.fieldInfo={layerField:s,fieldDomains:A(e,s),simpleType:P(s),partialUniqueValues:!1};let{fieldInfo:r}=this;try{let p=await Y({layer:e,view:o,field:t,sqlWhere:"definitionExpression"in e?e.definitionExpression??void 0:void 0,forBinning:!1}),l=W(s),a=p.uniqueValueInfos.filter(n=>h(n.value)?s.type==="string"&&!l||s.type==="guid"?n.value!=="<Null>"&&`${n.value}`.trim()!=="":(W(s)||s.type,n.value!=="<Null>"&&n.value!==""):!1);a.sort((n,u)=>n.count>u.count?-1:n.count<u.count?1:0),r.fieldDomains?.length&&r.fieldDomains.forEach(n=>{a.find(u=>u.value===n.code)||a.push({value:n.code,count:0})}),r.uniqueValueInfos=a,r.partialUniqueValues=p.uniqueValueInfos.length===2e3,this.arcgisLoad.emit()}catch(p){if(w("error",this,`uniqueValues() - ${p.message}`),this.hasFieldDomains(r)){let l=[];r.fieldDomains.forEach(a=>{l.find(n=>n.value===a.code)||l.push({value:a.code,count:void 0})})}}setTimeout(()=>{this.initialRender=!1,this.listNode?.setFocus()},800)}}setListRef(e){let{maxHeight:t}=this;this.listNode=e,t&&e?.setAttribute("style",`max-height: ${t||400}px`)}onSortMenuSelect(e){let t=e.currentTarget.selectedItems?.[0].getAttribute("data-value");this.sortBy=t||void 0,this.arcgisSortByChange.emit(t||void 0)}isSameLists(e,t){if(!e&&!t)return!0;if(!e||!t||e?.length!==t?.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0}hasFieldDomains(e){return!!e.fieldDomains?.length}render(){return this._propWatcherTask.render({complete:()=>{let{fieldInfo:e,selectedValues:t,sortBy:o,multiple:s,initialRender:r,showFilterLength:p,_messages:l}=this,{fieldDomains:a,uniqueValueInfos:n,partialUniqueValues:u,layerField:f}=e,c=f?.type;if(!n?.length)return"";let x=c?["small-integer","big-integer","integer","single","double","long","oid"].includes(c):!1,z=c?["date","date-only","time-only"].includes(c):!1,H=g=>{g.sort((d,m)=>d.count<=m.count?1:-1)},j=g=>{let d=a?.length;g.sort((m,v)=>{if(!d&&x)return(typeof m.value=="string"?Number.parseFloat(m.value):m.value)-(typeof v.value=="string"?Number.parseFloat(v.value):v.value);{let $=d?E(m.value,a):m.value,V=d?E(v.value,a):v.value;return`${$}`.startsWith("_")?1:`${V}`.startsWith("_")?-1:`${$}`.localeCompare(`${V}`)}})},G=(g,d)=>{g.sort((m,v)=>{let $=d?.indexOf(m.value)??-1,V=d?.indexOf(v.value)??-1;return $===V||$>-1&&V>-1?0:$>V?-1:1})};j(n),!o||o==="count"?H(n):o==="selected"&&G(n,t);let J=n.map(g=>this.renderUniqueValue(g)),T;return u&&!r&&(T=b`<div class="unique-values-content-list-msg">${l.errors.tooManyUniqueValues}</div>`),b`<div class="container"><calcite-list .label=${l.values} class="popover-unique-list" .filterEnabled=${n.length>=p} .selectionMode=${s?"multiple":"single"} .filterPlaceholder=${l.searchValues} @calciteListChange=${g=>{let d=g.target.selectedItems.map(m=>m.value);!a&&c==="date-only"?d=d?.map(m=>M(m)):!a&&c==="time-only"?d=d?.map(m=>_(m)):c&&["date","oid","small-integer","big-integer","integer","long"].includes(c)?d=d?.map(m=>Number.parseInt(m)):c&&["single","double"].includes(c)&&(d=d?.map(m=>Number.parseFloat(m))),!this.isSameLists(d,this.selectedValues)&&(this.selectedValues=d,this.arcgisChange.emit(d))}} @calciteListFilter=${()=>{this.dropdownNode.value&&(this.dropdownNode.value.disabled=this.listNode.filteredItems.length<4)}} ${F(this.setListRef)}>${n.length>=p&&!r?this.renderSort(x,z):null}${J}</calcite-list>${T}</div>`},error:()=>""})}renderSort(e,t){let{sortBy:o,_messages:s}=this;return b`<calcite-dropdown slot=filter-actions-end placement=bottom-end overlay-positioning=fixed @calciteDropdownSelect=${this.onSortMenuSelect} ${F(this.dropdownNode)}><calcite-action slot=trigger .label=${s.sortValues} text><calcite-icon scale=s icon=sortDescending flip-rtl></calcite-icon></calcite-action><calcite-dropdown-group><calcite-dropdown-item .selected=${o==="count"||!h(o)} data-value=count>${s.sortByCount}</calcite-dropdown-item><calcite-dropdown-item .selected=${o==="name"} data-value=name>${e||t?s.sortAscending:s.sortAlphabetical}</calcite-dropdown-item><calcite-dropdown-item .selected=${o==="selected"} data-value=selected>${s.sortSelected}</calcite-dropdown-item></calcite-dropdown-group></calcite-dropdown>`}renderUniqueValue(e){let{selectedValues:t,initialRender:o,view:s,fieldInfo:r,numberFormatOptions:p}=this,{fieldDomains:l,uniqueValueInfos:a,simpleType:n}=r,u=s&&"timeZone"in s&&s.timeZone||"system",f=l?.length?E(e.value,l):n==="date"?ee(e.value,u):n==="date-only"?te(e.value):n==="time-only"?ie(e.value):n==="timestamp-offset"?se(e.value,s):typeof e.value=="number"?X(e.value,p):e.value,c=t?n==="date-only"?t.includes(l?.length?e.value:M(e.value)):n==="time-only"?t.includes(l?.length?e.value:_(e.value)):t.includes(e.value):!1;return R(`list-item_${e.value}`,b`<calcite-list-item .label=${`${f}`} .value=${`${e.value}`} .selected=${c}>${h(e.count)&&(a.length>200&&!o||a.length<=200)?b`<div class="count" slot=actions-end>${`${e.count}`}</div>`:null}</calcite-list-item>`)}};O("arcgis-unique-values-list",D);return D},"intl","smartMapping/statistics/uniqueValues","core/lang")