@arcgis/core 4.25.0-next.20221108 → 4.25.1

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 (43) hide show
  1. package/arcade.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{4726c869d80257488a38.js → 0690434cb3d7df4188aa.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{bf097a329b91fcd7a300.js → 0a9813558c89a8824080.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{33ea3449d32ac21adc91.js → 0d10010d8db4ebd20356.js} +1 -1
  6. package/assets/esri/core/workers/chunks/0ea80e26c937441c2bc5.js +1 -0
  7. package/assets/esri/core/workers/chunks/52b6711572ac7e058ce6.js +1 -0
  8. package/assets/esri/core/workers/chunks/{e031a2fee155aa168858.js → 61959a85261218b22376.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{363700f66277a9176991.js → 7c255fe7a231d93a2048.js} +1 -1
  10. package/assets/esri/core/workers/chunks/8750c7463968f0c183ba.js +1 -0
  11. package/assets/esri/core/workers/chunks/a16641c79f56012b0d66.js +1 -0
  12. package/assets/esri/core/workers/chunks/{211ad79ff0b187c52449.js → afd87bc92895517b0877.js} +1 -1
  13. package/assets/esri/core/workers/chunks/b04984f048b75b2b4dd2.js +1 -0
  14. package/assets/esri/core/workers/chunks/bc878858cf5fb3237206.js +1 -0
  15. package/assets/esri/core/workers/chunks/{5de864843c0d3f4d291d.js → d4bfb6a3b8965be6f0d6.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{086dafcd10b310ba1a30.js → d9bba06ef5d22bd2d789.js} +1 -1
  17. package/assets/esri/core/workers/chunks/ee261fdc2a82d05e458e.js +1 -0
  18. package/assets/esri/core/workers/chunks/f29c6965e9e8f904be40.js +1 -0
  19. package/config.js +1 -1
  20. package/identity/IdentityManagerBase.js +1 -1
  21. package/interfaces.d.ts +8 -2
  22. package/layers/WMSLayer.js +1 -1
  23. package/layers/WMTSLayer.js +1 -1
  24. package/package.json +1 -1
  25. package/portal/support/urlUtils.js +1 -1
  26. package/request.js +1 -1
  27. package/support/revision.js +1 -1
  28. package/symbols/cim/CIMImageColorSubstitutionHelper.js +1 -1
  29. package/views/2d/layers/WMSLayerView2D.js +1 -1
  30. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  31. package/widgets/FeatureForm/FormExpressionArcadeExecutor.js +1 -1
  32. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  33. package/widgets/FeatureForm/InputField.js +1 -1
  34. package/widgets/FeatureForm.js +1 -1
  35. package/widgets/UtilityNetworkTrace.js +1 -1
  36. package/assets/esri/core/workers/chunks/6dfb2ddfd72009564a34.js +0 -1
  37. package/assets/esri/core/workers/chunks/83879da1ff7938a76574.js +0 -1
  38. package/assets/esri/core/workers/chunks/878bc2b24cc45418e819.js +0 -1
  39. package/assets/esri/core/workers/chunks/b5e6a868256c5aae6d5e.js +0 -1
  40. package/assets/esri/core/workers/chunks/c2a8813b618f98d0016d.js +0 -1
  41. package/assets/esri/core/workers/chunks/c868ffdc6bb8a49d82d7.js +0 -1
  42. package/assets/esri/core/workers/chunks/d573ec98401fbae26383.js +0 -1
  43. package/assets/esri/core/workers/chunks/f23d8ec18740eb2e5e8f.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{isSome as r}from"../../core/maybe.js";import{isAbortError as o,createResolver as a}from"../../core/promiseUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";const c="#JSAPI_FORM_EXPRESSIONS_MANAGER_GEOMETRY",l="esri.widgets.FeatureForm.FormExpressionsManager";let p=class extends t{constructor(e){super(e),this._fieldReferencesLookup=new Map,this._fieldsAffectedLookup=new Map,this._latestFieldValues={...e.feature.attributes}}initialize(){this._dependencyGraph=this._buildDependencyGraph()}get _baseContext(){const{editType:e,layer:t,map:s,originalFeature:o,spatialReference:a}=this.arcadeContextInfo,i="feature"===t?.type?t:"scene"===t?.type&&r(t.associatedLayer)?t.associatedLayer:void 0;return[{$originalfeature:o,$editcontext:{editType:e},$layer:i,$featureset:i,$datastore:t?.url,$map:s},{spatialReference:a}]}set feature(e){this._latestFieldValues={...e?.attributes},this._set("feature",e)}evaluateAll(){return this._evaluate(this.executors)}evaluateExpressions(e){return this._evaluate(e)}evaluateInvalidated(e){const{_fieldReferencesLookup:t,_latestFieldValues:s,feature:r}=this,o=new Set;for(const a of e)if(s[a]=r.getAttribute(a),t.has(a))for(const e of t.get(a))o.add(e);return this._evaluate([...o])}async evaluateInvalidatedByGeometry(){if(this._fieldReferencesLookup.has(c))return this._evaluate([...this._fieldReferencesLookup.get(c)])}resetExecutors(){for(const e of this.executors)e.reset()}_buildDependencyGraph(){const{_fieldReferencesLookup:e,_fieldsAffectedLookup:t,executors:o}=this,a=new Map(this.inputFields.map((e=>[e.name,e]))),i=new Map(o.map((e=>[e,new Array])));for(const n of o){for(const o of n.fieldsUsed){s(e,o,(()=>new Set)).add(n);const c=a.get(o),{valueExpressionExecutor:l,editableExpressionExecutor:p}=c;if(r(l)){i.get(l).push(n);s(t,l,(()=>new Set)).add(c)}if(r(p)){i.get(p).push(n);s(t,p,(()=>new Set)).add(c)}}if(n.usesGeometry){s(e,c,(()=>new Set)).add(n)}}return i}async _evaluate(e){const t=new Map,{_dependencyGraph:s,_fieldsAffectedLookup:r,_latestFieldValues:a}=this;for(const o of e)u(o,t,s);for(const[n,{resolver:c,dependencyPromises:l}]of t){Promise.all(l).then((async()=>{const[e,t]=this._makeContext(a);return n.executeAsync(e,t)})).then((()=>{if(r.has(n))for(const e of r.get(n))this._latestFieldValues[e.name]=e.value;c.resolve()}),(e=>{!e||o(e)||f(e)||n.markStale(),c.reject(e)}))}const i=(await Promise.allSettled(Array.from(t.values(),(({resolver:e})=>e.promise)))).filter((e=>"rejected"===e.status&&!(o(e.reason)||f(e.reason))));if(i.length>0)throw new AggregateError(i,"One or more expression executions failed")}_makeContext(e){const[t,s]=this._baseContext,r=this.feature.clone();return r.attributes=e,[{...t,$feature:r},s]}};e([i()],p.prototype,"_baseContext",null),e([i()],p.prototype,"feature",null),e([i()],p.prototype,"executors",void 0),e([i()],p.prototype,"inputFields",void 0),e([i()],p.prototype,"arcadeContextInfo",void 0),p=e([n(l)],p);const u=(e,t,s)=>{if(t.has(e))return;const r=a();t.set(e,{resolver:r,dependencyPromises:[]}),e.abort();const o=s.get(e);for(const a of o)u(a,t,s),t.get(a).dependencyPromises.push(r.promise)},f=e=>e&&"object"==typeof e&&"message"in e&&"Cancelled"===e.message;export{p as FormExpressionsManager};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{isSome as r}from"../../core/maybe.js";import{isAbortError as o,createResolver as a}from"../../core/promiseUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";const c="#JSAPI_FORM_EXPRESSIONS_MANAGER_GEOMETRY",l="esri.widgets.FeatureForm.FormExpressionsManager";let p=class extends t{constructor(e){super(e),this._fieldReferencesLookup=new Map,this._fieldsAffectedLookup=new Map,this._latestFieldValues={...e.feature.attributes}}initialize(){this._dependencyGraph=this._buildDependencyGraph()}get _baseContext(){const{editType:e,layer:t,map:s,originalFeature:o,spatialReference:a}=this.arcadeContextInfo,i="feature"===t?.type?t:"scene"===t?.type&&r(t.associatedLayer)?t.associatedLayer:void 0;return[{$originalfeature:o,$editcontext:{editType:e},$layer:i,$featureset:i,$datastore:t?.url,$map:s},{spatialReference:a}]}set feature(e){this._latestFieldValues={...e?.attributes},this._set("feature",e)}evaluateAll(){return this._evaluate(this.executors)}evaluateExpressions(e){return this._evaluate(e)}evaluateInvalidated(e){const{_fieldReferencesLookup:t,_latestFieldValues:s,feature:r}=this,o=new Set;for(const a of e)if(s[a]=r.getAttribute(a),t.has(a))for(const e of t.get(a))o.add(e);return this._evaluate([...o])}async evaluateInvalidatedByGeometry(){if(this._fieldReferencesLookup.has(c))return this._evaluate([...this._fieldReferencesLookup.get(c)])}resetExecutors(){for(const e of this.executors)e.reset()}_buildDependencyGraph(){const{_fieldReferencesLookup:e,_fieldsAffectedLookup:t,executors:o}=this,a=new Map(this.inputFields.map((e=>[e.name,e]))),i=new Map(o.map((e=>[e,new Array])));for(const n of o){for(const o of n.fieldsUsed){s(e,o,(()=>new Set)).add(n);const c=a.get(o),{valueExpressionExecutor:l,editableExpressionExecutor:p}=c;if(r(l)){i.get(l).push(n);s(t,l,(()=>new Set)).add(c)}if(r(p)){i.get(p).push(n);s(t,p,(()=>new Set)).add(c)}}if(n.geometryUsed){s(e,c,(()=>new Set)).add(n)}}return i}async _evaluate(e){const t=new Map,{_dependencyGraph:s,_fieldsAffectedLookup:r,_latestFieldValues:a}=this;for(const o of e)u(o,t,s);for(const[n,{resolver:c,dependencyPromises:l}]of t){Promise.all(l).then((async()=>{const[e,t]=this._makeContext(a);return n.executeAsync(e,t)})).then((()=>{if(r.has(n))for(const e of r.get(n))this._latestFieldValues[e.name]=e.value;c.resolve()}),(e=>{!e||o(e)||f(e)||n.markStale(),c.reject(e)}))}const i=(await Promise.allSettled(Array.from(t.values(),(({resolver:e})=>e.promise)))).filter((e=>"rejected"===e.status&&!(o(e.reason)||f(e.reason))));if(i.length>0)throw new AggregateError(i,"One or more expression executions failed")}_makeContext(e){const[t,s]=this._baseContext,r=this.feature.clone();return r.attributes=e,[{...t,$feature:r},s]}};e([i()],p.prototype,"_baseContext",null),e([i()],p.prototype,"feature",null),e([i()],p.prototype,"executors",void 0),e([i()],p.prototype,"inputFields",void 0),e([i()],p.prototype,"arcadeContextInfo",void 0),p=e([n(l)],p);const u=(e,t,s)=>{if(t.has(e))return;const r=a();t.set(e,{resolver:r,dependencyPromises:[]}),e.abort();const o=s.get(e);for(const a of o)u(a,t,s),t.get(a).dependencyPromises.push(r.promise)},f=e=>e&&"object"==typeof e&&"message"in e&&"Cancelled"===e.message;export{p as FormExpressionsManager};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../core/Accessor.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import{isSome as r,unwrap as s,get as l,isNone as o}from"../../core/maybe.js";import{generateUID as n}from"../../core/uid.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import"../../core/has.js";import p from"../../layers/support/CodedValueDomain.js";import"../../layers/support/Domain.js";import"../../layers/support/InheritedDomain.js";import"../../layers/support/RangeDomain.js";import{validateDomainValue as d,DomainValidationError as m,getDomainRange as y}from"../../layers/support/domainUtils.js";import{isNumericField as h,isStringField as c,isDateField as E,TypeValidationError as g,validateFieldValue as f,getFeatureEditFields as v,getFeatureGeometryFields as x,NumericRangeValidationError as b,getFieldRange as _}from"../../layers/support/fieldUtils.js";import{substitute as V}from"../../intl/substitute.js";var O,F;!function(e){e.Text="text",e.Number="number",e.Date="date",e.Unsupported="unsupported"}(O||(O={})),function(e){e.TOO_SHORT="length-validation-error::too-short"}(F||(F={}));const T={type:"number"},D={type:"number",intlOptions:{notation:"scientific"}},j={type:"date",intlOptions:{day:"2-digit",month:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}};function A(e){return e>=1e7||e<=-1e7}let N=class extends(i(t)){constructor(e){super(e),this._storedValue=null,this.editableExpressionExecutor=null,this.id=n().toString(),this.requiredExpressionExecutor=null,this.valueExpressionExecutor=null,this.visibilityExpressionExecutor=null,this.feature=null,this.field=null,this.fieldElement=null,this.layer=null,this.error=null,this.group=null,this.messages=null}get _configAllowsEdits(){const{fieldElement:e,layer:t,name:i}=this;if(r(e))return e.editableExpression?this.evaluatedEditableExpression:!1!==e.editable;return("subtype-group"!==t?.type?t?.popupTemplate?.fieldInfos?.find((({fieldName:e})=>e===i)):null)?.isEditable??!0}get _layerFieldAllowsEdits(){const{field:e,layer:t}=this;return t?.capabilities.operations.supportsEditing&&e?.editable}get isUsingValueExpression(){return this._shouldUseValueExpression()}get evaluatedEditableExpression(){const{editableExpressionExecutor:e}=this;return r(e)?!!e.lastEvaluatedValue:null}get evaluatedRequiredExpression(){const{requiredExpressionExecutor:e}=this;return r(e)?!!e.lastEvaluatedValue:null}get evaluatedVisibilityExpression(){const{visibilityExpressionExecutor:e}=this;return r(e)?!!e.lastEvaluatedValue:null}get evaluatedValueExpression(){const{valueExpressionExecutor:e}=this;return r(e)?e.lastEvaluatedValue:null}set initialFeature(e){this._set("initialFeature",e),this.notifyChange("valid")}get description(){return s(this.fieldElement)?.description}get domain(){const{layer:e}=this,t="typeIdField"in e?e.typeIdField:null,i=t===this.name,s=this.field?.domain;if(i&&!s){const t="subtype-group"===e.type?e.sublayers.map((({subtypeCode:e,title:t})=>({id:e,name:t}))):e.types.map((({id:e,name:t})=>({code:e,name:t})));return new p({name:"__internal-type-based-coded-value-domain__",codedValues:t})}const{feature:o}=this,n=t&&this.layer.getFieldDomain(this.name,{feature:o})||s,a=l(this.fieldElement,"domain");return r(a)&&this._isDomainCompatible(a)?a:n}get editable(){return!!this._layerFieldAllowsEdits&&(this.evaluatedEditableExpression??this._configAllowsEdits)}get inputType(){return s(this.fieldElement)?.input?.type}get errorMessage(){return this._toErrorMessage()}get hint(){return s(this.fieldElement)?.hint}get includeTime(){const{fieldElement:e}=this,t=r(e)&&"datetime-picker"===e.input?.type?e.input.includeTime:void 0;return void 0===t||t}get label(){return r(this.fieldElement)&&this.fieldElement.label||this.field.alias||this.field.name}get maxLength(){const e=-1;if(this.type===O.Date)return e;const{field:t,fieldElement:i}=this,s=t?.length,l=r(i)&&L(i.input)?i.input.maxLength:NaN;return!isNaN(l)&&l>=e&&(s===e||l<=s)?l:s}get minLength(){const e=-1;if(this.type===O.Date)return e;const{field:t,fieldElement:i}=this,s=t?.length,l=r(i)&&L(i.input)?i.input.minLength:NaN;return!isNaN(l)&&l>=e&&(s===e||l<=s)?l:e}get name(){return this.field?.name}get required(){const{editable:e,evaluatedRequiredExpression:t,field:i,visible:s}=this;return!!e&&(!1===i?.nullable||!(!s||!r(t))&&t)}set required(e){this._overrideIfSome("required",e)}get submittable(){const{field:e,required:t,valid:i,value:r}=this;return(!t||!o(r))&&(!!i||this.initialFeature.getAttribute(e.name)===r)}get type(){const{field:e}=this;return h(e)?O.Number:c(e)?O.Text:E(e)?O.Date:O.Unsupported}get updating(){const{editableExpressionExecutor:e,valueExpressionExecutor:t}=this;return r(t)&&t.updating||r(e)&&e.updating}get valid(){const e=this.editable?this._validate():null;return this._set("error",e),null===e}get value(){if(this._shouldUseValueExpression()){const e=this.evaluatedValueExpression;return this.type===O.Date&&e instanceof Date?e.getTime():r(e)&&"object"==typeof e?e.toString():e}return this.get("_storedValue")}set value(e){this.notifyChange("evaluatedVisibilityExpression"),this.set("_storedValue",e)}get visible(){return!this._isEditorField()&&(r(this.evaluatedVisibilityExpression)?this.evaluatedVisibilityExpression:!!r(this.fieldElement)||this._isVisibleByDefault())}_isDomainCompatible(e){const{field:t}=this;if("coded-value"===e?.type){const i=typeof e.codedValues[0].code;if("string"===i&&c(t)||"number"===i&&h(t))return!0}return!!("range"===e?.type&&h(t)||E(t))}_validate(){const{domain:e,field:t,initialFeature:i,minLength:r,required:s,type:l,valid:o,value:n}=this,a=s&&null===n,u=void 0!==o;return!a&&i.getAttribute(t.name)===n&&u?null:a?g.INVALID_TYPE:"text"===l&&r>-1&&"string"==typeof n&&n.length<r?F.TOO_SHORT:e?null!==n||s?d(e,n):null:f(t,n)}_isVisibleByDefault(){const e=this.field?.type;return"oid"!==e&&"global-id"!==e&&!this._isGeometryField()}_isEditorField(){return v(this.layer).includes(this.name)}_isGeometryField(){return x(this.layer).includes(this.name)}_shouldUseValueExpression(){return this._layerFieldAllowsEdits&&!this._configAllowsEdits&&r(this.valueExpressionExecutor)}_toErrorMessage(){const{domain:e,field:t,messages:i,minLength:r,value:s,required:l,type:o}=this,n=this.error;if(l&&null===s)return i.validationErrors.cannotBeNull;if(n===m.VALUE_OUT_OF_RANGE||n===b.OUT_OF_RANGE){const r=y(e)||_(t);return V(i.validationErrors.outsideRange,r,{format:{max:"date"===o?j:A(r.max)?D:T,min:"date"===o?j:A(r.min)?D:T}})}return n===m.INVALID_CODED_VALUE?i.validationErrors.invalidCodedValue:n===g.INVALID_TYPE?i.validationErrors.invalidType:n===F.TOO_SHORT?V(i.validationErrors.tooShort,{min:r}):null}};function L(e){return!!e&&"maxLength"in e}e([a()],N.prototype,"_storedValue",void 0),e([a()],N.prototype,"_configAllowsEdits",null),e([a()],N.prototype,"_layerFieldAllowsEdits",null),e([a()],N.prototype,"editableExpressionExecutor",void 0),e([a()],N.prototype,"requiredExpressionExecutor",void 0),e([a()],N.prototype,"valueExpressionExecutor",void 0),e([a()],N.prototype,"isUsingValueExpression",null),e([a()],N.prototype,"visibilityExpressionExecutor",void 0),e([a()],N.prototype,"evaluatedEditableExpression",null),e([a()],N.prototype,"evaluatedRequiredExpression",null),e([a()],N.prototype,"evaluatedVisibilityExpression",null),e([a()],N.prototype,"evaluatedValueExpression",null),e([a()],N.prototype,"feature",void 0),e([a()],N.prototype,"field",void 0),e([a({constructOnly:!0})],N.prototype,"fieldElement",void 0),e([a()],N.prototype,"initialFeature",null),e([a()],N.prototype,"layer",void 0),e([a({readOnly:!0})],N.prototype,"description",null),e([a()],N.prototype,"domain",null),e([a()],N.prototype,"editable",null),e([a({readOnly:!0})],N.prototype,"inputType",null),e([a({readOnly:!0})],N.prototype,"error",void 0),e([a({dependsOn:["error","messages","value"]})],N.prototype,"errorMessage",null),e([a()],N.prototype,"group",void 0),e([a({readOnly:!0})],N.prototype,"hint",null),e([a()],N.prototype,"includeTime",null),e([a()],N.prototype,"label",null),e([a()],N.prototype,"maxLength",null),e([a()],N.prototype,"minLength",null),e([a()],N.prototype,"messages",void 0),e([a({readOnly:!0})],N.prototype,"name",null),e([a()],N.prototype,"required",null),e([a()],N.prototype,"submittable",null),e([a()],N.prototype,"type",null),e([a()],N.prototype,"updating",null),e([a()],N.prototype,"valid",null),e([a({value:null})],N.prototype,"value",null),e([a()],N.prototype,"visible",null),N=e([u("esri.widgets.FeatureForm.InputField")],N);const U=N;export{U as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../core/Accessor.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import{isSome as r,unwrap as s,get as l,isNone as o}from"../../core/maybe.js";import{generateUID as n}from"../../core/uid.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import"../../core/has.js";import p from"../../layers/support/CodedValueDomain.js";import"../../layers/support/Domain.js";import"../../layers/support/InheritedDomain.js";import"../../layers/support/RangeDomain.js";import{validateDomainValue as d,DomainValidationError as m,getDomainRange as y}from"../../layers/support/domainUtils.js";import{isNumericField as h,isStringField as c,isDateField as E,TypeValidationError as f,validateFieldValue as g,getFeatureEditFields as v,getFeatureGeometryFields as x,NumericRangeValidationError as b,getFieldRange as _}from"../../layers/support/fieldUtils.js";import{substitute as V}from"../../intl/substitute.js";var O,F;!function(e){e.Text="text",e.Number="number",e.Date="date",e.Unsupported="unsupported"}(O||(O={})),function(e){e.TOO_SHORT="length-validation-error::too-short"}(F||(F={}));const T={type:"number"},D={type:"number",intlOptions:{notation:"scientific"}},j={type:"date",intlOptions:{day:"2-digit",month:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}};function A(e){return e>=1e7||e<=-1e7}let N=class extends(i(t)){constructor(e){super(e),this._storedValue=null,this.editableExpressionExecutor=null,this.id=n().toString(),this.requiredExpressionExecutor=null,this.valueExpressionExecutor=null,this.visibilityExpressionExecutor=null,this.feature=null,this.field=null,this.fieldElement=null,this.layer=null,this.error=null,this.group=null,this.messages=null}get _configAllowsEdits(){const{fieldElement:e,layer:t,name:i}=this;if(r(e))return e.editableExpression?this.evaluatedEditableExpression:!1!==e.editable;return("subtype-group"!==t?.type?t?.popupTemplate?.fieldInfos?.find((({fieldName:e})=>e===i)):null)?.isEditable??!0}get _layerFieldAllowsEdits(){const{field:e,layer:t}=this;return t?.capabilities.operations.supportsEditing&&e?.editable}get isUsingValueExpression(){return this._shouldUseValueExpression()}get evaluatedEditableExpression(){const{editableExpressionExecutor:e}=this;return r(e)?!!e.lastEvaluatedValue:null}get evaluatedRequiredExpression(){const{requiredExpressionExecutor:e}=this;return r(e)?!!e.lastEvaluatedValue:null}get evaluatedVisibilityExpression(){const{visibilityExpressionExecutor:e}=this;return r(e)?!!e.lastEvaluatedValue:null}get evaluatedValueExpression(){const{valueExpressionExecutor:e}=this;return r(e)?e.lastEvaluatedValue:null}set initialFeature(e){this._set("initialFeature",e),this.notifyChange("valid")}get description(){return s(this.fieldElement)?.description}get domain(){const{layer:e}=this,t="typeIdField"in e?e.typeIdField:null,i=t===this.name,s=this.field?.domain;if(i&&!s){const t="subtype-group"===e.type?e.sublayers.map((({subtypeCode:e,title:t})=>({id:e,name:t}))):e.types.map((({id:e,name:t})=>({code:e,name:t})));return new p({name:"__internal-type-based-coded-value-domain__",codedValues:t})}const{feature:o}=this,n=t&&this.layer.getFieldDomain(this.name,{feature:o})||s,u=l(this.fieldElement,"domain");return r(u)&&this._isDomainCompatible(u)?u:n}get editable(){return!!this._layerFieldAllowsEdits&&(this.evaluatedEditableExpression??this._configAllowsEdits)}get inputType(){return s(this.fieldElement)?.input?.type}get errorMessage(){return this._toErrorMessage()}get hint(){return s(this.fieldElement)?.hint}get includeTime(){const{fieldElement:e}=this,t=r(e)&&"datetime-picker"===e.input?.type?e.input.includeTime:void 0;return void 0===t||t}get label(){return r(this.fieldElement)&&this.fieldElement.label||this.field.alias||this.field.name}get maxLength(){const e=-1;if(this.type===O.Date)return e;const{field:t,fieldElement:i}=this,s=t?.length,l=r(i)&&L(i.input)?i.input.maxLength:NaN;return!isNaN(l)&&l>=e&&(s===e||l<=s)?l:s}get minLength(){const e=-1;if(this.type===O.Date)return e;const{field:t,fieldElement:i}=this,s=t?.length,l=r(i)&&L(i.input)?i.input.minLength:NaN;return!isNaN(l)&&l>=e&&(s===e||l<=s)?l:e}get name(){return this.field?.name}get required(){const{editable:e,evaluatedRequiredExpression:t,field:i,visible:s}=this;return!!e&&(!1===i?.nullable||!(!s||!r(t))&&t)}set required(e){this._overrideIfSome("required",e)}get submittable(){const{field:e,required:t,valid:i,value:r}=this;return(!t||!o(r))&&(!!i||this.initialFeature.getAttribute(e.name)===r)}get type(){const{field:e}=this;return h(e)?O.Number:c(e)?O.Text:E(e)?O.Date:O.Unsupported}get updating(){const{editableExpressionExecutor:e,valueExpressionExecutor:t}=this;return r(t)&&t.updating||r(e)&&e.updating}get valid(){const e=this.editable?this._validate():null;return this._set("error",e),null===e}get value(){if(this._shouldUseValueExpression()){const e=this.evaluatedValueExpression;if(this.type===O.Date){if(e instanceof Date)return e.getTime();if("number"!=typeof e)return parseInt(e,10)}return r(e)&&"object"==typeof e?e.toString():e}return this.get("_storedValue")}set value(e){this.notifyChange("evaluatedVisibilityExpression"),this.set("_storedValue",e)}get visible(){return!this._isEditorField()&&(r(this.evaluatedVisibilityExpression)?this.evaluatedVisibilityExpression:!!r(this.fieldElement)||this._isVisibleByDefault())}_isDomainCompatible(e){const{field:t}=this;if("coded-value"===e?.type){const i=typeof e.codedValues[0].code;if("string"===i&&c(t)||"number"===i&&h(t))return!0}return!!("range"===e?.type&&h(t)||E(t))}_validate(){const{domain:e,field:t,initialFeature:i,minLength:r,required:s,type:l,valid:o,value:n}=this,u=s&&null===n,a=void 0!==o;return!u&&i.getAttribute(t.name)===n&&a?null:u?f.INVALID_TYPE:"text"===l&&r>-1&&"string"==typeof n&&n.length<r?F.TOO_SHORT:e?null!==n||s?d(e,n):null:g(t,n)}_isVisibleByDefault(){const e=this.field?.type;return"oid"!==e&&"global-id"!==e&&!this._isGeometryField()}_isEditorField(){return v(this.layer).includes(this.name)}_isGeometryField(){return x(this.layer).includes(this.name)}_shouldUseValueExpression(){return this._layerFieldAllowsEdits&&!this._configAllowsEdits&&r(this.valueExpressionExecutor)}_toErrorMessage(){const{domain:e,field:t,messages:i,minLength:r,value:s,required:l,type:o}=this,n=this.error;if(l&&null===s)return i.validationErrors.cannotBeNull;if(n===m.VALUE_OUT_OF_RANGE||n===b.OUT_OF_RANGE){const r=y(e)||_(t);return V(i.validationErrors.outsideRange,r,{format:{max:"date"===o?j:A(r.max)?D:T,min:"date"===o?j:A(r.min)?D:T}})}return n===m.INVALID_CODED_VALUE?i.validationErrors.invalidCodedValue:n===f.INVALID_TYPE?i.validationErrors.invalidType:n===F.TOO_SHORT?V(i.validationErrors.tooShort,{min:r}):null}};function L(e){return!!e&&"maxLength"in e}e([u()],N.prototype,"_storedValue",void 0),e([u()],N.prototype,"_configAllowsEdits",null),e([u()],N.prototype,"_layerFieldAllowsEdits",null),e([u()],N.prototype,"editableExpressionExecutor",void 0),e([u()],N.prototype,"requiredExpressionExecutor",void 0),e([u()],N.prototype,"valueExpressionExecutor",void 0),e([u()],N.prototype,"isUsingValueExpression",null),e([u()],N.prototype,"visibilityExpressionExecutor",void 0),e([u()],N.prototype,"evaluatedEditableExpression",null),e([u()],N.prototype,"evaluatedRequiredExpression",null),e([u()],N.prototype,"evaluatedVisibilityExpression",null),e([u()],N.prototype,"evaluatedValueExpression",null),e([u()],N.prototype,"feature",void 0),e([u()],N.prototype,"field",void 0),e([u({constructOnly:!0})],N.prototype,"fieldElement",void 0),e([u()],N.prototype,"initialFeature",null),e([u()],N.prototype,"layer",void 0),e([u({readOnly:!0})],N.prototype,"description",null),e([u()],N.prototype,"domain",null),e([u()],N.prototype,"editable",null),e([u({readOnly:!0})],N.prototype,"inputType",null),e([u({readOnly:!0})],N.prototype,"error",void 0),e([u({dependsOn:["error","messages","value"]})],N.prototype,"errorMessage",null),e([u()],N.prototype,"group",void 0),e([u({readOnly:!0})],N.prototype,"hint",null),e([u()],N.prototype,"includeTime",null),e([u()],N.prototype,"label",null),e([u()],N.prototype,"maxLength",null),e([u()],N.prototype,"minLength",null),e([u()],N.prototype,"messages",void 0),e([u({readOnly:!0})],N.prototype,"name",null),e([u()],N.prototype,"required",null),e([u()],N.prototype,"submittable",null),e([u()],N.prototype,"type",null),e([u()],N.prototype,"updating",null),e([u()],N.prototype,"valid",null),e([u({value:null})],N.prototype,"value",null),e([u()],N.prototype,"visible",null),N=e([a("esri.widgets.FeatureForm.InputField")],N);const U=N;export{U as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{neverReached as t}from"../core/compilerUtils.js";import{isSome as i,isNone as a}from"../core/maybe.js";import{watch as s}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{getDomainRange as r}from"../layers/support/domainUtils.js";import{getFieldRange as o}from"../layers/support/fieldUtils.js";import u from"./Widget.js";import d from"./FeatureForm/FeatureFormViewModel.js";import{Heading as p,incrementHeadingLevel as c}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import{vmEvent as h}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";import{DateTime as _}from"luxon";import{getLocale as g}from"../intl/locale.js";const v={base:"esri-feature-form",form:"esri-feature-form__form",formHeader:"esri-feature-form__form-header",label:"esri-feature-form__label",inputFieldWrapper:"esri-feature-form__input-wrapper",inputFieldLoader:"esri-feature-form__input-loader",inputField:"esri-feature-form__input",inputDate:"esri-feature-form__input--date",inputTime:"esri-feature-form__input--time",inputRadioGroup:"esri-feature-form__input--radio-group",inputRadio:"esri-feature-form__input--radio",inputRadioLabel:"esri-feature-form__input--radio-label",inputDisabled:"esri-feature-form__input--disabled",inputSwitch:"esri-feature-form__input--switch",inputInvalid:"esri-feature-form__input--invalid",inputIconInvalid:"esri-feature-form__input-icon--invalid",errorMessage:"esri-feature-form__field-error-message",description:"esri-feature-form__description-text",dateInputPart:"esri-feature-form__date-input-part",loneDateInputPart:"esri-feature-form__date-input-part--lone",dateInputContainer:"esri-feature-form__date-input-container",dateFormatHint:"esri-feature-form__date-format-hint",group:"esri-feature-form__group",groupLabel:"esri-feature-form__group-label",groupHeader:"esri-feature-form__group-header",groupHeading:"esri-feature-form__group-header",groupTitle:"esri-feature-form__group-title",groupDescription:"esri-feature-form__group-description",groupToggleIcon:"esri-feature-form__group-toggle-icon",groupCollapsed:"esri-feature-form__group--collapsed",groupSequential:"esri-feature-form__group--sequential",groupActive:"esri-feature-form__group--active",collapseIcon:"esri-icon-up",errorIcon:"esri-icon-notice-triangle",expandIcon:"esri-icon-down",widget:"esri-widget",panel:"esri-widget--panel",input:"esri-input",select:"esri-select"},b={datePattern:"D",timePattern:"tt"};function F(e){return e&&e.inputFields}const I="data-field-name";let y=class extends u{constructor(e,t){super(e,t),this._activeDateFieldEdit=null,this._activeInputName=null,this._activeNumberFieldEdit=null,this._fieldFocusNeeded=!1,this._fieldToInitialIncompatibleDomainValue=new Map,this._switchFieldsWithInitialIncompatibleValue=new Set,this._userUpdatedInputFieldNames=new Set,this.disabled=!1,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesTemplates=null,this.viewModel=new d,this._handleRadioInputChange=e=>{this._commitInputValue(e.target)},this._handleInputInput=e=>{this._commitInputValue(e.currentTarget,!0)},this._handleFormKeyDown=this._handleFormKeyDown.bind(this),this._handleInputBlur=this._handleInputBlur.bind(this),this._handleInputFocus=this._handleInputFocus.bind(this),this._handleNumberInputMouseDown=this._handleNumberInputMouseDown.bind(this),this._handleInputKeyDown=this._handleInputKeyDown.bind(this),this._handleOptionChange=this._handleOptionChange.bind(this),this._handleGroupClick=this._handleGroupClick.bind(this),this._handleSubmit=this._handleSubmit.bind(this),this._afterInputCreateOrUpdate=this._afterInputCreateOrUpdate.bind(this)}initialize(){this.addHandles([s((()=>this.feature),(()=>{const e=this._getFocusableInput("forward");this._activeInputName=e&&e.name,this._userUpdatedInputFieldNames.clear(),this._fieldToInitialIncompatibleDomainValue.clear(),this._switchFieldsWithInitialIncompatibleValue.clear(),this._fieldFocusNeeded=!0})),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._userUpdatedInputFieldNames.add(e))),this._activeInputName=t,this._fieldFocusNeeded=!0,this.scheduleRender()}}))])}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),import("@esri/calcite-components/dist/components/calcite-input-message.js"),import("@esri/calcite-components/dist/components/calcite-progress.js"),import("@esri/calcite-components/dist/components/calcite-switch.js")])}destroy(){this._userUpdatedInputFieldNames.clear(),this._userUpdatedInputFieldNames=null}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return f("div",{class:this.classes(v.base,v.widget,v.panel)},"ready"===e?this.renderForm():null)}renderForm(){const{formTemplate:e}=this,t=i(e)&&e.title&&f(p,{key:"title",level:this.headingLevel},e.title),a=i(e)&&e.description&&f("p",{class:v.description,key:"description"},e.description),s=t||a?f("div",{class:v.formHeader},t,a):null;return f("form",{class:v.form,novalidate:!0,onsubmit:this._handleSubmit,onkeydown:this._handleFormKeyDown},s,this.renderFields())}renderFields(){const{viewModel:{inputFields:e}}=this;return e.filter((e=>e.visible)).map(((e,t)=>F(e)?this.renderGroup(e,t):this.renderLabeledField(e)))}renderGroup(e,t){const{formTemplate:a,disabled:s}=this,{description:n,inputFields:l,label:r,state:o}=e,u=l.filter((e=>e.visible)),d=this.viewModel.findField(this._activeInputName),m=!(!d||d.group!==e),h=`${this.id}_group_${t}`,_=`${this.id}_group-label_${t}`,g=`${this.id}_group-description_${t}`,b=n?f("p",{class:this.classes(v.groupDescription,v.description),id:g},n):null,F="sequential"===this.groupDisplay,I=F?m:"expanded"===o,y=I?v.collapseIcon:v.expandIcon;return f("fieldset",{"aria-expanded":I.toString(),"aria-labelledby":_,"aria-describedby":n?g:"",class:this.classes(v.group,F?v.groupSequential:null,I?null:v.groupCollapsed,m?v.groupActive:null,s?v.inputDisabled:null),disabled:s,"data-group":e,id:h,key:t,onclick:this._handleGroupClick},f("button",{role:F?"presentation":void 0,class:v.groupHeader,type:"button",tabIndex:F?-1:0},f("div",{class:v.groupTitle},f(p,{class:v.groupLabel,id:_,level:i(a)&&a.title?c(this.headingLevel):this.headingLevel},r),b),F?null:f("span",{class:this.classes(y,v.groupToggleIcon)})),u.map((e=>this.renderLabeledField(e))))}_getFocusableInput(e,t){const i=this.viewModel.allInputFields,a="forward"===e?i:i.slice().reverse();let s;if(t)if(F(t))s=a.indexOf(t.inputFields[0]);else{let i;if(this._isInputFieldInGroup(t)&&"collapsed"===t.group.state){const{inputFields:a}=t.group;i="forward"===e?a[a.length-1]:a[0]}else i=t;s=a.indexOf(i)+1}else s=0;for(let n=s;n<a.length;n++){const e=a[n];if(e.visible)return e}return null}renderLabeledField(e){const{feature:t,label:i,layer:a,type:s}=e;return f("label",{key:`${a.id}-${t.uid}-${e.name}`,class:v.label},[i,"unsupported"!==s?this.renderInputField(e):this.renderUnsupportedField(e),this.renderAuxiliaryText(e)])}renderInputField(e){const{domain:t,name:a,type:s,updating:n,value:l}=e,r=this.getCommonInputProps(e);if("coded-value"===t?.type){if(this._inputFieldHasInputType(e,"switch")){const{fieldElement:t}=e;if(!(this._switchFieldsWithInitialIncompatibleValue.has(a)||null==l||t.input.onValue!==l&&t.input.offValue!==l))return this.renderSwitchInputField(e,r);this._switchFieldsWithInitialIncompatibleValue.add(a)}return"radio-buttons"===e.inputType?this.renderRadioButtonsInputField(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),r):this.renderSelectInputField(e,this._getFieldValueOptions(a,t),r)}if("datetime-picker"===e.inputType||"date"===s)return this.renderDateInputField(e,r);const o="number"===s?f("input",{type:"number",...r,value:i(this._activeNumberFieldEdit)&&this._activeNumberFieldEdit.fieldName===e.name?this._activeNumberFieldEdit.value:`${r.value}`}):"text-area"===e.inputType?f("textarea",{...r}):f("input",{type:"text",...r});return n?f("div",{class:v.inputFieldWrapper},o,f("div",{class:v.inputFieldLoader},f("calcite-progress",{type:"indeterminate"}))):o}_parseDateTime(e,t,i){if(i){let a=_.fromJSDate(this._parseDate(e,i));const s=_.fromMillis(t.value??Date.now());return a="date"===i?a.set({hour:s.hour,minute:s.minute,second:s.second}):a.set({day:s.day,month:s.month,year:s.year}),a.isValid?a.toMillis():null}const a=_.fromJSDate(this._parseDate(e));return a.isValid?a.toMillis():null}renderDateInputField(e,t){const{value:i,includeTime:a}=e,{date:s,time:n}=this._formatDate(0),l=`${this.id}-${t.key}`,r=`${l}-date`,o=`${l}-time`,{_activeDateFieldEdit:u}=this;let{date:d,time:p}=this._formatDate(i);return u?.fieldName===e.name&&(d=u.date.input?.value??d,p=u.time.input?.value??p),f("div",{key:`${t.key}-date`,class:v.dateInputContainer},f("div",{class:this.classes(v.dateInputPart,a?null:v.loneDateInputPart)},f("input",{"aria-label":e.label,"aria-describedby":r,type:"text",...t,"data-date-part":"date",class:this.classes(t.class,v.inputDate),value:d}),f("div",{class:v.dateFormatHint,id:r},s)),a?f("div",{class:v.dateInputPart,key:"time-input"},f("input",{"aria-describedby":o,"aria-label":e.label,type:"text",...t,"data-date-part":"time",class:this.classes(t.class,v.inputTime),value:p}),f("div",{class:v.dateFormatHint,id:o},n)):null)}renderUnsupportedField(e){const t=this.getCommonInputProps(e);return f("input",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,disabled:t.disabled,class:this.classes(v.input,v.inputField,v.inputDisabled),onfocus:t.onfocus,readOnly:!0,tabIndex:t.tabIndex,type:"text",value:t.value,[I]:t[I]})}renderSelectInputField(e,t,i){const{value:s}=e,{messages:n,messagesTemplates:l}=this,r=t.map((e=>e.map((e=>f("calcite-combobox-item",{value:`${e.value}`,"text-label":e.name,key:`#${e.value}`,selected:s===e.value}))))),[o,u]=r;this._registerIncompatibleValue(s,t.flat(),e,(e=>{u.unshift(f("calcite-combobox-item",{value:`${e}`,"text-label":`${e}`,key:"incompatible-option",readOnly:!0}))}));const d=u.length>0?[f("calcite-combobox-item-group",{key:"recommended",label:n.recommended},o),f("calcite-combobox-item-group",{key:"other",label:l.other},u)]:o,p=a(e.fieldElement)||this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.showNoValueOption;if(!e.required&&p){const t="",i=this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty;d.unshift(f("calcite-combobox-item",{value:t,"text-label":this.messages.empty,key:"empty-option"},i))}return f("calcite-combobox",{...i,"selection-mode":"single",disabled:i.disabled||i.readOnly,allowCustomValues:!1,onCalciteComboboxChange:e=>this._handleOptionChange(e.target)},d)}_registerIncompatibleValue(e,t,i,a){const s=this._fieldToInitialIncompatibleDomainValue,n=s.has(i.name);(n||null!=e&&""!==e&&!t.some((t=>t.value===e))||n)&&(n||s.set(i.name,e),a?.(s.get(i.name)))}renderRadioButtonsInputField(e,t,i){const{value:s}=e,n=t.map((t=>this.renderRadioButton({key:t.name,label:t.name,name:e.name,value:t.value,selected:t.value===s,props:i})));this._registerIncompatibleValue(s,t,e);const l=a(e.fieldElement)||this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.showNoValueOption;if(!e.required&&l){const t="",a=this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty,l=s===t||null===s;n.unshift(this.renderRadioButton({key:"empty-option",label:a,name:e.name,value:t,selected:l,props:i}))}return f("div",{key:`${i.key}-radio`,class:v.inputRadioGroup},n)}renderSwitchInputField(e,t){const{value:i}=e,a=!!this._inputFieldHasInputType(e,"switch")&&i===e.fieldElement.input.onValue;return f("calcite-switch",{...t,class:v.inputSwitch,onCalciteSwitchChange:e=>{this._parseValue(e.currentTarget)},checked:a,disabled:t.disabled||t.readOnly})}renderRadioButton({key:e,name:t,value:i,selected:a,label:s,props:n}){return f("label",{key:e,class:v.inputRadioLabel},f("input",{...n,class:v.inputRadio,name:t,type:"radio",value:i,checked:a,onchange:this._handleRadioInputChange}),s)}renderAuxiliaryText(e){const t=this._userUpdatedInputFieldNames.has(e.name)&&!e.valid?e.errorMessage:i(this.viewModel.contingencyConstraintViolations.get(e.name))?this.messages.validationErrors.valuesIncompatible:i(e.valueExpressionExecutor)&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return i(t)?f("calcite-input-message",{status:"invalid",icon:!0,active:!0},t):e.description?f("div",{key:"description",class:v.description},e.description):void 0}getCommonInputProps(e){const{disabled:t,groupDisplay:a}=this,{editable:s,group:n,hint:l,maxLength:r,minLength:o,name:u,required:d,type:p,valid:c,value:m}=e,h=this._userUpdatedInputFieldNames.has(u),f=!s,_="all"===a&&i(n)&&"collapsed"===n.state;return{afterCreate:this._afterInputCreateOrUpdate,afterUpdate:this._afterInputCreateOrUpdate,"aria-invalid":c?"false":"true",class:this.classes(v.input,v.inputField,t||f?v.inputDisabled:null,h&&!c?v.inputInvalid:null),key:u,label:u,minlength:o>-1?`${o}`:"",maxlength:r>-1?`${r}`:"",...this._getNumberFieldConstraints(e),disabled:t,readOnly:f,value:null==m?"":`${m}`,[I]:u,onfocus:this._handleInputFocus,oninput:this._handleInputInput,onblur:this._handleInputBlur,onkeydown:this._handleInputKeyDown,onmousedown:"number"===p?this._handleNumberInputMouseDown:null,placeholder:"number"===p||"text"===p?l:"",required:d,tabIndex:_?-1:0}}_isInputFieldInGroup(e){return!F(e)&&i(e.group)}_handleNumberInputMouseDown({target:e}){e.focus(),this.scheduleRender()}_getFieldValueOptions(e,t){const i=t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),a=this.viewModel.fieldsWithContingentValues.has(e)?this._getContingentValueOptions(e):[];if(a.length>0){const e=new Set(a.map((e=>e.value)));return[a,i.filter((t=>!e.has(t.value)))]}return[i,[]]}_getContingentValueOptions(e){const t={};for(const n of this.viewModel.allInputFields){const{name:i,value:s}=n;!a(s)&&i!==e&&this.viewModel.fieldsWithContingentValues.has(i)&&(t[i]=s)}const i=this.viewModel.joinedContingentValues.slice(),s=new Map;for(const n of i){const i=n.values[e];if(a(i)||"code"!==i.objectType&&"null"!==i.objectType)continue;const{code:l,name:r}="null"===i.objectType?{code:"",name:this.messages.empty}:i.codedValue;if(s.has(l))continue;Object.entries(t).every((([e,t])=>!n.values.hasOwnProperty(e)||this._valueIsValidContingentValue(t,n.values[e])))&&s.set(l,{name:r,value:l})}return[...s.values()]}_getInputFieldFromInput(e){return this.viewModel.findField(e.getAttribute(I))}_getNumberFieldConstraints(e){const t=r(e.domain)||o(e.field);return t&&t.max!==Number.MAX_VALUE&&t.min!==Number.MIN_VALUE?t:{min:null,max:null}}_afterInputCreateOrUpdate(e){const{viewModel:t}=this,i=this._getInputFieldFromInput(e),a=t.findField(this._activeInputName),s=this._fieldToInitialIncompatibleDomainValue.get(i.name)===i.value;this._fieldFocusNeeded&&a===i&&("radio-buttons"!==i.inputType||s||e.checked)&&(this._fieldFocusNeeded=!1,this._isInputFieldInGroup(i)&&(i.group.state="expanded"),e.focus())}_handleInputFocus(e){const t=e.target,i=this._getInputFieldFromInput(t);this._activeInputName=i.name,"date"===i.type?this._syncDateFieldEdits(t):this._isNumberInputField(i)&&this._setUpNumberFieldEdit(t)}_isNumberInputField({domain:e,inputType:t="text-box",type:i}){return"number"===i&&"text-box"===t&&(!e||"coded-value"!==e.type)}_handleInputBlur(e){const t=e.target,a=this._getInputFieldFromInput(t);if("date"===a.type){const i=e.relatedTarget,s=i&&this._getInputFieldFromInput(i);if(s&&"date"===a.type&&"date"===s.type&&a.field===s.field){if(""!==t.value&&""===i.value){const s=i.getAttribute("data-date-part");i.value=this._formatDate(a.value??Date.now())[s],this._parseDate(t.value,t.getAttribute("data-date-part"))&&this._commitInputValue(e.target,!0,!1)}return}}"number"===a.type&&i(this._activeNumberFieldEdit)&&(this._activeNumberFieldEdit.input.value=`${a.value}`,this._activeNumberFieldEdit=null),this._commitInputValue(t),this.scheduleRender()}_commitInputValue(e,t=!1,a=!0){const s=this._getInputFieldFromInput(e);if(this._activeDateFieldEdit){const{date:i,time:n}=this._activeDateFieldEdit,l=this._parseDateTime(e.value,s,i.active?"date":"time"),r=null!==this.viewModel.getValue(s.name),o=i.input&&(n.input||!s.includeTime),u=null===l;if(t){if(u)return;(o||!a||r)&&this._updateDateFieldValue(s,l)}else{if(""===i.input?.value||""===n.input?.value)this._updateDateFieldValue(s,null);else if(o){const e=`${i.input.value} ${n.input?.value??""}`,t=this._parseDateTime(e,s);!(null!==t)&&r||this._updateDateFieldValue(s,t)}this._activeDateFieldEdit=null}}else i(this._activeNumberFieldEdit)&&this._isNumberInputField(s)&&(this._activeNumberFieldEdit.value=e.value),this._updateFieldValue(e)}_handleInputKeyDown(e){const{key:t,altKey:i,ctrlKey:a,metaKey:s}=e,n=this._getInputFieldFromInput(e.target);if("Enter"===t)this._isInputFieldInGroup(n)&&"collapsed"===n.group.state&&(n.group.state="expanded");else{const{type:l}=n.field,r="single"===l||"double"===l,o=!i&&!a&&!s;if(("integer"===l||"small-integer"===l||r)&&o&&1===t.length){const i=Number(t),a=["-","+"],s=["e","."],n=r?[...a,...s]:a;isNaN(i)&&!n.includes(t)&&e.preventDefault()}}}_setUpNumberFieldEdit(e){const t=this._getInputFieldFromInput(e);this._activeNumberFieldEdit={fieldName:t.name,input:e,value:e.value}}_syncDateFieldEdits(e){const t=this._getInputFieldFromInput(e);if("date"!==t.type)return;const i=e.getAttribute("data-date-part"),a="date"===i?{value:e.value,input:e,active:!0}:{...this._activeDateFieldEdit?.date,active:!1},s="time"===i?{value:e.value,input:e,active:!0}:{...this._activeDateFieldEdit?.time,active:!1};this._activeDateFieldEdit={fieldName:t.name,date:a,time:s}}_updateFieldValue(e){const t=e.getAttribute(I);if(this.viewModel.setValue(t,this._parseValue(e)),this._userUpdatedInputFieldNames.add(t),this.viewModel.fieldsWithContingentValues.has(t)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>i(t))));this.viewModel.validateContingencyConstraints(e)}}_updateDateFieldValue(e,t){this.viewModel.setValue(e.name,t),this._userUpdatedInputFieldNames.add(e.name)}_parseValue(e){const t=this._getInputFieldFromInput(e),i=e.value;if(this._inputFieldHasInputType(t,"switch")&&"CALCITE-COMBOBOX"!==e.tagName)return e.checked?t.fieldElement.input.onValue:t.fieldElement.input.offValue;if("radio-buttons"===t.inputType&&"radio"===e.type&&!e.checked)return t.value;const{type:a}=t;if("number"===a)return i?parseFloat(i):null;if("date"===a){if(!i)return null;const a=Number(i);if(!isNaN(a))return a;const s=e.getAttribute("data-date-part"),n=this._parseDate(i,s);if(!n)return null;let l=_.fromJSDate(n);const r=t.domain,o=_.now();let u=o;if(r&&"range"===r.type){const e=_.fromMillis(r.maxValue);o<e&&(u=e)}const d=this.viewModel.getValue(t.name),p=null!=d?_.fromMillis(d):u;return l="date"===s?l.set({hour:p.hour,minute:p.minute,second:p.second}):l.set({day:p.day,month:p.month,year:p.year}),l.toMillis()}return i}_handleOptionChange(e){this._commitInputValue(e),this.scheduleRender()}_handleGroupClick(e){const t=e.currentTarget["data-group"],i="expanded"===t.state,a="sequential"===this.groupDisplay,s=`.${v.groupHeader}`;if(!(i&&!e.target.closest(s))){if(this._activeInputName=this._getFocusableInput("forward",t)?.name,a){const a=e.target.closest(s);if(i&&!a)return;this.viewModel.inputFields.forEach((e=>{F(e)&&e!==t&&(e.state="collapsed")}))}t.state=i?"collapsed":"expanded",this._fieldFocusNeeded=a,this.scheduleRender()}}_handleSubmit(e){e.preventDefault()}_handleFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_formatDate(e){if(null==e)return{date:"",time:""};const t=_.fromMillis(e,{locale:g(),numberingSystem:"latn"});return{date:t.toLocaleString({year:"numeric",month:"2-digit",day:"2-digit"}),time:t.toFormat(b.timePattern)}}_parseDate(e,t){if(null==e||""===e)return null;const{timePattern:i,datePattern:a}=b,s=t?"date"===t?a:i:`${a} ${i}`,n=_.fromFormat(e,s,{locale:g(),numberingSystem:"latn"});return n.isValid?n.toJSDate():null}_inputFieldHasInputType(e,t){return i(e.fieldElement)&&e.fieldElement.input?.type===t}_valueIsValidContingentValue(e,i){switch(i.objectType){case"any":return!0;case"null":return null==e;case"code":return e===i.codedValue?.code;case"range":return e>=i.minValue&&e<=i.maxValue;default:return t(i.objectType),!1}}};e([n()],y.prototype,"disabled",void 0),e([n()],y.prototype,"feature",null),e([n()],y.prototype,"formTemplate",null),e([n()],y.prototype,"groupDisplay",void 0),e([n()],y.prototype,"headingLevel",void 0),e([n()],y.prototype,"label",null),e([n()],y.prototype,"layer",null),e([n(),m("esri/widgets/FeatureForm/t9n/FeatureForm")],y.prototype,"messages",void 0),e([n(),m("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],y.prototype,"messagesTemplates",void 0),e([n()],y.prototype,"spatialReference",null),e([n()],y.prototype,"strict",null),e([n()],y.prototype,"view",null),e([n(),h(["value-change","submit"])],y.prototype,"viewModel",void 0),y=e([l("esri.widgets.FeatureForm")],y);const w=y;export{w as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{neverReached as t}from"../core/compilerUtils.js";import{isSome as i,isNone as a}from"../core/maybe.js";import{watch as s}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{getDomainRange as r}from"../layers/support/domainUtils.js";import{getFieldRange as o}from"../layers/support/fieldUtils.js";import u from"./Widget.js";import d from"./FeatureForm/FeatureFormViewModel.js";import{Heading as p,incrementHeadingLevel as c}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import{vmEvent as h}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";import{DateTime as _}from"luxon";import{getLocale as g}from"../intl/locale.js";const v={base:"esri-feature-form",form:"esri-feature-form__form",formHeader:"esri-feature-form__form-header",label:"esri-feature-form__label",inputFieldWrapper:"esri-feature-form__input-wrapper",inputFieldLoader:"esri-feature-form__input-loader",inputField:"esri-feature-form__input",inputDate:"esri-feature-form__input--date",inputTime:"esri-feature-form__input--time",inputRadioGroup:"esri-feature-form__input--radio-group",inputRadio:"esri-feature-form__input--radio",inputRadioLabel:"esri-feature-form__input--radio-label",inputDisabled:"esri-feature-form__input--disabled",inputSwitch:"esri-feature-form__input--switch",inputInvalid:"esri-feature-form__input--invalid",inputIconInvalid:"esri-feature-form__input-icon--invalid",errorMessage:"esri-feature-form__field-error-message",description:"esri-feature-form__description-text",dateInputPart:"esri-feature-form__date-input-part",loneDateInputPart:"esri-feature-form__date-input-part--lone",dateInputContainer:"esri-feature-form__date-input-container",dateFormatHint:"esri-feature-form__date-format-hint",group:"esri-feature-form__group",groupLabel:"esri-feature-form__group-label",groupHeader:"esri-feature-form__group-header",groupHeading:"esri-feature-form__group-header",groupTitle:"esri-feature-form__group-title",groupDescription:"esri-feature-form__group-description",groupToggleIcon:"esri-feature-form__group-toggle-icon",groupCollapsed:"esri-feature-form__group--collapsed",groupSequential:"esri-feature-form__group--sequential",groupActive:"esri-feature-form__group--active",collapseIcon:"esri-icon-up",errorIcon:"esri-icon-notice-triangle",expandIcon:"esri-icon-down",widget:"esri-widget",panel:"esri-widget--panel",input:"esri-input",select:"esri-select"},b={datePattern:"D",timePattern:"tt"};function F(e){return e&&e.inputFields}const I="data-field-name";let y=class extends u{constructor(e,t){super(e,t),this._activeDateFieldEdit=null,this._activeInputName=null,this._activeNumberFieldEdit=null,this._fieldFocusNeeded=!1,this._fieldToInitialIncompatibleDomainValue=new Map,this._switchFieldsWithInitialIncompatibleValue=new Set,this._userUpdatedInputFieldNames=new Set,this.disabled=!1,this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesTemplates=null,this.viewModel=new d,this._handleRadioInputChange=e=>{this._commitInputValue(e.target)},this._handleInputInput=e=>{this._commitInputValue(e.currentTarget,!0)},this._handleFormKeyDown=this._handleFormKeyDown.bind(this),this._handleInputBlur=this._handleInputBlur.bind(this),this._handleInputFocus=this._handleInputFocus.bind(this),this._handleNumberInputMouseDown=this._handleNumberInputMouseDown.bind(this),this._handleInputKeyDown=this._handleInputKeyDown.bind(this),this._handleOptionChange=this._handleOptionChange.bind(this),this._handleGroupClick=this._handleGroupClick.bind(this),this._handleSubmit=this._handleSubmit.bind(this),this._afterInputCreateOrUpdate=this._afterInputCreateOrUpdate.bind(this)}initialize(){this.addHandles([s((()=>this.feature),(()=>{const e=this._getFocusableInput("forward");this._activeInputName=e&&e.name,this._userUpdatedInputFieldNames.clear(),this._fieldToInitialIncompatibleDomainValue.clear(),this._switchFieldsWithInitialIncompatibleValue.clear(),this._fieldFocusNeeded=!0})),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._userUpdatedInputFieldNames.add(e))),this._activeInputName=t,this._fieldFocusNeeded=!0,this.scheduleRender()}}))])}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),import("@esri/calcite-components/dist/components/calcite-input-message.js"),import("@esri/calcite-components/dist/components/calcite-progress.js"),import("@esri/calcite-components/dist/components/calcite-switch.js")])}destroy(){this._userUpdatedInputFieldNames.clear(),this._userUpdatedInputFieldNames=null}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return f("div",{class:this.classes(v.base,v.widget,v.panel)},"ready"===e?this.renderForm():null)}renderForm(){const{formTemplate:e}=this,t=i(e)&&e.title&&f(p,{key:"title",level:this.headingLevel},e.title),a=i(e)&&e.description&&f("p",{class:v.description,key:"description"},e.description),s=t||a?f("div",{class:v.formHeader},t,a):null;return f("form",{class:v.form,novalidate:!0,onsubmit:this._handleSubmit,onkeydown:this._handleFormKeyDown},s,this.renderFields())}renderFields(){const{viewModel:{inputFields:e}}=this;return e.filter((e=>e.visible)).map(((e,t)=>F(e)?this.renderGroup(e,t):this.renderLabeledField(e)))}renderGroup(e,t){const{formTemplate:a,disabled:s}=this,{description:n,inputFields:l,label:r,state:o}=e,u=l.filter((e=>e.visible)),d=this.viewModel.findField(this._activeInputName),m=!(!d||d.group!==e),h=`${this.id}_group_${t}`,_=`${this.id}_group-label_${t}`,g=`${this.id}_group-description_${t}`,b=n?f("p",{class:this.classes(v.groupDescription,v.description),id:g},n):null,F="sequential"===this.groupDisplay,I=F?m:"expanded"===o,y=I?v.collapseIcon:v.expandIcon;return f("fieldset",{"aria-expanded":I.toString(),"aria-labelledby":_,"aria-describedby":n?g:"",class:this.classes(v.group,F?v.groupSequential:null,I?null:v.groupCollapsed,m?v.groupActive:null,s?v.inputDisabled:null),disabled:s,"data-group":e,id:h,key:t,onclick:this._handleGroupClick},f("button",{role:F?"presentation":void 0,class:v.groupHeader,type:"button",tabIndex:F?-1:0},f("div",{class:v.groupTitle},f(p,{class:v.groupLabel,id:_,level:i(a)&&a.title?c(this.headingLevel):this.headingLevel},r),b),F?null:f("span",{class:this.classes(y,v.groupToggleIcon)})),u.map((e=>this.renderLabeledField(e))))}_getFocusableInput(e,t){const i=this.viewModel.allInputFields,a="forward"===e?i:i.slice().reverse();let s;if(t)if(F(t))s=a.indexOf(t.inputFields[0]);else{let i;if(this._isInputFieldInGroup(t)&&"collapsed"===t.group.state){const{inputFields:a}=t.group;i="forward"===e?a[a.length-1]:a[0]}else i=t;s=a.indexOf(i)+1}else s=0;for(let n=s;n<a.length;n++){const e=a[n];if(e.visible)return e}return null}renderLabeledField(e){const{feature:t,label:i,layer:a,type:s}=e;return f("label",{key:`${a.id}-${t.uid}-${e.name}`,class:v.label},[i,"unsupported"!==s?this.renderInputField(e):this.renderUnsupportedField(e),this.renderAuxiliaryText(e)])}renderInputField(e){const{domain:t,name:a,type:s,updating:n,value:l}=e,r=this.getCommonInputProps(e);if("coded-value"===t?.type){if(this._inputFieldHasInputType(e,"switch")){const{fieldElement:t}=e;if(!(this._switchFieldsWithInitialIncompatibleValue.has(a)||null==l||t.input.onValue!==l&&t.input.offValue!==l))return this.renderSwitchInputField(e,r);this._switchFieldsWithInitialIncompatibleValue.add(a)}return"radio-buttons"===e.inputType?this.renderRadioButtonsInputField(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),r):this.renderSelectInputField(e,this._getFieldValueOptions(a,t),r)}if("datetime-picker"===e.inputType||"date"===s)return this.renderDateInputField(e,r);const o="number"===s?f("input",{type:"number",...r,value:i(this._activeNumberFieldEdit)&&this._activeNumberFieldEdit.fieldName===e.name?this._activeNumberFieldEdit.value:`${r.value}`}):"text-area"===e.inputType?f("textarea",{...r}):f("input",{type:"text",...r});return n?f("div",{class:v.inputFieldWrapper},o,f("div",{class:v.inputFieldLoader},f("calcite-progress",{type:"indeterminate"}))):o}_parseDateTime(e,t,i){if(i){let a=_.fromJSDate(this._parseDate(e,i));const s=_.fromMillis(t.value??Date.now());return a="date"===i?a.set({hour:s.hour,minute:s.minute,second:s.second}):a.set({day:s.day,month:s.month,year:s.year}),a.isValid?a.toMillis():null}const a=_.fromJSDate(this._parseDate(e));return a.isValid?a.toMillis():null}renderDateInputField(e,t){const{value:i,includeTime:a}=e,{date:s,time:n}=this._formatDate(0),l=`${this.id}-${t.key}`,r=`${l}-date`,o=`${l}-time`,{_activeDateFieldEdit:u}=this;let{date:d,time:p}=this._formatDate(i);return u?.fieldName===e.name&&(d=u.date.input?.value??d,p=u.time.input?.value??p),f("div",{key:`${t.key}-date`,class:v.dateInputContainer},f("div",{class:this.classes(v.dateInputPart,a?null:v.loneDateInputPart)},f("input",{"aria-label":e.label,"aria-describedby":r,type:"text",...t,"data-date-part":"date",class:this.classes(t.class,v.inputDate),value:d}),f("div",{class:v.dateFormatHint,id:r},s)),a?f("div",{class:v.dateInputPart,key:"time-input"},f("input",{"aria-describedby":o,"aria-label":e.label,type:"text",...t,"data-date-part":"time",class:this.classes(t.class,v.inputTime),value:p}),f("div",{class:v.dateFormatHint,id:o},n)):null)}renderUnsupportedField(e){const t=this.getCommonInputProps(e);return f("input",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,disabled:t.disabled,class:this.classes(v.input,v.inputField,v.inputDisabled),onfocus:t.onfocus,readOnly:!0,tabIndex:t.tabIndex,type:"text",value:t.value,[I]:t[I]})}renderSelectInputField(e,t,i){const{value:s}=e,{messages:n,messagesTemplates:l}=this,r=t.map((e=>e.map((e=>f("calcite-combobox-item",{value:`${e.value}`,"text-label":e.name,key:`#${e.value}`,selected:s===e.value}))))),[o,u]=r;this._registerIncompatibleValue(s,t.flat(),e,(e=>{u.unshift(f("calcite-combobox-item",{value:`${e}`,"text-label":`${e}`,key:"incompatible-option",readOnly:!0}))}));const d=u.length>0?[f("calcite-combobox-item-group",{key:"recommended",label:n.recommended},o),f("calcite-combobox-item-group",{key:"other",label:l.other},u)]:o,p=a(e.fieldElement)||this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.showNoValueOption;if(!e.required&&p){const t="",i=this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty;d.unshift(f("calcite-combobox-item",{value:t,"text-label":this.messages.empty,key:"empty-option"},i))}return f("calcite-combobox",{...i,"selection-mode":"single","overlay-positioning":"fixed",disabled:i.disabled||i.readOnly,allowCustomValues:!1,onCalciteComboboxChange:e=>this._handleOptionChange(e.target)},d)}_registerIncompatibleValue(e,t,i,a){const s=this._fieldToInitialIncompatibleDomainValue,n=s.has(i.name);(n||null!=e&&""!==e&&!t.some((t=>t.value===e))||n)&&(n||s.set(i.name,e),a?.(s.get(i.name)))}renderRadioButtonsInputField(e,t,i){const{value:s}=e,n=t.map((t=>this.renderRadioButton({key:t.name,label:t.name,name:e.name,value:t.value,selected:t.value===s,props:i})));this._registerIncompatibleValue(s,t,e);const l=a(e.fieldElement)||this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.showNoValueOption;if(!e.required&&l){const t="",a=this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty,l=s===t||null===s;n.unshift(this.renderRadioButton({key:"empty-option",label:a,name:e.name,value:t,selected:l,props:i}))}return f("div",{key:`${i.key}-radio`,class:v.inputRadioGroup},n)}renderSwitchInputField(e,t){const{value:i}=e,a=!!this._inputFieldHasInputType(e,"switch")&&i===e.fieldElement.input.onValue;return f("calcite-switch",{...t,class:v.inputSwitch,onCalciteSwitchChange:e=>{this._parseValue(e.currentTarget)},checked:a,disabled:t.disabled||t.readOnly})}renderRadioButton({key:e,name:t,value:i,selected:a,label:s,props:n}){return f("label",{key:e,class:v.inputRadioLabel},f("input",{...n,class:v.inputRadio,name:t,type:"radio",value:i,checked:a,onchange:this._handleRadioInputChange}),s)}renderAuxiliaryText(e){const t=this._userUpdatedInputFieldNames.has(e.name)&&!e.valid?e.errorMessage:i(this.viewModel.contingencyConstraintViolations.get(e.name))?this.messages.validationErrors.valuesIncompatible:i(e.valueExpressionExecutor)&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return i(t)?f("calcite-input-message",{status:"invalid",icon:!0,active:!0},t):e.description?f("div",{key:"description",class:v.description},e.description):void 0}getCommonInputProps(e){const{disabled:t,groupDisplay:a}=this,{editable:s,group:n,hint:l,maxLength:r,minLength:o,name:u,required:d,type:p,valid:c,value:m}=e,h=this._userUpdatedInputFieldNames.has(u),f=!s,_="all"===a&&i(n)&&"collapsed"===n.state;return{afterCreate:this._afterInputCreateOrUpdate,afterUpdate:this._afterInputCreateOrUpdate,"aria-invalid":c?"false":"true",class:this.classes(v.input,v.inputField,t||f?v.inputDisabled:null,h&&!c?v.inputInvalid:null),key:u,label:u,minlength:o>-1?`${o}`:"",maxlength:r>-1?`${r}`:"",...this._getNumberFieldConstraints(e),disabled:t,readOnly:f,value:null==m?"":`${m}`,[I]:u,onfocus:this._handleInputFocus,oninput:this._handleInputInput,onblur:this._handleInputBlur,onkeydown:this._handleInputKeyDown,onmousedown:"number"===p?this._handleNumberInputMouseDown:null,placeholder:"number"===p||"text"===p?l:"",required:d,tabIndex:_?-1:0}}_isInputFieldInGroup(e){return!F(e)&&i(e.group)}_handleNumberInputMouseDown({target:e}){e.focus(),this.scheduleRender()}_getFieldValueOptions(e,t){const i=t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),a=this.viewModel.fieldsWithContingentValues.has(e)?this._getContingentValueOptions(e):[];if(a.length>0){const e=new Set(a.map((e=>e.value)));return[a,i.filter((t=>!e.has(t.value)))]}return[i,[]]}_getContingentValueOptions(e){const t={};for(const n of this.viewModel.allInputFields){const{name:i,value:s}=n;!a(s)&&i!==e&&this.viewModel.fieldsWithContingentValues.has(i)&&(t[i]=s)}const i=this.viewModel.joinedContingentValues.slice(),s=new Map;for(const n of i){const i=n.values[e];if(a(i)||"code"!==i.objectType&&"null"!==i.objectType)continue;const{code:l,name:r}="null"===i.objectType?{code:"",name:this.messages.empty}:i.codedValue;if(s.has(l))continue;Object.entries(t).every((([e,t])=>!n.values.hasOwnProperty(e)||this._valueIsValidContingentValue(t,n.values[e])))&&s.set(l,{name:r,value:l})}return[...s.values()]}_getInputFieldFromInput(e){return this.viewModel.findField(e.getAttribute(I))}_getNumberFieldConstraints(e){const t=r(e.domain)||o(e.field);return t&&t.max!==Number.MAX_VALUE&&t.min!==Number.MIN_VALUE?t:{min:null,max:null}}_afterInputCreateOrUpdate(e){const{viewModel:t}=this,i=this._getInputFieldFromInput(e),a=t.findField(this._activeInputName),s=this._fieldToInitialIncompatibleDomainValue.get(i.name)===i.value;this._fieldFocusNeeded&&a===i&&("radio-buttons"!==i.inputType||s||e.checked)&&(this._fieldFocusNeeded=!1,this._isInputFieldInGroup(i)&&(i.group.state="expanded"),e.focus())}_handleInputFocus(e){const t=e.target,i=this._getInputFieldFromInput(t);this._activeInputName=i.name,"date"===i.type?this._syncDateFieldEdits(t):this._isNumberInputField(i)&&this._setUpNumberFieldEdit(t)}_isNumberInputField({domain:e,inputType:t="text-box",type:i}){return"number"===i&&"text-box"===t&&(!e||"coded-value"!==e.type)}_handleInputBlur(e){const t=e.target,a=this._getInputFieldFromInput(t);if("date"===a.type){const i=e.relatedTarget,s=i&&this._getInputFieldFromInput(i);if(s&&"date"===a.type&&"date"===s.type&&a.field===s.field){if(""!==t.value&&""===i.value){const s=i.getAttribute("data-date-part");i.value=this._formatDate(a.value??Date.now())[s],this._parseDate(t.value,t.getAttribute("data-date-part"))&&this._commitInputValue(e.target,!0,!1)}return}}"number"===a.type&&i(this._activeNumberFieldEdit)&&(this._activeNumberFieldEdit.input.value=`${a.value}`,this._activeNumberFieldEdit=null),this._commitInputValue(t),this.scheduleRender()}_commitInputValue(e,t=!1,a=!0){const s=this._getInputFieldFromInput(e);if(this._activeDateFieldEdit){const{date:i,time:n}=this._activeDateFieldEdit,l=this._parseDateTime(e.value,s,i.active?"date":"time"),r=null!==this.viewModel.getValue(s.name),o=i.input&&(n.input||!s.includeTime),u=null===l;if(t){if(u)return;(o||!a||r)&&this._updateDateFieldValue(s,l)}else{if(""===i.input?.value||""===n.input?.value)this._updateDateFieldValue(s,null);else if(o){const e=`${i.input.value} ${n.input?.value??""}`,t=this._parseDateTime(e,s);!(null!==t)&&r||this._updateDateFieldValue(s,t)}this._activeDateFieldEdit=null}}else i(this._activeNumberFieldEdit)&&this._isNumberInputField(s)&&(this._activeNumberFieldEdit.value=e.value),this._updateFieldValue(e)}_handleInputKeyDown(e){const{key:t,altKey:i,ctrlKey:a,metaKey:s}=e,n=this._getInputFieldFromInput(e.target);if("Enter"===t)this._isInputFieldInGroup(n)&&"collapsed"===n.group.state&&(n.group.state="expanded");else{const{type:l}=n.field,r="single"===l||"double"===l,o=!i&&!a&&!s;if(("integer"===l||"small-integer"===l||r)&&o&&1===t.length){const i=Number(t),a=["-","+"],s=["e","."],n=r?[...a,...s]:a;isNaN(i)&&!n.includes(t)&&e.preventDefault()}}}_setUpNumberFieldEdit(e){const t=this._getInputFieldFromInput(e);this._activeNumberFieldEdit={fieldName:t.name,input:e,value:e.value}}_syncDateFieldEdits(e){const t=this._getInputFieldFromInput(e);if("date"!==t.type)return;const i=e.getAttribute("data-date-part"),a="date"===i?{value:e.value,input:e,active:!0}:{...this._activeDateFieldEdit?.date,active:!1},s="time"===i?{value:e.value,input:e,active:!0}:{...this._activeDateFieldEdit?.time,active:!1};this._activeDateFieldEdit={fieldName:t.name,date:a,time:s}}_updateFieldValue(e){const t=e.getAttribute(I);if(this.viewModel.setValue(t,this._parseValue(e)),this._userUpdatedInputFieldNames.add(t),this.viewModel.fieldsWithContingentValues.has(t)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>i(t))));this.viewModel.validateContingencyConstraints(e)}}_updateDateFieldValue(e,t){this.viewModel.setValue(e.name,t),this._userUpdatedInputFieldNames.add(e.name)}_parseValue(e){const t=this._getInputFieldFromInput(e),i=e.value;if(this._inputFieldHasInputType(t,"switch")&&"CALCITE-COMBOBOX"!==e.tagName)return e.checked?t.fieldElement.input.onValue:t.fieldElement.input.offValue;if("radio-buttons"===t.inputType&&"radio"===e.type&&!e.checked)return t.value;const{type:a}=t;if("number"===a)return i?parseFloat(i):null;if("date"===a){if(!i)return null;const a=Number(i);if(!isNaN(a))return a;const s=e.getAttribute("data-date-part"),n=this._parseDate(i,s);if(!n)return null;let l=_.fromJSDate(n);const r=t.domain,o=_.now();let u=o;if(r&&"range"===r.type){const e=_.fromMillis(r.maxValue);o<e&&(u=e)}const d=this.viewModel.getValue(t.name),p=null!=d?_.fromMillis(d):u;return l="date"===s?l.set({hour:p.hour,minute:p.minute,second:p.second}):l.set({day:p.day,month:p.month,year:p.year}),l.toMillis()}return i}_handleOptionChange(e){this._commitInputValue(e),this.scheduleRender()}_handleGroupClick(e){const t=e.currentTarget["data-group"],i="expanded"===t.state,a="sequential"===this.groupDisplay,s=`.${v.groupHeader}`;if(!(i&&!e.target.closest(s))){if(this._activeInputName=this._getFocusableInput("forward",t)?.name,a){const a=e.target.closest(s);if(i&&!a)return;this.viewModel.inputFields.forEach((e=>{F(e)&&e!==t&&(e.state="collapsed")}))}t.state=i?"collapsed":"expanded",this._fieldFocusNeeded=a,this.scheduleRender()}}_handleSubmit(e){e.preventDefault()}_handleFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_formatDate(e){if(null==e)return{date:"",time:""};const t=_.fromMillis(e,{locale:g(),numberingSystem:"latn"});return{date:t.toLocaleString({year:"numeric",month:"2-digit",day:"2-digit"}),time:t.toFormat(b.timePattern)}}_parseDate(e,t){if(null==e||""===e)return null;const{timePattern:i,datePattern:a}=b,s=t?"date"===t?a:i:`${a} ${i}`,n=_.fromFormat(e,s,{locale:g(),numberingSystem:"latn"});return n.isValid?n.toJSDate():null}_inputFieldHasInputType(e,t){return i(e.fieldElement)&&e.fieldElement.input?.type===t}_valueIsValidContingentValue(e,i){switch(i.objectType){case"any":return!0;case"null":return null==e;case"code":return e===i.codedValue?.code;case"range":return e>=i.minValue&&e<=i.maxValue;default:return t(i.objectType),!1}}};e([n()],y.prototype,"disabled",void 0),e([n()],y.prototype,"feature",null),e([n()],y.prototype,"formTemplate",null),e([n()],y.prototype,"groupDisplay",void 0),e([n()],y.prototype,"headingLevel",void 0),e([n()],y.prototype,"label",null),e([n()],y.prototype,"layer",null),e([n(),m("esri/widgets/FeatureForm/t9n/FeatureForm")],y.prototype,"messages",void 0),e([n(),m("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],y.prototype,"messagesTemplates",void 0),e([n()],y.prototype,"spatialReference",null),e([n()],y.prototype,"strict",null),e([n()],y.prototype,"view",null),e([n(),h(["value-change","submit"])],y.prototype,"viewModel",void 0),y=e([l("esri.widgets.FeatureForm")],y);const w=y;export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{when as s,watch as i}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import{storeNode as a}from"./support/widgetUtils.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{vmEvent as c}from"./support/decorators/vmEvent.js";import{tsx as d}from"./support/jsxFactory.js";import h from"./UtilityNetworkTrace/UtilityNetworkTraceViewModel.js";import{GraphicHandler as u,HIGHLIGHT_COLOR as p}from"./UtilityNetworkTrace/support/GraphicHandler.js";const g={base:"esri-utility-trace-network",loaderContainer:"esri-utility-trace-network__loader-container",loader:"esri-utility-trace-network__loader",fadeIn:"esri-utility-trace-network--fade-in",addButtonContainer:"esri-utility-trace-network__add-button-container",noticeContainer:"esri-utility-trace-network__notice-container",listContainer:"esri-utility-trace-network__list-container",resultsContainer:"esri-utility-trace-network__results-container",flow:"esri-utility-trace-network__flow",esriWidget:"esri-widget",esriWidgetPanel:"esri-widget--panel",esriWidgetDisabled:"esri-widget--disabled",esriButton:"esri-button",esriButtonTertiary:"esri-button--tertiary",esriInput:"esri-input",esriMatchHeight:"esri-match-height",iconHandle:"esri-icon-handle-vertical",iconPlus:"esri-icon-plus",iconEdit:"esri-icon-edit",iconHandleHorizontal:"esri-icon-handle-horizontal",iconRefresh:"esri-icon-refresh",iconLink:"esri-icon-link",iconRemove:"esri-icon-erase",widgetIcon:"esri-icon-UtilityNetworkTrace",header:"esri-widget__heading",loading:"esri-icon-loading-indicator",rotating:"esri-rotating"},m="esri.widgets.UtilityNetworkTrace";function w(e){return{height:e+"px"}}function _(e){return{width:e+"px"}}function v(){return{width:"75%"}}function b(){return{textAlign:"center"}}function y(){return{width:"100%"}}const T={NOEXTENTION:-2147208474};let S=class extends(t(o)){constructor(e,t){super(e,t),this._tracesExists=!0,this._graphicHandler=null,this._selectToolActive=!1,this._activeTrace=null,this._activeSwatch="",this._traceHeaderForFlow="",this._assetGroupHeader="",this._assetTypeHeader="",this._traceResultsFunctions=[],this._traceResultsAssetGroup=[],this._traceResultsAssetType=[],this._traceResultsIndividual=[],this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this._activeTab="input",this._flagViewType="starting-point",this._alertRemoveModal=!1,this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoStartAssetFound=!1,this._warningNoBarrierAssetFound=!1,this._warningNoTerminal=!1,this._confirmReset=!1,this._showResultOptions=!1,this._resultObjectIdField="objectid",this._resultDisplayField="objectid",this._resultSortField="objectid",this._resultSortOrder="desc",this._swatchNode=null,this._individualResultNode=null,this._symbolStartFlag=null,this._symbolBarrier=null,this._watchHandler=null,this._loadUNError=!0,this._errorMessage="",this.disabled=!0,this.iconClass=g.widgetIcon,this.inputSettings=[],this.messages=null,this.messagesCommon=null,this.viewModel=new h}initialize(){this._utilityNetworkTraceInitialized(),this._graphicHandler=new u}get defaultGraphicColor(){return this.viewModel.defaultGraphicColor}set defaultGraphicColor(e){this.viewModel.defaultGraphicColor=e}get flags(){return this.viewModel.flags}set flags(e){this.viewModel.flags=e}get gdbVersion(){return this.viewModel.gdbVersion}set gdbVersion(e){this.viewModel.gdbVersion=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get selectedTraces(){return this.viewModel.selectedTraces}set selectedTraces(e){this.viewModel.selectedTraces=e}get selectOnComplete(){return this.viewModel.selectOnComplete}set selectOnComplete(e){this.viewModel.selectOnComplete=e}get showGraphicsOnComplete(){return this.viewModel.showGraphicsOnComplete}set showGraphicsOnComplete(e){this.viewModel.showGraphicsOnComplete=e}get showSelectionAttributes(){return this.viewModel.showSelectionAttributes}set showSelectionAttributes(e){this.viewModel.showSelectionAttributes=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}async checkCanTrace(){this._confirmReset=!1;const e=this.viewModel.checkCanTrace();e.status?(this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoTraceSelected=!1,this._warningNoTerminal=!1,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this.switchTab("result"),this.viewModel._activeProgress=!0,await this.viewModel.callTrace(),this.viewModel._activeProgress=!1):e.issues.forEach((e=>{switch(e){case"noStart":this._warningNoFlag=!0;break;case"noTerminalSelected":this._warningNoTerminal=!0;break;default:this._warningNoTraceSelected=!0}}))}confirmReset(){this._confirmReset=!0}render(){const{state:e}=this.viewModel;this._mixCustomStrings(),this._overrideFlagSymbol();const t="loading"===e?this.renderLoading():this.renderUtilityNetworkTrace();return d("div",{class:this.classes(g.base,g.esriWidget,g.esriWidgetPanel,{[g.esriWidgetDisabled]:this.disabled})},t)}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-group.js"),import("@esri/calcite-components/dist/components/calcite-action-pad.js"),import("@esri/calcite-components/dist/components/calcite-block.js"),import("@esri/calcite-components/dist/components/calcite-block-section.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-checkbox.js"),import("@esri/calcite-components/dist/components/calcite-color-picker-swatch.js"),import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-flow-item.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-label.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-modal.js"),import("@esri/calcite-components/dist/components/calcite-notice.js"),import("@esri/calcite-components/dist/components/calcite-option.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-select.js"),import("@esri/calcite-components/dist/components/calcite-tab.js"),import("@esri/calcite-components/dist/components/calcite-tab-nav.js"),import("@esri/calcite-components/dist/components/calcite-tab-title.js"),import("@esri/calcite-components/dist/components/calcite-tabs.js")])}switchTab(e){this._activeTab=e}switchToFunctions(e,t){this._traceResultsFunctions=e,this._showTraceResultFunctions=t}switchToAssetGroup(e,t,s){this._traceHeaderForFlow=t,this._traceResultsAssetGroup=e,this._showTraceResultAssetGroup=s}switchToAssetType(e,t,s){this._assetGroupHeader=t,this._traceResultsAssetType=e,this._showTraceResultAssetType=s}switchToIndividualRecords(e,t,s){this._assetTypeHeader=t,this._traceResultsIndividual=e,this._showIndividualRecords=s}renderLoading(){return d("div",{class:g.loaderContainer,key:"loader"},d("div",{class:g.loader}))}renderUtilityNetworkTrace(){const{messages:e}=this;let t=d("calcite-tabs",{position:"above",layout:"center",styles:y()},d("calcite-tab-nav",{slot:"tab-nav"},d("calcite-tab-title",{active:"input"===this._activeTab,onclick:()=>{this.switchTab("input")}},e.inputsStrings.headerTabInputs),d("calcite-tab-title",{active:"result"===this._activeTab,onclick:()=>{this.switchTab("result")}},e.resultsStrings.headerTabResults)),d("calcite-tab",{active:"input"===this._activeTab},this.renderInputPanel()),d("calcite-tab",{active:"result"===this._activeTab},this.viewModel._activeProgress?d("calcite-loader",{active:!0,label:e.alertsStrings.traceExecuting,text:e.alertsStrings.traceExecuting,type:"indeterminate"}):this.viewModel._traceResults.length>0?this.renderResultPanel():this.renderWarningMessage("noTraceExecuted",!1),d("calcite-modal",{active:this._confirmReset,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._confirmReset=!1}},d("h3",{slot:"header"},e.resultsStrings.startOverButton),d("div",{slot:"content"},e.resultsStrings.startOverValidation),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._confirmReset=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this._confirmReset=!1,this.viewModel.reset(),this.switchTab("input")}},e.globalStrings.ok))));return this._tracesExists||(t=d("calcite-panel",null,this.renderWarningMessage("noTraceConfig",!1))),this._loadUNError||(t=d("calcite-panel",null,this.renderWarningMessage("loadUNError",!1,this._errorMessage))),t}renderInputPanel(){const{messages:e}=this;return d("calcite-flow",{class:g.flow},d("calcite-flow-item",null,this._warningNoFlag?this.renderWarningMessage("flag",!0):null,this._warningNoTerminal?this.renderWarningMessage("noTerminal",!0):null,this._warningNoTraceSelected?this.renderWarningMessage("trace",!0):null,this.renderTraceSelectorContainer(),this.renderStartFlagsContainer(),this.renderBarriersFlagsContainer(),this._warningNoFlag&&this._warningNoTraceSelected?d("div",{styles:w(10)}):null,d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.checkCanTrace()}},e.tracingStrings.runTrace)),this._selectToolActive?this.renderActiveTool():null)}renderResultPanel(){return d("div",{class:this.classes(g.resultsContainer)},d("calcite-flow",null,this.renderTraceResults(),this._showTraceResultFunctions?this.renderTraceResultFunctions():null,this._showTraceResultAssetGroup?this.renderTraceResultByAssetGroup():null,this._showTraceResultAssetType?this.renderTraceResultByAssetType():null,this._showIndividualRecords?this.renderTraceResultIndividual():null,this._showIndividualRecords?this.renderTraceResultIndividualPopover():null))}renderStartFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"starting-point"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"start"))}));let i=null;return this._symbolStartFlag&&(i=this._getSymbolIcon(this._symbolStartFlag)),d("calcite-block",{heading:e.inputsStrings.headerStartingPoint+" ("+s.length+")",open:!0,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"pin",scale:"s"})),d("div",null,e.inputsStrings.startingPointHint),d("div",{class:g.listContainer},t),this._warningNoStartAssetFound?this.renderWarningMessage("noStartAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline","icon-start":"plus",scale:"m",href:"",label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="starting-point",this._selectToolActive=!0,this._warningNoStartAssetFound=!1,this.viewModel.addFlagByHit("starting-point",this._symbolStartFlag).then((e=>{e?this._warningNoFlag=!1:this._warningNoStartAssetFound=!0,this._selectToolActive=!1}))},round:!0})))}renderBarriersFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"barrier"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"barrier"))}));let i=null;return this._symbolBarrier&&(i=this._getSymbolIcon(this._symbolBarrier)),d("calcite-block",{heading:e.inputsStrings.headerBarrier+" ("+s.length+")",open:!1,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"x-circle-f",scale:"s"})),d("div",null,e.inputsStrings.barrierPointHint),d("div",{class:g.listContainer},t),this._warningNoBarrierAssetFound?this.renderWarningMessage("noBarrierAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline",color:"blue","icon-start":"plus",scale:"m",href:"",round:!0,label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="barrier",this._selectToolActive=!0,this._warningNoBarrierAssetFound=!1,this.viewModel.addFlagByHit("barrier",this._symbolBarrier).then((e=>{e||(this._warningNoBarrierAssetFound=!0),this._selectToolActive=!1}))}})))}renderFlagRow(e,t){const{messages:s}=this,i=[];let r=!1;return null!==e.allTerminals&&void 0!==e.allTerminals&&e.allTerminals.terminals.length>0&&(r=!0,e.allTerminals.terminals.forEach((t=>{let s=!1;e.selectedTerminals.includes(t.id)&&(s=!0),i.push(d("calcite-combobox-item",{key:t.name,selected:s,value:t.id,"text-label":t.name}))}))),d("calcite-block",{key:"pop"+e.globalId+e.type+e.id+t,heading:e.displayValue.value,collapsible:null!==e.allTerminals||"barrier"===e.type},d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.remove,label:s.globalStrings.remove,onCalciteListItemChange:()=>{this.viewModel.removeFlag(e)},onclick:()=>{this.viewModel.removeFlag(e)},scale:"s",icon:"trash"}),d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.zoomToFeature,label:s.globalStrings.zoomToFeature,onCalciteListItemChange:()=>{this.viewModel.zoomToAsset(e.details.geometry)},onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)},scale:"s",icon:"zoom-to-object"}),"barrier"===e.type?d("calcite-label",{scale:"s",layout:"inline"},d("calcite-checkbox",{checked:e.isFilterBarrier,scale:"s",onclick:()=>{this.viewModel.manageFilterBarrier(!e.isFilterBarrier,e)}}),s.inputsStrings.barrierFilter):null,r?d("calcite-combobox",{label:s.globalStrings.selectTerminalPlaceholder,placeholder:s.globalStrings.selectTerminalPlaceholder,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChange:t=>{t.detail.selectedItems.length>0?(e.selectedTerminals=[],t.detail.selectedItems.forEach((t=>{this.viewModel.addTerminal(t.value,e)}))):e.selectedTerminals=[]},onCalciteComboboxChipDismiss:t=>{t.preventDefault(),this.viewModel.removeTerminal(t.target.value,e)}},i):null)}renderActiveTool(){const{messages:e}=this;let t=null;return"starting-point"===this._flagViewType?this._symbolStartFlag&&(t=this._getSymbolIcon(this._symbolStartFlag)):this._symbolBarrier&&(t=this._getSymbolIcon(this._symbolBarrier)),d("calcite-flow-item",{"height-scale":"s",onCalciteFlowItemBackClick:()=>{this.viewModel._clickHandler&&(this.viewModel._clickHandler.remove(),this.view.popup.autoOpenEnabled=!0),this._selectToolActive=!1},heading:e.inputsStrings.addPointOption},d("calcite-block",{open:!0,collapsible:!1,heading:""},d("div",{styles:b()},t||d("calcite-icon",{icon:"starting-point"===this._flagViewType?"pin":"x-circle-f",scale:"s"})),d("div",{styles:b()},e.inputsStrings.addPointHint)))}renderTraceSelectorContainer(){const{messages:e}=this,t=[];return this.viewModel._traces.length>0&&this.viewModel._traces.forEach((e=>{t.push(d("calcite-combobox-item",{key:e.globalId,selected:e.selected,value:e.globalId,"text-label":e.title,onCalciteComboboxItemChange:t=>{const s=t.target;this.viewModel.selectTraces(s.selected,e.globalId),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}}))})),d("calcite-block",{heading:e.tracingStrings.traceOperation,open:!0,collapsible:!0},d("calcite-combobox",{label:e.inputsStrings.selectTraces,placeholder:e.inputsStrings.selectTraces,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChipDismiss:e=>{this.viewModel.selectTraces(!1,e.target.value),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}},t))}renderStartOverContainer(){const{messages:e}=this;return d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.confirmReset()}},e.resultsStrings.startOverButton)}renderWarningMessage(e,t,s){const{messages:i}=this;let r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;switch(e){case"flag":r=i.alertsStrings.startingPointAlertHeader,l=i.alertsStrings.startingPointAlert;break;case"noTerminal":r=i.alertsStrings.noTerminalDefinedHeader,l=i.alertsStrings.noTerminalDefined;break;case"trace":r=i.alertsStrings.selectTraceAlertHeader,l=i.alertsStrings.selectTraceAlert;break;case"noTraceExecuted":r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;break;case"noBarrierAsset":case"noStartAsset":r=i.alertsStrings.noAssetsFoundHeader,l=i.alertsStrings.noAssetFound;break;case"noTraceConfig":r="",l=i.alertsStrings.noTraceSupported;break;default:r=i.alertsStrings.genericErrorHeader,l=s||""}return d("div",{class:g.noticeContainer,key:e},d("calcite-notice",{open:!0,key:e,active:!0,dismissible:t,icon:!0,scale:"s",width:"auto",color:"red",onCalciteNoticeClose:()=>{switch(e){case"flag":this._warningNoFlag=!1;break;case"noTerminal":this._warningNoTerminal=!1;break;case"trace":this._warningNoTraceSelected=!1;break;case"noStartAsset":this._warningNoStartAssetFound=!1;break;case"noBarrierAsset":this._warningNoBarrierAssetFound=!1}}},d("div",{slot:"title"},r),d("div",{slot:"message"},l)))}renderRemoveTraceContainer(e){const{messages:t}=this;return d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:t.globalStrings.clearResults,label:t.globalStrings.clearResults,onCalciteListItemChange:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},onclick:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},scale:"s",icon:"trash"})}renderHighlightColorPicker(e,t){const{messages:s}=this,i=[];for(let r=0;r<p.length;r++)i.push(d("calcite-action",{key:r,text:s.resultsStrings.graphicColor,label:s.resultsStrings.graphicColor,scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(r),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(r).hex,active:e.color===this._graphicHandler.getHighlightColor(r).color})));return d("calcite-action-pad",{position:"start",layout:"grid",expandDisabled:!0},d("calcite-action-group",{layout:"grid",columns:4},i))}renderTraceResults(){const{messages:e}=this,t=this.viewModel._traceResults,s=[];return t.forEach(((t,i)=>{let r=[],l=[],o=!1,a=!1,n=!1;null!==t.results&&t.results.hasOwnProperty("elements")?(null!==t.results.aggregatedGeometry&&(a=!0),null!==t.results.globalFunctionResults&&t.results.globalFunctionResults.length>0&&(l=t.results.globalFunctionResults,l.length>0&&(n=!0)),t.results.elements.length>0&&(r=t.results.elements,r.length>0&&(o=!0)),s.push(d("calcite-block",{key:t.trace.title,heading:t.trace.title,summary:t.trace.description,collapsible:!1,open:!0,intlOptions:e.resultsStrings.ellipsesOptions},this.renderRemoveTraceContainer(t),d("calcite-list",null,n?d("calcite-list-item",{label:e.resultsStrings.functionHeader+" ("+l.length+")",onclick:()=>{this.switchToFunctions(l,!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):null,o&&this.viewModel.showSelectionAttributes?d("calcite-list-item",{key:this.id,label:e.resultsStrings.viewFeatures+" ("+r.length+")",onclick:()=>{this.switchToAssetGroup(this._groupResultsByAssetGroup(t),t.trace.title+" ("+r.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):this.viewModel.showSelectionAttributes?d("calcite-label",{layout:"inline",scale:"s"},e.resultsStrings.noSelectionResults):null),d("div",{styles:w(10)}),o?d("calcite-label",{layout:"inline",scale:"s",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}},d("calcite-checkbox",{checked:t.selectionEnabled,scale:"m",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}}),this.viewModel.showSelectionAttributes?e.resultsStrings.selectFeatures:e.resultsStrings.selectFeatures+" ("+r.length+")"):null,a?d("calcite-block-section",{"toggle-display":"switch",text:e.resultsStrings.highlightTrace,open:t.graphicEnabled,onCalciteBlockSectionToggle:e=>{e.target.open?this.viewModel.changeResultGraphicColor(t.graphicColor,t):this.viewModel.removeResultGraphicFromView(t)}},d("calcite-action",{text:e.resultsStrings.graphicColor,label:e.resultsStrings.graphicColor,scale:"s",onclick:e=>{const t=e.target;this._swatchNode=t,this._activeSwatch="aggGeom_"+i}},d("calcite-color-picker-swatch",{scale:"s",color:t.graphicColor.hex})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.graphicColor,text:e.resultsStrings.graphicColor,referenceElement:this._swatchNode,placement:"auto-start",offsetDistance:0,offsetSkidding:0,open:this._activeSwatch==="aggGeom_"+i,onCalcitePopoverClose:()=>{this._swatchNode=null,this._activeSwatch=null}},this.renderHighlightColorPicker(t.graphicColor,t))):null))):s.push(d("calcite-block",{key:"error-"+i,heading:t.trace.title,collapsible:!1,open:!0},this.renderRemoveTraceContainer(t),this.renderWarningMessage("noController",!1,t.status)))})),d("calcite-flow-item",{key:"traceResults"},s,this.renderStartOverContainer(),d("calcite-modal",{active:this._alertRemoveModal,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._alertRemoveModal=!1}},d("h3",{slot:"header"},e.globalStrings.clearResults),d("div",{slot:"content"},e.alertsStrings.clearResultsAlert),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._alertRemoveModal=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this.viewModel.clearResult(this._activeTrace),this._alertRemoveModal=!1,0===this.viewModel._traceResults.length?this.switchTab("input"):(this._activeTrace=this.viewModel._traceResults[0].trace,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1)}},e.globalStrings.ok)))}renderTraceResultFunctions(){const{messages:e}=this,t=this._traceResultsFunctions,s=[];return t.forEach((e=>{s.push(this.renderResultRowFunctions(e))})),d("calcite-flow-item",{key:"functionResultMultiple",onCalciteFlowItemBackClick:()=>{this.switchToFunctions([],!1)},heading:e.resultsStrings.functionHeader},s,this.renderStartOverContainer())}renderTraceResultByAssetGroup(){const e=this._traceResultsAssetGroup,t=[];for(const s in e){const i=e[s];for(const e in i)t.push(this.renderResultRowAssetGroup(i[e]))}return d("calcite-flow-item",{key:"assetGroupResultMultiple",onCalciteFlowItemBackClick:()=>{this.switchToAssetGroup([],"",!1)},heading:this._traceHeaderForFlow},d("calcite-list",null,t),this.renderStartOverContainer())}renderTraceResultByAssetType(){const e=this._traceResultsAssetType,t=[];for(const s in e)e[s].length>0&&t.push(this.renderResultRowAssetType(e[s]));return d("calcite-flow-item",{key:"assetTypeResult",onCalciteFlowItemBackClick:()=>{this.switchToAssetType([],"",!1)},heading:this._assetGroupHeader},t,this.renderStartOverContainer())}renderTraceResultIndividual(){const{messages:e}=this,t=this._traceResultsIndividual;t.sort(this._compare(this._resultSortField,this._resultSortOrder));const s=[];if(t.length>0){t[0].details.fields.some((e=>e.name.toLowerCase()===this._resultDisplayField.toLocaleLowerCase()))||(this._resultDisplayField=this._resultObjectIdField,this._resultSortField=this._resultObjectIdField),t.forEach((e=>{s.push(this.renderResultRowIndividual(e))}))}return d("calcite-flow-item",{key:"individualResult",onCalciteFlowItemBackClick:()=>{this._showResultOptions=!1,this.switchToIndividualRecords([],"",!1)},heading:this._assetTypeHeader},d("calcite-action",{"text-enabled":!0,slot:"header-actions-end",text:e.resultsStrings.displayAttribute,onCalciteListItemChange:()=>{this._showResultOptions=!0},onclick:()=>{this._showResultOptions=!0},scale:"s",icon:"gear",label:e.resultsStrings.displayAttribute,id:"field_options"+this.id,afterCreate:a,bind:this,"data-node-ref":"_individualResultNode"}),s,this.renderStartOverContainer())}renderTraceResultIndividualPopover(){const{messages:e}=this,t=this._traceResultsIndividual,s=[],i=[];return t.length>0&&t[0].details.fields.forEach((e=>{s.push(d("calcite-option",{key:"display"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultDisplayField})),i.push(d("calcite-option",{key:"sort"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultSortField}))})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.displayAttribute,referenceElement:this._individualResultNode,placement:"left-start",offsetDistance:0,offsetSkidding:0,open:this._showResultOptions,styles:null!==this.domNode?_(.75*this.domNode.clientWidth):v()},d("calcite-block",{heading:"",open:!0},d("calcite-label",{scale:"s"},e.resultsStrings.displayAttribute,d("calcite-select",{label:e.resultsStrings.displayAttribute,onCalciteSelectChange:e=>{const t=e.target;this._resultDisplayField=t.selectedOption.value,this._showResultOptions=!1}},s)),d("calcite-label",{scale:"s"},e.resultsStrings.sortBy,d("calcite-select",{label:e.resultsStrings.sortBy,onCalciteSelectChange:e=>{const s=e.target;this._resultSortField=s.selectedOption.value,t.sort(this._compare(this._resultSortField,this._resultSortOrder)),this._traceResultsIndividual=t,this._showResultOptions=!1}},i))))}renderResultRow(e){let t=e[0].assetGroupCode;const s=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(s.length>0){const i=s[0].assetGroups.filter((t=>t.assetGroupCode===e[0].assetGroupCode));i.length>0&&(t=i[0].assetGroupName)}return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}renderResultRowFunctions(e){return d("calcite-block",{heading:e.networkAttributeName+" "+e.functionType+" = "+e.result,collapsible:!1})}renderResultRowAssetGroup(e){const t=this._getAssetGroupName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowAssetType(e){const t=this._getAssetTypeName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.viewModel.queryFeaturesById(e).then((s=>{if(s?.length){this._resultObjectIdField=s[0].layer.objectIdField,"objectid"===this._resultDisplayField&&(this._resultDisplayField=s[0].layer.objectIdField),"objectid"===this._resultSortField&&(this._resultSortField=s[0].layer.objectIdField);const i=this._appendAttributes(e,s,"objectId");this.switchToIndividualRecords(i,t+" ("+e.length+")",!0)}else this.switchToIndividualRecords(e,t+" ("+e.length+")",!0)}))}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowIndividual(e){const{messages:t}=this;let s="",i=null;for(let r=0;r<e.details.fields.length;r++)e.details.fields[r].name===this._resultDisplayField&&(i=e.details.fields[r]);if("date"===i.type){s=new Date(e.details.attributes[this._resultDisplayField]).toDateString()}else if(null!==i.domain){const t=i.domain.codedValues;let r="";for(let s=0;s<t.length;s++)t[s].code===e.details.attributes[this._resultDisplayField]&&(r=t[s].name);s=r}else s="assetgroup"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetGroupName(e):"assettype"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetTypeName(e):e.details.attributes[this._resultDisplayField];return s&&""!==s&&null!==s||(s=t.resultsStrings.noValue),d("calcite-list-item",{label:s,onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)}},d("calcite-icon",{icon:"zoom-to-object","text-label":t.globalStrings.zoomToFeature,scale:"s",slot:"content-end"}))}_mixCustomStrings(){const{messages:e}=this;this.inputSettings.length>0&&this.inputSettings.forEach((t=>{"starting-point"===t.type&&(e.inputsStrings.headerStartingPoint=t.label,e.inputsStrings.startingPointHint=t.description),"barrier"===t.type&&(e.inputsStrings.headerBarrier=t.label,e.inputsStrings.barrierPointHint=t.description)}))}_overrideFlagSymbol(){this.inputSettings.length>0&&this.inputSettings.forEach((e=>{"starting-point"===e.type?this._symbolStartFlag=e.symbol:this._symbolBarrier=e.symbol,this.viewModel.changeFlagSymbol(e.type,e.symbol)}))}_utilityNetworkTraceInitialized(){return this.viewModel.loadUtilityNetwork().then((e=>e?(this.viewModel.selectTracesOnLoad(),this._registerWatchers(),this.viewModel._traces.length<=0&&(this._tracesExists=!1),this.viewModel.flags.length>0?this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(async()=>{this._warningNoFlag=!1,this._warningNoBarrierAssetFound=!1,this._warningNoStartAssetFound=!1;const e=await this.viewModel.addFlagsOnLoad();this.viewModel.removeFlagsOnLoadWatcher(),e.includes("barrier")&&(this._warningNoBarrierAssetFound=!0),e.includes("starting-point")&&(this._warningNoStartAssetFound=!0),this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}))})):this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))):(this._tracesExists=!1,this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))))).catch((e=>{const{messages:t}=this;this._loadUNError=!1,e.details.raw.extendedCode===T.NOEXTENTION?this._errorMessage=t?.alertsStrings?.noUserExtension||e.message:this._errorMessage=e.message,this.disabled=!1}))}_registerWatchers(){this.addHandles([i((()=>this.selectedTraces),(()=>{this.viewModel.selectTracesOnLoad(),this.scheduleRender()})),i((()=>this.defaultGraphicColor),(()=>{this.viewModel._traceResults.length>0&&this.viewModel._traceResults.forEach((e=>{this.viewModel.changeResultGraphicColor(this.viewModel.defaultGraphicColor,e)})),this.scheduleRender()}))])}_groupResultsByAssetGroup(e){const t=[],s=e.results.elements,i=this._groupBy(s,"networkSourceId");for(const r in i)t.push(this._groupBy(i[r],"assetGroupCode"));return t}_groupResultsByAssetType(e){return this._groupBy(e,"assetTypeCode")}_appendAttributes(e,t,s){const i=[];return e.forEach((e=>{t.forEach((t=>{t.featureSet.features.forEach((r=>{e[s]===r.attributes[this._resultObjectIdField]&&(e.details=r,e.details.fields=t.featureSet.fields,i.push(e))}))}))})),i}_getAssetGroupName(e){let t=e.assetGroupCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const e=i.assetGroups.find((e=>e.assetGroupCode===s));e&&(t=e.assetGroupName)}return t}_getAssetTypeName(e){let t=e.assetTypeCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const r=i.assetGroups.find((e=>e.assetGroupCode===s));if(r){const s=r.assetTypes.find((t=>t.assetTypeCode===e.assetTypeCode));s&&(t=s.assetTypeName)}}return t}_compare(e,t){return(s,i)=>{let r=0,l=s.details.attributes[e],o=i.details.attributes[e];return isNaN(l)&&(l=l.toLowerCase()),isNaN(o)&&(o=o.toLowerCase()),"desc"===t?l>o?r=1:l<o&&(r=-1):l<o?r=1:l>o&&(r=-1),r}}_groupBy(e,t){return e.reduce(((e,s)=>((e[s[t]]=e[s[t]]||[]).push(s),e)),{})}_getSymbolIcon(e){return"picture-marker"===e.type?d("img",{src:e.url,width:e.width,height:e.height}):null}};e([r()],S.prototype,"_tracesExists",void 0),e([r()],S.prototype,"_selectToolActive",void 0),e([r()],S.prototype,"_activeTrace",void 0),e([r()],S.prototype,"_activeSwatch",void 0),e([r()],S.prototype,"_traceHeaderForFlow",void 0),e([r()],S.prototype,"_assetGroupHeader",void 0),e([r()],S.prototype,"_assetTypeHeader",void 0),e([r()],S.prototype,"_traceResultsFunctions",void 0),e([r()],S.prototype,"_traceResultsAssetGroup",void 0),e([r()],S.prototype,"_traceResultsAssetType",void 0),e([r()],S.prototype,"_traceResultsIndividual",void 0),e([r()],S.prototype,"_showTraceResultFunctions",void 0),e([r()],S.prototype,"_showTraceResultAssetGroup",void 0),e([r()],S.prototype,"_showTraceResultAssetType",void 0),e([r()],S.prototype,"_showIndividualRecords",void 0),e([r()],S.prototype,"_activeTab",void 0),e([r()],S.prototype,"_alertRemoveModal",void 0),e([r()],S.prototype,"_warningNoFlag",void 0),e([r()],S.prototype,"_warningNoTraceSelected",void 0),e([r()],S.prototype,"_confirmReset",void 0),e([r()],S.prototype,"_swatchNode",void 0),e([r()],S.prototype,"_errorMessage",void 0),e([r()],S.prototype,"defaultGraphicColor",null),e([r()],S.prototype,"disabled",void 0),e([r()],S.prototype,"flags",null),e([r()],S.prototype,"gdbVersion",null),e([r()],S.prototype,"iconClass",void 0),e([r()],S.prototype,"inputSettings",void 0),e([r()],S.prototype,"label",null),e([r(),n("esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace")],S.prototype,"messages",void 0),e([r(),n("esri/t9n/common")],S.prototype,"messagesCommon",void 0),e([r()],S.prototype,"selectedTraces",null),e([r()],S.prototype,"selectOnComplete",null),e([r()],S.prototype,"showGraphicsOnComplete",null),e([r()],S.prototype,"showSelectionAttributes",null),e([r()],S.prototype,"view",null),e([c(["add-flag","add-flag-complete","add-flag-error","select-features","clear-selection"]),r({type:h})],S.prototype,"viewModel",void 0),S=e([l(m)],S);const f=S;export{f as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{when as s,watch as i}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import{storeNode as a}from"./support/widgetUtils.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{vmEvent as c}from"./support/decorators/vmEvent.js";import{tsx as d}from"./support/jsxFactory.js";import h from"./UtilityNetworkTrace/UtilityNetworkTraceViewModel.js";import{GraphicHandler as u,HIGHLIGHT_COLOR as p}from"./UtilityNetworkTrace/support/GraphicHandler.js";const g={base:"esri-utility-trace-network",loaderContainer:"esri-utility-trace-network__loader-container",loader:"esri-utility-trace-network__loader",fadeIn:"esri-utility-trace-network--fade-in",addButtonContainer:"esri-utility-trace-network__add-button-container",noticeContainer:"esri-utility-trace-network__notice-container",listContainer:"esri-utility-trace-network__list-container",resultsContainer:"esri-utility-trace-network__results-container",flow:"esri-utility-trace-network__flow",esriWidget:"esri-widget",esriWidgetPanel:"esri-widget--panel",esriWidgetDisabled:"esri-widget--disabled",esriButton:"esri-button",esriButtonTertiary:"esri-button--tertiary",esriInput:"esri-input",esriMatchHeight:"esri-match-height",iconHandle:"esri-icon-handle-vertical",iconPlus:"esri-icon-plus",iconEdit:"esri-icon-edit",iconHandleHorizontal:"esri-icon-handle-horizontal",iconRefresh:"esri-icon-refresh",iconLink:"esri-icon-link",iconRemove:"esri-icon-erase",widgetIcon:"esri-icon-UtilityNetworkTrace",header:"esri-widget__heading",loading:"esri-icon-loading-indicator",rotating:"esri-rotating"},m="esri.widgets.UtilityNetworkTrace";function w(e){return{height:e+"px"}}function _(e){return{width:e+"px"}}function v(){return{width:"75%"}}function b(){return{textAlign:"center"}}function y(){return{width:"100%"}}function T(){return{height:"100%"}}const S={NOEXTENTION:-2147208474};let f=class extends(t(o)){constructor(e,t){super(e,t),this._tracesExists=!0,this._graphicHandler=null,this._selectToolActive=!1,this._activeTrace=null,this._activeSwatch="",this._traceHeaderForFlow="",this._assetGroupHeader="",this._assetTypeHeader="",this._traceResultsFunctions=[],this._traceResultsAssetGroup=[],this._traceResultsAssetType=[],this._traceResultsIndividual=[],this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this._activeTab="input",this._flagViewType="starting-point",this._alertRemoveModal=!1,this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoStartAssetFound=!1,this._warningNoBarrierAssetFound=!1,this._warningNoTerminal=!1,this._confirmReset=!1,this._showResultOptions=!1,this._resultObjectIdField="objectid",this._resultDisplayField="objectid",this._resultSortField="objectid",this._resultSortOrder="desc",this._swatchNode=null,this._individualResultNode=null,this._symbolStartFlag=null,this._symbolBarrier=null,this._watchHandler=null,this._loadUNError=!0,this._errorMessage="",this.disabled=!0,this.iconClass=g.widgetIcon,this.inputSettings=[],this.messages=null,this.messagesCommon=null,this.viewModel=new h}initialize(){this._utilityNetworkTraceInitialized(),this._graphicHandler=new u}get defaultGraphicColor(){return this.viewModel.defaultGraphicColor}set defaultGraphicColor(e){this.viewModel.defaultGraphicColor=e}get flags(){return this.viewModel.flags}set flags(e){this.viewModel.flags=e}get gdbVersion(){return this.viewModel.gdbVersion}set gdbVersion(e){this.viewModel.gdbVersion=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get selectedTraces(){return this.viewModel.selectedTraces}set selectedTraces(e){this.viewModel.selectedTraces=e}get selectOnComplete(){return this.viewModel.selectOnComplete}set selectOnComplete(e){this.viewModel.selectOnComplete=e}get showGraphicsOnComplete(){return this.viewModel.showGraphicsOnComplete}set showGraphicsOnComplete(e){this.viewModel.showGraphicsOnComplete=e}get showSelectionAttributes(){return this.viewModel.showSelectionAttributes}set showSelectionAttributes(e){this.viewModel.showSelectionAttributes=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}async checkCanTrace(){this._confirmReset=!1;const e=this.viewModel.checkCanTrace();e.status?(this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoTraceSelected=!1,this._warningNoTerminal=!1,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this.switchTab("result"),this.viewModel._activeProgress=!0,await this.viewModel.callTrace(),this.viewModel._activeProgress=!1):e.issues.forEach((e=>{switch(e){case"noStart":this._warningNoFlag=!0;break;case"noTerminalSelected":this._warningNoTerminal=!0;break;default:this._warningNoTraceSelected=!0}}))}confirmReset(){this._confirmReset=!0}render(){const{state:e}=this.viewModel;this._mixCustomStrings(),this._overrideFlagSymbol();const t="loading"===e?this.renderLoading():this.renderUtilityNetworkTrace();return d("div",{class:this.classes(g.base,g.esriWidget,g.esriWidgetPanel,{[g.esriWidgetDisabled]:this.disabled})},t)}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-group.js"),import("@esri/calcite-components/dist/components/calcite-action-pad.js"),import("@esri/calcite-components/dist/components/calcite-block.js"),import("@esri/calcite-components/dist/components/calcite-block-section.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-checkbox.js"),import("@esri/calcite-components/dist/components/calcite-color-picker-swatch.js"),import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-flow-item.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-label.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-modal.js"),import("@esri/calcite-components/dist/components/calcite-notice.js"),import("@esri/calcite-components/dist/components/calcite-option.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-select.js"),import("@esri/calcite-components/dist/components/calcite-tab.js"),import("@esri/calcite-components/dist/components/calcite-tab-nav.js"),import("@esri/calcite-components/dist/components/calcite-tab-title.js"),import("@esri/calcite-components/dist/components/calcite-tabs.js")])}switchTab(e){this._activeTab=e}switchToFunctions(e,t){this._traceResultsFunctions=e,this._showTraceResultFunctions=t}switchToAssetGroup(e,t,s){this._traceHeaderForFlow=t,this._traceResultsAssetGroup=e,this._showTraceResultAssetGroup=s}switchToAssetType(e,t,s){this._assetGroupHeader=t,this._traceResultsAssetType=e,this._showTraceResultAssetType=s}switchToIndividualRecords(e,t,s){this._assetTypeHeader=t,this._traceResultsIndividual=e,this._showIndividualRecords=s}renderLoading(){return d("div",{class:g.loaderContainer,key:"loader"},d("div",{class:g.loader}))}renderUtilityNetworkTrace(){const{messages:e}=this;let t=d("calcite-tabs",{position:"above",layout:"center",styles:y()},d("calcite-tab-nav",{slot:"tab-nav"},d("calcite-tab-title",{active:"input"===this._activeTab,onclick:()=>{this.switchTab("input")}},e.inputsStrings.headerTabInputs),d("calcite-tab-title",{active:"result"===this._activeTab,onclick:()=>{this.switchTab("result")}},e.resultsStrings.headerTabResults)),d("calcite-tab",{active:"input"===this._activeTab},this.renderInputPanel()),d("calcite-tab",{active:"result"===this._activeTab},this.viewModel._activeProgress?d("calcite-loader",{active:!0,label:e.alertsStrings.traceExecuting,text:e.alertsStrings.traceExecuting,type:"indeterminate"}):this.viewModel._traceResults.length>0?this.renderResultPanel():this.renderWarningMessage("noTraceExecuted",!1),d("calcite-modal",{active:this._confirmReset,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._confirmReset=!1}},d("h3",{slot:"header"},e.resultsStrings.startOverButton),d("div",{slot:"content"},e.resultsStrings.startOverValidation),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._confirmReset=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this._confirmReset=!1,this.viewModel.reset(),this.switchTab("input")}},e.globalStrings.ok))));return this._tracesExists||(t=d("calcite-panel",null,this.renderWarningMessage("noTraceConfig",!1))),this._loadUNError||(t=d("calcite-panel",null,this.renderWarningMessage("loadUNError",!1,this._errorMessage))),t}renderInputPanel(){const{messages:e}=this;return d("calcite-flow",{class:g.flow},d("calcite-flow-item",null,this._warningNoFlag?this.renderWarningMessage("flag",!0):null,this._warningNoTerminal?this.renderWarningMessage("noTerminal",!0):null,this._warningNoTraceSelected?this.renderWarningMessage("trace",!0):null,this.renderTraceSelectorContainer(),this.renderStartFlagsContainer(),this.renderBarriersFlagsContainer(),this._warningNoFlag&&this._warningNoTraceSelected?d("div",{styles:w(10)}):null,d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.checkCanTrace()}},e.tracingStrings.runTrace)),this._selectToolActive?this.renderActiveTool():null)}renderResultPanel(){return d("calcite-flow",{styles:T()},this.renderTraceResults(),this._showTraceResultFunctions?this.renderTraceResultFunctions():null,this._showTraceResultAssetGroup?this.renderTraceResultByAssetGroup():null,this._showTraceResultAssetType?this.renderTraceResultByAssetType():null,this._showIndividualRecords?this.renderTraceResultIndividual():null,this._showIndividualRecords?this.renderTraceResultIndividualPopover():null)}renderStartFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"starting-point"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"start"))}));let i=null;return this._symbolStartFlag&&(i=this._getSymbolIcon(this._symbolStartFlag)),d("calcite-block",{heading:e.inputsStrings.headerStartingPoint+" ("+s.length+")",open:!0,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"pin",scale:"s"})),d("div",null,e.inputsStrings.startingPointHint),d("div",{class:g.listContainer},t),this._warningNoStartAssetFound?this.renderWarningMessage("noStartAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline","icon-start":"plus",scale:"m",href:"",label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="starting-point",this._selectToolActive=!0,this._warningNoStartAssetFound=!1,this.viewModel.addFlagByHit("starting-point",this._symbolStartFlag).then((e=>{e?this._warningNoFlag=!1:this._warningNoStartAssetFound=!0,this._selectToolActive=!1}))},round:!0})))}renderBarriersFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"barrier"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"barrier"))}));let i=null;return this._symbolBarrier&&(i=this._getSymbolIcon(this._symbolBarrier)),d("calcite-block",{heading:e.inputsStrings.headerBarrier+" ("+s.length+")",open:!1,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"x-circle-f",scale:"s"})),d("div",null,e.inputsStrings.barrierPointHint),d("div",{class:g.listContainer},t),this._warningNoBarrierAssetFound?this.renderWarningMessage("noBarrierAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline",color:"blue","icon-start":"plus",scale:"m",href:"",round:!0,label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="barrier",this._selectToolActive=!0,this._warningNoBarrierAssetFound=!1,this.viewModel.addFlagByHit("barrier",this._symbolBarrier).then((e=>{e||(this._warningNoBarrierAssetFound=!0),this._selectToolActive=!1}))}})))}renderFlagRow(e,t){const{messages:s}=this,i=[];let r=!1;return null!==e.allTerminals&&void 0!==e.allTerminals&&e.allTerminals.terminals.length>0&&(r=!0,e.allTerminals.terminals.forEach((t=>{let s=!1;e.selectedTerminals.includes(t.id)&&(s=!0),i.push(d("calcite-combobox-item",{key:t.name,selected:s,value:t.id,"text-label":t.name}))}))),d("calcite-block",{key:"pop"+e.globalId+e.type+e.id+t,heading:e.displayValue.value,collapsible:null!==e.allTerminals||"barrier"===e.type},d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.remove,label:s.globalStrings.remove,onCalciteListItemChange:()=>{this.viewModel.removeFlag(e)},onclick:()=>{this.viewModel.removeFlag(e)},scale:"s",icon:"trash"}),d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.zoomToFeature,label:s.globalStrings.zoomToFeature,onCalciteListItemChange:()=>{this.viewModel.zoomToAsset(e.details.geometry)},onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)},scale:"s",icon:"zoom-to-object"}),"barrier"===e.type?d("calcite-label",{scale:"s",layout:"inline"},d("calcite-checkbox",{checked:e.isFilterBarrier,scale:"s",onclick:()=>{this.viewModel.manageFilterBarrier(!e.isFilterBarrier,e)}}),s.inputsStrings.barrierFilter):null,r?d("calcite-combobox",{label:s.globalStrings.selectTerminalPlaceholder,placeholder:s.globalStrings.selectTerminalPlaceholder,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChange:t=>{t.detail.selectedItems.length>0?(e.selectedTerminals=[],t.detail.selectedItems.forEach((t=>{this.viewModel.addTerminal(t.value,e)}))):e.selectedTerminals=[]},onCalciteComboboxChipDismiss:t=>{t.preventDefault(),this.viewModel.removeTerminal(t.target.value,e)}},i):null)}renderActiveTool(){const{messages:e}=this;let t=null;return"starting-point"===this._flagViewType?this._symbolStartFlag&&(t=this._getSymbolIcon(this._symbolStartFlag)):this._symbolBarrier&&(t=this._getSymbolIcon(this._symbolBarrier)),d("calcite-flow-item",{"height-scale":"s",onCalciteFlowItemBackClick:()=>{this.viewModel._clickHandler&&(this.viewModel._clickHandler.remove(),this.view.popup.autoOpenEnabled=!0),this._selectToolActive=!1},heading:e.inputsStrings.addPointOption},d("calcite-block",{open:!0,collapsible:!1,heading:""},d("div",{styles:b()},t||d("calcite-icon",{icon:"starting-point"===this._flagViewType?"pin":"x-circle-f",scale:"s"})),d("div",{styles:b()},e.inputsStrings.addPointHint)))}renderTraceSelectorContainer(){const{messages:e}=this,t=[];return this.viewModel._traces.length>0&&this.viewModel._traces.forEach((e=>{t.push(d("calcite-combobox-item",{key:e.globalId,selected:e.selected,value:e.globalId,"text-label":e.title,onCalciteComboboxItemChange:t=>{const s=t.target;this.viewModel.selectTraces(s.selected,e.globalId),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}}))})),d("calcite-block",{heading:e.tracingStrings.traceOperation,open:!0,collapsible:!0},d("calcite-combobox",{label:e.inputsStrings.selectTraces,placeholder:e.inputsStrings.selectTraces,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChipDismiss:e=>{this.viewModel.selectTraces(!1,e.target.value),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}},t))}renderStartOverContainer(){const{messages:e}=this;return d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.confirmReset()}},e.resultsStrings.startOverButton)}renderWarningMessage(e,t,s){const{messages:i}=this;let r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;switch(e){case"flag":r=i.alertsStrings.startingPointAlertHeader,l=i.alertsStrings.startingPointAlert;break;case"noTerminal":r=i.alertsStrings.noTerminalDefinedHeader,l=i.alertsStrings.noTerminalDefined;break;case"trace":r=i.alertsStrings.selectTraceAlertHeader,l=i.alertsStrings.selectTraceAlert;break;case"noTraceExecuted":r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;break;case"noBarrierAsset":case"noStartAsset":r=i.alertsStrings.noAssetsFoundHeader,l=i.alertsStrings.noAssetFound;break;case"noTraceConfig":r="",l=i.alertsStrings.noTraceSupported;break;default:r=i.alertsStrings.genericErrorHeader,l=s||""}return d("div",{class:g.noticeContainer,key:e},d("calcite-notice",{open:!0,key:e,active:!0,dismissible:t,icon:!0,scale:"s",width:"auto",color:"red",onCalciteNoticeClose:()=>{switch(e){case"flag":this._warningNoFlag=!1;break;case"noTerminal":this._warningNoTerminal=!1;break;case"trace":this._warningNoTraceSelected=!1;break;case"noStartAsset":this._warningNoStartAssetFound=!1;break;case"noBarrierAsset":this._warningNoBarrierAssetFound=!1}}},d("div",{slot:"title"},r),d("div",{slot:"message"},l)))}renderRemoveTraceContainer(e){const{messages:t}=this;return d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:t.globalStrings.clearResults,label:t.globalStrings.clearResults,onCalciteListItemChange:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},onclick:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},scale:"s",icon:"trash"})}renderHighlightColorPicker(e,t){const{messages:s}=this,i=[];for(let r=0;r<p.length;r++)i.push(d("calcite-action",{key:r,text:s.resultsStrings.graphicColor,label:s.resultsStrings.graphicColor,scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(r),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(r).hex,active:e.color===this._graphicHandler.getHighlightColor(r).color})));return d("calcite-action-pad",{position:"start",layout:"grid",expandDisabled:!0},d("calcite-action-group",{layout:"grid",columns:4},i))}renderTraceResults(){const{messages:e}=this,t=this.viewModel._traceResults,s=[];return t.forEach(((t,i)=>{let r=[],l=[],o=!1,a=!1,n=!1;null!==t.results&&t.results.hasOwnProperty("elements")?(null!==t.results.aggregatedGeometry&&(a=!0),null!==t.results.globalFunctionResults&&t.results.globalFunctionResults.length>0&&(l=t.results.globalFunctionResults,l.length>0&&(n=!0)),t.results.elements.length>0&&(r=t.results.elements,r.length>0&&(o=!0)),s.push(d("calcite-block",{key:t.trace.title,heading:t.trace.title,summary:t.trace.description,collapsible:!1,open:!0,intlOptions:e.resultsStrings.ellipsesOptions},this.renderRemoveTraceContainer(t),d("calcite-list",null,n?d("calcite-list-item",{label:e.resultsStrings.functionHeader+" ("+l.length+")",onclick:()=>{this.switchToFunctions(l,!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):null,o&&this.viewModel.showSelectionAttributes?d("calcite-list-item",{key:this.id,label:e.resultsStrings.viewFeatures+" ("+r.length+")",onclick:()=>{this.switchToAssetGroup(this._groupResultsByAssetGroup(t),t.trace.title+" ("+r.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):this.viewModel.showSelectionAttributes?d("calcite-label",{layout:"inline",scale:"s"},e.resultsStrings.noSelectionResults):null),d("div",{styles:w(10)}),o?d("calcite-label",{layout:"inline",scale:"s",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}},d("calcite-checkbox",{checked:t.selectionEnabled,scale:"m",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}}),this.viewModel.showSelectionAttributes?e.resultsStrings.selectFeatures:e.resultsStrings.selectFeatures+" ("+r.length+")"):null,a?d("calcite-block-section",{"toggle-display":"switch",text:e.resultsStrings.highlightTrace,open:t.graphicEnabled,onCalciteBlockSectionToggle:e=>{e.target.open?this.viewModel.changeResultGraphicColor(t.graphicColor,t):this.viewModel.removeResultGraphicFromView(t)}},d("calcite-action",{text:e.resultsStrings.graphicColor,label:e.resultsStrings.graphicColor,scale:"s",onclick:e=>{const t=e.target;this._swatchNode=t,this._activeSwatch="aggGeom_"+i}},d("calcite-color-picker-swatch",{scale:"s",color:t.graphicColor.hex})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.graphicColor,text:e.resultsStrings.graphicColor,referenceElement:this._swatchNode,placement:"auto-start",offsetDistance:0,offsetSkidding:0,open:this._activeSwatch==="aggGeom_"+i,onCalcitePopoverClose:()=>{this._swatchNode=null,this._activeSwatch=null}},this.renderHighlightColorPicker(t.graphicColor,t))):null))):s.push(d("calcite-block",{key:"error-"+i,heading:t.trace.title,collapsible:!1,open:!0},this.renderRemoveTraceContainer(t),this.renderWarningMessage("noController",!1,t.status)))})),d("calcite-flow-item",{key:"traceResults",styles:T()},s,this.renderStartOverContainer(),d("calcite-modal",{active:this._alertRemoveModal,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._alertRemoveModal=!1}},d("h3",{slot:"header"},e.globalStrings.clearResults),d("div",{slot:"content"},e.alertsStrings.clearResultsAlert),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._alertRemoveModal=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this.viewModel.clearResult(this._activeTrace),this._alertRemoveModal=!1,0===this.viewModel._traceResults.length?this.switchTab("input"):(this._activeTrace=this.viewModel._traceResults[0].trace,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1)}},e.globalStrings.ok)))}renderTraceResultFunctions(){const{messages:e}=this,t=this._traceResultsFunctions,s=[];return t.forEach((e=>{s.push(this.renderResultRowFunctions(e))})),d("calcite-flow-item",{key:"functionResultMultiple",onCalciteFlowItemBackClick:()=>{this.switchToFunctions([],!1)},heading:e.resultsStrings.functionHeader},s,this.renderStartOverContainer())}renderTraceResultByAssetGroup(){const e=this._traceResultsAssetGroup,t=[];for(const s in e){const i=e[s];for(const e in i)t.push(this.renderResultRowAssetGroup(i[e]))}return d("calcite-flow-item",{key:"assetGroupResultMultiple",onCalciteFlowItemBackClick:()=>{this.switchToAssetGroup([],"",!1)},heading:this._traceHeaderForFlow},d("calcite-list",null,t),this.renderStartOverContainer())}renderTraceResultByAssetType(){const e=this._traceResultsAssetType,t=[];for(const s in e)e[s].length>0&&t.push(this.renderResultRowAssetType(e[s]));return d("calcite-flow-item",{key:"assetTypeResult",onCalciteFlowItemBackClick:()=>{this.switchToAssetType([],"",!1)},heading:this._assetGroupHeader},t,this.renderStartOverContainer())}renderTraceResultIndividual(){const{messages:e}=this,t=this._traceResultsIndividual;t.sort(this._compare(this._resultSortField,this._resultSortOrder));const s=[];if(t.length>0){t[0].details.fields.some((e=>e.name.toLowerCase()===this._resultDisplayField.toLocaleLowerCase()))||(this._resultDisplayField=this._resultObjectIdField,this._resultSortField=this._resultObjectIdField),t.forEach((e=>{s.push(this.renderResultRowIndividual(e))}))}return d("calcite-flow-item",{key:"individualResult",onCalciteFlowItemBackClick:()=>{this._showResultOptions=!1,this.switchToIndividualRecords([],"",!1)},heading:this._assetTypeHeader},d("calcite-action",{"text-enabled":!0,slot:"header-actions-end",text:e.resultsStrings.displayAttribute,onCalciteListItemChange:()=>{this._showResultOptions=!0},onclick:()=>{this._showResultOptions=!0},scale:"s",icon:"gear",label:e.resultsStrings.displayAttribute,id:"field_options"+this.id,afterCreate:a,bind:this,"data-node-ref":"_individualResultNode"}),s,this.renderStartOverContainer())}renderTraceResultIndividualPopover(){const{messages:e}=this,t=this._traceResultsIndividual,s=[],i=[];return t.length>0&&t[0].details.fields.forEach((e=>{s.push(d("calcite-option",{key:"display"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultDisplayField})),i.push(d("calcite-option",{key:"sort"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultSortField}))})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.displayAttribute,referenceElement:this._individualResultNode,placement:"left-start",offsetDistance:0,offsetSkidding:0,open:this._showResultOptions,styles:null!==this.domNode?_(.75*this.domNode.clientWidth):v()},d("calcite-block",{heading:"",open:!0},d("calcite-label",{scale:"s"},e.resultsStrings.displayAttribute,d("calcite-select",{label:e.resultsStrings.displayAttribute,onCalciteSelectChange:e=>{const t=e.target;this._resultDisplayField=t.selectedOption.value,this._showResultOptions=!1}},s)),d("calcite-label",{scale:"s"},e.resultsStrings.sortBy,d("calcite-select",{label:e.resultsStrings.sortBy,onCalciteSelectChange:e=>{const s=e.target;this._resultSortField=s.selectedOption.value,t.sort(this._compare(this._resultSortField,this._resultSortOrder)),this._traceResultsIndividual=t,this._showResultOptions=!1}},i))))}renderResultRow(e){let t=e[0].assetGroupCode;const s=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(s.length>0){const i=s[0].assetGroups.filter((t=>t.assetGroupCode===e[0].assetGroupCode));i.length>0&&(t=i[0].assetGroupName)}return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}renderResultRowFunctions(e){return d("calcite-block",{heading:e.networkAttributeName+" "+e.functionType+" = "+e.result,collapsible:!1})}renderResultRowAssetGroup(e){const t=this._getAssetGroupName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowAssetType(e){const t=this._getAssetTypeName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.viewModel.queryFeaturesById(e).then((s=>{if(s?.length){this._resultObjectIdField=s[0].layer.objectIdField,"objectid"===this._resultDisplayField&&(this._resultDisplayField=s[0].layer.objectIdField),"objectid"===this._resultSortField&&(this._resultSortField=s[0].layer.objectIdField);const i=this._appendAttributes(e,s,"objectId");this.switchToIndividualRecords(i,t+" ("+e.length+")",!0)}else this.switchToIndividualRecords(e,t+" ("+e.length+")",!0)}))}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowIndividual(e){const{messages:t}=this;let s="",i=null;for(let r=0;r<e.details.fields.length;r++)e.details.fields[r].name===this._resultDisplayField&&(i=e.details.fields[r]);if("date"===i.type){s=new Date(e.details.attributes[this._resultDisplayField]).toDateString()}else if(null!==i.domain){const t=i.domain.codedValues;let r="";for(let s=0;s<t.length;s++)t[s].code===e.details.attributes[this._resultDisplayField]&&(r=t[s].name);s=r}else s="assetgroup"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetGroupName(e):"assettype"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetTypeName(e):e.details.attributes[this._resultDisplayField];return s&&""!==s&&null!==s||(s=t.resultsStrings.noValue),d("calcite-list-item",{label:s,onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)}},d("calcite-icon",{icon:"zoom-to-object","text-label":t.globalStrings.zoomToFeature,scale:"s",slot:"content-end"}))}_mixCustomStrings(){const{messages:e}=this;this.inputSettings.length>0&&this.inputSettings.forEach((t=>{"starting-point"===t.type&&(e.inputsStrings.headerStartingPoint=t.label,e.inputsStrings.startingPointHint=t.description),"barrier"===t.type&&(e.inputsStrings.headerBarrier=t.label,e.inputsStrings.barrierPointHint=t.description)}))}_overrideFlagSymbol(){this.inputSettings.length>0&&this.inputSettings.forEach((e=>{"starting-point"===e.type?this._symbolStartFlag=e.symbol:this._symbolBarrier=e.symbol,this.viewModel.changeFlagSymbol(e.type,e.symbol)}))}_utilityNetworkTraceInitialized(){return this.viewModel.loadUtilityNetwork().then((e=>e?(this.viewModel.selectTracesOnLoad(),this._registerWatchers(),this.viewModel._traces.length<=0&&(this._tracesExists=!1),this.viewModel.flags.length>0?this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(async()=>{this._warningNoFlag=!1,this._warningNoBarrierAssetFound=!1,this._warningNoStartAssetFound=!1;const e=await this.viewModel.addFlagsOnLoad();this.viewModel.removeFlagsOnLoadWatcher(),e.includes("barrier")&&(this._warningNoBarrierAssetFound=!0),e.includes("starting-point")&&(this._warningNoStartAssetFound=!0),this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}))})):this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))):(this._tracesExists=!1,this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))))).catch((e=>{const{messages:t}=this;this._loadUNError=!1,e.details.raw.extendedCode===S.NOEXTENTION?this._errorMessage=t?.alertsStrings?.noUserExtension||e.message:this._errorMessage=e.message,this.disabled=!1}))}_registerWatchers(){this.addHandles([i((()=>this.selectedTraces),(()=>{this.viewModel.selectTracesOnLoad(),this.scheduleRender()})),i((()=>this.defaultGraphicColor),(()=>{this.viewModel._traceResults.length>0&&this.viewModel._traceResults.forEach((e=>{this.viewModel.changeResultGraphicColor(this.viewModel.defaultGraphicColor,e)})),this.scheduleRender()}))])}_groupResultsByAssetGroup(e){const t=[],s=e.results.elements,i=this._groupBy(s,"networkSourceId");for(const r in i)t.push(this._groupBy(i[r],"assetGroupCode"));return t}_groupResultsByAssetType(e){return this._groupBy(e,"assetTypeCode")}_appendAttributes(e,t,s){const i=[];return e.forEach((e=>{t.forEach((t=>{t.featureSet.features.forEach((r=>{e[s]===r.attributes[this._resultObjectIdField]&&(e.details=r,e.details.fields=t.featureSet.fields,i.push(e))}))}))})),i}_getAssetGroupName(e){let t=e.assetGroupCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const e=i.assetGroups.find((e=>e.assetGroupCode===s));e&&(t=e.assetGroupName)}return t}_getAssetTypeName(e){let t=e.assetTypeCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const r=i.assetGroups.find((e=>e.assetGroupCode===s));if(r){const s=r.assetTypes.find((t=>t.assetTypeCode===e.assetTypeCode));s&&(t=s.assetTypeName)}}return t}_compare(e,t){return(s,i)=>{let r=0,l=s.details.attributes[e],o=i.details.attributes[e];return isNaN(l)&&(l=l.toLowerCase()),isNaN(o)&&(o=o.toLowerCase()),"desc"===t?l>o?r=1:l<o&&(r=-1):l<o?r=1:l>o&&(r=-1),r}}_groupBy(e,t){return e.reduce(((e,s)=>((e[s[t]]=e[s[t]]||[]).push(s),e)),{})}_getSymbolIcon(e){return"picture-marker"===e.type?d("img",{src:e.url,width:e.width,height:e.height}):null}};e([r()],f.prototype,"_tracesExists",void 0),e([r()],f.prototype,"_selectToolActive",void 0),e([r()],f.prototype,"_activeTrace",void 0),e([r()],f.prototype,"_activeSwatch",void 0),e([r()],f.prototype,"_traceHeaderForFlow",void 0),e([r()],f.prototype,"_assetGroupHeader",void 0),e([r()],f.prototype,"_assetTypeHeader",void 0),e([r()],f.prototype,"_traceResultsFunctions",void 0),e([r()],f.prototype,"_traceResultsAssetGroup",void 0),e([r()],f.prototype,"_traceResultsAssetType",void 0),e([r()],f.prototype,"_traceResultsIndividual",void 0),e([r()],f.prototype,"_showTraceResultFunctions",void 0),e([r()],f.prototype,"_showTraceResultAssetGroup",void 0),e([r()],f.prototype,"_showTraceResultAssetType",void 0),e([r()],f.prototype,"_showIndividualRecords",void 0),e([r()],f.prototype,"_activeTab",void 0),e([r()],f.prototype,"_alertRemoveModal",void 0),e([r()],f.prototype,"_warningNoFlag",void 0),e([r()],f.prototype,"_warningNoTraceSelected",void 0),e([r()],f.prototype,"_confirmReset",void 0),e([r()],f.prototype,"_swatchNode",void 0),e([r()],f.prototype,"_errorMessage",void 0),e([r()],f.prototype,"defaultGraphicColor",null),e([r()],f.prototype,"disabled",void 0),e([r()],f.prototype,"flags",null),e([r()],f.prototype,"gdbVersion",null),e([r()],f.prototype,"iconClass",void 0),e([r()],f.prototype,"inputSettings",void 0),e([r()],f.prototype,"label",null),e([r(),n("esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace")],f.prototype,"messages",void 0),e([r(),n("esri/t9n/common")],f.prototype,"messagesCommon",void 0),e([r()],f.prototype,"selectedTraces",null),e([r()],f.prototype,"selectOnComplete",null),e([r()],f.prototype,"showGraphicsOnComplete",null),e([r()],f.prototype,"showSelectionAttributes",null),e([r()],f.prototype,"view",null),e([c(["add-flag","add-flag-complete","add-flag-error","select-features","clear-selection"]),r({type:h})],f.prototype,"viewModel",void 0),f=e([l(m)],f);const R=f;export{R as default};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9324,3172,9880,661],{22303:(e,t,r)=>{r.d(t,{Z:()=>f});var n,o,s=r(35270),i=r(22021),a=r(70586),l=r(75215);function u(e){return(0,i.uZ)((0,l.vU)(e),0,255)}function c(e,t,r){return e=Number(e),isNaN(e)?r:e<t?t:e>r?r:e}class d{constructor(e){this.r=255,this.g=255,this.b=255,this.a=1,e&&this.setColor(e)}static blendColors(e,t,r,n=new d){return n.r=Math.round(e.r+(t.r-e.r)*r),n.g=Math.round(e.g+(t.g-e.g)*r),n.b=Math.round(e.b+(t.b-e.b)*r),n.a=e.a+(t.a-e.a)*r,n._sanitize()}static fromRgb(e,t){const r=e.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/);if(r){const e=r[2].split(/\s*,\s*/),n=r[1];if("rgb"===n&&3===e.length||"rgba"===n&&4===e.length){const r=e[0];if("%"===r.charAt(r.length-1)){const r=e.map((e=>2.56*parseFloat(e)));return 4===e.length&&(r[3]=parseFloat(e[3])),d.fromArray(r,t)}return d.fromArray(e.map((e=>parseFloat(e))),t)}if("hsl"===n&&3===e.length||"hsla"===n&&4===e.length)return d.fromArray((0,s.B7)(parseFloat(e[0]),parseFloat(e[1])/100,parseFloat(e[2])/100,parseFloat(e[3])),t)}return null}static fromHex(e,t=new d){if(4!==e.length&&7!==e.length||"#"!==e[0])return null;const r=4===e.length?4:8,n=(1<<r)-1;let o=Number("0x"+e.substr(1));return isNaN(o)?null:(["b","g","r"].forEach((e=>{const s=o&n;o>>=r,t[e]=4===r?17*s:s})),t.a=1,t)}static fromArray(e,t=new d){return t._set(Number(e[0]),Number(e[1]),Number(e[2]),Number(e[3])),isNaN(t.a)&&(t.a=1),t._sanitize()}static fromString(e,t){const r=(0,s.St)(e)?(0,s.h$)(e):null;return r&&d.fromArray(r,t)||d.fromRgb(e,t)||d.fromHex(e,t)}static fromJSON(e){return e&&new d([e[0],e[1],e[2],e[3]/255])}static toUnitRGB(e){return(0,a.pC)(e)?[e.r/255,e.g/255,e.b/255]:null}static toUnitRGBA(e){return(0,a.pC)(e)?[e.r/255,e.g/255,e.b/255,null!=e.a?e.a:1]:null}get isBright(){return.299*this.r+.587*this.g+.114*this.b>=127}setColor(e){return"string"==typeof e?d.fromString(e,this):Array.isArray(e)?d.fromArray(e,this):(this._set(e.r??0,e.g??0,e.b??0,e.a??1),e instanceof d||this._sanitize()),this}toRgb(){return[this.r,this.g,this.b]}toRgba(){return[this.r,this.g,this.b,this.a]}toHex(){const e=this.r.toString(16),t=this.g.toString(16),r=this.b.toString(16);return`#${e.length<2?"0"+e:e}${t.length<2?"0"+t:t}${r.length<2?"0"+r:r}`}toCss(e=!1){const t=this.r+", "+this.g+", "+this.b;return e?`rgba(${t}, ${this.a})`:`rgb(${t})`}toString(){return this.toCss(!0)}toJSON(){return this.toArray()}toArray(e=d.AlphaMode.ALWAYS){const t=u(this.r),r=u(this.g),n=u(this.b);return e===d.AlphaMode.ALWAYS||1!==this.a?[t,r,n,u(255*this.a)]:[t,r,n]}clone(){return new d(this.toRgba())}hash(){return this.r<<24|this.g<<16|this.b<<8|255*this.a}equals(e){return(0,a.pC)(e)&&e.r===this.r&&e.g===this.g&&e.b===this.b&&e.a===this.a}_sanitize(){return this.r=Math.round(c(this.r,0,255)),this.g=Math.round(c(this.g,0,255)),this.b=Math.round(c(this.b,0,255)),this.a=c(this.a,0,1),this}_set(e,t,r,n){this.r=e,this.g=t,this.b=r,this.a=n}}d.prototype.declaredClass="esri.Color",n=d||(d={}),(o=n.AlphaMode||(n.AlphaMode={}))[o.ALWAYS=0]="ALWAYS",o[o.UNLESS_OPAQUE=1]="UNLESS_OPAQUE";const f=d},99880:(e,t,r)=>{r.d(t,{V:()=>l});var n=r(68773),o=(r(3172),r(20102)),s=r(92604),i=r(17452);const a=s.Z.getLogger("esri.assets");function l(e){if(!n.Z.assetsPath)throw a.errorOnce("The API assets location needs to be set using config.assetsPath. More information: https://arcg.is/1OzLe50"),new o.Z("assets:path-not-set","config.assetsPath is not set");return(0,i.v_)(n.Z.assetsPath,e)}},46521:(e,t,r)=>{function n(){return[1,0,0,0,1,0,0,0,1]}function o(e,t){return new Float64Array(e,t,9)}r.d(t,{a:()=>o,c:()=>n}),Object.freeze(Object.defineProperty({__proto__:null,create:n,clone:function(e){return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},fromValues:function(e,t,r,n,o,s,i,a,l){return[e,t,r,n,o,s,i,a,l]},createView:o},Symbol.toStringTag,{value:"Module"}))},52138:(e,t,r)=>{r.d(t,{a:()=>l,d:()=>p,e:()=>f,f:()=>h,g:()=>g,h:()=>v,i:()=>i,j:()=>M,k:()=>d,m:()=>u,s:()=>s,t:()=>a,v:()=>c,x:()=>C,y:()=>m});var n=r(65617),o=r(46851);function s(e,t,r,n,o,s,i,a,l,u,c,d,f,h,p,m,b){return e[0]=t,e[1]=r,e[2]=n,e[3]=o,e[4]=s,e[5]=i,e[6]=a,e[7]=l,e[8]=u,e[9]=c,e[10]=d,e[11]=f,e[12]=h,e[13]=p,e[14]=m,e[15]=b,e}function i(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function a(e,t){if(e===t){const r=t[1],n=t[2],o=t[3],s=t[6],i=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=s,e[11]=t[14],e[12]=o,e[13]=i,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function l(e,t){const r=t[0],n=t[1],o=t[2],s=t[3],i=t[4],a=t[5],l=t[6],u=t[7],c=t[8],d=t[9],f=t[10],h=t[11],p=t[12],m=t[13],b=t[14],y=t[15],g=r*a-n*i,w=r*l-o*i,M=r*u-s*i,v=n*l-o*a,C=n*u-s*a,T=o*u-s*l,S=c*m-d*p,O=c*b-f*p,A=c*y-h*p,U=d*b-f*m,I=d*y-h*m,E=f*y-h*b;let q=g*E-w*I+M*U+v*A-C*O+T*S;return q?(q=1/q,e[0]=(a*E-l*I+u*U)*q,e[1]=(o*I-n*E-s*U)*q,e[2]=(m*T-b*C+y*v)*q,e[3]=(f*C-d*T-h*v)*q,e[4]=(l*A-i*E-u*O)*q,e[5]=(r*E-o*A+s*O)*q,e[6]=(b*M-p*T-y*w)*q,e[7]=(c*T-f*M+h*w)*q,e[8]=(i*I-a*A+u*S)*q,e[9]=(n*A-r*I-s*S)*q,e[10]=(p*C-m*M+y*g)*q,e[11]=(d*M-c*C-h*g)*q,e[12]=(a*O-i*U-l*S)*q,e[13]=(r*U-n*O+o*S)*q,e[14]=(m*w-p*v-b*g)*q,e[15]=(c*v-d*w+f*g)*q,e):null}function u(e,t,r){const n=t[0],o=t[1],s=t[2],i=t[3],a=t[4],l=t[5],u=t[6],c=t[7],d=t[8],f=t[9],h=t[10],p=t[11],m=t[12],b=t[13],y=t[14],g=t[15];let w=r[0],M=r[1],v=r[2],C=r[3];return e[0]=w*n+M*a+v*d+C*m,e[1]=w*o+M*l+v*f+C*b,e[2]=w*s+M*u+v*h+C*y,e[3]=w*i+M*c+v*p+C*g,w=r[4],M=r[5],v=r[6],C=r[7],e[4]=w*n+M*a+v*d+C*m,e[5]=w*o+M*l+v*f+C*b,e[6]=w*s+M*u+v*h+C*y,e[7]=w*i+M*c+v*p+C*g,w=r[8],M=r[9],v=r[10],C=r[11],e[8]=w*n+M*a+v*d+C*m,e[9]=w*o+M*l+v*f+C*b,e[10]=w*s+M*u+v*h+C*y,e[11]=w*i+M*c+v*p+C*g,w=r[12],M=r[13],v=r[14],C=r[15],e[12]=w*n+M*a+v*d+C*m,e[13]=w*o+M*l+v*f+C*b,e[14]=w*s+M*u+v*h+C*y,e[15]=w*i+M*c+v*p+C*g,e}function c(e,t,r){const n=r[0],o=r[1],s=r[2];if(t===e)e[12]=t[0]*n+t[4]*o+t[8]*s+t[12],e[13]=t[1]*n+t[5]*o+t[9]*s+t[13],e[14]=t[2]*n+t[6]*o+t[10]*s+t[14],e[15]=t[3]*n+t[7]*o+t[11]*s+t[15];else{const r=t[0],i=t[1],a=t[2],l=t[3],u=t[4],c=t[5],d=t[6],f=t[7],h=t[8],p=t[9],m=t[10],b=t[11];e[0]=r,e[1]=i,e[2]=a,e[3]=l,e[4]=u,e[5]=c,e[6]=d,e[7]=f,e[8]=h,e[9]=p,e[10]=m,e[11]=b,e[12]=r*n+u*o+h*s+t[12],e[13]=i*n+c*o+p*s+t[13],e[14]=a*n+d*o+m*s+t[14],e[15]=l*n+f*o+b*s+t[15]}return e}function d(e,t,r){const n=r[0],o=r[1],s=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*o,e[5]=t[5]*o,e[6]=t[6]*o,e[7]=t[7]*o,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function f(e,t,r,n){let s,i,a,l,u,c,d,f,h,p,m,b,y,g,w,M,v,C,T,S,O,A,U,I,E=n[0],q=n[1],k=n[2],_=Math.sqrt(E*E+q*q+k*k);return _<(0,o.g)()?null:(_=1/_,E*=_,q*=_,k*=_,s=Math.sin(r),i=Math.cos(r),a=1-i,l=t[0],u=t[1],c=t[2],d=t[3],f=t[4],h=t[5],p=t[6],m=t[7],b=t[8],y=t[9],g=t[10],w=t[11],M=E*E*a+i,v=q*E*a+k*s,C=k*E*a-q*s,T=E*q*a-k*s,S=q*q*a+i,O=k*q*a+E*s,A=E*k*a+q*s,U=q*k*a-E*s,I=k*k*a+i,e[0]=l*M+f*v+b*C,e[1]=u*M+h*v+y*C,e[2]=c*M+p*v+g*C,e[3]=d*M+m*v+w*C,e[4]=l*T+f*S+b*O,e[5]=u*T+h*S+y*O,e[6]=c*T+p*S+g*O,e[7]=d*T+m*S+w*O,e[8]=l*A+f*U+b*I,e[9]=u*A+h*U+y*I,e[10]=c*A+p*U+g*I,e[11]=d*A+m*U+w*I,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function h(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function p(e,t,r){if(0===t)return i(e);let n,s,a,l=r[0],u=r[1],c=r[2],d=Math.sqrt(l*l+u*u+c*c);return d<(0,o.g)()?null:(d=1/d,l*=d,u*=d,c*=d,n=Math.sin(t),s=Math.cos(t),a=1-s,e[0]=l*l*a+s,e[1]=u*l*a+c*n,e[2]=c*l*a-u*n,e[3]=0,e[4]=l*u*a-c*n,e[5]=u*u*a+s,e[6]=c*u*a+l*n,e[7]=0,e[8]=l*c*a+u*n,e[9]=u*c*a-l*n,e[10]=c*c*a+s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function m(e,t){const r=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function b(e,t,r){const n=t[0],o=t[1],s=t[2],i=t[3],a=n+n,l=o+o,u=s+s,c=n*a,d=n*l,f=n*u,h=o*l,p=o*u,m=s*u,b=i*a,y=i*l,g=i*u;return e[0]=1-(h+m),e[1]=d+g,e[2]=f-y,e[3]=0,e[4]=d-g,e[5]=1-(c+m),e[6]=p+b,e[7]=0,e[8]=f+y,e[9]=p-b,e[10]=1-(c+h),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}const y=(0,n.c)();function g(e,t,r,n){const o=t[0],s=t[1],i=t[2],a=t[3],l=o+o,u=s+s,c=i+i,d=o*l,f=o*u,h=o*c,p=s*u,m=s*c,b=i*c,y=a*l,g=a*u,w=a*c,M=n[0],v=n[1],C=n[2];return e[0]=(1-(p+b))*M,e[1]=(f+w)*M,e[2]=(h-g)*M,e[3]=0,e[4]=(f-w)*v,e[5]=(1-(d+b))*v,e[6]=(m+y)*v,e[7]=0,e[8]=(h+g)*C,e[9]=(m-y)*C,e[10]=(1-(d+p))*C,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function w(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function M(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function v(e,t){if(e===t)return!0;const r=e[0],n=e[1],s=e[2],i=e[3],a=e[4],l=e[5],u=e[6],c=e[7],d=e[8],f=e[9],h=e[10],p=e[11],m=e[12],b=e[13],y=e[14],g=e[15],w=t[0],M=t[1],v=t[2],C=t[3],T=t[4],S=t[5],O=t[6],A=t[7],U=t[8],I=t[9],E=t[10],q=t[11],k=t[12],_=t[13],x=t[14],R=t[15],P=(0,o.g)();return Math.abs(r-w)<=P*Math.max(1,Math.abs(r),Math.abs(w))&&Math.abs(n-M)<=P*Math.max(1,Math.abs(n),Math.abs(M))&&Math.abs(s-v)<=P*Math.max(1,Math.abs(s),Math.abs(v))&&Math.abs(i-C)<=P*Math.max(1,Math.abs(i),Math.abs(C))&&Math.abs(a-T)<=P*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(l-S)<=P*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(u-O)<=P*Math.max(1,Math.abs(u),Math.abs(O))&&Math.abs(c-A)<=P*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-U)<=P*Math.max(1,Math.abs(d),Math.abs(U))&&Math.abs(f-I)<=P*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(h-E)<=P*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(p-q)<=P*Math.max(1,Math.abs(p),Math.abs(q))&&Math.abs(m-k)<=P*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(b-_)<=P*Math.max(1,Math.abs(b),Math.abs(_))&&Math.abs(y-x)<=P*Math.max(1,Math.abs(y),Math.abs(x))&&Math.abs(g-R)<=P*Math.max(1,Math.abs(g),Math.abs(R))}function C(e){const t=(0,o.g)(),r=e[0],n=e[1],s=e[2],i=e[4],a=e[5],l=e[6],u=e[8],c=e[9],d=e[10];return Math.abs(1-(r*r+i*i+u*u))<=t&&Math.abs(1-(n*n+a*a+c*c))<=t&&Math.abs(1-(s*s+l*l+d*d))<=t}const T=u,S=w;Object.freeze(Object.defineProperty({__proto__:null,copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},set:s,identity:i,transpose:a,invert:l,adjoint:function(e,t){const r=t[0],n=t[1],o=t[2],s=t[3],i=t[4],a=t[5],l=t[6],u=t[7],c=t[8],d=t[9],f=t[10],h=t[11],p=t[12],m=t[13],b=t[14],y=t[15];return e[0]=a*(f*y-h*b)-d*(l*y-u*b)+m*(l*h-u*f),e[1]=-(n*(f*y-h*b)-d*(o*y-s*b)+m*(o*h-s*f)),e[2]=n*(l*y-u*b)-a*(o*y-s*b)+m*(o*u-s*l),e[3]=-(n*(l*h-u*f)-a*(o*h-s*f)+d*(o*u-s*l)),e[4]=-(i*(f*y-h*b)-c*(l*y-u*b)+p*(l*h-u*f)),e[5]=r*(f*y-h*b)-c*(o*y-s*b)+p*(o*h-s*f),e[6]=-(r*(l*y-u*b)-i*(o*y-s*b)+p*(o*u-s*l)),e[7]=r*(l*h-u*f)-i*(o*h-s*f)+c*(o*u-s*l),e[8]=i*(d*y-h*m)-c*(a*y-u*m)+p*(a*h-u*d),e[9]=-(r*(d*y-h*m)-c*(n*y-s*m)+p*(n*h-s*d)),e[10]=r*(a*y-u*m)-i*(n*y-s*m)+p*(n*u-s*a),e[11]=-(r*(a*h-u*d)-i*(n*h-s*d)+c*(n*u-s*a)),e[12]=-(i*(d*b-f*m)-c*(a*b-l*m)+p*(a*f-l*d)),e[13]=r*(d*b-f*m)-c*(n*b-o*m)+p*(n*f-o*d),e[14]=-(r*(a*b-l*m)-i*(n*b-o*m)+p*(n*l-o*a)),e[15]=r*(a*f-l*d)-i*(n*f-o*d)+c*(n*l-o*a),e},determinant:function(e){const t=e[0],r=e[1],n=e[2],o=e[3],s=e[4],i=e[5],a=e[6],l=e[7],u=e[8],c=e[9],d=e[10],f=e[11],h=e[12],p=e[13],m=e[14],b=e[15];return(t*i-r*s)*(d*b-f*m)-(t*a-n*s)*(c*b-f*p)+(t*l-o*s)*(c*m-d*p)+(r*a-n*i)*(u*b-f*h)-(r*l-o*i)*(u*m-d*h)+(n*l-o*a)*(u*p-c*h)},multiply:u,translate:c,scale:d,rotate:f,rotateX:function(e,t,r){const n=Math.sin(r),o=Math.cos(r),s=t[4],i=t[5],a=t[6],l=t[7],u=t[8],c=t[9],d=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=s*o+u*n,e[5]=i*o+c*n,e[6]=a*o+d*n,e[7]=l*o+f*n,e[8]=u*o-s*n,e[9]=c*o-i*n,e[10]=d*o-a*n,e[11]=f*o-l*n,e},rotateY:function(e,t,r){const n=Math.sin(r),o=Math.cos(r),s=t[0],i=t[1],a=t[2],l=t[3],u=t[8],c=t[9],d=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*o-u*n,e[1]=i*o-c*n,e[2]=a*o-d*n,e[3]=l*o-f*n,e[8]=s*n+u*o,e[9]=i*n+c*o,e[10]=a*n+d*o,e[11]=l*n+f*o,e},rotateZ:function(e,t,r){const n=Math.sin(r),o=Math.cos(r),s=t[0],i=t[1],a=t[2],l=t[3],u=t[4],c=t[5],d=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*o+u*n,e[1]=i*o+c*n,e[2]=a*o+d*n,e[3]=l*o+f*n,e[4]=u*o-s*n,e[5]=c*o-i*n,e[6]=d*o-a*n,e[7]=f*o-l*n,e},fromTranslation:h,fromScaling:function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},fromRotation:p,fromXRotation:m,fromYRotation:function(e,t){const r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},fromZRotation:function(e,t){const r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},fromRotationTranslation:b,fromQuat2:function(e,t){const r=y,n=-t[0],o=-t[1],s=-t[2],i=t[3],a=t[4],l=t[5],u=t[6],c=t[7],d=n*n+o*o+s*s+i*i;return d>0?(r[0]=2*(a*i+c*n+l*s-u*o)/d,r[1]=2*(l*i+c*o+u*n-a*s)/d,r[2]=2*(u*i+c*s+a*o-l*n)/d):(r[0]=2*(a*i+c*n+l*s-u*o),r[1]=2*(l*i+c*o+u*n-a*s),r[2]=2*(u*i+c*s+a*o-l*n)),b(e,t,r),e},getTranslation:function(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e},getScaling:function(e,t){const r=t[0],n=t[1],o=t[2],s=t[4],i=t[5],a=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.sqrt(r*r+n*n+o*o),e[1]=Math.sqrt(s*s+i*i+a*a),e[2]=Math.sqrt(l*l+u*u+c*c),e},getRotation:function(e,t){const r=t[0]+t[5]+t[10];let n=0;return r>0?(n=2*Math.sqrt(r+1),e[3]=.25*n,e[0]=(t[6]-t[9])/n,e[1]=(t[8]-t[2])/n,e[2]=(t[1]-t[4])/n):t[0]>t[5]&&t[0]>t[10]?(n=2*Math.sqrt(1+t[0]-t[5]-t[10]),e[3]=(t[6]-t[9])/n,e[0]=.25*n,e[1]=(t[1]+t[4])/n,e[2]=(t[8]+t[2])/n):t[5]>t[10]?(n=2*Math.sqrt(1+t[5]-t[0]-t[10]),e[3]=(t[8]-t[2])/n,e[0]=(t[1]+t[4])/n,e[1]=.25*n,e[2]=(t[6]+t[9])/n):(n=2*Math.sqrt(1+t[10]-t[0]-t[5]),e[3]=(t[1]-t[4])/n,e[0]=(t[8]+t[2])/n,e[1]=(t[6]+t[9])/n,e[2]=.25*n),e},fromRotationTranslationScale:g,fromRotationTranslationScaleOrigin:function(e,t,r,n,o){const s=t[0],i=t[1],a=t[2],l=t[3],u=s+s,c=i+i,d=a+a,f=s*u,h=s*c,p=s*d,m=i*c,b=i*d,y=a*d,g=l*u,w=l*c,M=l*d,v=n[0],C=n[1],T=n[2],S=o[0],O=o[1],A=o[2],U=(1-(m+y))*v,I=(h+M)*v,E=(p-w)*v,q=(h-M)*C,k=(1-(f+y))*C,_=(b+g)*C,x=(p+w)*T,R=(b-g)*T,P=(1-(f+m))*T;return e[0]=U,e[1]=I,e[2]=E,e[3]=0,e[4]=q,e[5]=k,e[6]=_,e[7]=0,e[8]=x,e[9]=R,e[10]=P,e[11]=0,e[12]=r[0]+S-(U*S+q*O+x*A),e[13]=r[1]+O-(I*S+k*O+R*A),e[14]=r[2]+A-(E*S+_*O+P*A),e[15]=1,e},fromQuat:function(e,t){const r=t[0],n=t[1],o=t[2],s=t[3],i=r+r,a=n+n,l=o+o,u=r*i,c=n*i,d=n*a,f=o*i,h=o*a,p=o*l,m=s*i,b=s*a,y=s*l;return e[0]=1-d-p,e[1]=c+y,e[2]=f-b,e[3]=0,e[4]=c-y,e[5]=1-u-p,e[6]=h+m,e[7]=0,e[8]=f+b,e[9]=h-m,e[10]=1-u-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},frustum:function(e,t,r,n,o,s,i){const a=1/(r-t),l=1/(o-n),u=1/(s-i);return e[0]=2*s*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*s*l,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(o+n)*l,e[10]=(i+s)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=i*s*2*u,e[15]=0,e},perspective:function(e,t,r,n,o){const s=1/Math.tan(t/2);let i;return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=o&&o!==1/0?(i=1/(n-o),e[10]=(o+n)*i,e[14]=2*o*n*i):(e[10]=-1,e[14]=-2*n),e},perspectiveFromFieldOfView:function(e,t,r,n){const o=Math.tan(t.upDegrees*Math.PI/180),s=Math.tan(t.downDegrees*Math.PI/180),i=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),l=2/(i+a),u=2/(o+s);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(i-a)*l*.5,e[9]=(o-s)*u*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e},ortho:function(e,t,r,n,o,s,i){const a=1/(t-r),l=1/(n-o),u=1/(s-i);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*a,e[13]=(o+n)*l,e[14]=(i+s)*u,e[15]=1,e},lookAt:function(e,t,r,n){let s,a,l,u,c,d,f,h,p,m;const b=t[0],y=t[1],g=t[2],w=n[0],M=n[1],v=n[2],C=r[0],T=r[1],S=r[2],O=(0,o.g)();return Math.abs(b-C)<O&&Math.abs(y-T)<O&&Math.abs(g-S)<O?i(e):(f=b-C,h=y-T,p=g-S,m=1/Math.sqrt(f*f+h*h+p*p),f*=m,h*=m,p*=m,s=M*p-v*h,a=v*f-w*p,l=w*h-M*f,m=Math.sqrt(s*s+a*a+l*l),m?(m=1/m,s*=m,a*=m,l*=m):(s=0,a=0,l=0),u=h*l-p*a,c=p*s-f*l,d=f*a-h*s,m=Math.sqrt(u*u+c*c+d*d),m?(m=1/m,u*=m,c*=m,d*=m):(u=0,c=0,d=0),e[0]=s,e[1]=u,e[2]=f,e[3]=0,e[4]=a,e[5]=c,e[6]=h,e[7]=0,e[8]=l,e[9]=d,e[10]=p,e[11]=0,e[12]=-(s*b+a*y+l*g),e[13]=-(u*b+c*y+d*g),e[14]=-(f*b+h*y+p*g),e[15]=1,e)},targetTo:function(e,t,r,n){const o=t[0],s=t[1],i=t[2],a=n[0],l=n[1],u=n[2];let c=o-r[0],d=s-r[1],f=i-r[2],h=c*c+d*d+f*f;h>0&&(h=1/Math.sqrt(h),c*=h,d*=h,f*=h);let p=l*f-u*d,m=u*c-a*f,b=a*d-l*c;return h=p*p+m*m+b*b,h>0&&(h=1/Math.sqrt(h),p*=h,m*=h,b*=h),e[0]=p,e[1]=m,e[2]=b,e[3]=0,e[4]=d*b-f*m,e[5]=f*p-c*b,e[6]=c*m-d*p,e[7]=0,e[8]=c,e[9]=d,e[10]=f,e[11]=0,e[12]=o,e[13]=s,e[14]=i,e[15]=1,e},str:function(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"},frob:function(e){return Math.sqrt(e[0]**2+e[1]**2+e[2]**2+e[3]**2+e[4]**2+e[5]**2+e[6]**2+e[7]**2+e[8]**2+e[9]**2+e[10]**2+e[11]**2+e[12]**2+e[13]**2+e[14]**2+e[15]**2)},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e},subtract:w,multiplyScalar:function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e},multiplyScalarAndAdd:function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e},exactEquals:M,equals:v,isOrthoNormal:C,mul:T,sub:S},Symbol.toStringTag,{value:"Module"}))},51305:(e,t,r)=>{r.d(t,{c:()=>h,g:()=>c,j:()=>I,k:()=>m,m:()=>d,s:()=>u});var n=r(46521),o=r(94961),s=r(65617),i=r(46851),a=r(17896),l=r(98766);function u(e,t,r){r*=.5;const n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function c(e,t){const r=2*Math.acos(t[3]),n=Math.sin(r/2);return n>(0,i.g)()?(e[0]=t[0]/n,e[1]=t[1]/n,e[2]=t[2]/n):(e[0]=1,e[1]=0,e[2]=0),r}function d(e,t,r){const n=t[0],o=t[1],s=t[2],i=t[3],a=r[0],l=r[1],u=r[2],c=r[3];return e[0]=n*c+i*a+o*u-s*l,e[1]=o*c+i*l+s*a-n*u,e[2]=s*c+i*u+n*l-o*a,e[3]=i*c-n*a-o*l-s*u,e}function f(e,t,r,n){const o=t[0],s=t[1],a=t[2],l=t[3];let u,c,d,f,h,p=r[0],m=r[1],b=r[2],y=r[3];return c=o*p+s*m+a*b+l*y,c<0&&(c=-c,p=-p,m=-m,b=-b,y=-y),1-c>(0,i.g)()?(u=Math.acos(c),d=Math.sin(u),f=Math.sin((1-n)*u)/d,h=Math.sin(n*u)/d):(f=1-n,h=n),e[0]=f*o+h*p,e[1]=f*s+h*m,e[2]=f*a+h*b,e[3]=f*l+h*y,e}function h(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function p(e,t){const r=t[0]+t[4]+t[8];let n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let r=0;t[4]>t[0]&&(r=1),t[8]>t[3*r+r]&&(r=2);const o=(r+1)%3,s=(r+2)%3;n=Math.sqrt(t[3*r+r]-t[3*o+o]-t[3*s+s]+1),e[r]=.5*n,n=.5/n,e[3]=(t[3*o+s]-t[3*s+o])*n,e[o]=(t[3*o+r]+t[3*r+o])*n,e[s]=(t[3*s+r]+t[3*r+s])*n}return e}function m(e,t,r,n){const o=.5*Math.PI/180;t*=o,r*=o,n*=o;const s=Math.sin(t),i=Math.cos(t),a=Math.sin(r),l=Math.cos(r),u=Math.sin(n),c=Math.cos(n);return e[0]=s*l*c-i*a*u,e[1]=i*a*c+s*l*u,e[2]=i*l*u-s*a*c,e[3]=i*l*c+s*a*u,e}const b=l.c,y=l.s,g=l.a,w=d,M=l.b,v=l.d,C=l.l,T=l.e,S=T,O=l.f,A=O,U=l.n,I=l.g,E=l.h,q=(0,s.c)(),k=(0,s.f)(1,0,0),_=(0,s.f)(0,1,0),x=(0,o.a)(),R=(0,o.a)(),P=(0,n.c)();Object.freeze(Object.defineProperty({__proto__:null,identity:function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},setAxisAngle:u,getAxisAngle:c,multiply:d,rotateX:function(e,t,r){r*=.5;const n=t[0],o=t[1],s=t[2],i=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=n*l+i*a,e[1]=o*l+s*a,e[2]=s*l-o*a,e[3]=i*l-n*a,e},rotateY:function(e,t,r){r*=.5;const n=t[0],o=t[1],s=t[2],i=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=n*l-s*a,e[1]=o*l+i*a,e[2]=s*l+n*a,e[3]=i*l-o*a,e},rotateZ:function(e,t,r){r*=.5;const n=t[0],o=t[1],s=t[2],i=t[3],a=Math.sin(r),l=Math.cos(r);return e[0]=n*l+o*a,e[1]=o*l-n*a,e[2]=s*l+i*a,e[3]=i*l-s*a,e},calculateW:function(e,t){const r=t[0],n=t[1],o=t[2];return e[0]=r,e[1]=n,e[2]=o,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-o*o)),e},slerp:f,random:function(e){const t=i.R,r=t(),n=t(),o=t(),s=Math.sqrt(1-r),a=Math.sqrt(r);return e[0]=s*Math.sin(2*Math.PI*n),e[1]=s*Math.cos(2*Math.PI*n),e[2]=a*Math.sin(2*Math.PI*o),e[3]=a*Math.cos(2*Math.PI*o),e},invert:function(e,t){const r=t[0],n=t[1],o=t[2],s=t[3],i=r*r+n*n+o*o+s*s,a=i?1/i:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-o*a,e[3]=s*a,e},conjugate:h,fromMat3:p,fromEuler:m,str:function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},copy:b,set:y,add:g,mul:w,scale:M,dot:v,lerp:C,length:T,len:S,squaredLength:O,sqrLen:A,normalize:U,exactEquals:I,equals:E,rotationTo:function(e,t,r){const n=(0,a.e)(t,r);return n<-.999999?((0,a.f)(q,k,t),(0,a.u)(q)<1e-6&&(0,a.f)(q,_,t),(0,a.n)(q,q),u(e,q,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):((0,a.f)(q,t,r),e[0]=q[0],e[1]=q[1],e[2]=q[2],e[3]=1+n,U(e,e))},sqlerp:function(e,t,r,n,o,s){return f(x,t,o,s),f(R,r,n,s),f(e,x,R,2*s*(1-s)),e},setAxes:function(e,t,r,n){const o=P;return o[0]=r[0],o[3]=r[1],o[6]=r[2],o[1]=n[0],o[4]=n[1],o[7]=n[2],o[2]=-t[0],o[5]=-t[1],o[8]=-t[2],U(e,p(e,o))}},Symbol.toStringTag,{value:"Module"}))},37140:(e,t,r)=>{function n(){const e=new Float32Array(4);return e[3]=1,e}function o(e){const t=new Float32Array(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}r.d(t,{b:()=>o,c:()=>n}),Object.freeze(Object.defineProperty({__proto__:null,create:n,clone:o,fromValues:function(e,t,r,n){const o=new Float32Array(4);return o[0]=e,o[1]=t,o[2]=r,o[3]=n,o},createView:function(e,t){return new Float32Array(e,t,4)}},Symbol.toStringTag,{value:"Module"}))},94961:(e,t,r)=>{function n(){return[0,0,0,1]}function o(e){return[e[0],e[1],e[2],e[3]]}function s(e,t){return new Float64Array(e,t,4)}r.d(t,{I:()=>i,a:()=>n,b:()=>o,c:()=>s});const i=[0,0,0,1];Object.freeze(Object.defineProperty({__proto__:null,create:n,clone:o,fromValues:function(e,t,r,n){return[e,t,r,n]},createView:s,IDENTITY:i},Symbol.toStringTag,{value:"Module"}))},72119:(e,t,r)=>{function n(){return new Float32Array(3)}function o(e){const t=new Float32Array(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function s(e,t,r){const n=new Float32Array(3);return n[0]=e,n[1]=t,n[2]=r,n}function i(){return n()}function a(){return s(1,1,1)}function l(){return s(1,0,0)}function u(){return s(0,1,0)}function c(){return s(0,0,1)}r.d(t,{b:()=>o,c:()=>n,f:()=>s});const d=i(),f=a(),h=l(),p=u(),m=c();Object.freeze(Object.defineProperty({__proto__:null,create:n,clone:o,fromValues:s,createView:function(e,t){return new Float32Array(e,t,3)},zeros:i,ones:a,unitX:l,unitY:u,unitZ:c,ZEROS:d,ONES:f,UNIT_X:h,UNIT_Y:p,UNIT_Z:m},Symbol.toStringTag,{value:"Module"}))},35270:(e,t,r)=>{r.d(t,{B7:()=>l,St:()=>o,VL:()=>i,h$:()=>s,rW:()=>u});const n={transparent:[0,0,0,0],black:[0,0,0,1],silver:[192,192,192,1],gray:[128,128,128,1],white:[255,255,255,1],maroon:[128,0,0,1],red:[255,0,0,1],purple:[128,0,128,1],fuchsia:[255,0,255,1],green:[0,128,0,1],lime:[0,255,0,1],olive:[128,128,0,1],yellow:[255,255,0,1],navy:[0,0,128,1],blue:[0,0,255,1],teal:[0,128,128,1],aqua:[0,255,255,1],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],blanchedalmond:[255,235,205,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],oldlace:[253,245,230,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],rebeccapurple:[102,51,153,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],whitesmoke:[245,245,245,1],yellowgreen:[154,205,50,1]};function o(e){return n[e]||n[e.toLowerCase()]}function s(e){return n[e]??n[e.toLowerCase()]}function i(e){return[...s(e)]}function a(e,t,r){r<0&&++r,r>1&&--r;const n=6*r;return n<1?e+(t-e)*n:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function l(e,t,r,n=1){const o=(e%360+360)%360/360,s=r<=.5?r*(t+1):r+t-r*t,i=2*r-s;return[Math.round(255*a(i,s,o+1/3)),Math.round(255*a(i,s,o)),Math.round(255*a(i,s,o-1/3)),n]}function u(e){const t=e.length>5,r=t?8:4,n=(1<<r)-1,o=t?1:17,s=t?9===e.length:5===e.length;let i=Number("0x"+e.substr(1));if(isNaN(i))return null;const a=[0,0,0,1];let l;return s&&(l=i&n,i>>=r,a[3]=o*l/255),l=i&n,i>>=r,a[2]=o*l,l=i&n,i>>=r,a[1]=o*l,l=i&n,i>>=r,a[0]=o*l,a}},36030:(e,t,r)=>{r.d(t,{J:()=>s});var n=r(35454),o=r(5600);function s(e,t={}){const r=e instanceof n.X?e:new n.X(e,t),s={type:t?.ignoreUnknown??1?r.apiValues:String,json:{type:r.jsonValues,read:!t?.readOnly&&{reader:r.read},write:{writer:r.write}}};return void 0!==t?.readOnly&&(s.readOnly=!!t.readOnly),void 0!==t?.default&&(s.json.default=t.default),void 0!==t?.name&&(s.json.name=t.name),(0,o.Cb)(s)}},10661:(e,t,r)=>{r.d(t,{s:()=>o});var n=r(39020);class o{constructor(){this._observers=[]}observe(e){return this._observers.includes(e)||this._observers.push(e),new n.X(this._observers,e)}notify(){const e=this._observers.slice();for(let t=0;t<e.length;++t){const r=e[t];r.onInvalidated(),r.onCommitted()}}}},67900:(e,t,r)=>{r.d(t,{$C:()=>S,En:()=>C,Jo:()=>N,_R:()=>O,c9:()=>U,cM:()=>A,gV:()=>P,hd:()=>u,qE:()=>q,ty:()=>T}),r(80442);var n=r(35454),o=r(70586),s=r(24678),i=r(68441),a=r(8744),l=r(58116);const u=39.37,c=i.sv.radius*Math.PI/200,d=/UNIT\[([^\]]+)\]\]$/i,f=l.Z,h=/UNIT\[([^\]]+)\]/i,p=new Set([4261,4305,4807,4810,4811,4812,4816,4819,4821,4901,4902,37225,104139,104140]),m=(0,n.w)()({meter:"meters",foot:"feet",foot_us:"us-feet",foot_clarke:"clarke-feet",yard_clarke:"clarke-yards",link_clarke:"clarke-links",yard_sears:"sears-yards",foot_sears:"sears-feet",chain_sears:"sears-chains",chain_benoit_1895_b:"benoit-1895-b-chains",yard_indian:"indian-yards",yard_indian_1937:"indian-1937-yards",foot_gold_coast:"gold-coast-feet",chain_sears_1922_truncated:"sears-1922-truncated-chains","50_kilometers":"50-kilometers","150_kilometers":"150-kilometers"}),b=e=>e*e,y=e=>e*e*e,g={length:{baseUnit:"meters",units:{millimeters:{inBaseUnits:.001},centimeters:{inBaseUnits:.01},decimeters:{inBaseUnits:.1},meters:{inBaseUnits:1},kilometers:{inBaseUnits:1e3},inches:{inBaseUnits:.0254},feet:{inBaseUnits:.3048},yards:{inBaseUnits:.9144},miles:{inBaseUnits:1609.344},"nautical-miles":{inBaseUnits:1852},"us-feet":{inBaseUnits:1200/3937}}},area:{baseUnit:"square-meters",units:{"square-millimeters":{inBaseUnits:b(.001)},"square-centimeters":{inBaseUnits:b(.01)},"square-decimeters":{inBaseUnits:b(.1)},"square-meters":{inBaseUnits:1},"square-kilometers":{inBaseUnits:b(1e3)},"square-inches":{inBaseUnits:b(.0254)},"square-feet":{inBaseUnits:b(.3048)},"square-yards":{inBaseUnits:b(.9144)},"square-miles":{inBaseUnits:b(1609.344)},"square-us-feet":{inBaseUnits:b(1200/3937)},acres:{inBaseUnits:.0015625*b(1609.344)},ares:{inBaseUnits:100},hectares:{inBaseUnits:1e4}}},volume:{baseUnit:"liters",units:{liters:{inBaseUnits:1},"cubic-millimeters":{inBaseUnits:1e3*y(.001)},"cubic-centimeters":{inBaseUnits:1e3*y(.01)},"cubic-decimeters":{inBaseUnits:1e3*y(.1)},"cubic-meters":{inBaseUnits:1e3},"cubic-kilometers":{inBaseUnits:1e3*y(1e3)},"cubic-inches":{inBaseUnits:1e3*y(.0254)},"cubic-feet":{inBaseUnits:1e3*y(.3048)},"cubic-yards":{inBaseUnits:1e3*y(.9144)},"cubic-miles":{inBaseUnits:1e3*y(1609.344)}}},angle:{baseUnit:"radians",units:{radians:{inBaseUnits:1},degrees:{inBaseUnits:Math.PI/180}}}},w=(()=>{const e={};for(const t in g)for(const r in g[t].units)e[r]=t;return e})();function M(e){const t=w[e];if(!t)throw new Error("unknown type");return t}function v(e,t=null){return t=t||M(e),g[t].baseUnit===e}function C(e,t,r){if(t===r)return e;const n=M(t);if(n!==M(r))throw new Error("incompatible units");const o=v(t,n)?e:function(e,t,r){return e*g[r].units[t].inBaseUnits}(e,t,n);return v(r,n)?o:function(e,t,r){return e/g[r].units[t].inBaseUnits}(o,r,n)}function T(e,t,r){return C(e,t,"meters")/(r*Math.PI/180)}function S(e){return m.fromJSON(e.toLowerCase())||null}function O(e){if((0,o.pC)(e)&&!(0,a.N$)(e))return 1;const t=U(e);return t>1e5?1:t}function A(e){return U(e)>=(0,s.Iu)(e).metersPerDegree?"meters":q(e)}function U(e,t=i.sv.metersPerDegree){return(0,o.Pt)(function(e,t=!1){const r=(0,o.pC)(e)?e.wkid:null,n=(0,o.pC)(e)?e.wkt:null;let s=null;if(r){if((0,a.o$)(r))return i.yr.metersPerDegree;if((0,a.ME)(r))return i.Z1.metersPerDegree;s=f.values[f[r]],!s&&t&&p.has(r)&&(s=c)}else n&&(_(n)?s=I(d.exec(n),s):k(n)&&(s=I(h.exec(n),s)));return s}(e,!0),t)}function I(e,t){return e&&e[1]?E(e[1]):t}function E(e){return parseFloat(e.split(",")[1])}function q(e){const t=(0,o.pC)(e)?e.wkid:null,r=(0,o.pC)(e)?e.wkt:null;let n=null;if(t)n=f.units[f[t]];else if(r){const e=_(r)?d:k(r)?h:null;if(e){const t=e.exec(r);t&&t[1]&&(n=function(e){const t=/[\\"\\']{1}([^\\"\\']+)/.exec(e);let r=t&&t[1];if(!r||!f.units.includes(r)){const t=E(e);r=null;const n=f.values;for(let e=0;e<n.length;++e)if(Math.abs(t-n[e])<1e-7){r=f.units[e];break}}return r}(t[1]))}}return(0,o.pC)(n)?S(n):null}function k(e){return/^GEOCCS/i.test(e)}function _(e){return/^PROJCS/i.test(e)}new Map([["meters","square-meters"],["feet","square-feet"],["us-feet","square-us-feet"]]);const x={esriAcres:"acres",esriAres:"ares",esriHectares:"hectares",esriSquareCentimeters:"square-centimeters",esriSquareDecimeters:"square-decimeters",esriSquareFeet:"square-feet",esriSquareInches:"square-inches",esriSquareKilometers:"square-kilometers",esriSquareMeters:"square-meters",esriSquareMiles:"square-miles",esriSquareMillimeters:"square-millimeters",esriSquareUsFeet:"square-us-feet",esriSquareYards:"square-yards"},R={esriCentimeters:"centimeters",esriDecimeters:"decimeters",esriFeet:"feet",esriInches:"inches",esriKilometers:"kilometers",esriMeters:"meters",esriMiles:"miles",esriMillimeters:"millimeters",esriNauticalMiles:"nautical-miles",esriYards:"yards"},P=(0,n.w)()(x),N=(0,n.w)()(R);(0,n.w)()({...x,...R})},24678:(e,t,r)=>{r.d(t,{GG:()=>l,HQ:()=>u,Iu:()=>h,VY:()=>c,e8:()=>p,rS:()=>f,wY:()=>d});var n=r(70586),o=r(82971),s=r(68441),i=r(8744);function a(e){return new o.Z({wkt:`GEOCCS["Spherical geocentric",\n DATUM["Not specified",\n SPHEROID["Sphere",${e.radius},0]],\n PRIMEM["Greenwich",0.0,\n AUTHORITY["EPSG","8901"]],\n UNIT["m",1.0],\n AXIS["Geocentric X",OTHER],\n AXIS["Geocentric Y",EAST],\n AXIS["Geocentric Z",NORTH]\n ]`})}const l=a(s.sv),u=a(s.yr),c=a(s.Z1),d=new o.Z({wkt:`GEOCCS["WGS 84",\n DATUM["WGS_1984",\n SPHEROID["WGS 84",${s.sv.radius},298.257223563,\n AUTHORITY["EPSG","7030"]],\n AUTHORITY["EPSG","6326"]],\n PRIMEM["Greenwich",0,\n AUTHORITY["EPSG","8901"]],\n UNIT["m",1.0,\n AUTHORITY["EPSG","9001"]],\n AXIS["Geocentric X",OTHER],\n AXIS["Geocentric Y",OTHER],\n AXIS["Geocentric Z",NORTH],\n AUTHORITY["EPSG","4978"]\n]`});function f(e){return e&&((0,i.BZ)(e)||e===u)?u:e&&((0,i.V2)(e)||e===c)?c:l}function h(e){return(0,n.pC)(e)&&((0,i.BZ)(e)||e===u)?s.yr:(0,n.pC)(e)&&((0,i.V2)(e)||e===c)?s.Z1:s.sv}function p(e){return(0,i.o$)(e)?s.yr:(0,i.ME)(e)?s.Z1:s.sv}},24470:(e,t,r)=>{r.d(t,{Gv:()=>g,HH:()=>u,SO:()=>d,Ue:()=>s,al:()=>a,cS:()=>m,fS:()=>y,jE:()=>f,jn:()=>c,kK:()=>h,oJ:()=>l,r3:()=>p}),r(80442),r(22021);var n=r(70586),o=r(6570);function s(e=w){return[e[0],e[1],e[2],e[3]]}function i(e,t){return e!==t&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3]),e}function a(e,t,r,n,o=s()){return o[0]=e,o[1]=t,o[2]=r,o[3]=n,o}function l(e,t=s()){return t[0]=e.xmin,t[1]=e.ymin,t[2]=e.xmax,t[3]=e.ymax,t}function u(e,t){return new o.Z({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:t})}function c(e,t,r){if((0,n.Wi)(t))i(r,e);else if("length"in t)b(t)?(r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r[3]=Math.max(e[3],t[3])):2!==t.length&&3!==t.length||(r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.max(e[2],t[0]),r[3]=Math.max(e[3],t[1]));else switch(t.type){case"extent":r[0]=Math.min(e[0],t.xmin),r[1]=Math.min(e[1],t.ymin),r[2]=Math.max(e[2],t.xmax),r[3]=Math.max(e[3],t.ymax);break;case"point":r[0]=Math.min(e[0],t.x),r[1]=Math.min(e[1],t.y),r[2]=Math.max(e[2],t.x),r[3]=Math.max(e[3],t.y)}}function d(e){return function(e){return(0,n.Wi)(e)||e[0]>=e[2]?0:e[2]-e[0]}(e)*function(e){return e[1]>=e[3]?0:e[3]-e[1]}(e)}function f(e,t,r){return t>=e[0]&&r>=e[1]&&t<=e[2]&&r<=e[3]}function h(e,t){return Math.max(t[0],e[0])<=Math.min(t[2],e[2])&&Math.max(t[1],e[1])<=Math.min(t[3],e[3])}function p(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}function m(e){return e?i(e,g):s(g)}function b(e){return null!=e&&4===e.length}function y(e,t){return b(e)&&b(t)?e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]:e===t}const g=[1/0,1/0,-1/0,-1/0],w=[0,0,0,0]},69285:(e,t,r)=>{r.d(t,{k:()=>i});var n=r(70586),o=r(67900),s=r(8744);function i(e,t,r){if((0,n.Wi)(t)||(0,n.Wi)(r)||r.vcsWkid||(0,s.fS)(t,r))return null;const i=(0,o._R)(t)/(0,o._R)(r);if(1===i)return null;switch(e){case"point":case"esriGeometryPoint":return e=>function(e,t){e&&null!=e.z&&(e.z*=t)}(e,i);case"polyline":case"esriGeometryPolyline":return e=>function(e,t){if(e)for(const r of e.paths)for(const e of r)e.length>2&&(e[2]*=t)}(e,i);case"polygon":case"esriGeometryPolygon":return e=>function(e,t){if(e)for(const r of e.rings)for(const e of r)e.length>2&&(e[2]*=t)}(e,i);case"multipoint":case"esriGeometryMultipoint":return e=>function(e,t){if(e)for(const r of e.points)r.length>2&&(r[2]*=t)}(e,i);case"extent":case"esriGeometryExtent":return e=>function(e,t){e&&null!=e.zmin&&null!=e.zmax&&(e.zmin*=t,e.zmax*=t)}(e,i);default:return null}}},23030:(e,t,r)=>{r.d(t,{Z:()=>g});var n,o=r(43697),s=r(22974),i=r(5600),a=r(75215),l=r(36030),u=r(52011),c=r(25848),d=r(66338),f=r(22303),h=r(96674);let p=n=class extends h.wq{constructor(){super(...arguments),this.description=null,this.label=null,this.minValue=0,this.maxValue=0,this.color=null}clone(){return new n({description:this.description,label:this.label,minValue:this.minValue,maxValue:this.maxValue,color:(0,s.d9)(this.color)})}};(0,o._)([(0,i.Cb)({type:String,json:{write:!0}})],p.prototype,"description",void 0),(0,o._)([(0,i.Cb)({type:String,json:{write:!0}})],p.prototype,"label",void 0),(0,o._)([(0,i.Cb)({type:Number,json:{read:{source:"classMinValue"},write:{target:"classMinValue"}}})],p.prototype,"minValue",void 0),(0,o._)([(0,i.Cb)({type:Number,json:{read:{source:"classMaxValue"},write:{target:"classMaxValue"}}})],p.prototype,"maxValue",void 0),(0,o._)([(0,i.Cb)({type:f.Z,json:{type:[a.z8],write:!0}})],p.prototype,"color",void 0),p=n=(0,o._)([(0,u.j)("esri.renderers.support.pointCloud.ColorClassBreakInfo")],p);const m=p;var b;let y=b=class extends c.Z{constructor(e){super(e),this.type="point-cloud-class-breaks",this.field=null,this.legendOptions=null,this.fieldTransformType=null,this.colorClassBreakInfos=null}clone(){return new b({...this.cloneProperties(),field:this.field,fieldTransformType:this.fieldTransformType,colorClassBreakInfos:(0,s.d9)(this.colorClassBreakInfos),legendOptions:(0,s.d9)(this.legendOptions)})}};(0,o._)([(0,l.J)({pointCloudClassBreaksRenderer:"point-cloud-class-breaks"})],y.prototype,"type",void 0),(0,o._)([(0,i.Cb)({json:{write:!0},type:String})],y.prototype,"field",void 0),(0,o._)([(0,i.Cb)({type:d.I,json:{write:!0}})],y.prototype,"legendOptions",void 0),(0,o._)([(0,i.Cb)({type:c.Z.fieldTransformTypeKebabDict.apiValues,json:{type:c.Z.fieldTransformTypeKebabDict.jsonValues,read:c.Z.fieldTransformTypeKebabDict.read,write:c.Z.fieldTransformTypeKebabDict.write}})],y.prototype,"fieldTransformType",void 0),(0,o._)([(0,i.Cb)({type:[m],json:{write:!0}})],y.prototype,"colorClassBreakInfos",void 0),y=b=(0,o._)([(0,u.j)("esri.renderers.PointCloudClassBreaksRenderer")],y);const g=y},25848:(e,t,r)=>{r.d(t,{Z:()=>S});var n,o=r(43697),s=r(35454),i=r(96674),a=r(22974),l=r(5600),u=(r(75215),r(52011));r(67676);let c=n=class extends i.wq{constructor(){super(...arguments),this.field=null,this.minValue=0,this.maxValue=255}clone(){return new n({field:this.field,minValue:this.minValue,maxValue:this.maxValue})}};(0,o._)([(0,l.Cb)({type:String,json:{write:!0}})],c.prototype,"field",void 0),(0,o._)([(0,l.Cb)({type:Number,nonNullable:!0,json:{write:!0}})],c.prototype,"minValue",void 0),(0,o._)([(0,l.Cb)({type:Number,nonNullable:!0,json:{write:!0}})],c.prototype,"maxValue",void 0),c=n=(0,o._)([(0,u.j)("esri.renderers.support.pointCloud.ColorModulation")],c);const d=c,f=new s.X({pointCloudFixedSizeAlgorithm:"fixed-size",pointCloudSplatAlgorithm:"splat"});let h=class extends i.wq{};(0,o._)([(0,l.Cb)({type:f.apiValues,readOnly:!0,nonNullable:!0,json:{type:f.jsonValues,read:!1,write:f.write}})],h.prototype,"type",void 0),h=(0,o._)([(0,u.j)("esri.renderers.support.pointCloud.PointSizeAlgorithm")],h);const p=h;var m,b=r(36030);let y=m=class extends p{constructor(){super(...arguments),this.type="fixed-size",this.size=0,this.useRealWorldSymbolSizes=null}clone(){return new m({size:this.size,useRealWorldSymbolSizes:this.useRealWorldSymbolSizes})}};(0,o._)([(0,b.J)({pointCloudFixedSizeAlgorithm:"fixed-size"})],y.prototype,"type",void 0),(0,o._)([(0,l.Cb)({type:Number,nonNullable:!0,json:{write:!0}})],y.prototype,"size",void 0),(0,o._)([(0,l.Cb)({type:Boolean,json:{write:!0}})],y.prototype,"useRealWorldSymbolSizes",void 0),y=m=(0,o._)([(0,u.j)("esri.renderers.support.pointCloud.PointSizeFixedSizeAlgorithm")],y);const g=y;var w;let M=w=class extends p{constructor(){super(...arguments),this.type="splat",this.scaleFactor=1}clone(){return new w({scaleFactor:this.scaleFactor})}};(0,o._)([(0,b.J)({pointCloudSplatAlgorithm:"splat"})],M.prototype,"type",void 0),(0,o._)([(0,l.Cb)({type:Number,value:1,nonNullable:!0,json:{write:!0}})],M.prototype,"scaleFactor",void 0),M=w=(0,o._)([(0,u.j)("esri.renderers.support.pointCloud.PointSizeSplatAlgorithm")],M);const v={key:"type",base:p,typeMap:{"fixed-size":g,splat:M}},C=(0,s.w)()({pointCloudClassBreaksRenderer:"point-cloud-class-breaks",pointCloudRGBRenderer:"point-cloud-rgb",pointCloudStretchRenderer:"point-cloud-stretch",pointCloudUniqueValueRenderer:"point-cloud-unique-value"});let T=class extends i.wq{constructor(e){super(e),this.type=void 0,this.pointSizeAlgorithm=null,this.colorModulation=null,this.pointsPerInch=10}clone(){return console.warn(".clone() is not implemented for "+this.declaredClass),null}cloneProperties(){return{pointSizeAlgorithm:(0,a.d9)(this.pointSizeAlgorithm),colorModulation:(0,a.d9)(this.colorModulation),pointsPerInch:(0,a.d9)(this.pointsPerInch)}}};(0,o._)([(0,l.Cb)({type:C.apiValues,readOnly:!0,nonNullable:!0,json:{type:C.jsonValues,read:!1,write:C.write}})],T.prototype,"type",void 0),(0,o._)([(0,l.Cb)({types:v,json:{write:!0}})],T.prototype,"pointSizeAlgorithm",void 0),(0,o._)([(0,l.Cb)({type:d,json:{write:!0}})],T.prototype,"colorModulation",void 0),(0,o._)([(0,l.Cb)({json:{write:!0},nonNullable:!0,type:Number})],T.prototype,"pointsPerInch",void 0),T=(0,o._)([(0,u.j)("esri.renderers.PointCloudRenderer")],T),(T||(T={})).fieldTransformTypeKebabDict=new s.X({none:"none",lowFourBit:"low-four-bit",highFourBit:"high-four-bit",absoluteValue:"absolute-value",moduloTen:"modulo-ten"});const S=T},14008:(e,t,r)=>{r.d(t,{Z:()=>h});var n,o=r(43697),s=r(22974),i=r(5600),a=(r(75215),r(36030)),l=r(52011),u=r(25848),c=r(66338),d=r(21849);let f=n=class extends u.Z{constructor(e){super(e),this.type="point-cloud-stretch",this.field=null,this.legendOptions=null,this.fieldTransformType=null,this.stops=null}clone(){return new n({...this.cloneProperties(),field:(0,s.d9)(this.field),fieldTransformType:(0,s.d9)(this.fieldTransformType),stops:(0,s.d9)(this.stops),legendOptions:(0,s.d9)(this.legendOptions)})}};(0,o._)([(0,a.J)({pointCloudStretchRenderer:"point-cloud-stretch"})],f.prototype,"type",void 0),(0,o._)([(0,i.Cb)({json:{write:!0},type:String})],f.prototype,"field",void 0),(0,o._)([(0,i.Cb)({type:c.I,json:{write:!0}})],f.prototype,"legendOptions",void 0),(0,o._)([(0,i.Cb)({type:u.Z.fieldTransformTypeKebabDict.apiValues,json:{type:u.Z.fieldTransformTypeKebabDict.jsonValues,read:u.Z.fieldTransformTypeKebabDict.read,write:u.Z.fieldTransformTypeKebabDict.write}})],f.prototype,"fieldTransformType",void 0),(0,o._)([(0,i.Cb)({type:[d.Z],json:{write:!0}})],f.prototype,"stops",void 0),f=n=(0,o._)([(0,l.j)("esri.renderers.PointCloudStretchRenderer")],f);const h=f},46329:(e,t,r)=>{r.d(t,{Z:()=>g});var n,o=r(43697),s=r(22974),i=r(5600),a=r(75215),l=r(36030),u=r(52011),c=r(25848),d=r(66338),f=r(22303),h=r(96674);let p=n=class extends h.wq{constructor(){super(...arguments),this.description=null,this.label=null,this.values=null,this.color=null}clone(){return new n({description:this.description,label:this.label,values:(0,s.d9)(this.values),color:(0,s.d9)(this.color)})}};(0,o._)([(0,i.Cb)({type:String,json:{write:!0}})],p.prototype,"description",void 0),(0,o._)([(0,i.Cb)({type:String,json:{write:!0}})],p.prototype,"label",void 0),(0,o._)([(0,i.Cb)({type:[String],json:{write:!0}})],p.prototype,"values",void 0),(0,o._)([(0,i.Cb)({type:f.Z,json:{type:[a.z8],write:!0}})],p.prototype,"color",void 0),p=n=(0,o._)([(0,u.j)("esri.renderers.support.pointCloud.ColorUniqueValueInfo")],p);const m=p;var b;let y=b=class extends c.Z{constructor(e){super(e),this.type="point-cloud-unique-value",this.field=null,this.fieldTransformType=null,this.colorUniqueValueInfos=null,this.legendOptions=null}clone(){return new b({...this.cloneProperties(),field:(0,s.d9)(this.field),fieldTransformType:(0,s.d9)(this.fieldTransformType),colorUniqueValueInfos:(0,s.d9)(this.colorUniqueValueInfos),legendOptions:(0,s.d9)(this.legendOptions)})}};(0,o._)([(0,l.J)({pointCloudUniqueValueRenderer:"point-cloud-unique-value"})],y.prototype,"type",void 0),(0,o._)([(0,i.Cb)({json:{write:!0},type:String})],y.prototype,"field",void 0),(0,o._)([(0,i.Cb)({type:c.Z.fieldTransformTypeKebabDict.apiValues,json:{type:c.Z.fieldTransformTypeKebabDict.jsonValues,read:c.Z.fieldTransformTypeKebabDict.read,write:c.Z.fieldTransformTypeKebabDict.write}})],y.prototype,"fieldTransformType",void 0),(0,o._)([(0,i.Cb)({type:[m],json:{write:!0}})],y.prototype,"colorUniqueValueInfos",void 0),(0,o._)([(0,i.Cb)({type:d.I,json:{write:!0}})],y.prototype,"legendOptions",void 0),y=b=(0,o._)([(0,u.j)("esri.renderers.PointCloudUniqueValueRenderer")],y);const g=y},66338:(e,t,r)=>{r.d(t,{I:()=>l});var n,o=r(43697),s=r(96674),i=r(5600),a=(r(67676),r(75215),r(52011));let l=n=class extends s.wq{constructor(){super(...arguments),this.title=null}clone(){return new n({title:this.title})}};(0,o._)([(0,i.Cb)({type:String,json:{write:!0}})],l.prototype,"title",void 0),l=n=(0,o._)([(0,a.j)("esri.renderers.support.LegendOptions")],l)},21849:(e,t,r)=>{r.d(t,{Z:()=>f});var n,o=r(43697),s=r(22303),i=r(96674),a=r(5600),l=(r(67676),r(75215)),u=r(52011),c=r(30556);let d=n=class extends i.wq{constructor(e){super(e),this.color=null,this.label=null,this.value=null}writeValue(e,t,r){t[r]=e??0}clone(){return new n({color:this.color&&this.color.clone(),label:this.label,value:this.value})}};(0,o._)([(0,a.Cb)({type:s.Z,json:{type:[l.z8],write:!0}})],d.prototype,"color",void 0),(0,o._)([(0,a.Cb)({type:String,json:{write:!0}})],d.prototype,"label",void 0),(0,o._)([(0,a.Cb)({type:Number,json:{write:{writerEnsuresNonNull:!0}}})],d.prototype,"value",void 0),(0,o._)([(0,c.c)("value")],d.prototype,"writeValue",null),d=n=(0,o._)([(0,u.j)("esri.renderers.visualVariables.support.ColorStop")],d);const f=d},3172:(e,t,r)=>{r.r(t),r.d(t,{default:()=>h});var n=r(68773),o=r(40330),s=r(20102),i=r(80442),a=r(22974),l=r(70586),u=r(95330),c=r(17452),d=r(71058),f=r(85958);async function h(e,t){const a=(0,c.HK)(e),y=(0,c.jc)(e);y||a||(e=(0,c.Fv)(e));const g={url:e,requestOptions:{...(0,l.Wg)(t)}};let w=(0,c.oh)(e);if(w){const e=await async function(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let r,n;try{n=await e.before(t)}catch(e){r=T("request:interceptor",e,t)}if((n instanceof Error||n instanceof s.Z)&&(r=T("request:interceptor",n,t)),r)throw e.error&&e.error(r),r;return n}}(w,g);if(null!=e)return{data:e,getHeader:M,requestOptions:g.requestOptions,url:g.url};w.after||w.error||(w=null)}if(e=g.url,"image"===(t=g.requestOptions).responseType){if((0,i.Z)("host-webworker")||(0,i.Z)("host-node"))throw T("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),g)}else if(a)throw T("request:invalid-parameters",new Error("Data URLs are not supported for responseType = "+t.responseType),g);if("head"===t.method){if(t.body)throw T("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),g);if(a||y)throw T("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),g)}if(await async function(){(0,i.Z)("host-webworker")?p||(p=await r.e(9884).then(r.bind(r,29884))):h._abortableFetch||(h._abortableFetch=globalThis.fetch.bind(globalThis))}(),p)return p.execute(e,t);const v=new AbortController;(0,u.fu)(t,(()=>v.abort()));const C={controller:v,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:w,params:g,redoRequest:!1,useIdentity:m.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},U=await async function(e){let t,r;await async function(e){const t=e.params.url,r=e.params.requestOptions,s=e.controller.signal,i=r.body;let a=null,l=null;if(b&&"HTMLFormElement"in globalThis&&(i instanceof FormData?a=i:i instanceof HTMLFormElement&&(a=new FormData(i))),"string"==typeof i&&(l=i),e.fetchOptions={cache:r.cacheBust&&!h._abortableFetch.polyfill?"no-cache":"default",credentials:"same-origin",headers:r.headers||{},method:"head"===r.method?"HEAD":"GET",mode:"cors",priority:m.priority,redirect:"follow",signal:s},(a||l)&&(e.fetchOptions.body=a||l),"anonymous"===r.authMode&&(e.useIdentity=!1),e.hasToken=!!(/token=/i.test(t)||r.query?.token||a?.get("token")),!e.hasToken&&n.Z.apiKey&&(0,d.r)(t)&&(r.query||(r.query={}),r.query.token=n.Z.apiKey,e.hasToken=!0),e.useIdentity&&!e.hasToken&&!e.credentialToken&&!O(t)&&!(0,u.Hc)(s)){let n;"immediate"===r.authMode?(await S(),n=await o.id.getCredential(t,{signal:s}),e.credential=n):"no-prompt"===r.authMode?(await S(),n=await o.id.getCredential(t,{prompt:!1,signal:s}).catch((()=>{})),e.credential=n):o.id&&(n=o.id.findCredential(t)),n&&(e.credentialToken=n.token,e.useSSL=!!n.ssl)}}(e);try{do{[t,r]=await A(e)}while(!await I(e,t,r))}catch(r){const n=T("request:server",r,e.params,t);throw n.details.ssl=e.useSSL,e.interceptor&&e.interceptor.error&&e.interceptor.error(n),n}const s=e.params.url;if(r&&/\/sharing\/rest\/(accounts|portals)\/self/i.test(s)){if(!e.hasToken&&!e.credentialToken&&r.user?.username&&!(0,c.kl)(s)){const e=(0,c.P$)(s,!0);e&&m.trustedServers.push(e)}Array.isArray(r.authorizedCrossOriginNoCorsDomains)&&(0,f.Hu)(r.authorizedCrossOriginNoCorsDomains)}const i=e.credential;if(i&&o.id){const e=o.id.findServerInfo(i.server);let t=e&&e.owningSystemUrl;if(t){t=t.replace(/\/?$/,"/sharing");const e=o.id.findCredential(t,i.userId);e&&-1===o.id._getIdenticalSvcIdx(t,e)&&e.resources.unshift(t)}}return{data:r,getHeader:t?e=>t?.headers.get(e):M,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}(C);return w?.after?.(U),U}let p;const m=n.Z.request,b="FormData"in globalThis,y=[499,498,403,401],g=["COM_0056","COM_0057","SB_0008"],w=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],M=()=>null,v=Symbol();function C(e){const t=(0,c.P$)(e);return!t||t.endsWith(".arcgis.com")||h._corsServers.includes(t)||(0,c.kl)(t)}function T(e,t,r,n){let o="Error";const i={url:r.url,requestOptions:r.requestOptions,getHeader:M,ssl:!1};if(t instanceof s.Z)return t.details?(t.details=(0,a.d9)(t.details),t.details.url=r.url,t.details.requestOptions=r.requestOptions):t.details=i,t;if(t){const e=n&&(e=>n.headers.get(e)),r=n&&n.status,s=t.message;s&&(o=s),e&&(i.getHeader=e),i.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||r||0,i.subCode=t.subcode,i.messageCode=t.messageCode,"string"==typeof t.details?i.messages=[t.details]:i.messages=t.details,i.raw=v in t?t[v]:t}return(0,u.D_)(t)?(0,u.zE)():new s.Z(e,o,i)}async function S(){o.id||await Promise.all([r.e(6261),r.e(1400),r.e(1761)]).then(r.bind(r,55142))}function O(e){return w.some((t=>t.test(e)))}async function A(e){let t=e.params.url;const r=e.params.requestOptions,n=e.fetchOptions??{},s=(0,c.jc)(t)||(0,c.HK)(t),a=r.responseType||"json",l=s?0:null!=r.timeout?r.timeout:m.timeout;let d=!1;if(!s){e.useSSL&&(t=(0,c.hO)(t)),r.cacheBust&&"default"===n.cache&&(t=(0,c.ZN)(t,"request.preventCache",Date.now()));let s={...r.query};e.credentialToken&&(s.token=e.credentialToken);let a=(0,c.B7)(s);(0,i.Z)("esri-url-encodes-apostrophe")&&(a=a.replace(/'/g,"%27"));const l=t.length+1+a.length;let u;d="delete"===r.method||"post"===r.method||"put"===r.method||!!r.body||l>m.maxUrlLength;const h=r.useProxy||!!(0,c.ed)(t);if(h){const e=(0,c.b7)(t);u=e.path,!d&&u.length+1+l>m.maxUrlLength&&(d=!0),e.query&&(s={...e.query,...s})}if("HEAD"===n.method&&(d||h)){if(d){if(l>m.maxUrlLength)throw T("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw T("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(h)throw T("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(d?(n.method="delete"===r.method?"DELETE":"put"===r.method?"PUT":"POST",r.body?t=(0,c.fl)(t,s):(n.body=(0,c.B7)(s),n.headers||(n.headers={}),n.headers["Content-Type"]="application/x-www-form-urlencoded")):t=(0,c.fl)(t,s),h&&(e.useProxy=!0,t=`${u}?${t}`),s.token&&b&&n.body instanceof FormData&&!/\/(sharing|usrsvcs)\/(appservices|servers)\//i.test(t)&&n.body.set("token",s.token),r.hasOwnProperty("withCredentials"))e.withCredentials=r.withCredentials;else if(!(0,c.D6)(t,(0,c.TI)()))if((0,c.kl)(t))e.withCredentials=!0;else if(o.id){const r=o.id.findServerInfo(t);r&&r.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(n.credentials="include",(0,f.jH)(t)&&await(0,f.jz)(d?(0,c.fl)(t,s):t))}let p,y,g=0,w=!1;l>0&&(g=setTimeout((()=>{w=!0,e.controller.abort()}),l));try{if("native-request-init"===r.responseType)y=n,y.url=t;else if("image"!==r.responseType||"default"!==n.cache||"GET"!==n.method||d||function(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}(r.headers)||!s&&!e.useProxy&&m.proxyUrl&&!C(t)){if(p=await h._abortableFetch(t,n),e.useProxy||function(e){const t=(0,c.P$)(e);t&&!h._corsServers.includes(t)&&h._corsServers.push(t)}(t),"native"===r.responseType)y=p;else if("HEAD"!==n.method)if(p.ok){switch(a){case"array-buffer":y=await p.arrayBuffer();break;case"blob":case"image":y=await p.blob();break;default:y=await p.text()}if(g&&(clearTimeout(g),g=0),"json"===a||"xml"===a||"document"===a)if(y)switch(a){case"json":y=JSON.parse(y);break;case"xml":y=U(y,"application/xml");break;case"document":y=U(y,"text/html")}else y=null;if(y){if("array-buffer"===a||"blob"===a){const e=p.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&y["blob"===a?"size":"byteLength"]<=750)try{const e=await new Response(y).json();e.error&&(y=e)}catch{}}"image"===a&&y instanceof Blob&&(y=await E(URL.createObjectURL(y),e,!0))}}else y=await p.text()}else y=await E(t,e)}catch(n){if("AbortError"===n.name){if(w)throw new Error("Timeout exceeded");throw(0,u.zE)("Request canceled")}if(!(!p&&n instanceof TypeError&&m.proxyUrl)||r.body||"delete"===r.method||"head"===r.method||"post"===r.method||"put"===r.method||e.useProxy||C(t))throw n;e.redoRequest=!0,(0,c.tD)({proxyUrl:m.proxyUrl,urlPrefix:(0,c.P$)(t)??""})}finally{g&&clearTimeout(g)}return[p,y]}function U(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function I(e,t,r){if(e.redoRequest)return e.redoRequest=!1,!1;const n=e.params.requestOptions;if(!t||"native"===n.responseType||"native-request-init"===n.responseType)return!0;let s,i;if(!t.ok)throw s=new Error(`Unable to load ${t.url} status: ${t.status}`),s[v]=r,s;r&&(r.error?s=r.error:"error"===r.status&&Array.isArray(r.messages)&&(s={...r},s[v]=r,s.details=r.messages));let a,l=null;s&&(i=Number(s.code),l=s.hasOwnProperty("subcode")?Number(s.subcode):null,a=s.messageCode,a=a&&a.toUpperCase());const u=n.authMode;if(403===i&&(4===l||s.message&&s.message.toLowerCase().includes("ssl")&&!s.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===i)&&void 0!==i&&y.includes(i)&&!O(e.params.url)&&(403!==i||a&&!g.includes(a)&&(null==l||2===l&&e.credentialToken))){await S();try{const t=await o.id.getCredential(e.params.url,{error:T("request:server",s,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=t,e.credentialToken=t.token,e.useSSL=e.useSSL||t.ssl,!1}catch(t){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;s=t}}if(s)throw s;return!0}function E(e,t,r=!1){const n=t.controller.signal,o=new Image;return t.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.fetchPriority=m.priority,o.src=e,(0,f.fY)(o,e,r,n)}h._abortableFetch=null,h._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"]},71058:(e,t,r)=>{r.d(t,{r:()=>s});var n=r(17452);const o=["elevation3d.arcgis.com","js.arcgis.com","jsdev.arcgis.com","jsqa.arcgis.com","static.arcgis.com"];function s(e){const t=(0,n.P$)(e,!0);return!!t&&t.endsWith(".arcgis.com")&&!o.includes(t)&&!e.endsWith("/sharing/rest/generateToken")}},85958:(e,t,r)=>{r.d(t,{Hu:()=>c,fY:()=>l,jH:()=>d,jz:()=>f});var n=r(68773),o=r(80442),s=r(70586),i=r(95330),a=r(17452);function l(e,t,r=!1,n){return new Promise(((a,l)=>{if((0,i.Hc)(n))return void l(u());let c=()=>{h(),l(new Error(`Unable to load ${t}`))},d=()=>{const t=e;h(),a(t)},f=()=>{if(!e)return;const t=e;h(),t.src="",l(u())};const h=()=>{(0,o.Z)("esri-image-decode")||(e.removeEventListener("error",c),e.removeEventListener("load",d)),c=null,d=null,e=null,(0,s.pC)(n)&&n.removeEventListener("abort",f),f=null,r&&URL.revokeObjectURL(t)};(0,s.pC)(n)&&n.addEventListener("abort",f),(0,o.Z)("esri-image-decode")?e.decode().then(d,c):(e.addEventListener("error",c),e.addEventListener("load",d))}))}function u(){try{return new DOMException("Aborted","AbortError")}catch{const e=new Error;return e.name="AbortError",e}}function c(e){n.Z.request.crossOriginNoCorsDomains||(n.Z.request.crossOriginNoCorsDomains={});const t=n.Z.request.crossOriginNoCorsDomains;for(let r of e)r=r.toLowerCase(),/^https?:\/\//.test(r)?t[(0,a.P$)(r)??""]=0:(t[(0,a.P$)("http://"+r)??""]=0,t[(0,a.P$)("https://"+r)??""]=0)}function d(e){const t=n.Z.request.crossOriginNoCorsDomains;if(t){let r=(0,a.P$)(e);if(r)return r=r.toLowerCase(),!(0,a.D6)(r,(0,a.TI)())&&t[r]<Date.now()-36e5}return!1}async function f(e){const t=n.Z.request.crossOriginNoCorsDomains,r=(0,a.P$)(e);t&&r&&(t[r.toLowerCase()]=Date.now());const o=(0,a.mN)(e);e=o.path,"json"===o.query?.f&&(e+="?f=json");try{await fetch(e,{mode:"no-cors",credentials:"include"})}catch{}}},90447:(e,t,r)=>{r.r(t),r.d(t,{default:()=>C});var n=r(70586),o=r(1533),s=r(51305),i=r(37140),a=r(17896),l=r(72119),u=r(44547),c=r(82971),d=r(23030),f=r(14008),h=r(46329),p=r(91891),m=r(25683);function b(e,t,r,n){const{rendererJSON:o,isRGBRenderer:s}=e;let i=null,a=null;if(t&&s)i=t;else if(t&&"pointCloudUniqueValueRenderer"===o.type){a=h.Z.fromJSON(o);const e=a.colorUniqueValueInfos;i=new Uint8Array(3*n);const r=g(a.fieldTransformType);for(let o=0;o<n;o++){const n=(r?r(t[o]):t[o])+"";for(let t=0;t<e.length;t++)if(e[t].values.includes(n)){i[3*o]=e[t].color.r,i[3*o+1]=e[t].color.g,i[3*o+2]=e[t].color.b;break}}}else if(t&&"pointCloudStretchRenderer"===o.type){a=f.Z.fromJSON(o);const e=a.stops;i=new Uint8Array(3*n);const r=g(a.fieldTransformType);for(let o=0;o<n;o++){const n=r?r(t[o]):t[o],s=e.length-1;if(n<e[0].value)i[3*o]=e[0].color.r,i[3*o+1]=e[0].color.g,i[3*o+2]=e[0].color.b;else if(n>=e[s].value)i[3*o]=e[s].color.r,i[3*o+1]=e[s].color.g,i[3*o+2]=e[s].color.b;else for(let t=1;t<e.length;t++)if(n<e[t].value){const r=(n-e[t-1].value)/(e[t].value-e[t-1].value);i[3*o]=e[t].color.r*r+e[t-1].color.r*(1-r),i[3*o+1]=e[t].color.g*r+e[t-1].color.g*(1-r),i[3*o+2]=e[t].color.b*r+e[t-1].color.b*(1-r);break}}}else if(t&&"pointCloudClassBreaksRenderer"===o.type){a=d.Z.fromJSON(o);const e=a.colorClassBreakInfos;i=new Uint8Array(3*n);const r=g(a.fieldTransformType);for(let o=0;o<n;o++){const n=r?r(t[o]):t[o];for(let t=0;t<e.length;t++)if(n>=e[t].minValue&&n<=e[t].maxValue){i[3*o]=e[t].color.r,i[3*o+1]=e[t].color.g,i[3*o+2]=e[t].color.b;break}}}else{i=new Uint8Array(3*n);for(let e=0;e<i.length;e++)i[e]=255}if(r&&a&&a.colorModulation){const e=a.colorModulation.minValue,t=a.colorModulation.maxValue,o=.3;for(let s=0;s<n;s++){const n=r[s],a=n>=t?1:n<=e?o:o+(1-o)*(n-e)/(t-e);i[3*s]=a*i[3*s],i[3*s+1]=a*i[3*s+1],i[3*s+2]=a*i[3*s+2]}}return i}function y(e,t,r){return(0,n.pC)(e)&&e.attributeInfo.useElevation?function(e,t){const r=new Float64Array(t);for(let n=0;n<t;n++)r[n]=e[3*n+2];return r}(t,r):(0,n.pC)(e)?(0,p.qM)(e.attributeInfo.storageInfo,e.buffer,r):null}function g(e){return null==e||"none"===e?null:"low-four-bit"===e?e=>15&e:"high-four-bit"===e?e=>(240&e)>>4:"absolute-value"===e?e=>Math.abs(e):"modulo-ten"===e?e=>e%10:null}function w(e){let t=0;for(const r of e||[])t|=1<<r;return t}class M{transform(e){const t=this._transform(e),r=[t.points.buffer,t.rgb.buffer];(0,n.pC)(t.pointIdFilterMap)&&r.push(t.pointIdFilterMap.buffer);for(const e of t.attributes)"buffer"in e.values&&(0,o.eP)(e.values.buffer)&&e.values.buffer!==t.rgb.buffer&&r.push(e.values.buffer);return Promise.resolve({result:t,transferList:r})}_transform(e){const t=function(e,t){if(null==e.encoding||""===e.encoding){const r=(0,p.W7)(t,e);if((0,n.Wi)(r.vertexAttributes.position))return;const o=(0,p.I_)(t,r.vertexAttributes.position),s=r.header.fields,i=[s.offsetX,s.offsetY,s.offsetZ],a=[s.scaleX,s.scaleY,s.scaleZ],l=o.length/3,u=new Float64Array(3*l);for(let e=0;e<l;e++)u[3*e]=o[3*e]*a[0]+i[0],u[3*e+1]=o[3*e+1]*a[1]+i[1],u[3*e+2]=o[3*e+2]*a[2]+i[2];return u}if("lepcc-xyz"===e.encoding)return(0,m.Gi)(t).result}(e.schema,e.geometryBuffer);let r=t.length/3,o=null;const s=[],i=y(e.primaryAttributeData,t,r);(0,n.pC)(e.primaryAttributeData)&&i&&s.push({attributeInfo:e.primaryAttributeData.attributeInfo,values:i});const a=y(e.modulationAttributeData,t,r);(0,n.pC)(e.modulationAttributeData)&&a&&s.push({attributeInfo:e.modulationAttributeData.attributeInfo,values:a});let l=b(e.rendererInfo,i,a,r);if(e.filterInfo&&e.filterInfo.length>0&&(0,n.pC)(e.filterAttributesData)){const n=e.filterAttributesData.map((e=>{const n=y(e,t,r),o={attributeInfo:e.attributeInfo,values:n};return s.push(o),o}));o=new Uint32Array(r),r=function(e,t,r,n,o){const s=e.length/3;let i=0;for(let a=0;a<s;a++){let s=!0;for(let e=0;e<n.length&&s;e++){const{filterJSON:t}=n[e],r=o[e].values[a];switch(t.type){case"pointCloudValueFilter":{const e="exclude"===t.mode;t.values.includes(r)===e&&(s=!1);break}case"pointCloudBitfieldFilter":{const e=w(t.requiredSetBits),n=w(t.requiredClearBits);(r&e)===e&&0==(r&n)||(s=!1);break}case"pointCloudReturnFilter":{const e=15&r,n=r>>>4&15,o=n>1,i=1===e,a=e===n;let l=!1;for(const e of t.includedReturns)if("last"===e&&a||"firstOfMany"===e&&i&&o||"lastOfMany"===e&&a&&o||"single"===e&&!o){l=!0;break}l||(s=!1);break}}}s&&(r[i]=a,e[3*i]=e[3*a],e[3*i+1]=e[3*a+1],e[3*i+2]=e[3*a+2],t[3*i]=t[3*a],t[3*i+1]=t[3*a+1],t[3*i+2]=t[3*a+2],i++)}return i}(t,l,o,e.filterInfo,n)}for(const n of e.userAttributesData){const e=y(n,t,r);s.push({attributeInfo:n.attributeInfo,values:e})}3*r<l.length&&(l=new Uint8Array(l.buffer.slice(0,3*r))),this._applyElevationOffsetInPlace(t,r,e.elevationOffset);const u=this._transformCoordinates(t,r,e.obb,c.Z.fromJSON(e.inSR),c.Z.fromJSON(e.outSR));return{obb:e.obb,points:u,rgb:l,attributes:s,pointIdFilterMap:o}}_transformCoordinates(e,t,r,n,o){if(!(0,u.CM)(e,n,0,e,o,0,t))throw new Error("Can't reproject");const i=(0,l.f)(r.center[0],r.center[1],r.center[2]),c=(0,l.c)(),d=(0,l.c)();(0,s.c)(v,r.quaternion);const f=new Float32Array(3*t);for(let n=0;n<t;n++)c[0]=e[3*n]-i[0],c[1]=e[3*n+1]-i[1],c[2]=e[3*n+2]-i[2],(0,a.q)(d,c,v),r.halfSize[0]=Math.max(r.halfSize[0],Math.abs(d[0])),r.halfSize[1]=Math.max(r.halfSize[1],Math.abs(d[1])),r.halfSize[2]=Math.max(r.halfSize[2],Math.abs(d[2])),f[3*n]=c[0],f[3*n+1]=c[1],f[3*n+2]=c[2];return f}_applyElevationOffsetInPlace(e,t,r){if(0!==r)for(let n=0;n<t;n++)e[3*n+2]+=r}}const v=(0,i.c)();function C(){return new M}},91891:(e,t,r)=>{r.d(t,{I_:()=>f,W7:()=>m,qM:()=>y});var n=r(20102),o=r(22974),s=r(92604),i=r(25683),a=r(35065);const l=s.Z.getLogger("esri.views.3d.layers.i3s.I3SBinaryReader");function u(e,t,r){let o="",s=0;for(;s<r;){const i=e[t+s];if(i<128)o+=String.fromCharCode(i),s++;else if(i>=192&&i<224){if(s+1>=r)throw new n.Z("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const a=(31&i)<<6|63&e[t+s+1];o+=String.fromCharCode(a),s+=2}else if(i>=224&&i<240){if(s+2>=r)throw new n.Z("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(15&i)<<12|(63&e[t+s+1])<<6|63&e[t+s+2];o+=String.fromCharCode(a),s+=3}else{if(!(i>=240&&i<248))throw new n.Z("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(s+3>=r)throw new n.Z("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(7&i)<<18|(63&e[t+s+1])<<12|(63&e[t+s+2])<<6|63&e[t+s+3];if(a>=65536){const e=55296+(a-65536>>10),t=56320+(1023&a);o+=String.fromCharCode(e,t)}else o+=String.fromCharCode(a);s+=4}}}return o}function c(e,t){const r={byteOffset:0,byteCount:0,fields:Object.create(null)};let n=0;for(let o=0;o<t.length;o++){const s=t[o],i=s.valueType||s.type,a=w[i];r.fields[s.property]=a(e,n),n+=g[i].BYTES_PER_ELEMENT}return r.byteCount=n,r}function d(e,t,r){const o=[];let s,i,a=0;for(i=0;i<e;i+=1){if(s=t[i],s>0){if(o.push(u(r,a,s-1)),0!==r[a+s-1])throw new n.Z("string-array-error","Invalid string array: missing null termination.")}else o.push(null);a+=s}return o}function f(e,t){return new(0,g[t.valueType])(e,t.byteOffset,t.count*t.valuesPerElement)}function h(e,t,r){const s=null!=t.header?c(e,t.header):{byteOffset:0,byteCount:0,fields:{count:r}},i={header:s,byteOffset:s.byteCount,byteCount:0,entries:Object.create(null)};let a=s.byteCount;for(let e=0;e<t.ordering.length;e++){const r=t.ordering[e],l=(0,o.d9)(t[r]);if(l.count=s.fields.count,"String"===l.valueType){if(l.byteOffset=a,l.byteCount=s.fields[r+"ByteCount"],"UTF-8"!==l.encoding)throw new n.Z("unsupported-encoding","Unsupported String encoding.",{encoding:l.encoding})}else{if(!M(l.valueType))throw new n.Z("unsupported-value-type","Unsupported binary valueType",{valueType:l.valueType});{const e=v(l.valueType);a+=a%e!=0?e-a%e:0,l.byteOffset=a,l.byteCount=e*l.valuesPerElement*l.count}}a+=l.byteCount,i.entries[r]=l}return i.byteCount=a-i.byteOffset,i}function p(e,t,r){if(t!==e&&l.error(`Invalid ${r} buffer size\n expected: ${e}, actual: ${t})`),t<e)throw new n.Z("buffer-too-small","Binary buffer is too small",{expectedSize:e,actualSize:t})}function m(e,t){const r=c(e,t&&t.header);let n=r.byteCount;const o={isDraco:!1,header:r,byteOffset:r.byteCount,byteCount:0,vertexAttributes:{}},s=r.fields,i=null!=s.vertexCount?s.vertexCount:s.count;for(const e of t.ordering){if(!t.vertexAttributes[e])continue;const r={...t.vertexAttributes[e],byteOffset:n,count:i},s=b[e]?b[e]:"_"+e;o.vertexAttributes[s]=r,n+=v(r.valueType)*r.valuesPerElement*i}const a=s.faceCount;if(t.faces&&a){o.faces={};for(const e of t.ordering){if(!t.faces[e])continue;const r={...t.faces[e],byteOffset:n,count:a};o.faces[e]=r,n+=v(r.valueType)*r.valuesPerElement*a}}const l=s.featureCount;if(t.featureAttributes&&t.featureAttributeOrder&&l){o.featureAttributes={};for(const e of t.featureAttributeOrder){if(!t.featureAttributes[e])continue;const r={...t.featureAttributes[e],byteOffset:n,count:l};o.featureAttributes[e]=r,n+=("UInt64"===r.valueType?8:v(r.valueType))*r.valuesPerElement*l}}return p(n,e.byteLength,"geometry"),o.byteCount=n-o.byteOffset,o}const b={position:a.T.POSITION,normal:a.T.NORMAL,color:a.T.COLOR,uv0:a.T.UV0,region:a.T.UVREGION};function y(e,t,r){if("lepcc-rgb"===e.encoding)return(0,i.IT)(t);if("lepcc-intensity"===e.encoding)return(0,i.ti)(t);if(null!=e.encoding&&""!==e.encoding)throw new n.Z("unknown-attribute-storage-info-encoding","Unknown Attribute Storage Info Encoding");e["attributeByteCounts "]&&!e.attributeByteCounts&&(l.warn("Warning: Trailing space in 'attributeByteCounts '."),e.attributeByteCounts=e["attributeByteCounts "]),"ObjectIds"===e.ordering[0]&&e.hasOwnProperty("objectIds")&&(l.warn("Warning: Case error in objectIds"),e.ordering[0]="objectIds");const o=h(t,e,r);p(o.byteOffset+o.byteCount,t.byteLength,"attribute");const s=o.entries.attributeValues||o.entries.objectIds;if(s){if("String"===s.valueType){const e=o.entries.attributeByteCounts,r=f(t,e),n=function(e,t){return new Uint8Array(e,t.byteOffset,t.byteCount)}(t,s);return d(e.count,r,n)}return f(t,s)}throw new n.Z("bad-attribute-storage-info","Bad attributeStorageInfo specification.")}const g={Float32:Float32Array,Float64:Float64Array,UInt8:Uint8Array,Int8:Int8Array,UInt16:Uint16Array,Int16:Int16Array,UInt32:Uint32Array,Int32:Int32Array},w={Float32:(e,t)=>new DataView(e,0).getFloat32(t,!0),Float64:(e,t)=>new DataView(e,0).getFloat64(t,!0),UInt8:(e,t)=>new DataView(e,0).getUint8(t),Int8:(e,t)=>new DataView(e,0).getInt8(t),UInt16:(e,t)=>new DataView(e,0).getUint16(t,!0),Int16:(e,t)=>new DataView(e,0).getInt16(t,!0),UInt32:(e,t)=>new DataView(e,0).getUint32(t,!0),Int32:(e,t)=>new DataView(e,0).getInt32(t,!0)};function M(e){return g.hasOwnProperty(e)}function v(e){return M(e)?g[e].BYTES_PER_ELEMENT:0}},25683:(e,t,r)=>{r.d(t,{Gi:()=>a,IT:()=>d,ti:()=>h});var n=r(20102);const o=!0;function s(e,t,r){return{identifier:String.fromCharCode.apply(null,new Uint8Array(e,r+0,10)),version:t.getUint16(r+10,o),checksum:t.getUint32(r+12,o)}}function i(e,t){return{sizeLo:e.getUint32(t+0,o),sizeHi:e.getUint32(t+4,o),minX:e.getFloat64(t+8,o),minY:e.getFloat64(t+16,o),minZ:e.getFloat64(t+24,o),maxX:e.getFloat64(t+32,o),maxY:e.getFloat64(t+40,o),maxZ:e.getFloat64(t+48,o),errorX:e.getFloat64(t+56,o),errorY:e.getFloat64(t+64,o),errorZ:e.getFloat64(t+72,o),count:e.getUint32(t+80,o),reserved:e.getUint32(t+84,o)}}function a(e){const t=new DataView(e,0);let r=0;const{identifier:o,version:a}=s(e,t,r);if(r+=16,"LEPCC "!==o)throw new n.Z("lepcc-decode-error","Bad identifier");if(a>1)throw new n.Z("lepcc-decode-error","Unknown version");const u=i(t,r);if(r+=88,u.sizeHi*2**32+u.sizeLo!==e.byteLength)throw new n.Z("lepcc-decode-error","Bad size");const c=new Float64Array(3*u.count),d=[],f=[],h=[],p=[];if(r=l(e,r,d),r=l(e,r,f),r=l(e,r,h),r=l(e,r,p),r!==e.byteLength)throw new n.Z("lepcc-decode-error","Bad length");let m=0,b=0;for(let e=0;e<d.length;e++){b+=d[e];let t=0;for(let r=0;r<f[e];r++){t+=h[m];const e=p[m];c[3*m]=Math.min(u.maxX,u.minX+2*u.errorX*t),c[3*m+1]=Math.min(u.maxY,u.minY+2*u.errorY*b),c[3*m+2]=Math.min(u.maxZ,u.minZ+2*u.errorZ*e),m++}}return{errorX:u.errorX,errorY:u.errorY,errorZ:u.errorZ,result:c}}function l(e,t,r){const n=[];t=u(e,t,n);const o=[];for(let s=0;s<n.length;s++){o.length=0,t=u(e,t,o);for(let e=0;e<o.length;e++)r.push(o[e]+n[s])}return t}function u(e,t,r){const s=new DataView(e,t),i=s.getUint8(0),a=31&i,l=!!(32&i),u=(192&i)>>6;let c=0;if(0===u)c=s.getUint32(1,o),t+=5;else if(1===u)c=s.getUint16(1,o),t+=3;else{if(2!==u)throw new n.Z("lepcc-decode-error","Bad count type");c=s.getUint8(1),t+=2}if(l)throw new n.Z("lepcc-decode-error","LUT not implemented");const d=Math.ceil(c*a/8),f=new Uint8Array(e,t,d);let h=0,p=0,m=0;const b=-1>>>32-a;for(let e=0;e<c;e++){for(;p<a;)h|=f[m]<<p,p+=8,m+=1;r[e]=h&b,h>>>=a,p-=a,p+a>32&&(h|=f[m-1]>>8-p)}return t+m}function c(e,t){return{sizeLo:e.getUint32(t+0,o),sizeHi:e.getUint32(t+4,o),count:e.getUint32(t+8,o),colorMapCount:e.getUint16(t+12,o),lookupMethod:e.getUint8(t+14),compressionMethod:e.getUint8(t+15)}}function d(e){const t=new DataView(e,0);let r=0;const{identifier:o,version:i}=s(e,t,r);if(r+=16,"ClusterRGB"!==o)throw new n.Z("lepcc-decode-error","Bad identifier");if(i>1)throw new n.Z("lepcc-decode-error","Unknown version");const a=c(t,r);if(r+=16,a.sizeHi*2**32+a.sizeLo!==e.byteLength)throw new n.Z("lepcc-decode-error","Bad size");if((2===a.lookupMethod||1===a.lookupMethod)&&0===a.compressionMethod){if(3*a.colorMapCount+a.count+r!==e.byteLength||a.colorMapCount>256)throw new n.Z("lepcc-decode-error","Bad count");const t=new Uint8Array(e,r,3*a.colorMapCount),o=new Uint8Array(e,r+3*a.colorMapCount,a.count),s=new Uint8Array(3*a.count);for(let e=0;e<a.count;e++){const r=o[e];s[3*e]=t[3*r],s[3*e+1]=t[3*r+1],s[3*e+2]=t[3*r+2]}return s}if(0===a.lookupMethod&&0===a.compressionMethod){if(3*a.count+r!==e.byteLength||0!==a.colorMapCount)throw new n.Z("lepcc-decode-error","Bad count");return new Uint8Array(e,r).slice()}if(a.lookupMethod<=2&&1===a.compressionMethod){if(r+3!==e.byteLength||1!==a.colorMapCount)throw new n.Z("lepcc-decode-error","Bad count");const o=t.getUint8(r),s=t.getUint8(r+1),i=t.getUint8(r+2),l=new Uint8Array(3*a.count);for(let e=0;e<a.count;e++)l[3*e]=o,l[3*e+1]=s,l[3*e+2]=i;return l}throw new n.Z("lepcc-decode-error","Bad method "+a.lookupMethod+","+a.compressionMethod)}function f(e,t){return{sizeLo:e.getUint32(t+0,o),sizeHi:e.getUint32(t+4,o),count:e.getUint32(t+8,o),scaleFactor:e.getUint16(t+12,o),bitsPerPoint:e.getUint8(t+14),reserved:e.getUint8(t+15)}}function h(e){const t=new DataView(e,0);let r=0;const{identifier:o,version:i}=s(e,t,r);if(r+=16,"Intensity "!==o)throw new n.Z("lepcc-decode-error","Bad identifier");if(i>1)throw new n.Z("lepcc-decode-error","Unknown version");const a=f(t,r);if(r+=16,a.sizeHi*2**32+a.sizeLo!==e.byteLength)throw new n.Z("lepcc-decode-error","Bad size");const l=new Uint16Array(a.count);if(8===a.bitsPerPoint){if(a.count+r!==e.byteLength)throw new n.Z("lepcc-decode-error","Bad size");const t=new Uint8Array(e,r,a.count);for(let e=0;e<a.count;e++)l[e]=t[e]*a.scaleFactor}else if(16===a.bitsPerPoint){if(2*a.count+r!==e.byteLength)throw new n.Z("lepcc-decode-error","Bad size");const t=new Uint16Array(e,r,a.count);for(let e=0;e<a.count;e++)l[e]=t[e]*a.scaleFactor}else{const t=[];if(u(e,r,t)!==e.byteLength)throw new n.Z("lepcc-decode-error","Bad size");for(let e=0;e<a.count;e++)l[e]=t[e]*a.scaleFactor}return l}},35065:(e,t,r)=>{var n;r.d(t,{T:()=>n}),function(e){e.POSITION="position",e.NORMAL="normal",e.UV0="uv0",e.AUXPOS1="auxpos1",e.AUXPOS2="auxpos2",e.MAPPOS="mapPos",e.COLOR="color",e.SYMBOLCOLOR="symbolColor",e.SIZE="size",e.TANGENT="tangent",e.OFFSET="offset",e.SUBDIVISIONFACTOR="subdivisionFactor",e.COLORFEATUREATTRIBUTE="colorFeatureAttribute",e.SIZEFEATUREATTRIBUTE="sizeFeatureAttribute",e.OPACITYFEATUREATTRIBUTE="opacityFeatureAttribute",e.DISTANCETOSTART="distanceToStart",e.UVMAPSPACE="uvMapSpace",e.BOUNDINGRECT="boundingRect",e.UVREGION="uvRegion",e.NORMALCOMPRESSED="normalCompressed",e.PROFILERIGHT="profileRight",e.PROFILEUP="profileUp",e.PROFILEVERTEXANDNORMAL="profileVertexAndNormal",e.FEATUREVALUE="featureValue",e.MODELORIGINHI="modelOriginHi",e.MODELORIGINLO="modelOriginLo",e.MODEL="model",e.MODELNORMAL="modelNormal",e.INSTANCECOLOR="instanceColor",e.INSTANCEFEATUREATTRIBUTE="instanceFeatureAttribute",e.LOCALTRANSFORM="localTransform",e.GLOBALTRANSFORM="globalTransform",e.BOUNDINGSPHERE="boundingSphere",e.MODELORIGIN="modelOrigin",e.MODELSCALEFACTORS="modelScaleFactors",e.FEATUREATTRIBUTE="featureAttribute",e.STATE="state",e.LODLEVEL="lodLevel",e.POSITION0="position0",e.POSITION1="position1",e.NORMALA="normalA",e.NORMALB="normalB",e.COMPONENTINDEX="componentIndex",e.VARIANTOFFSET="variantOffset",e.VARIANTSTROKE="variantStroke",e.VARIANTEXTENSION="variantExtension",e.U8PADDING="u8padding",e.U16PADDING="u16padding",e.SIDENESS="sideness",e.START="start",e.END="end",e.UP="up",e.EXTRUDE="extrude",e.OBJECTANDLAYERIDCOLOR="objectAndLayerIdColor",e.OBJECTANDLAYERIDCOLOR_INSTANCED="objectAndLayerIdColor_instanced"}(n||(n={}))}}]);