2 lines
79 KiB
JavaScript
2 lines
79 KiB
JavaScript
import{ep as fr,A as l,B as p,C as R,bk as ke,a6 as se,f as Wt,Y as gr,_ as at,eQ as ot,s as _,eo as Tt,aJ as Vt,aH as Ge,aa as ye,aI as Se,z as Ee,ar as ve,bc as wr,aV as ge,ae as Kt,cx as De,b2 as st,ab as Re,ek as Dt,gF as Gt,fJ as _r,ft as br,bm as Zt,bn as Xt,dn as Tr,lT as Er,c$ as me,c_ as Rt,G as We,fv as kr,fx as Mr,E as xr,F as Cr,fE as Ir,bq as er,V as St,aC as Lr}from"./index-b5c8f851.js";import{p as ue}from"./geohashUtils-77d8429b.js";import{r as le}from"./featureConversionUtils-6aca8295.js";import{a as Nt,t as $t}from"./OptimizedGeometry-d94e541f.js";import{m as vr}from"./FeatureStore-1b13fe8f.js";import{W as Dr}from"./QueryEngine-f2d30caa.js";import{l as Gr,o as Ve}from"./clientSideDefaults-6e7fdab0.js";import"./OptimizedFeatureSet-1d1ac4b9.js";import"./timeSupport-b4d06407.js";import"./projectionSupport-d15822a5.js";import"./json-48e3ea08.js";import"./WhereClause-08dab84b.js";import"./TimeOnly-99f1af45.js";import"./QueryEngineCapabilities-85c4f1d0.js";import"./quantizationUtils-50e37a76.js";import"./utils-10149227.js";import"./utils-b84c61ef.js";import"./generateRendererUtils-d29abb94.js";import"./RenderState-1d6218ee.js";const Rr="ESRI__DESTINATION_ID",Sr="ESRI__ORIGIN_ID";let Ke=class pe{constructor(){this._featureLookup=new Map}static getInstance(){return pe.instance||(pe.instance=new pe),pe.instance}static resetInstance(){pe.instance&&(pe.instance=null)}deleteFromStore(t){t.forEach(r=>{this._featureLookup.delete(r)})}readFromStoreByList(t){const r=[];return t.forEach(i=>{const n=this.readFromStoreById(i);n&&r.push(n)}),r}readFromStoreById(t){return this._featureLookup.get(t)??null}writeToStore(t,r,i){const n=[];return t.forEach(a=>{if(!(a!=null&&a.id))return;a.properties||(a.properties=[]);let o,s=null;if(i&&a.properties[i]&&(s=le(a.properties[i])),"originId"in a&&"destinationId"in a&&(a.properties[Sr]=a.originId,a.properties[Rr]=a.destinationId),a.properties[r]=a.id,a.id&&this._featureLookup.has(a.id)&&this._featureLookup.get(a.id).attributes){const d=this._featureLookup.get(a.id),u=JSON.parse(JSON.stringify(Object.assign(d.attributes,a.properties)));i&&a.properties[i]&&(u[i]=fr(a.properties[i])),o=new Nt(s?JSON.parse(JSON.stringify(s)):d!=null&&d.geometry?JSON.parse(JSON.stringify(d.geometry)):null,u,null,a.properties[r])}else o=new Nt(s?JSON.parse(JSON.stringify(s)):null,a.properties,null,a.properties[r]);this._featureLookup.set(a.id,o),n.push(o)}),n}},Pe=class extends ke{constructor(t){super(t),this.resultRows=[]}};l([p()],Pe.prototype,"resultRows",void 0),Pe=l([R("esri.rest.knowledgeGraph.GraphQueryResult")],Pe);const Ft=Pe;let Oe=class extends ke{constructor(t){super(t),this.resultRowsStream=new ReadableStream}};l([p()],Oe.prototype,"resultRowsStream",void 0),Oe=l([R("esri.rest.knowledgeGraph.GraphQueryResult")],Oe);const Pt=Oe;let ae=class extends se{constructor(t){super(t),this.name=null,this.unique=null,this.ascending=null,this.description=null,this.fieldNames=null}};l([p({type:String,json:{write:!0}})],ae.prototype,"name",void 0),l([p({type:Boolean,json:{write:!0}})],ae.prototype,"unique",void 0),l([p({type:Boolean,json:{write:!0}})],ae.prototype,"ascending",void 0),l([p({type:String,json:{write:!0}})],ae.prototype,"description",void 0),l([p({type:[String],json:{write:!0}})],ae.prototype,"fieldNames",void 0),ae=l([R("esri.rest.knowledgeGraph.FieldIndex")],ae);const tr=ae;let q=class extends se{constructor(t){super(t),this.name=null,this.alias=null,this.fieldType=null,this.geometryType=null,this.hasM=null,this.hasZ=null,this.nullable=null,this.editable=null,this.required=null,this.defaultVisibility=null,this.systemMaintained=null,this.role=null,this.defaultValue=null}};l([p({type:String,json:{write:!0}})],q.prototype,"name",void 0),l([p({type:String,json:{write:!0}})],q.prototype,"alias",void 0),l([p({type:String,json:{write:!0}})],q.prototype,"fieldType",void 0),l([p({type:String,json:{write:!0}})],q.prototype,"geometryType",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"hasM",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"hasZ",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"nullable",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"editable",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"required",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"defaultVisibility",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"systemMaintained",void 0),l([p()],q.prototype,"role",void 0),l([p({type:Object,json:{type:String,write:{writer:(e,t)=>{t.defaultValue=e!=null?e.toString():null}}}})],q.prototype,"defaultValue",void 0),q=l([R("esri.rest.knowledgeGraph.GraphProperty")],q);const rr=q;let ne=class extends se{constructor(t){super(t),this.name=null,this.alias=null,this.role=null,this.strict=null,this.properties=null,this.fieldIndexes=null}};l([p({type:String,json:{write:!0}})],ne.prototype,"name",void 0),l([p({type:String,json:{write:!0}})],ne.prototype,"alias",void 0),l([p({type:String,json:{write:!0}})],ne.prototype,"role",void 0),l([p({type:Boolean,json:{write:!0}})],ne.prototype,"strict",void 0),l([p({type:[rr],json:{write:!0}})],ne.prototype,"properties",void 0),l([p({type:[tr],json:{write:!0}})],ne.prototype,"fieldIndexes",void 0),ne=l([R("esri.rest.knowledgeGraph.GraphObjectType")],ne);const ir=ne;let lt=class extends ir{constructor(t){super(t)}};lt=l([R("esri.rest.knowledgeGraph.EntityType")],lt);const Et=lt;let je=class extends ir{constructor(t){super(t),this.endPoints=[]}};l([p()],je.prototype,"endPoints",void 0),je=l([R("esri.rest.knowledgeGraph.RelationshipType")],je);const kt=je;let V=class extends se{constructor(t){super(t),this.timestamp=null,this.spatialReference=null,this.strict=null,this.objectIdField=null,this.globalIdField=null,this.arcgisManaged=null,this.identifierInfo=null,this.searchIndexes=null,this.entityTypes=null,this.relationshipTypes=null}};l([p({type:Date,json:{type:Number,write:{writer:(e,t)=>{t.timestamp=e==null?void 0:e.getTime()}}}})],V.prototype,"timestamp",void 0),l([p({type:Wt,json:{write:!0}})],V.prototype,"spatialReference",void 0),l([p({type:Boolean,json:{write:!0}})],V.prototype,"strict",void 0),l([p({type:String,json:{write:!0}})],V.prototype,"objectIdField",void 0),l([p({type:String,json:{write:!0}})],V.prototype,"globalIdField",void 0),l([p()],V.prototype,"arcgisManaged",void 0),l([p()],V.prototype,"identifierInfo",void 0),l([p()],V.prototype,"searchIndexes",void 0),l([p({type:[Et],json:{write:!0}})],V.prototype,"entityTypes",void 0),l([p({type:[kt],json:{write:!0}})],V.prototype,"relationshipTypes",void 0),V=l([R("esri.rest.knowledgeGraph.DataModel")],V);const nr=V;let P=class extends se{constructor(t){super(t),this.capabilities=[],this.supportsSearch=!1,this.supportedQueryFormats=[],this.allowGeometryUpdates=!1,this.searchMaxRecordCount=null,this.serviceCapabilities=null,this.maxRecordCount=null,this.description="",this.copyrightText="",this.units="",this.spatialReference=null,this.currentVersion=null,this.dateFieldsTimeReference=null,this.serviceItemId="",this.supportsDocuments=!1,this.dataEditingNotSupported=!1,this.schemaEditingNotSupported=!1}};l([p({type:[String],json:{write:!0}})],P.prototype,"capabilities",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"supportsSearch",void 0),l([p({type:[String],json:{write:!0}})],P.prototype,"supportedQueryFormats",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"allowGeometryUpdates",void 0),l([p({type:Number,json:{write:!0}})],P.prototype,"searchMaxRecordCount",void 0),l([p({type:Object,json:{write:!0}})],P.prototype,"serviceCapabilities",void 0),l([p({type:Number,json:{write:!0}})],P.prototype,"maxRecordCount",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"description",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"copyrightText",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"units",void 0),l([p({type:Object,json:{write:!0}})],P.prototype,"spatialReference",void 0),l([p({type:Number,json:{write:!0}})],P.prototype,"currentVersion",void 0),l([p({type:Object,json:{write:!0}})],P.prototype,"dateFieldsTimeReference",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"serviceItemId",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"supportsDocuments",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"dataEditingNotSupported",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"schemaEditingNotSupported",void 0),P=l([R("esri.rest.knowledgeGraph.ServiceDefinition")],P);const ar=P;let we=class extends se{constructor(t){super(t),this.dataModel=null,this.serviceDefinition=null}};l([p({type:String,json:{write:!0}})],we.prototype,"url",void 0),l([p({type:nr,json:{write:!0}})],we.prototype,"dataModel",void 0),l([p({type:ar,json:{write:!0}})],we.prototype,"serviceDefinition",void 0),we=l([R("esri.rest.knowledgeGraph.KnowledgeGraph")],we);const Nr=we,Ot="esri/rest/knowledgeGraph/wasmInterface/";let Ze;async function oe(){const e=Ze;if(e)return e;const t=gr("wasm-simd");return Ze=$r(t),Ze}async function $r(e){if(e){const{default:r}=await at(()=>import("./arcgis-knowledge-client-core-simd-73cfadf3.js"),["assets/arcgis-knowledge-client-core-simd-73cfadf3.js","assets/index-b5c8f851.js","assets/index-86716609.css"]).then(i=>i.a);return r({locateFile:i=>ot(Ot+i)})}const{default:t}=await at(()=>import("./arcgis-knowledge-client-core-2492c60b.js"),["assets/arcgis-knowledge-client-core-2492c60b.js","assets/index-b5c8f851.js","assets/index-86716609.css"]).then(r=>r.a);return t({locateFile:r=>ot(Ot+r)})}function or(e,t){const r=new t.ArrayValue;return r.deleteLater(),e.forEach(i=>{r.add_value(xt(i,t))}),r}function sr(e,t){const r=new t.ObjectValue;r.deleteLater();for(const[i,n]of Object.entries(e))r.set_key_value(i,xt(n,t));return r}function Mt(e,t){if(e instanceof Vt)return jr(e,t);if(e instanceof Ge)return Ar(e,t);if(e instanceof ye||e instanceof Se)return Or(e,t);throw new _("knowledge-graph:unsupported-geometry","Only Point, Multipoint, Polyline, and Polygon geometry are supported by ArcGIS Knowledge",{geometry:e})}function Fr(e,t){t.input_quantization_parameters={xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}function Pr(e,t,r){if(!e.extent)throw new _("knowledge-graph:illegal-output-quantization","The Output quantization provided to the encoder had an illegal value as part of its extent",e.extent);if(!e.quantizeMode)throw new _("knowledge-graph:illegal-output-quantization","The Output quantization contained an illegal mode setting",e.quantizeMode);if(!e.tolerance)throw new _("knowledge-graph:illegal-output-quantization","The Output quantization contained an illegal tolerance setting",e.quantizeMode);t.output_quantization_parameters={extent:{xmax:e.extent.xmax,ymax:e.extent.ymax,xmin:e.extent.xmin,ymin:e.extent.ymin},quantize_mode:r.esriQuantizeMode[e.quantizeMode],tolerance:e.tolerance}}function xt(e,t){if(e==null)return"";if(typeof e!="object"||e instanceof Date)return e;if(e instanceof Tt)return Mt(e,t);if(Array.isArray(e)){const r=new t.ArrayValue;return r.deleteLater(),e.forEach(i=>{r.add_value(xt(i,t))}),r}return sr(e,t)}function Or(e,t){const r=new t.GeometryValue;r.deleteLater(),r.has_z=e.hasZ,r.has_m=e.hasM;const i=[],n=[];let a=[];e instanceof ye?(r.geometry_type=t.esriGeometryType.esriGeometryPolyline,a=e.paths):e instanceof Se&&(r.geometry_type=t.esriGeometryType.esriGeometryPolygon,a=e.rings);let o=0,s=0;return a.forEach(d=>{let u=0;d.forEach(c=>{u++,c.forEach(m=>{i[s]=m,s++})}),n[o]=u,o++}),r.coords=new Float64Array(i),r.lengths=new Uint32Array(n),r}function jr(e,t){const r=new t.GeometryValue;r.deleteLater(),r.geometry_type=r.geometry_type=t.esriGeometryType.esriGeometryMultipoint,r.has_z=e.hasZ,r.has_m=e.hasM;const i=[],n=[];n[0]=e.points.length;let a=0;return e.points.forEach(o=>{o.forEach(s=>{i[a]=s,a++})}),r.coords=new Float64Array(i),r.lengths=new Uint32Array(n),r}function Ar(e,t){const r=new t.GeometryValue;r.deleteLater(),r.geometry_type=t.esriGeometryType.esriGeometryPoint,r.has_z=e.hasZ,r.has_m=e.hasM;const i=[],n=[];n[0]=1,i[0]=e.x,i[1]=e.y;let a=2;return e.hasZ&&(i[a]=e.z,a++),e.hasM&&(i[a]=e.m,a++),r.coords=new Float64Array(i),r.lengths=new Uint32Array(n),r}let Ae=class extends se{constructor(t){super(t),this.properties=null}};l([p({json:{write:!0}})],Ae.prototype,"properties",void 0),Ae=l([R("esri.rest.knowledgeGraph.GraphObject")],Ae);const Ct=Ae;let Ie=class extends Ct{constructor(t){super(t),this.typeName=null,this.id=null}};l([p({type:String,json:{write:!0}})],Ie.prototype,"typeName",void 0),l([p({type:String,json:{write:!0}})],Ie.prototype,"id",void 0),Ie=l([R("esri.rest.knowledgeGraph.GraphNamedObject")],Ie);const lr=Ie;let ze=class extends lr{constructor(t){super(t),this.layoutGeometry=null}};l([p({type:Ge,json:{write:!0}})],ze.prototype,"layoutGeometry",void 0),ze=l([R("esri.rest.knowledgeGraph.Entity")],ze);const pr=ze;let _e=class extends lr{constructor(t){super(t),this.originId=null,this.destinationId=null,this.layoutGeometry=null}};l([p({type:String,json:{write:!0}})],_e.prototype,"originId",void 0),l([p({type:String,json:{write:!0}})],_e.prototype,"destinationId",void 0),l([p({type:ye,json:{write:!0}})],_e.prototype,"layoutGeometry",void 0),_e=l([R("esri.rest.Relationship.Relationship")],_e);const dr=_e;function $e(e,t){if(!e.typeName)throw new _("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits");if(e instanceof pr){const r=new t.EntityValue;r.deleteLater(),r.type_name=e.typeName;for(const[i,n]of Object.entries(e.properties))r.set_key_value(i,jt(n,t));return e.id&&r.set_id(e.id),r}if(e instanceof dr){const r=new t.RelationshipValue;r.deleteLater(),r.type_name=e.typeName;for(const[i,n]of Object.entries(e.properties))r.set_key_value(i,jt(n,t));return e.id&&r.set_id(e.id),e.originId&&e.destinationId&&r.set_related_entity_ids(e.originId,e.destinationId),r}throw new _("knowledge-graph:applyEdits-encoding-failure","Could not determine the type of a named graph object passed to the encoder")}function zr(e){return{xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}function jt(e,t){return e==null?"":typeof e!="object"||e instanceof Date?e:e instanceof Tt?Mt(e,t):""}let de=class extends ke{constructor(t){super(t),this.name=null,this.supportedCategory=null,this.analyzers=[],this.searchProperties=new Map}};l([p()],de.prototype,"name",void 0),l([p()],de.prototype,"supportedCategory",void 0),l([p()],de.prototype,"analyzers",void 0),l([p()],de.prototype,"searchProperties",void 0),de=l([R("esri.rest.knowledgeGraph.SearchIndex")],de);const Qr=de;var Ye,Be,He,pt,dt,ut,ht;(function(e){e[e.Regular=0]="Regular",e[e.Provenance=1]="Provenance",e[e.Document=2]="Document"})(Ye||(Ye={})),function(e){e[e.esriFieldTypeSmallInteger=0]="esriFieldTypeSmallInteger",e[e.esriFieldTypeInteger=1]="esriFieldTypeInteger",e[e.esriFieldTypeSingle=2]="esriFieldTypeSingle",e[e.esriFieldTypeDouble=3]="esriFieldTypeDouble",e[e.esriFieldTypeString=4]="esriFieldTypeString",e[e.esriFieldTypeDate=5]="esriFieldTypeDate",e[e.esriFieldTypeOID=6]="esriFieldTypeOID",e[e.esriFieldTypeGeometry=7]="esriFieldTypeGeometry",e[e.esriFieldTypeBlob=8]="esriFieldTypeBlob",e[e.esriFieldTypeRaster=9]="esriFieldTypeRaster",e[e.esriFieldTypeGUID=10]="esriFieldTypeGUID",e[e.esriFieldTypeGlobalID=11]="esriFieldTypeGlobalID",e[e.esriFieldTypeXML=12]="esriFieldTypeXML",e[e.esriFieldTypeBigInteger=13]="esriFieldTypeBigInteger",e[e.esriFieldTypeDateOnly=14]="esriFieldTypeDateOnly",e[e.esriFieldTypeTimeOnly=15]="esriFieldTypeTimeOnly",e[e.esriFieldTypeTimestampOffset=16]="esriFieldTypeTimestampOffset"}(Be||(Be={})),function(e){e[e.esriGeometryNull=0]="esriGeometryNull",e[e.esriGeometryPoint=1]="esriGeometryPoint",e[e.esriGeometryMultipoint=2]="esriGeometryMultipoint",e[e.esriGeometryPolyline=3]="esriGeometryPolyline",e[e.esriGeometryPolygon=4]="esriGeometryPolygon",e[e.esriGeometryEnvelope=5]="esriGeometryEnvelope",e[e.esriGeometryAny=6]="esriGeometryAny",e[e.esriGeometryMultiPatch=7]="esriGeometryMultiPatch"}(He||(He={})),function(e){e[e.esriMethodHintUNSPECIFIED=0]="esriMethodHintUNSPECIFIED",e[e.esriUUIDESRI=1]="esriUUIDESRI",e[e.esriUUIDRFC4122=2]="esriUUIDRFC4122"}(pt||(pt={})),function(e){e[e.esriTypeUNSPECIFIED=0]="esriTypeUNSPECIFIED",e[e.esriTypeEntity=1]="esriTypeEntity",e[e.esriTypeRelationship=2]="esriTypeRelationship",e[e.esriTypeBoth=4]="esriTypeBoth"}(dt||(dt={})),function(e){e[e.esriGraphPropertyUNSPECIFIED=0]="esriGraphPropertyUNSPECIFIED",e[e.esriGraphPropertyRegular=1]="esriGraphPropertyRegular",e[e.esriGraphPropertyDocumentName=2]="esriGraphPropertyDocumentName",e[e.esriGraphPropertyDocumentTitle=3]="esriGraphPropertyDocumentTitle",e[e.esriGraphPropertyDocumentUrl=4]="esriGraphPropertyDocumentUrl",e[e.esriGraphPropertyDocumentText=5]="esriGraphPropertyDocumentText",e[e.esriGraphPropertyDocumentKeywords=6]="esriGraphPropertyDocumentKeywords",e[e.esriGraphPropertyDocumentContentType=7]="esriGraphPropertyDocumentContentType",e[e.esriGraphPropertyDocumentMetadata=8]="esriGraphPropertyDocumentMetadata",e[e.esriGraphPropertyDocumentFileExtension=9]="esriGraphPropertyDocumentFileExtension"}(ut||(ut={})),function(e){e[e.esriIdentifierInfoTypeUNSPECIFIED=0]="esriIdentifierInfoTypeUNSPECIFIED",e[e.esriIdentifierInfoTypeDatabaseNative=1]="esriIdentifierInfoTypeDatabaseNative",e[e.esriIdentifierInfoTypeUniformProperty=2]="esriIdentifierInfoTypeUniformProperty"}(ht||(ht={}));function Ur(e){var t,r,i,n,a,o,s,d,u,c,m;return e.deleteLater(),new nr({timestamp:e.timestamp,spatialReference:new Wt(e.spatial_reference),strict:e.strict,objectIdField:e.objectid_property,globalIdField:e.globalid_property,arcgisManaged:e.arcgis_managed,identifierInfo:{identifierMappingInfo:{identifierInfoType:ht[(i=(r=(t=e.identifier_info)==null?void 0:t.identifier_mapping_info)==null?void 0:r.identifier_info_type)==null?void 0:i.value],databaseNativeIdentifier:(a=(n=e.identifier_info)==null?void 0:n.identifier_mapping_info)==null?void 0:a.database_native_identifier,uniformPropertyIdentifier:{identifierPropertyName:(d=(s=(o=e.identifier_info)==null?void 0:o.identifier_mapping_info)==null?void 0:s.uniform_property_identifier)==null?void 0:d.identifier_property_name}},identifierGenerationInfo:{uuidMethodHint:pt[(m=(c=(u=e.identifier_info)==null?void 0:u.identifier_generation_info)==null?void 0:c.uuid_method_hint)==null?void 0:m.value]}},searchIndexes:Xr(e.search_indexes),entityTypes:Jr(e.entity_types),relationshipTypes:Zr(e.relationship_types)})}function qr(e){return e.deleteLater(),new Et(ur(e))}function Yr(e){return e.deleteLater(),new tr({name:e.name,unique:e.unique,ascending:e.ascending,description:e.description,fieldNames:Wr(e.fields)})}function ur(e){return{name:e.name,alias:e.alias,role:Ye[e.role.value]?Ye[e.role.value]:null,strict:e.strict,properties:Vr(e.properties),fieldIndexes:Kr(e.field_indexes)}}function Br(e){return e.deleteLater(),new rr({alias:e.alias,name:e.name,fieldType:Be[e.field_type.value]?Be[e.field_type.value]:null,geometryType:He[e.geometry_type.value]?He[e.geometry_type.value]:null,hasM:e.has_m,hasZ:e.has_z,nullable:e.nullable,editable:e.editable,required:e.required,defaultVisibility:e.default_visibility,systemMaintained:e.system_maintained,role:ut[e.role.value],defaultValue:e.default_value})}function Hr(e){e.deleteLater();const t=ur(e),r=[];for(let i=0;i<e.end_points.size();i++){const n=e.end_points.get(i);r.push({originEntityType:n.origin_entity_type,destinationEntityType:n.dest_entity_type})}return new kt(Object.assign({endPoints:r},t))}function Jr(e){const t=[];for(let r=0;r<e.size();r++)t.push(qr(e.get(r)));return t}function Wr(e){const t=[];for(let r=0;r<e.size();r++)t.push(e.get(r));return t}function Vr(e){const t=[];for(let r=0;r<e.size();r++)t.push(Br(e.get(r)));return t}function Kr(e){const t=[];for(let r=0;r<e.size();r++)t.push(Yr(e.get(r)));return t}function Zr(e){const t=[];for(let r=0;r<e.size();r++)t.push(Hr(e.get(r)));return t}function Xr(e){const t=[];for(let r=0;r<e.size();r++){const i=new Qr,n=e.get(0);i.name=n.name,i.supportedCategory=dt[n.supported_category.value];const a=n.analyzers.size();for(let o=0;o<a;o++)i.analyzers.push({name:n.analyzers.get(o).name});for(let o=0;o<n.search_properties.keys().size();o++){const s=n.search_properties.keys().get(o),d=n.search_properties.get(s),u=[];for(let c=0;c<d.property_names.size();c++)u.push(d.property_names.get(c));i.searchProperties.set(s,{propertyNames:u})}t.push(i)}return t}let ct=class extends Ct{constructor(t){super(t)}};ct=l([R("esri.rest.knowledgeGraph.ObjectValue")],ct);const ei=ct;let Qe=class extends se{constructor(t){super(t),this.path=null}};l([p({type:[Ct],json:{write:!0}})],Qe.prototype,"path",void 0),Qe=l([R("esri.rest.knowledgeGraph.Path")],Qe);const ti=Qe;var Z;(function(e){e[e.ESRI_GEOMETRY_NULL=0]="ESRI_GEOMETRY_NULL",e[e.ESRI_GEOMETRY_POINT=1]="ESRI_GEOMETRY_POINT",e[e.ESRI_GEOMETRY_MULTIPOINT=2]="ESRI_GEOMETRY_MULTIPOINT",e[e.ESRI_GEOMETRY_POLYLINE=3]="ESRI_GEOMETRY_POLYLINE",e[e.ESRI_GEOMETRY_POLYGON=4]="ESRI_GEOMETRY_POLYGON",e[e.ESRI_GEOMETRY_ENVELOPE=5]="ESRI_GEOMETRY_ENVELOPE",e[e.ESRI_GEOMETRY_ANY=6]="ESRI_GEOMETRY_ANY",e[e.ESRI_GEOMETRY_MULTI_PATCH=7]="ESRI_GEOMETRY_MULTI_PATCH"})(Z||(Z={}));var he,At;(function(e){e[e.OBJECT=0]="OBJECT",e[e.ENTITY=1]="ENTITY",e[e.RELATIONSHIP=2]="RELATIONSHIP",e[e.PATH=3]="PATH",e[e.ARRAY=4]="ARRAY"})(he||(he={})),function(e){e[e.view=0]="view",e[e.edit=1]="edit"}(At||(At={}));function ri(e){const t={},r=It(e,t),i=e.lengths,n=e.coords,a=i[0];t.points=[];let o=0;for(let s=0;s<a;s++){const d=[];for(let u=0;u<r;u++)d[u]=n[o],o++;t.points.push(d)}return new Vt(t)}function ii(e){const t={};let r=2;It(e,t);const i=e.coords;return t.x=i[0],t.y=i[1],e.has_z&&(t.z=i[r],r++),e.has_m&&(t.m=i[r]),new Ge(t)}function ni(e){return new ye(hr(e))}function ai(e){return new Se(hr(e))}function hr(e){const t={},r=It(e,t),i=e.lengths,n=e.coords;let a="";if(e.geometry_type.value===Z.ESRI_GEOMETRY_POLYGON)a="rings";else{if(e.geometry_type.value!==Z.ESRI_GEOMETRY_POLYLINE)throw new _("KnowledgeGraph:illegal-geometry-type","Illegal Geometry type for multipath conversion");a="paths"}t[a]=[];let o=0;return i.forEach(s=>{const d=[];for(let u=0;u<s;u++){const c=[];for(let m=0;m<r;m++)c[m]=n[o],o++;d.push(c)}t[a].push(d)}),t}function It(e,t){let r=2;return e.has_z?(t.hasZ=e.has_z,r++):t.hasZ=!1,e.has_m?(t.hasM=e.has_m,r++):t.hasM=!1,r}const Fe=Ee.getLogger("esri.rest.knowledgeGraph.WasmToQueryResponseObjConstructors"),oi={decodedWasmObjToQueryResponseObj:(e,t)=>{if(e==null)return null;if(typeof e!="object"||"getDate"in e)return e;if("geometry_type"in e)switch(e.geometry_type.value){case null:return null;case Z.ESRI_GEOMETRY_POINT:return ii(e);case Z.ESRI_GEOMETRY_MULTIPOINT:return ri(e);case Z.ESRI_GEOMETRY_POLYLINE:return ni(e);case Z.ESRI_GEOMETRY_POLYGON:return ai(e);case Z.ESRI_GEOMETRY_ENVELOPE:case Z.ESRI_GEOMETRY_MULTI_PATCH:return Fe.warnOnce("Envelope and Multipatch are not supported on knowledge entities, but one of those geometry types was detected. Result interpreted as null"),null;case Z.ESRI_GEOMETRY_NULL:case Z.ESRI_GEOMETRY_ANY:default:return Fe.warnOnce("Unknown or blank geometry type returned - Result interpreted as null"),null}else{if(!("object_value_type"in e))return Fe.warnOnce("A decoded value came back of a type that is not supported. Result interpreted as null"),null;switch(e.object_value_type.value){case he.OBJECT:return li(e,t);case he.ENTITY:return cr(e,t);case he.RELATIONSHIP:return yr(e,t);case he.PATH:return pi(e,t);case he.ARRAY:return si(e,t);default:return Fe.warnOnce("Unknown graph object type detected! Result interpreted as null"),null}}}};function si(e,t){const r=[],i=e.count();for(let n=0;n<i;n++){const a=e.get_value_at(n);r.push(Lt(a,t))}return r}function Lt(e,t){return oi.decodedWasmObjToQueryResponseObj(e,t)}function cr(e,t){const r=e.type_name,i=vt(e,t),n=e.get_id();return new pr(Object.assign({typeName:r,id:n},i))}function vt(e,t){const r={},i=e.key_count();for(let n=0;n<i;n++)r[e.get_key_at(n)]=Lt(e.get_value_at(n),t);return{properties:r}}function li(e,t){return new ei(vt(e,t))}function pi(e,t){const r=e.entity_count(),i=e.relationship_count(),n=[];for(let a=0;a<r;a++)n.push(cr(e.get_entity_at(a),t)),a<i&&n.push(yr(e.get_relationship_at(a),t));return new ti({path:n})}function yr(e,t){const r=e.type_name,i=vt(e,t);return new dr(Object.assign({typeName:r,id:e.get_id(),originId:e.get_origin_entity_id(),destinationId:e.get_destination_entity_id()},i))}let be=class extends ke{constructor(t){super(t),this.hasError=null,this.error=null,this.editResults=[]}};l([p()],be.prototype,"hasError",void 0),l([p()],be.prototype,"error",void 0),l([p()],be.prototype,"editResults",void 0),be=l([R("esri.rest.knowledgeGraph.GraphApplyEdits")],be);const di=be;function ui(e){const t=new di;t.hasError=e.has_error(),t.hasError&&(t.error={errorCode:e.error.error_code,errorMessage:e.error.error_message});const r=e.get_edit_results_count();for(let i=0;i<r;i++){const n=e.get_edit_results_at(i),a=e.get_edit_results_type_name_at(i),o=[],s=[],d=[],u=n.get_add_results_count(),c=n.get_update_results_count(),m=n.get_delete_results_count();for(let g=0;g<u;g++){const h=n.get_add_result_at(g);o.push({id:h.id,error:{errorCode:h.error.error_code,errorMessage:h.error.error_message}})}for(let g=0;g<c;g++){const h=n.get_update_result_at(g);s.push({id:h.id,error:{errorCode:h.error.error_code,errorMessage:h.error.error_message}})}for(let g=0;g<m;g++){const h=n.get_delete_result_at(g);d.push({id:h.id,error:{errorCode:h.error.error_code,errorMessage:h.error.error_message}})}t.editResults.push({typeName:a,adds:o,updates:s,deletes:d})}return t}const Ne={fetchKnowledgeGraph:async e=>{const t=new Nr({url:e}),r=[];return r.push(Je(t)),r.push(ci(t)),await Promise.all(r),t},refreshDataModel:async e=>{e.dataModel=await mr(e)},refreshServiceDefinition:async e=>{var r,i;const t=(await ve(e.url,{query:{f:"json"}})).data;return t.capabilities=(r=t==null?void 0:t.capabilities)==null?void 0:r.split(","),t.supportedQueryFormats=(i=t==null?void 0:t.supportedQueryFormats)==null?void 0:i.split(","),e.serviceDefinition=new ar(t),e.serviceDefinition},executeQueryStreaming:async(e,t,r)=>{const i=`${e.url}/graph/query`;await et(e);const n=await tt(i,r);n.data.body=await fi(t,e);const a=await Xe(n.data.url,n.data);if(e.dataModel)return new Pt({resultRowsStream:await zt(a,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},executeApplyEdits:async(e,t,r)=>{var a;if((a=e.serviceDefinition)!=null&&a.dataEditingNotSupported)throw new _("knowledge-graph:data-editing-not-supported","The Knowledge Graph Service definition indicated that data editing is not supported");const i=`${e.url}/graph/applyEdits`;await et(e);const n=await tt(i,r);return n.data.body=await mi(t,e),wi(await Xe(n.data.url,n.data))},executeQuery:async(e,t,r)=>{var s;const i=`${e.url}/graph/query`,n=await ve(i,{responseType:"array-buffer",query:{f:"pbf",openCypherQuery:t.openCypherQuery,...r==null?void 0:r.query},signal:r==null?void 0:r.signal,timeout:r==null?void 0:r.timeout}),a=(s=n.getHeader)==null?void 0:s.call(n,"content-type"),o=n.data;if(a!=null&&a.includes("application/x-protobuf")){const d=new(await oe()).GraphQueryDecoder;if(d.deleteLater(),e.dataModel)return new Ft({resultRows:yt(d,o,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:a,data:n.data})},executeSearch:async(e,t,r)=>{var d;const i=t.typeCategoryFilter,n=`${e.url}/graph/search`,a=await ve(n,{responseType:"array-buffer",query:{f:"pbf",searchQuery:`"${t.searchQuery}"`,typeCategoryFilter:i,...r==null?void 0:r.query},signal:r==null?void 0:r.signal,timeout:r==null?void 0:r.timeout}),o=(d=a.getHeader)==null?void 0:d.call(a,"content-type"),s=a.data;if(o!=null&&o.includes("application/x-protobuf")){const u=new(await oe()).GraphQueryDecoder;if(u.deleteLater(),e.dataModel)return new Ft({resultRows:yt(u,s,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:o,data:a.data})},executeSearchStreaming:async(e,t,r)=>{const i=`${e.url}/graph/search`;await et(e);const n=await tt(i,r);n.data.body=await gi(t);const a=await Xe(n.data.url,n.data);if(e.dataModel)return new Pt({resultRowsStream:await zt(a,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},_fetchWrapper:async(e,t)=>fetch(e,t)};async function Ue(e,t,r){return Ne.executeQueryStreaming(e,t,r)}async function hi(e){return Ne.fetchKnowledgeGraph(e)}async function Je(e){return Ne.refreshDataModel(e)}async function ci(e){return Ne.refreshServiceDefinition(e)}async function Xe(e,t){return Ne._fetchWrapper(e,t)}async function et(e){var r;((r=wr)==null?void 0:r.findCredential(e.url))||(e.dataModel?await mr(e):await Je(e))}function xe(e,t,r){if(e.error_code!==0)throw new _(t,r,{errorCode:e.error_code,errorMessage:e.error_message})}function yi(e,t,r,i){t==null?r.set_param_key_value(e,""):typeof t!="object"||t instanceof Date?r.set_param_key_value(e,t):t instanceof Tt?r.set_param_key_value(e,Mt(t,i)):t instanceof Array?r.set_param_key_value(e,or(t,i)):r.set_param_key_value(e,sr(t,i))}async function mi(e,t){var o,s,d,u,c,m,g,h,E;if(t.dataModel||await Je(t),!t.dataModel)throw new _("knowledge-graph:data-model-undefined","Encoding could not proceed because a data model was not provided and it could not be determined from the service");const r=await oe(),i=!!((o=e.options)!=null&&o.cascadeDelete),n=new r.GraphApplyEditsEncoder(r.SpatialReferenceUtil.WGS84(),(s=e.options)!=null&&s.inputQuantizationParameters?zr((d=e.options)==null?void 0:d.inputQuantizationParameters):r.InputQuantizationUtil.WGS84_lossless());n.deleteLater(),n.cascade_delete=i;try{let w;(u=e.entityAdds)==null||u.forEach(y=>{w=n.add_entity($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),(c=e.relationshipAdds)==null||c.forEach(y=>{if(!y.originId||!y.destinationId)throw new _("knowledge-graph:relationship-origin-destination-missing","When adding a new relationship, you must provide both an origin and destination id on the appropriate class property");w=n.add_relationship($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),(m=e.entityUpdates)==null||m.forEach(y=>{if(!y.id)throw new _("knowledge-graph:entity-id-missing","When updating an entity or relationship, you must specify the id on the class level property");w=n.update_entity($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),(g=e.relationshipUpdates)==null||g.forEach(y=>{if(!y.id)throw new _("knowledge-graph:relationship-id-missing","When updating an entity or relationship, you must specify the id on the class level property");w=n.update_relationship($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),(h=e.entityDeletes)==null||h.forEach(y=>{var I;if(!y.typeName)throw new _("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const b=n.make_delete_helper(y.typeName,!0);b.deleteLater(),(I=y.ids)==null||I.forEach(Q=>{b.delete_by_id(Q)})}),(E=e.relationshipDeletes)==null||E.forEach(y=>{var I;if(!y.typeName)throw new _("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const b=n.make_delete_helper(y.typeName,!1);(I=y.ids)==null||I.forEach(Q=>{b.delete_by_id(Q)})}),n.encode()}catch(w){throw new _("knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed",{error:w})}const a=n.get_encoding_result();return xe(a.error,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed"),a.get_byte_buffer()}async function fi(e,t){var a,o;const r=await oe(),i=new r.GraphQueryRequestEncoder;if(i.deleteLater(),i.output_spatial_reference=r.SpatialReferenceUtil.WGS84(),i.open_cypher_query=e.openCypherQuery,e.bindParameters)for(const[s,d]of Object.entries(e.bindParameters))yi(s,d,i,r);if(e.bindGeometryQuantizationParameters)Fr(e.bindGeometryQuantizationParameters,i);else{if(t.dataModel||await Je(t),((o=(a=t.dataModel)==null?void 0:a.spatialReference)==null?void 0:o.wkid)!==4326)throw new _("knowledge-graph:SR-quantization-mismatch","If the DataModel indicates a coordinate system other than WGS84, inputQuantizationParameters must be provided to the query encoder");i.input_quantization_parameters=r.InputQuantizationUtil.WGS84_lossless()}e.outputQuantizationParameters&&Pr(e.outputQuantizationParameters,i,r);try{i.encode()}catch(s){throw new _("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{error:s})}const n=i.get_encoding_result();if(n.error.error_code!==0)throw new _("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{errorCode:n.error.error_code,errorMessage:n.error.error_message});return n.get_byte_buffer()}async function gi(e){var n;const t=await oe(),r=new t.GraphSearchRequestEncoder;if(r.deleteLater(),r.search_query=e.searchQuery,r.type_category_filter=t.esriNamedTypeCategory[e.typeCategoryFilter],e.returnSearchContext===!0&&(r.return_search_context=e.returnSearchContext),e.start!=null&&e.start>0&&(r.start_index=e.start),e.num!=null&&(r.max_num_results=e.num),e.idsFilter!=null&&Array.isArray(e.idsFilter)&&e.idsFilter.length>0)try{r.set_ids_filter(or(e.idsFilter,t))}catch(a){throw new _("knowledge-graph:ids-format-error","Attempting to set ids filter failed. This is usually caused by an incorrectly formatted UUID string",{error:a})}(n=e.namedTypesFilter)==null||n.forEach(a=>{r.add_named_type_filter(a)});try{r.encode()}catch(a){throw new _("knowledge-graph:search-encoding-failed","Attempting to encode the search failed",{error:a})}const i=r.get_encoding_result();if(i.error.error_code!==0)throw new _("knowledge-graph:search-encoding-failed","Attempting to get encoding result from the query failed",{errorCode:i.error.error_code,errorMessage:i.error.error_message});return i.get_byte_buffer()}async function tt(e,t){return ve(e,{responseType:"native-request-init",method:"post",query:{f:"pbf",...t==null?void 0:t.query},body:"x",headers:{"Content-Type":"application/octet-stream"},signal:t==null?void 0:t.signal,timeout:t==null?void 0:t.timeout})}async function wi(e){const t=e.headers.get("content-type");if(t!=null&&t.includes("application/x-protobuf")){const r=await e.arrayBuffer(),i=new(await oe()).GraphApplyEditsDecoder;return i.deleteLater(),i.decode(new Uint8Array(r)),ui(i)}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:t,data:e.text()})}function yt(e,t,r){e.push_buffer(new Uint8Array(t));const i=[];let n=0;for(;e.next_row();){n||(n=e.get_header_keys().size());const a=new Array(n);for(let o=0;o<n;o++){const s=e.get_value(o);a[o]=Lt(s,r)}i.push(a)}if(e.has_error())throw new _("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded",{errorCode:e.error.error_code,errorMessage:e.error.error_message});return i}async function zt(e,t){var i;const r=e.headers.get("content-type");if(e.headers.get("content-length")&&Ee.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").warnOnce("Found `Content-Length` header when expecting a streaming HTTP response! Please investigate whether all intermediate HTTP proxies and/or load balancers are configured such that they don't forcefully buffer the entire response before returning it to the client. A valid HTTP streaming response should use Chunked Transfer Encoding and not have a Content Length defined."),r==null?void 0:r.includes("application/x-protobuf")){const n=(i=e.body)==null?void 0:i.getReader(),a=new(await oe()).GraphQueryDecoder;return a.deleteLater(),new ReadableStream({async start(o){try{return s()}catch(d){n==null||n.releaseLock(),o.error(new _("knowledge-graph:stream-decoding-error","The server returned a valid response, but there was an error decoding the response stream",{error:d})),o.close()}function s(){return n==null?void 0:n.read().then(({done:d,value:u})=>{if(d){let m;if(a.has_error()&&(m=new _("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded",{errorCode:a.error.error_code,errorMessage:a.error.error_message})),n.releaseLock(),m)throw o.error(m),m;return void o.close()}const c=yt(a,u,t);return c.length>0&&o.enqueue(c),s()})}}})}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:r,data:e.text()})}async function mr(e){var a;const t=`${e.url}/dataModel/queryDataModel`,r=await ve(t,{responseType:"array-buffer",query:{f:"pbf"}}),i=(a=r.getHeader)==null?void 0:a.call(r,"content-type"),n=r.data;if(i!=null&&i.includes("application/x-protobuf")){const o=(await oe()).decode_data_model_from_protocol_buffer(new Uint8Array(n));if(!o)throw new _("knowledge-graph:data-model-decode-failure","The server responded to the data model query, but the response failed to be decoded. This typically occurs when the Knowledge JS API (4.26 or later) is used with an unsupported backend (11.0 or earlier)");return Ur(o)}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:i,data:r.data})}let qe=class extends ke{constructor(t){super(t),this.openCypherQuery=""}};l([p()],qe.prototype,"openCypherQuery",void 0),qe=l([R("esri.rest.knowledgeGraph.GraphQuery")],qe);const _i=qe;let Te=class extends _i{constructor(t){super(t),this.bindParameters=null,this.bindGeometryQuantizationParameters=null,this.outputQuantizationParameters=null}};l([p()],Te.prototype,"bindParameters",void 0),l([p()],Te.prototype,"bindGeometryQuantizationParameters",void 0),l([p()],Te.prototype,"outputQuantizationParameters",void 0),Te=l([R("esri.rest.knowledgeGraph.GraphQueryStreaming")],Te);const Le=Te;function bi(e){if(!e.spatialReference.isWGS84)throw new _("knowledge-graph:layer-support-utils","The extentToInBoundsRings function only supports WGS84 spatial references.");let t;return t=e.xmax>180&&e.xmin<180?[[[e.xmin,e.ymin],[e.xmin,e.ymax],[180,e.ymax],[180,e.ymin],[e.xmin,e.ymin]],[[-180,e.ymin],[-180,e.ymax],[e.xmax-360,e.ymax],[e.xmax-360,e.ymin],[-180,e.ymin]]]:e.xmax>180&&e.xmin>180?[[[e.xmin-360,e.ymin],[e.xmin-360,e.ymax],[e.xmax-360,e.ymax],[e.xmax-360,e.ymin],[e.xmin-360,e.ymin]]]:e.xmax>-180&&e.xmin<-180?[[[e.xmin+360,e.ymin],[e.xmin+360,e.ymax],[180,e.ymax],[180,e.ymin],[e.xmin+360,e.ymin]],[[-180,e.ymin],[-180,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[-180,e.ymin]]]:e.xmax<-180&&e.xmin<-180?[[[e.xmin+360,e.ymin],[e.xmin+360,e.ymax],[e.xmax+360,e.ymax],[e.xmax+360,e.ymin],[e.xmin+360,e.ymin]]]:[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]],t}async function Ti(e,t){var a,o;const r=[],i=new Map,n=[];if((a=t.dataModel)!=null&&a.relationshipTypes)for(const s of t.dataModel.relationshipTypes)s.name&&i.set(s.name,[]);for(const s of e)i.has(s.typeName)&&((o=i.get(s.typeName))==null||o.push(s.id));for(const[s,d]of i){if(d.length<1)continue;const u=new Le({openCypherQuery:`MATCH (n)-[r:${s}]->(m) WHERE id(r) in $ids RETURN id(n), labels(n)[0], id(m), labels(m)[0]`,bindParameters:{ids:d}});n.push(Ue(t,u).then(async c=>{const m=c.resultRowsStream.getReader();for(;;){const{done:g,value:h}=await m.read();if(g)break;for(const E of h)r.push({id:E[0],typeName:E[1]}),r.push({id:E[2],typeName:E[3]})}}))}return await Promise.all(n),r}const D="ESRI__ID",Ce="ESRI__ORIGIN_ID",rt="ESRI__DESTINATION_ID",O="ESRI__LAYOUT_GEOMETRY",ce=12,Qt=Ee.getLogger("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager");let te=class extends ke{constructor(t){var i,n,a;super(t),this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.memberIdTypeLookup=new Map,this._processingCacheUpdatesLookup=new Map;const r=new Map;(i=t.knowledgeGraph.dataModel.entityTypes)==null||i.forEach(o=>{var s,d;o.name&&(r.set(o.name,"entity"),this._processingCacheUpdatesLookup.set(o.name,[]),t.inclusionModeDefinition&&!((s=t.inclusionModeDefinition)!=null&&s.generateAllSublayers)||this.entityTypeNames.add(o.name),(d=o.properties)==null||d.forEach(u=>{u.geometryType&&u.geometryType!=="esriGeometryNull"&&this.geographicLookup.set(o.name,{name:u.name??"",geometryType:u.geometryType})}))}),(n=t.knowledgeGraph.dataModel.relationshipTypes)==null||n.forEach(o=>{var s,d;o.name&&(r.set(o.name,"relationship"),this._processingCacheUpdatesLookup.set(o.name,[]),t.inclusionModeDefinition&&!((s=t.inclusionModeDefinition)!=null&&s.generateAllSublayers)||this.relationshipTypeNames.add(o.name),(d=o.properties)==null||d.forEach(u=>{u.geometryType&&u.geometryType!=="esriGeometryNull"&&this.geographicLookup.set(o.name,{name:u.name??"",geometryType:u.geometryType})}))}),(a=t.inclusionModeDefinition)==null||a.namedTypeDefinitions.forEach((o,s)=>{var u,c;if(r.get(s)==="entity")this.entityTypeNames.add(s);else{if(r.get(s)!=="relationship")return Qt.warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void((u=t.inclusionModeDefinition)==null?void 0:u.namedTypeDefinitions.delete(s));this.relationshipTypeNames.add(s)}const d=new Map;(c=o.members)==null||c.forEach(m=>{this.memberIdTypeLookup.set(m.id,s);const g=this.getById(m.id);g&&d.set(m.id,g)}),this.sublayerCaches.set(s,d)})}addToLayer(t){t.forEach(({typeName:r,id:i})=>{if(!this.inclusionModeDefinition)throw new _("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(r)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(r)){const n=this.inclusionModeDefinition.namedTypeDefinitions.get(r);n.members||(n.members=new Map),n.members.set(i,{id:i}),this.memberIdTypeLookup.set(i,r)}}else{const n=new Map;n.set(i,{id:i}),this.inclusionModeDefinition.namedTypeDefinitions.set(r,{useAllData:!1,members:n}),this.memberIdTypeLookup.set(i,r)}})}getById(t){return Ke.getInstance().readFromStoreById(t)}async getData(t,r,i){var a,o;if(r.objectType.name&&((a=this.inclusionModeDefinition)!=null&&a.namedTypeDefinitions)&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(r.objectType.name))return[];let n;if(n=t||new ge({where:"1=1",outFields:["*"]}),r.parentCompositeLayer.type==="link-chart"){const s=r.parentCompositeLayer,d=this._processingCacheUpdatesLookup.get(r.objectType.name??""),u=n.outFields,c=n.geometry;let m="",g="";c&&c.extent&&(m=ue(c.extent.ymin,c.extent.xmin,ce),g=ue(c.extent.ymax,c.extent.xmax,ce)),u&&u.length===1&&u[0]===D&&n.where==="1=1"||await Promise.all(d??[]);const h=this.sublayerCaches.has(r.objectType.name??"")?Array.from((o=this.sublayerCaches.get(r.objectType.name))==null?void 0:o.values()):[],E=[];return h.forEach(w=>{if(w.geometry=s.linkChartDiagramLookup.get(w.attributes[r.objectIdField]),w.attributes[O]=w.geometry,m&&g){const y=s.linkChartGeohashLookup.get(w.attributes[r.objectIdField]);y?y>=m&&y<=g&&E.push(w):E.push(w)}else E.push(w)}),E}return this.retrieveDataFromService(n,r,i)}async getConnectedRecordIds(t){const r=[],i=[],n=new Map;return t.forEach(a=>{var o;if(this.memberIdTypeLookup.has(a)){const s=this.memberIdTypeLookup.get(a);if(!this.entityTypeNames.has(s))return;n.has(s)?(o=n.get(s))==null||o.push(a):n.set(s,[a])}}),n.forEach((a,o)=>{const s=`MATCH (n:${o})-[r]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`,d=new Promise(u=>{(async()=>{const c=(await Ue(this.knowledgeGraph,new Le({openCypherQuery:s,bindParameters:{ids:a}}))).resultRowsStream.getReader();try{for(;;){const{done:m,value:g}=await c.read();if(m)break;for(let h=0;h<g.length;h++){const E=g[h];r.push({id:E[0],typeName:E[1]}),r.push({id:E[2],typeName:E[3]})}}}catch(m){if(m.name!=="AbortError")throw m;Qt.info("Request aborted as expected")}})().then(()=>{u()})});i.push(d)}),await Promise.all(i),r}async refreshCacheContent(t,r,i,n=!0){var u,c,m,g,h,E,w;const a=Ke.getInstance(),o=[],s=new Map,d=new Map;(u=this.knowledgeGraph.dataModel.entityTypes)==null||u.forEach(y=>{y.name&&d.set(y.name,y)}),(c=this.knowledgeGraph.dataModel.relationshipTypes)==null||c.forEach(y=>{y.name&&d.set(y.name,y)}),t||this.inclusionModeDefinition?t?t.forEach(y=>{var b;if(this.memberIdTypeLookup.has(y)){const I=this.memberIdTypeLookup.get(y);s.has(I)?(b=s.get(I))==null||b.push(y):s.set(I,[y])}}):(g=(m=this.inclusionModeDefinition)==null?void 0:m.namedTypeDefinitions)==null||g.forEach((y,b)=>{y.useAllData?s.set(b,null):y.members&&y.members.forEach(I=>{var Q;s.has(b)&&s.get(b)!==null?(Q=s.get(b))==null||Q.push(I.id):s.set(b,[I.id])})}):((h=this.knowledgeGraph.dataModel.entityTypes)==null||h.forEach(y=>{y.name&&s.set(y.name,null)}),(E=this.knowledgeGraph.dataModel.entityTypes)==null||E.forEach(y=>{y.name&&s.set(y.name,null)}));for(const[y,b]of s){const I=new Promise(Q=>{(async()=>{var K,M,S,B,Me,N,C;const J=new Set,X=[];let f,x="",L=!1;if(r||((M=(K=d.get(y))==null?void 0:K.properties)==null||M.forEach(G=>{G.name&&J.add(G.name)})),i&&this.geographicLookup.has(y)){const G=(S=this.geographicLookup.get(y))==null?void 0:S.name;G&&J.add(G)}if(this.entityTypeNames.has(y))x=`MATCH (n:${y}) ${b?"WHERE id(n) IN $ids ":""}return ID(n)`,J.forEach(G=>{x+=`, n.${G}`,X.push(G)});else{if(!this.relationshipTypeNames.has(y))throw new _("knowledge-graph:layer-data-manager",`The graph type of ${y} could not be determined. Was this type set in the KG data model and inclusion definition?`);L=!0,x=`MATCH ()-[n:${y}]->() ${b?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,J.forEach(G=>{x+=`, n.${G}`,X.push(G)})}f=new Le(b?{openCypherQuery:x,bindParameters:{ids:b}}:{openCypherQuery:x});const ee=(await Ue(this.knowledgeGraph,f)).resultRowsStream.getReader();for(;;){const{done:G,value:U}=await ee.read();if(G)break;const z=[];for(let v=0;v<U.length;v++){const T=U[v];let A=0,W=0;const ie={properties:{}};for(ie.id=T[A],A++,W++,L&&(ie.originId=T[A],A++,W++,ie.destinationId=T[A],A++,W++,Gt(this.nodeConnectionsLookup,ie.originId,()=>new Set).add(ie.id),Gt(this.nodeConnectionsLookup,ie.destinationId,()=>new Set).add(ie.id));A<T.length;A++)ie.properties[X[A-W]]=T[A];z.push(ie)}const F=a.writeToStore(z,D,(B=this.geographicLookup.get(y))==null?void 0:B.name);this.sublayerCaches.has(y)||this.sublayerCaches.set(y,new Map),n&&!((Me=this.inclusionModeDefinition)!=null&&Me.namedTypeDefinitions.has(y))&&((N=this.inclusionModeDefinition)==null||N.namedTypeDefinitions.set(y,{useAllData:!1,members:new Map})),n&&!((C=this.inclusionModeDefinition)!=null&&C.namedTypeDefinitions.get(y).members)&&(this.inclusionModeDefinition.namedTypeDefinitions.get(y).members=new Map);const j=this.sublayerCaches.get(y);F.forEach(v=>{var T,A;j==null||j.set(v.attributes[D],v),n&&!((T=this.inclusionModeDefinition)!=null&&T.namedTypeDefinitions.get(y).members.has(v.attributes[D]))&&((A=this.inclusionModeDefinition)==null||A.namedTypeDefinitions.get(y).members.set(v.attributes[D],{id:v.attributes[D]}),this.memberIdTypeLookup.set(v.attributes[D],y))})}})().then(()=>{Q(null)})});o.push(I),(w=this._processingCacheUpdatesLookup.get(y))==null||w.push(I)}await Promise.all(o)}removeFromLayer(t){var n;const r=new Set,i=new Set(t.map(a=>a.id));for(const a of t)r.add(a.typeName),this.memberIdTypeLookup.delete(a.id),(n=this.inclusionModeDefinition)==null||n.namedTypeDefinitions.forEach(o=>{var s;(s=o.members)!=null&&s.has(a.id)&&o.members.delete(a.id)});r.forEach(a=>{var o;(o=this.sublayerCaches.get(a))==null||o.forEach((s,d)=>{var u;i.has(d)&&((u=this.sublayerCaches.get(a))==null||u.delete(d))})})}async retrieveDataFromService(t,r,i){var w,y,b,I,Q,k,J,X,f,x,L,ee,K,M,S,B,Me;const n=Ke.getInstance(),a=new Set,o=[];let s,d="",u=[];const c=r.graphType==="relationship",m=(b=(y=(w=this.inclusionModeDefinition)==null?void 0:w.namedTypeDefinitions)==null?void 0:y.get(r.objectType.name))==null?void 0:b.useAllData,g=r.parentCompositeLayer.sublayerIdsCache.get(r.objectType.name);let h=!m&&g?Array.from(g).sort():null;if((k=(Q=(I=this.inclusionModeDefinition)==null?void 0:I.namedTypeDefinitions)==null?void 0:Q.get(r.objectType.name))!=null&&k.useAllData)(f=(X=(J=this.inclusionModeDefinition)==null?void 0:J.namedTypeDefinitions)==null?void 0:X.get(r.objectType.name))!=null&&f.useAllData&&t.objectIds!=null&&(h=t.objectIds);else if(t.objectIds!=null&&h&&h.length>0){const N=t.objectIds;t.objectIds=h.filter(C=>N.includes(C))}else if(t.objectIds!=null)h=t.objectIds;else{if((x=this.inclusionModeDefinition)!=null&&x.namedTypeDefinitions.has(r.objectType.name)&&(!((L=this.inclusionModeDefinition.namedTypeDefinitions.get(r.objectType.name))!=null&&L.members)||((K=(ee=this.inclusionModeDefinition.namedTypeDefinitions.get(r.objectType.name))==null?void 0:ee.members)==null?void 0:K.size)<1))return t.objectIds=[],[];t.objectIds=h}if(t.outFields!=null){const N=t.outFields;N.includes("*")?r.fields.forEach(C=>{a.add(C.name)}):N.forEach(C=>{C!==D&&C!==r.geometryFieldName&&a.add(C)})}if(t.geometry!=null){const N=t.geometry;let C;const G=r.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,U=G==null?void 0:G.spatialReference,z=(M=G==null?void 0:G.serviceCapabilities)==null?void 0:M.geometryCapabilities;let F=z==null?void 0:z.geometryMaxBoundingRectangleSizeX,j=z==null?void 0:z.geometryMaxBoundingRectangleSizeY;if((S=N==null?void 0:N.extent)!=null&&S.spatialReference&&!((B=N.spatialReference)!=null&&B.isWGS84)?(await Kt(N.extent.spatialReference,De),C=st(N.extent,De)):C=N.extent,F&&j&&U){if(U.wkid!==4326){const v=new Re({spatialReference:U,xmax:F,ymax:j}),T=st(v,De);F=T.xmax,j=T.ymax}if(C.xmax-C.xmin>F)throw new _("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${F}° latitude, limit exceeded`);if(C.ymax-C.ymin>j)throw new _("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${j}° longitude, limit exceeded`)}if(t.where!=null&&t.where!=="1=1"){const v=await Dt(t.where.toUpperCase(),r.fieldsIndex);r.fields.forEach(T=>{v.fieldNames.includes(T.name)&&a.add(T.name)})}d=c?`Match ()-[n:${r.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${r.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${r.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${r.geometryFieldName}) return ID(n)`,r.geometryFieldName&&a.add(r.geometryFieldName),a.forEach(v=>{d+=`, n.${v}`,o.push(v)}),s=new Le({openCypherQuery:d,bindParameters:{param_filter_geom:new Se({rings:bi(C)})}})}else{let N="";if(t.where!=null&&t.where!=="1=1"){const U=await Dt(t.where,r.fieldsIndex);r.fields.forEach(T=>{U.fieldNames.includes(T.name)&&a.add(T.name)});const z=new Set(["column-reference","string","number","binary-expression"]),F=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let j=!1;const v=T=>{if(T.type==="column-reference")return`n.${T.column}`;if(T.type==="string")return`'${T.value}'`;if(T.type==="number")return`${T.value}`;if(T.type==="binary-expression"&&z.has(T.left.type)&&z.has(T.right.type)&&F.has(T.operator))return`${v(T.left)} ${T.operator} ${v(T.right)}`;if(T.type==="binary-expression"&&T.operator==="LIKE"){let A="";if(T.left.type==="function"&&T.left.args.value[0].type==="column-reference")A+=`lower(n.${T.left.args.value[0].column})`;else{if(T.left.type!=="column-reference")return j=!0,"";A+=`lower(n.${T.left.column})`}if(A+=" CONTAINS (",T.right.type!=="string")return j=!0,"";{let W=T.right.value;W.charAt(0)==="%"&&(W=W.slice(1)),W.charAt(W.length-1)==="%"&&(W=W.slice(0,-1)),A+=`'${W.toLowerCase()}')`}return A}return j=!0,""};N=v(U.parseTree),j&&(N="")}let C="";C=c?`Match ()-[n:${r.objectType.name}]->()`:`Match (n:${r.objectType.name})`;let G=!1;h&&(G=!0,C+=" WHERE ID(n) IN $ids"),N&&(C+=G?" AND":" WHERE",C+=` ${N}`),C+=" return ID(n)",c&&(C+=", id(startNode(n)), id(endNode(n))"),t.returnGeometry&&r.geometryFieldName&&a.add(r.geometryFieldName),a.forEach(U=>{C+=`, n.${U}`,o.push(U)}),s=new Le(h?{openCypherQuery:C,bindParameters:{ids:h}}:{openCypherQuery:C})}const E=(await Ue(r.parentCompositeLayer.dataManager.knowledgeGraph,s,i)).resultRowsStream.getReader();for(;;){const{done:N,value:C}=await E.read();if(N)break;const G=[];for(let U=0;U<C.length;U++){const z=C[U];let F=0,j=0;const v={properties:{}};for(v.id=z[F],F++,j++,c&&(v.originId=z[F],F++,j++,v.destinationId=z[F],F++,j++);F<z.length;F++)v.properties[o[F-j]]=z[F];G.push(v)}u=u.concat(n.writeToStore(G,D,(Me=r.parentCompositeLayer.dataManager.geographicLookup.get(r.objectType.name))==null?void 0:Me.name))}return u}};l([p()],te.prototype,"knowledgeGraph",void 0),l([p()],te.prototype,"inclusionModeDefinition",void 0),l([p()],te.prototype,"entityTypeNames",void 0),l([p()],te.prototype,"relationshipTypeNames",void 0),l([p()],te.prototype,"geographicLookup",void 0),l([p()],te.prototype,"sublayerCaches",void 0),l([p()],te.prototype,"nodeConnectionsLookup",void 0),l([p()],te.prototype,"memberIdTypeLookup",void 0),te=l([R("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager")],te);const Ut=_r(),Ei=e=>{let t=class extends e{constructor(){super(...arguments),this.fields=[],this.fieldsIndex=null}};return l([p(Ut.fields)],t.prototype,"fields",void 0),l([p(Ut.fieldsIndex)],t.prototype,"fieldsIndex",void 0),t=l([R("esri.layers.knowledgeGraphLayer.KnowledgeGraphSublayerBase")],t),t};let $=class extends br(Ei(Zt(Xt(Tr(er))))){constructor(e){var t,r,i,n,a;if(super(e),this.capabilities=Gr(!1,!1),this.definitionExpression="",this.displayField="",this.elevationInfo=null,this.geometryType=null,this.geometryFieldName=null,this.graphType=null,this.hasM=!1,this.hasZ=!1,this.labelsVisible=null,this.labelingInfo=null,this.objectIdField=D,this.objectType=null,this.parentCompositeLayer=null,this.popupTemplate=null,this.source={openPorts:()=>this.load().then(()=>{const o=new MessageChannel;return new Er(o.port1,{channel:o,client:{queryFeatures:(s,d={})=>{const u=ge.fromJSON(s);return this.queryFeaturesJSON(u,d)}}}),[o.port2]})},this.type="knowledge-graph-sublayer",e.parentCompositeLayer.type==="link-chart")e.graphType==="relationship"?this.geometryType="polyline":this.geometryType="point",this.geometryFieldName=O;else if((t=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name))!=null&&t.geometryType&&((r=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name))==null?void 0:r.geometryType)!=="esriGeometryNull"){const o=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name);this.geometryFieldName=(o==null?void 0:o.name)??null,this.geometryType=o!=null&&o.geometryType?me.fromJSON(o.geometryType):null;const s=o==null?void 0:o.name,d=s?(i=e.objectType.properties)==null?void 0:i[s]:null;d?(this.hasM=d.hasM??!1,this.hasZ=d.hasZ??!1):(this.hasM=!1,this.hasZ=!1)}else this.geometryType=null;(n=e.objectType.properties)==null||n.forEach(o=>{let s=null,d=o.fieldType;d==="esriFieldTypeOID"&&(d="esriFieldTypeInteger"),this.fields.push(Rt.fromJSON({name:o.name,type:d,alias:o.alias,defaultValue:s,editable:o.editable,nullable:o.nullable}))}),this.fields.push(Rt.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1})),this._set("fields",[...this.fields]),(a=e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel)!=null&&a.spatialReference&&(this.spatialReference=e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel.spatialReference),e.parentCompositeLayer.type==="link-chart"?e.graphType==="relationship"?this.renderer=We(Ve(me.toJSON("polyline")).renderer):this.renderer=We(Ve(me.toJSON("point")).renderer):this.renderer=We(Ve(me.toJSON(this.geometryType)).renderer)}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){kr(e,this.fieldsIndex),this._set("renderer",e)}createPopupTemplate(e){return Mr(this,e)}createQuery(){return new ge({where:"1=1",outFields:["*"]})}getField(e){for(let t=0;t<this.fields.length;t++)if(this.fields[t].name===e)return this.fields[t];throw new Error("Field not found")}getFieldDomain(e,t){return null}async queryFeatures(e,t){const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e),n=xr.fromJSON(await i.executeQuery(r.toJSON(),t==null?void 0:t.signal));return n.features.forEach(a=>{a.sourceLayer=this}),n}async queryFeaturesJSON(e,t){const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return await i.executeQuery(r.toJSON(),t==null?void 0:t.signal)}async queryFeatureCount(e,t){const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return i.executeQueryForCount(r.toJSON(),t==null?void 0:t.signal)}async queryExtent(e={},t){var s,d,u,c;const r={...e,returnGeometry:!0},{resolvedQuery:i,queryEngine:n}=await this._setupQueryObjects(r),a=await n.executeQueryForExtent(i.toJSON(),t==null?void 0:t.signal);let o;return o=((s=a.extent)==null?void 0:s.xmin)!=null&&((d=a.extent)==null?void 0:d.xmax)!=null&&((u=a.extent)==null?void 0:u.ymin)!=null&&((c=a.extent)==null?void 0:c.ymax)!=null?new Re(a.extent):new Re,{count:a.count,extent:o}}async queryObjectIds(e,t){const r=ge.from(e);let i;if(this.parentCompositeLayer.type==="link-chart"&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const n=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(n)}return i.executeQueryForIds(r.toJSON(),t==null?void 0:t.signal)}loadQueryEngine(e){const t=new vr({geometryType:me.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new Dr({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:me.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:null,featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new ge({where:"1=1",outFields:[D]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}async _setupQueryObjects(e,t){var a;const r=ge.from(e),i=r.geometry;let n;if(i&&!((a=i.spatialReference)!=null&&a.isWGS84)&&(await Kt(i.spatialReference,De),r.geometry=st(i instanceof Se||i instanceof ye?i:i.extent,De)),this.parentCompositeLayer.type==="link-chart"&&this._cachedQueryEngine)n=this._cachedQueryEngine;else{const o=await this.parentCompositeLayer.dataManager.getData(r,this,t);n=this.loadQueryEngine(o)}return{resolvedQuery:r,queryEngine:n}}};l([p()],$.prototype,"capabilities",void 0),l([p({readOnly:!0})],$.prototype,"defaultPopupTemplate",null),l([p()],$.prototype,"definitionExpression",void 0),l([p()],$.prototype,"displayField",void 0),l([p()],$.prototype,"elevationInfo",void 0),l([p()],$.prototype,"geometryType",void 0),l([p()],$.prototype,"geometryFieldName",void 0),l([p()],$.prototype,"graphType",void 0),l([p()],$.prototype,"hasM",void 0),l([p()],$.prototype,"hasZ",void 0),l([p()],$.prototype,"labelsVisible",void 0),l([p()],$.prototype,"labelingInfo",void 0),l([p()],$.prototype,"objectIdField",void 0),l([p()],$.prototype,"objectType",void 0),l([p()],$.prototype,"parentCompositeLayer",void 0),l([p({type:Cr,json:{name:"popupInfo",write:!0}})],$.prototype,"popupTemplate",void 0),l([p({types:Ir,json:{write:{target:"layerDefinition.drawingInfo.renderer"}}})],$.prototype,"renderer",null),l([p()],$.prototype,"source",void 0),l([p({json:{read:!1}})],$.prototype,"type",void 0),$=l([R("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],$);const it=$;let nt,H=null;function ki(){return nt||(nt=at(()=>import("./lclayout-79c01695.js"),["assets/lclayout-79c01695.js","assets/index-b5c8f851.js","assets/index-86716609.css"]).then(e=>e.l).then(({default:e})=>e({locateFile:t=>ot(`esri/libs/linkchartlayout/${t}`)})).then(e=>{Mi(e)}),nt)}function Mi(e){H=e}var re;function fe(e,t,r,i,n,a){const o=r.length,s=n.length,d=Float64Array.BYTES_PER_ELEMENT,u=Uint32Array.BYTES_PER_ELEMENT,c=Uint8Array.BYTES_PER_ELEMENT,m=16,g=m-1+o*(c+2*d)+s*(2*u),h=H._malloc(g);try{const E=h+m-h%m,w=E+o*d,y=w+o*d,b=y+s*u,I=b+s*u,Q=()=>[H.HEAPF64.subarray(E>>3,(E>>3)+o),H.HEAPF64.subarray(w>>3,(w>>3)+o),H.HEAPU32.subarray(y>>2,(y>>2)+s),H.HEAPU32.subarray(b>>2,(b>>2)+s),H.HEAPU8.subarray(I,I+o)],[k,J,X,f,x]=Q();k.set(r),J.set(i),X.set(n),f.set(a),x.set(t);const L=e(o,I,E,w,s,y,b),[ee,K,M,S,B]=Q();return r.set(ee),i.set(K),n.set(M),a.set(S),t.set(B),L}finally{H._free(h)}}(function(e){e[e.None=0]="None",e[e.IsMovable=1]="IsMovable",e[e.IsGeographic=2]="IsGeographic",e[e.IsRoot=4]="IsRoot"})(re||(re={}));const qt=2,Yt=1,Bt=-1;var mt,ft,gt,wt,_t,bt,Ht,Jt;(function(e){function t(){return H.getMinIdealEdgeLength()}function r(i,n,a,o,s,d=qt,u=Yt,c=Bt){return fe((m,g,h,E,w,y,b)=>H.applyForceDirectedLayout(m,g,h,E,w,y,b,d,u,c),i,n,a,o,s)}e.getMinIdealEdgeLength=t,e.apply=r})(mt||(mt={})),function(e){function t(r,i,n,a,o,s=qt,d=Yt,u=Bt){return fe((c,m,g,h,E,w,y)=>H.applyCommunityLayout(c,m,g,h,E,w,y,s,d,u),r,i,n,a,o)}e.apply=t}(ft||(ft={})),function(e){function t(r,i,n,a,o){return fe(H.applySimpleLayout,r,i,n,a,o)}e.apply=t}(gt||(gt={})),function(e){function t(r,i,n,a,o){return fe(H.applyHierarchicalLayout,r,i,n,a,o)}e.apply=t}(wt||(wt={})),function(e){function t(r,i,n,a,o){return fe(H.applyRadialTreeLayout,r,i,n,a,o)}e.apply=t}(_t||(_t={})),function(e){function t(r,i,n,a,o){return fe(H.applySmartTreeLayout,r,i,n,a,o)}e.apply=t}(bt||(bt={})),function(e){e[e.Undirected=0]="Undirected",e[e.Directed=1]="Directed",e[e.Reversed=2]="Reversed"}(Ht||(Ht={})),function(e){e[e.ByCC_Raw=0]="ByCC_Raw",e[e.ByCC_NormalizeGlobally=1]="ByCC_NormalizeGlobally",e[e.ByCC_NormalizeByCC=2]="ByCC_NormalizeByCC"}(Jt||(Jt={}));const xi=(e,t,r)=>(e.has(t)||e.set(t,r()),e.get(t));let Y=class extends Zt(Xt(er)){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE",xScaleFactor:1,yScaleFactor:1},this._graphTypeLookup=new Map,this.knowledgeGraph=null,this.layers=new St,this.linkChartDiagramLookup=new Map,this.linkChartExtent=new Re({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.linkChartGeohashLookup=new Map,this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new St,this.type="link-chart",this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new _("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){var a,o,s,d,u,c;if(!this.title&&this.url){const m=this.url.split("/");this.title=m[m.length-2]}const t=new Set;let r=[],i=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new _("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");(a=e.knowledgeGraph.dataModel.entityTypes)==null||a.forEach(m=>{m.name&&this._graphTypeLookup.set(m.name,m)}),(o=e.knowledgeGraph.dataModel.relationshipTypes)==null||o.forEach(m=>{m.name&&this._graphTypeLookup.set(m.name,m)}),(s=e.inclusionModeDefinition)!=null&&s.generateAllSublayers?(r=e.knowledgeGraph.dataModel.entityTypes??[],i=e.knowledgeGraph.dataModel.relationshipTypes??[]):(d=e.inclusionModeDefinition)!=null&&d.namedTypeDefinitions&&((u=e.inclusionModeDefinition)==null?void 0:u.namedTypeDefinitions.size)>0?(c=e.inclusionModeDefinition)==null||c.namedTypeDefinitions.forEach((m,g)=>{var h,E;if(!this._graphTypeLookup.get(g))return Ee.getLogger(this).warn(`A named type, ${g}, was in the inclusion list that wasn't in the data model and will be removed`),void((h=e.inclusionModeDefinition)==null?void 0:h.namedTypeDefinitions.delete(g));this._graphTypeLookup.get(g)instanceof kt||"strictOrigin"in this._graphTypeLookup.get(g)?t.has(g)||(t.add(g),i.push(this._graphTypeLookup.get(g))):this._graphTypeLookup.get(g)instanceof Et||"properties"in this._graphTypeLookup.get(g)?t.has(g)||(t.add(g),r.push(this._graphTypeLookup.get(g))):(Ee.getLogger(this).warn(`A named type, ${g}, was in the inclusion list that wasn't properly modeled and will be removed`),(E=e.inclusionModeDefinition)==null||E.namedTypeDefinitions.delete(g))}):(r=e.knowledgeGraph.dataModel.entityTypes??[],i=e.knowledgeGraph.dataModel.relationshipTypes??[]);const n=new te({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=r,this.memberRelationshipTypes=i,this.dataManager=n}load(e){return this.addResolvingPromise(new Promise(t=>{hi(this.url).then(r=>{var i,n,a,o,s,d;if(this._initializeLayerProperties({knowledgeGraph:r,inclusionModeDefinition:this._originalInclusionList}),(n=(i=this.dataManager.inclusionModeDefinition)==null?void 0:i.namedTypeDefinitions)!=null&&n.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},(a=this.dataManager.knowledgeGraph.dataModel.entityTypes)==null||a.forEach(u=>{var c;u.name&&((c=this.dataManager.inclusionModeDefinition)==null||c.namedTypeDefinitions.set(u.name,{useAllData:!0}))}),(o=this.dataManager.knowledgeGraph.dataModel.relationshipTypes)==null||o.forEach(u=>{var c;u.name&&((c=this.dataManager.inclusionModeDefinition)==null||c.namedTypeDefinitions.set(u.name,{useAllData:!0}))})),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),(s=this.dataManager.inclusionModeDefinition)==null||s.namedTypeDefinitions.forEach(u=>{var c;u.useAllData=!1,(c=u.members)==null||c.forEach(m=>{let g;g=m.linkChartLocation instanceof $t?m.linkChartLocation:m.linkChartLocation?le(m.linkChartLocation):null,this.linkChartDiagramLookup.set(m.id,g),g&&g.coords.length===2&&g.lengths.length===0?this.linkChartGeohashLookup.set(m.id,ue(g.coords[1],g.coords[0],ce)):this.linkChartGeohashLookup.set(m.id,"")}),this.addResolvingPromise(this._initializeDiagram().then(async()=>{this.layers.forEach(async m=>{await m.refreshCachedQueryEngine()}),this.tables.forEach(async m=>{await m.refreshCachedQueryEngine()})}))});else{const u=((d=this.defaultLinkChartConfig)==null?void 0:d.layoutMode)==="GEOGRAPHIC";this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,u,!0).then(async()=>{Lr(e);const c=[],m=[];this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach(g=>{g.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach(g=>{m.push(g.refreshCachedQueryEngine()),c.push(new Promise(h=>{g.on("layerview-create",()=>{h(null)})}))}),this.tables.forEach(g=>{m.push(g.refreshCachedQueryEngine())}),await Promise.all(m)}))}t(null)})})),Promise.resolve(this)}async addRecords(e,t){let r=[];t!=null&&t.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(r=await Ti(e,this.dataManager.knowledgeGraph));const i=e.concat(r).filter(n=>{var a;return!((a=this.sublayerIdsCache.get(n.typeName))!=null&&a.has(n.id))});await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:r=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){var a,o,s,d,u,c,m,g;let i=[];for(const h of e)((s=(o=(a=this.dataManager.inclusionModeDefinition)==null?void 0:a.namedTypeDefinitions)==null?void 0:o.get(h.typeName))==null?void 0:s.useAllData)===!1&&((m=(c=(u=(d=this.dataManager.inclusionModeDefinition)==null?void 0:d.namedTypeDefinitions)==null?void 0:u.get(h.typeName))==null?void 0:c.members)!=null&&m.has(h.id))&&i.push(h);if(t){const h=new Set,E=[];for(const w of i)if(this.dataManager.nodeConnectionsLookup.has(w.id))for(const y of this.dataManager.nodeConnectionsLookup.get(w.id))h.add(y);for(const w of h)this.dataManager.memberIdTypeLookup.has(w)&&E.push({id:w,typeName:this.dataManager.memberIdTypeLookup.get(w)});i=i.concat(E)}this.dataManager.removeFromLayer(i);for(const h of i)(g=this.sublayerIdsCache.get(h.typeName))==null||g.delete(h.id),this.linkChartDiagramLookup.delete(h.id);r&&await this.calculateLinkChartLayout(this._currentLinkChartConfig.layoutMode,{xScaleFactor:this._currentLinkChartConfig.xScaleFactor,yScaleFactor:this._currentLinkChartConfig.xScaleFactor});const n=[];return this.layers.forEach(h=>{n.push(h.refreshCachedQueryEngine())}),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e){const t=await this.dataManager.getConnectedRecordIds(e),r=t.filter(i=>{var n;return!((n=this.sublayerIdsCache.get(i.typeName))!=null&&n.has(i.id))});return await this._handleNewRecords(t),{records:r}}loadLayerAssumingLocalCache(){var e,t;this.memberRelationshipTypes.forEach(r=>{const i=new it({objectType:r,parentCompositeLayer:this,graphType:"relationship",title:r.name});i.geometryType?this.layers.push(i):this.tables.push(i),this.dataManager.sublayerCaches.has(r.name)||this.dataManager.sublayerCaches.set(r.name,new Map)}),this.memberEntityTypes.forEach(r=>{const i=new it({objectType:r,parentCompositeLayer:this,graphType:"entity",title:r.name});i.geometryType?this.layers.push(i):this.tables.push(i),this.dataManager.sublayerCaches.has(r.name)||this.dataManager.sublayerCaches.set(r.name,new Map)}),(e=this.dataManager.inclusionModeDefinition)!=null&&e.namedTypeDefinitions&&((t=this.dataManager.inclusionModeDefinition)==null||t.namedTypeDefinitions.forEach((r,i)=>{var a;const n=xi(this.sublayerIdsCache,i,()=>new Set);(a=r.members)==null||a.forEach(o=>{if(n.add(o.id),o.linkChartLocation)if(o.linkChartLocation instanceof $t)this.linkChartDiagramLookup.set(o.id,o.linkChartLocation),o.linkChartLocation.coords.length===2&&o.linkChartLocation.lengths.length===0?this.linkChartGeohashLookup.set(o.id,ue(o.linkChartLocation.coords[1],o.linkChartLocation.coords[0],ce)):this.linkChartGeohashLookup.set(o.id,"");else{const s=le(o.linkChartLocation);this.linkChartDiagramLookup.set(o.id,o.linkChartLocation?s:null),"x"in o.linkChartLocation&&"y"in o.linkChartLocation?this.linkChartGeohashLookup.set(o.id,ue(o.linkChartLocation.x,o.linkChartLocation.y,ce)):this.linkChartGeohashLookup.set(o.id,"")}})}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const r=[],i=[];this.dataManager.sublayerCaches.forEach((f,x)=>{this.dataManager.entityTypeNames.has(x)?f.forEach(L=>{r.push({typeName:x,feature:L})}):this.dataManager.relationshipTypeNames.has(x)&&f.forEach(L=>{i.push({typeName:x,feature:L})})}),this.linkChartDiagramLookup=new Map;const n=new Map,a=new Map,o=new Map,s=new Map,d=new Uint8Array(r.length),u=new Float64Array(r.length),c=new Float64Array(r.length),m=new Uint32Array(i.length),g=new Uint32Array(i.length),h=[],E="FORCE_DIRECTED",w=(t==null?void 0:t.xScaleFactor)??1,y=(t==null?void 0:t.yScaleFactor)??1,b=new Re({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let I,Q="FORCE_DIRECTED",k=0,J=0;switch(Q=e==="GEOGRAPHIC"?E:e,Q){case"FORCE_DIRECTED":I=mt.apply;break;case"COMMUNITY":I=ft.apply;break;case"HIERARCHICAL":I=wt.apply;break;case"RADIAL_TREE":I=_t.apply;break;case"SMART_TREE":I=bt.apply;break;default:I=gt.apply}r.forEach(({typeName:f,feature:x})=>{var L,ee,K;if((L=t==null?void 0:t.lockedNodeLocations)!=null&&L.has(x.attributes[D])){e==="GEOGRAPHIC"&&this.dataManager.geographicLookup.has(f)?d[k]=re.IsGeographic:d[k]=re.None;const M=t.lockedNodeLocations.get(x.attributes[D]);u[k]=M.x,c[k]=M.y}else if(e==="GEOGRAPHIC"&&this.dataManager.geographicLookup.has(f)){d[k]=re.IsGeographic;let M=null;const S=x.attributes[this.dataManager.geographicLookup.get(f).name];switch((ee=this.dataManager.geographicLookup.get(f))==null?void 0:ee.geometryType){case"esriGeometryPoint":u[k]=S==null?void 0:S.x,c[k]=S==null?void 0:S.y;break;case"esriGeometryPolygon":M=S==null?void 0:S.centroid,(M==null?void 0:M.x)!=null&&(M==null?void 0:M.y)!=null?(u[k]=M.x,c[k]=M.y):d[k]=re.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":M=(K=S==null?void 0:S.extent)==null?void 0:K.center,(M==null?void 0:M.x)!=null&&(M==null?void 0:M.y)!=null?(u[k]=M.x,c[k]=M.y):d[k]=re.IsMovable;break;default:d[k]=re.IsMovable}(u[k]==null||c[k]==null||Number.isNaN(u[k])||Number.isNaN(c[k]))&&(d[k]=re.IsMovable,u[k]=0,c[k]=0)}else d[k]=re.IsMovable,u[k]=0,c[k]=0;s.set(x.attributes[D],k),h[k]={feature:x,typeName:f},k++});let X=!1;if(i.forEach(f=>{const x=s.get(f.feature.attributes[Ce]),L=s.get(f.feature.attributes[rt]);x!==void 0&&L!==void 0?(m[J]=x,g[J]=L,J++):(X=!0,this.linkChartDiagramLookup.set(f.feature.attributes[Ce],null),this.linkChartGeohashLookup.set(f.feature.attributes[Ce],null))}),X&&Ee.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null"),await ki(),!I(d,u,c,m,g))throw new _("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let f=0;f<h.length;f++){if(d[f]===re.IsMovable&&(u[f]=u[f]*w,c[f]=c[f]*y),c[f]>84.9999&&(c[f]=84.9999),c[f]<-84.9999&&(c[f]=-84.9999),u[f]>179.9999&&(u[f]=179.9999),u[f]<-179.9999&&(u[f]=-179.9999),h[f].feature.attributes[O]=new Ge(u[f],c[f]),n.has(h[f].typeName)){const L=n.get(h[f].typeName);L==null||L.set(h[f].feature.attributes[D],h[f].feature)}else{const L=new Map;L.set(h[f].feature.attributes[D],h[f].feature),n.set(h[f].typeName,L)}o.set(h[f].feature.attributes[D],h[f].feature);const x=le(h[f].feature.attributes[O]);this.linkChartDiagramLookup.set(h[f].feature.attributes[D],h[f].feature.attributes[O]?x:null),this.linkChartGeohashLookup.set(h[f].feature.attributes[D],ue(h[f].feature.attributes[O].y,h[f].feature.attributes[O].x,ce)),h[f].feature.attributes[O].x<b.xmin&&(b.xmin=h[f].feature.attributes[O].x),h[f].feature.attributes[O].x>b.xmax&&(b.xmax=h[f].feature.attributes[O].x),h[f].feature.attributes[O].y<b.ymin&&(b.ymin=h[f].feature.attributes[O].y),h[f].feature.attributes[O].y>b.ymax&&(b.ymax=h[f].feature.attributes[O].y)}return this.linkChartExtent.xmin=b.xmin,this.linkChartExtent.xmax=b.xmax,this.linkChartExtent.ymin=b.ymin,this.linkChartExtent.ymax=b.ymax,i.forEach(f=>{var M,S;const x=(M=h[s.get(f.feature.attributes[Ce])])==null?void 0:M.feature.attributes[O],L=(S=h[s.get(f.feature.attributes[rt])])==null?void 0:S.feature.attributes[O];if(!x||!L)return;const ee=new ye({paths:[[x.x,x.y],[L.x,L.y]]});if(f.feature.attributes[O]=ee,a.has(f.typeName)){const B=a.get(f.typeName);B==null||B.set(f.feature.attributes[D],f.feature)}else{const B=new Map;B.set(f.feature.attributes[D],f.feature),a.set(f.typeName,B)}o.set(f.feature.attributes[D],f.feature);const K=le(f.feature.attributes[O]);this.linkChartDiagramLookup.set(f.feature.attributes[D],f.feature.attributes[O]?K:null),this.linkChartGeohashLookup.set(f.feature.attributes[D],"")}),this._currentLinkChartConfig={layoutMode:e,xScaleFactor:w,yScaleFactor:y},{nodes:n,links:a,idMap:o}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const r=[];await this.calculateLinkChartLayout(e,t),this.layers.forEach(i=>{r.push(i.refreshCachedQueryEngine())}),await Promise.all(r),this._refreshNamedTypes()}getCurrentNodeLocations(){var t,r;const e=new Map;return(r=(t=this.dataManager.inclusionModeDefinition)==null?void 0:t.namedTypeDefinitions)==null||r.forEach(i=>{var n;(n=i==null?void 0:i.members)==null||n.forEach(a=>{const o=a.linkChartLocation;let s;const d=a.id;o&&(s="x"in o?{x:o.x,y:o.y}:{x:o.coords[0],y:o.coords[1]},e.set(d,new Ge({x:s.x,y:s.y})))})}),e}async synchronizeInclusionListWithCache(){return new Promise(e=>{var t;(t=this.dataManager.inclusionModeDefinition)==null||t.namedTypeDefinitions.forEach((r,i)=>{if(r.useAllData=!1,r.members&&r.members.size>0){if(!this.dataManager.sublayerCaches.get(i))return;const n=new Set(Array.from(this.dataManager.sublayerCaches.get(i).keys()));Array.from(r.members.keys()).filter(a=>!n.has(a)).forEach(a=>{var o;(o=r.members)==null||o.delete(a)})}}),e()})}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach(r=>{t.push(r.refreshCachedQueryEngine())}),await Promise.all(t),this._refreshNamedTypes()}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const r of e)this.sublayerIdsCache.has(r.typeName)||(this.sublayerIdsCache.set(r.typeName,new Set),t.push(r.typeName)),this.sublayerIdsCache.get(r.typeName).add(r.id);for(const r of t)if(this._graphTypeLookup.has(r)){const i=this._graphTypeLookup.get(r),n="endPoints"in i?"relationship":"entity",a=new it({objectType:i,parentCompositeLayer:this,graphType:n,title:r});n==="entity"?this.dataManager.entityTypeNames.add(r):this.dataManager.relationshipTypeNames.add(r),a.geometryType?this.layers.push(a):this.tables.push(a),this.dataManager.sublayerCaches.set(r,new Map)}await this.dataManager.refreshCacheContent(e.map(r=>r.id)),await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,{xScaleFactor:this._currentLinkChartConfig.xScaleFactor,yScaleFactor:this._currentLinkChartConfig.xScaleFactor})}async _initializeDiagram(){var e,t;this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?((t=(e=this.dataManager.inclusionModeDefinition)==null?void 0:e.namedTypeDefinitions)==null||t.forEach(r=>{var i;(i=r==null?void 0:r.members)==null||i.forEach(n=>{const a=n.linkChartLocation;let o;const s=n.id;if(!a)return;o="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const d=le(o);this.linkChartDiagramLookup.set(s,d),this.linkChartGeohashLookup.set(s,ue(o.x,o.y,ce)),this.linkChartExtent.xmin>o.x&&(this.linkChartExtent.xmin=o.x),this.linkChartExtent.xmax<o.x&&(this.linkChartExtent.xmax=o.x),this.linkChartExtent.ymin>o.y&&(this.linkChartExtent.ymin=o.y),this.linkChartExtent.ymax<o.y&&(this.linkChartExtent.ymax=o.y)})}),this.memberRelationshipTypes.forEach(r=>{var i;r.name&&((i=this.dataManager.sublayerCaches.get(r.name))==null||i.forEach(n=>{const a=this.linkChartDiagramLookup.get(n.attributes[Ce]),o=this.linkChartDiagramLookup.get(n.attributes[rt]);if(a&&o){const s=le(new ye({paths:[[a.coords[0],a.coords[1]],[o.coords[0],o.coords[1]]]}));this.linkChartDiagramLookup.set(n.attributes[D],s)}else this.linkChartDiagramLookup.set(n.attributes[D],null);this.linkChartGeohashLookup.set(n.attributes[D],"")}))})):await this.calculateLinkChartLayout(this.defaultLinkChartConfig.layoutMode,{xScaleFactor:this.defaultLinkChartConfig.xScaleFactor,yScaleFactor:this.defaultLinkChartConfig.yScaleFactor,lockedNodeLocations:this.getCurrentNodeLocations()}):await this.calculateLinkChartLayout("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}};l([p()],Y.prototype,"dataPreloadedInLocalCache",void 0),l([p()],Y.prototype,"defaultLinkChartConfig",void 0),l([p()],Y.prototype,"dataManager",void 0),l([p()],Y.prototype,"knowledgeGraph",void 0),l([p()],Y.prototype,"layers",void 0),l([p()],Y.prototype,"linkChartDiagramLookup",void 0),l([p()],Y.prototype,"linkChartExtent",void 0),l([p()],Y.prototype,"linkChartGeohashLookup",void 0),l([p()],Y.prototype,"memberEntityTypes",void 0),l([p()],Y.prototype,"memberRelationshipTypes",void 0),l([p()],Y.prototype,"sublayerIdsCache",void 0),l([p()],Y.prototype,"tables",void 0),l([p({json:{read:!1}})],Y.prototype,"type",void 0),Y=l([R("esri.layers.LinkChartLayer")],Y);const cn=Y;export{cn as default};
|