import { p as p2 } from "./chunk-65K7LC56.js"; import { d as d2 } from "./chunk-ATPLLI5W.js"; import { l } from "./chunk-XH7RUGVZ.js"; import { m as m2 } from "./chunk-TBBTRX4O.js"; import { U, r as r3 } from "./chunk-VNFRAYHO.js"; import { n as n2 } from "./chunk-R5IG2D6H.js"; import { M2 as M, o } from "./chunk-ECW2QABR.js"; import { d, e, n2 as n, u2 as u, y3 as y } from "./chunk-Y3WMVFTW.js"; import { b } from "./chunk-IHXECKQQ.js"; import { f, m, p, w } from "./chunk-ULGDPLM2.js"; import { r as r2, s3 as s } from "./chunk-EMJ4ZSM2.js"; import { r } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/portal/PortalQueryResult.js var e2 = class extends y { constructor(r4) { super(r4), this.nextQueryParams = null, this.queryParams = null, this.results = null, this.total = null; } }; e([d()], e2.prototype, "nextQueryParams", void 0), e([d()], e2.prototype, "queryParams", void 0), e([d()], e2.prototype, "results", void 0), e([d()], e2.prototype, "total", void 0), e2 = e([n("esri.portal.PortalQueryResult")], e2); var p3 = e2; // node_modules/@arcgis/core/portal/Portal.js var G; var O; var U2 = { PortalGroup: () => import("./PortalGroup-D7OB5LSW.js"), PortalItem: () => import("./PortalItem-VBDEEBID.js"), PortalUser: () => import("./PortalUser-LHCQVD2S.js") }; var j = G = class extends u(m2) { constructor(e3) { super(e3), this.access = null, this.allSSL = false, this.authMode = "auto", this.authorizedCrossOriginDomains = null, this.basemapGalleryGroupQuery = null, this.bingKey = null, this.canListApps = false, this.canListData = false, this.canListPreProvisionedItems = false, this.canProvisionDirectPurchase = false, this.canSearchPublic = true, this.canShareBingPublic = false, this.canSharePublic = false, this.canSignInArcGIS = false, this.canSignInIDP = false, this.colorSetsGroupQuery = null, this.commentsEnabled = false, this.created = null, this.culture = null, this.customBaseUrl = null, this.defaultBasemap = null, this.defaultDevBasemap = null, this.defaultExtent = null, this.defaultVectorBasemap = null, this.description = null, this.devBasemapGalleryGroupQuery = null, this.eueiEnabled = null, this.featuredGroups = null, this.featuredItemsGroupQuery = null, this.galleryTemplatesGroupQuery = null, this.livingAtlasGroupQuery = null, this.hasCategorySchema = false, this.helperServices = null, this.homePageFeaturedContent = null, this.homePageFeaturedContentCount = null, this.httpPort = null, this.httpsPort = null, this.id = null, this.ipCntryCode = null, this.isPortal = false, this.isReadOnly = false, this.layerTemplatesGroupQuery = null, this.maxTokenExpirationMinutes = null, this.modified = null, this.name = null, this.portalHostname = null, this.portalMode = null, this.portalProperties = null, this.region = null, this.rotatorPanels = null, this.showHomePageDescription = false, this.sourceJSON = null, this.supportsHostedServices = false, this.symbolSetsGroupQuery = null, this.templatesGroupQuery = null, this.units = null, this.url = r2.portalUrl, this.urlKey = null, this.user = null, this.useStandardizedQuery = false, this.useVectorBasemaps = false, this.vectorBasemapGalleryGroupQuery = null; } normalizeCtorArgs(e3) { return typeof e3 == "string" ? { url: e3 } : e3; } destroy() { this._esriId_credentialCreateHandle && (this._esriId_credentialCreateHandle.remove(), this._esriId_credentialCreateHandle = null); } readAuthorizedCrossOriginDomains(e3) { if (e3) for (const r4 of e3) r2.request.trustedServers.includes(r4) || r2.request.trustedServers.push(r4); return e3; } readDefaultBasemap(e3) { return this._readBasemap(e3); } readDefaultDevBasemap(e3) { return this._readBasemap(e3); } readDefaultVectorBasemap(e3) { return this._readBasemap(e3); } get extraQuery() { const e3 = !(this.user && this.user.orgId) || this.canSearchPublic; return this.id && !e3 ? ` AND orgid:${this.id}` : null; } get isOrganization() { return !!this.access; } get restUrl() { let e3 = this.url; if (e3) { const t = e3.indexOf("/sharing"); e3 = t > 0 ? e3.substring(0, t) : this.url.replace(/\/+$/, ""), e3 += "/sharing/rest"; } return e3; } get thumbnailUrl() { const e3 = this.restUrl, t = this.thumbnail; return e3 && t ? this._normalizeSSL(e3 + "/portals/self/resources/" + t) : null; } readUrlKey(e3) { return e3 ? e3.toLowerCase() : e3; } readUser(e3) { let t = null; return e3 && (t = p2.fromJSON(e3), t.portal = this), t; } load(e3) { const t = import("./Basemap-TZ3SGI2Y.js").then(({ default: t2 }) => { f(e3), O = t2; }).then(() => this.sourceJSON ? this.sourceJSON : this._fetchSelf(this.authMode, false, e3)).then((e4) => { if (n2) { const e5 = n2; this.credential = e5.findCredential(this.restUrl), this.credential || this.authMode !== G.AUTH_MODE_AUTO || (this._esriId_credentialCreateHandle = e5.on("credential-create", () => { e5.findCredential(this.restUrl) && this._signIn(); })); } this.sourceJSON = e4, this.read(e4); }); return this.addResolvingPromise(t), Promise.resolve(this); } async createElevationLayers() { await this.load(); const e3 = this._getHelperService("defaultElevationLayers"), t = (await import("./ElevationLayer-AEMRYKQF.js")).default; return e3 ? e3.map((e4) => new t({ id: e4.id, url: e4.url })) : []; } fetchBasemaps(e3, r4) { const o2 = new d2(); return o2.query = e3 || (r2.apiKey && r3(this.url) ? this.devBasemapGalleryGroupQuery : this.useVectorBasemaps ? this.vectorBasemapGalleryGroupQuery : this.basemapGalleryGroupQuery), o2.disableExtraQuery = true, this.queryGroups(o2, r4).then((e4) => { if (o2.num = 100, o2.query = 'type:"Web Map" -type:"Web Application"', e4.total) { const t = e4.results[0]; return o2.sortField = t.sortField || "name", o2.sortOrder = t.sortOrder || "desc", t.queryItems(o2, r4); } return null; }).then((e4) => { let t; return t = e4 && e4.total ? e4.results.filter((e5) => e5.type === "Web Map").map((e5) => new O({ portalItem: e5 })) : [], t; }); } fetchCategorySchema(e3) { return this.hasCategorySchema ? this._request(this.restUrl + "/portals/self/categorySchema", e3).then((e4) => e4.categorySchema) : p(e3) ? Promise.reject(m()) : Promise.resolve([]); } fetchFeaturedGroups(e3) { const t = this.featuredGroups, r4 = new d2(); if (r4.num = 100, r4.sortField = "title", t && t.length) { const o2 = []; for (const e4 of t) o2.push(`(title:"${e4.title}" AND owner:${e4.owner})`); return r4.query = o2.join(" OR "), this.queryGroups(r4, e3).then((e4) => e4.results); } return p(e3) ? Promise.reject(m()) : Promise.resolve([]); } fetchRegions(e3) { const t = this.user?.culture || this.culture || l(); return this._request(this.restUrl + "/portals/regions", { ...e3, query: { culture: t } }); } fetchSettings(e3) { const t = this.user?.culture || this.culture || l(); return this._request(this.restUrl + "/portals/self/settings", { ...e3, query: { culture: t } }); } static getDefault() { return G._default && !G._default.destroyed || (G._default = new G()), G._default; } queryGroups(e3, t) { return this._queryPortal("/community/groups", e3, "PortalGroup", t); } queryItems(e3, t) { return this._queryPortal("/search", e3, "PortalItem", t); } queryUsers(e3, t) { return e3.sortField || (e3.sortField = "username"), this._queryPortal("/community/users", e3, "PortalUser", t); } toJSON() { throw new s("internal:not-yet-implemented", "Portal.toJSON is not yet implemented"); } static fromJSON(e3) { if (!e3) return null; if (e3.declaredClass) throw new Error("JSON object is already hydrated"); return new G({ sourceJSON: e3 }); } _getHelperService(e3) { const t = this.helperServices && this.helperServices[e3]; if (!t) throw new s("portal:service-not-found", `The \`helperServices\` do not include an entry named "${e3}"`); return t; } _getHelperServiceUrl(e3) { const t = this._getHelperService(e3); if (!t.url) throw new s("portal:service-url-not-found", `The \`helperServices\` entry "${e3}" does not include a \`url\` value`); return t.url; } _fetchSelf(e3 = this.authMode, t = false, r4) { const o2 = this.restUrl + "/portals/self", s2 = { authMode: e3, query: { culture: l().toLowerCase() }, ...r4 }; return s2.authMode === "auto" && (s2.authMode = "no-prompt"), t && (s2.query.default = true), this._request(o2, s2); } _queryPortal(e3, t, r4, o2) { const s2 = b(d2, t), i = (t2) => this._request(this.restUrl + e3, { ...s2.toRequestOptions(this), ...o2 }).then((e4) => { const r5 = s2.clone(); return r5.start = e4.nextStart, new p3({ nextQueryParams: r5, queryParams: s2, total: e4.total, results: G._resultsToTypedArray(t2, { portal: this }, e4, o2) }); }).then((e4) => Promise.all(e4.results.map((t3) => typeof t3.when == "function" ? t3.when() : e4)).then(() => e4, (t3) => (w(t3), e4))); return r4 && U2[r4] ? U2[r4]().then(({ default: e4 }) => (f(o2), i(e4))) : i(); } _signIn() { if (this.authMode === G.AUTH_MODE_ANONYMOUS) return Promise.reject(new s("portal:invalid-auth-mode", `Current "authMode"' is "${this.authMode}"`)); if (this.loadStatus === "failed") return Promise.reject(this.loadError); const e3 = (e4) => Promise.resolve().then(() => this.loadStatus === "not-loaded" ? (e4 || (this.authMode = "immediate"), this.load().then(() => null)) : this.loadStatus === "loading" ? this.load().then(() => this.credential ? null : (this.credential = e4, this._fetchSelf("immediate"))) : this.user && this.credential === e4 ? null : (this.credential = e4, this._fetchSelf("immediate"))).then((e5) => { e5 && (this.sourceJSON = e5, this.read(e5)); }); return n2 ? n2.getCredential(this.restUrl).then((t) => e3(t)) : e3(this.credential); } _normalizeSSL(e3) { return e3.replace(/^http:/i, "https:").replace(":7080", ":7443"); } _normalizeUrl(e3) { const t = this.credential && this.credential.token; return this._normalizeSSL(t ? e3 + (e3.includes("?") ? "&" : "?") + "token=" + t : e3); } _requestToTypedArray(e3, t, r4) { return this._request(e3, t).then((e4) => { const t2 = G._resultsToTypedArray(r4, { portal: this }, e4); return Promise.all(t2.map((t3) => typeof t3.when == "function" ? t3.when() : e4)).then(() => t2, () => t2); }); } _readBasemap(e3) { if (e3) { const t = O.fromJSON(e3); return t.portalItem = { portal: this }, t; } return null; } _request(e3, t = {}) { const r4 = { f: "json", ...t.query }, { authMode: s2 = this.authMode === G.AUTH_MODE_ANONYMOUS ? "anonymous" : "auto", body: i = null, cacheBust: a = false, method: l2 = "auto", responseType: u2 = "json", signal: n3 } = t, p4 = { authMode: s2, body: i, cacheBust: a, method: l2, query: r4, responseType: u2, timeout: 0, signal: n3 }; return U(this._normalizeSSL(e3), p4).then((e4) => e4.data); } static _resultsToTypedArray(e3, t, r4, o2) { let s2; if (r4) { const i = r(o2) ? o2.signal : null; s2 = r4.listings || r4.notifications || r4.userInvitations || r4.tags || r4.items || r4.groups || r4.comments || r4.provisions || r4.results || r4.relatedItems || r4, (e3 || t) && (s2 = s2.map((r5) => { const o3 = Object.assign(e3 ? e3.fromJSON(r5) : r5, t); return typeof o3.load == "function" && o3.load(i), o3; })); } else s2 = []; return s2; } }; j.AUTH_MODE_ANONYMOUS = "anonymous", j.AUTH_MODE_AUTO = "auto", j.AUTH_MODE_IMMEDIATE = "immediate", e([d()], j.prototype, "access", void 0), e([d()], j.prototype, "allSSL", void 0), e([d()], j.prototype, "authMode", void 0), e([d()], j.prototype, "authorizedCrossOriginDomains", void 0), e([o("authorizedCrossOriginDomains")], j.prototype, "readAuthorizedCrossOriginDomains", null), e([d()], j.prototype, "basemapGalleryGroupQuery", void 0), e([d()], j.prototype, "bingKey", void 0), e([d()], j.prototype, "canListApps", void 0), e([d()], j.prototype, "canListData", void 0), e([d()], j.prototype, "canListPreProvisionedItems", void 0), e([d()], j.prototype, "canProvisionDirectPurchase", void 0), e([d()], j.prototype, "canSearchPublic", void 0), e([d()], j.prototype, "canShareBingPublic", void 0), e([d()], j.prototype, "canSharePublic", void 0), e([d()], j.prototype, "canSignInArcGIS", void 0), e([d()], j.prototype, "canSignInIDP", void 0), e([d()], j.prototype, "colorSetsGroupQuery", void 0), e([d()], j.prototype, "commentsEnabled", void 0), e([d({ type: Date })], j.prototype, "created", void 0), e([d()], j.prototype, "credential", void 0), e([d()], j.prototype, "culture", void 0), e([d()], j.prototype, "currentVersion", void 0), e([d()], j.prototype, "customBaseUrl", void 0), e([d()], j.prototype, "defaultBasemap", void 0), e([o("defaultBasemap")], j.prototype, "readDefaultBasemap", null), e([d()], j.prototype, "defaultDevBasemap", void 0), e([o("defaultDevBasemap")], j.prototype, "readDefaultDevBasemap", null), e([d({ type: M })], j.prototype, "defaultExtent", void 0), e([d()], j.prototype, "defaultVectorBasemap", void 0), e([o("defaultVectorBasemap")], j.prototype, "readDefaultVectorBasemap", null), e([d()], j.prototype, "description", void 0), e([d()], j.prototype, "devBasemapGalleryGroupQuery", void 0), e([d()], j.prototype, "eueiEnabled", void 0), e([d({ readOnly: true })], j.prototype, "extraQuery", null), e([d()], j.prototype, "featuredGroups", void 0), e([d()], j.prototype, "featuredItemsGroupQuery", void 0), e([d()], j.prototype, "galleryTemplatesGroupQuery", void 0), e([d()], j.prototype, "livingAtlasGroupQuery", void 0), e([d()], j.prototype, "hasCategorySchema", void 0), e([d()], j.prototype, "helpBase", void 0), e([d()], j.prototype, "helperServices", void 0), e([d()], j.prototype, "helpMap", void 0), e([d()], j.prototype, "homePageFeaturedContent", void 0), e([d()], j.prototype, "homePageFeaturedContentCount", void 0), e([d()], j.prototype, "httpPort", void 0), e([d()], j.prototype, "httpsPort", void 0), e([d()], j.prototype, "id", void 0), e([d()], j.prototype, "ipCntryCode", void 0), e([d({ readOnly: true })], j.prototype, "isOrganization", null), e([d()], j.prototype, "isPortal", void 0), e([d()], j.prototype, "isReadOnly", void 0), e([d()], j.prototype, "layerTemplatesGroupQuery", void 0), e([d()], j.prototype, "maxTokenExpirationMinutes", void 0), e([d({ type: Date })], j.prototype, "modified", void 0), e([d()], j.prototype, "name", void 0), e([d()], j.prototype, "portalHostname", void 0), e([d()], j.prototype, "portalMode", void 0), e([d()], j.prototype, "portalProperties", void 0), e([d()], j.prototype, "region", void 0), e([d({ readOnly: true })], j.prototype, "restUrl", null), e([d()], j.prototype, "rotatorPanels", void 0), e([d()], j.prototype, "showHomePageDescription", void 0), e([d()], j.prototype, "sourceJSON", void 0), e([d()], j.prototype, "staticImagesUrl", void 0), e([d({ json: { name: "2DStylesGroupQuery" } })], j.prototype, "stylesGroupQuery2d", void 0), e([d({ json: { name: "stylesGroupQuery" } })], j.prototype, "stylesGroupQuery3d", void 0), e([d()], j.prototype, "supportsHostedServices", void 0), e([d()], j.prototype, "symbolSetsGroupQuery", void 0), e([d()], j.prototype, "templatesGroupQuery", void 0), e([d()], j.prototype, "thumbnail", void 0), e([d({ readOnly: true })], j.prototype, "thumbnailUrl", null), e([d()], j.prototype, "units", void 0), e([d()], j.prototype, "url", void 0), e([d()], j.prototype, "urlKey", void 0), e([o("urlKey")], j.prototype, "readUrlKey", null), e([d()], j.prototype, "user", void 0), e([o("user")], j.prototype, "readUser", null), e([d()], j.prototype, "useStandardizedQuery", void 0), e([d()], j.prototype, "useVectorBasemaps", void 0), e([d()], j.prototype, "vectorBasemapGalleryGroupQuery", void 0), j = G = e([n("esri.portal.Portal")], j); var B = j; export { B }; //# sourceMappingURL=chunk-4NKD334K.js.map