chunk-7IBV2TRE.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. import {
  2. p
  3. } from "./chunk-SFEFRQCL.js";
  4. import {
  5. e,
  6. l3 as l,
  7. n5 as n,
  8. y3 as y
  9. } from "./chunk-2Z2TG5CU.js";
  10. import {
  11. s3 as s
  12. } from "./chunk-E5O6P5I2.js";
  13. // node_modules/@arcgis/core/portal/PortalFolder.js
  14. var p2 = class extends l {
  15. constructor(t) {
  16. super(t), this.created = null, this.id = null, this.portal = null, this.title = null, this.username = null;
  17. }
  18. get url() {
  19. const t = this.get("portal.restUrl");
  20. return t ? `${t}/content/users/${this.username}/${this.id}` : null;
  21. }
  22. toJSON() {
  23. throw new s("internal:not-yet-implemented", "PortalFolder.toJSON is not yet implemented");
  24. }
  25. };
  26. e([y({ type: Date })], p2.prototype, "created", void 0), e([y()], p2.prototype, "id", void 0), e([y()], p2.prototype, "portal", void 0), e([y()], p2.prototype, "title", void 0), e([y({ readOnly: true })], p2.prototype, "url", null), e([y()], p2.prototype, "username", void 0), p2 = e([n("esri.portal.PortalFolder")], p2);
  27. var l2 = p2;
  28. // node_modules/@arcgis/core/portal/PortalUser.js
  29. var i;
  30. var u = i = class extends l {
  31. constructor(...t) {
  32. 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;
  33. }
  34. get thumbnailUrl() {
  35. const t = this.url, r = this.thumbnail;
  36. return t && r ? this.portal._normalizeUrl(`${t}/info/${r}?f=json`) : null;
  37. }
  38. get userContentUrl() {
  39. const t = this.get("portal.restUrl");
  40. return t ? `${t}/content/users/${this.username}` : null;
  41. }
  42. get url() {
  43. const t = this.get("portal.restUrl");
  44. return t ? `${t}/community/users/${this.username}` : null;
  45. }
  46. addItem(t) {
  47. const r = t && t.item, e2 = t && t.data, o = t && t.folder, l3 = { method: "post" };
  48. r && (l3.query = r.createPostQuery(), null != e2 && ("string" == typeof e2 ? l3.query.text = e2 : "object" == typeof e2 && (l3.query.text = JSON.stringify(e2))));
  49. let s2 = this.userContentUrl;
  50. return o && (s2 += "/" + ("string" == typeof o ? o : o.id)), this.portal._request(s2 + "/addItem", l3).then((t2) => (r.id = t2.id, r.portal = this.portal, r.loaded ? r.reload() : r.load()));
  51. }
  52. deleteItem(t) {
  53. let r = this.userContentUrl;
  54. return t.ownerFolder && (r += "/" + t.ownerFolder), this.portal._request(r + `/items/${t.id}/delete`, { method: "post" }).then(() => {
  55. t.id = null, t.portal = null;
  56. });
  57. }
  58. deleteItems(t) {
  59. const r = this.userContentUrl + "/deleteItems", e2 = t.map((t2) => t2.id);
  60. if (e2.length) {
  61. const o = { method: "post", query: { items: e2.join(",") } };
  62. return this.portal._request(r, o).then(() => {
  63. t.forEach((t2) => {
  64. t2.id = null, t2.portal = null;
  65. });
  66. });
  67. }
  68. return Promise.resolve(void 0);
  69. }
  70. fetchFolders() {
  71. var _a;
  72. const t = { query: { num: 1 } };
  73. return this.portal._request((_a = this.userContentUrl) != null ? _a : "", t).then((t2) => {
  74. let r;
  75. return r = t2 && t2.folders ? t2.folders.map((t3) => {
  76. const r2 = l2.fromJSON(t3);
  77. return r2.portal = this.portal, r2;
  78. }) : [], r;
  79. });
  80. }
  81. fetchGroups() {
  82. var _a;
  83. return this.portal._request((_a = this.url) != null ? _a : "").then((t) => {
  84. let r;
  85. return r = t && t.groups ? t.groups.map((t2) => {
  86. const r2 = p.fromJSON(t2);
  87. return r2.portal = this.portal, r2;
  88. }) : [], r;
  89. });
  90. }
  91. fetchItems(t) {
  92. var _a;
  93. const r = t != null ? t : {};
  94. let e2, o = (_a = this.userContentUrl) != null ? _a : "";
  95. return r.folder && (o += "/" + r.folder.id), import("./PortalItem-N6U3KORV.js").then(({ default: t2 }) => {
  96. e2 = t2;
  97. const l3 = { folders: false, num: r.num || 10, start: r.start || 1, sortField: r.sortField || "created", sortOrder: r.sortOrder || "asc" };
  98. return this.portal._request(o, { query: l3 });
  99. }).then((t2) => {
  100. let r2;
  101. return t2 && t2.items ? (r2 = t2.items.map((t3) => {
  102. const r3 = e2.fromJSON(t3);
  103. return r3.portal = this.portal, r3;
  104. }), Promise.all(r2.map((t3) => t3.load())).catch((t3) => t3).then(() => ({ items: r2, nextStart: t2.nextStart, total: t2.total }))) : { items: [], nextStart: -1, total: 0 };
  105. });
  106. }
  107. fetchTags() {
  108. return this.portal._request(this.url + "/tags").then((t) => t.tags);
  109. }
  110. getThumbnailUrl(t) {
  111. let r = this.thumbnailUrl;
  112. return r && t && (r += `&w=${t}`), r;
  113. }
  114. queryFavorites(t) {
  115. 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" }));
  116. }
  117. toJSON() {
  118. throw new s("internal:not-yet-implemented", "PortalGroup.toJSON is not yet implemented");
  119. }
  120. static fromJSON(t) {
  121. if (!t)
  122. return null;
  123. if (t.declaredClass)
  124. throw new Error("JSON object is already hydrated");
  125. const r = new i();
  126. return r.sourceJSON = t, r.read(t), r;
  127. }
  128. };
  129. e([y()], u.prototype, "access", void 0), e([y({ type: Date })], u.prototype, "created", void 0), e([y()], u.prototype, "culture", void 0), e([y()], u.prototype, "description", void 0), e([y()], u.prototype, "email", void 0), e([y()], u.prototype, "favGroupId", void 0), e([y()], u.prototype, "fullName", void 0), e([y({ type: Date })], u.prototype, "modified", void 0), e([y()], u.prototype, "orgId", void 0), e([y()], u.prototype, "portal", void 0), e([y()], u.prototype, "preferredView", void 0), e([y()], u.prototype, "privileges", void 0), e([y()], u.prototype, "region", void 0), e([y()], u.prototype, "role", void 0), e([y()], u.prototype, "roleId", void 0), e([y()], u.prototype, "sourceJSON", void 0), e([y()], u.prototype, "thumbnail", void 0), e([y({ readOnly: true })], u.prototype, "thumbnailUrl", null), e([y()], u.prototype, "units", void 0), e([y({ readOnly: true })], u.prototype, "userContentUrl", null), e([y({ readOnly: true })], u.prototype, "url", null), e([y()], u.prototype, "username", void 0), e([y()], u.prototype, "userType", void 0), u = i = e([n("esri.portal.PortalUser")], u);
  130. var p3 = u;
  131. export {
  132. p3 as p
  133. };
  134. //# sourceMappingURL=chunk-7IBV2TRE.js.map