import { p } from "./chunk-ATPLLI5W.js"; import { d, e, l3 as l, n2 as n } from "./chunk-Y3WMVFTW.js"; import { s3 as s } from "./chunk-EMJ4ZSM2.js"; // node_modules/@arcgis/core/portal/PortalFolder.js var p2 = class extends l { constructor(t) { super(t), this.created = null, this.id = null, this.portal = null, this.title = null, this.username = null; } get url() { const t = this.get("portal.restUrl"); return t ? `${t}/content/users/${this.username}/${this.id}` : null; } toJSON() { throw new s("internal:not-yet-implemented", "PortalFolder.toJSON is not yet implemented"); } }; e([d({ type: Date })], p2.prototype, "created", void 0), e([d()], p2.prototype, "id", void 0), e([d()], p2.prototype, "portal", void 0), e([d()], p2.prototype, "title", void 0), e([d({ readOnly: true })], p2.prototype, "url", null), e([d()], p2.prototype, "username", void 0), p2 = e([n("esri.portal.PortalFolder")], p2); var l2 = p2; // node_modules/@arcgis/core/portal/PortalUser.js var i; var u = i = class extends l { constructor(...t) { super(...t), this.access = null, this.created = null, this.culture = null, this.description = null, this.email = null, this.fullName = null, this.modified = null, this.orgId = null, this.portal = null, this.preferredView = null, this.privileges = null, this.region = null, this.role = null, this.roleId = null, this.sourceJSON = null, this.units = null, this.username = null, this.userType = null; } get thumbnailUrl() { const t = this.url, r = this.thumbnail; return t && r ? this.portal._normalizeUrl(`${t}/info/${r}?f=json`) : null; } get userContentUrl() { const t = this.get("portal.restUrl"); return t ? `${t}/content/users/${this.username}` : null; } get url() { const t = this.get("portal.restUrl"); return t ? `${t}/community/users/${this.username}` : null; } addItem(t) { const r = t && t.item, e2 = t && t.data, o = t && t.folder, s2 = { method: "post" }; r && (s2.query = r.createPostQuery(), e2 != null && (typeof e2 == "string" ? s2.query.text = e2 : typeof e2 == "object" && (s2.query.text = JSON.stringify(e2)))); let l3 = this.userContentUrl; return o && (l3 += "/" + (typeof o == "string" ? o : o.id)), this.portal._request(l3 + "/addItem", s2).then((t2) => (r.id = t2.id, r.portal = this.portal, r.loaded ? r.reload() : r.load())); } deleteItem(t) { let r = this.userContentUrl; return t.ownerFolder && (r += "/" + t.ownerFolder), this.portal._request(r + `/items/${t.id}/delete`, { method: "post" }).then(() => { t.id = null, t.portal = null; }); } deleteItems(t) { const r = this.userContentUrl + "/deleteItems", e2 = t.map((t2) => t2.id); if (e2.length) { const o = { method: "post", query: { items: e2.join(",") } }; return this.portal._request(r, o).then(() => { t.forEach((t2) => { t2.id = null, t2.portal = null; }); }); } return Promise.resolve(void 0); } fetchFolders() { const t = { query: { num: 1 } }; return this.portal._request(this.userContentUrl, t).then((t2) => { let r; return r = t2 && t2.folders ? t2.folders.map((t3) => { const r2 = l2.fromJSON(t3); return r2.portal = this.portal, r2; }) : [], r; }); } fetchGroups() { return this.portal._request(this.url).then((t) => { let r; return r = t && t.groups ? t.groups.map((t2) => { const r2 = p.fromJSON(t2); return r2.portal = this.portal, r2; }) : [], r; }); } fetchItems(t) { t || (t = {}); let r, e2 = this.userContentUrl; return t.folder && (e2 += "/" + t.folder.id), import("./PortalItem-VBDEEBID.js").then(({ default: o }) => { r = o; const s2 = { folders: false, num: t.num || 10, start: t.start || 1, sortField: t.sortField || "created", sortOrder: t.sortOrder || "asc" }; return this.portal._request(e2, { query: s2 }); }).then((t2) => { let e3; return t2 && t2.items ? (e3 = t2.items.map((t3) => { const e4 = r.fromJSON(t3); return e4.portal = this.portal, e4; }), Promise.all(e3.map((t3) => t3.load())).catch((t3) => t3).then(() => ({ items: e3, nextStart: t2.nextStart, total: t2.total }))) : { items: [], nextStart: -1, total: 0 }; }); } fetchTags() { return this.portal._request(this.url + "/tags").then((t) => t.tags); } getThumbnailUrl(t) { let r = this.thumbnailUrl; return r && t && (r += `&w=${t}`), r; } queryFavorites(t) { return this.favGroupId ? (this._favGroup || (this._favGroup = new p({ id: this.favGroupId, portal: this.portal })), this._favGroup.queryItems(t)) : Promise.reject(new s("internal:unknown", "Unknown internal error", { internalError: "Unknown favGroupId" })); } toJSON() { throw new s("internal:not-yet-implemented", "PortalGroup.toJSON is not yet implemented"); } static fromJSON(t) { if (!t) return null; if (t.declaredClass) throw new Error("JSON object is already hydrated"); const r = new i(); return r.sourceJSON = t, r.read(t), r; } }; e([d()], u.prototype, "access", void 0), e([d({ type: Date })], u.prototype, "created", void 0), e([d()], u.prototype, "culture", void 0), e([d()], u.prototype, "description", void 0), e([d()], u.prototype, "email", void 0), e([d()], u.prototype, "favGroupId", void 0), e([d()], u.prototype, "fullName", void 0), e([d({ type: Date })], u.prototype, "modified", void 0), e([d()], u.prototype, "orgId", void 0), e([d()], u.prototype, "portal", void 0), e([d()], u.prototype, "preferredView", void 0), e([d()], u.prototype, "privileges", void 0), e([d()], u.prototype, "region", void 0), e([d()], u.prototype, "role", void 0), e([d()], u.prototype, "roleId", void 0), e([d()], u.prototype, "sourceJSON", void 0), e([d()], u.prototype, "thumbnail", void 0), e([d({ readOnly: true })], u.prototype, "thumbnailUrl", null), e([d()], u.prototype, "units", void 0), e([d({ readOnly: true })], u.prototype, "userContentUrl", null), e([d({ readOnly: true })], u.prototype, "url", null), e([d()], u.prototype, "username", void 0), e([d()], u.prototype, "userType", void 0), u = i = e([n("esri.portal.PortalUser")], u); var p3 = u; export { p3 as p }; //# sourceMappingURL=chunk-65K7LC56.js.map