@arcgis/portal-components 6.0.0-next.2 → 6.0.0-next.21

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.
Files changed (308) hide show
  1. package/dist/cdn/{MKSFNVXL.js → 22TDAUX4.js} +1 -1
  2. package/dist/cdn/234TH32X.js +106 -0
  3. package/dist/cdn/2D3FQXJ4.js +2 -0
  4. package/dist/cdn/{BKD7JSV2.js → 2DXO6FVX.js} +1 -1
  5. package/dist/cdn/{TWCJJCPC.js → 2XJX2JUO.js} +1 -1
  6. package/dist/cdn/{SGDDFWCJ.js → 3EQGUCO4.js} +1 -1
  7. package/dist/cdn/{OR6T5SB3.js → 3J3ISO3E.js} +1 -1
  8. package/dist/cdn/3RTST3I6.js +2 -0
  9. package/dist/cdn/3XH3JHOI.js +2 -0
  10. package/dist/cdn/4ONCJSSP.js +2 -0
  11. package/dist/cdn/4QYVBXZT.js +2 -0
  12. package/dist/cdn/{K75JTQPW.js → 4VLEUN7I.js} +1 -1
  13. package/dist/cdn/4WQA7UAJ.js +2 -0
  14. package/dist/cdn/5OWIWCEQ.js +2 -0
  15. package/dist/cdn/{7ZWYUHGK.js → 5R4JJWGB.js} +1 -1
  16. package/dist/cdn/63HYFDRU.js +2 -0
  17. package/dist/cdn/6MATPHXT.js +79 -0
  18. package/dist/cdn/7IP3RVPH.js +2 -0
  19. package/dist/cdn/7ISSDO2T.js +2 -0
  20. package/dist/cdn/AKTIIRJQ.js +2 -0
  21. package/dist/cdn/ASID6YW7.js +135 -0
  22. package/dist/cdn/B3HV5JVN.js +2 -0
  23. package/dist/cdn/B6666VUQ.js +2 -0
  24. package/dist/cdn/BOO7GG5L.js +2 -0
  25. package/dist/cdn/CZ4FC4GM.js +2 -0
  26. package/dist/cdn/D3LZFIHV.js +2 -0
  27. package/dist/cdn/{NWVLGU2C.js → D3Q72PPN.js} +1 -1
  28. package/dist/cdn/DABNV2OO.js +2 -0
  29. package/dist/cdn/DELNTRCT.js +2 -0
  30. package/dist/cdn/DOCNBKQZ.js +2 -0
  31. package/dist/cdn/EP7NWEC5.js +2 -0
  32. package/dist/cdn/EQRBP6H6.js +66 -0
  33. package/dist/cdn/{ABORO35R.js → ESKKH4DE.js} +1 -1
  34. package/dist/cdn/EUQQZIRW.js +2 -0
  35. package/dist/cdn/F2HT5PVQ.js +2 -0
  36. package/dist/cdn/FE3O23SE.js +2 -0
  37. package/dist/cdn/FGRMURKX.js +2 -0
  38. package/dist/cdn/FN2QMDEW.js +2 -0
  39. package/dist/cdn/{I6IRHXWR.js → FYVATGMR.js} +1 -1
  40. package/dist/cdn/{RHCRPJWS.js → G3WDR53S.js} +1 -1
  41. package/dist/cdn/GAU6DNV5.js +2 -0
  42. package/dist/cdn/GPAIXN52.js +2 -0
  43. package/dist/cdn/GRSBU4PD.js +2 -0
  44. package/dist/cdn/{JWBUJT43.js → H7FA5HFE.js} +1 -1
  45. package/dist/cdn/HHGKNVCH.js +4 -0
  46. package/dist/cdn/HJLWIQDI.js +2 -0
  47. package/dist/cdn/I3EWDYTU.js +2 -0
  48. package/dist/cdn/{24QSQLRY.js → IKPVMXXW.js} +1 -1
  49. package/dist/cdn/{5HZNBMW6.js → IOFXDIWC.js} +1 -1
  50. package/dist/cdn/IPHBVKMY.js +2 -0
  51. package/dist/cdn/{GAF4YT5N.js → IUIFCQQU.js} +1 -1
  52. package/dist/cdn/{ZKZDKJ6D.js → IVDZGUNZ.js} +1 -1
  53. package/dist/cdn/J6SI4Z4F.js +2 -0
  54. package/dist/cdn/K3GAZFRI.js +63 -0
  55. package/dist/cdn/K7LYYLUF.js +2 -0
  56. package/dist/cdn/{74T6IXSN.js → KDORI7H4.js} +1 -1
  57. package/dist/cdn/KRORL7QC.js +2 -0
  58. package/dist/cdn/LGJWULAW.js +2 -0
  59. package/dist/cdn/LTMPXQTC.js +2 -0
  60. package/dist/cdn/M5STJJRX.js +2 -0
  61. package/dist/cdn/M7J7RAM4.js +2 -0
  62. package/dist/cdn/{AXOBMX3S.js → MLTZSPZQ.js} +1 -1
  63. package/dist/cdn/MSSJRDR7.js +2 -0
  64. package/dist/cdn/{L64UURQB.js → N4ZRMYZL.js} +1 -1
  65. package/dist/cdn/NBCYYUHP.js +2 -0
  66. package/dist/cdn/NHVPNSNH.js +2 -0
  67. package/dist/cdn/NQ2IAQKL.js +41 -0
  68. package/dist/cdn/NXGTEDK4.js +2 -0
  69. package/dist/cdn/{7LMZHJZG.js → NYOXMT6S.js} +1 -1
  70. package/dist/cdn/O3JP4FQ3.js +2 -0
  71. package/dist/cdn/O4YFPGD5.js +2 -0
  72. package/dist/cdn/{JIJO4CAS.js → ODSA6NNS.js} +1 -1
  73. package/dist/cdn/OHAQPQAP.js +2 -0
  74. package/dist/cdn/OOXTSCQT.js +2 -0
  75. package/dist/cdn/OQ2JULON.js +2 -0
  76. package/dist/cdn/OVH4YLTS.js +2 -0
  77. package/dist/cdn/QB5BGHLA.js +2 -0
  78. package/dist/cdn/QKCRNS75.js +2 -0
  79. package/dist/cdn/{2YZWRFCI.js → RKMW4FUN.js} +1 -1
  80. package/dist/cdn/RT26JZP5.js +2 -0
  81. package/dist/cdn/SKHFISBA.js +2 -0
  82. package/dist/cdn/SKIDJ4QI.js +2 -0
  83. package/dist/cdn/SRWFOV5W.js +2 -0
  84. package/dist/cdn/{IN4JPZTY.js → SSCKCDXD.js} +1 -1
  85. package/dist/cdn/T66G7GIR.js +2 -0
  86. package/dist/cdn/{RQYNPDN3.js → TIMYD2HM.js} +1 -1
  87. package/dist/cdn/{ROX3GKKA.js → TIPQ2ZWK.js} +1 -1
  88. package/dist/cdn/TJWJ3LTU.js +2 -0
  89. package/dist/cdn/{DHMNNIXZ.js → TMR4BRFI.js} +1 -1
  90. package/dist/cdn/{JN23JH3T.js → TTQGRN2V.js} +1 -1
  91. package/dist/cdn/{MLYQGIJU.js → U2HTYOBB.js} +13 -13
  92. package/dist/cdn/{YZTBAUIO.js → UHOW7Q65.js} +1 -1
  93. package/dist/cdn/ULGME5RT.js +2 -0
  94. package/dist/cdn/{Z6R3C4AK.js → US3N5L73.js} +1 -1
  95. package/dist/cdn/W5POIPYP.js +2 -0
  96. package/dist/cdn/{TLM457Z5.js → WJWWYBZ7.js} +1 -1
  97. package/dist/cdn/WNEPEEPZ.js +2 -0
  98. package/dist/cdn/WPAZDJHU.js +2 -0
  99. package/dist/cdn/WT72SOAU.js +2 -0
  100. package/dist/cdn/XJGKRAN5.js +2 -0
  101. package/dist/cdn/{JPUUMGX5.js → XS5EOWBK.js} +1 -1
  102. package/dist/cdn/Y5VUMGKH.js +3 -0
  103. package/dist/cdn/{EQDYQOOT.js → YCIFVZ4J.js} +1 -1
  104. package/dist/cdn/{3NSHGKZA.js → YDXJHNDI.js} +1 -1
  105. package/dist/cdn/{32BWFMTC.js → YIOJIA4Y.js} +1 -1
  106. package/dist/cdn/{K2XSYDAP.js → YK6FCXWU.js} +1 -1
  107. package/dist/cdn/YPDHSE2J.js +2 -0
  108. package/dist/cdn/{M5PPX4ZX.js → YQLFXHFG.js} +1 -1
  109. package/dist/cdn/YSVPB3BO.js +2 -0
  110. package/dist/cdn/YUOVGTP5.js +2 -0
  111. package/dist/cdn/Z5CA4C6H.js +2 -0
  112. package/dist/cdn/{TXC7YBGL.js → ZD6XJVGV.js} +1 -1
  113. package/dist/cdn/ZHQXYCPA.js +2 -0
  114. package/dist/cdn/{DLI4XKJ3.js → ZOX4RLS4.js} +1 -1
  115. package/dist/cdn/assets/portal-ai-assistant/t9n/messages.en.json +1 -1
  116. package/dist/cdn/assets/portal-entity-picker/t9n/messages.en.json +1 -1
  117. package/dist/cdn/assets/portal-item-card-sublayer-select/t9n/messages.en.json +1 -0
  118. package/dist/cdn/assets/portal-item-share-summary/t9n/messages.en.json +1 -0
  119. package/dist/cdn/index.js +1 -1
  120. package/dist/cdn/main.css +1 -1
  121. package/dist/chunks/fieldAddDelete.js +7 -7
  122. package/dist/chunks/functionalities.js +14 -9
  123. package/dist/chunks/groups.js +8 -61
  124. package/dist/chunks/groups2.js +23 -8
  125. package/dist/chunks/info.js +2 -2
  126. package/dist/chunks/item.js +58 -26
  127. package/dist/chunks/item2.js +34 -30
  128. package/dist/chunks/itemThumbnail.js +21 -21
  129. package/dist/chunks/loadClassificationData.js +26 -27
  130. package/dist/chunks/portal-delete-items-review.js +1 -1
  131. package/dist/chunks/portal-item-badge.js +1 -1
  132. package/dist/chunks/portal-related-items-list-item.js +1 -1
  133. package/dist/chunks/portal.js +6 -6
  134. package/dist/chunks/portal2.js +11 -11
  135. package/dist/chunks/portalEntitySelection.js +54 -0
  136. package/dist/chunks/query.js +13 -13
  137. package/dist/chunks/request.js +49 -41
  138. package/dist/chunks/requests.js +7 -7
  139. package/dist/chunks/selectedMentions.js +25 -0
  140. package/dist/chunks/services.js +1 -1
  141. package/dist/chunks/string.js +14 -10
  142. package/dist/chunks/ui.js +1 -0
  143. package/dist/chunks/url.js +2 -2
  144. package/dist/chunks/user.js +10 -10
  145. package/dist/chunks/utils.js +35 -22
  146. package/dist/chunks/utils2.js +4 -4
  147. package/dist/chunks/utils3.js +88 -657
  148. package/dist/chunks/utils4.js +664 -0
  149. package/dist/components/arcgis-portal-account-switcher/customElement.js +28 -26
  150. package/dist/components/arcgis-portal-account-switcher-accounts/customElement.d.ts +4 -4
  151. package/dist/components/arcgis-portal-account-switcher-accounts/customElement.js +8 -8
  152. package/dist/components/arcgis-portal-account-switcher-list/customElement.d.ts +4 -4
  153. package/dist/components/arcgis-portal-account-switcher-list/customElement.js +6 -6
  154. package/dist/components/arcgis-portal-account-switcher-signout/customElement.d.ts +5 -5
  155. package/dist/components/arcgis-portal-account-switcher-signout/customElement.js +3 -3
  156. package/dist/components/arcgis-portal-add-gps-metadata/customElement.d.ts +6 -0
  157. package/dist/components/arcgis-portal-add-gps-metadata/customElement.js +153 -130
  158. package/dist/components/arcgis-portal-ai-assistant/customElement.d.ts +25 -15
  159. package/dist/components/arcgis-portal-ai-assistant/customElement.js +574 -2409
  160. package/dist/components/arcgis-portal-ai-assistant/index.js +4 -0
  161. package/dist/components/arcgis-portal-ai-assistant/tools/getItemTool.d.ts +11 -0
  162. package/dist/components/arcgis-portal-ai-assistant/types/assistantTools.d.ts +51 -0
  163. package/dist/components/arcgis-portal-ai-assistant/types/portalEntityTools.d.ts +14 -0
  164. package/dist/components/arcgis-portal-ai-assistant-interrupt/customElement.d.ts +39 -0
  165. package/dist/components/arcgis-portal-ai-assistant-interrupt/customElement.js +63 -27
  166. package/dist/components/arcgis-portal-ai-assistant-interrupt/index.js +3 -1
  167. package/dist/components/arcgis-portal-classification-banner/customElement.js +2 -2
  168. package/dist/components/arcgis-portal-classification-config/customElement.js +2 -2
  169. package/dist/components/arcgis-portal-classification-favorite/customElement.js +2 -2
  170. package/dist/components/arcgis-portal-classification-form-element/customElement.js +1 -1
  171. package/dist/components/arcgis-portal-delete-items/customElement.d.ts +69 -3
  172. package/dist/components/arcgis-portal-delete-items/customElement.js +446 -330
  173. package/dist/components/arcgis-portal-delete-items/index.js +1 -2
  174. package/dist/components/arcgis-portal-delete-items/types.d.ts +1 -0
  175. package/dist/components/arcgis-portal-entity-picker/customElement.d.ts +36 -0
  176. package/dist/components/arcgis-portal-entity-picker/customElement.js +202 -120
  177. package/dist/components/arcgis-portal-entity-picker/index.js +2 -0
  178. package/dist/components/arcgis-portal-field-delete/customElement.js +33 -31
  179. package/dist/components/arcgis-portal-field-delete/index.js +1 -1
  180. package/dist/components/arcgis-portal-group-badges/customElement.js +5 -5
  181. package/dist/components/arcgis-portal-group-browser/customElement.js +93 -99
  182. package/dist/components/arcgis-portal-group-browser/types.d.ts +3 -7
  183. package/dist/components/arcgis-portal-group-browser-preview/customElement.js +2 -2
  184. package/dist/components/arcgis-portal-group-browser-preview-card/customElement.js +1 -1
  185. package/dist/components/arcgis-portal-group-card/customElement.js +18 -18
  186. package/dist/components/arcgis-portal-group-thumbnail/customElement.js +1 -1
  187. package/dist/components/arcgis-portal-item-card/customElement.d.ts +26 -10
  188. package/dist/components/arcgis-portal-item-card/customElement.js +101 -91
  189. package/dist/components/arcgis-portal-item-card/index.js +2 -1
  190. package/dist/components/arcgis-portal-item-card-sublayer-select/customElement.d.ts +102 -0
  191. package/dist/components/arcgis-portal-item-card-sublayer-select/customElement.js +352 -0
  192. package/dist/components/arcgis-portal-item-card-sublayer-select/index.d.ts +1 -0
  193. package/dist/components/arcgis-portal-item-card-sublayer-select/index.js +8 -0
  194. package/dist/components/arcgis-portal-item-card-sublayer-select/types.d.ts +22 -0
  195. package/dist/components/arcgis-portal-item-share-summary/customElement.d.ts +113 -0
  196. package/dist/components/arcgis-portal-item-share-summary/customElement.js +172 -0
  197. package/dist/components/arcgis-portal-item-share-summary/index.d.ts +1 -0
  198. package/dist/components/arcgis-portal-item-share-summary/index.js +5 -0
  199. package/dist/components/arcgis-portal-item-share-summary-editable/customElement.d.ts +33 -0
  200. package/dist/components/arcgis-portal-item-share-summary-editable/customElement.js +19 -0
  201. package/dist/components/arcgis-portal-item-share-summary-editable/index.d.ts +1 -0
  202. package/dist/components/arcgis-portal-item-share-summary-editable/index.js +2 -0
  203. package/dist/components/arcgis-portal-item-thumbnail/customElement.d.ts +1 -0
  204. package/dist/components/arcgis-portal-item-thumbnail/customElement.js +14 -14
  205. package/dist/components/arcgis-portal-item-type/customElement.js +1 -1
  206. package/dist/components/arcgis-portal-mentionable-text-area/customElement.js +61 -57
  207. package/dist/components/arcgis-portal-navigation/customElement.js +7 -8
  208. package/dist/components/arcgis-portal-navigation/index.js +1 -1
  209. package/dist/components/arcgis-portal-replacement-item-redirect/customElement.js +8 -8
  210. package/dist/components/arcgis-portal-review-related-items/customElement.d.ts +333 -0
  211. package/dist/components/arcgis-portal-review-related-items/customElement.js +45 -18
  212. package/dist/components/arcgis-portal-review-related-items/index.js +2 -0
  213. package/dist/components/arcgis-portal-sublayer-type/customElement.js +13 -103
  214. package/dist/components/arcgis-portal-user-popup/customElement.js +28 -28
  215. package/dist/components/portal-group-browser-filters/customElement.js +15 -15
  216. package/dist/components/portal-related-items-list-item/customElement.js +16 -14
  217. package/dist/components/portal-related-items-list-item/index.js +1 -1
  218. package/dist/docs/api.json +1 -1
  219. package/dist/docs/docs.json +1 -1
  220. package/dist/docs/vscode.html-custom-data.json +1 -1
  221. package/dist/docs/web-types.json +1 -1
  222. package/dist/index.d.ts +30 -0
  223. package/dist/index.js +155 -6
  224. package/dist/loader.js +15 -12
  225. package/dist/services/groups.d.ts +9 -0
  226. package/dist/services/item.d.ts +9 -0
  227. package/dist/types/item.d.ts +9 -9
  228. package/dist/types/lumina.d.ts +36 -17
  229. package/dist/types/preact.d.ts +39 -17
  230. package/dist/types/react.d.ts +42 -17
  231. package/dist/types/services.d.ts +27 -1
  232. package/dist/types/stencil.d.ts +36 -17
  233. package/dist/utils/generateEmbeddings.d.ts +7 -0
  234. package/dist/utils/semanticSearch.d.ts +60 -0
  235. package/dist/utils/types.d.ts +10 -0
  236. package/package.json +10 -10
  237. package/dist/cdn/23FS4XTG.js +0 -2
  238. package/dist/cdn/2MPQ5IWJ.js +0 -2
  239. package/dist/cdn/3CQKCUM5.js +0 -2
  240. package/dist/cdn/3EYB5GQX.js +0 -2
  241. package/dist/cdn/3LEQ37YT.js +0 -68
  242. package/dist/cdn/46BUEBWS.js +0 -2
  243. package/dist/cdn/4AI52H7C.js +0 -2
  244. package/dist/cdn/4MUB6TL6.js +0 -2
  245. package/dist/cdn/4PRXQFCV.js +0 -2
  246. package/dist/cdn/4QFTKB6T.js +0 -2
  247. package/dist/cdn/4TSXFX3M.js +0 -2
  248. package/dist/cdn/5C5GHX4D.js +0 -2
  249. package/dist/cdn/5PPZNVWG.js +0 -2
  250. package/dist/cdn/66XWNGQ2.js +0 -2
  251. package/dist/cdn/6F4SJDRR.js +0 -2
  252. package/dist/cdn/6RZEXOK3.js +0 -2
  253. package/dist/cdn/A2SQ4EMZ.js +0 -2
  254. package/dist/cdn/AICPYLWE.js +0 -4
  255. package/dist/cdn/AJQT7UXB.js +0 -2
  256. package/dist/cdn/APSYZEPP.js +0 -209
  257. package/dist/cdn/AZOJHVAO.js +0 -2
  258. package/dist/cdn/BSTA5KI5.js +0 -2
  259. package/dist/cdn/CD5UWSCP.js +0 -2
  260. package/dist/cdn/CXXV6WJT.js +0 -2
  261. package/dist/cdn/DDBXEXOV.js +0 -2
  262. package/dist/cdn/DYO5P3F2.js +0 -2
  263. package/dist/cdn/E66BDC6N.js +0 -2
  264. package/dist/cdn/EEAVX4PP.js +0 -2
  265. package/dist/cdn/EITRZQSC.js +0 -2
  266. package/dist/cdn/EMJQI4MA.js +0 -2
  267. package/dist/cdn/FIBQAMJ3.js +0 -2
  268. package/dist/cdn/FIQZPIIK.js +0 -2
  269. package/dist/cdn/FNLBJ4ZQ.js +0 -2
  270. package/dist/cdn/FRE56NBG.js +0 -2
  271. package/dist/cdn/GSOBDGLK.js +0 -2
  272. package/dist/cdn/GUO7HKSP.js +0 -463
  273. package/dist/cdn/GX7U3727.js +0 -2
  274. package/dist/cdn/GXM3XY3J.js +0 -2
  275. package/dist/cdn/I273CANO.js +0 -2
  276. package/dist/cdn/I6NVKNZJ.js +0 -2
  277. package/dist/cdn/J5FKIZAM.js +0 -2
  278. package/dist/cdn/JL52W3Z4.js +0 -2
  279. package/dist/cdn/JOUR2FB2.js +0 -3
  280. package/dist/cdn/LISDTBEX.js +0 -2
  281. package/dist/cdn/LWFACY3F.js +0 -2
  282. package/dist/cdn/LYLQCBVX.js +0 -2
  283. package/dist/cdn/N4VOTJ25.js +0 -2
  284. package/dist/cdn/N5QLV56W.js +0 -2
  285. package/dist/cdn/NRMQDCM3.js +0 -2
  286. package/dist/cdn/OD5WXP7J.js +0 -2
  287. package/dist/cdn/OXPXXIWL.js +0 -2
  288. package/dist/cdn/PMRFXB4F.js +0 -2
  289. package/dist/cdn/PNIFJ5DQ.js +0 -2
  290. package/dist/cdn/PZDI5ZDC.js +0 -2
  291. package/dist/cdn/RVYSVTPQ.js +0 -2
  292. package/dist/cdn/SVROAT3Z.js +0 -2
  293. package/dist/cdn/TBZXKKGP.js +0 -2
  294. package/dist/cdn/TNUCSWBN.js +0 -2
  295. package/dist/cdn/TOICLGFK.js +0 -2
  296. package/dist/cdn/TOTWYGB3.js +0 -2
  297. package/dist/cdn/TUUUK3VX.js +0 -2
  298. package/dist/cdn/U3KMGSVH.js +0 -2
  299. package/dist/cdn/WC3FPLYQ.js +0 -2
  300. package/dist/cdn/XYMBRPC7.js +0 -2
  301. package/dist/cdn/YTODQCOG.js +0 -2
  302. package/dist/cdn/YYTEJVBL.js +0 -2
  303. package/dist/cdn/ZDDN7UKS.js +0 -2
  304. package/dist/chunks/functional.js +0 -9
  305. package/dist/components/arcgis-portal-ai-assistant/data/capability-registries/types.d.ts +0 -45
  306. /package/dist/cdn/{OUMTV5H5.js → KHKREBVZ.js} +0 -0
  307. /package/dist/components/arcgis-portal-ai-assistant/{agents/types.d.ts → types/navigation.d.ts} +0 -0
  308. /package/dist/components/arcgis-portal-ai-assistant/{agents → types}/portalRouteKeys.d.ts +0 -0
