123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- import {
- Ke
- } from "./chunk-6NQ3AA2U.js";
- import {
- b
- } from "./chunk-EGZW6HC3.js";
- import {
- B
- } from "./chunk-4NKD334K.js";
- import {
- U
- } from "./chunk-VNFRAYHO.js";
- import {
- n
- } from "./chunk-R5IG2D6H.js";
- import {
- w
- } from "./chunk-ULGDPLM2.js";
- import {
- r,
- t
- } from "./chunk-GZT4BVFP.js";
- // node_modules/@arcgis/core/layers/support/capabilities.js
- var t2 = { analytics: { supportsCacheHint: false }, attachment: { supportsContentType: false, supportsExifInfo: false, supportsKeywords: false, supportsName: false, supportsSize: false, supportsCacheHint: false, supportsResize: false }, data: { isVersioned: false, supportsAttachment: false, supportsM: false, supportsZ: false }, editing: { supportsDeleteByAnonymous: false, supportsDeleteByOthers: false, supportsGeometryUpdate: false, supportsGlobalId: false, supportsReturnServiceEditsInSourceSpatialReference: false, supportsRollbackOnFailure: false, supportsUpdateByAnonymous: false, supportsUpdateByOthers: false, supportsUpdateWithoutM: false, supportsUploadWithItemId: false }, metadata: { supportsAdvancedFieldProperties: false }, operations: { supportsCalculate: false, supportsTruncate: false, supportsValidateSql: false, supportsAdd: false, supportsDelete: false, supportsEditing: false, supportsChangeTracking: false, supportsQuery: false, supportsQueryAnalytics: false, supportsQueryAttachments: false, supportsQueryTopFeatures: false, supportsResizeAttachments: false, supportsSync: false, supportsUpdate: false, supportsExceedsLimitStatistics: false }, queryRelated: { supportsCount: false, supportsOrderBy: false, supportsPagination: false, supportsCacheHint: false }, queryTopFeatures: { supportsCacheHint: false }, query: { maxRecordCount: 0, maxRecordCountFactor: 0, standardMaxRecordCount: 0, supportsCacheHint: false, supportsCentroid: false, supportsCompactGeometry: false, supportsDefaultSpatialReference: false, supportsDisjointSpatialRelationship: false, supportsDistance: false, supportsDistinct: false, supportsExtent: false, supportsFormatPBF: false, supportsGeometryProperties: false, supportsHavingClause: false, supportsHistoricMoment: false, supportsMaxRecordCountFactor: false, supportsOrderBy: false, supportsPagination: false, supportsPercentileStatistics: false, supportsQuantization: false, supportsQuantizationEditMode: false, supportsQueryByOthers: false, supportsQueryGeometry: false, supportsResultType: false, supportsSqlExpression: false, supportsStandardizedQueriesOnly: false, supportsTopFeaturesQuery: false, supportsSpatialAggregationStatistics: false, supportedSpatialAggregationStatistics: { envelope: false, centroid: false, convexHull: false }, supportsStatistics: false, tileMaxRecordCount: 0 } };
- // node_modules/@arcgis/core/layers/support/FetchAssociatedFeatureLayer.js
- var l = class {
- constructor(t3, r2, e, a) {
- this.parsedUrl = t3, this.portalItem = r2, this.apiKey = e, this.signal = a, this.rootDocument = null;
- const s = this.parsedUrl.path.match(/^(.*)\/SceneServer\/layers\/([\d]*)\/?$/i);
- s && (this.urlParts = { root: s[1], layerId: parseInt(s[2], 10) });
- }
- async fetch() {
- if (!this.urlParts)
- return null;
- const t3 = this.portalItem ?? await this._portalItemFromServiceItemId();
- if (t(t3))
- return this._loadFromUrl();
- const r2 = await this._findAndLoadRelatedPortalItem(t3);
- return t(r2) ? null : this._loadFeatureLayerFromPortalItem(r2);
- }
- async fetchPortalItem() {
- if (!this.urlParts)
- return null;
- const t3 = this.portalItem ?? await this._portalItemFromServiceItemId();
- return t(t3) ? null : this._findAndLoadRelatedPortalItem(t3);
- }
- async _fetchRootDocument() {
- if (r(this.rootDocument))
- return this.rootDocument;
- if (t(this.urlParts))
- return this.rootDocument = {}, {};
- const t3 = { query: { f: "json", token: this.apiKey }, responseType: "json", signal: this.signal }, s = `${this.urlParts.root}/SceneServer`;
- try {
- const e = await U(s, t3);
- this.rootDocument = e.data;
- } catch {
- this.rootDocument = {};
- }
- return this.rootDocument;
- }
- async _fetchServiceOwningPortalUrl() {
- const e = n?.findServerInfo(this.parsedUrl.path);
- if (e?.owningSystemUrl)
- return e.owningSystemUrl;
- const a = this.parsedUrl.path.replace(/(.*\/rest)\/.*/i, "$1") + "/info";
- try {
- const t3 = (await U(a, { query: { f: "json" }, responseType: "json", signal: this.signal })).data.owningSystemUrl;
- if (t3)
- return t3;
- } catch (i) {
- w(i);
- }
- return null;
- }
- async _findAndLoadRelatedPortalItem(t3) {
- try {
- return (await t3.fetchRelatedItems({ relationshipType: "Service2Service", direction: "reverse" }, { signal: this.signal })).find((t4) => t4.type === "Feature Service") || null;
- } catch (r2) {
- return w(r2), null;
- }
- }
- async _loadFeatureLayerFromPortalItem(t3) {
- await t3.load({ signal: this.signal });
- const r2 = await this._findMatchingAssociatedSublayerUrl(t3.url);
- return new Ke({ url: r2, portalItem: t3 }).load({ signal: this.signal });
- }
- async _loadFromUrl() {
- const t3 = await this._findMatchingAssociatedSublayerUrl(`${this.urlParts.root}/FeatureServer`);
- return new Ke({ url: t3 }).load({ signal: this.signal });
- }
- async _findMatchingAssociatedSublayerUrl(t3) {
- const e = t3.replace(/^(.*FeatureServer)(\/[\d]*\/?)?$/i, "$1"), a = { query: { f: "json" }, responseType: "json", authMode: "no-prompt", signal: this.signal }, s = this.urlParts.layerId, i = this._fetchRootDocument(), o = U(e, a), [n2, l2] = await Promise.all([o, i]), c = l2 && l2.layers, h = n2.data && n2.data.layers;
- if (!Array.isArray(h))
- throw new Error("expected layers array");
- if (Array.isArray(c))
- for (let r2 = 0; r2 < Math.min(c.length, h.length); r2++) {
- if (c[r2].id === s)
- return `${e}/${h[r2].id}`;
- }
- else if (s < h.length)
- return `${e}/${h[s].id}`;
- throw new Error("could not find matching associated sublayer");
- }
- async _portalItemFromServiceItemId() {
- const t3 = (await this._fetchRootDocument()).serviceItemId;
- if (!t3)
- return null;
- const r2 = new b({ id: t3, apiKey: this.apiKey }), e = await this._fetchServiceOwningPortalUrl();
- r(e) && (r2.portal = new B({ url: e }));
- try {
- return r2.load({ signal: this.signal });
- } catch (i) {
- return w(i), null;
- }
- }
- };
- export {
- t2 as t,
- l
- };
- //# sourceMappingURL=chunk-Z25OS74A.js.map
|