@arcgis/core 4.33.0-next.20250227 → 4.33.0-next.20250228
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/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +2 -0
- package/applications/KnowledgeStudio/generalSharedKgUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{3170552a6310725d7730.js → 05b7c739115be0490583.js} +1 -1
- package/assets/esri/core/workers/chunks/2c227d97d00b3849f441.js +1 -0
- package/assets/esri/core/workers/chunks/2ce80c764cca9e6a20cd.js +1 -0
- package/assets/esri/core/workers/chunks/6f9bfa6ed34ef6efcc6f.js +1 -0
- package/assets/esri/core/workers/chunks/8abd2235aa702d8b239f.js +1 -0
- package/assets/esri/core/workers/chunks/a288c2474ef193f9fbd3.js +1 -0
- package/assets/esri/core/workers/chunks/{e118245566be994a53da.js → a901c445d36f1a9e7df8.js} +1 -1
- package/assets/esri/core/workers/chunks/a91f2d1deb950f46ad09.js +1 -0
- package/assets/esri/core/workers/chunks/b8416f2560710258c239.js +1 -0
- package/assets/esri/core/workers/chunks/f45ef721d21388846101.js +1 -0
- package/assets/esri/core/workers/chunks/{2d4bfd747580ed3b6f4d.js → fdab6921d007929ab288.js} +1 -1
- package/assets/esri/themes/base/widgets/_Sketch.scss +4 -4
- 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/chunks/chartUtilsAm5.js +1 -1
- package/interfaces.d.ts +17 -15
- package/intl/duration.js +1 -1
- package/intl/locale.js +1 -1
- package/intl/messages.js +1 -1
- package/layers/BingMapsLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/mixins/SublayersOwner.js +1 -1
- package/layers/support/rasterDatasets/covJSONParser.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/previewSymbol2D.js +1 -1
- package/views/3d/environment/CloudsRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +11 -11
- package/views/3d/webgl-engine/core/shaderLibrary/util/LookupCubemapFromTextureArray.glsl.js +39 -0
- package/views/3d/webgl-engine/core/shaderModules/Texture2DArrayBindUniform.js +5 -0
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/webdoc/support/writeUtils.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/ScaleRangeSlider/scalePreviewUtils.js +1 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/widgets/support/Selector2D/selectorUtils.js +1 -1
- package/widgets/support/chartUtilsAm5.js +1 -1
- package/assets/esri/core/workers/chunks/22e7db720724f2426d74.js +0 -1
- package/assets/esri/core/workers/chunks/2515ace848cf078c6263.js +0 -1
- package/assets/esri/core/workers/chunks/2c348d0e8131f08391cb.js +0 -1
- package/assets/esri/core/workers/chunks/380128e2cb74798478c1.js +0 -1
- package/assets/esri/core/workers/chunks/68ac336f7384bbca85ab.js +0 -1
- package/assets/esri/core/workers/chunks/823bf95f42cc42f20e22.js +0 -1
- package/assets/esri/core/workers/chunks/84e50d3ff298b7b66070.js +0 -1
- package/assets/esri/core/workers/chunks/aa98a6c38e82d384403c.js +0 -1
package/interfaces.d.ts
CHANGED
|
@@ -1629,6 +1629,8 @@ declare namespace __esri {
|
|
|
1629
1629
|
interface generalSharedKgUtils {
|
|
1630
1630
|
extentToInBoundsRings(extent: Extent): number[][][];
|
|
1631
1631
|
getBindParametersFromCypherQuery(query: string): Promise<BindParamsFromCypherQueryResult>;
|
|
1632
|
+
getDefaultKnowledgeSublayerLabelingInfos(graphTypeName: string, geometryType: "point" | "multipoint" | "polyline" | "polygon" | nullish, displayLabelProperty: string): LabelClass[] | nullish;
|
|
1633
|
+
getDefaultLinkChartSublayerLabelingInfos(graphType: "entity" | "relationship", graphTypeName: string, displayLabelProperty: string): LabelClass[] | nullish;
|
|
1632
1634
|
newLinkChartLayerWithOptimizedGeometry(properties?: LinkChartLayerConstructProperties): LinkChartLayer;
|
|
1633
1635
|
}
|
|
1634
1636
|
|
|
@@ -100032,7 +100034,7 @@ declare namespace __esri {
|
|
|
100032
100034
|
*
|
|
100033
100035
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100034
100036
|
*/
|
|
100035
|
-
whenLayerView(layer: PointCloudLayer): Promise<
|
|
100037
|
+
whenLayerView(layer: PointCloudLayer): Promise<PointCloudLayerView>;
|
|
100036
100038
|
/**
|
|
100037
100039
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100038
100040
|
* on the view for the given layer.
|
|
@@ -100041,7 +100043,7 @@ declare namespace __esri {
|
|
|
100041
100043
|
*
|
|
100042
100044
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100043
100045
|
*/
|
|
100044
|
-
whenLayerView(layer: StreamLayer): Promise<
|
|
100046
|
+
whenLayerView(layer: StreamLayer): Promise<StreamLayerView>;
|
|
100045
100047
|
/**
|
|
100046
100048
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100047
100049
|
* on the view for the given layer.
|
|
@@ -100050,7 +100052,7 @@ declare namespace __esri {
|
|
|
100050
100052
|
*
|
|
100051
100053
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100052
100054
|
*/
|
|
100053
|
-
whenLayerView(layer: WFSLayer): Promise<
|
|
100055
|
+
whenLayerView(layer: WFSLayer): Promise<WFSLayerView>;
|
|
100054
100056
|
/**
|
|
100055
100057
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100056
100058
|
* on the view for the given layer.
|
|
@@ -100059,7 +100061,7 @@ declare namespace __esri {
|
|
|
100059
100061
|
*
|
|
100060
100062
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100061
100063
|
*/
|
|
100062
|
-
whenLayerView(layer: OGCFeatureLayer): Promise<
|
|
100064
|
+
whenLayerView(layer: OGCFeatureLayer): Promise<OGCFeatureLayerView>;
|
|
100063
100065
|
/**
|
|
100064
100066
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100065
100067
|
* on the view for the given layer.
|
|
@@ -100068,7 +100070,7 @@ declare namespace __esri {
|
|
|
100068
100070
|
*
|
|
100069
100071
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100070
100072
|
*/
|
|
100071
|
-
whenLayerView(layer: FeatureLayer): Promise<
|
|
100073
|
+
whenLayerView(layer: FeatureLayer): Promise<FeatureLayerView>;
|
|
100072
100074
|
/**
|
|
100073
100075
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100074
100076
|
* on the view for the given layer.
|
|
@@ -100077,7 +100079,7 @@ declare namespace __esri {
|
|
|
100077
100079
|
*
|
|
100078
100080
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100079
100081
|
*/
|
|
100080
|
-
whenLayerView(layer: CSVLayer): Promise<
|
|
100082
|
+
whenLayerView(layer: CSVLayer): Promise<CSVLayerView>;
|
|
100081
100083
|
/**
|
|
100082
100084
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100083
100085
|
* on the view for the given layer.
|
|
@@ -100086,7 +100088,7 @@ declare namespace __esri {
|
|
|
100086
100088
|
*
|
|
100087
100089
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100088
100090
|
*/
|
|
100089
|
-
whenLayerView(layer: GeoJSONLayer): Promise<
|
|
100091
|
+
whenLayerView(layer: GeoJSONLayer): Promise<GeoJSONLayerView>;
|
|
100090
100092
|
/**
|
|
100091
100093
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100092
100094
|
* on the view for the given layer.
|
|
@@ -100095,7 +100097,7 @@ declare namespace __esri {
|
|
|
100095
100097
|
*
|
|
100096
100098
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100097
100099
|
*/
|
|
100098
|
-
whenLayerView(layer: GeoRSSLayer): Promise<
|
|
100100
|
+
whenLayerView(layer: GeoRSSLayer): Promise<GeoRSSLayerView>;
|
|
100099
100101
|
/**
|
|
100100
100102
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100101
100103
|
* on the view for the given layer.
|
|
@@ -100104,7 +100106,7 @@ declare namespace __esri {
|
|
|
100104
100106
|
*
|
|
100105
100107
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100106
100108
|
*/
|
|
100107
|
-
whenLayerView(layer: GraphicsLayer): Promise<
|
|
100109
|
+
whenLayerView(layer: GraphicsLayer): Promise<GraphicsLayerView>;
|
|
100108
100110
|
/**
|
|
100109
100111
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100110
100112
|
* on the view for the given layer.
|
|
@@ -100113,7 +100115,7 @@ declare namespace __esri {
|
|
|
100113
100115
|
*
|
|
100114
100116
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100115
100117
|
*/
|
|
100116
|
-
whenLayerView(layer: ImageryLayer): Promise<
|
|
100118
|
+
whenLayerView(layer: ImageryLayer): Promise<ImageryLayerView>;
|
|
100117
100119
|
/**
|
|
100118
100120
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100119
100121
|
* on the view for the given layer.
|
|
@@ -100122,7 +100124,7 @@ declare namespace __esri {
|
|
|
100122
100124
|
*
|
|
100123
100125
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100124
100126
|
*/
|
|
100125
|
-
whenLayerView(layer: KMLLayer): Promise<
|
|
100127
|
+
whenLayerView(layer: KMLLayer): Promise<KMLLayerView>;
|
|
100126
100128
|
/**
|
|
100127
100129
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100128
100130
|
* on the view for the given layer.
|
|
@@ -100131,7 +100133,7 @@ declare namespace __esri {
|
|
|
100131
100133
|
*
|
|
100132
100134
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100133
100135
|
*/
|
|
100134
|
-
whenLayerView(layer: SceneLayer): Promise<
|
|
100136
|
+
whenLayerView(layer: SceneLayer): Promise<SceneLayerView>;
|
|
100135
100137
|
/**
|
|
100136
100138
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100137
100139
|
* on the view for the given layer.
|
|
@@ -100140,7 +100142,7 @@ declare namespace __esri {
|
|
|
100140
100142
|
*
|
|
100141
100143
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100142
100144
|
*/
|
|
100143
|
-
whenLayerView(layer: DimensionLayer): Promise<
|
|
100145
|
+
whenLayerView(layer: DimensionLayer): Promise<DimensionLayerView>;
|
|
100144
100146
|
/**
|
|
100145
100147
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100146
100148
|
* on the view for the given layer.
|
|
@@ -100149,7 +100151,7 @@ declare namespace __esri {
|
|
|
100149
100151
|
*
|
|
100150
100152
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100151
100153
|
*/
|
|
100152
|
-
whenLayerView(layer: MediaLayer): Promise<
|
|
100154
|
+
whenLayerView(layer: MediaLayer): Promise<MediaLayerView>;
|
|
100153
100155
|
/**
|
|
100154
100156
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100155
100157
|
* on the view for the given layer.
|
|
@@ -100158,7 +100160,7 @@ declare namespace __esri {
|
|
|
100158
100160
|
*
|
|
100159
100161
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#whenLayerView Read more...}
|
|
100160
100162
|
*/
|
|
100161
|
-
whenLayerView(layer: ViewshedLayer): Promise<
|
|
100163
|
+
whenLayerView(layer: ViewshedLayer): Promise<ViewshedLayerView>;
|
|
100162
100164
|
/**
|
|
100163
100165
|
* Gets the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html LayerView} created
|
|
100164
100166
|
* on the view for the given layer.
|
package/intl/duration.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{convertTime as o}from"../core/timeUtils.js";import{
|
|
5
|
+
import{convertTime as o}from"../core/timeUtils.js";import{getLocale as l,getLocaleParts as n}from"./locale.js";import{Duration as t}from"luxon";function r(l,n="milliseconds",r={}){const i={locale:e(),numberingSystem:"latn"};let s;return s=l?t.fromMillis(o(l,n,"milliseconds"),i).rescale():t.fromObject({seconds:0},i),s.toHuman({listStyle:"narrow",unitDisplay:"long",...r})}function e(){const o=l();return"bs"===n(o)?.language?"hr":o}export{r as formatDuration};
|
package/intl/locale.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{makeHandle as n}from"../core/handleUtils.js";let e,
|
|
5
|
+
import{makeHandle as n}from"../core/handleUtils.js";let e,o;const t=globalThis.esriConfig?.locale??globalThis.dojoConfig?.locale,i=globalThis.document?.documentElement;function a(){const n=i?.getAttribute("lang"),e=globalThis.navigator?.language;return t??n??e??"en"}function r(){return void 0===o&&(o=a()),o}function l(n){e=n||void 0,b()}const c=/^(?<language>[a-z]{2,3})(?:-[a-z]{3})?(?:-[A-Z][a-z]{3})?(?:-(?<region>[A-Z]{2}|\d{3}))?(?:-.*)?$/;function u(n=r()){return c.exec(n)?.groups}function s(n=r()){const e=u(n)?.language;return"he"===e||"ar"===e}const g=[];function f(e){return g.push(e),n((()=>g.splice(g.indexOf(e),1)))}const h=[];function d(e){return h.push(e),n((()=>h.splice(h.indexOf(e),1)))}function b(){const n=e??a();o!==n&&([...h].forEach((e=>e(n))),o=n,[...g].forEach((e=>e(n))))}if(globalThis.addEventListener?.("languagechange",b),i){new MutationObserver((()=>{b()})).observe(i,{attributeFilter:["lang"]})}export{d as beforeLocaleChange,a as getDefaultLocale,r as getLocale,u as getLocaleParts,f as onLocaleChange,s as prefersRTL,l as setLocale};
|
package/intl/messages.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 t from"../core/Error.js";import{makeHandle as n}from"../core/handleUtils.js";import{createResolver as e}from"../core/promiseUtils.js";import{beforeLocaleChange as r,getLocale as s}from"./locale.js";const
|
|
5
|
+
import t from"../core/Error.js";import{makeHandle as n}from"../core/handleUtils.js";import{createResolver as e}from"../core/promiseUtils.js";import{beforeLocaleChange as r,getLocale as s,getLocaleParts as o}from"./locale.js";const i={ar:!0,bg:!0,bs:!0,ca:!0,cs:!0,da:!0,de:!0,el:!0,en:!0,es:!0,et:!0,fi:!0,fr:!0,he:!0,hr:!0,hu:!0,id:!0,it:!0,ja:!0,ko:!0,lt:!0,lv:!0,nb:"no",nl:!0,no:!0,pl:!0,pt:"pt-BR","pt-BR":!0,"pt-PT":!0,ro:!0,ru:!0,sk:!0,sl:!0,sr:!0,sv:!0,th:!0,tr:!0,uk:!0,vi:!0,zh:"zh-CN","zh-CN":!0,"zh-HK":!0,"zh-TW":!0};function a(t){return t in i}function c(t){if(a(t)){const n=i[t];return!0===n?t:n}return null}const d=[],l=new Map;function h(t){for(const n of l.keys())_(t.pattern,n)&&l.delete(n)}function u(t){return d.includes(t)||(h(t),d.unshift(t)),n((()=>{const n=d.indexOf(t);n>-1&&(d.splice(n,1),h(t))}))}async function f(t){const n=s();l.has(t)||l.set(t,p(t,n));const e=l.get(t);return e&&await g.add(e),e}function m(t){const n=o(t);return n?c(t)??c(n.language):null}async function p(n,e){const r=[];for(const t of d)if(_(t.pattern,n))try{return await t.fetchMessageBundle(n,e)}catch(s){r.push(s)}if(r.length)throw new t("intl:message-bundle-error",`Errors occurred while loading "${n}"`,{errors:r});throw new t("intl:no-message-bundle-loader",`No loader found for message bundle "${n}"`)}function _(t,n){return"string"==typeof t?n.startsWith(t):t.test(n)}r((()=>{l.clear()}));const g=new class{constructor(){this._numLoading=0,this._dfd=null}async waitForAll(){this._dfd&&await this._dfd.promise}add(t){return this._increase(),t.then((()=>this._decrease()),(()=>this._decrease())),this.waitForAll()}_increase(){this._numLoading++,this._dfd||(this._dfd=e())}_decrease(){this._numLoading=Math.max(this._numLoading-1,0),this._dfd&&0===this._numLoading&&(this._dfd.resolve(),this._dfd=null)}},w={cache:l,loaders:d};export{f as fetchMessageBundle,i as messageBundlesLocaleMap,m as normalizeMessageBundleLocale,u as registerMessageBundleLoader,w as test};
|
package/layers/BingMapsLayer.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 t from"../request.js";import r from"../core/Error.js";import{JSONMap as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import{deprecatedModule as r}from"../core/deprecate.js";import o from"../core/Error.js";import{JSONMap as a}from"../core/jsonMap.js";import s from"../core/Logger.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import p from"../geometry/Point.js";import u from"../geometry/SpatialReference.js";import g from"./BaseTileLayer.js";import{BlendLayer as d}from"./mixins/BlendLayer.js";import{OperationalLayer as y}from"./mixins/OperationalLayer.js";import c from"./support/LOD.js";import m from"./support/TileInfo.js";const h=new a({BingMapsAerial:"aerial",BingMapsRoad:"road",BingMapsHybrid:"hybrid"}),b="https://dev.virtualearth.net";r(s.getLogger("esri.layers.BingMapsLayer"),"esri.layers.BingMapsLayer",{version:"4.33",warnOnce:!0});let w=class extends(d(y(i(g)))){constructor(e){super(e),this.type="bing-maps",this.tileInfo=new m({size:[256,256],dpi:96,origin:new p({x:-20037508.342787,y:20037508.342787,spatialReference:u.WebMercator}),spatialReference:u.WebMercator,lods:[new c({level:1,resolution:78271.5169639999,scale:295828763.795777}),new c({level:2,resolution:39135.7584820001,scale:147914381.897889}),new c({level:3,resolution:19567.8792409999,scale:73957190.948944}),new c({level:4,resolution:9783.93962049996,scale:36978595.474472}),new c({level:5,resolution:4891.96981024998,scale:18489297.737236}),new c({level:6,resolution:2445.98490512499,scale:9244648.868618}),new c({level:7,resolution:1222.99245256249,scale:4622324.434309}),new c({level:8,resolution:611.49622628138,scale:2311162.217155}),new c({level:9,resolution:305.748113140558,scale:1155581.108577}),new c({level:10,resolution:152.874056570411,scale:577790.554289}),new c({level:11,resolution:76.4370282850732,scale:288895.277144}),new c({level:12,resolution:38.2185141425366,scale:144447.638572}),new c({level:13,resolution:19.1092570712683,scale:72223.819286}),new c({level:14,resolution:9.55462853563415,scale:36111.909643}),new c({level:15,resolution:4.77731426794937,scale:18055.954822}),new c({level:16,resolution:2.38865713397468,scale:9027.977411}),new c({level:17,resolution:1.19432856685505,scale:4513.988705}),new c({level:18,resolution:.597164283559817,scale:2256.994353}),new c({level:19,resolution:.298582141647617,scale:1128.497176}),new c({level:20,resolution:.1492910708238085,scale:564.248588})]}),this.key=null,this.style="road",this.culture="en-US",this.region=null,this.portalUrl=null,this.hasAttributionData=!0}get bingMetadata(){return this._get("bingMetadata")}set bingMetadata(e){this._set("bingMetadata",e)}get copyright(){return null!=this.bingMetadata?this.bingMetadata.copyright:null}get operationalLayerType(){return h.toJSON(this.style)}get bingLogo(){return null!=this.bingMetadata?this.bingMetadata.brandLogoUri:null}load(e){return this.key?this.addResolvingPromise(this._getMetadata()):this.portalUrl?this.addResolvingPromise(this._getPortalBingKey().then((()=>this._getMetadata()))):this.addResolvingPromise(Promise.reject(new o("bingmapslayer:load","Bing layer must have bing key."))),Promise.resolve(this)}getTileUrl(e,t,r){if(!this.loaded||null==this.bingMetadata)return null;const o=this.bingMetadata.resourceSets[0].resources[0],a=o.imageUrlSubdomains[t%o.imageUrlSubdomains.length],s=this._getQuadKey(e,t,r);return o.imageUrl.replace("{subdomain}",a).replace("{quadkey}",s)}async fetchAttributionData(){return this.load().then((()=>{if(null==this.bingMetadata)return null;return{contributors:this.bingMetadata.resourceSets[0].resources[0].imageryProviders.map((e=>({attribution:e.attribution,coverageAreas:e.coverageAreas.map((e=>({zoomMin:e.zoomMin,zoomMax:e.zoomMax,score:1,bbox:[e.bbox[0],e.bbox[1],e.bbox[2],e.bbox[3]]})))})))}}))}_getMetadata(){const e={road:"roadOnDemand",aerial:"aerial",hybrid:"aerialWithLabelsOnDemand"}[this.style];return t(`${b}/REST/v1/Imagery/Metadata/${e}`,{responseType:"json",query:{include:"ImageryProviders",uriScheme:"https",key:this.key,suppressStatus:!0,output:"json",culture:this.culture,userRegion:this.region}}).then((e=>{const t=e.data;if(200!==t.statusCode)throw new o("bingmapslayer:getmetadata",t.statusDescription);if(this.bingMetadata=t,0===this.bingMetadata.resourceSets.length)throw new o("bingmapslayer:getmetadata","no bing resourcesets");if(0===this.bingMetadata.resourceSets[0].resources.length)throw new o("bingmapslayer:getmetadata","no bing resources")})).catch((e=>{throw new o("bingmapslayer:getmetadata",e.message)}))}_getPortalBingKey(){return t(this.portalUrl??"",{responseType:"json",authMode:"no-prompt",query:{f:"json"}}).then((e=>{if(!e.data.bingKey)throw new o("bingmapslayer:getportalbingkey","The referenced Portal does not contain a valid bing key");this.key=e.data.bingKey})).catch((e=>{throw new o("bingmapslayer:getportalbingkey",e.message)}))}_getQuadKey(e,t,r){let o="";for(let a=e;a>0;a--){let e=0;const s=1<<a-1;r&s&&(e+=1),t&s&&(e+=2),o+=e.toString()}return o}};e([n({json:{read:!1,write:!1},value:null})],w.prototype,"bingMetadata",null),e([n({json:{read:!1,write:!1},value:"bing-maps",readOnly:!0})],w.prototype,"type",void 0),e([n({type:m})],w.prototype,"tileInfo",void 0),e([n({type:String,readOnly:!0,json:{read:!1,write:!1}})],w.prototype,"copyright",null),e([n({type:String,json:{write:!1,read:!1}})],w.prototype,"key",void 0),e([n({type:h.apiValues,nonNullable:!0,json:{read:{source:"layerType",reader:h.read}}})],w.prototype,"style",void 0),e([n({type:["BingMapsAerial","BingMapsHybrid","BingMapsRoad"]})],w.prototype,"operationalLayerType",null),e([n({type:String,json:{write:!1,read:!1}})],w.prototype,"culture",void 0),e([n({type:String,json:{write:!1,read:!1}})],w.prototype,"region",void 0),e([n({type:String,json:{write:!0,read:!0}})],w.prototype,"portalUrl",void 0),e([n({type:Boolean,json:{write:!1,read:!1}})],w.prototype,"hasAttributionData",void 0),e([n({type:String,readOnly:!0})],w.prototype,"bingLogo",null),w=e([l("esri.layers.BingMapsLayer")],w);const v=w;export{v 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 b from"./Layer.js";import{convertFromGeometry as w}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 R}from"./mixins/BlendLayer.js";import{OperationalLayer as A}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as G,LCSimpleLayout as z,LCSmartTreeLayout as P,LCRadialTreeLayout as O,LCHierarchicalLayout as F,LCCommunityLayout as U,LCForceDirectedLayout as B,NodeFlag as Q,load as W,CallStatus as $,LinkType as H}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as K}from"../rest/knowledgeGraphService.js";let V=class extends(A(R(j(r(b))))){constructor(e){if(super(e),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 v({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=>{K(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 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);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings}),n.length>0&&(this.membershipModified=!0);const o=[];return this.layers.forEach((e=>{o.push(e.refreshCachedQueryEngine())})),await Promise.all(o),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&&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:w(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),b=new Float64Array(a.length),D=new Float64Array(a.length),v=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",A=new m({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let j,K="organic-standard",V=0,q=0;const J=G.apply;switch(K="geographic-organic-standard"===e?R:e,K){case"organic-standard":j=B.apply;break;case"organic-community":j=U.apply;break;case"hierarchical-bottom-to-top":j=F.apply;break;case"radial-root-centric":j=O.apply;break;case"tree-left-to-right":j=P.apply;break;default:j=z.apply}let X=!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[V]=Q.IsGeographic:y[V]=Q.None;const n=t.lockedNodeLocations.get(i.attributes[M]);g[V]=n.x,b[V]=n.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)){y[V]=Q.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[V]=t?.x,b[V]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(g[V]=e.x,b[V]=e.y):y[V]=Q.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(g[V]=e.x,b[V]=e.y):y[V]=Q.IsMovable;break;default:y[V]=Q.IsMovable}(null==g[V]||null==b[V]||Number.isNaN(g[V])||Number.isNaN(b[V]))&&(y[V]=Q.IsMovable,g[V]=0,b[V]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!X&&t?.lockedNodeLocations?.has(i.attributes[M])&&(X=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;D[V]=o?new Date(o).getTime():NaN;const r=e?.endField,s=r&&e?.endField?i.attributes[r]:null;v[V]=s?new Date(s).getTime():NaN,g[V]=0,b[V]=0,y[V]=Q.IsMovable}else y[V]=Q.IsMovable,g[V]=0,b[V]=0;u.set(i.attributes[M],V),_[V]={feature:i,typeName:a},V++})),X&&n.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let Y=!1;const Z=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=Z.get(t),h=s?.has(a.typeName);h||(x[q]=o,I[q]=r,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(E[q]=d?new Date(d).getTime():NaN,S[q]=c?new Date(c).getTime():NaN),void 0===s?Z.set(t,new Map([[a.typeName,q]])):s.set(a.typeName,q),q++),l.push(a)}else Y=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),Y&&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 ee=this._validateOrganicLayoutSettings(e,t?.layoutSettings?.organicLayoutSettings),te=this._convertValidatedOrganicSettingsToCalculationSettings(ee);await W();let ae=$.Error,ie=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let a;({status:ae,links:ie,graphics:a}=J((()=>t?.signal?.aborted??!1),y,g,b,D,v,x.subarray(0,q),I.subarray(0,q),E.subarray(0,q),S.subarray(0,q),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings)),ae===$.Success&&(this.chronologicalAuxiliaryGraphics=a)}else({status:ae,links:ie}=j((()=>t?.signal?.aborted??!1),y,g,b,x.subarray(0,q),I.subarray(0,q),te.computationBudgetTime,te.idealEdgeLengthMultiplier,te.repulsionRadiusMultiplier));if(s(t?.signal),ae===$.Error)throw new i("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(ae===$.Canceled)throw h();for(let i=0;i<_.length;i++){if(b[i]>84.9999?b[i]=84.9999:b[i]<-84.9999&&(b[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],b[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=w(_[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],_[i].feature.attributes[T].x<A.xmin&&(A.xmin=_[i].feature.attributes[T].x),_[i].feature.attributes[T].x>A.xmax&&(A.xmax=_[i].feature.attributes[T].x),_[i].feature.attributes[T].y<A.ymin&&(A.ymin=_[i].feature.attributes[T].y),_[i].feature.attributes[T].y>A.ymax&&(A.ymax=_[i].feature.attributes[T].y)}if(this.linkChartExtent.xmin=A.xmin,this.linkChartExtent.xmax=A.xmax,this.linkChartExtent.ymin=A.ymin,this.linkChartExtent.ymax=A.ymax,!ie)throw new i("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ne=new Map,oe=new Map,re=new Map,se=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=Z.get(d).get(r.typeName),g=0===y?0:ie?.vertexEndIndex[y-1];if(!se.has(y)){if(se.add(y),ie.types[y]===H.Recursive){const e=[ie.vertices[2*g],ie.vertices[2*g+1]],t=[ie.vertices[2*(g+1)],ie.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(ie.types[y]!==H.Regular){n.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=g;e<ie.vertexEndIndex[y];e++)a.push([ie.vertices[2*e],ie.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);ne.has(d)?ne.get(d).push(a):ne.set(d,[a])}const m=ne.get(d);oe.has(d)||(oe.set(d,new Map),re.set(d,new Map));const f=oe.get(d),b=re.get(d);f.has(r.typeName)||(f.set(r.typeName,m.shift()),b.set(r.typeName,0));const N=f.get(r.typeName);b.set(r.typeName,b.get(r.typeName)+1);const D=new L({paths:[N]});if(r.feature.attributes[T]=D,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 v=w(r.feature.attributes[T]);this.relationshipLinkChartDiagramLookup.set(r.feature.attributes[M],r.feature.attributes[T]?v: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=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),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=[];this.dataManager.addToLayer(e);for(const n of e)this.sublayerIdsCache.has(n.typeName)||(this.sublayerIdsCache.set(n.typeName,new Set),a.push(n.typeName)),this.sublayerIdsCache.get(n.typeName).add(n.id);for(const n of a){const e=this._graphTypeLookup.get(n);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(n):this.dataManager.relationshipTypeNames.add(n),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(n,new Map)}}await I(this,a,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)),void 0,void 0,void 0,t);const i={layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:new Map};for(const[n,o]of this.entityLinkChartDiagramLookup.entries())o&&i.lockedNodeLocations.set(n,new f(o.coords[0],o.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,i)}_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(e){const t=this.dataManager.sublayerCaches;t.has(e.name)||t.set(e.name,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=w(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=w(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(D).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===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()],V.prototype,"dataPreloadedInLocalCache",void 0),e([c()],V.prototype,"initializationLinkChartConfig",void 0),e([c()],V.prototype,"membershipModified",void 0),e([c()],V.prototype,"dataManager",void 0),e([c()],V.prototype,"initializationInclusionModeDefinition",null),e([c()],V.prototype,"knowledgeGraph",void 0),e([c({type:a.ofType(x),json:{write:{ignoreOrigin:!0}}})],V.prototype,"layers",void 0),e([c({readOnly:!0})],V.prototype,"linkChart",null),e([c()],V.prototype,"entityLinkChartDiagramLookup",void 0),e([c()],V.prototype,"relationshipLinkChartDiagramLookup",void 0),e([c()],V.prototype,"linkChartExtent",void 0),e([c()],V.prototype,"memberEntityTypes",void 0),e([c()],V.prototype,"memberRelationshipTypes",void 0),e([c({type:["LinkChartLayer"]})],V.prototype,"operationalLayerType",void 0),e([c()],V.prototype,"sublayerIdsCache",void 0),e([c({type:a.ofType(x),json:{write:{ignoreOrigin:!0}}})],V.prototype,"tables",void 0),e([c({json:{read:!1}})],V.prototype,"type",void 0),e([c({json:{read:!1}})],V.prototype,"chronologicalAuxiliaryGraphics",void 0),V=e([u("esri.layers.LinkChartLayer")],V);const q=V;export{q 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 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 b from"./Layer.js";import{convertFromGeometry as w}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(b))))){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 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);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings}),n.length>0&&(this.membershipModified=!0);const o=[];return this.layers.forEach((e=>{o.push(e.refreshCachedQueryEngine())})),await Promise.all(o),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&&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:w(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),b=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",A=new m({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let j,G="organic-standard",V=0,q=0;const J=z.apply;switch(G="geographic-organic-standard"===e?R:e,G){case"organic-standard":j=Q.apply;break;case"organic-community":j=B.apply;break;case"hierarchical-bottom-to-top":j=U.apply;break;case"radial-root-centric":j=F.apply;break;case"tree-left-to-right":j=O.apply;break;default:j=P.apply}let X=!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[V]=W.IsGeographic:y[V]=W.None;const n=t.lockedNodeLocations.get(i.attributes[M]);g[V]=n.x,b[V]=n.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)){y[V]=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[V]=t?.x,b[V]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(g[V]=e.x,b[V]=e.y):y[V]=W.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(g[V]=e.x,b[V]=e.y):y[V]=W.IsMovable;break;default:y[V]=W.IsMovable}(null==g[V]||null==b[V]||Number.isNaN(g[V])||Number.isNaN(b[V]))&&(y[V]=W.IsMovable,g[V]=0,b[V]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!X&&t?.lockedNodeLocations?.has(i.attributes[M])&&(X=!0);const e=t?.timeInfoByTypeName?.get(a),n=e?.startField,o=n&&e?.startField?i.attributes[n]:null;v[V]=o?new Date(o).getTime():NaN;const r=e?.endField,s=r&&e?.endField?i.attributes[r]:null;D[V]=s?new Date(s).getTime():NaN,g[V]=0,b[V]=0,y[V]=W.IsMovable}else y[V]=W.IsMovable,g[V]=0,b[V]=0;u.set(i.attributes[M],V),_[V]={feature:i,typeName:a},V++})),X&&n.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let Y=!1;const Z=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=Z.get(t),h=s?.has(a.typeName);h||(x[q]=o,I[q]=r,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(E[q]=d?new Date(d).getTime():NaN,S[q]=c?new Date(c).getTime():NaN),void 0===s?Z.set(t,new Map([[a.typeName,q]])):s.set(a.typeName,q),q++),l.push(a)}else Y=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),Y&&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 ee=this._validateOrganicLayoutSettings(e,t?.layoutSettings?.organicLayoutSettings),te=this._convertValidatedOrganicSettingsToCalculationSettings(ee);await $();let ae=H.Error,ie=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let a;({status:ae,links:ie,graphics:a}=J((()=>t?.signal?.aborted??!1),y,g,b,v,D,x.subarray(0,q),I.subarray(0,q),E.subarray(0,q),S.subarray(0,q),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings)),ae===H.Success&&(this.chronologicalAuxiliaryGraphics=a)}else({status:ae,links:ie}=j((()=>t?.signal?.aborted??!1),y,g,b,x.subarray(0,q),I.subarray(0,q),te.computationBudgetTime,te.idealEdgeLengthMultiplier,te.repulsionRadiusMultiplier));if(s(t?.signal),ae===H.Error)throw new i("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(ae===H.Canceled)throw h();for(let i=0;i<_.length;i++){if(b[i]>84.9999?b[i]=84.9999:b[i]<-84.9999&&(b[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],b[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=w(_[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],_[i].feature.attributes[T].x<A.xmin&&(A.xmin=_[i].feature.attributes[T].x),_[i].feature.attributes[T].x>A.xmax&&(A.xmax=_[i].feature.attributes[T].x),_[i].feature.attributes[T].y<A.ymin&&(A.ymin=_[i].feature.attributes[T].y),_[i].feature.attributes[T].y>A.ymax&&(A.ymax=_[i].feature.attributes[T].y)}if(this.linkChartExtent.xmin=A.xmin,this.linkChartExtent.xmax=A.xmax,this.linkChartExtent.ymin=A.ymin,this.linkChartExtent.ymax=A.ymax,!ie)throw new i("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ne=new Map,oe=new Map,re=new Map,se=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=Z.get(d).get(r.typeName),g=0===y?0:ie?.vertexEndIndex[y-1];if(!se.has(y)){if(se.add(y),ie.types[y]===K.Recursive){const e=[ie.vertices[2*g],ie.vertices[2*g+1]],t=[ie.vertices[2*(g+1)],ie.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(ie.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<ie.vertexEndIndex[y];e++)a.push([ie.vertices[2*e],ie.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);ne.has(d)?ne.get(d).push(a):ne.set(d,[a])}const m=ne.get(d);oe.has(d)||(oe.set(d,new Map),re.set(d,new Map));const f=oe.get(d),b=re.get(d);f.has(r.typeName)||(f.set(r.typeName,m.shift()),b.set(r.typeName,0));const N=f.get(r.typeName);b.set(r.typeName,b.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=w(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]=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),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=[];this.dataManager.addToLayer(e);for(const n of e)this.sublayerIdsCache.has(n.typeName)||(this.sublayerIdsCache.set(n.typeName,new Set),a.push(n.typeName)),this.sublayerIdsCache.get(n.typeName).add(n.id);for(const n of a){const e=this._graphTypeLookup.get(n);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(n):this.dataManager.relationshipTypeNames.add(n),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(n,new Map)}}await I(this,a,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)),void 0,void 0,void 0,t);const i={layoutSettings:this._currentLinkChartConfig.layoutSettings,lockedNodeLocations:new Map};for(const[n,o]of this.entityLinkChartDiagramLookup.entries())o&&i.lockedNodeLocations.set(n,new f(o.coords[0],o.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,i)}_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(e){const t=this.dataManager.sublayerCaches;t.has(e.name)||t.set(e.name,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=w(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=w(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};
|
|
@@ -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"../../PopupTemplate.js";import{clone as r}from"../../core/lang.js";import o from"../../core/Logger.js";import{MultiOriginJSONMixin as i}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as p}from"../../core/accessorSupport/PropertyOrigin.js";import l from"../../geometry/Extent.js";import y from"../../geometry/Point.js";import u from"../../geometry/Polygon.js";import m from"../../geometry/Polyline.js";import{initializeProjection as d,project as h}from"../../geometry/projection.js";import c from"../../geometry/SpatialReference.js";import{wgs84 as f}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as g}from"../../geometry/support/typeUtils.js";import j from"../Layer.js";import b from"../graphics/data/FeatureStore.js";import{QueryEngine as w}from"../graphics/data/QueryEngine.js";import{createCapabilities as T,createDrawingInfo as I}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as S,systemAggregationCountFieldName as v,systemIsSpatialFieldName as O,systemLayoutGeometryFieldName as E,systemOriginIdFieldName as x,systemDestinationIdFieldName as N}from"./constants.js";import{KnowledgeGraphSublayerBase as L}from"./KnowledgeGraphSublayerBase.js";import{getDisplayLabelProperty as F,getLinkChartDefaultLabelingInfo as _,getMapDefaultLabelingInfo as R,getKGSublayerSymbolColor as Q,getDefaultLCRelationshipSublayerSymbol as C}from"./layerUtils.js";import{BlendLayer as M,blendModeProperty as k,effectProperty as J}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as D,displayFilterEnabledProperty as P,displayFilterInfoProperty as q}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as G,featureEffectProperty as U}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as A}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as Z,orderByProperty as B}from"../mixins/OrderedLayer.js";import{RefreshableLayer as V}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as K}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as W,useViewTimeProperty as Y}from"../mixins/TemporalLayer.js";import{legendEnabled as z,maxScale as H,minScale as X,opacity as $,popupEnabled as ee}from"../support/commonProperties.js";import{featureReductionProperty as te}from"../support/featureReductionUtils.js";import re from"../support/Field.js";import{fixRendererFields as oe,fixTimeInfoFields as ie}from"../support/fieldUtils.js";import ne from"../support/LabelClass.js";import{reader as se}from"../support/labelingInfo.js";import ae from"../support/TimeInfo.js";import pe from"../../renderers/SimpleRenderer.js";import{fromJSON as le}from"../../renderers/support/jsonUtils.js";import{rendererTypes as ye}from"../../renderers/support/typeUtils.js";import ue from"../../rest/support/FeatureSet.js";import me from"../../rest/support/Query.js";import{createPopupTemplate as de}from"../../support/popupUtils.js";import{applyColorToSymbol as he}from"../../symbols/support/utils.js";import ce from"../../core/workers/RemoteClient.js";function fe(e){if(!e.json)return e;e.json.write=ge(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=ge(e.write))}return e}function ge(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=je(e)),e):!0===e?be():e}function je(e){const{target:t,writer:r,overridePolicy:o,...i}=e;return function(e,t){const r=we.call(this,e,t);return r.enabled?{...i,...r}:r}}function be(){return{overridePolicy:we}}function we(e,t){const r=!!this.geometryType;let o={enabled:r};return r&&(o={...o,...Te.call(this,e,t)}),o}function Te(e,t){return{ignoreOrigin:this.originIdOf(t)>p.DEFAULTS}}let Ie=class extends(L(D(A(G(M(Z(W(K(V(i(j))))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=T(!1,!1),this.charts=null,this.definitionExpression=null,this.displayField="",this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=S,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new ce(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=me.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach((t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(re.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))})),e.push(re.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),re.fromJSON({name:v,type:"esriFieldTypeInteger",alias:v,editable:!1}),re.fromJSON({name:O,type:"esriFieldTypeInteger",alias:O,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?g.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return E;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");const e=this.objectType.properties?F(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?_(this.graphType,this.graphTypeName,e):R(this.graphTypeName,this.geometryType,e)}set renderer(e){oe(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map((e=>e.name)).indexOf(this.graphTypeName),r=Q(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new pe({type:"simple",symbol:C(r)});const e=le(I(g.toJSON("point")).renderer);return he(e.symbol,r),e}const o=le(I(g.toJSON(this.geometryType)).renderer);return he(o.symbol,r),o}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??c.WGS84}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return de(this,e)}createQuery(){return new me({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),i=ue.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return i.features.forEach((e=>{e.sourceLayer=this})),i}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:i}=await this._setupQueryObjects(r),n=await i.executeQueryForExtent(o.toJSON(),t?.signal);let s;return s=null!=n.extent?.xmin&&null!=n.extent?.xmax&&null!=n.extent?.ymin&&null!=n.extent?.ymax?new l(n.extent):new l,{count:n.count,extent:s}}async queryObjectIds(e,t){await this.load();const r=me.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return await o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new b({geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new w({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new me({where:"1=1",outFields:[S]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then((()=>ie(this.timeInfo,this.fieldsIndex)))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=me.from(e),o=r.geometry;if(o&&!o.spatialReference?.isWGS84&&(await d(o.spatialReference,f),r.geometry=h(o instanceof u||o instanceof m||o instanceof y?o:o.extent,f)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const i=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(i)}}};e([n(fe(r(k)))],Ie.prototype,"blendMode",void 0),e([n()],Ie.prototype,"capabilities",void 0),e([n({json:{origins:{"web-scene":{write:!1}},write:be()}})],Ie.prototype,"charts",void 0),e([n({readOnly:!0})],Ie.prototype,"defaultPopupTemplate",null),e([n({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Ie.prototype,"definitionExpression",void 0),e([n()],Ie.prototype,"displayField",void 0),e([n(fe(r(P)))],Ie.prototype,"displayFilterEnabled",void 0),e([n(fe(r(q)))],Ie.prototype,"displayFilterInfo",void 0),e([n(fe(r(J)))],Ie.prototype,"effect",void 0),e([n()],Ie.prototype,"elevationInfo",void 0),e([n(fe(r(U)))],Ie.prototype,"featureEffect",void 0),e([n(fe(r(te)))],Ie.prototype,"featureReduction",null),e([n()],Ie.prototype,"fields",null),e([n()],Ie.prototype,"geometryType",null),e([n()],Ie.prototype,"geometryFieldName",null),e([n({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphType",void 0),e([n({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphTypeName",null),e([n()],Ie.prototype,"hasM",null),e([n()],Ie.prototype,"hasZ",null),e([n({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Ie.prototype,"id",void 0),e([n({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Ie.prototype,"labelsVisible",void 0),e([n({type:[ne],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:ve,write:be()}})],Ie.prototype,"labelingInfo",null),e([n({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"layerType",void 0),e([n(fe(r(z)))],Ie.prototype,"legendEnabled",void 0),e([n(fe(r(H)))],Ie.prototype,"maxScale",void 0),e([n(fe(r(X)))],Ie.prototype,"minScale",void 0),e([n()],Ie.prototype,"objectIdField",void 0),e([n()],Ie.prototype,"objectType",void 0),e([n(fe(r($)))],Ie.prototype,"opacity",void 0),e([n(fe(r(B)))],Ie.prototype,"orderBy",void 0),e([n({clonable:!1})],Ie.prototype,"parent",void 0),e([n()],Ie.prototype,"parentCompositeLayer",void 0),e([n(fe(r(ee)))],Ie.prototype,"popupEnabled",void 0),e([n({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Ie.prototype,"popupTemplate",void 0),e([n({type:Number,json:{write:{overridePolicy:Te}}})],Ie.prototype,"refreshInterval",void 0),e([n({types:ye,json:{name:"layerDefinition.drawingInfo.renderer",write:be()}})],Ie.prototype,"renderer",null),e([n()],Ie.prototype,"source",void 0),e([n()],Ie.prototype,"spatialReference",null),e([n({type:ae,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],Ie.prototype,"timeInfo",null),e([n({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"title",null),e([a("title")],Ie.prototype,"writeTitle",null),e([n({json:{read:!1}})],Ie.prototype,"type",void 0),e([n(fe(r(Y)))],Ie.prototype,"useViewTime",void 0),e([n({type:Boolean,json:{name:"visibility",write:be()}})],Ie.prototype,"visible",void 0),Ie=e([s("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Ie);const Se=Ie;function ve(e,t,r){const i=[["ESRI__AGGREGATION_COUNT",v],["ESRI__ORIGIN_ID",x],["ESRI__DESTINATION_ID",N],["ESRI__LAYOUT_GEOMETRY",E]];try{for(const t of e)for(const[e,r]of i)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(n){o.getLogger(this).warn("Error updating labelingInfo",n)}return se(e,t,r)}export{Se as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import{clone as r}from"../../core/lang.js";import o from"../../core/Logger.js";import{MultiOriginJSONMixin as i}from"../../core/MultiOriginJSONSupport.js";import"../../core/workers/workers.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import{OriginId as p}from"../../core/accessorSupport/PropertyOrigin.js";import l from"../../geometry/Extent.js";import y from"../../geometry/Point.js";import u from"../../geometry/Polygon.js";import m from"../../geometry/Polyline.js";import{initializeProjection as d,project as h}from"../../geometry/projection.js";import c from"../../geometry/SpatialReference.js";import{wgs84 as f}from"../../geometry/support/spatialReferenceUtils.js";import{featureGeometryTypeKebabDictionary as g}from"../../geometry/support/typeUtils.js";import j from"../Layer.js";import b from"../graphics/data/FeatureStore.js";import{QueryEngine as w}from"../graphics/data/QueryEngine.js";import{createCapabilities as T,createDrawingInfo as I}from"../graphics/sources/support/clientSideDefaults.js";import{systemOidFieldName as S,systemAggregationCountFieldName as v,systemIsSpatialFieldName as O,systemLayoutGeometryFieldName as E,systemOriginIdFieldName as x,systemDestinationIdFieldName as N}from"./constants.js";import{KnowledgeGraphSublayerBase as L}from"./KnowledgeGraphSublayerBase.js";import{getDisplayLabelProperty as F,getLinkChartDefaultLabelingInfo as _,getMapDefaultLabelingInfo as R,getKGSublayerSymbolColor as Q,getDefaultLCRelationshipSublayerSymbol as C}from"./layerUtils.js";import{BlendLayer as M,blendModeProperty as k,effectProperty as J}from"../mixins/BlendLayer.js";import{DisplayFilteredLayer as D,displayFilterEnabledProperty as P,displayFilterInfoProperty as q}from"../mixins/DisplayFilteredLayer.js";import{FeatureEffectLayer as G,featureEffectProperty as U}from"../mixins/FeatureEffectLayer.js";import{FeatureReductionLayer as A}from"../mixins/FeatureReductionLayer.js";import{OrderedLayer as Z,orderByProperty as B}from"../mixins/OrderedLayer.js";import{RefreshableLayer as V}from"../mixins/RefreshableLayer.js";import{ScaleRangeLayer as K}from"../mixins/ScaleRangeLayer.js";import{TemporalLayer as W,useViewTimeProperty as Y}from"../mixins/TemporalLayer.js";import{legendEnabled as z,maxScale as H,minScale as X,opacity as $,popupEnabled as ee}from"../support/commonProperties.js";import{featureReductionProperty as te}from"../support/featureReductionUtils.js";import re from"../support/Field.js";import{fixRendererFields as oe,fixTimeInfoFields as ie}from"../support/fieldUtils.js";import ne from"../support/LabelClass.js";import{reader as se}from"../support/labelingInfo.js";import ae from"../support/TimeInfo.js";import pe from"../../renderers/SimpleRenderer.js";import{fromJSON as le}from"../../renderers/support/jsonUtils.js";import{rendererTypes as ye}from"../../renderers/support/typeUtils.js";import ue from"../../rest/support/FeatureSet.js";import me from"../../rest/support/Query.js";import{createPopupTemplate as de}from"../../support/popupUtils.js";import{applyColorToSymbol as he}from"../../symbols/support/utils.js";import ce from"../../core/workers/RemoteClient.js";function fe(e){if(!e.json)return e;e.json.write=ge(e.json.write);const t=e.json.origins;if(!t)return e;let r;for(r in t){const e=t[r];e&&(e.write=ge(e.write))}return e}function ge(e){return"object"==typeof e&&e?(!1!==e.enabled&&(e.overridePolicy=je(e)),e):!0===e?be():e}function je(e){const{target:t,writer:r,overridePolicy:o,...i}=e;return function(e,t){const r=we.call(this,e,t);return r.enabled?{...i,...r}:r}}function be(){return{overridePolicy:we}}function we(e,t){const r=!!this.geometryType;let o={enabled:r};return r&&(o={...o,...Te.call(this,e,t)}),o}function Te(e,t){return{ignoreOrigin:this.originIdOf(t)>p.DEFAULTS}}let Ie=class extends(L(D(A(G(M(Z(W(K(V(i(j))))))))))){constructor(e){super(e),this.blendMode="normal",this.capabilities=T(!1,!1),this.charts=null,this.definitionExpression=null,this.displayField="",this.displayFilterEnabled=!0,this.displayFilterInfo=null,this.effect=null,this.elevationInfo=null,this.featureEffect=null,this.graphType=null,this.labelsVisible=!0,this.layerType=null,this.legendEnabled=!0,this.maxScale=0,this.minScale=0,this.objectIdField=S,this.objectType=null,this.opacity=1,this.orderBy=null,this.parent=null,this.parentCompositeLayer=null,this.persistenceEnabled=!0,this.popupEnabled=!0,this.popupTemplate=null,this.refreshInterval=0,this.source={openPorts:()=>this.load().then((()=>{const e=new MessageChannel;return new ce(e.port1,{channel:e,client:{queryFeatures:(e,t={})=>{const r=me.fromJSON(e);return this.queryFeaturesJSON(r,t)}}}),[e.port2]}))},this.type="knowledge-graph-sublayer",this.useViewTime=!0,this.visible=!0}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const t=this._normalizeFeatureReduction(e);this._set("featureReduction",t)}get fields(){const e=[];return this.objectType?.properties?.forEach((t=>{const r="esriFieldTypeOID"===t.fieldType?"esriFieldTypeInteger":t.fieldType;e.push(re.fromJSON({name:t.name,type:r,alias:t.alias,defaultValue:t.defaultValue,editable:t.editable,nullable:t.nullable}))})),e.push(re.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1}),re.fromJSON({name:v,type:"esriFieldTypeInteger",alias:v,editable:!1}),re.fromJSON({name:O,type:"esriFieldTypeInteger",alias:O,editable:!1})),e}get geometryType(){if("link-chart"===this.parentCompositeLayer?.type)return"relationship"===this.graphType?"polyline":"point";const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.geometryType;return t&&"esriGeometryNull"!==t?g.fromJSON(t):null}get geometryFieldName(){if("link-chart"===this.parentCompositeLayer?.type)return E;const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name);return e?.name??null}get graphTypeName(){return this.objectType?.name}get hasM(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasM??!1}get hasZ(){const e=this.parentCompositeLayer?.dataManager.geographicLookup.get(this.objectType?.name),t=e?.name,r=t?this.objectType?.properties?.[t]:null;return r?.hasZ??!1}set labelingInfo(e){this._set("labelingInfo",e)}get labelingInfo(){if(this._isOverridden("labelingInfo"))return this._get("labelingInfo");const e=this.objectType.properties?F(this.objectType.properties):"ESRI__ID";return"link-chart"===this.parentCompositeLayer.type?_(this.graphType,this.graphTypeName,e):R(this.graphTypeName,this.geometryType,e)}set renderer(e){oe(e,this.fieldsIndex),this._set("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const e=this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel,t=[...e?.entityTypes??[],...e?.relationshipTypes??[]].map((e=>e.name)).indexOf(this.graphTypeName),r=Q(t);if("link-chart"===this.parentCompositeLayer?.type){if("relationship"===this.graphType)return new pe({type:"simple",symbol:C(r)});const e=le(I(g.toJSON("point")).renderer);return he(e.symbol,r),e}const o=le(I(g.toJSON(this.geometryType)).renderer);return he(o.symbol,r),o}get spatialReference(){return this.parentCompositeLayer?.dataManager?.knowledgeGraph?.dataModel?.spatialReference??c.WGS84}set timeInfo(e){this._set("timeInfo",e)}get title(){return this._isOverridden("title")?this._get("title"):this.graphTypeName}set title(e){this._set("title",e)}writeTitle(e,t){t.title=e??"Layer"}createPopupTemplate(e){return de(this,e)}createQuery(){return new me({where:"1=1",outFields:["*"]})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return null}async queryFeatures(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e),i=ue.fromJSON(await o.executeQuery(r.toJSON(),t?.signal));return i.features.forEach((e=>{e.sourceLayer=this})),i}async queryFeaturesJSON(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return await o.executeQuery(r.toJSON(),t?.signal)}async queryFeatureCount(e,t){await this.load();const{resolvedQuery:r,queryEngine:o}=await this._setupQueryObjects(e);return o.executeQueryForCount(r.toJSON(),t?.signal)}async queryExtent(e={},t){await this.load();const r={...e,returnGeometry:!0},{resolvedQuery:o,queryEngine:i}=await this._setupQueryObjects(r),n=await i.executeQueryForExtent(o.toJSON(),t?.signal);let s;return s=null!=n.extent?.xmin&&null!=n.extent?.xmax&&null!=n.extent?.ymin&&null!=n.extent?.ymax?new l(n.extent):new l,{count:n.count,extent:s}}async queryObjectIds(e,t){await this.load();const r=me.from(e);let o;if("link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)o=this._cachedQueryEngine;else{const e=await this.parentCompositeLayer.dataManager.getData(r,this,t);o=this.loadQueryEngine(e)}return await o.executeQueryForIds(r.toJSON(),t?.signal)}loadQueryEngine(e){const t=new b({geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new w({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:g.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:this.timeInfo?.toJSON(),featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new me({where:"1=1",outFields:[S]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}load(e){return this.addResolvingPromise(this.parent.load(e).then((()=>ie(this.timeInfo,this.fieldsIndex)))),Promise.resolve(this)}async _setupQueryObjects(e,t){const r=me.from(e),o=r.geometry;if(o&&!o.spatialReference?.isWGS84&&(await d(o.spatialReference,f),r.geometry=h(o instanceof u||o instanceof m||o instanceof y?o:o.extent,f)),"link-chart"===this.parentCompositeLayer.type&&this._cachedQueryEngine)return{resolvedQuery:r,queryEngine:this._cachedQueryEngine};const i=await this.parentCompositeLayer.dataManager.getData(r,this,t);return{resolvedQuery:r,queryEngine:this.loadQueryEngine(i)}}};e([n(fe(r(k)))],Ie.prototype,"blendMode",void 0),e([n()],Ie.prototype,"capabilities",void 0),e([n({json:{origins:{"web-scene":{write:!1}},write:be()}})],Ie.prototype,"charts",void 0),e([n({readOnly:!0})],Ie.prototype,"defaultPopupTemplate",null),e([n({type:String,json:{origins:{service:{read:!1}},name:"layerDefinition.definitionExpression",write:{ignoreOrigin:!0}}})],Ie.prototype,"definitionExpression",void 0),e([n()],Ie.prototype,"displayField",void 0),e([n(fe(r(P)))],Ie.prototype,"displayFilterEnabled",void 0),e([n(fe(r(q)))],Ie.prototype,"displayFilterInfo",void 0),e([n(fe(r(J)))],Ie.prototype,"effect",void 0),e([n()],Ie.prototype,"elevationInfo",void 0),e([n(fe(r(U)))],Ie.prototype,"featureEffect",void 0),e([n(fe(r(te)))],Ie.prototype,"featureReduction",null),e([n()],Ie.prototype,"fields",null),e([n()],Ie.prototype,"geometryType",null),e([n()],Ie.prototype,"geometryFieldName",null),e([n({type:["entity","relationship"],nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphType",void 0),e([n({type:String,nonNullable:!0,json:{write:{isRequired:!0,ignoreOrigin:!0}}})],Ie.prototype,"graphTypeName",null),e([n()],Ie.prototype,"hasM",null),e([n()],Ie.prototype,"hasZ",null),e([n({type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Ie.prototype,"id",void 0),e([n({type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",default:!1,write:{overridePolicy(){return{enabled:!!this.geometryType,alwaysWriteDefaults:!0,ignoreOrigin:!0}}}}})],Ie.prototype,"labelsVisible",void 0),e([n({type:[ne],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:ve,write:be()}})],Ie.prototype,"labelingInfo",null),e([n({readOnly:!0,json:{read:!1,write:{writer(e,t){switch(this.parentCompositeLayer?.type){case"link-chart":t.layerType="LinkChartSubLayer";break;case"knowledge-graph":t.layerType=this.geometryType?"KnowledgeGraphSubLayer":"KnowledgeGraphSubTable"}},isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"layerType",void 0),e([n(fe(r(z)))],Ie.prototype,"legendEnabled",void 0),e([n(fe(r(H)))],Ie.prototype,"maxScale",void 0),e([n(fe(r(X)))],Ie.prototype,"minScale",void 0),e([n()],Ie.prototype,"objectIdField",void 0),e([n()],Ie.prototype,"objectType",void 0),e([n(fe(r($)))],Ie.prototype,"opacity",void 0),e([n(fe(r(B)))],Ie.prototype,"orderBy",void 0),e([n({clonable:!1})],Ie.prototype,"parent",void 0),e([n()],Ie.prototype,"parentCompositeLayer",void 0),e([n(fe(r(ee)))],Ie.prototype,"popupEnabled",void 0),e([n({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],Ie.prototype,"popupTemplate",void 0),e([n({type:Number,json:{write:{overridePolicy:Te}}})],Ie.prototype,"refreshInterval",void 0),e([n({types:ye,json:{name:"layerDefinition.drawingInfo.renderer",write:be()}})],Ie.prototype,"renderer",null),e([n()],Ie.prototype,"source",void 0),e([n()],Ie.prototype,"spatialReference",null),e([n({type:ae,json:{name:"layerDefinition.timeInfo",write:!0,origins:{"web-document":{name:"layerDefinition.timeInfo",read:!0,write:!0},"portal-item":{name:"layerDefinition.timeInfo",read:!0,write:!0}}}})],Ie.prototype,"timeInfo",null),e([n({type:String,json:{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],Ie.prototype,"title",null),e([a("title")],Ie.prototype,"writeTitle",null),e([n({json:{read:!1}})],Ie.prototype,"type",void 0),e([n(fe(r(Y)))],Ie.prototype,"useViewTime",void 0),e([n({type:Boolean,json:{name:"visibility",write:be()}})],Ie.prototype,"visible",void 0),Ie=e([s("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],Ie);const Se=Ie;function ve(e,t,r){const i=[["ESRI__AGGREGATION_COUNT",v],["ESRI__ORIGIN_ID",x],["ESRI__DESTINATION_ID",N],["ESRI__LAYOUT_GEOMETRY",E]];try{for(const t of e)for(const[e,r]of i)t.labelExpression=t.labelExpression?.replaceAll(e,r),t.labelExpressionInfo?.expression&&(t.labelExpressionInfo.expression=t.labelExpressionInfo.expression.replaceAll(e,r))}catch(n){o.getLogger(this).warn("Error updating labelingInfo",n)}return se(e,t,r)}export{Se 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]:{}},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 r=c("web-document"===e?"web-map":e);let s=y.SERVICE,t=this.sublayersSourceJSON[y.SERVICE].layers,o=this.sublayersSourceJSON[y.SERVICE].context,a=null;const l=[y.PORTAL_ITEM,y.WEB_SCENE,y.WEB_MAP].filter((e=>e<=r));for(const y of l){const e=this.sublayersSourceJSON[y];p(e.layers)&&(s=y,t=e.layers,o=e.context,e.visibleLayers&&(a={visibleLayers:e.visibleLayers,context:e.context}))}const i=[y.PORTAL_ITEM,y.WEB_SCENE,y.WEB_MAP].filter((e=>e>s&&e<=r));let n=null;for(const y of i){const{layers:e,visibleLayers:r,context:s}=this.sublayersSourceJSON[y];e&&(n={layers:e,context:s}),r&&(a={visibleLayers:r,context:s})}const u=h(t,o),d=new Map,m=new Set;if(n)for(const y of n.layers)d.set(y.id,y);if(a?.visibleLayers)for(const y of a.visibleLayers)m.add(y);return S(u,(e=>{n&&e.read(d.get(e.id),n.context),a&&e.read({defaultVisibility:m.has(e.id)},a.context)})),{origin:b(s),sublayers:new f({items:u})}}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};
|
|
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 r=c("web-document"===e?"web-map":e);let s=y.SERVICE,t=this.sublayersSourceJSON[y.SERVICE].layers,o=this.sublayersSourceJSON[y.SERVICE].context,a=null;const l=[y.PORTAL_ITEM,y.WEB_SCENE,y.WEB_MAP].filter((e=>e<=r));for(const y of l){const e=this.sublayersSourceJSON[y];p(e.layers)&&(s=y,t=e.layers,o=e.context,e.visibleLayers&&(a={visibleLayers:e.visibleLayers,context:e.context}))}const i=[y.PORTAL_ITEM,y.WEB_SCENE,y.WEB_MAP].filter((e=>e>s&&e<=r));let n=null;for(const y of i){const{layers:e,visibleLayers:r,context:s}=this.sublayersSourceJSON[y];e&&(n={layers:e,context:s}),r&&(a={visibleLayers:r,context:s})}const u=h(t,o),d=new Map,m=new Set;if(n)for(const y of n.layers)d.set(y.id,y);if(a?.visibleLayers)for(const y of a.visibleLayers)m.add(y);return S(u,(e=>{n&&e.read(d.get(e.id),n.context),a&&e.read({defaultVisibility:m.has(e.id)},a.context)})),{origin:b(s),sublayers:new f({items:u})}}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};
|
|
@@ -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 e from"../../../Color.js";import t from"../../../geometry/Extent.js";import n from"../../../geometry/SpatialReference.js";import{
|
|
5
|
+
import e from"../../../Color.js";import t from"../../../geometry/Extent.js";import n from"../../../geometry/SpatialReference.js";import{getLocaleParts as l}from"../../../intl/locale.js";import s from"../PixelBlock.js";import{getIntegerPixelType as a}from"../rasterFormats/pixelRangeUtils.js";function i(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function r(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function o(e){const{axes:l}=e.domain,s=Object.keys(l),a=[],o=[];let u=-1,m=-1,c=[];for(let t=0;t<s.length;t++){const e=s[t];i(e)?u=t:r(e)&&(m=t);const n=l[e],d=[];if("values"in n){n.values.forEach((e=>d.push("string"==typeof e?new Date(e).getTime():e)));const e=d[1]-d[0];a.push([d[0]-.5*e,d[d.length-1]+.5*e]),o.push(e)}else{const{start:e,stop:t,num:l}=n,s=(t-e)/(l-1);a.push([e-.5*s,t+.5*s]),o.push(s);for(let n=0;n<l;n++)d.push(e+s*n)}c.push({name:e,values:d,extent:[d[0],d[d.length-1]]})}u>-1&&-1===m?m=0===u?1:0:m>-1&&-1===u?u=0===m?1:0:-1===m&&-1===u&&(u=0,m=1),c=c.filter(((e,t)=>!(t===u||t===m)));const{referencing:d}=e.domain,f=d.find((e=>e.coordinates.includes(s[u]))).system.id,p=f?.slice(f.lastIndexOf("/")+1),h=null==p||"CRS84"===p?4326:Number(p),g=new n({wkid:h}),[b,y]=a[u],[x,j]=a[m],v=new t({xmin:b,xmax:y,ymin:x,ymax:j,spatialReference:g});return{width:Math.round(v.width/o[u]),height:Math.round(v.height/o[m]),extent:v,dimensions:c}}function u(e){const t=l()?.language;return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function m(){return Math.round(255*Math.random())}function c(t){const n={},{parameters:l}=t;if(!l)return n;for(const[s,a]of Object.entries(l)){const{type:t,description:l,unit:i,categoryEncoding:r,observedProperty:o}=a;if("Parameter"===t&&(n[s]={},l&&(n[s].description=u(l)),i&&(n[s].unit=i.label?u(i.label):null,n[s].symbol=i.symbol?.value),r)){const t=Object.entries(r).map(((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})));let l=!1;o?.categories?.length&&(o.categories.forEach((n=>{if(!n.id)return;const s=n.id.slice(n.id.lastIndexOf("/")+1),a=t.find((e=>e.ClassName===s));if(!a)return;const i=n.label?u(n.label):null;if(a.Label=i,n.preferredColor){const t=e.fromHex(n.preferredColor);t&&(l=!0,a.Red=t.r,a.Green=t.g,a.Blue=t.b)}})),l&&t.forEach((e=>{null==e.Red&&(e.Red=m(),e.Green=m(),e.Blue=m())})));const a={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:t.map((e=>({attributes:e})))};l&&a.fields.push({name:"Red",type:"esriFieldTypeInteger",alias:"Red",domain:null},{name:"Green",type:"esriFieldTypeInteger",alias:"Green",domain:null},{name:"Blue",type:"esriFieldTypeInteger",alias:"Blue",domain:null}),n[s].attributeTable=a}}return n}function d(e){let t=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let l=0;l<e.length;l++){const s=e[l];null!=s&&(s<t&&(t=s),s>n&&(n=s))}return a(t,n)}function f(e,t,n){const l=e.map(((e,n)=>({name:e,count:t[n]}))).sort(((e,t)=>e.name>t.name?-1:1)),s=(a=1,e=>a*=e.count);var a;const i=[...l.slice(1),{name:"",count:1}].reverse().map(s).reverse();let r=0;for(let o=e.length-1;o>=0;o--){r+=i[l.findIndex((({name:t})=>t===e[o]))]*(n%t[o]),n=Math.floor(n/t[o])}return r}function p(e){const{width:t,height:n,extent:l,dimensions:a}=o(e),{ranges:i}=e,r=Object.keys(i).sort(((e,t)=>e<t?-1:1)),u=[];for(let s=0;s<r.length;s++){const e=r[s];a?.length&&u.push({name:e,dimensions:a})}const m=c(e);u.forEach((e=>m[e.name]&&Object.assign(e,m[e.name])));const p=u.length?{variables:u}:void 0,h=[];for(let o=0;o<r.length;o++){const e=r[o],{values:l,dataType:u,axisNames:m,shape:c}=i[e],p=c.length>2?o*c.slice(0,-2).reduce(((e,t)=>e*t)):0,g=m.slice(0,-2),b=c.slice(0,-2),y="float"===u?"f32":d(l),x=t*n,j=l.length/x;for(let i=0;i<j;i++){const e=s.createEmptyBand(y,x),r=new Uint8Array(x).fill(255);let u=!1;const m=i*x;for(let t=0;t<x;t++){const n=l[m+t];null==n?(r[t]=0,u=!0):e[t]=n}if(0===o||a?.length){const l=new s({width:t,height:n,mask:u?r:null,pixels:[e],pixelType:y});if(l.updateStatistics(),a?.length){h[f(g,b,i)+p]=l}else h.push(l)}else{const t=h[i];t.pixels.push(e),u?t.mask&&(t.mask=s.combineBandMasks([t.mask,r])):t.mask=u?r:null}}}const g=Object.values(m).find((e=>e.attributeTable))?.attributeTable;return{extent:l,pixelBlocks:h,multidimensionalInfo:p,attributeTable:g,bandNames:p?void 0:r}}export{i as isXAxis,r as isYAxis,p as parseGridCoverage};
|
package/package.json
CHANGED
package/support/revision.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
|
-
const
|
|
5
|
+
const f="20250228",c="5f8df7426a174ca8fefcf3012c8fe069ec9a8f0d";export{f as buildDate,c as commitHash};
|
|
@@ -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 t from"../../Color.js";import{getColorLuminance as e}from"../../core/colorUtils.js";import i from"../../core/Error.js";import{loadFont as o}from"../../core/fontUtils.js";import{pt2px as n}from"../../core/screenUtils.js";import{quantizePolygon as a,quantizePolyline as l}from"../../geometry/support/quantizationUtils.js";import{getFill as s,getStroke as r,getDashArray as h,getPatternUrlWithColor as c}from"./gfxUtils.js";import{SymbolSizeDefaults as m,shapes as u,adjustColorBrightness as p}from"./previewUtils.js";import{renderSymbol as d}from"./renderUtils.js";import{backgroundPadding as g}from"./textUtils.js";const f="picture-fill",y="picture-marker",w="simple-fill",x="simple-line",b="simple-marker",v="text",M="Aa",S=m.size,z=m.maxSize,k=m.maxOutlineSize,L=m.lineWidth,C=225,$=document.createElement("canvas");function j(t,e,i){if("polygon"===t.type){const o=t.extent,n=0===o.width?1:o.width,l=0===o.height?1:o.height;t=a({originPosition:"upperLeft",scale:[n/e,l/i],translate:[o.xmin,o.ymax]},{},t);let s="";for(let e=0;e<t.rings.length;e++){const i=t.rings[e];for(let t=0;t<i.length;t++){const e=i[t][0],o=i[t][1];let n="";0===t?(n=`M${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n):t===i.length-1?(n=`l${e.toString()} ${o.toString()} Z`,""!==s&&(n=` ${n}`),s+=n):(n=`l${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n)}}return s}if("polyline"===t.type){const o=t.extent,n=0===o.width?1:o.width,a=0===o.height?1:o.height;t=l({originPosition:"
|
|
5
|
+
import t from"../../Color.js";import{getColorLuminance as e}from"../../core/colorUtils.js";import i from"../../core/Error.js";import{loadFont as o}from"../../core/fontUtils.js";import{pt2px as n}from"../../core/screenUtils.js";import{quantizePolygon as a,quantizePolyline as l}from"../../geometry/support/quantizationUtils.js";import{getFill as s,getStroke as r,getDashArray as h,getPatternUrlWithColor as c}from"./gfxUtils.js";import{SymbolSizeDefaults as m,shapes as u,adjustColorBrightness as p}from"./previewUtils.js";import{renderSymbol as d}from"./renderUtils.js";import{backgroundPadding as g}from"./textUtils.js";const f="picture-fill",y="picture-marker",w="simple-fill",x="simple-line",b="simple-marker",v="text",M="Aa",S=m.size,z=m.maxSize,k=m.maxOutlineSize,L=m.lineWidth,C=225,$=document.createElement("canvas");function j(t,e,i){if("polygon"===t.type){const o=t.extent,n=0===o.width?1:o.width,l=0===o.height?1:o.height;t=a({originPosition:"upperLeft",scale:[n/e,l/i],translate:[o.xmin,o.ymax]},{},t);let s="";for(let e=0;e<t.rings.length;e++){const i=t.rings[e];for(let t=0;t<i.length;t++){const e=i[t][0],o=i[t][1];let n="";0===t?(n=`M${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n):t===i.length-1?(n=`l${e.toString()} ${o.toString()} Z`,""!==s&&(n=` ${n}`),s+=n):(n=`l${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n)}}return s}if("polyline"===t.type){const o=t.extent,n=0===o.width?1:o.width,a=0===o.height?1:o.height;t=l({originPosition:"upperLeft",scale:[n/e,a/i],translate:[o.xmin,o.ymax]},{},t);let s="";for(let e=0;e<t.paths.length;e++){const i=t.paths[e];for(let t=0;t<i.length;t++){const e=i[t][0],o=i[t][1];let n="";0===t?(n=`M${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n):(n=`l${e.toString()} ${o.toString()}`,""!==s&&(n=` ${n}`),s+=n)}}return s}return""}function B(t,e){const i=$.getContext("2d"),o=[];e&&(e.weight&&o.push(e.weight),e.size&&o.push(e.size+"px"),e.family&&o.push(e.family)),i.font=o.join(" ");const{width:n,actualBoundingBoxLeft:a,actualBoundingBoxRight:l,actualBoundingBoxAscent:s,actualBoundingBoxDescent:r}=i.measureText(t);return{width:Math.ceil(Math.max(n,a+l)),height:Math.ceil(s+r),x:Math.floor(a),y:Math.floor((s-r)/2)}}function P(t){const e=t?.size;return{width:null!=e&&"object"==typeof e&&"width"in e?n(e.width):null,height:null!=e&&"object"==typeof e&&"height"in e?n(e.height):null}}async function U(t,e){const i=e.fill,o=t.color;if("pattern"===i?.type&&o&&t.type!==f){const t=await c(i.src,o.toCss(!0));i.src=t,e.fill=i}}async function A(t,e,i,n){if(!("font"in t)||!t.font||"text"!==e.shape.type)return;try{await o(t.font)}catch{}const{width:a,height:l}=P(n);if(!/[\uE600-\uE6FF]/.test(e.shape.text)){const{width:o,height:s,x:r,y:h}=B(e.shape.text,{weight:e.font?.weight,size:e.font?.size,family:e.font?.family});i[0]=a??o,i[1]=l??s,e.shape.x=r,e.shape.y=h;let c="angle"in t?t.angle:null;if(null!=n?.rotation&&(c=(c??0)+n.rotation),c){const t=c*(Math.PI/180),e=Math.abs(Math.sin(t)),o=Math.abs(Math.cos(t));i[1]=i[0]*e+i[1]*o}}}function E(t,e,i,o,a){if(null!=t.haloColor&&null!=t.haloSize){a.masking??=i.map((()=>[]));const l=n(t.haloSize);o[0]+=l,o[1]+=l,i.unshift([{...e,fill:null,stroke:{color:t.haloColor,width:2*l,join:"round",cap:"round"}}]),a.masking.unshift([{shape:{type:"rect",x:0,y:0,width:o[0]+2*g,height:o[1]+2*g},fill:[255,255,255],stroke:null},{...e,fill:[0,0,0,0],stroke:null}])}null==t.backgroundColor&&null==t.borderLineColor||(o[0]+=2*g,o[1]+=2*g,i.unshift([{shape:{type:"rect",x:0,y:0,width:o[0],height:o[1]},fill:t.backgroundColor,stroke:{color:t.borderLineColor,width:n(t.borderLineSize)}}]),a.masking?.unshift([]))}function F(t,e){return t>e?"dark":"light"}function Z(t,e){const i="number"==typeof e?.size?e?.size:null,o=null!=i?n(i):null,a=null!=e?.maxSize?n(e.maxSize):null;let l="angle"in t?t.angle:null;null!=e?.rotation&&(l=(l??0)+e.rotation);const c=s(t);let m=r(t);"dark"!==q(t,245)||e?.ignoreWhiteSymbols||(m={width:.75,...m,color:"#bdc3c7"});let p=null;const d={shape:null,fill:c,stroke:m,offset:[0,0]};m?.width&&(m.width=Math.min(m.width,k));const g=m?.width||0;let C=null!=e?.size&&(null==e?.scale||e?.scale),$=0,U=0,A=!1;switch(t.type){case b:{const i=t.style,{width:s,height:r}=P(e);let h=s===r&&null!=s?s:null!=o?o:Math.min(n(t.size),a||z);if(!0===e?.useMarkerSymbolSize&&null!==s&&null!==r){const e=Math.min(n(t.size),a||z);h=e>s&&e>r?Math.min(s,r):e}switch($=h,U=h,i){case"circle":d.shape={type:"circle",cx:0,cy:0,r:.5*h},C||($+=g,U+=g);break;case"cross":d.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[$,.5*U]},{command:"M",values:[.5*$,0]},{command:"L",values:[.5*$,U]}]};break;case"diamond":d.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[.5*$,0]},{command:"L",values:[$,.5*U]},{command:"L",values:[.5*$,U]},{command:"Z",values:[]}]},C||($+=g,U+=g);break;case"square":d.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,0]},{command:"L",values:[$,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},C||($+=g,U+=g),l&&(A=!0);break;case"triangle":d.shape={type:"path",path:[{command:"M",values:[.5*$,0]},{command:"L",values:[$,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},C||($+=g,U+=g),l&&(A=!0);break;case"x":d.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,U]},{command:"M",values:[$,0]},{command:"L",values:[0,U]}]},l&&(A=!0);break;case"path":d.shape={type:"path",path:t.path||""},C||($+=g,U+=g),l&&(A=!0),C=!0}break}case x:{const{width:t,height:i}=P(e),n=h(m).reduce(((t,e)=>t+e),0),a=n&&Math.ceil(L/n),l=i??o??g,s=t??(n*a||L);if(C=!0,"polyline"===e?.geometry?.type&&e?.geometry?.extent){$=s,U=i??$;const t=1e3,o=.15*t;p=[$,U],U=p[0]>p[1]?t*p[1]/p[0]:t,$=p[0]>p[1]?t:t*p[0]/p[1],m?.width&&(m.width=m.width*t/(p[1]>p[0]?p[1]:p[0]),m.width>o&&(m.width=o)),d.shape={type:"path",path:j(e.geometry,$,U)}}else $=null!=e?.maxSize?Math.min(s,e.maxSize):s,U=l,m&&(m.width=l),d.shape={type:"path",path:[{command:"M",values:[l/2,U/2]},{command:"L",values:[$-l/2,U/2]}]};break}case f:case w:{const t="object"==typeof e?.symbolConfig&&!!e?.symbolConfig?.isSquareFill,{width:i,height:n}=P(e);$=!t&&i!==n||null==i?null!=o?o:S:i,U=!t&&i!==n||null==n?$:n,C||($+=g,U+=g),C=!0,e?.geometry?.extent&&"polygon"===e?.geometry?.type?(p=[$,U],U=p[0]>p[1]?1e3*p[1]/p[0]:1e3,$=p[0]>p[1]?1e3:1e3*p[0]/p[1],d.shape={type:"path",path:j(e.geometry,$,U)}):d.shape=t?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[$,0]},{command:"L",values:[$,U]},{command:"L",values:[0,U]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:u.fill[0];break}case y:{const i=Math.min(n(t.width),a||z),s=Math.min(n(t.height),a||z),{width:r,height:h}=P(e),c=r===h&&null!=r?r:null!=o?o:Math.max(i,s),m=t.width/t.height;$=m<=1?Math.ceil(c*m):c,U=m<=1?c:Math.ceil(c/m),d.shape={type:"image",x:-Math.round($/2),y:-Math.round(U/2),width:$,height:U,src:t.url||""},l&&(A=!0);break}case v:{const i=t,l=e?.overrideText||i.text||M,s=i.font,{width:r,height:h}=P(e),c=null!=h?h:null!=o?o:Math.min(n(s.size),a||z),{width:m,height:u}=B(l,{weight:s.weight,size:c,family:s.family}),p=/[\uE600-\uE6FF]/.test(l);$=r??(p?c:m),U=p?c:u;let g=.5*(p?c:u);p&&(g+=5),d.shape={type:"text",text:l,x:i.xoffset||0,y:i.yoffset||g,align:"middle",alignBaseline:i.verticalAlignment,decoration:s&&s.decoration,rotated:i.rotated,kerning:i.kerning},d.font=s&&{size:c,style:s.style,decoration:s.decoration,weight:s.weight,family:s.family};break}}return{shapeDescriptor:d,size:[$,U],outputSize:p,renderOptions:{node:e?.node,scale:C,opacity:e?.opacity,rotations:[l],useRotationSize:A,effectView:e?.effectView,ariaLabel:e?.ariaLabel}}}async function D(t,e){const{shapeDescriptor:o,size:n,renderOptions:a,outputSize:l}=Z(t,e);if(!o.shape)throw new i("symbolPreview: renderPreviewHTML2D","symbol not supported.");await U(t,o),await A(t,o,n,e);const s=[[o]];if("object"==typeof e?.symbolConfig&&e?.symbolConfig?.applyColorModulation){const t=.6*n[0];s.unshift([{...o,offset:[-t,0],fill:p(o.fill,-.3)}]),s.push([{...o,offset:[t,0],fill:p(o.fill,.3)}]),n[0]+=2*t,a.scale=!1}"text"===t.type&&E(t,o,s,n,a);const r=d(s,n,a);if(l&&r){const t="img"===r.nodeName.toLowerCase()?r:r.firstChild;"svg"===t.nodeName.toLowerCase()&&t.setAttribute("viewBox",`0 0 ${n[0].toString()} ${n[1].toString()}`),t.setAttribute("width",l[0].toString()),t.setAttribute("height",l[1].toString()),l.length>2&&(t.style.setProperty("padding-left",l[2]?.toString()+"px"),t.style.setProperty("padding-right",l[2]?.toString()+"px"),t.style.setProperty("padding-top",l[3]?.toString()+"px"),t.style.setProperty("padding-bottom",l[3]?.toString()+"px"),t.style.setProperty("box-sizing","border-box"))}return r}function q(i,o=C){const n=s(i),a=r(i),l=!n||"type"in n?null:new t(n),h=a?.color?new t(a?.color):null,c=l?F(e(l),o):null,m=h?F(e(h),o):null;return m?c?c===m?c:o>=C?"light":"dark":m:c}export{q as getContrastingBackgroundTheme,Z as getRenderSymbolParameters,D as previewSymbol2D};
|