@@ -0,0 +1,352 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import { c as A } from "../../chunks/runtime.js";
3
+ import { formatNumber as L } from "@arcgis/core/intl.js";
4
+ import { LitElement as x, createEvent as y, nothing as q } from "@arcgis/lumina";
5
+ import { css as N, html as u } from "lit";
6
+ import { createRef as R, ref as G } from "lit/directives/ref.js";
7
+ import { u as U } from "../../chunks/useT9n.js";
8
+ import { j as g } from "../../chunks/item2.js";
9
+ import { b, g as O } from "../../chunks/items.js";
10
+ import { g as P } from "../../chunks/utils3.js";
11
+ import { r as k, i as j, c as B, f as D } from "../../chunks/request.js";
12
+ import { isAbortError as M } from "@arcgis/core/core/promiseUtils.js";
13
+ import { log as J } from "@arcgis/toolkit/log";
14
+ import { g as T, b as F } from "../../chunks/portal.js";
15
+ const z = N`:host,.dropdown{display:block}.title{max-inline-size:32rem;overflow-wrap:anywhere}.dropdown-group{max-block-size:10rem;overflow:auto}calcite-alert{--calcite-z-index-toast: 999;z-index:999}`;
16
+ function p(e, s, t) {
17
+ if (e.id === void 0)
18
+ throw new Error("The service layer has no ID.");
19
+ return {
20
+ description: e.description,
21
+ fieldAliases: e.fields?.map((i) => i.alias ?? ""),
22
+ fields: e.fields,
23
+ geometryType: t ? "table" : e.geometryType,
24
+ id: e.id,
25
+ title: e.name || e.title || "",
26
+ type: e.type,
27
+ matched: s?.find((i) => i.id === e.id)?.matched,
28
+ sourceJSON: e
29
+ };
30
+ }
31
+ async function S(e, s, t, i, r) {
32
+ const a = s.portalMode === "multitenant", l = new URL(T(s)).hostname, o = e.includes(".arcgis.com/"), n = ["//services", "//tiles", "//features", "//locationservices"].some(
33
+ (h) => e.includes(h)
34
+ ), d = s.supportsHostedServices && e.includes(l) && a;
35
+ return await k({
36
+ url: e,
37
+ portal: s,
38
+ method: "post",
39
+ options: {
40
+ useProxy: !1,
41
+ timeout: a ? 5e3 : 6e4,
42
+ addSSL: o && n || !o && d,
43
+ ...t ? {} : { addTokenManually: !1 },
44
+ disableIdentityLookup: !1,
45
+ signal: r
46
+ }
47
+ });
48
+ }
49
+ function $(e) {
50
+ if (typeof e != "object" || e === null)
51
+ return;
52
+ if ("code" in e && typeof e.code == "number")
53
+ return e.code;
54
+ const s = "details" in e ? e.details : void 0, t = typeof s == "object" && s !== null && "raw" in s ? s.raw : void 0;
55
+ return typeof t == "object" && t !== null && "code" in t && typeof t.code == "number" ? t.code : void 0;
56
+ }
57
+ function C(e) {
58
+ return typeof e == "object" && e !== null && "message" in e && typeof e.message == "string" ? e.message : void 0;
59
+ }
60
+ function H(e) {
61
+ return [404, 500].includes($(e) ?? 0) || C(e) === "Invalid URL";
62
+ }
63
+ function _(e, s, t) {
64
+ const i = $(s), r = C(s);
65
+ return !e && (i === 499 && (r === "Token Required" || r === "Token required.") || i === 403 || i === 498 && r === "Invalid Token") && !!t.user;
66
+ }
67
+ function w(e, s, t, i) {
68
+ const r = t?.tables, a = !!t?.layers?.length || !!r, l = [...t?.layers ?? [], ...t?.tables ?? []].map((o) => o.id);
69
+ return (e ?? []).filter(({ id: o, type: n }) => !a || n === "Table" && !r || l.includes(o)).map((o) => p(o, s, i));
70
+ }
71
+ async function K({
72
+ serviceInfo: e,
73
+ item: s,
74
+ portal: t,
75
+ layers: i,
76
+ isSecure: r,
77
+ allowLoginWindow: a,
78
+ data: l,
79
+ signal: o
80
+ }) {
81
+ if (!e.layers?.length && !e.tables?.length && e.fields)
82
+ return { result: { sublayers: [p(e, i)], serviceInfo: e } };
83
+ try {
84
+ const n = await S(
85
+ `${s.url}/layers`,
86
+ t,
87
+ r,
88
+ a,
89
+ o
90
+ );
91
+ return {
92
+ result: {
93
+ sublayers: [
94
+ ...w(n.layers, i, l),
95
+ ...w(n.tables, i, l, !0)
96
+ ].sort((d, c) => d.id - c.id),
97
+ serviceInfo: e
98
+ }
99
+ };
100
+ } catch {
101
+ return { error: { code: "unhandledError" } };
102
+ }
103
+ }
104
+ async function W(e, s, t) {
105
+ try {
106
+ const i = new URL(`${T(s)}content/items/${e.id}/data`);
107
+ i.searchParams.set("f", "json");
108
+ const r = F(s);
109
+ r && i.searchParams.set("token", r);
110
+ const l = await (await fetch(i, { signal: t })).text();
111
+ return l ? JSON.parse(l) : void 0;
112
+ } catch (i) {
113
+ if (t?.aborted || M(i))
114
+ throw i;
115
+ J("warn", "portal.services.layers", "Unable to read optional item data; loading the service directly.", {
116
+ detail: { error: i }
117
+ });
118
+ return;
119
+ }
120
+ }
121
+ async function I({
122
+ item: e,
123
+ portal: s,
124
+ layers: t,
125
+ isSecure: i = !1,
126
+ data: r,
127
+ allowLoginWindow: a,
128
+ retry: l,
129
+ signal: o
130
+ }) {
131
+ try {
132
+ const n = r ?? (l ? void 0 : await W(e, s, o));
133
+ if (n?.error?.code === 403 && n.error.messageCode === "SB_0006")
134
+ return { error: { code: "serviceNotExist" } };
135
+ if (e.type === "Feature Collection" && n?.layers)
136
+ return {
137
+ result: {
138
+ sublayers: n.layers.map(({ layerDefinition: d }, c) => {
139
+ if (!d)
140
+ throw new Error("A feature collection layer has no layer definition.");
141
+ return {
142
+ ...p({ ...d, id: c }),
143
+ description: "",
144
+ matched: !1,
145
+ sourceJSON: void 0
146
+ };
147
+ })
148
+ }
149
+ };
150
+ try {
151
+ if (!e.url)
152
+ throw new Error("Invalid URL");
153
+ const d = await S(e.url, s, i, a, o), c = await K({
154
+ serviceInfo: d,
155
+ item: e,
156
+ portal: s,
157
+ layers: t,
158
+ isSecure: i,
159
+ allowLoginWindow: a,
160
+ data: n,
161
+ signal: o
162
+ });
163
+ return b(e).includes("SubtypeGroupLayer") && c.result && n?.layers?.length && (c.result.sublayers = c.result.sublayers.flatMap((h) => {
164
+ const m = n?.layers?.find(({ id: f }) => f === h.id);
165
+ return m?.layerType === "SubtypeGroupLayer" && m.layers?.length ? [
166
+ h,
167
+ ...m.layers.map((f) => ({
168
+ ...p(f),
169
+ // use the parent layer as the geometry type
170
+ geometryType: h.geometryType
171
+ }))
172
+ ] : [h];
173
+ })), c;
174
+ } catch (d) {
175
+ return !o?.aborted && _(i, d, s) ? await I({ item: e, portal: s, layers: t, data: n, isSecure: !0, allowLoginWindow: a, signal: o }) : { error: { code: H(d) ? "serviceNotExist" : "unhandledError" } };
176
+ }
177
+ } catch {
178
+ return { error: { code: "unhandledError" } };
179
+ }
180
+ }
181
+ const Q = {
182
+ esriGeometryPoint: "point",
183
+ esriGeometryPolyline: "polyline",
184
+ esriGeometryPolygon: "polygon",
185
+ esriGeometryMultipoint: "multipoint"
186
+ };
187
+ function E(e) {
188
+ return {
189
+ id: e.id,
190
+ title: e.title,
191
+ description: e.description ?? "",
192
+ fieldAliases: Array.isArray(e.fieldAliases) ? e.fieldAliases.join(",") : e.fieldAliases ?? "",
193
+ geometryType: !e.geometryType || e.geometryType === "table" ? "nonspatial" : Q[e.geometryType] ?? "nonspatial",
194
+ sourceJSON: e.sourceJSON
195
+ };
196
+ }
197
+ function v(e) {
198
+ let s;
199
+ const t = typeof e == "object" && e !== null && "details" in e ? e.details : void 0, i = typeof t == "object" && t !== null && "raw" in t ? t.raw : void 0;
200
+ for (const r of [e, t, i])
201
+ typeof r != "object" || r === null || "messageCode" in r && typeof r.messageCode == "string" && (s = r.messageCode);
202
+ return { error: { code: s === "OAUTH_0070" ? "notebookAccessBlocked" : "serviceUnavailable" } };
203
+ }
204
+ function V(e) {
205
+ return g(e) || !e.id ? void 0 : j("serviceInfo", e.id)?.result?.sublayers.map(E);
206
+ }
207
+ function X(e) {
208
+ e.id && B("serviceInfo", e.id);
209
+ }
210
+ async function Y({
211
+ item: e,
212
+ portal: s,
213
+ signal: t
214
+ }) {
215
+ try {
216
+ if (t.throwIfAborted(), g(e)) {
217
+ if (!e.url)
218
+ throw new Error("The geoprocessing item has no service URL.");
219
+ const r = await k({
220
+ url: e.url,
221
+ portal: s,
222
+ options: { signal: t, addTokenManually: !1 }
223
+ }), a = r.tasks ?? (r.parameters ? [e.url.split("/GPServer/").pop() ?? ""] : void 0);
224
+ if (!a)
225
+ throw new Error("The geoprocessing service did not return tasks.");
226
+ return { result: { tasks: a } };
227
+ }
228
+ if (!e.id)
229
+ throw new Error("The item has no ID.");
230
+ const i = await D({
231
+ requester: async () => await I({ item: e, portal: s, isSecure: !1, allowLoginWindow: !0 }),
232
+ key: "serviceInfo",
233
+ id: e.id
234
+ });
235
+ return t.throwIfAborted(), i.result ? { result: { sublayers: i.result.sublayers.map(E) } } : v(i.error);
236
+ } catch (i) {
237
+ return v(i);
238
+ }
239
+ }
240
+ class Z extends x {
241
+ constructor() {
242
+ super(...arguments), this.messages = U({ blocking: !0 }), this.dropdown = R(), this.selectedEntries = [], this.loading = !1, this.fetched = !1, this.selectedItems = [], this.allowedGeometries = [], this.width = "auto", this.appearance = "outline", this.selection = "single", this.disabled = !1, this.arcgisItemCardSelect = y(), this.arcgisItemCardSelectError = y();
243
+ }
244
+ static {
245
+ this.properties = { sublayers: 16, tasks: 16, loading: 16, fetched: 16, error: 16, item: 0, portal: 0, selectedItems: 0, allowedGeometries: 0, width: 1, appearance: 1, selection: 1, disabled: 7, messageOverrides: 0 };
246
+ }
247
+ static {
248
+ this.styles = z;
249
+ }
250
+ get isTask() {
251
+ return g(this.item);
252
+ }
253
+ get sortedSublayers() {
254
+ return [...this.sublayers ?? []].sort((s, t) => Number(this.isAllowed(t)) - Number(this.isAllowed(s)) || t.id - s.id);
255
+ }
256
+ get selectText() {
257
+ const s = this.selectedEntries, { messages: t } = this;
258
+ if (this.isTask) {
259
+ const r = s[0];
260
+ return s.length === 1 && r && "task" in r ? t.selectedTask.replace("${task}", r.task) : t.selectTask;
261
+ }
262
+ if (!s.length && !this.sublayers?.length)
263
+ return this.isSelected() ? t.selectedSingle : t.select;
264
+ if (!s.length)
265
+ return this.selection === "multiple" ? t.selectLayers : t.select;
266
+ if (this.selection === "multiple")
267
+ return t.selectedLayers.replace("${num}", L(s.length));
268
+ const i = s[0];
269
+ return i && "sublayer" in i ? t.selectedName.replace("${name}", i.sublayer.title) : t.select;
270
+ }
271
+ willUpdate(s) {
272
+ if (s.has("disabled") && this.disabled && (this.requestController?.abort(), this.loading = !1, this.dropdown.value && (this.dropdown.value.open = !1)), (s.has("item") || s.has("selectedItems")) && (this.selectedEntries = this.selectedItems.filter((t) => "item" in t && t.item.id === this.item?.id)), (s.has("item") || s.has("portal")) && (this.requestController?.abort(), this.sublayers = this.item ? O(this.item).sublayers : void 0, this.tasks = void 0, this.loading = !1, this.fetched = !1, this.error = void 0, this.item && !this.sublayers)) {
273
+ const t = V(this.item);
274
+ t && (this.sublayers = t, this.fetched = !0);
275
+ }
276
+ }
277
+ disconnectedCallback() {
278
+ super.disconnectedCallback(), this.requestController?.abort(), this.loading = !1;
279
+ }
280
+ isSelected(s, t) {
281
+ return this.selectedItems.some((i) => "item" in i ? i.item.id === this.item.id && (s ? "sublayer" in i && i.sublayer.id === s.id : t !== void 0 && "task" in i && i.task === t) : !s && t === void 0 && i.id === this.item.id);
282
+ }
283
+ isAllowed(s) {
284
+ return !this.allowedGeometries.length || this.allowedGeometries.includes(s.geometryType);
285
+ }
286
+ select(s, t, i = this.selection === "single" || !this.isSelected(s, t)) {
287
+ this.disabled || (this.arcgisItemCardSelect.emit({
288
+ item: this.item,
289
+ ...s ? { sublayer: s } : {},
290
+ ...t !== void 0 ? { task: t } : {},
291
+ selected: i
292
+ }), this.requestUpdate(), this.reconcileSelection());
293
+ }
294
+ async reconcileSelection() {
295
+ await this.updateComplete;
296
+ const s = this.sortedSublayers;
297
+ this.dropdown.value?.querySelectorAll("calcite-dropdown-item").forEach((t, i) => {
298
+ t.selected = this.isTask ? this.isSelected(void 0, this.tasks?.[i]) : this.isSelected(s[i]);
299
+ });
300
+ }
301
+ async handleTrigger(s = !1) {
302
+ if (this.loading || this.disabled)
303
+ return;
304
+ this.requestController?.abort();
305
+ const t = new AbortController();
306
+ this.requestController = t;
307
+ const { item: i, portal: r } = this, a = () => !t.signal.aborted && this.item === i && this.portal === r && this.el.isConnected, l = s || !this.fetched && (this.isTask || !this.sublayers && this.item.type !== "Image Service" || b(this.item).includes("SubtypeGroupLayer"));
308
+ if (l) {
309
+ s && (X(i), this.fetched = !1), this.loading = !0, this.error = void 0;
310
+ const n = await Y({ item: i, portal: r, signal: t.signal });
311
+ if (!a())
312
+ return;
313
+ if (this.loading = !1, n.error || !n.result) {
314
+ this.error = n.error ?? { code: "serviceUnavailable" }, this.arcgisItemCardSelectError.emit({ item: i, error: this.error });
315
+ return;
316
+ }
317
+ if (this.sublayers = n.result.sublayers, this.tasks = n.result.tasks, this.fetched = !0, await this.updateComplete, !a())
318
+ return;
319
+ }
320
+ if (l && this.isTask && this.tasks?.length === 1) {
321
+ this.dropdown.value && (this.dropdown.value.open = !1), this.select(void 0, this.tasks[0], !0);
322
+ return;
323
+ }
324
+ if (!this.isTask && !this.sublayers?.length) {
325
+ s || this.select(void 0, void 0, !this.isSelected());
326
+ return;
327
+ }
328
+ const o = this.dropdown.value;
329
+ o && (await o.componentOnReady(), a() && (o.open = l || !o.open));
330
+ }
331
+ renderButton(s) {
332
+ return u`<calcite-button slot=${(s ? "trigger" : void 0) ?? q} class="dropdown" .loading=${this.loading} .disabled=${this.loading || this.disabled} .appearance=${this.selectedEntries.length || this.isSelected() ? "solid" : this.appearance} kind=neutral .iconEnd=${s ? "chevron-down" : void 0} .width=${this.width} @click=${(t) => {
333
+ t.stopPropagation(), this.handleTrigger();
334
+ }}>${this.selectText}</calcite-button>`;
335
+ }
336
+ render() {
337
+ if (!this.item || !this.portal || !this.messages._lang)
338
+ return null;
339
+ const s = this.sortedSublayers;
340
+ return u`${s.length || this.isTask ? u`<calcite-dropdown class="dropdown" width=l .placement=${this.appearance === "solid" ? "top" : "bottom-end"} .closeOnSelectDisabled=${!this.isTask && this.selection === "multiple"} overlay-positioning=fixed ${G(this.dropdown)}>${this.renderButton(!0)}<calcite-dropdown-group class="dropdown-group" .selectionMode=${this.selection} .groupTitle=${this.isTask && this.tasks?.length ? this.messages.selectTaskFrom.replace("${title}", this.item.title ?? "") : void 0}>${this.isTask ? this.tasks?.map((t) => u`<calcite-dropdown-item .disabled=${this.disabled} .selected=${this.isSelected(void 0, t)} @calciteDropdownItemSelect=${() => this.select(void 0, t)}><span class="title">${t}</span></calcite-dropdown-item>`) : s.map((t) => u`<calcite-dropdown-item .id=${`sublayer-${t.id}`} .iconStart=${P({ geometry: t.geometryType }).icon} .disabled=${this.disabled || !this.isAllowed(t)} .selected=${this.isSelected(t)} @calciteDropdownItemSelect=${() => {
341
+ this.isAllowed(t) && this.select(t);
342
+ }}><span class="title">${t.title}</span></calcite-dropdown-item>${!this.isAllowed(t) && u`<calcite-tooltip .referenceElement=${`sublayer-${t.id}`} overlay-positioning=fixed>${this.messages.geometryNotAllowed}</calcite-tooltip>` || ""}`)}</calcite-dropdown-group></calcite-dropdown>` : this.renderButton(!1)}<calcite-alert .label=${this.messages.errorTitle} icon kind=danger .open=${!!this.error} @calciteAlertClose=${() => {
343
+ this.error = void 0;
344
+ }}><div slot=title>${this.messages.errorTitle}</div><div slot=message>${this.error?.code === "notebookAccessBlocked" ? this.messages.notebookErrorBody : this.messages.errorBody}</div><calcite-link slot=link @click=${(t) => {
345
+ t.stopPropagation(), this.handleTrigger(!0);
346
+ }}>${this.messages.retry}</calcite-link></calcite-alert>`;
347
+ }
348
+ }
349
+ A("arcgis-portal-item-card-sublayer-select", Z);
350
+ export {
351
+ Z as ArcgisPortalItemCardSublayerSelect
352
+ };
@@ -0,0 +1 @@
1
+ export * from "./customElement.js";
@@ -0,0 +1,8 @@
1
+ import "@esri/calcite-components/components/calcite-button";
2
+ import "@esri/calcite-components/components/calcite-dropdown";
3
+ import "@esri/calcite-components/components/calcite-dropdown-group";
4
+ import "@esri/calcite-components/components/calcite-dropdown-item";
5
+ import "@esri/calcite-components/components/calcite-tooltip";
6
+ import "@esri/calcite-components/components/calcite-alert";
7
+ import "@esri/calcite-components/components/calcite-link";
8
+ export * from "./customElement.js";
@@ -0,0 +1,22 @@
1
+ import type PortalItem from "@arcgis/core/portal/PortalItem.js";
2
+ import type { SearchResultSublayer } from "../../types/item.js";
3
+
4
+ export type PortalItemCardSelectedItem = PortalItem | {
5
+ item: PortalItem;
6
+ sublayer: SearchResultSublayer;
7
+ } | {
8
+ item: PortalItem;
9
+ task: string;
10
+ };
11
+
12
+ export interface PortalItemCardSublayerSelectDetail {
13
+ item: PortalItem;
14
+ sublayer?: SearchResultSublayer;
15
+ task?: string;
16
+ selected: boolean;
17
+ }
18
+
19
+ export interface PortalItemCardSelectErrorDetail {
20
+ item: PortalItem;
21
+ error: unknown;
22
+ }
@@ -0,0 +1,113 @@
1
+ /// <reference path="../../index.d.ts" />
2
+ import type Portal from "@arcgis/core/portal/Portal.js";
3
+ import type PortalItem from "@arcgis/core/portal/PortalItem.js";
4
+ import type { PublicLitElement as LitElement } from "@arcgis/lumina";
5
+ import type { PortalGroupSourceJSON } from "../../types/group.js";
6
+ import type { T9nMeta } from "@arcgis/lumina/controllers";
7
+ import type { Icon as Icon } from "@esri/calcite-components/components/calcite-icon";
8
+ import type { Tooltip as Tooltip } from "@esri/calcite-components/components/calcite-tooltip";
9
+
10
+ /**
11
+ * Read-only sharing summary, also reusable as the UI of a sharing workflow.
12
+ *
13
+ * @slot [tooltip-header-end] - Content at the end of the sharing tooltip header.
14
+ */
15
+ export abstract class ArcgisPortalItemShareSummary extends LitElement {
16
+ /**
17
+ * Automatically fetches omitted groups, including when the item or portal changes.
18
+ *
19
+ * @default false
20
+ */
21
+ accessor autoFetchGroups: boolean;
22
+ /** List of current user's groups the item is shared to. */
23
+ accessor groups: string[] | undefined;
24
+ /** Item whose sharing status you'd like to show, can be a search result or a PortalItem instance. */
25
+ accessor item: PortalItem;
26
+ /** Overrides the component's localized messages. */
27
+ accessor messageOverrides: {
28
+ sharing?: string | undefined;
29
+ private?: string | undefined;
30
+ shared?: string | undefined;
31
+ org?: string | undefined;
32
+ public?: string | undefined;
33
+ privateGroups?: string | undefined;
34
+ sharedGroups?: string | undefined;
35
+ orgGroups?: string | undefined;
36
+ publicGroups?: string | undefined;
37
+ groups?: string | undefined;
38
+ updateSharing?: string | undefined;
39
+ viewableBy?: string | undefined;
40
+ everyone?: string | undefined;
41
+ organization?: string | undefined;
42
+ groupMembers?: string | undefined;
43
+ };
44
+ /** @internal */
45
+ protected messages: {
46
+ sharing: string;
47
+ private: string;
48
+ shared: string;
49
+ org: string;
50
+ public: string;
51
+ privateGroups: string;
52
+ sharedGroups: string;
53
+ orgGroups: string;
54
+ publicGroups: string;
55
+ groups: string;
56
+ updateSharing: string;
57
+ viewableBy: string;
58
+ everyone: string;
59
+ organization: string;
60
+ groupMembers: string;
61
+ } & T9nMeta<{
62
+ sharing: string;
63
+ private: string;
64
+ shared: string;
65
+ org: string;
66
+ public: string;
67
+ privateGroups: string;
68
+ sharedGroups: string;
69
+ orgGroups: string;
70
+ publicGroups: string;
71
+ groups: string;
72
+ updateSharing: string;
73
+ viewableBy: string;
74
+ everyone: string;
75
+ organization: string;
76
+ groupMembers: string;
77
+ }>;
78
+ /**
79
+ * Positioning of the tooltip overlay.
80
+ *
81
+ * @default "absolute"
82
+ */
83
+ accessor overlayPositioning: Tooltip["overlayPositioning"];
84
+ /** Portal used for sharing and group requests. */
85
+ accessor portal: Portal;
86
+ /**
87
+ * Scale of the component.
88
+ *
89
+ * @default "m"
90
+ */
91
+ accessor scale: Icon["scale"];
92
+ /**
93
+ * Force display of hoverText (even if showText is true).
94
+ *
95
+ * @default false
96
+ */
97
+ accessor showHoverText: boolean | undefined;
98
+ /**
99
+ * Show text, if false will show icon plus tooltip.
100
+ *
101
+ * @default true
102
+ */
103
+ accessor showText: boolean;
104
+ /** List of all the user's groups. */
105
+ accessor userGroups: Pick<PortalGroupSourceJSON, "id">[] | undefined;
106
+ /**
107
+ * Refreshes sharing groups after pending property updates, excluding favorites from the sharing count.
108
+ * Does not reload the item's access level; the host must supply the updated item after sharing changes.
109
+ */
110
+ fetchGroups(): Promise<void>;
111
+ /** Focuses the summary button after pending property updates. */
112
+ setFocus(): Promise<void>;
113
+ }
@@ -0,0 +1,172 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import { c as f } from "../../chunks/runtime.js";
3
+ import { LitElement as v, createEvent as b, nothing as y } from "@arcgis/lumina";
4
+ import { css as x, html as c } from "lit";
5
+ import { createRef as g, ref as m } from "lit/directives/ref.js";
6
+ import { u as w } from "../../chunks/useT9n.js";
7
+ import { g as d } from "../../chunks/portal.js";
8
+ import { f as $, c as G } from "../../chunks/item.js";
9
+ import { r as h } from "../../chunks/request.js";
10
+ async function z(i, t, r = {}) {
11
+ try {
12
+ const e = await h({
13
+ url: `${d(i)}content/items/${t}/groups`,
14
+ portal: i,
15
+ options: r
16
+ });
17
+ return { result: [...e.admin, ...e.member, ...e.other] };
18
+ } catch (e) {
19
+ return r.signal?.aborted || console.error("Unable to fetch item sharing groups", e), { error: { code: "unhandledError" } };
20
+ }
21
+ }
22
+ async function S(i, t, r, e = {}) {
23
+ if (!r.length)
24
+ return { result: [] };
25
+ try {
26
+ const s = d(i), o = await h({
27
+ url: `${s}content/items/${t.id}`,
28
+ portal: i,
29
+ options: e
30
+ });
31
+ if (o.itemControl !== "admin" && o.itemControl !== "update") {
32
+ const a = await $(i, { groups: r }, [t], e);
33
+ return a.error ? { error: a.error } : { result: a.result?.[t.id] ?? [] };
34
+ }
35
+ const n = t.ownerFolder ? `${t.ownerFolder}/` : "", l = await h({
36
+ url: `${s}content/users/${t.owner}/${n}items/${t.id}`,
37
+ portal: i,
38
+ options: e
39
+ }), p = new Set(r.map(({ id: a }) => a));
40
+ return { result: l.sharing.groups.filter((a) => p.has(a)) };
41
+ } catch (s) {
42
+ return e.signal?.aborted || console.error("Unable to resolve item sharing group IDs", s), { error: { code: "unhandledError" } };
43
+ }
44
+ }
45
+ async function D(i, t, r = {}) {
46
+ try {
47
+ return { result: (await Promise.all(
48
+ G([...new Set(t)], 100).map(async (s) => (await h({
49
+ url: `${d(i)}community/groups`,
50
+ portal: i,
51
+ params: { q: `id:(${s.join(" OR ")})`, num: 100 },
52
+ options: r
53
+ })).results)
54
+ )).flat().sort((s, o) => s.title.localeCompare(o.title)) };
55
+ } catch (e) {
56
+ return r.signal?.aborted || console.error("Unable to fetch sharing group details", e), { error: { code: "unhandledError" } };
57
+ }
58
+ }
59
+ const O = x`:host{display:inline-flex;align-items:center;justify-content:center;min-inline-size:var(--arcgis-portal-item-share-summary-spacing, 1rem);--text-size: var(--arcgis-portal-item-share-summary-text-size, .875rem);--spacing: var(--arcgis-portal-item-share-summary-spacing, 1rem);--padding: var(--arcgis-portal-item-share-summary-padding, 7px)}:host([scale="s"]){--text-size: var(--arcgis-portal-item-share-summary-text-size, .75rem);--padding: var(--arcgis-portal-item-share-summary-padding, 3px)}:host([scale="l"]){--text-size: var(--arcgis-portal-item-share-summary-text-size, 1rem);--padding: var(--arcgis-portal-item-share-summary-padding, 9px)}:host([scale="s"][show-text]){--padding: var(--arcgis-portal-item-share-summary-padding, 3px 8px)}:host([scale="m"][show-text]){--padding: var(--arcgis-portal-item-share-summary-padding, 7px 12px)}:host([scale="l"][show-text]){--padding: var(--arcgis-portal-item-share-summary-padding, 9px 16px)}.wrapper{display:flex;align-items:center;padding:var(--padding);border:1px solid var(--arcgis-portal-item-share-summary-border-color, var(--calcite-color-border-1));border-radius:calc(var(--spacing) + .5rem);background:var(--arcgis-portal-item-share-summary-background-color, var(--calcite-color-foreground-1));color:var(--calcite-color-text-1);font:inherit;font-size:var(--text-size);line-height:1;cursor:pointer}.wrapper:hover{background:var(--calcite-color-foreground-2)}.wrapper:focus-visible{outline:2px solid var(--calcite-color-focus);outline-offset:2px}.icon{display:block;flex:0 0 auto;inline-size:var(--spacing);block-size:var(--spacing)}.text{margin-inline-start:calc(var(--spacing) / 4);font-weight:400}calcite-tooltip{--calcite-tooltip-z-index: calc(var(--calcite-z-index-overlay) + 1)}.tooltip{inline-size:18rem;padding-block-start:.25rem;margin:-1rem}.section-header{display:flex;align-items:center;justify-content:space-between;margin:0;padding:.75rem;background:var(--calcite-color-background);color:var(--calcite-color-text-2);font-size:.875rem;font-weight:700}.section-header h4{margin:0;font:inherit}.section{box-sizing:border-box;max-block-size:10rem;overflow:auto;margin:0;padding:.75rem;background:var(--calcite-color-foreground-1)}.status{color:var(--calcite-color-text-1);font-size:.875rem}.groups{list-style:none}.group{display:flex;align-items:center;padding-block:.25rem}.avatar{flex-shrink:0}.group-text{flex:1;min-inline-size:0;margin-inline-start:.75rem}.group-text h5,.group-text p{margin:0;padding:0;line-height:1.35}.group-text h5{overflow-wrap:anywhere;color:var(--calcite-color-text-1);font-size:.875rem;font-weight:500}.group-text p{color:var(--calcite-color-text-3);font-size:.75rem}calcite-loader{--calcite-loader-padding: 2rem}`, R = {
60
+ private: "user",
61
+ shared: "user",
62
+ org: "organization",
63
+ public: "globe"
64
+ };
65
+ function k(i, t, r, e, s) {
66
+ const o = i === "shared" && !t?.length && r ? "private" : i, n = new Intl.NumberFormat(s).format(t?.length ?? 0);
67
+ return {
68
+ icon: R[o],
69
+ access: t?.length && o === "shared" ? e.private : e[o],
70
+ groups: t?.length ? e.groups.replace("${num}", n) : (
71
+ // here, no groups or groups weren't configured correctly
72
+ o === "shared" ? e.shared : ""
73
+ ),
74
+ tooltip: t?.length ? e[`${o}Groups`].replace("${num}", n) : e[o],
75
+ tooltipNoCount: t?.length ? e[`${o}Groups`].replace("(${num})", "").trim() : e[o]
76
+ };
77
+ }
78
+ class I extends v {
79
+ constructor() {
80
+ super(...arguments), this.messages = w({ blocking: !0, name: "portal-item-share-summary" }), this.buttonRef = g(), this.tooltipRef = g(), this.tooltipOpen = !1, this.loadingDetails = !1, this.showText = !0, this.scale = "m", this.overlayPositioning = "absolute", this.autoFetchGroups = !1, this.arcgisInternalShareSummaryActivate = b({ bubbles: !1, composed: !1 });
81
+ }
82
+ static {
83
+ this.properties = { groupData: 16, loadingDetails: 16, favoriteOnlySource: 16, item: 0, portal: 0, groups: 0, userGroups: 0, showText: 7, showHoverText: 5, scale: 3, overlayPositioning: 1, autoFetchGroups: 5, messageOverrides: 0 };
84
+ }
85
+ static {
86
+ this.styles = O;
87
+ }
88
+ async fetchGroups() {
89
+ await this.updateComplete, await this.refreshGroups();
90
+ }
91
+ async setFocus() {
92
+ await this.updateComplete, this.buttonRef.value?.focus();
93
+ }
94
+ willUpdate(t) {
95
+ const r = t.has("item") || t.has("portal"), e = t.has("groups") && this.groups !== this.fetchedGroups;
96
+ (r || t.has("groups") || t.has("userGroups")) && (this.detailsRequest?.abort(), this.groupData = void 0, this.loadingDetails = !1, this.favoriteOnlySource === "details" && (this.favoriteOnlySource = void 0)), (r || e) && (this.groupsRequest?.abort(), this.favoriteOnlySource = void 0, r && this.fetchedGroups && this.groups === this.fetchedGroups && (this.groups = void 0), this.fetchedGroups = void 0), this.autoFetchGroups && this.groups === void 0 && this.item?.id && this.portal && (r || e || t.has("autoFetchGroups")) && this.refreshGroups(), (this.showHoverText ?? !this.showText) || (this.tooltipOpen = !1), this.tooltipOpen && (r || t.has("groups") || t.has("userGroups")) && this.item?.id && this.portal && this.loadGroupData();
97
+ }
98
+ updated() {
99
+ this.tooltipRef.value && this.buttonRef.value && (this.tooltipRef.value.referenceElement = this.buttonRef.value);
100
+ }
101
+ async refreshGroups() {
102
+ const { item: t, portal: r, groups: e } = this;
103
+ if (!t?.id || !r) {
104
+ console.error("A saved item and portal are required to fetch sharing groups");
105
+ return;
106
+ }
107
+ this.groupsRequest?.abort();
108
+ const s = new AbortController();
109
+ this.groupsRequest = s;
110
+ const { result: o, error: n } = await z(r, t.id, { signal: s.signal });
111
+ if (!(s.signal.aborted || this.item !== t || this.portal !== r || this.groups !== e)) {
112
+ if (n || !o) {
113
+ console.error("Unable to refresh the sharing summary", n);
114
+ return;
115
+ }
116
+ this.fetchedGroups = o.filter((l) => !l.isFav).map(({ id: l }) => l), this.favoriteOnlySource = o.length > 0 && this.fetchedGroups.length === 0 ? "refresh" : void 0, this.groups = this.fetchedGroups;
117
+ }
118
+ }
119
+ async loadGroupData() {
120
+ const { item: t, portal: r, groups: e, userGroups: s } = this;
121
+ if (!t?.id || !t.owner || !r) {
122
+ console.error("A saved item, owner, and portal are required to load sharing details");
123
+ return;
124
+ }
125
+ this.detailsRequest?.abort();
126
+ const o = new AbortController();
127
+ this.detailsRequest = o;
128
+ const n = { signal: o.signal }, l = () => !o.signal.aborted && this.item === t && this.portal === r && this.groups === e && this.userGroups === s;
129
+ this.loadingDetails = !0;
130
+ try {
131
+ let p = e;
132
+ if (s) {
133
+ const u = await S(r, { id: t.id, owner: t.owner, ownerFolder: t.ownerFolder }, s, n);
134
+ if (!l())
135
+ return;
136
+ if (u.error) {
137
+ console.error("Unable to resolve sharing details", u.error);
138
+ return;
139
+ }
140
+ u.result?.length && (p = u.result);
141
+ }
142
+ const a = await D(r, p ?? [], n);
143
+ if (!l())
144
+ return;
145
+ if (a.error || !a.result) {
146
+ console.error("Unable to load sharing details", a.error);
147
+ return;
148
+ }
149
+ this.groupData = a.result.filter((u) => !u.isFav), a.result.length ? this.favoriteOnlySource = this.groupData.length ? void 0 : this.favoriteOnlySource ?? "details" : this.favoriteOnlySource === "details" && (this.favoriteOnlySource = void 0);
150
+ } finally {
151
+ l() && (this.loadingDetails = !1);
152
+ }
153
+ }
154
+ renderGroupData() {
155
+ const { messages: t, groupData: r } = this;
156
+ return r?.length ? c`<h4 class="section-header">${t.groups.replace("${num}", new Intl.NumberFormat(t._lang).format(r.length))}</h4><ul class="section groups">${r.map((e) => c`<li class="group"><arcgis-portal-group-thumbnail .group=${e} .portal=${this.portal} class="avatar"></arcgis-portal-group-thumbnail><div class="group-text"><h5>${e.title}</h5><p>${t.viewableBy.replace("${level}", e.access === "public" ? t.everyone : e.access === "org" ? t.organization : t.groupMembers)}</p></div></li>`)}</ul>` : null;
157
+ }
158
+ render() {
159
+ if (!this.item?.access)
160
+ return null;
161
+ const { messages: t, showText: r } = this, e = k(this.item.access, this.groups ?? this.groupData?.map(({ id: s }) => s), this.favoriteOnlySource !== void 0, t, t._lang);
162
+ return c`<button type=button class="wrapper" aria-label=${e.tooltip ?? y} @click=${() => this.arcgisInternalShareSummaryActivate.emit()} ${m(this.buttonRef)}><calcite-icon class="icon" .icon=${e.icon} scale=s></calcite-icon>${r && e.groups !== e.access && c`<span class="text">${e.access}</span>` || ""}${e.groups && c`<calcite-icon class="icon" icon=plus scale=s></calcite-icon><calcite-icon class="icon" icon=group scale=s></calcite-icon>${r && c`<span class="text">${e.groups}</span>` || ""}` || ""}</button>${(this.showHoverText ?? !r) && c`<calcite-tooltip close-on-click placement=bottom-start offset-distance=6 offset-skidding=0 .overlayPositioning=${this.overlayPositioning} @calciteTooltipBeforeOpen=${() => {
163
+ this.tooltipOpen = !0, this.loadGroupData();
164
+ }} @calciteTooltipBeforeClose=${() => {
165
+ this.tooltipOpen = !1;
166
+ }} ${m(this.tooltipRef)}><div class="tooltip">${this.loadingDetails ? c`<calcite-loader .label=${t.sharing} scale=s></calcite-loader>` : c`<div class="section-header"><h4>${t.sharing}</h4><slot name=tooltip-header-end></slot></div><p class="section status">${this.groupData?.length ? e.tooltipNoCount : e.tooltip}</p>${this.renderGroupData()}`}</div></calcite-tooltip>` || ""}`;
167
+ }
168
+ }
169
+ f("arcgis-portal-item-share-summary", I);
170
+ export {
171
+ I as ArcgisPortalItemShareSummary
172
+ };