@arcgis/core 4.33.0-next.20250507 → 4.33.0-next.20250508
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.
- package/WebLinkChart.js +1 -1
- package/arcade/batchExec.js +5 -0
- package/arcade/functions/aiServices.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/029a118e6dfb3f544a5c.js +1 -0
- package/assets/esri/core/workers/chunks/037af6379f3e9278633b.js +1 -0
- package/assets/esri/core/workers/chunks/0516bd18334d3af6c555.js +1 -0
- package/assets/esri/core/workers/chunks/094300acbd24085cb063.js +1 -0
- package/assets/esri/core/workers/chunks/0bbb38f59f37c51c72f0.js +1 -0
- package/assets/esri/core/workers/chunks/10e6dffa57aa1a626708.js +1 -0
- package/assets/esri/core/workers/chunks/1abd026ed12c863e1d94.js +1 -0
- package/assets/esri/core/workers/chunks/1eef9cf19634c038b59b.js +1 -0
- package/assets/esri/core/workers/chunks/{7cd32b10ed0e18e44ef2.js → 2b01e3bce78541620a86.js} +1 -1
- package/assets/esri/core/workers/chunks/{cd81df932b87583b7e4c.js → 306e262f148b3057b11b.js} +1 -1
- package/assets/esri/core/workers/chunks/352b7dcd1633e0c98194.js +1 -0
- package/assets/esri/core/workers/chunks/35c996f6fbff165b03f4.js +1 -0
- package/assets/esri/core/workers/chunks/391b1c3e736a62befbaf.js +1 -0
- package/assets/esri/core/workers/chunks/{cbec01223d51cdb9ee79.js → 3c45603af279ad7fed8c.js} +1 -1
- package/assets/esri/core/workers/chunks/40e556a0645af8658658.js +1 -0
- package/assets/esri/core/workers/chunks/4402336db7210cd583e0.js +1 -0
- package/assets/esri/core/workers/chunks/46104db7f77952bb6c12.js +1 -0
- package/assets/esri/core/workers/chunks/{5383dc4814b0ba42e871.js → 47cd99ab3ed11a931084.js} +1 -1
- package/assets/esri/core/workers/chunks/47f64a340b5d56bf9e59.js +1 -0
- package/assets/esri/core/workers/chunks/49f0e53b3c9ba8451442.js +1 -0
- package/assets/esri/core/workers/chunks/515e3295495d0958db7e.js +1 -0
- package/assets/esri/core/workers/chunks/5ddf463c85c33428e807.js +1 -0
- package/assets/esri/core/workers/chunks/5e0118a030cf741f78c6.js +319 -0
- package/assets/esri/core/workers/chunks/{875a0e2d023094c8e15e.js → 66e79aa02b3aa12b3778.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5a43d54684747561aa9.js → 6b42bcfbb60432e3ed1f.js} +1 -1
- package/assets/esri/core/workers/chunks/6b5274d46a155d65dff1.js +39 -0
- package/assets/esri/core/workers/chunks/6e5d8a6b29c06a27998c.js +1 -0
- package/assets/esri/core/workers/chunks/6eabced7123a65d47292.js +1 -0
- package/assets/esri/core/workers/chunks/6f506303017903b9a06f.js +1 -0
- package/assets/esri/core/workers/chunks/6f6bf67a7960b7e9b03e.js +1 -0
- package/assets/esri/core/workers/chunks/{52a3d0e041717da7697e.js → 736cb9f74bf050b70f4c.js} +1 -1
- package/assets/esri/core/workers/chunks/74187c771ee7083d1db7.js +1 -0
- package/assets/esri/core/workers/chunks/{85d87cd1bf7eecd54100.js → 752ef63d910852b7be44.js} +1 -1
- package/assets/esri/core/workers/chunks/7c49a8877bd744daa3d5.js +1 -0
- package/assets/esri/core/workers/chunks/7ffc1db10b00754398e8.js +1 -0
- package/assets/esri/core/workers/chunks/81546c6141d564ed59c9.js +1 -0
- package/assets/esri/core/workers/chunks/83fcc6f770ad084b8ab9.js +1 -0
- package/assets/esri/core/workers/chunks/852dd5af8e704613310a.js +1 -0
- package/assets/esri/core/workers/chunks/85efb318cda7260221ae.js +1 -0
- package/assets/esri/core/workers/chunks/86138c297095af1ac604.js +1 -0
- package/assets/esri/core/workers/chunks/8b74b609de4f70e1a75c.js +1 -0
- package/assets/esri/core/workers/chunks/90f93091fe088875f80f.js +1 -0
- package/assets/esri/core/workers/chunks/91a02ee91f61cf841111.js +1 -0
- package/assets/esri/core/workers/chunks/9aedd7874da7c63865d6.js +1 -0
- package/assets/esri/core/workers/chunks/9ca480eb8b2312381ccf.js +1 -0
- package/assets/esri/core/workers/chunks/a0d2bd5d4ed3c90f6b1c.js +1 -0
- package/assets/esri/core/workers/chunks/a73c6b4bc5baf440f85a.js +1 -0
- package/assets/esri/core/workers/chunks/b5d68d8460b7c15001dd.js +1 -0
- package/assets/esri/core/workers/chunks/b816b608f31954128246.js +1 -0
- package/assets/esri/core/workers/chunks/bcab8b9ce2f9d2ebaae7.js +1 -0
- package/assets/esri/core/workers/chunks/bd7b54db7fd278b15500.js +1 -0
- package/assets/esri/core/workers/chunks/c1175477dfcdee90a453.js +1 -0
- package/assets/esri/core/workers/chunks/c17c269cc30e7e1d0bfb.js +1 -0
- package/assets/esri/core/workers/chunks/c2f925167a43f63289a7.js +1 -0
- package/assets/esri/core/workers/chunks/c9ab067b07d1eab974d1.js +1 -0
- package/assets/esri/core/workers/chunks/cb80b7ddc9acf625d754.js +1 -0
- package/assets/esri/core/workers/chunks/{812d8554144ef5a7cd4b.js → cd4fb107489594c57438.js} +1 -1
- package/assets/esri/core/workers/chunks/cd5c380196db7fb55242.js +1 -0
- package/assets/esri/core/workers/chunks/d874d24568b1acedebc4.js +1 -0
- package/assets/esri/core/workers/chunks/d9948763423784b68c09.js +1 -0
- package/assets/esri/core/workers/chunks/e662c86b8bafc5512d3d.js +1 -0
- package/assets/esri/core/workers/chunks/e697dd4508f02dcfe329.js +1 -0
- package/assets/esri/core/workers/chunks/ed6d0fea159dea638c2f.js +1 -0
- package/assets/esri/themes/base/widgets/_Daylight.scss +0 -4
- package/assets/esri/themes/base/widgets/_ShadowCast.scss +27 -28
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/ShadowCast/t9n/ShadowCast.json +1 -1
- package/chunks/aiServices.js +1 -1
- package/interfaces.d.ts +50 -3
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
- package/layers/mixins/SublayersOwner.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/package.json +1 -1
- package/rest/print.js +1 -1
- package/rest/support/JobInfo.js +1 -1
- package/rest/support/TranslateContent.js +1 -1
- package/rest/support/TranslateParameters.js +1 -1
- package/rest/support/TranslateResult.js +1 -1
- package/support/loadArcade.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
- package/views/3d/state/controllers/InteractiveController.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/widgets/Daylight/DaylightViewModel.js +1 -1
- package/widgets/Daylight/css.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/ShadowCast/components/ThresholdConfigurator.js +1 -1
- package/widgets/ShadowCast/css.js +1 -1
- package/assets/esri/core/workers/chunks/00e49ed684cc167c4481.js +0 -1
- package/assets/esri/core/workers/chunks/02e1332e91393ee985e8.js +0 -1
- package/assets/esri/core/workers/chunks/0366d46c78aa3b4a0523.js +0 -1
- package/assets/esri/core/workers/chunks/076a205298026e926d70.js +0 -1
- package/assets/esri/core/workers/chunks/07adf428f5fdba5c7cdf.js +0 -1
- package/assets/esri/core/workers/chunks/1349d4ea29fbf41e22bc.js +0 -1
- package/assets/esri/core/workers/chunks/2934fd7ec0c07371c4fe.js +0 -1
- package/assets/esri/core/workers/chunks/2a72f272051721767ca1.js +0 -319
- package/assets/esri/core/workers/chunks/2a9f206c23f69045d3f2.js +0 -1
- package/assets/esri/core/workers/chunks/2ac2c9cb88a7d1249b56.js +0 -1
- package/assets/esri/core/workers/chunks/2ad47c0ba1680f7d5e03.js +0 -1
- package/assets/esri/core/workers/chunks/2b3aa568356f4b70afe8.js +0 -1
- package/assets/esri/core/workers/chunks/35002d23c5b9f37c6331.js +0 -1
- package/assets/esri/core/workers/chunks/35b138f6d0687c5bee4f.js +0 -1
- package/assets/esri/core/workers/chunks/4957450197305498d327.js +0 -1
- package/assets/esri/core/workers/chunks/4b63f36189730396721b.js +0 -1
- package/assets/esri/core/workers/chunks/55def679b9f1c7c4d4d3.js +0 -1
- package/assets/esri/core/workers/chunks/598fade09fa4da759ac2.js +0 -1
- package/assets/esri/core/workers/chunks/60f7cd05e88701f43d3f.js +0 -1
- package/assets/esri/core/workers/chunks/6118144588af9cd8e49b.js +0 -1
- package/assets/esri/core/workers/chunks/62c5030557595c9a7c37.js +0 -1
- package/assets/esri/core/workers/chunks/62d1e6e7d8685ffc152f.js +0 -1
- package/assets/esri/core/workers/chunks/687a11f49772bf5e1f5a.js +0 -1
- package/assets/esri/core/workers/chunks/6b554b42e16ad32b433d.js +0 -1
- package/assets/esri/core/workers/chunks/6fc39a58f3011291c602.js +0 -1
- package/assets/esri/core/workers/chunks/7978b66cdfe078960ddd.js +0 -1
- package/assets/esri/core/workers/chunks/7fa70851868f80eaccfc.js +0 -1
- package/assets/esri/core/workers/chunks/8d09cc782dae1dcfc6c4.js +0 -1
- package/assets/esri/core/workers/chunks/8ec0a762ec73d1f91fce.js +0 -1
- package/assets/esri/core/workers/chunks/919673d958045ab94c95.js +0 -1
- package/assets/esri/core/workers/chunks/9321e3244ccb1ee9985a.js +0 -1
- package/assets/esri/core/workers/chunks/97a4f8504e76c877893b.js +0 -1
- package/assets/esri/core/workers/chunks/9cac00d4bfac14aaae12.js +0 -1
- package/assets/esri/core/workers/chunks/a1278a1c4a913c671989.js +0 -1
- package/assets/esri/core/workers/chunks/a2452958b0ced28fc1e5.js +0 -1
- package/assets/esri/core/workers/chunks/aed72cbac8d463b1d2e0.js +0 -1
- package/assets/esri/core/workers/chunks/af44ba2ee6c7670ddcc1.js +0 -1
- package/assets/esri/core/workers/chunks/b2f1d1721a9dd88a1adf.js +0 -1
- package/assets/esri/core/workers/chunks/b52a738ca2b5c39f8e15.js +0 -1
- package/assets/esri/core/workers/chunks/b60504e6326464a512df.js +0 -1
- package/assets/esri/core/workers/chunks/b79e8d1e3f2c214549b7.js +0 -1
- package/assets/esri/core/workers/chunks/ba4aafa8dfa76006c3e7.js +0 -1
- package/assets/esri/core/workers/chunks/bbcc5c5ef7cb92c2e213.js +0 -39
- package/assets/esri/core/workers/chunks/bceb837623aa79fcfbed.js +0 -1
- package/assets/esri/core/workers/chunks/bfd39cd1d83291ba014b.js +0 -1
- package/assets/esri/core/workers/chunks/ca8c631172902c6623fa.js +0 -1
- package/assets/esri/core/workers/chunks/cf008faa999e8d07116f.js +0 -1
- package/assets/esri/core/workers/chunks/dcb9ab790e694328d02c.js +0 -1
- package/assets/esri/core/workers/chunks/e93222c65bd28203ddf7.js +0 -1
- package/assets/esri/core/workers/chunks/ea70cabea50960dc8167.js +0 -1
- package/assets/esri/core/workers/chunks/f07b3aecff90a6a400d8.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"widgetLabel":"Shadow cast","timeLabel":"Time range","timeRange":"{start} - {end}","visualizationLabel":"Visualization","threshold":{"label":"Areas above threshold","colorLabel":"Exceeds threshold color","valueLabel":"Areas in shadow for more than (hours)","discreteLabel":"Discrete shadows","discreteColorLabel":"
|
|
1
|
+
{"widgetLabel":"Shadow cast","timeLabel":"Time range","timeRange":"{start} - {end}","visualizationLabel":"Visualization","threshold":{"label":"Areas above threshold","colorLabel":"Exceeds threshold color","valueLabel":"Areas in shadow for more than (hours)","discreteLabel":"Discrete context shadows","discreteColorLabel":"Context shadow color"},"duration":{"label":"Total shadow duration","colorLabel":"Color","modeLabel":"Gradient style","continuousLabel":"Continuous","hourlyLabel":"Hourly"},"discrete":{"label":"Discrete shadows","colorLabel":"Color","intervalLabel":"Time interval"},"timeInShadow":"Total time in shadow: {duration}"}
|
package/chunks/aiServices.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{toSymbolId as
|
|
5
|
+
import{toSymbolId as t}from"../arcade/arcadeEnvironment.js";import e from"../arcade/Dictionary.js";import{ArcadeExecutionError as s,ExecutionErrorCodes as r}from"../arcade/executionError.js";import{D as n,m as o,M as a}from"./languageUtils.js";import i from"../core/Logger.js";import{getOrCreateMapValue as c}from"../core/MapUtils.js";import l from"../portal/Portal.js";import{translate as u}from"../rest/translate.js";import h from"../rest/support/TranslateContent.js";import m from"../rest/support/TranslateParameters.js";import p from"../rest/support/TranslateResult.js";import{isString as f,isArray as _}from"../support/guards.js";class d{constructor(t){this.portal=t}async translate(t){this.portal.loaded||await this.portal.load();const e=this.portal.helperServices?.aiUtilityServices;if(null==e)return{success:!1};const s=e.url+e.translateUtility;try{return{success:!0,results:(await u(s,t)).map((t=>t.toJSON()))}}catch(r){return i.getLogger("esri.arcade.functions.aiServices").error(r),{success:!1}}}}class y{constructor(t,e,s){this._parameters=t,this._maxTotalContentSize=e,this._maxContentsLength=s,this._requests=[],this._normalizedContents=new Map,this._contentsTotalSize=0}tryAdd(t){const e=new Set(t.filter((t=>!this._normalizedContents.has(t.text))).map((t=>t.text)));if(this._requests.length+e.size>this._maxContentsLength)return null;let s=0;for(const n of e)s+=n.length;if((s+this._contentsTotalSize)*(this._parameters.to.length??1)>this._maxTotalContentSize)return null;const r=this._requests.length;for(const{key:n,text:o}of t)c(this._normalizedContents,o,(()=>[])).push({batchIdx:r,key:n});return this._requests.push(t),this._contentsTotalSize+=s,r}async send(t){const e=[],s=[];let r=0;for(const[i,c]of this._normalizedContents)e.push(new h({key:String(r++),text:i})),s.push(c);const n=new m(this._parameters);n.contents=e;const o=await t.translate(n);if(!o.success)return Array.from(this._requests,(()=>o));const a=Array.from(this._requests,(()=>({success:!0,results:[]})));for(const i of o.results){const t=Number(i.key);for(const e of s[t])a[e.batchIdx].results.push({...i,key:e.key})}return a}}function g(t){const e=[...new Set(t.to)].sort(),s=t.from??null,r=t.portalUrl,n=t.translator,o=t.apiKey??null;return JSON.stringify([e,s,r,n,o])}async function w(t,e,s){try{return(await t.yieldFor(s))[e]}catch{return{success:!1}}}class x{constructor(t,e,{maxTotalContentSize:s=5e4,maxContentsLength:r=1e3}={}){this._executor=t,this._service=e,this._openBatches=new Map,this._maxTotalContentSize=s,this._maxContentsLength=r}create(t){return{translate:async e=>{const s=g(e),{contents:r,to:n,from:o,translator:a,portalUrl:i,apiKey:c}=e;if(null==n)return{success:!1};if(null==r||r.every((t=>0===t.text.length)))return{success:!1};const l=this._openBatches.get(s);if(null!=l){const e=l.data.tryAdd(r);if(null!=e)return await w(t,e,l);l.send()}const u=new y({to:n,from:o,translator:a,portalUrl:i,apiKey:c},this._maxTotalContentSize,this._maxContentsLength),h=u.tryAdd(r);if(null!=h){const e=this._executor.openBatch(u,{open:t=>{this._openBatches.set(s,t)},execute:t=>t.send(this._service),close:t=>{this._openBatches.get(s)===t&&this._openBatches.delete(s)}});return await w(t,h,e)}return await this._service.translate(e)}}}}function S(i){"async"===i.mode&&(i.functions[t("TranslateText")]=function(t,c){return i.standardFunctionAsync(t,c,(async(t,i,c)=>{if(n(c,2,3,t,i),!f(c[0])&&!_(c[0])&&!o(c[0]))throw new s(t,r.InvalidParameter,i);const u=a(c[0]);if(!f(c[1])&&!_(c[1])&&!o(c[1]))throw new s(t,r.InvalidParameter,i);const y=a(c[1]);let g=null;if(c.length>=3){if(!f(c[2]))throw new s(t,r.InvalidParameter,i);g=c[2]}const w=t.services?.portal??l.getDefault(),x=new m({to:y,contents:u.map(((t,e)=>new h({key:String(e),text:t}))),from:g,portalUrl:w.url}),S=t.services?.translation??new d(w),T=await S.translate(x);return T.success?e.convertJsonToArcade({success:!0,results:T.results.map((t=>p.fromJSON(t).toJSON()))},t.timeZone??"system",!0):new e({success:!1})}))})}const T=Object.freeze(Object.defineProperty({__proto__:null,BatchTranslationServiceFactory:x,PortalTranslationService:d,getTranslateParametersKey:g,registerFunctions:S},Symbol.toStringTag,{value:"Module"}));export{T as A,x as B,d as P,g,S as r};
|
package/interfaces.d.ts
CHANGED
|
@@ -252,6 +252,9 @@ declare namespace __esri {
|
|
|
252
252
|
export type CSVLayerLayerviewCreateEventHandler = (event: CSVLayerLayerviewCreateEvent) => void;
|
|
253
253
|
export type CSVLayerLayerviewDestroyEventHandler = (event: CSVLayerLayerviewDestroyEvent) => void;
|
|
254
254
|
export type CSVLayerRefreshEventHandler = (event: CSVLayerRefreshEvent) => void;
|
|
255
|
+
export type DaylightViewModelUserDateTimeChangeEventHandler = (
|
|
256
|
+
event: DaylightViewModelUserDateTimeChangeEvent,
|
|
257
|
+
) => void;
|
|
255
258
|
export type EditorSketchCreateEventHandler = (event: EditorSketchCreateEvent) => void;
|
|
256
259
|
export type EditorSketchUpdateEventHandler = (event: EditorSketchUpdateEvent) => void;
|
|
257
260
|
export type EditorViewModelSketchCreateEventHandler = (event: EditorViewModelSketchCreateEvent) => void;
|
|
@@ -15360,6 +15363,12 @@ declare namespace __esri {
|
|
|
15360
15363
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-buildingSublayers-BuildingComponentSublayer.html#definitionExpression Read more...}
|
|
15361
15364
|
*/
|
|
15362
15365
|
definitionExpression: string | nullish;
|
|
15366
|
+
/**
|
|
15367
|
+
* An array of fields in the layer.
|
|
15368
|
+
*
|
|
15369
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-buildingSublayers-BuildingComponentSublayer.html#fields Read more...}
|
|
15370
|
+
*/
|
|
15371
|
+
readonly fields: Field[];
|
|
15363
15372
|
/**
|
|
15364
15373
|
* Indicates how the layer should display in the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-LayerList.html LayerList} widget.
|
|
15365
15374
|
*
|
|
@@ -15390,6 +15399,13 @@ declare namespace __esri {
|
|
|
15390
15399
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-buildingSublayers-BuildingComponentSublayer.html#loadWarnings Read more...}
|
|
15391
15400
|
*/
|
|
15392
15401
|
declare readonly loadWarnings: Loadable["loadWarnings"];
|
|
15402
|
+
/**
|
|
15403
|
+
* The name of an `oid` {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-buildingSublayers-BuildingComponentSublayer.html#fields field} containing
|
|
15404
|
+
* a unique value or identifier for each feature in the layer.
|
|
15405
|
+
*
|
|
15406
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-buildingSublayers-BuildingComponentSublayer.html#objectIdField Read more...}
|
|
15407
|
+
*/
|
|
15408
|
+
readonly objectIdField: string;
|
|
15393
15409
|
/**
|
|
15394
15410
|
* An array of field names from the service to include with each feature.
|
|
15395
15411
|
*
|
|
@@ -24048,6 +24064,11 @@ declare namespace __esri {
|
|
|
24048
24064
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-KnowledgeGraphLayer.html#addRecords Read more...}
|
|
24049
24065
|
*/
|
|
24050
24066
|
addRecords(records: IdTypePair[]): Promise<void>;
|
|
24067
|
+
convertSublayerToDynamicData(typeName: string): void;
|
|
24068
|
+
convertSublayerToExplicitMembership(typeName: string): void;
|
|
24069
|
+
convertToExplicitMembership(): void;
|
|
24070
|
+
convertToFullyDynamicData(): void;
|
|
24071
|
+
createSublayerForNamedType(typeName: string): Promise<KnowledgeGraphSublayer>;
|
|
24051
24072
|
/**
|
|
24052
24073
|
* Assumes that data for all of the members defined in the inclusionModeDefinition is already loaded into local storage.
|
|
24053
24074
|
*
|
|
@@ -28470,7 +28491,7 @@ declare namespace __esri {
|
|
|
28470
28491
|
popupEnabled: boolean;
|
|
28471
28492
|
readonly type: "parquet";
|
|
28472
28493
|
/**
|
|
28473
|
-
* The ParquetLayer
|
|
28494
|
+
* The ParquetLayer enables visualization of [parquet files](https://parquet.apache.org/docs/) on a map.
|
|
28474
28495
|
*
|
|
28475
28496
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ParquetLayer.html Read more...}
|
|
28476
28497
|
*/
|
|
@@ -104396,6 +104417,7 @@ declare namespace __esri {
|
|
|
104396
104417
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-WebLinkChart.html#connectFromEntities Read more...}
|
|
104397
104418
|
*/
|
|
104398
104419
|
connectFromEntities(entityIds: string[], options?: GeneralOptions): Promise<IdTypePair[]>;
|
|
104420
|
+
createSublayerForNamedType(typeName: string): Promise<KnowledgeGraphSublayer>;
|
|
104399
104421
|
/**
|
|
104400
104422
|
* Given a list of entity IDs to expand from, will attempt to retrieve all one-hop connected entities and the connecting relationships.
|
|
104401
104423
|
*
|
|
@@ -110850,7 +110872,10 @@ declare namespace __esri {
|
|
|
110850
110872
|
visibleElements?: DaylightVisibleElements;
|
|
110851
110873
|
}
|
|
110852
110874
|
|
|
110853
|
-
export
|
|
110875
|
+
export interface DaylightViewModel extends Accessor, Evented {
|
|
110876
|
+
}
|
|
110877
|
+
|
|
110878
|
+
export class DaylightViewModel {
|
|
110854
110879
|
/**
|
|
110855
110880
|
* A season can be set instead of a date.
|
|
110856
110881
|
*
|
|
@@ -110925,6 +110950,25 @@ declare namespace __esri {
|
|
|
110925
110950
|
*/
|
|
110926
110951
|
get localDate(): Date;
|
|
110927
110952
|
set localDate(value: DateProperties);
|
|
110953
|
+
/**
|
|
110954
|
+
* Emits an event on the instance.
|
|
110955
|
+
*
|
|
110956
|
+
* @param type The name of the event.
|
|
110957
|
+
* @param event The event payload.
|
|
110958
|
+
*
|
|
110959
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Daylight-DaylightViewModel.html#emit Read more...}
|
|
110960
|
+
*/
|
|
110961
|
+
emit(type: string, event?: any): boolean;
|
|
110962
|
+
/**
|
|
110963
|
+
* Indicates whether there is an event listener on the instance that matches
|
|
110964
|
+
* the provided event name.
|
|
110965
|
+
*
|
|
110966
|
+
* @param type The name of the event.
|
|
110967
|
+
*
|
|
110968
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Daylight-DaylightViewModel.html#hasEventListener Read more...}
|
|
110969
|
+
*/
|
|
110970
|
+
hasEventListener(type: string): boolean;
|
|
110971
|
+
on(name: "user-date-time-change", eventHandler: DaylightViewModelUserDateTimeChangeEventHandler): IHandle;
|
|
110928
110972
|
}
|
|
110929
110973
|
|
|
110930
110974
|
interface DaylightViewModelProperties {
|
|
@@ -110991,6 +111035,9 @@ declare namespace __esri {
|
|
|
110991
111035
|
yearPlaying?: boolean;
|
|
110992
111036
|
}
|
|
110993
111037
|
|
|
111038
|
+
export interface DaylightViewModelUserDateTimeChangeEvent {
|
|
111039
|
+
}
|
|
111040
|
+
|
|
110994
111041
|
/**
|
|
110995
111042
|
* The visible elements that are displayed within the widget.
|
|
110996
111043
|
*
|
|
@@ -139513,7 +139560,7 @@ declare namespace __esri {
|
|
|
139513
139560
|
*/
|
|
139514
139561
|
view: MapView | SceneView | nullish;
|
|
139515
139562
|
/**
|
|
139516
|
-
* Provides the logic for the {@link https://developers.arcgis.com/javascript/latest/
|
|
139563
|
+
* Provides the logic for the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Zoom.html Zoom} widget.
|
|
139517
139564
|
*
|
|
139518
139565
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Zoom-ZoomViewModel.html Read more...}
|
|
139519
139566
|
*/
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{fetchAndConvertSerializedKnowledgeIdMap as t,serializeInclusionDefinitionToIdCollectionsMapPbf as i}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import o from"../core/Collection.js";import s from"../core/Error.js";import a from"../core/Logger.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{MultiOriginJSONMixin as n}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as p}from"../core/promiseUtils.js";import{watch as l,sync as d}from"../core/reactiveUtils.js";import{isAbsolute as h,join as y}from"../core/urlUtils.js";import{generateUUID as c}from"../core/uuid.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../core/accessorSupport/decorators/writer.js";import{OriginId as w,idToName as b,nameToId as M}from"../core/accessorSupport/PropertyOrigin.js";import T from"./Layer.js";import{KnowledgeGraphLayerDataManager as S}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import _ from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{initializeLayersFromClientData as L}from"./knowledgeGraph/layerUtils.js";import{ArcGISService as D}from"./mixins/ArcGISService.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{CustomParametersMixin as v}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as k}from"./mixins/OperationalLayer.js";import{PortalLayer as A}from"./mixins/PortalLayer.js";import{RefreshableLayer as G}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{url as N}from"./support/commonProperties.js";import{fetchKnowledgeGraph as C}from"../rest/knowledgeGraphService.js";import{f as R,t as I}from"../chunks/persistableUrlUtils.js";let U=class extends(j(E(G(D(k(A(n(v(T))))))))){constructor(e){super(e),this._graphTypeLookup=new Map,this._namedTypesModified=!1,this.dataManager=null,this.definitionSetMap=null,this.knowledgeGraph=null,this.layers=new(o.ofType(_)),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="KnowledgeGraphLayer",this.sublayerIdsCache=new Map,this.tables=new(o.ofType(_)),this.type="knowledge-graph",this.url=null,this.addHandles(l((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),d))}load(e){return this.addResolvingPromise(this._doLoad(e)),Promise.resolve(this)}async _doLoad(e){try{await this.loadFromPortal({supportedTypes:["Knowledge Graph Layer"]},e)}catch(t){p(t)}await this._fetchMetadata(),await this._initializeLayerProperties(),this.loadLayerAssumingLocalCache(),this._layersLoadedFromAuthoritativeItem()||await L(this)}async _fetchMetadata(){if(!this.url)throw new s("knowledge-graph:missing-url","KnowledgeGraphLayer must be created with a url");const e=await C(this.url);this.knowledgeGraph=e,this._forEachGraphType((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}))}async _initializeLayerProperties(){this.originIdOf("inclusionModeDefinition")===w.USER?this._validateInclusionModeDefinition():await this._initializeInclusionModeDefinition(),this._setMemberTypes(),this.dataManager=new S({knowledgeGraph:this.knowledgeGraph,inclusionModeDefinition:this.inclusionModeDefinition})}async _initializeInclusionModeDefinition(){const e=this.definitionSetMap?await t(this.definitionSetMap,!0):{generateAllSublayers:!0,namedTypeDefinitions:new Map};[...this.layers.toArray(),...this.tables.toArray()].forEach((t=>{const i=this._graphTypeLookup.get(t.graphTypeName);i&&!e.namedTypeDefinitions.has(i.name)&&e.namedTypeDefinitions.set(i.name,{useAllData:!0})})),this.setAtOrigin("inclusionModeDefinition",e,b(this.originIdOf("definitionSetMap")))}_validateInclusionModeDefinition(){const{inclusionModeDefinition:e}=this;if(!e)return;const{namedTypeDefinitions:t}=e;if(t?.size>0)t.forEach(((e,i)=>{const o=this._graphTypeLookup.get(i);if(!o)return a.getLogger(this).warn(`A named type, ${i}, was in the inclusion list that wasn't in the data model and will be removed`),void t.delete(i);"relationship"!==o.type&&"entity"!==o.type&&(a.getLogger(this).warn(`A named type, ${i}, was in the inclusion list that wasn't properly modeled and will be removed`),t.delete(i))}));else if(!e.generateAllSublayers)throw new s("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined")}_setMemberTypes(){let e=[],t=[];const{inclusionModeDefinition:i}=this,o=i?.namedTypeDefinitions;!i||i.generateAllSublayers?(e=this.knowledgeGraph.dataModel?.entityTypes??[],t=this.knowledgeGraph.dataModel?.relationshipTypes??[]):o&&o.size>0&&o.forEach(((i,o)=>{const s=this._graphTypeLookup.get(o);switch(s?.type){case"relationship":t.push(s);break;case"entity":e.push(s)}})),this.memberEntityTypes=e,this.memberRelationshipTypes=t}_forEachGraphType(e){[...this.knowledgeGraph.dataModel?.entityTypes??[],...this.knowledgeGraph.dataModel?.relationshipTypes??[]].forEach((t=>{e(t)}))}_refreshNamedTypes(){this._namedTypesModified=!0;for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}async _handleNewRecords(e){const t=[],i=[];for(const o of e){if(!this._graphTypeLookup.has(o.typeName))continue;this.dataManager.sublayerCaches.has(o.typeName)||(this.dataManager.sublayerCaches.set(o.typeName,new Map),t.push(o.typeName));r(this.sublayerIdsCache,o.typeName,(()=>new Set)).add(o.id),i.push(o)}this.dataManager.addToLayer(i);for(const o of t){const e=this._graphTypeLookup.get(o);e&&(this._addSublayer(e),"entity"===e.type?this.dataManager.entityTypeNames.add(o):this.dataManager.relationshipTypeNames.add(o))}await L(this,t),this._refreshNamedTypes()}_createSublayers(e,t,i){e.forEach((e=>{const o=this._createSublayer(e);i(o)&&t.push(o),this._updateSublayerCaches(e)}))}_addSublayer(e){const t=this._createSublayer(e);return t.geometryType?this.layers.push(t):this.tables.push(t),t}_createSublayer(e){return new _({objectType:e,parentCompositeLayer:this,graphType:e.type})}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const i=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));i&&(t.objectType=i,this._updateSublayerCaches(i))}))}_updateSublayerCaches({name:e}){if(!e)return;const t=this.dataManager.sublayerCaches;t.has(e)||t.set(e,new Map)}_saveUrlAsNewResource(e,t,i,o){e[t]="<pending>",i.pendingOperations.push(x(this.inclusionModeDefinition).then((s=>{const a=P(o);e[t]=a.itemRelativeUrl,i.toAdd.push({resource:a,content:{type:"blob",blob:s},compress:!1,finish:e=>{this.definitionSetMap=e.url}})})))}_displaysAllRecords(e){for(const[,{useAllData:t}]of e.namedTypeDefinitions)if(!t)return!1;return!0}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_layersLoadedFromAuthoritativeItem(){const e=this.originIdOf("layers");return e>=w.PORTAL_ITEM&&e<w.USER}readDefinitionSetMap(e,t,i){return R(e,i)}writeDefinitionSetMap(e,t,i,o){const s=o?.portalItem,a=o?.resources,r=M(o?.origin);if(!s||!a||null==r)return void(e&&(t[i]=I(e,o)));const{inclusionModeDefinition:n}=this;if(!n||this._displaysAllRecords(n))return void(this.definitionSetMap=null);const p=this.originIdOf("inclusionModeDefinition");if(p===w.USER||this._namedTypesModified||r<p)this._saveUrlAsNewResource(t,i,a,s);else if(r===p&&e){const r=I(e,o);h(r)?this._saveUrlAsNewResource(t,i,a,s):t[i]=r}}set inclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("inclusionModeDefinition",e):a.getLogger(this).error("#inclusionModeDefinition","inclusionModeDefinition cannot be changed after the layer is loaded.")}loadLayerAssumingLocalCache(){const e=[...this.memberEntityTypes,...this.memberRelationshipTypes];this.originIdOf("layers")===w.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===w.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const i=r(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((e=>{i.add(e.id)}))}))}async addRecords(e){await this.load(),await this._handleNewRecords(e)}async removeRecords(e){await this.load();const t=[];for(const i of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(i.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(i.typeName)?.members?.has(i.id)&&t.push(i);this.dataManager.removeFromLayer(t);for(const i of t)this.sublayerIdsCache.get(i.typeName)?.delete(i.id);return this._refreshNamedTypes(),t}};e([m()],U.prototype,"dataManager",void 0),e([m({json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],U.prototype,"definitionSetMap",void 0),e([u("definitionSetMap")],U.prototype,"readDefinitionSetMap",null),e([g("definitionSetMap")],U.prototype,"writeDefinitionSetMap",null),e([m()],U.prototype,"inclusionModeDefinition",null),e([m()],U.prototype,"knowledgeGraph",void 0),e([m({type:o.ofType(_),json:{write:{ignoreOrigin:!0}}})],U.prototype,"layers",void 0),e([m()],U.prototype,"memberEntityTypes",void 0),e([m()],U.prototype,"memberRelationshipTypes",void 0),e([m({type:["KnowledgeGraphLayer"]})],U.prototype,"operationalLayerType",void 0),e([m()],U.prototype,"sublayerIdsCache",void 0),e([m({type:o.ofType(_),json:{write:{ignoreOrigin:!0}}})],U.prototype,"tables",void 0),e([m({json:{read:!1}})],U.prototype,"type",void 0),e([m(N)],U.prototype,"url",void 0),U=e([f("esri.layers.KnowledgeGraphLayer")],U);const O=U;async function x(e){const t=await i(e);return new Blob([t],{type:"application/x-protobuf"})}function P(e){const t=`definitionSetMap-${c()}.dat`,i=y("knowledgeGraphLayer",t);return e.resourceFromPath(i)}export{O as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{fetchAndConvertSerializedKnowledgeIdMap as i,serializeInclusionDefinitionToIdCollectionsMapPbf as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import a from"../core/Collection.js";import s from"../core/Error.js";import o from"../core/Logger.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{MultiOriginJSONMixin as n}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as p}from"../core/promiseUtils.js";import{watch as d,sync as l}from"../core/reactiveUtils.js";import{isAbsolute as h,join as y}from"../core/urlUtils.js";import{generateUUID as c}from"../core/uuid.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../core/accessorSupport/decorators/writer.js";import{OriginId as w,idToName as M,nameToId as b}from"../core/accessorSupport/PropertyOrigin.js";import T from"./Layer.js";import{KnowledgeGraphLayerDataManager as D}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import S from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{initializeLayersFromClientData as _}from"./knowledgeGraph/layerUtils.js";import{ArcGISService as L}from"./mixins/ArcGISService.js";import{BlendLayer as v}from"./mixins/BlendLayer.js";import{CustomParametersMixin as k}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as A}from"./mixins/PortalLayer.js";import{RefreshableLayer as C}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as G}from"./mixins/ScaleRangeLayer.js";import{url as N}from"./support/commonProperties.js";import{fetchKnowledgeGraph as E}from"../rest/knowledgeGraphService.js";import{f as I,t as x}from"../chunks/persistableUrlUtils.js";let R=class extends(v(G(C(L(j(A(n(k(T))))))))){constructor(e){super(e),this._graphTypeLookup=new Map,this._namedTypesModified=!1,this.dataManager=null,this.definitionSetMap=null,this.knowledgeGraph=null,this.layers=new(a.ofType(S)),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="KnowledgeGraphLayer",this.sublayerIdsCache=new Map,this.tables=new(a.ofType(S)),this.type="knowledge-graph",this.url=null,this.addHandles(d((()=>this.layers.concat(this.tables)),((e,i)=>this._handleSublayersChange(e,i)),l))}load(e){return this.addResolvingPromise(this._doLoad(e)),Promise.resolve(this)}async _doLoad(e){try{await this.loadFromPortal({supportedTypes:["Knowledge Graph Layer"]},e)}catch(i){p(i)}await this._fetchMetadata(),await this._initializeLayerProperties(),this.loadLayerAssumingLocalCache(),this._layersLoadedFromAuthoritativeItem()||await _(this)}async _fetchMetadata(){if(!this.url)throw new s("knowledge-graph:missing-url","KnowledgeGraphLayer must be created with a url");const e=await E(this.url);this.knowledgeGraph=e,this._forEachGraphType((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}))}async _initializeLayerProperties(){this.originIdOf("inclusionModeDefinition")===w.USER?this._validateInclusionModeDefinition():await this._initializeInclusionModeDefinition(),this._setMemberTypes(),this.dataManager=new D({knowledgeGraph:this.knowledgeGraph,inclusionModeDefinition:this.inclusionModeDefinition})}async _initializeInclusionModeDefinition(){const e=this.definitionSetMap?await i(this.definitionSetMap,!0):{generateAllSublayers:!0,namedTypeDefinitions:new Map};[...this.layers.toArray(),...this.tables.toArray()].forEach((i=>{const t=this._graphTypeLookup.get(i.graphTypeName);t&&!e.namedTypeDefinitions.has(t.name)&&e.namedTypeDefinitions.set(t.name,{useAllData:!0})})),this.setAtOrigin("inclusionModeDefinition",e,M(this.originIdOf("definitionSetMap")))}_validateInclusionModeDefinition(){const{inclusionModeDefinition:e}=this;if(!e)return;const{namedTypeDefinitions:i}=e;if(i?.size>0)i.forEach(((e,t)=>{const a=this._graphTypeLookup.get(t);if(!a)return o.getLogger(this).warn(`A named type, ${t}, was in the inclusion list that wasn't in the data model and will be removed`),void i.delete(t);"relationship"!==a.type&&"entity"!==a.type&&(o.getLogger(this).warn(`A named type, ${t}, was in the inclusion list that wasn't properly modeled and will be removed`),i.delete(t))}));else if(!e.generateAllSublayers)throw new s("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined")}_setMemberTypes(){let e=[],i=[];const{inclusionModeDefinition:t}=this,a=t?.namedTypeDefinitions;!t||t.generateAllSublayers?(e=this.knowledgeGraph.dataModel?.entityTypes??[],i=this.knowledgeGraph.dataModel?.relationshipTypes??[]):a&&a.size>0&&a.forEach(((t,a)=>{const s=this._graphTypeLookup.get(a);switch(s?.type){case"relationship":i.push(s);break;case"entity":e.push(s)}})),this.memberEntityTypes=e,this.memberRelationshipTypes=i}_forEachGraphType(e){[...this.knowledgeGraph.dataModel?.entityTypes??[],...this.knowledgeGraph.dataModel?.relationshipTypes??[]].forEach((i=>{e(i)}))}_refreshNamedTypes(){this._namedTypesModified=!0;for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}async _handleNewRecords(e){const i=[],t=[];for(const a of e){if(!this._graphTypeLookup.has(a.typeName))continue;this.dataManager.sublayerCaches.has(a.typeName)||(this.dataManager.sublayerCaches.set(a.typeName,new Map),i.push(a.typeName));r(this.sublayerIdsCache,a.typeName,(()=>new Set)).add(a.id),t.push(a)}this.dataManager.addToLayer(t);for(const a of i){const e=this._graphTypeLookup.get(a);e&&(this._addSublayer(e),"entity"===e.type?this.dataManager.entityTypeNames.add(a):this.dataManager.relationshipTypeNames.add(a))}await _(this,i),this._refreshNamedTypes()}_createSublayers(e,i,t){e.forEach((e=>{const a=this._createSublayer(e);t(a)&&i.push(a),this._updateSublayerCaches(e)}))}_addSublayer(e){const i=this._createSublayer(e);return i.geometryType?this.layers.push(i):this.tables.push(i),i}_createSublayer(e){return new S({objectType:e,parentCompositeLayer:this,graphType:e.type})}_updateSublayers(e,i){i.forEach((i=>{i.parentCompositeLayer=this;const t=e.find((e=>e.type===i.graphType&&e.name===i.graphTypeName));t&&(i.objectType=t,this._updateSublayerCaches(t))}))}_updateSublayerCaches({name:e}){if(!e)return;const i=this.dataManager.sublayerCaches;i.has(e)||i.set(e,new Map)}_saveUrlAsNewResource(e,i,t,a){e[i]="<pending>",t.pendingOperations.push(O(this.inclusionModeDefinition).then((s=>{const o=K(a);e[i]=o.itemRelativeUrl,t.toAdd.push({resource:o,content:{type:"blob",blob:s},compress:!1,finish:e=>{this.definitionSetMap=e.url}})})))}_displaysAllRecords(e){for(const[,{useAllData:i}]of e.namedTypeDefinitions)if(!i)return!1;return!0}_handleSublayersChange(e,i){i&&(i.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_layersLoadedFromAuthoritativeItem(){const e=this.originIdOf("layers");return e>=w.PORTAL_ITEM&&e<w.USER}readDefinitionSetMap(e,i,t){return I(e,t)}writeDefinitionSetMap(e,i,t,a){const s=a?.portalItem,o=a?.resources,r=b(a?.origin);if(!s||!o||null==r)return void(e&&(i[t]=x(e,a)));const{inclusionModeDefinition:n}=this;if(!n||this._displaysAllRecords(n))return void(this.definitionSetMap=null);const p=this.originIdOf("inclusionModeDefinition");if(p===w.USER||this._namedTypesModified||r<p)this._saveUrlAsNewResource(i,t,o,s);else if(r===p&&e){const r=x(e,a);h(r)?this._saveUrlAsNewResource(i,t,o,s):i[t]=r}}set inclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("inclusionModeDefinition",e):o.getLogger(this).error("#inclusionModeDefinition","inclusionModeDefinition cannot be changed after the layer is loaded.")}loadLayerAssumingLocalCache(){const e=[...this.memberEntityTypes,...this.memberRelationshipTypes];this.originIdOf("layers")===w.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===w.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,i)=>{const t=r(this.sublayerIdsCache,i,(()=>new Set));e.members?.forEach((e=>{t.add(e.id)}))}))}async addRecords(e){await this.load(),await this._handleNewRecords(e)}async createSublayerForNamedType(e){await this.load();const i=this._graphTypeLookup.get(e);if(!i)throw new s("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");if(this.dataManager.sublayerCaches.has(e))throw new s("knowledge-graph:duplicate-type","The specified type already exists as a sublayer.");this.dataManager.sublayerCaches.set(e,new Map),r(this.sublayerIdsCache,e,(()=>new Set));const t=this._addSublayer(i);return"entity"===i.type?this.dataManager.entityTypeNames.add(e):this.dataManager.relationshipTypeNames.add(e),this.dataManager.inclusionModeDefinition&&this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!0}),await _(this,[e]),this._refreshNamedTypes(),t}convertSublayerToDynamicData(e){if(!this.dataManager.inclusionModeDefinition)throw new s("knowledge-graph:fully-dynamic-membership","This Knowledge Graph Layer already uses fully dynamic membership, individual sublayers cannot be converted");if(!this._graphTypeLookup.get(e))throw new s("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");if(!this.dataManager.sublayerCaches.has(e))throw new s("knowledge-graph:duplicate-type","The specified type does not exist as a sublayer.");const i=this.dataManager.inclusionModeDefinition.namedTypeDefinitions.get(e);i?.useAllData?o.getLogger(this).warn("This Knowledge Graph Layer already uses dynamic membership for the sublayer - no conversion was made"):(this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!0}),this.sublayerIdsCache.delete(e),this._refreshNamedTypes())}convertSublayerToExplicitMembership(e){if(!this.dataManager.inclusionModeDefinition)throw new s("knowledge-graph:fully-dynamic-membership","This Knowledge Graph Layer already uses fully dynamic membership, individual sublayers cannot be converted");if(!this._graphTypeLookup.get(e))throw new s("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");const i=this.dataManager.inclusionModeDefinition.namedTypeDefinitions.get(e);if(!i||i.useAllData){if(!this.dataManager.sublayerCaches.has(e))throw new s("knowledge-graph:duplicate-type","The specified type does not exist as a sublayer.");this.sublayerIdsCache.set(e,new Set),this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:new Map}),this._refreshNamedTypes()}else o.getLogger(this).warn("This Knowledge Graph Layer already uses explicit membership for the sublayer - no conversion was made")}convertToFullyDynamicData(){this.dataManager.inclusionModeDefinition||o.getLogger(this).warn("This Knowledge Graph Layer already uses fully dynamic membership - no conversion was made"),this.sublayerIdsCache.clear(),this.dataManager.inclusionModeDefinition=null,this._refreshNamedTypes()}convertToExplicitMembership(){this.dataManager.inclusionModeDefinition&&this.dataManager.inclusionModeDefinition.namedTypeDefinitions.size>0&&o.getLogger(this).warn("This Knowledge Graph Layer already uses explicit membership - no conversion was made"),this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map};for(const e of this.dataManager.sublayerCaches.keys())r(this.sublayerIdsCache,e,(()=>new Set)),this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:new Map});this._refreshNamedTypes()}async removeRecords(e){await this.load();const i=[];for(const t of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(t.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(t.typeName)?.members?.has(t.id)&&i.push(t);this.dataManager.removeFromLayer(i);for(const t of i)this.sublayerIdsCache.get(t.typeName)?.delete(t.id);return this._refreshNamedTypes(),i}};e([m()],R.prototype,"dataManager",void 0),e([m({json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],R.prototype,"definitionSetMap",void 0),e([u("definitionSetMap")],R.prototype,"readDefinitionSetMap",null),e([g("definitionSetMap")],R.prototype,"writeDefinitionSetMap",null),e([m()],R.prototype,"inclusionModeDefinition",null),e([m()],R.prototype,"knowledgeGraph",void 0),e([m({type:a.ofType(S),json:{write:{ignoreOrigin:!0}}})],R.prototype,"layers",void 0),e([m()],R.prototype,"memberEntityTypes",void 0),e([m()],R.prototype,"memberRelationshipTypes",void 0),e([m({type:["KnowledgeGraphLayer"]})],R.prototype,"operationalLayerType",void 0),e([m()],R.prototype,"sublayerIdsCache",void 0),e([m({type:a.ofType(S),json:{write:{ignoreOrigin:!0}}})],R.prototype,"tables",void 0),e([m({json:{read:!1}})],R.prototype,"type",void 0),e([m(N)],R.prototype,"url",void 0),R=e([f("esri.layers.KnowledgeGraphLayer")],R);const U=R;async function O(e){const i=await t(e);return new Blob([i],{type:"application/x-protobuf"})}function K(e){const i=`definitionSetMap-${c()}.dat`,t=y("knowledgeGraphLayer",i);return e.resourceFromPath(t)}export{U as default};
|
package/layers/LinkChartLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{serializationUtilsModuleWrapper as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import a from"../core/Collection.js";import i from"../core/Error.js";import n from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as s,isAbortError as l,createAbortError as h}from"../core/promiseUtils.js";import{watch as d,sync as p}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as y,idToName as g}from"../core/accessorSupport/PropertyOrigin.js";import m from"../geometry/Extent.js";import f from"../geometry/Point.js";import L from"../geometry/Polyline.js";import w from"./Layer.js";import{convertFromGeometry as b}from"./graphics/featureConversionUtils.js";import{systemOidFieldName as M,systemOriginIdFieldName as k,systemDestinationIdFieldName as C,systemLayoutGeometryFieldName as T,systemAggregationCountFieldName as N}from"./knowledgeGraph/constants.js";import{IdealEdgeLengthTypeOptions as v}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as D}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import x from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{initializeLayersFromClientData as I}from"./knowledgeGraph/layerUtils.js";import E from"./knowledgeGraph/SessionMemoryStorage.js";import{convertLayoutTypeToWebSupportedFormat as S,getRelationshipEndNodeIds as _}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as R}from"./mixins/BlendLayer.js";import{OperationalLayer as A}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{url as G}from"./support/commonProperties.js";import{LCChronologicalLayout as z,LCSimpleLayout as P,LCSmartTreeLayout as O,LCRadialTreeLayout as F,LCHierarchicalLayout as U,LCCommunityLayout as B,LCForceDirectedLayout as Q,NodeFlag as W,load as $,CallStatus as H,LinkType as K}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as V}from"../rest/knowledgeGraphService.js";let q=class extends(A(R(j(r(w))))){constructor(e){if(super(e),this.url=null,this.dataPreloadedInLocalCache=!1,this.initializationLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"organic-standard"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(a.ofType(x)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new m({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(a.ofType(x)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.initializationInclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.initializationInclusionModeDefinition)throw new i("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");this.addHandles(d((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),p))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:a,dataPreloadedInLocalCache:i,initializationLinkChartConfig:n}=e;return{url:t,title:a,dataPreloadedInLocalCache:i,initializationLinkChartConfig:n}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let a=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new i("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(a=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,r)=>{const s=this._graphTypeLookup.get(r);if(!s)return n.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(r);"relationship"===s.type?t.has(r)||(t.add(r),o.push(s)):"entity"===s.type?t.has(r)||(t.add(r),a.push(s)):(n.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(r))})):(a=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const r=new D({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=a,this.memberRelationshipTypes=o,this.dataManager=r}load(e){const a=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),this._layersLoadedFromAuthoritativeItem()||await I(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach((a=>{t.push(a.refreshCachedQueryEngine()),e.push(new Promise((e=>{a.on("layerview-create",(()=>{e(null)}))})))})),this.tables.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t)};return this.addResolvingPromise(new Promise((i=>{V(this.url).then((async n=>{n.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),n.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}));const r=this.linkChart?.linkChartProperties;if(r?.originIdOf("entitiesUrl")===y.LINK_CHART&&(this.membershipModified=!1,this._originalInclusionList=await t.fetchAndConvertSerializedLinkChart({entitiesUrl:r?.entitiesUrl,relationshipsUrl:r?.relationshipsUrl}),this._alignLayersDataModelAndInclusionDefinition(n.dataModel),this.initializationLinkChartConfig={layoutSettings:r?.layoutSettings??void 0,layoutMode:S(r.layoutType)}),this._initializeLayerProperties({knowledgeGraph:n,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache){const e=E.getInstance();for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const i of a.members?.values()??[]){const a=e.readFromStoreById(`${t}__${i.id}`);if(a){o(this.dataManager.sublayerCaches,t,(()=>new Map)).set(i.id,a)}}await a()}else{const t="geographic-organic-standard"===this.initializationLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{s(e),await a()})))}i(null)}))}))),Promise.resolve(this)}set initializationInclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("initializationInclusionModeDefinition",e):n.getLogger(this).error("#initializationInclusionModeDefinition","initializationInclusionModeDefinition cannot be changed after the layer is loaded.")}get linkChart(){return this.parent}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await _(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));i.length>0&&(this.membershipModified=!0),await this._handleNewRecords(i,t)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1,overrideMembershipCheck:i=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1,overrideMembershipCheck:!1}){let n=[];for(const s of e)(i||!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(s.typeName)?.members?.has(s.id))&&n.push(s);if(t){const e=new Set,t=[];for(const a of n)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});n=n.concat(t)}this.dataManager.removeFromLayer(n);for(const s of n)this.sublayerIdsCache.get(s.typeName)?.delete(s.id),this.dataManager.relationshipTypeNames.has(s.typeName)?this.relationshipLinkChartDiagramLookup.delete(s.id):this.entityLinkChartDiagramLookup.delete(s.id);const o=a?void 0:this.getCurrentNodeLocations();await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:o}),n.length>0&&(this.membershipModified=!0);const r=[];return this.layers.forEach((e=>{r.push(e.refreshCachedQueryEngine())})),await Promise.all(r),this._refreshNamedTypes(),n}async expand(e,t){let a=[];try{const i=await this.dataManager.getConnectedRecordIds(e,t?.relationshipTypeNames,t);a=i.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id))),await this._handleNewRecords(i,t),i.length>0&&(this.membershipModified=!0),s(t?.signal)}catch(i){throw l(i)&&a.length>0&&await this.removeRecords(a,{overrideMembershipCheck:!0}),i}return{records:a}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.originIdOf("layers")===y.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===y.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const a=o(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((({id:e,linkChartLocation:i})=>{if(a.add(e),i){const a="coords"in i&&"lengths"in i?i:b(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,a):this.entityLinkChartDiagramLookup.set(e,a)}}))}))}async calculateLinkChartLayout(e="organic-standard",t){const a=[],r=[],l=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{a.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{r.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const d=new Map,p=new Map,c=new Map,u=new Map,y=new Uint8Array(a.length),g=new Float64Array(a.length),w=new Float64Array(a.length),v=new Float64Array(a.length),D=new Float64Array(a.length),x=new Uint32Array(r.length),I=new Uint32Array(r.length),E=new Float64Array(r.length),S=new Float64Array(r.length),_=[],R="organic-standard";let A=!1;const j=new m({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let G,V="organic-standard",q=0,J=0;const X=z.apply;switch(V="geographic-organic-standard"===e?R:e,V){case"organic-standard":G=Q.apply;break;case"organic-community":G=B.apply;break;case"hierarchical-bottom-to-top":G=U.apply;break;case"radial-root-centric":G=F.apply;break;case"tree-left-to-right":G=O.apply;break;default:G=P.apply}let Y=!1;a.forEach((({typeName:a,feature:i})=>{if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e&&t?.lockedNodeLocations?.has(i.attributes[M])){"geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)?y[q]=W.IsGeographic:y[q]=W.None;const n=t.lockedNodeLocations.get(i.attributes[M]);g[q]=n.x,w[q]=n.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)){y[q]=W.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":g[q]=t?.x,w[q]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(g[q]=e.x,w[q]=e.y):y[q]=W.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(g[q]=e.x,w[q]=e.y):y[q]=W.IsMovable;break;default:y[q]=W.IsMovable}(null==g[q]||null==w[q]||Number.isNaN(g[q])||Number.isNaN(w[q]))&&(y[q]=W.IsMovable,g[q]=0,w[q]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!Y&&t?.lockedNodeLocations?.has(i.attributes[M])&&(Y=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;v[q]=o?new Date(o).getTime():NaN;const r=e?.endField,s=r&&e?.endField?i.attributes[r]:null;D[q]=s?new Date(s).getTime():NaN,g[q]=0,w[q]=0,y[q]=W.IsMovable}else y[q]=W.IsMovable,g[q]=0,w[q]=0;u.set(i.attributes[M],q),_[q]={feature:i,typeName:a},q++})),Y&&n.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let Z=!1;const ee=new Map;r.forEach((a=>{const i=a.feature.attributes[k],n=a.feature.attributes[C],o=u.get(i),r=u.get(n),s=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?s?.startField:null,d=h?a.feature.attributes[h]:null,p=s?.endField,c=p?a.feature.attributes[p]:null;if(void 0!==o&&void 0!==r){let t=i+"-"+n;"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(t=t+"-"+d+"-"+c);const s=ee.get(t),h=s?.has(a.typeName);h||(x[J]=o,I[J]=r,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(E[J]=d?new Date(d).getTime():NaN,S[J]=c?new Date(c).getTime():NaN),void 0===s?ee.set(t,new Map([[a.typeName,J]])):s.set(a.typeName,J),J++),l.push(a)}else Z=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),Z&&n.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");const te=this._validateOrganicLayoutSettings(e,t?.layoutSettings?.organicLayoutSettings),ae=this._convertValidatedOrganicSettingsToCalculationSettings(te);await $();let ie=H.Error,ne=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let a;({status:ie,links:ne,graphics:a}=X((()=>t?.signal?.aborted??!1),y,g,w,v,D,x.subarray(0,J),I.subarray(0,J),E.subarray(0,J),S.subarray(0,J),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings)),ie===H.Success&&(this.chronologicalAuxiliaryGraphics=a)}else({status:ie,links:ne}=G((()=>t?.signal?.aborted??!1),y,g,w,x.subarray(0,J),I.subarray(0,J),ae.computationBudgetTime,ae.idealEdgeLengthMultiplier,ae.repulsionRadiusMultiplier));if(s(t?.signal),ie===H.Error)throw new i("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(ie===H.Canceled)throw h();for(let i=0;i<_.length;i++){if(w[i]>84.9999?w[i]=84.9999:w[i]<-84.9999&&(w[i]=-84.9999),g[i]>179.9999?g[i]=179.9999:g[i]<-179.9999&&(g[i]=-179.9999),_[i].feature.attributes[T]=new f(g[i],w[i]),d.has(_[i].typeName)){const e=d.get(_[i].typeName);e?.set(_[i].feature.attributes[M],_[i].feature)}else{const e=new Map;e.set(_[i].feature.attributes[M],_[i].feature),d.set(_[i].typeName,e)}c.set(_[i].feature.attributes[M],_[i].feature);const e=b(_[i].feature.attributes[T]);this.entityLinkChartDiagramLookup.set(_[i].feature.attributes[M],_[i].feature.attributes[T]?e:null);const t=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,_[i].typeName,(()=>({useAllData:!1,members:new Map})));o(t.members,_[i].feature.attributes[M],(()=>({id:_[i].feature.attributes[M],linkChartLocation:void 0}))).linkChartLocation=_[i].feature.attributes[T];const{x:a,y:n}=_[i].feature.attributes[T];if(A)j.xmin=Math.min(j.xmin,a),j.xmax=Math.max(j.xmax,a),j.ymin=Math.min(j.ymin,n),j.ymax=Math.max(j.ymax,n);else{const e=1e-7;j.xmin=a-e,j.xmax=a+e,j.ymin=n-e,j.ymax=n+e,A=!0}}if(this.linkChartExtent.xmin=j.xmin,this.linkChartExtent.xmax=j.xmax,this.linkChartExtent.ymin=j.ymin,this.linkChartExtent.ymax=j.ymax,!ne)throw new i("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const oe=new Map,re=new Map,se=new Map,le=new Set;for(let i=0;i<l.length;i++){const a=[],r=l[i],s=r.feature.attributes[k],h=r.feature.attributes[C];let d=s+"-"+h;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){const e=t?.timeInfoByTypeName?.get(r.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?r.feature.attributes[a]:null,n=e?.endField;d+="-"+i+"-"+(n?r.feature.attributes[n]:null)}const y=ee.get(d).get(r.typeName),g=0===y?0:ne?.vertexEndIndex[y-1];if(!le.has(y)){if(le.add(y),ne.types[y]===K.Recursive){const e=[ne.vertices[2*g],ne.vertices[2*g+1]],t=[ne.vertices[2*(g+1)],ne.vertices[2*(g+1)+1]],i=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],n=[i[0]-e[0],i[1]-e[1]],o=[i[0]+n[1],i[1]-n[0]],r=[i[0]-n[1],i[1]+n[0]];a.push(e),a.push(o),a.push(t),a.push(r),a.push(e)}else{if(ne.types[y]!==K.Regular){n.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=g;e<ne.vertexEndIndex[y];e++)a.push([ne.vertices[2*e],ne.vertices[2*e+1]])}if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e){const e=_[u.get(s)]?.feature.attributes[T],t=_[u.get(h)]?.feature.attributes[T];a[0][0]===e.x&&a[0][1]===e.y||(a[0]=[e.x,e.y]),a[a.length-1][0]===t.x&&a[a.length-1][1]===t.y||(a[a.length-1]=[t.x,t.y])}for(let e=1;e<a.length-1;e++)a[e][1]>85.5?a[e][1]=85.5:a[e][1]<-85.5&&(a[e][1]=-85.5),a[e][0]>179.9999?a[e][0]=179.9999:a[e][0]<-179.9999&&(a[e][0]=-179.9999);oe.has(d)?oe.get(d).push(a):oe.set(d,[a])}const m=oe.get(d);re.has(d)||(re.set(d,new Map),se.set(d,new Map));const f=re.get(d),w=se.get(d);f.has(r.typeName)||(f.set(r.typeName,m.shift()),w.set(r.typeName,0));const N=f.get(r.typeName);w.set(r.typeName,w.get(r.typeName)+1);const v=new L({paths:[N]});if(r.feature.attributes[T]=v,p.has(r.typeName)){const e=p.get(r.typeName);e?.set(r.feature.attributes[M],r.feature)}else{const e=new Map;e.set(r.feature.attributes[M],r.feature),p.set(r.typeName,e)}c.set(r.feature.attributes[M],r.feature);const D=b(r.feature.attributes[T]);this.relationshipLinkChartDiagramLookup.set(r.feature.attributes[M],r.feature.attributes[T]?D:null);const x=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,r.typeName,(()=>({useAllData:!1,members:new Map})));o(x.members,r.feature.attributes[M],(()=>({id:r.feature.attributes[M],linkChartLocation:void 0}))).linkChartLocation=D}for(const i of l)i.feature.attributes[N]=se.get(i.feature.attributes[k]+"-"+i.feature.attributes[C])?.get(i.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutSettings:t?.layoutSettings?.clone()},{nodes:d,links:p,idMap:c}}async applyNewLinkChartLayout(e="organic-standard",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),this.membershipModified=!0,await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||a?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new f({x:i.x,y:i.y})))}));return e}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}a=await this.dataManager.getRelationshipsBetweenNodes(e,i,t),await this._handleNewRecords(a,t),s(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}async connectFromEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}let n=[];for(const e of this.dataManager.entityTypeNames){const t=this.sublayerIdsCache.get(e);t&&(n=n.concat(Array.from(t)))}a=await this.dataManager.getRelationshipsFromNodes(e,n,i,t),await this._handleNewRecords(a,t),a.length>0&&(this.membershipModified=!0),s(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="organic-standard",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t}),this.linkChart?.handleChronologicalOverlay()}async _handleNewRecords(e,t){const a=[],i=[];for(const r of e){if(!this._graphTypeLookup.has(r.typeName))continue;this.dataManager.sublayerCaches.has(r.typeName)||(this.dataManager.sublayerCaches.set(r.typeName,new Map),a.push(r.typeName));o(this.sublayerIdsCache,r.typeName,(()=>new Set)).add(r.id),i.push(r)}this.dataManager.addToLayer(i);for(const o of a){const e=this._graphTypeLookup.get(o);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(o):this.dataManager.relationshipTypeNames.add(o),t.geometryType?this.layers.push(t):this.tables.push(t)}}await I(this,a,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)),void 0,void 0,void 0,t);const n={layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:new Map};for(const[o,r]of this.entityLinkChartDiagramLookup.entries())r&&n.lockedNodeLocations.set(o,new f(r.coords[0],r.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,n)}_createSublayers(e,t,a){e.forEach((e=>{const i=this._createSublayer(e);a(i)&&t.push(i),this._updateSublayerCaches(e)}))}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const a=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));a&&(t.objectType=a,t.read({title:a.name},{origin:"service"}),this._updateSublayerCaches(a))}))}_updateSublayerCaches({name:e}){if(!e)return;const t=this.dataManager.sublayerCaches;t.has(e)||t.set(e,new Map)}_layersLoadedFromAuthoritativeItem(){const e=this.originIdOf("layers");return e>=y.PORTAL_ITEM&&e<y.USER}async _initializeDiagram(){this.initializationLinkChartConfig?this.initializationLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const o=b(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[k]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[C]);if(t&&a){const i=b(new L({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[M],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[M],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.initializationLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.initializationLinkChartConfig||{}}):await this._calculateLayoutWithSublayerTimeInfo("organic-standard",{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})}_validateOrganicLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),i=e=>a(e)&&e>=1,o=e=>a(e)&&e>=1,r=e=>Object.values(v).includes(e),s=e=>a(e)&&e>=0,l={};if(!new Set(["organic-standard","organic-community","geographic-organic-standard","chronological-multi-timeline","chronological-mono-timeline"]).has(e)||!t)return l;const{computationBudgetTime:h,autoRepulsionRadius:d,repulsionRadiusMultiplier:p,absoluteIdealEdgeLength:c,multiplicativeIdealEdgeLength:u,idealEdgeLengthType:y}=t;return o(h)?l.computationBudgetTime=h:h&&n.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),l.autoRepulsionRadius=d,!d&&i(p)?l.repulsionRadiusMultiplier=p:d||(l.autoRepulsionRadius=!0,n.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting")),"geographic-organic-standard"===e&&(r(y)?l.idealEdgeLengthType=y:void 0!==y&&n.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),"absolute-value"===y&&s(c)?l.absoluteIdealEdgeLength=c:"absolute-value"===y&&void 0!==c?n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting"):"multiplier"===y&&s(u)?l.multiplicativeIdealEdgeLength=u:"multiplier"===y&&void 0!==u&&n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),l}_convertValidatedOrganicSettingsToCalculationSettings(e){let t=e.idealEdgeLengthType===v.ABSOLUTE?e.absoluteIdealEdgeLength:e.multiplicativeIdealEdgeLength;return e.idealEdgeLengthType===v.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime??void 0,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier&&!e.autoRepulsionRadius?e.repulsionRadiusMultiplier:void 0,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new x({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const t=new Set((e.entityTypes??[]).map((e=>e.name)).concat((e.relationshipTypes??[]).map((e=>e.name)))),i=new Set((e.entityTypes??[]).map((e=>e.name))),o=new Set((e.relationshipTypes??[]).map((e=>e.name)));if(this.layers){for(const a of this.layers)!a.graphType&&t.has(a.graphTypeName)&&(a.graphType=i.has(a.graphTypeName)?"entity":"relationship");const e=this.layers.filter((e=>t.has(e.graphTypeName)&&("entity"===e.graphType?i.has(e.graphTypeName):o.has(e.graphTypeName))));this.setAtOrigin("layers",e,g(this.originIdOf("layers")))}else this.layers=new a;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map((e=>e.graphTypeName))??[],a=this.layers.map((e=>e.graphTypeName)).concat(t);for(const n of a)e.has(n)||this._originalInclusionList.namedTypeDefinitions.set(n,{useAllData:!1,members:new Map});const i=[];for(const o of this._originalInclusionList.namedTypeDefinitions.keys())a.includes(o)||(n.getLogger(this).warn(`A named type, ${o}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),i.push(o));for(const n of i)this._originalInclusionList.namedTypeDefinitions.delete(n)}}};e([c(G)],q.prototype,"url",void 0),e([c()],q.prototype,"dataPreloadedInLocalCache",void 0),e([c()],q.prototype,"initializationLinkChartConfig",void 0),e([c()],q.prototype,"membershipModified",void 0),e([c()],q.prototype,"dataManager",void 0),e([c()],q.prototype,"initializationInclusionModeDefinition",null),e([c()],q.prototype,"knowledgeGraph",void 0),e([c({type:a.ofType(x),json:{write:{ignoreOrigin:!0}}})],q.prototype,"layers",void 0),e([c({readOnly:!0})],q.prototype,"linkChart",null),e([c()],q.prototype,"entityLinkChartDiagramLookup",void 0),e([c()],q.prototype,"relationshipLinkChartDiagramLookup",void 0),e([c()],q.prototype,"linkChartExtent",void 0),e([c()],q.prototype,"memberEntityTypes",void 0),e([c()],q.prototype,"memberRelationshipTypes",void 0),e([c({type:["LinkChartLayer"]})],q.prototype,"operationalLayerType",void 0),e([c()],q.prototype,"sublayerIdsCache",void 0),e([c({type:a.ofType(x),json:{write:{ignoreOrigin:!0}}})],q.prototype,"tables",void 0),e([c({json:{read:!1}})],q.prototype,"type",void 0),e([c({json:{read:!1}})],q.prototype,"chronologicalAuxiliaryGraphics",void 0),q=e([u("esri.layers.LinkChartLayer")],q);const J=q;export{J as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{serializationUtilsModuleWrapper as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import a from"../core/Collection.js";import i from"../core/Error.js";import n from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as r,isAbortError as l,createAbortError as h}from"../core/promiseUtils.js";import{watch as d,sync as p}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as y,idToName as g}from"../core/accessorSupport/PropertyOrigin.js";import m from"../geometry/Extent.js";import f from"../geometry/Point.js";import L from"../geometry/Polyline.js";import w from"./Layer.js";import{convertFromGeometry as b}from"./graphics/featureConversionUtils.js";import{systemOidFieldName as M,systemOriginIdFieldName as k,systemDestinationIdFieldName as C,systemLayoutGeometryFieldName as T,systemAggregationCountFieldName as N}from"./knowledgeGraph/constants.js";import{IdealEdgeLengthTypeOptions as D}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as v}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import x from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{initializeLayersFromClientData as I}from"./knowledgeGraph/layerUtils.js";import E from"./knowledgeGraph/SessionMemoryStorage.js";import{convertLayoutTypeToWebSupportedFormat as S,getRelationshipEndNodeIds as _}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as A}from"./mixins/BlendLayer.js";import{OperationalLayer as R}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{url as G}from"./support/commonProperties.js";import{LCChronologicalLayout as z,LCSimpleLayout as P,LCSmartTreeLayout as F,LCRadialTreeLayout as O,LCHierarchicalLayout as U,LCCommunityLayout as B,LCForceDirectedLayout as Q,NodeFlag as W,load as $,CallStatus as H,LinkType as K}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as V}from"../rest/knowledgeGraphService.js";let q=class extends(R(A(j(s(w))))){constructor(e){if(super(e),this.url=null,this.dataPreloadedInLocalCache=!1,this.initializationLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"organic-standard"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(a.ofType(x)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new m({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(a.ofType(x)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.initializationInclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.initializationInclusionModeDefinition)throw new i("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");this.addHandles(d((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),p))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:a,dataPreloadedInLocalCache:i,initializationLinkChartConfig:n}=e;return{url:t,title:a,dataPreloadedInLocalCache:i,initializationLinkChartConfig:n}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let a=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new i("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(a=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,s)=>{const r=this._graphTypeLookup.get(s);if(!r)return n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(s);"relationship"===r.type?t.has(s)||(t.add(s),o.push(r)):"entity"===r.type?t.has(s)||(t.add(s),a.push(r)):(n.getLogger(this).warn(`A named type, ${s}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(s))})):(a=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const s=new v({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=a,this.memberRelationshipTypes=o,this.dataManager=s}load(e){const a=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),this._layersLoadedFromAuthoritativeItem()||await I(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach((a=>{t.push(a.refreshCachedQueryEngine()),e.push(new Promise((e=>{a.on("layerview-create",(()=>{e(null)}))})))})),this.tables.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t)};return this.addResolvingPromise(new Promise((i=>{V(this.url).then((async n=>{n.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),n.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}));const s=this.linkChart?.linkChartProperties;if(s?.originIdOf("entitiesUrl")===y.LINK_CHART&&(this.membershipModified=!1,this._originalInclusionList=await t.fetchAndConvertSerializedLinkChart({entitiesUrl:s?.entitiesUrl,relationshipsUrl:s?.relationshipsUrl}),this._alignLayersDataModelAndInclusionDefinition(n.dataModel),this.initializationLinkChartConfig={layoutSettings:s?.layoutSettings??void 0,layoutMode:S(s.layoutType)}),this._initializeLayerProperties({knowledgeGraph:n,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache){const e=E.getInstance();for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const i of a.members?.values()??[]){const a=e.readFromStoreById(`${t}__${i.id}`);if(a){o(this.dataManager.sublayerCaches,t,(()=>new Map)).set(i.id,a)}}await a()}else{const t="geographic-organic-standard"===this.initializationLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{r(e),await a()})))}i(null)}))}))),Promise.resolve(this)}set initializationInclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("initializationInclusionModeDefinition",e):n.getLogger(this).error("#initializationInclusionModeDefinition","initializationInclusionModeDefinition cannot be changed after the layer is loaded.")}get linkChart(){return this.parent}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await _(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));i.length>0&&(this.membershipModified=!0),await this._handleNewRecords(i,t)}async createSublayerForNamedType(e){await this.load();const t=this._graphTypeLookup.get(e);if(!t)throw new i("knowledge-graph:missing-type","The specified type does not exist in the knowledge graph.");if(this.dataManager.sublayerCaches.has(e))throw new i("knowledge-graph:duplicate-type","The specified type already exists as a sublayer.");this.dataManager.sublayerCaches.set(e,new Map),o(this.sublayerIdsCache,e,(()=>new Set));const a=this._createSublayer(t);return"entity"===t.type?this.dataManager.entityTypeNames.add(e):this.dataManager.relationshipTypeNames.add(e),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.set(e,{useAllData:!1,members:new Map}),a.geometryType?this.layers.push(a):this.tables.push(a),await I(this,[e]),this._refreshNamedTypes(),a}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1,overrideMembershipCheck:i=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1,overrideMembershipCheck:!1}){let n=[];for(const r of e)(i||!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.members?.has(r.id))&&n.push(r);if(t){const e=new Set,t=[];for(const a of n)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});n=n.concat(t)}this.dataManager.removeFromLayer(n);for(const r of n)this.sublayerIdsCache.get(r.typeName)?.delete(r.id),this.dataManager.relationshipTypeNames.has(r.typeName)?this.relationshipLinkChartDiagramLookup.delete(r.id):this.entityLinkChartDiagramLookup.delete(r.id);const o=a?void 0:this.getCurrentNodeLocations();await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:o}),n.length>0&&(this.membershipModified=!0);const s=[];return this.layers.forEach((e=>{s.push(e.refreshCachedQueryEngine())})),await Promise.all(s),this._refreshNamedTypes(),n}async expand(e,t){let a=[];try{const i=await this.dataManager.getConnectedRecordIds(e,t?.relationshipTypeNames,t);a=i.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id))),await this._handleNewRecords(i,t),i.length>0&&(this.membershipModified=!0),r(t?.signal)}catch(i){throw l(i)&&a.length>0&&await this.removeRecords(a,{overrideMembershipCheck:!0}),i}return{records:a}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.originIdOf("layers")===y.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===y.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const a=o(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((({id:e,linkChartLocation:i})=>{if(a.add(e),i){const a="coords"in i&&"lengths"in i?i:b(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,a):this.entityLinkChartDiagramLookup.set(e,a)}}))}))}async calculateLinkChartLayout(e="organic-standard",t){const a=[],s=[],l=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{a.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{s.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const d=new Map,p=new Map,c=new Map,u=new Map,y=new Uint8Array(a.length),g=new Float64Array(a.length),w=new Float64Array(a.length),D=new Float64Array(a.length),v=new Float64Array(a.length),x=new Uint32Array(s.length),I=new Uint32Array(s.length),E=new Float64Array(s.length),S=new Float64Array(s.length),_=[],A="organic-standard";let R=!1;const j=new m({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let G,V="organic-standard",q=0,J=0;const X=z.apply;switch(V="geographic-organic-standard"===e?A:e,V){case"organic-standard":G=Q.apply;break;case"organic-community":G=B.apply;break;case"hierarchical-bottom-to-top":G=U.apply;break;case"radial-root-centric":G=O.apply;break;case"tree-left-to-right":G=F.apply;break;default:G=P.apply}let Y=!1;a.forEach((({typeName:a,feature:i})=>{if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e&&t?.lockedNodeLocations?.has(i.attributes[M])){"geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)?y[q]=W.IsGeographic:y[q]=W.None;const n=t.lockedNodeLocations.get(i.attributes[M]);g[q]=n.x,w[q]=n.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)){y[q]=W.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],n=this.dataManager.geographicLookup.get(a)?.geometryType;switch(n){case"esriGeometryPoint":g[q]=t?.x,w[q]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(g[q]=e.x,w[q]=e.y):y[q]=W.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(g[q]=e.x,w[q]=e.y):y[q]=W.IsMovable;break;default:y[q]=W.IsMovable}(null==g[q]||null==w[q]||Number.isNaN(g[q])||Number.isNaN(w[q]))&&(y[q]=W.IsMovable,g[q]=0,w[q]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!Y&&t?.lockedNodeLocations?.has(i.attributes[M])&&(Y=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;D[q]=o?new Date(o).getTime():NaN;const s=e?.endField,r=s&&e?.endField?i.attributes[s]:null;v[q]=r?new Date(r).getTime():NaN,g[q]=0,w[q]=0,y[q]=W.IsMovable}else y[q]=W.IsMovable,g[q]=0,w[q]=0;u.set(i.attributes[M],q),_[q]={feature:i,typeName:a},q++})),Y&&n.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let Z=!1;const ee=new Map;s.forEach((a=>{const i=a.feature.attributes[k],n=a.feature.attributes[C],o=u.get(i),s=u.get(n),r=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?r?.startField:null,d=h?a.feature.attributes[h]:null,p=r?.endField,c=p?a.feature.attributes[p]:null;if(void 0!==o&&void 0!==s){let t=i+"-"+n;"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(t=t+"-"+d+"-"+c);const r=ee.get(t),h=r?.has(a.typeName);h||(x[J]=o,I[J]=s,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(E[J]=d?new Date(d).getTime():NaN,S[J]=c?new Date(c).getTime():NaN),void 0===r?ee.set(t,new Map([[a.typeName,J]])):r.set(a.typeName,J),J++),l.push(a)}else Z=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),Z&&n.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");const te=this._validateOrganicLayoutSettings(e,t?.layoutSettings?.organicLayoutSettings),ae=this._convertValidatedOrganicSettingsToCalculationSettings(te);await $();let ie=H.Error,ne=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let a;({status:ie,links:ne,graphics:a}=X((()=>t?.signal?.aborted??!1),y,g,w,D,v,x.subarray(0,J),I.subarray(0,J),E.subarray(0,J),S.subarray(0,J),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings)),ie===H.Success&&(this.chronologicalAuxiliaryGraphics=a)}else({status:ie,links:ne}=G((()=>t?.signal?.aborted??!1),y,g,w,x.subarray(0,J),I.subarray(0,J),ae.computationBudgetTime,ae.idealEdgeLengthMultiplier,ae.repulsionRadiusMultiplier));if(r(t?.signal),ie===H.Error)throw new i("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(ie===H.Canceled)throw h();for(let i=0;i<_.length;i++){if(w[i]>84.9999?w[i]=84.9999:w[i]<-84.9999&&(w[i]=-84.9999),g[i]>179.9999?g[i]=179.9999:g[i]<-179.9999&&(g[i]=-179.9999),_[i].feature.attributes[T]=new f(g[i],w[i]),d.has(_[i].typeName)){const e=d.get(_[i].typeName);e?.set(_[i].feature.attributes[M],_[i].feature)}else{const e=new Map;e.set(_[i].feature.attributes[M],_[i].feature),d.set(_[i].typeName,e)}c.set(_[i].feature.attributes[M],_[i].feature);const e=b(_[i].feature.attributes[T]);this.entityLinkChartDiagramLookup.set(_[i].feature.attributes[M],_[i].feature.attributes[T]?e:null);const t=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,_[i].typeName,(()=>({useAllData:!1,members:new Map})));o(t.members,_[i].feature.attributes[M],(()=>({id:_[i].feature.attributes[M],linkChartLocation:void 0}))).linkChartLocation=_[i].feature.attributes[T];const{x:a,y:n}=_[i].feature.attributes[T];if(R)j.xmin=Math.min(j.xmin,a),j.xmax=Math.max(j.xmax,a),j.ymin=Math.min(j.ymin,n),j.ymax=Math.max(j.ymax,n);else{const e=1e-7;j.xmin=a-e,j.xmax=a+e,j.ymin=n-e,j.ymax=n+e,R=!0}}if(this.linkChartExtent.xmin=j.xmin,this.linkChartExtent.xmax=j.xmax,this.linkChartExtent.ymin=j.ymin,this.linkChartExtent.ymax=j.ymax,!ne)throw new i("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const oe=new Map,se=new Map,re=new Map,le=new Set;for(let i=0;i<l.length;i++){const a=[],s=l[i],r=s.feature.attributes[k],h=s.feature.attributes[C];let d=r+"-"+h;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){const e=t?.timeInfoByTypeName?.get(s.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?s.feature.attributes[a]:null,n=e?.endField;d+="-"+i+"-"+(n?s.feature.attributes[n]:null)}const y=ee.get(d).get(s.typeName),g=0===y?0:ne?.vertexEndIndex[y-1];if(!le.has(y)){if(le.add(y),ne.types[y]===K.Recursive){const e=[ne.vertices[2*g],ne.vertices[2*g+1]],t=[ne.vertices[2*(g+1)],ne.vertices[2*(g+1)+1]],i=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],n=[i[0]-e[0],i[1]-e[1]],o=[i[0]+n[1],i[1]-n[0]],s=[i[0]-n[1],i[1]+n[0]];a.push(e),a.push(o),a.push(t),a.push(s),a.push(e)}else{if(ne.types[y]!==K.Regular){n.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=g;e<ne.vertexEndIndex[y];e++)a.push([ne.vertices[2*e],ne.vertices[2*e+1]])}if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e){const e=_[u.get(r)]?.feature.attributes[T],t=_[u.get(h)]?.feature.attributes[T];a[0][0]===e.x&&a[0][1]===e.y||(a[0]=[e.x,e.y]),a[a.length-1][0]===t.x&&a[a.length-1][1]===t.y||(a[a.length-1]=[t.x,t.y])}for(let e=1;e<a.length-1;e++)a[e][1]>85.5?a[e][1]=85.5:a[e][1]<-85.5&&(a[e][1]=-85.5),a[e][0]>179.9999?a[e][0]=179.9999:a[e][0]<-179.9999&&(a[e][0]=-179.9999);oe.has(d)?oe.get(d).push(a):oe.set(d,[a])}const m=oe.get(d);se.has(d)||(se.set(d,new Map),re.set(d,new Map));const f=se.get(d),w=re.get(d);f.has(s.typeName)||(f.set(s.typeName,m.shift()),w.set(s.typeName,0));const N=f.get(s.typeName);w.set(s.typeName,w.get(s.typeName)+1);const D=new L({paths:[N]});if(s.feature.attributes[T]=D,p.has(s.typeName)){const e=p.get(s.typeName);e?.set(s.feature.attributes[M],s.feature)}else{const e=new Map;e.set(s.feature.attributes[M],s.feature),p.set(s.typeName,e)}c.set(s.feature.attributes[M],s.feature);const v=b(s.feature.attributes[T]);this.relationshipLinkChartDiagramLookup.set(s.feature.attributes[M],s.feature.attributes[T]?v:null);const x=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,s.typeName,(()=>({useAllData:!1,members:new Map})));o(x.members,s.feature.attributes[M],(()=>({id:s.feature.attributes[M],linkChartLocation:void 0}))).linkChartLocation=v}for(const i of l)i.feature.attributes[N]=re.get(i.feature.attributes[k]+"-"+i.feature.attributes[C])?.get(i.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutSettings:t?.layoutSettings?.clone()},{nodes:d,links:p,idMap:c}}async applyNewLinkChartLayout(e="organic-standard",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),this.membershipModified=!0,await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||a?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const n=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(n,new f({x:i.x,y:i.y})))}));return e}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}a=await this.dataManager.getRelationshipsBetweenNodes(e,i,t),await this._handleNewRecords(a,t),r(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}async connectFromEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}let n=[];for(const e of this.dataManager.entityTypeNames){const t=this.sublayerIdsCache.get(e);t&&(n=n.concat(Array.from(t)))}a=await this.dataManager.getRelationshipsFromNodes(e,n,i,t),await this._handleNewRecords(a,t),a.length>0&&(this.membershipModified=!0),r(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="organic-standard",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t}),this.linkChart?.handleChronologicalOverlay()}async _handleNewRecords(e,t){const a=[],i=[];for(const s of e){if(!this._graphTypeLookup.has(s.typeName))continue;this.dataManager.sublayerCaches.has(s.typeName)||(this.dataManager.sublayerCaches.set(s.typeName,new Map),a.push(s.typeName));o(this.sublayerIdsCache,s.typeName,(()=>new Set)).add(s.id),i.push(s)}this.dataManager.addToLayer(i);for(const o of a){const e=this._graphTypeLookup.get(o);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(o):this.dataManager.relationshipTypeNames.add(o),t.geometryType?this.layers.push(t):this.tables.push(t)}}await I(this,a,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)),void 0,void 0,void 0,t);const n={layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:new Map};for(const[o,s]of this.entityLinkChartDiagramLookup.entries())s&&n.lockedNodeLocations.set(o,new f(s.coords[0],s.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,n)}_createSublayers(e,t,a){e.forEach((e=>{const i=this._createSublayer(e);a(i)&&t.push(i),this._updateSublayerCaches(e)}))}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const a=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));a&&(t.objectType=a,t.read({title:a.name},{origin:"service"}),this._updateSublayerCaches(a))}))}_updateSublayerCaches({name:e}){if(!e)return;const t=this.dataManager.sublayerCaches;t.has(e)||t.set(e,new Map)}_layersLoadedFromAuthoritativeItem(){const e=this.originIdOf("layers");return e>=y.PORTAL_ITEM&&e<y.USER}async _initializeDiagram(){this.initializationLinkChartConfig?this.initializationLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const n=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const o=b(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[k]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[C]);if(t&&a){const i=b(new L({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[M],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[M],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.initializationLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.initializationLinkChartConfig||{}}):await this._calculateLayoutWithSublayerTimeInfo("organic-standard",{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})}_validateOrganicLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),i=e=>a(e)&&e>=1,o=e=>a(e)&&e>=1,s=e=>Object.values(D).includes(e),r=e=>a(e)&&e>=0,l={};if(!new Set(["organic-standard","organic-community","geographic-organic-standard","chronological-multi-timeline","chronological-mono-timeline"]).has(e)||!t)return l;const{computationBudgetTime:h,autoRepulsionRadius:d,repulsionRadiusMultiplier:p,absoluteIdealEdgeLength:c,multiplicativeIdealEdgeLength:u,idealEdgeLengthType:y}=t;return o(h)?l.computationBudgetTime=h:h&&n.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),l.autoRepulsionRadius=d,!d&&i(p)?l.repulsionRadiusMultiplier=p:d||(l.autoRepulsionRadius=!0,n.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting")),"geographic-organic-standard"===e&&(s(y)?l.idealEdgeLengthType=y:void 0!==y&&n.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),"absolute-value"===y&&r(c)?l.absoluteIdealEdgeLength=c:"absolute-value"===y&&void 0!==c?n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting"):"multiplier"===y&&r(u)?l.multiplicativeIdealEdgeLength=u:"multiplier"===y&&void 0!==u&&n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),l}_convertValidatedOrganicSettingsToCalculationSettings(e){let t=e.idealEdgeLengthType===D.ABSOLUTE?e.absoluteIdealEdgeLength:e.multiplicativeIdealEdgeLength;return e.idealEdgeLengthType===D.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.computationBudgetTime??void 0,repulsionRadiusMultiplier:e.repulsionRadiusMultiplier&&!e.autoRepulsionRadius?e.repulsionRadiusMultiplier:void 0,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new x({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const t=new Set((e.entityTypes??[]).map((e=>e.name)).concat((e.relationshipTypes??[]).map((e=>e.name)))),i=new Set((e.entityTypes??[]).map((e=>e.name))),o=new Set((e.relationshipTypes??[]).map((e=>e.name)));if(this.layers){for(const a of this.layers)!a.graphType&&t.has(a.graphTypeName)&&(a.graphType=i.has(a.graphTypeName)?"entity":"relationship");const e=this.layers.filter((e=>t.has(e.graphTypeName)&&("entity"===e.graphType?i.has(e.graphTypeName):o.has(e.graphTypeName))));this.setAtOrigin("layers",e,g(this.originIdOf("layers")))}else this.layers=new a;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map((e=>e.graphTypeName))??[],a=this.layers.map((e=>e.graphTypeName)).concat(t);for(const n of a)e.has(n)||this._originalInclusionList.namedTypeDefinitions.set(n,{useAllData:!1,members:new Map});const i=[];for(const o of this._originalInclusionList.namedTypeDefinitions.keys())a.includes(o)||(n.getLogger(this).warn(`A named type, ${o}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),i.push(o));for(const n of i)this._originalInclusionList.namedTypeDefinitions.delete(n)}}};e([c(G)],q.prototype,"url",void 0),e([c()],q.prototype,"dataPreloadedInLocalCache",void 0),e([c()],q.prototype,"initializationLinkChartConfig",void 0),e([c()],q.prototype,"membershipModified",void 0),e([c()],q.prototype,"dataManager",void 0),e([c()],q.prototype,"initializationInclusionModeDefinition",null),e([c()],q.prototype,"knowledgeGraph",void 0),e([c({type:a.ofType(x),json:{write:{ignoreOrigin:!0}}})],q.prototype,"layers",void 0),e([c({readOnly:!0})],q.prototype,"linkChart",null),e([c()],q.prototype,"entityLinkChartDiagramLookup",void 0),e([c()],q.prototype,"relationshipLinkChartDiagramLookup",void 0),e([c()],q.prototype,"linkChartExtent",void 0),e([c()],q.prototype,"memberEntityTypes",void 0),e([c()],q.prototype,"memberRelationshipTypes",void 0),e([c({type:["LinkChartLayer"]})],q.prototype,"operationalLayerType",void 0),e([c()],q.prototype,"sublayerIdsCache",void 0),e([c({type:a.ofType(x),json:{write:{ignoreOrigin:!0}}})],q.prototype,"tables",void 0),e([c({json:{read:!1}})],q.prototype,"type",void 0),e([c({json:{read:!1}})],q.prototype,"chronologicalAuxiliaryGraphics",void 0),q=e([u("esri.layers.LinkChartLayer")],q);const J=q;export{J as default};
|
package/layers/MapImageLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{loadAll as s}from"../core/loadAll.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{debounce as o,throwIfAbortError as a,isAbortError as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{loadAll as s}from"../core/loadAll.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{debounce as o,throwIfAbortError as a,isAbortError as n}from"../core/promiseUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{Integer as m}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as l}from"../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../core/accessorSupport/decorators/writer.js";import{nameToId as y,OriginId as h}from"../core/accessorSupport/PropertyOrigin.js";import d from"../geometry/Extent.js";import{getScale as f}from"../geometry/support/scaleUtils.js";import{srToRESTValue as g}from"../geometry/support/spatialReferenceUtils.js";import v from"./Layer.js";import{APIKeyMixin as b}from"./mixins/APIKeyMixin.js";import{ArcGISMapService as S}from"./mixins/ArcGISMapService.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as x}from"./mixins/BlendLayer.js";import{CustomParametersMixin as I}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as O}from"./mixins/PortalLayer.js";import{RefreshableLayer as E}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as P}from"./mixins/SublayersOwner.js";import{TemporalLayer as T}from"./mixins/TemporalLayer.js";import{url as A}from"./support/commonProperties.js";import{ExportImageParameters as M}from"./support/ExportImageParameters.js";import{createBitmap as R}from"./support/imageBitmapUtils.js";import U from"./support/Sublayer.js";import{shouldWriteSublayerStructure as _}from"./support/sublayerUtils.js";import{serviceSupportsSpatialReference as F}from"./support/versionUtils.js";import N from"../symbols/support/ElevationInfo.js";import{T as J}from"../chunks/TimeExtent.js";import{timeZoneProperty as V}from"../time/timeZoneUtils.js";import{SaveOperationType as q}from"../webdoc/interfaces.js";let k=class extends(x(T(L(P(S(j(w(O(i(E(b(I(v))))))))))))){constructor(...e){super(...e),this._exportImageParameters=new M({layer:this}),this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.dpi=96,this.elevationInfo=new N({mode:"on-the-ground"}),this.gdbVersion=null,this.imageFormat="png24",this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.isReference=null,this.labelsVisible=!1,this.operationalLayerType="ArcGISMapServiceLayer",this.preferredTimeZone=null,this.sourceJSON=null,this.sublayers=null,this.type="map-image",this.url=null,this._debouncedSaveOperations=o((async(e,r,t)=>{const{save:s,saveAs:i}=await import("./save/mapImageLayerUtils.js");switch(e){case q.SAVE:return s(this,r);case q.SAVE_AS:return i(this,t,r)}}))}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service"]},e).catch(a).then((()=>this._fetchService(r)))),Promise.resolve(this)}destroy(){this._exportImageParameters.destroy()}readImageFormat(e,r){const t=r.supportedImageFormatTypes;return t&&t.includes("PNG32")?"png32":"png24"}writeSublayers(e,r,t,s){if(!this.loaded||!e)return;const i=e.slice().reverse().flatten((({sublayers:e})=>e&&e.toArray().reverse())).toArray();let o=!1;const a=y(s.origin);let n;if(this.capabilities?.operations.supportsExportMap&&this.capabilities?.exportMap?.supportsDynamicLayers)if(a===h.PORTAL_ITEM){const e=this.createSublayersForOrigin("service").sublayers;o=_(i,e,h.SERVICE)}else if(a>h.PORTAL_ITEM){const e=this.createSublayersForOrigin("portal-item");o=_(i,e.sublayers,y(e.origin)),n=e.originWithPartialOverrides}const p=[],m={writeSublayerStructure:o,...s,minimumWritableOrigin:n};let l=o||this.hasVisibleLayersForOrigin(a);i.forEach((e=>{const r=e.write({},m);p.push(r),l=l||"user"===e.originOf("visible")}));p.some((e=>Object.keys(e).length>1))&&(r.layers=p),l&&(r.visibleLayers=i.filter((e=>e.visible)).map((e=>e.id)))}createExportImageParameters(e,r,t,s){const i=s?.pixelRatio||1;e&&this.version>=10&&(e=e.clone().shiftCentralMeridian()),this._exportImageParameters.floors=s?.floors??null,this._exportImageParameters.scale=f({extent:e,width:r})*i;const o=this._exportImageParameters.toJSON(),a=!s?.rotation||this.version<10.3?{}:{rotation:-s.rotation},n=e?.spatialReference,p=g(n);o.dpi*=i;const m={};if(s?.timeExtent){const{start:e,end:r}=s.timeExtent.toJSON();m.time=e&&r&&e===r?""+e:`${e??"null"},${r??"null"}`}else this.timeInfo&&!this.timeInfo.hasLiveData&&(m.time="null,null");return{bbox:e?e.xmin+","+e.ymin+","+e.xmax+","+e.ymax:void 0,bboxSR:p,imageSR:p,size:r+","+t,...o,...a,...m}}async fetchImage(e,r,t,s){const{data:i}=await this._fetchImage("image",e,r,t,s);return i}async fetchImageBitmap(e,r,t,s){const{data:i,url:o}=await this._fetchImage("blob",e,r,t,s);return R(i,o,s?.signal)}async fetchRecomputedExtents(e={}){const t={...e,query:{returnUpdates:!0,f:"json",...this.customParameters,token:this.apiKey}},{data:s}=await r(this.url,t),{extent:i,fullExtent:o,timeExtent:a}=s,n=i||o;return{fullExtent:n&&d.fromJSON(n),timeExtent:a&&J.fromJSON({start:a[0],end:a[1]})}}loadAll(){return s(this,(e=>{e(this.allSublayers),e(this.subtables)}))}async save(e){return this._debouncedSaveOperations(q.SAVE,e)}async saveAs(e,r){return this._debouncedSaveOperations(q.SAVE_AS,r,e)}serviceSupportsSpatialReference(e){return F(this,e)}async _fetchImage(e,s,i,o,a){const p={responseType:e,signal:a?.signal??null,query:{...this.parsedUrl.query,...this.createExportImageParameters(s,i,o,a),f:"image",...this.refreshParameters,...this.customParameters,token:this.apiKey}},m=this.parsedUrl.path+"/export";if(null!=p.query?.dynamicLayers&&!this.capabilities?.exportMap?.supportsDynamicLayers)throw new t("mapimagelayer:dynamiclayer-not-supported",`service ${this.url} doesn't support dynamic layers, which is required to be able to change the sublayer's order, rendering, labeling or source.`,{query:p.query});try{const{data:e}=await r(m,p);return{data:e,url:m}}catch(l){if(n(l))throw l;throw new t("mapimagelayer:image-fetch-error",`Unable to load image: ${m}`,{error:l})}}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:t,ssl:s}=await r(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},signal:e});s&&(this.url=this.url.replace(/^http:/i,"https:")),this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})}hasVisibleLayersForOrigin(e){return!(null==e||!this.sublayersSourceJSON[e]?.visibleLayers)}};e([p(V("dateFieldsTimeReference"))],k.prototype,"dateFieldsTimeZone",void 0),e([p({type:Boolean})],k.prototype,"datesInUnknownTimezone",void 0),e([p()],k.prototype,"dpi",void 0),e([p()],k.prototype,"elevationInfo",void 0),e([p()],k.prototype,"gdbVersion",void 0),e([p()],k.prototype,"imageFormat",void 0),e([l("imageFormat",["supportedImageFormatTypes"])],k.prototype,"readImageFormat",null),e([p({json:{origins:{service:{read:{source:"maxImageHeight"}}}}})],k.prototype,"imageMaxHeight",void 0),e([p({json:{origins:{service:{read:{source:"maxImageWidth"}}}}})],k.prototype,"imageMaxWidth",void 0),e([p()],k.prototype,"imageTransparency",void 0),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],k.prototype,"isReference",void 0),e([p({json:{read:!1,write:!1}})],k.prototype,"labelsVisible",void 0),e([p({type:["ArcGISMapServiceLayer"]})],k.prototype,"operationalLayerType",void 0),e([p({json:{read:!1,write:!1}})],k.prototype,"popupEnabled",void 0),e([p(V("preferredTimeReference"))],k.prototype,"preferredTimeZone",void 0),e([p()],k.prototype,"sourceJSON",void 0),e([p({json:{write:{ignoreOrigin:!0}}})],k.prototype,"sublayers",void 0),e([u("sublayers",{layers:{type:[U]},visibleLayers:{type:[m]}})],k.prototype,"writeSublayers",null),e([p({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],k.prototype,"listMode",void 0),e([p({json:{read:!1},readOnly:!0,value:"map-image"})],k.prototype,"type",void 0),e([p(A)],k.prototype,"url",void 0),k=e([c("esri.layers.MapImageLayer")],k);const G=k;export{G 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../PopupTemplate.js";import o from"../../request.js";import s from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import a from"../../core/Loadable.js";import n from"../../core/Logger.js";import p from"../../core/Promise.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as u}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import c from"../../geometry/Extent.js";import m from"../../geometry/SpatialReference.js";import h from"../FeatureLayer.js";import f from"./BuildingSublayer.js";import{zeroCapabilities as g}from"../support/capabilities.js";import{popupEnabled as j}from"../support/commonProperties.js";import{getFieldDomain as v}from"../support/featureLayerUtils.js";import{defineFieldProperties as L}from"../support/fieldProperties.js";import b from"../support/FieldsIndex.js";import{unpackFieldNames as I}from"../support/fieldUtils.js";import{fetchIndexInfo as S}from"../support/I3SIndexInfo.js";import{I3SNodePageDefinition as F,I3SMaterialDefinition as w,I3STextureSetDefinition as O,I3SGeometryDefinition as x}from"../support/I3SLayerDefinitions.js";import{webSceneRendererTypes as P}from"../../renderers/support/typeUtils.js";import q from"../../rest/support/Query.js";import{isNumber as T}from"../../support/guards.js";import{createPopupTemplate as Q}from"../../support/popupUtils.js";import U from"../../symbols/support/ElevationInfo.js";import{queryAttributesFromCachedAttributesId as E}from"../../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as D,getFetchPopupTemplate as R}from"../../views/layers/support/popupUtils.js";const A=L();let _=class extends(a.LoadableMixin(p.EsriPromiseMixin(f))){constructor(e){super(e),this.type="building-component",this.nodePages=null,this.materialDefinitions=[],this.textureSetDefinitions=[],this.geometryDefinitions=[],this.indexInfo=null,this.serviceUpdateTimeStamp=null,this.store=null,this.attributeStorageInfo=[],this.fields=[],this.associatedLayer=null,this.outFields=null,this.listMode="show",this.renderer=null,this.definitionExpression=null,this.popupEnabled=!0,this.popupTemplate=null,this.layerType="3d-object"}get parsedUrl(){return this.layer?{path:`${this.layer.parsedUrl?.path}/sublayers/${this.id}`,query:this.layer.parsedUrl?.query}:{path:""}}get fieldsIndex(){return new b(this.fields)}readAssociatedLayer(e,t){const r=this.layer.associatedFeatureServiceItem,o=t.associatedLayerID;return null!=r&&"number"==typeof o?new h({portalItem:r,customParameters:this.customParameters,layerId:o}):null}get objectIdField(){if(null!=this.fields)for(const e of this.fields)if("oid"===e.type)return e.name;return
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../PopupTemplate.js";import o from"../../request.js";import s from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import a from"../../core/Loadable.js";import n from"../../core/Logger.js";import p from"../../core/Promise.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as u}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import c from"../../geometry/Extent.js";import m from"../../geometry/SpatialReference.js";import h from"../FeatureLayer.js";import f from"./BuildingSublayer.js";import{zeroCapabilities as g}from"../support/capabilities.js";import{popupEnabled as j}from"../support/commonProperties.js";import{getFieldDomain as v}from"../support/featureLayerUtils.js";import{defineFieldProperties as L}from"../support/fieldProperties.js";import b from"../support/FieldsIndex.js";import{unpackFieldNames as I}from"../support/fieldUtils.js";import{fetchIndexInfo as S}from"../support/I3SIndexInfo.js";import{I3SNodePageDefinition as F,I3SMaterialDefinition as w,I3STextureSetDefinition as O,I3SGeometryDefinition as x}from"../support/I3SLayerDefinitions.js";import{webSceneRendererTypes as P}from"../../renderers/support/typeUtils.js";import q from"../../rest/support/Query.js";import{isNumber as T}from"../../support/guards.js";import{createPopupTemplate as Q}from"../../support/popupUtils.js";import U from"../../symbols/support/ElevationInfo.js";import{queryAttributesFromCachedAttributesId as E}from"../../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as D,getFetchPopupTemplate as R}from"../../views/layers/support/popupUtils.js";const A=L();let _=class extends(a.LoadableMixin(p.EsriPromiseMixin(f))){constructor(e){super(e),this.type="building-component",this.nodePages=null,this.materialDefinitions=[],this.textureSetDefinitions=[],this.geometryDefinitions=[],this.indexInfo=null,this.serviceUpdateTimeStamp=null,this.store=null,this.attributeStorageInfo=[],this.fields=[],this.associatedLayer=null,this.outFields=null,this.listMode="show",this.renderer=null,this.definitionExpression=null,this.popupEnabled=!0,this.popupTemplate=null,this.layerType="3d-object"}get parsedUrl(){return this.layer?{path:`${this.layer.parsedUrl?.path}/sublayers/${this.id}`,query:this.layer.parsedUrl?.query}:{path:""}}get fieldsIndex(){return new b(this.fields)}readAssociatedLayer(e,t){const r=this.layer.associatedFeatureServiceItem,o=t.associatedLayerID;return null!=r&&"number"==typeof o?new h({portalItem:r,customParameters:this.customParameters,layerId:o}):null}get objectIdField(){if(null!=this.fields)for(const e of this.fields)if("oid"===e.type)return e.name;return""}get displayField(){return null!=this.associatedLayer?this.associatedLayer.displayField:void 0}get apiKey(){return this.layer.apiKey}get customParameters(){return this.layer.customParameters}get fullExtent(){return this.layer.fullExtent}get spatialReference(){return this.layer.spatialReference}get version(){return this.layer.version}get elevationInfo(){return this.layer.elevationInfo}get minScale(){return this.layer.minScale}get maxScale(){return this.layer.maxScale}get effectiveScaleRange(){return this.layer.effectiveScaleRange}get defaultPopupTemplate(){return this.createPopupTemplate()}load(e){const t=null!=e?e.signal:null,r=this._fetchService(t).then((()=>{this.indexInfo=S(this.parsedUrl.path,this.rootNode,this.nodePages,this.customParameters,this.apiKey,n.getLogger(this),t)}));return this.addResolvingPromise(r),Promise.resolve(this)}createPopupTemplate(e){return Q(this,e)}async _fetchService(e){const t=(await o(this.parsedUrl.path,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e})).data;this.read(t,{origin:"service",url:this.parsedUrl})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getField(e)?.domain??null;return this.associatedLayer?v(this.associatedLayer,e,t,r):r}getFeatureType(e){return e&&null!=this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return null!=this.associatedLayer?this.associatedLayer.types??[]:[]}get typeIdField(){return null!=this.associatedLayer?this.associatedLayer.typeIdField:null}get geometryType(){return"3d-object"===this.layerType?"mesh":"point"}get profile(){return"3d-object"===this.layerType?"mesh-pyramids":"points"}get capabilities(){const e=null!=this.associatedLayer&&this.associatedLayer.capabilities?this.associatedLayer.capabilities:g,{query:t,operations:{supportsQuery:r},data:{supportsZ:o,supportsM:s,isVersioned:i}}=e;return{query:t,operations:{supportsQuery:r},data:{supportsZ:o,supportsM:s,isVersioned:i}}}createQuery(){const e=new q;return"mesh"!==this.geometryType&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this.layer,t.sourceLayer=this;return e}))}async queryObjectIds(e,t){const r=await this._getAssociatedLayerForQuery();return(await r.queryObjectIds(e||this.createQuery(),t)).filter(T)}async queryCachedAttributes(e,t){const r=I(this.fieldsIndex,await D(this,R(this)));return E(this.parsedUrl.path,this.attributeStorageInfo,e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const o=await this.queryCachedAttributes(e,[r]);if(!o||0===o.length)throw new s("scenelayer:feature-not-in-cached-data","Feature not found in cached data");return new t({attributes:o[0],layer:this,sourceLayer:this})}getFieldUsageInfo(e){return this.fieldsIndex.has(e)?{supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1}:{supportsLabelingInfo:!1,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:null!=this.associatedLayer}}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return null!=e&&e.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),null==this.associatedLayer)throw new s("buildingscenelayer:query-not-available","BuildingSceneLayer component layer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new s("buildingscenelayer:query-not-available","BuildingSceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}};e([l({readOnly:!0})],_.prototype,"parsedUrl",null),e([l({type:F,readOnly:!0})],_.prototype,"nodePages",void 0),e([l({type:[w],readOnly:!0})],_.prototype,"materialDefinitions",void 0),e([l({type:[O],readOnly:!0})],_.prototype,"textureSetDefinitions",void 0),e([l({type:[x],readOnly:!0})],_.prototype,"geometryDefinitions",void 0),e([l({readOnly:!0})],_.prototype,"serviceUpdateTimeStamp",void 0),e([l({readOnly:!0})],_.prototype,"store",void 0),e([l({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],_.prototype,"rootNode",void 0),e([l({readOnly:!0})],_.prototype,"attributeStorageInfo",void 0),e([l(A.fields)],_.prototype,"fields",void 0),e([l({readOnly:!0})],_.prototype,"fieldsIndex",null),e([l({readOnly:!0,type:h})],_.prototype,"associatedLayer",void 0),e([y("service","associatedLayer",["associatedLayerID"])],_.prototype,"readAssociatedLayer",null),e([l(A.outFields)],_.prototype,"outFields",void 0),e([l({type:String,readOnly:!0})],_.prototype,"objectIdField",null),e([l({readOnly:!0,type:String,json:{read:!1}})],_.prototype,"displayField",null),e([l({readOnly:!0,type:String})],_.prototype,"apiKey",null),e([l({readOnly:!0,type:String})],_.prototype,"customParameters",null),e([l({readOnly:!0,type:c})],_.prototype,"fullExtent",null),e([l({readOnly:!0,type:m})],_.prototype,"spatialReference",null),e([l({readOnly:!0})],_.prototype,"version",null),e([l({readOnly:!0,type:U})],_.prototype,"elevationInfo",null),e([l({readOnly:!0,type:Number})],_.prototype,"minScale",null),e([l({readOnly:!0,type:Number})],_.prototype,"maxScale",null),e([l({readOnly:!0,type:Number})],_.prototype,"effectiveScaleRange",null),e([l({type:["hide","show"],json:{write:!0}})],_.prototype,"listMode",void 0),e([l({types:P,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],_.prototype,"renderer",void 0),e([l({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],_.prototype,"definitionExpression",void 0),e([l(j)],_.prototype,"popupEnabled",void 0),e([l({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],_.prototype,"popupTemplate",void 0),e([l({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],_.prototype,"normalReferenceFrame",void 0),e([l({readOnly:!0,json:{read:!1}})],_.prototype,"defaultPopupTemplate",null),e([l()],_.prototype,"types",null),e([l()],_.prototype,"typeIdField",null),e([l({json:{write:!1}}),u(new i({"3DObject":"3d-object",Point:"point"}))],_.prototype,"layerType",void 0),e([l()],_.prototype,"geometryType",null),e([l()],_.prototype,"profile",null),e([l({readOnly:!0,json:{read:!1}})],_.prototype,"capabilities",null),e([l({readOnly:!0})],_.prototype,"statisticsInfo",void 0),_=e([d("esri.layers.buildingSublayers.BuildingComponentSublayer")],_);const C=_;export{C 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Collection.js";import s from"../../core/CollectionFlattener.js";import t from"../../core/Error.js";import o from"../../core/Logger.js";import{watch as a,sync as l}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{getProperties as n}from"../../core/accessorSupport/utils.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{OriginId as y,nameToId as c,idToName as b}from"../../core/accessorSupport/PropertyOrigin.js";import d from"../support/Sublayer.js";import{isSublayerOverhaul as p}from"../support/sublayerUtils.js";function h(e,r){const s=[],t={};return e?(e.forEach((e=>{const o=new d;if(o.read(e,r),t[o.id]=o,null!=e.parentLayerId&&-1!==e.parentLayerId){const r=t[e.parentLayerId];r.sublayers||(r.sublayers=[]),r.sublayers.unshift(o)}else s.unshift(o)})),s):s}const f=r.ofType(d);function S(e,r){e&&e.forEach((e=>{r(e),e.sublayers&&e.sublayers.length&&S(e.sublayers,r)}))}const m=m=>{let E=class extends m{constructor(...e){super(...e),this.allSublayers=new s({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.sublayersSourceJSON={[y.SERVICE]:{},[y.PORTAL_ITEM]:{},[y.WEB_SCENE]:{},[y.WEB_MAP]:{},[y.LINK_CHART]:{}},this.subtables=null,this.addHandles([a((()=>this.sublayers),((e,r)=>this._handleSublayersChange(e,r)),l),a((()=>this.subtables),((e,r)=>this._handleSublayersChange(e,r)),l)])}destroy(){this.allSublayers.destroy()}readSublayers(e,r){if(!r||!e)return;const{sublayersSourceJSON:s}=this,t=c(r.origin);if(t<y.SERVICE)return;if(s[t]={context:r,visibleLayers:e.visibleLayers||s[t].visibleLayers,layers:e.layers||s[t].layers},t>y.SERVICE)return;this._set("serviceSublayers",this.createSublayersForOrigin("service").sublayers);const{sublayers:o,origin:a}=this.createSublayersForOrigin("web-document"),l=n(this);l.setDefaultOrigin(a),this._set("sublayers",new f(o)),l.setDefaultOrigin("user")}findSublayerById(e){return this.allSublayers.find((r=>r.id===e))}createServiceSublayers(){return this.createSublayersForOrigin("service").sublayers}createSublayersForOrigin(e){const
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Collection.js";import s from"../../core/CollectionFlattener.js";import t from"../../core/Error.js";import o from"../../core/Logger.js";import{watch as a,sync as l}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{getProperties as n}from"../../core/accessorSupport/utils.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{OriginId as y,nameToId as c,idToName as b}from"../../core/accessorSupport/PropertyOrigin.js";import d from"../support/Sublayer.js";import{isSublayerOverhaul as p}from"../support/sublayerUtils.js";function h(e,r){const s=[],t={};return e?(e.forEach((e=>{const o=new d;if(o.read(e,r),t[o.id]=o,null!=e.parentLayerId&&-1!==e.parentLayerId){const r=t[e.parentLayerId];r.sublayers||(r.sublayers=[]),r.sublayers.unshift(o)}else s.unshift(o)})),s):s}const f=r.ofType(d);function S(e,r){e&&e.forEach((e=>{r(e),e.sublayers&&e.sublayers.length&&S(e.sublayers,r)}))}const m=m=>{let E=class extends m{constructor(...e){super(...e),this.allSublayers=new s({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.sublayersSourceJSON={[y.SERVICE]:{},[y.PORTAL_ITEM]:{},[y.WEB_SCENE]:{},[y.WEB_MAP]:{},[y.LINK_CHART]:{}},this.subtables=null,this.addHandles([a((()=>this.sublayers),((e,r)=>this._handleSublayersChange(e,r)),l),a((()=>this.subtables),((e,r)=>this._handleSublayersChange(e,r)),l)])}destroy(){this.allSublayers.destroy()}readSublayers(e,r){if(!r||!e)return;const{sublayersSourceJSON:s}=this,t=c(r.origin);if(t<y.SERVICE)return;if(s[t]={context:r,visibleLayers:e.visibleLayers||s[t].visibleLayers,layers:e.layers||s[t].layers},t>y.SERVICE)return;this._set("serviceSublayers",this.createSublayersForOrigin("service").sublayers);const{sublayers:o,origin:a}=this.createSublayersForOrigin("web-document"),l=n(this);l.setDefaultOrigin(a),this._set("sublayers",new f(o)),l.setDefaultOrigin("user")}findSublayerById(e){return this.allSublayers.find((r=>r.id===e))}createServiceSublayers(){return this.createSublayersForOrigin("service").sublayers}createSublayersForOrigin(e){let r;const s=c("web-document"===e?"web-map":e);let t=y.SERVICE,o=this.sublayersSourceJSON[y.SERVICE].layers,a=this.sublayersSourceJSON[y.SERVICE].context,l=null;const i=[y.PORTAL_ITEM,y.WEB_SCENE,y.WEB_MAP].filter((e=>e<=s));for(const y of i){const e=this.sublayersSourceJSON[y];p(e.layers)&&(t=y,o=e.layers,a=e.context,e.visibleLayers&&(l={visibleLayers:e.visibleLayers,context:e.context}))}const n=[y.PORTAL_ITEM,y.WEB_SCENE,y.WEB_MAP].filter((e=>e>t&&e<=s));let u=null;for(const y of n){const{layers:e,visibleLayers:s,context:t}=this.sublayersSourceJSON[y];e&&(u={layers:e,context:t},r??=y),s&&(l={visibleLayers:s,context:t})}const d=h(o,a),m=new Map,E=new Set;if(u)for(const y of u.layers)m.set(y.id,y);if(l?.visibleLayers)for(const y of l.visibleLayers)E.add(y);return S(d,(e=>{u&&e.read(m.get(e.id),u.context),l&&e.read({defaultVisibility:E.has(e.id)},l.context)})),{origin:b(t),originWithPartialOverrides:r?b(r):null,sublayers:new f({items:d})}}read(e,r){super.read(e,r),this.readSublayers(e,r)}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null,e.layer=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this,e.layer=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this,e.layer=this})),e.on("after-remove",(({item:e})=>{e.parent=null,e.layer=null}))],"sublayers-owner"),"tile"===this.type&&this.addHandles(e.on("before-changes",(e=>{o.getLogger("esri.layers.TileLayer").error(new t("tilelayer:sublayers-non-modifiable","ISublayer can't be added, moved, or removed from the layer's sublayers",{layer:this})),e.preventDefault()})),"sublayers-owner"))}};return e([i({readOnly:!0})],E.prototype,"allSublayers",void 0),e([i({readOnly:!0,type:r.ofType(d)})],E.prototype,"serviceSublayers",void 0),e([i({value:null,type:f,json:{read:!1,write:{allowNull:!0,ignoreOrigin:!0}}})],E.prototype,"sublayers",void 0),e([i({readOnly:!0})],E.prototype,"sublayersSourceJSON",void 0),e([i({type:f,json:{read:{source:"tables"}}})],E.prototype,"subtables",void 0),E=e([u("esri.layers.mixins.SublayersOwner")],E),E};export{m as SublayersOwner,S as forEachSublayer};
|