@arcgis/portal-components 6.0.0-next.13 → 6.0.0-next.14

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 (115) hide show
  1. package/dist/cdn/{ICZNMBOV.js → 2W4ZEY3I.js} +1 -1
  2. package/dist/cdn/{Z6R3C4AK.js → 2XIDYV73.js} +1 -1
  3. package/dist/cdn/{WGCNE5CY.js → 36WCJDSE.js} +1 -1
  4. package/dist/cdn/{IHB4RIMJ.js → 3K3BYENR.js} +1 -1
  5. package/dist/cdn/{F6WFLI25.js → 3MLYU2YK.js} +1 -1
  6. package/dist/cdn/{4CCM74YA.js → 3QJWPWLY.js} +1 -1
  7. package/dist/cdn/3ZC26CT6.js +4 -0
  8. package/dist/cdn/{2WN6YUY5.js → 4AJW7TXX.js} +1 -1
  9. package/dist/cdn/4B2URSFO.js +2 -0
  10. package/dist/cdn/565U4WSN.js +2 -0
  11. package/dist/cdn/{TWCJJCPC.js → 57MT7FOI.js} +1 -1
  12. package/dist/cdn/{G6V653H2.js → 5CBLAWTC.js} +1 -1
  13. package/dist/cdn/5RHV5HXF.js +2 -0
  14. package/dist/cdn/{RHCRPJWS.js → 5SKCVK2P.js} +1 -1
  15. package/dist/cdn/5TY55CJN.js +2 -0
  16. package/dist/cdn/{2JAJY2VO.js → 5VAV267L.js} +1 -1
  17. package/dist/cdn/63C5KHJE.js +2 -0
  18. package/dist/cdn/{E3NOMS5M.js → 66PLI3XK.js} +1 -1
  19. package/dist/cdn/6MVERAK7.js +2 -0
  20. package/dist/cdn/{2YZWRFCI.js → 6XAFP5OI.js} +1 -1
  21. package/dist/cdn/{4NW3MEKV.js → 7GOPVQZP.js} +1 -1
  22. package/dist/cdn/{A2Z4NCPQ.js → 7HOK3ICE.js} +1 -1
  23. package/dist/cdn/{6U626CTA.js → 7M6OSITT.js} +1 -1
  24. package/dist/cdn/{Z2XXKHIS.js → AEPP4WJM.js} +1 -1
  25. package/dist/cdn/{G2C2DUPW.js → AJ5H2JMU.js} +1 -1
  26. package/dist/cdn/{BKD7JSV2.js → AXKMKCEW.js} +1 -1
  27. package/dist/cdn/{FJ3I3AJE.js → AYHYABMC.js} +1 -1
  28. package/dist/cdn/BGPQQ2RK.js +2 -0
  29. package/dist/cdn/{5HZNBMW6.js → C5FTQSU6.js} +1 -1
  30. package/dist/cdn/CB5XUOOF.js +2 -0
  31. package/dist/cdn/{XQE23XTL.js → CHZFGIWM.js} +1 -1
  32. package/dist/cdn/DCIJJNO3.js +2 -0
  33. package/dist/cdn/{CSRZ3UYP.js → EHHFEPC2.js} +1 -1
  34. package/dist/cdn/EJZ4LX4Z.js +2 -0
  35. package/dist/cdn/{MFLYO7PJ.js → FF2IT35O.js} +1 -1
  36. package/dist/cdn/{IO6RGF5S.js → FTT33ZZJ.js} +1 -1
  37. package/dist/cdn/{4BPXIHDF.js → HA35MMMF.js} +1 -1
  38. package/dist/cdn/{XQFUL7N2.js → HOOOFVRH.js} +1 -1
  39. package/dist/cdn/{OR6T5SB3.js → HXFKOELM.js} +1 -1
  40. package/dist/cdn/{K2XSYDAP.js → I57CRKF7.js} +1 -1
  41. package/dist/cdn/JOQEFKCE.js +2 -0
  42. package/dist/cdn/JRRPPRMV.js +2 -0
  43. package/dist/cdn/{VKMH5MIX.js → K5Q4ZROX.js} +1 -1
  44. package/dist/cdn/{ZC5KXI4B.js → KGTBXDD2.js} +1 -1
  45. package/dist/cdn/{L4Y2HIOC.js → LFRULIBL.js} +1 -1
  46. package/dist/cdn/{TT6IOLZG.js → LMFWH7YP.js} +1 -1
  47. package/dist/cdn/{OFWQLRQE.js → LVUKORME.js} +1 -1
  48. package/dist/cdn/{HNJ4WG6S.js → MSP6STQ7.js} +1 -1
  49. package/dist/cdn/{ZKY5WVYH.js → NBEOY6GP.js} +1 -1
  50. package/dist/cdn/{I27LRUII.js → NOI7ZXEF.js} +1 -1
  51. package/dist/cdn/{XSEZCHSU.js → O3YZLC7G.js} +1 -1
  52. package/dist/cdn/OQ3OHDEB.js +2 -0
  53. package/dist/cdn/{Z26C36RJ.js → P3GNUA6J.js} +1 -1
  54. package/dist/cdn/P7ZCCDSD.js +2 -0
  55. package/dist/cdn/{XKNKWC5Z.js → Q3VELMMC.js} +1 -1
  56. package/dist/cdn/{ATQT25TR.js → QKGHH3FS.js} +1 -1
  57. package/dist/cdn/{W2UVKYOW.js → QPPMRBBW.js} +1 -1
  58. package/dist/cdn/R5DXQCCJ.js +2 -0
  59. package/dist/cdn/{O24CJZKB.js → R7XRTDY6.js} +1 -1
  60. package/dist/cdn/RA75BDVB.js +2 -0
  61. package/dist/cdn/{BKKSIY4O.js → REWOUYVV.js} +1 -1
  62. package/dist/cdn/{NBJIISZZ.js → RLI7T32U.js} +1 -1
  63. package/dist/cdn/{6K4H4EN2.js → SQCDEL42.js} +1 -1
  64. package/dist/cdn/T333LJ4L.js +2 -0
  65. package/dist/cdn/{3S6ORDJI.js → T7NY3ZIG.js} +1 -1
  66. package/dist/cdn/{44QEELTO.js → TKTMO2NO.js} +1 -1
  67. package/dist/cdn/{7BHYNG4B.js → TNRHHR67.js} +1 -1
  68. package/dist/cdn/{5WGAYGZM.js → TVFDFN6V.js} +1 -1
  69. package/dist/cdn/{I6IRHXWR.js → ULTSLT4L.js} +1 -1
  70. package/dist/cdn/VLUI423B.js +2 -0
  71. package/dist/cdn/{6NENX7Z3.js → VRGGPMVR.js} +1 -1
  72. package/dist/cdn/{IN4JPZTY.js → VXDDXPD7.js} +1 -1
  73. package/dist/cdn/{KAPXKRSU.js → WFU6WGTW.js} +1 -1
  74. package/dist/cdn/{TIHS6NZD.js → WH54CSSU.js} +1 -1
  75. package/dist/cdn/YO3CD3O5.js +2 -0
  76. package/dist/cdn/{MTY3QVCM.js → YRLNSQ23.js} +1 -1
  77. package/dist/cdn/{YZTBAUIO.js → YTVLEHJT.js} +1 -1
  78. package/dist/cdn/{BTWTESBF.js → Z44I2CVX.js} +1 -1
  79. package/dist/cdn/ZACZJ2SR.js +2 -0
  80. package/dist/cdn/{M5PPX4ZX.js → ZJCG6JI7.js} +1 -1
  81. package/dist/cdn/ZMVW64CR.js +2 -0
  82. package/dist/cdn/index.js +1 -1
  83. package/dist/chunks/loadClassificationData.js +10 -11
  84. package/dist/components/arcgis-portal-navigation/index.js +1 -1
  85. package/dist/docs/api.json +1 -1
  86. package/dist/docs/docs.json +1 -1
  87. package/dist/docs/vscode.html-custom-data.json +1 -1
  88. package/dist/docs/web-types.json +1 -1
  89. package/dist/index.d.ts +3 -0
  90. package/dist/index.js +150 -16
  91. package/dist/utils/generateEmbeddings.d.ts +7 -0
  92. package/dist/utils/semanticSearch.d.ts +60 -0
  93. package/package.json +7 -7
  94. package/dist/cdn/23CP74IB.js +0 -2
  95. package/dist/cdn/5DVLAKTA.js +0 -2
  96. package/dist/cdn/6ZKYBUII.js +0 -2
  97. package/dist/cdn/7XBAKSHJ.js +0 -2
  98. package/dist/cdn/AC63PIGJ.js +0 -2
  99. package/dist/cdn/AICPYLWE.js +0 -4
  100. package/dist/cdn/BQFVNCSA.js +0 -2
  101. package/dist/cdn/DG6ZTIXN.js +0 -2
  102. package/dist/cdn/DWGYWUVJ.js +0 -2
  103. package/dist/cdn/E5VN6XPP.js +0 -2
  104. package/dist/cdn/FNWM2SRX.js +0 -2
  105. package/dist/cdn/I6WGLIEC.js +0 -2
  106. package/dist/cdn/IM7DWCQW.js +0 -2
  107. package/dist/cdn/ISHV5HNX.js +0 -2
  108. package/dist/cdn/JQWP52DP.js +0 -2
  109. package/dist/cdn/OVQQO7DF.js +0 -2
  110. package/dist/cdn/Q2CR4M4G.js +0 -2
  111. package/dist/cdn/QXBFIAOL.js +0 -2
  112. package/dist/cdn/RQTLNBI2.js +0 -2
  113. package/dist/cdn/RW2EKBM4.js +0 -2
  114. package/dist/cdn/XRMYRNQY.js +0 -2
  115. package/dist/cdn/YEQE6MNG.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import k from"./3SCRMD7A.js";import j from"./XQFUL7N2.js";import i from"./6G6MIY3R.js";import h from"./6K4H4EN2.js";import g from"./ATQT25TR.js";import"./JOUR2FB2.js";import{a as N}from"./4KTRAA2J.js";import"./PKA745KL.js";import"./VDXESPJK.js";import"./DAAON2UO.js";import e from"./TZ6HFMZZ.js";import c from"./TIPQ2ZWK.js";import a from"./C5IKEISI.js";import{a as F,c as $}from"./H7DF6TTK.js";import{c as U}from"./KV4ZZSNW.js";import"./2FKNF2ZK.js";import{a as S}from"./FJ3I3AJE.js";import{b as E}from"./I6WGLIEC.js";import"./K2XSYDAP.js";import{J as A,K as b,L as P,M as w,O as M,R as L,h as T,j as d,w as f}from"./AICPYLWE.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([_,R,{b:v},,,,{a:x},{b:O},,{b:p}])=>{async function q(i,t,e=!1){try{let s=new Map;for(let n of i){let{id:l,owner:c}=n,a=s.get(c)??[];a.push(l),s.set(c,a)}let r=[];for(let[n,l]of s){let c=`${t.restUrl}/content/users/${encodeURIComponent(n)}/deleteItems`;for(let a of O(l,100)){let o=R(c,{method:"post",query:{f:"json",items:a.join(","),permanentDelete:e}});r.push(o.then(({data:m})=>m))}}return{result:(await Promise.all(r)).flatMap(({results:n})=>n)}}catch{return{error:{code:"unhandledError"}}}}async function W(i){let{item:t,portal:e,permanentlyDelete:s}=i,{id:r,owner:n}=t;if(!r||!n)return{error:{code:"unhandledError"}};let l=e.recycleBinEnabled&&!s?"/canRecycle":"/canDelete",c=`${e.restUrl}/content/users/${encodeURIComponent(n)}/items/${r}${l}`;try{return{result:(await R(c,{query:{f:"json"}})).data}}catch(a){let o=a.details?.raw;switch(o?.messageCode){case"CONT_00481":case"CONT_00483":case"CONT_00484":return{error:{code:"itemHasDependentItems"}};case"CONT_0048":return{error:{code:"itemDeleteProtected"}};case"CONT_0298":return{error:{code:"itemNotSupportedInRecycleBin"}};default:return{error:{code:"unhandledError",message:o?.message}}}}}async function Q(i,t){try{let e=`${i.itemUrl}/setContentStatus`;return{result:(await R(e,{query:{status:t??"",clearEmptyFields:!t,f:"json"},method:"post"})).data}}catch(e){return console.error(e),{error:{code:"unhandledError"}}}}function G(i,t){return(i.relatedItems??[]).map(e=>X(e,t))}function X(i,t){return i instanceof _?i:new _({...i,portal:t})}async function y({itemId:i,portal:t,relationship:e,includeRecycleBin:s,nextkey:r}){let{relationshipType:n,direction:l}=e,c=`${t.restUrl}/content/items/${i}/relatedItems`;try{let a=await v({url:c,portal:t,params:{includeRecycleBin:s,f:"json",relationshipType:n?Array.isArray(n)?n.join(","):n:void 0,direction:l,nextkey:r}});return{success:!0,result:{...a,relatedItems:G(a,t)}}}catch(a){return{success:!1,error:a}}}async function Y({itemId:i,portal:t,relationship:e,includeRecycleBin:s,num:r,nextkey:n}){let{relationshipRules:l,direction:c}=e,a=`${t.restUrl}/content/items/${i}/relatedItems`;try{let o=await v({url:a,portal:t,params:{includeRecycleBin:s,f:"json",...l?.length?{relationshipRules:l.join(",")}:{},includeSystemManaged:"true",excludedFlags:"legacy,exclude",num:r,direction:c,nextkey:n}});return{success:!0,result:{...o,relatedItems:G(o,t)}}}catch(o){return{success:!1,error:o}}}async function Z(i,t){let{id:e,type:s,typeKeywords:r=[]}=i;if(!e)return null;let n=["Scene Service","Map Service","WFS","OGCFeatureServer","Vector Tile Service","3DTiles Service"].includes(s),l=["Map Service","Vector Tile Service"].includes(s),c=o=>o?.typeKeywords?.includes("View Service")??!1,a=()=>n?[{relationshipType:["Service2Service"],direction:"reverse"},{relationshipType:["Service2Data"],direction:"forward"}]:r.includes("Bulk Published Service")?{relationshipType:["DataStore2BPService"],direction:"reverse"}:s==="Geoprocessing Service"&&r.includes("Notebook Web Tool")?{relationshipType:["Notebook2WebTool"],direction:"reverse"}:r.includes("Route Layer")?{relationshipType:["Service2Route"],direction:"reverse"}:s==="Mobile Application"?{relationshipType:["MobileApp2Code"],direction:"reverse"}:s==="Map Package"?{relationshipType:["Area2Package"],direction:"reverse"}:s==="Feature Service"?{relationshipType:["Service2Layer"],direction:"reverse"}:r.includes("Document")?{relationshipType:["Item2Attachment"],direction:"reverse"}:s==="Application Configuration"?{relationshipType:["Map2AppConfig"],direction:"reverse"}:{relationshipType:["Service2Data"],direction:"forward"};try{let o=a();if(!o)return null;if(!Array.isArray(o))return{sourceData:(await y({itemId:e,portal:t,relationship:o})).result?.relatedItems?.[0]??null,relationship:o};if(n){let m={relationshipType:["Service2Service"],direction:"reverse"},g=await y({itemId:e,portal:t,relationship:m}),h=g.result?.total?g.result.relatedItems.shift()??null:null;if(l&&!c(h)||!h){m={relationshipType:["Service2Data"],direction:"forward"};let I=await y({itemId:e,portal:t,relationship:m});return{sourceData:I.result?.total?I.result.relatedItems.shift()??h:h,relationship:m}}return{sourceData:h,relationship:m}}return null}catch(o){return console.error(o),{sourceData:null,relationship:{direction:"forward"}}}}async function ee(i,t){let{id:e,type:s,typeKeywords:r=[]}=i;try{let n=s==="Notebook"?{relationshipType:["Notebook2WebTool"],direction:"forward"}:r.includes("Has Related Route Layers")?{relationshipType:["Service2Route"],direction:"forward"}:r.includes("Hosted Service")||s==="Feature Service"?{relationshipType:["Service2Service"],direction:s==="Feed"?"reverse":"forward"}:s==="Data Store"||r.includes("ArcGIS Server")?{relationshipType:["DataStore2BPService"],direction:"forward"}:{relationshipType:["Service2Data"],direction:"reverse"},l=await y({itemId:e,portal:t,relationship:n,includeRecycleBin:!0});return{resultData:{items:l.result?.total?l.result.relatedItems:null,count:l.result?.total??0},relationship:n}}catch(n){return console.error(n),{resultData:{items:null,count:0},relationship:{direction:"forward"}}}}async function te(i,t){let{id:e}=i;try{return(await y({itemId:e,portal:t,relationship:{relationshipType:["ReplacementItem2Item"],direction:"forward"}})).result?.relatedItems??[]}catch(s){return console.error(s),[]}}function se({recycleItems:i,cannotDeleteItems:t,permanentlyDeleteItems:e}){return[...i,...t,...e]}function ie(i){return i.map(({item:t,sourceData:e,resultData:s,replacementItemFor:r})=>({item:t,sourceData:e,resultData:s,replacementItemFor:r}))}function K(i,t,e){return!t&&!!e?.length&&!p(i)}function ne({item:i,sourceData:t,resultData:e}){return!e?.some(s=>!s.inRecycleBin)||K(i,t,e)?!1:!V(i,e)&&!J(i,e)}function re({selectedItems:i}){let t=[];return t.push(...i.flatMap(({item:e,sourceData:s,resultData:r,replacementItemFor:n})=>{let l=K(e,s,r),c=!!(r?.some(a=>!a.inRecycleBin)&&!V(e,r)&&!J(e,r));return l&&c?[{item:e,reason:"dependent",offendingItems:r??void 0}]:n&&n?.length>0?[{item:e,reason:"replacement",offendingItems:n}]:[]})),t}function V(i,t){let e=t[0];return i.type==="Feed"&&p(i)&&t.length===1&&e?.type==="Feature Service"&&p(e)}function J(i,t){let e=t[0];return i.type==="Feature Service"&&p(i)&&t.length===1&&e?.type==="Feed"&&p(e)}function C(i){return i?i.filter(t=>t.type!=="Code Attachment"):null}function H(i){return!!(i&&"inRecycleBin"in i&&i.inRecycleBin===!0)}function u(i){return i.updatedStatus??i.kind}function k(i){return{...i,originalStatus:i.originalStatus??i.kind}}function ae(i,t){return{...i,kind:t,originalStatus:i.originalStatus??i.kind}}async function le(i,t){let e=await W({item:i,portal:t,permanentlyDelete:!1});if(e.error&&e.error.code!=="itemNotSupportedInRecycleBin")return{kind:"cannotDelete",errorCode:e.error.code};if(e.result?.success)return{kind:"recycle"};let s=await W({item:i,portal:t,permanentlyDelete:!0});return s.result?.success?{kind:"permanentlyDelete"}:{kind:"cannotDelete",errorCode:s.error?.code??"unhandledError"}}function ce(i){switch(i){case"itemHasDependentItems":return"hasDependentItems";case"itemDeleteProtected":return"deleteProtected";default:return"uncaught"}}async function oe(i,t){let e=await Y({itemId:i.id,portal:t,relationship:{direction:"forward"}}),s=await Z(i,t),r=await ee(i,t),n=await te(i,t),l=e.result?.relatedItems??[],c=C(l)??[],a=e.result?.aggregations?.total?.count,o=C(r.resultData.items),m=C(n),g=s?.sourceData,h={usedByItems:c,usedByItemsCount:a==null?c.length:Math.max(0,a-(l.length-c.length)),sourceData:g?.type==="Code Attachment"?null:g??null,resultData:o,replacementItemFor:m?.length?m:null},I=ne({item:i,...h}),D=await le(i,t);return D.kind==="cannotDelete"?k({item:i,...h,kind:"cannotDelete",reason:ce(D.errorCode)}):I?k({item:i,...h,kind:"cannotDelete",reason:"hasDependentItems"}):D.kind==="permanentlyDelete"?k({item:i,...h,kind:"permanentlyDelete",reason:"notSupported"}):k({item:i,...h,kind:D.kind})}async function de(i,t){let e=await Promise.all(i.map(async s=>await oe(s,t)));return me(e)}function me(i){let t=new Map;for(let e of i)e.item.id&&t.set(e.item.id,e);return i.map(e=>{if(e.kind!=="cannotDelete"||e.reason!=="hasDependentItems"||!e.item.id)return e;let s=he(e.resultData,t);if(s.length===0)return e;let r=s.every(l=>t.has(l)),n=s.every(l=>!t.get(l)?.item.protected);return r&&n?ae(e,"recycle"):e})}function he(i,t,e=new Set){if(!i?.length)return[];let s=i.filter(n=>!H(n)),r=new Set;for(;s.length>0;){let n=s.shift().id;if(!n||e.has(n))continue;e.add(n),r.add(n);let l=t.get(n)?.resultData??[];s.push(...l.filter(c=>!H(c)))}return[...r]}var ue=T`:host{display:block}calcite-dialog{--calcite-dialog-content-space: 0;--calcite-dialog-background-color: var(--calcite-color-background)}calcite-panel{display:flex;flex-direction:column;gap:.75rem;>*{margin-inline:.75rem}}.panel__content{width:100%;box-sizing:border-box}.single-item-bucket{--calcite-block-background-color: transparent;--calcite-block-border-color: transparent}.bucket__content{display:flex;align-items:flex-start;gap:.75rem;width:100%}.bucket__icon{flex-shrink:0}.bucket__icon--danger{color:var(--calcite-color-status-danger)}.bucket__details{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.bucket__header{font-weight:500}.bucket__label{margin-inline-end:.25rem}.bucket__checkbox{align-self:flex-start;margin-top:.5rem}.bucket__description{line-height:1.35;font-size:var(--calcite-font-size--1)}.bucket__link{display:flex;align-items:center;min-height:1.5rem}.item-link-content{position:relative;>arcgis-portal-item-type{margin-inline-end:.25rem;vertical-align:middle}}.panel__checkbox-container{width:100%;box-sizing:border-box;background-color:var(--calcite-color-foreground-1)}.panel__checkbox{padding-block:.75rem;padding-inline-start:.75rem}.panel__related-items{margin-top:1rem;border:1px solid var(--calcite-color-border-2)}.panel__related-items-icon{color:var(--calcite-color-status-warning)}.panel__related-items-notice{padding-bottom:.75rem}arcgis-portal-review-related-items{margin-bottom:.75rem}calcite-list{overflow:auto;min-block-size:0;max-height:min(250px,75vh)}.discouraged-items-warning{margin-bottom:.75rem}.header-description{font-size:var(--calcite-font-size--1);font-weight:400}`,z=new Map;async function pe(i,t){let e=F(i),s=JSON.stringify([e,t]),r=z.get(s);if(r)return r;try{let n=(await v({url:`${e}portals/helpmap`,portal:i,params:{culture:t}}))?.helpMap?.m??{};return z.set(s,n),n}catch{return{}}}var ge=i=>E((t,e)=>{let s,r;return e.onUpdate(()=>{let n=i.portal(),l=i.language(),c=n?.restUrl;c===s&&l===r||(s=c,r=l,e.exports={},!(!n||!c||!l)&&pe(n,l).then(a=>{e.exports=a}))}),{}});function j({id:i,linkText:t,label:e,placement:s,items:r,portal:n,user:l}){return d`<calcite-link id=${i??M} @keydown=${c=>{if(c.key===" "||c.key==="Enter"){let a=c.currentTarget.nextElementSibling;a&&(a.open=!a.open)}}}>${t}</calcite-link><calcite-popover .label=${e} .referenceElement=${i} .placement=${s} auto-close focus-trap-disabled @keydown=${c=>{if(c.key==="Tab"){let a=c.currentTarget;requestAnimationFrame(()=>{a.open=!1})}}} @calcitePopoverOpen=${c=>{c.currentTarget.querySelector("calcite-list-item")?.setFocus()}}><calcite-list .label=${e} selection-mode=none>${r.map(c=>d`<calcite-list-item .label=${c.title??""} @calciteListItemSelect=${()=>{let a=c.itemPageUrl;a&&window.open(a.replace("sharing/rest/",""),"_blank","noopener,noreferrer")}}><span slot=content-start><arcgis-portal-item-type .item=${c} .portal=${n} .user=${l} hide-text></arcgis-portal-item-type></span><span slot=content>${c.title}</span></calcite-list-item>`)}</calcite-list></calcite-popover>`}var B=class extends P{constructor(){super(...arguments),this.deleteStatusRequestId=0,this.updatedCannotDeleteItemIds=new Set,this.permanentlyDeleteCheckboxRef=A(),this.messages=S({blocking:!0}),this.fieldDeleteMessages=S({name:"portal-field-delete"}),this.helpMap=ge({portal:()=>this.portal,language:()=>this.messages._t9nLocale}),this.isLoading=!0,this.submittingAction=null,this.loadedItems=[],this.hasConfirmedReview=!1,this.hasReviewedSelectedItems=!1,this.cannotDeleteItems=[],this.recycleItems=[],this.permanentlyDeleteItems=[],this.deprecateItems=[],this.excludeItems=[],this.reviewingDirectlyUsedByItems=!1,this.reviewDecision=null,this.active=!0,this.items=[],this.itemIds=[],this.user=null,this.disableLinks=!1,this.arcgisClose=f(),this.arcgisConfirm=f(),this.arcgisError=f()}static{this.properties={isLoading:16,submittingAction:16,loadedItems:16,hasConfirmedReview:16,hasReviewedSelectedItems:16,cannotDeleteItems:16,recycleItems:16,permanentlyDeleteItems:16,deprecateItems:16,excludeItems:16,reviewingDirectlyUsedByItems:16,reviewDecision:16,active:5,items:0,itemIds:0,portal:0,user:0,disableLinks:5}}static{this.styles=ue}willUpdate(t){let e=t.has("items")||t.has("itemIds")||t.has("portal")||t.has("user")||t.has("active");this.active&&e&&(this.user??=this.portal?.user||null,this.resetState(),this.initializeItems(++this.deleteStatusRequestId))}async initializeItems(t){let{items:e,itemIds:s,portal:r}=this,n=e.length?e:await Promise.all(s.map(async l=>await new _({id:l,portal:r}).load()));t===this.deleteStatusRequestId&&(this.loadedItems=n,await this.determineDeleteStatus(t))}async handleReviewDecision(t){let e=this.itemsWithImpactedItems.map(({item:a})=>a),s=t==="delete"?"recycle":t==="deprecate"?"deprecate":"exclude",r=this.permanentlyDeleteItems.filter(a=>this.isPermanentlyDeleteOverrideActive(a)),n=this.permanentlyDeleteItems.filter(a=>!this.isPermanentlyDeleteOverrideActive(a)),l=[...this.recycleItems,...this.deprecateItems,...this.excludeItems,...r],c=t==="delete"&&l.some(a=>u(a)!=="recycle"&&e.some(({id:o})=>o===a.item.id));for(let a of l){if(!e.some(({id:m})=>m===a.item.id))continue;let o=a.originalStatus??a.kind;a.originalStatus=o,a.updatedStatus=s}if(this.reviewDecision={action:t,items:e},this.hasConfirmedReview=!0,this.reviewingDirectlyUsedByItems=!1,this.recycleItems=l.filter(a=>u(a)==="recycle"),this.deprecateItems=l.filter(a=>u(a)==="deprecate"),this.excludeItems=l.filter(a=>u(a)==="exclude"),this.permanentlyDeleteItems=n,t!=="delete"||c){this.isLoading=!0;let a=[...this.cannotDeleteItems,...this.recycleItems,...this.permanentlyDeleteItems].map(({item:o})=>o);await this.determineDeleteStatus(++this.deleteStatusRequestId,a)}}async updateAllContentStatus(t,e){return(await Promise.all(t.map(async s=>await Q(s,e)))).flatMap(({result:s})=>s?[s]:[])}async handleDelete(){if(!this.active||this.submittingAction)return;this.submittingAction="delete";let t={restUrl:this.portal.restUrl},{result:e=[]}=this.recycleItems.length?await q(this.recycleItems.map(({item:n})=>n),t):{result:[]},{result:s=[]}=this.permanentlyDeleteItems.length?await q(this.permanentlyDeleteItems.map(({item:n})=>n),t,!0):{result:[]},r=this.deprecateItems.length?await this.updateAllContentStatus(this.deprecateItems.map(({item:n})=>n),"deprecated"):null;this.arcgisConfirm.emit({deletedItems:e,permanentlyDeletedItems:s,deletedItemsCount:e.length,permanentlyDeletedItemsCount:s.length,deprecatedItems:r}),this.closeDialog()}async handleDeprecate(){if(!this.active||this.submittingAction)return;this.submittingAction="deprecate";let t=[...this.deprecateItems,...this.recycleItems,...this.cannotDeleteItems,...this.permanentlyDeleteItems].filter(Boolean),e=t.length?await this.updateAllContentStatus(t.map(({item:s})=>s),"deprecated"):null;this.arcgisConfirm.emit({deletedItems:null,permanentlyDeletedItems:null,deletedItemsCount:0,permanentlyDeletedItemsCount:0,deprecatedItems:e}),this.closeDialog()}handleDialogClose(){this.active&&this.closeDialog()}closeDialog(){this.active=!1,this.resetState(),this.arcgisClose.emit()}resetState(){this.isLoading=!0,this.submittingAction=null,this.loadedItems=[],this.hasConfirmedReview=!1,this.hasReviewedSelectedItems=!1,this.cannotDeleteItems=[],this.recycleItems=[],this.permanentlyDeleteItems=[],this.deprecateItems=[],this.excludeItems=[],this.reviewingDirectlyUsedByItems=!1,this.reviewDecision=null,this.updatedCannotDeleteItemIds.clear(),++this.deleteStatusRequestId}async determineDeleteStatus(t,e=this.loadedItems){let s=new Set(this.recycleItems.map(({item:n})=>n.id).filter(n=>!!n)),r=await de(e,this.portal);if(t===this.deleteStatusRequestId){this.cannotDeleteItems=r.filter(n=>u(n)==="cannotDelete");for(let n of this.cannotDeleteItems)n.item.id&&s.has(n.item.id)&&this.updatedCannotDeleteItemIds.add(n.item.id);this.recycleItems=r.filter(n=>u(n)==="recycle"),this.permanentlyDeleteItems=r.filter(n=>u(n)==="permanentlyDelete"),this.isLoading=!1}}get itemsWithImpactedItems(){let t=new Set(this.loadedItems.map(({id:e})=>e));return[...this.recycleItems,...this.deprecateItems,...this.excludeItems,...this.permanentlyDeleteItems.filter(e=>this.isPermanentlyDeleteOverrideActive(e))].map(e=>({...e,usedByItems:e.usedByItems.filter(({id:s})=>!t.has(s))})).filter(({usedByItems:e})=>e.length>0)}get itemsHaveImpactedItems(){return this.itemsWithImpactedItems.length>0}get itemsNeedReview(){return this.itemsWithImpactedItems.some(t=>["recycle","permanentlyDelete"].includes(u(t)))}isPermanentlyDeleteOverrideActive(t){return t.kind==="recycle"&&t.updatedStatus==="permanentlyDelete"}async handlePermanentlyDeleteOverrideChange(t){if(t){let e=this.recycleItems.map(s=>({...s,originalStatus:s.originalStatus??s.kind,updatedStatus:"permanentlyDelete"}));this.recycleItems=[],this.permanentlyDeleteItems=[...this.permanentlyDeleteItems,...e]}else{let e=this.permanentlyDeleteItems.filter(s=>this.isPermanentlyDeleteOverrideActive(s));this.permanentlyDeleteItems=this.permanentlyDeleteItems.filter(s=>!this.isPermanentlyDeleteOverrideActive(s)),this.recycleItems=[...this.recycleItems,...e.map(s=>({...s,updatedStatus:"recycle"}))]}await this.updateComplete,await new Promise(e=>requestAnimationFrame(()=>e())),await this.permanentlyDeleteCheckboxRef.value?.setFocus()}get deleteButtonEnabled(){return!this.isLoading&&(!this.itemsNeedReview||this.hasConfirmedReview)}get markedForDeprecation(){return this.reviewDecision?.action==="deprecate"?this.reviewDecision.items:[]}get deleteMode(){return[this.recycleItems,this.deprecateItems,this.excludeItems,this.permanentlyDeleteItems].filter(t=>t.length>0).length>1?"mixed":this.markedForDeprecation.length>0?"deprecate":this.permanentlyDeleteItems.length>0?"permanentlyDelete":this.recycleItems.length>0?"delete":(this.cannotDeleteItems.length>0,"none")}getHeaderText(){return this.reviewingDirectlyUsedByItems?this.messages.reviewItemsCount.replace("{count}",`${this.itemsWithImpactedItems.length}`):this.isLoading?"":this.loadedItems.length>0&&this.permanentlyDeleteItems.length===this.loadedItems.length?this.messages.permanentlyDelete:(this.items.length?this.items:this.itemIds).length===1?this.messages.deleteItem:this.messages.deleteItems}getHeaderDescription(){return this.loadedItems.length<=1?"":this.reviewingDirectlyUsedByItems?this.messages.reviewItemsDescription:this.messages.selectedItems.replace("{count}",`${this.loadedItems.length}`)}getConfirmButtonText(){switch(this.deleteMode){case"mixed":return this.messages.confirm;case"deprecate":return this.messages.deprecate;case"permanentlyDelete":return this.portal.recycleBinEnabled?this.messages.permanentlyDelete:this.messages.delete;case"delete":return this.messages.delete;default:return this.messages.delete}}renderBucket({icon:t,label:e,description:s,link:r,additionalContent:n,dangerIcon:l=!1,bucket:c}){return d`<calcite-block class=${w({"single-item-bucket":(this.items.length?this.items:this.itemIds).length===1})} scale=l expanded><div class="bucket__content"><calcite-icon class=${w({bucket__icon:!0,"bucket__icon--danger":l})} scale=l .icon=${t}></calcite-icon><div class="bucket__details"><div class="bucket__header"><span class="bucket__label">${e}</span><span>${this.renderBucketItems(c)}</span></div>${s&&d`<span class="bucket__description">${s}</span>`||""}${r&&d`<div class="bucket__link"><calcite-link .href=${r.href} target=_blank icon-start=launch>${r.text??this.messages.moreInfo}</calcite-link></div>`||""}${n}</div></div></calcite-block>`}renderBucketItems(t=[]){return this.renderItemLinks(t.map(({item:e})=>e))}renderItemLinks(t,e=`delete-items-bucket-${t.map(({id:s})=>s).join("-")}`){if(t.length===0)return null;if(t.length===1){let s=t[0],r=`${U({portal:this.portal})}/item.html?id=${s.id}`;return d`<calcite-link .href=${r} target=_blank><span class="item-link-content"><arcgis-portal-item-type .item=${s} .portal=${this.portal} .user=${this.user} hide-text></arcgis-portal-item-type><span>${s.title}</span></span></calcite-link>`}return j({id:e,linkText:t.length,label:this.messages.bucketItems.replace("{count}",String(t.length)),placement:"bottom-start",items:t,portal:this.portal,user:this.user})}renderRelatedItemsPopover(t){let e=t.flatMap(({usedByItems:s})=>s);return t.length>1||e.length===0?null:j({id:"delete-items-directly-used-by",linkText:x(this.messages._t9nLocale,this.messages.usedByOtherItems,e.length),label:this.messages.usedByPopover,placement:"auto",items:e,portal:this.portal,user:this.user})}renderDirectlyUsedByItems(){let t=se({recycleItems:this.recycleItems,cannotDeleteItems:this.cannotDeleteItems,permanentlyDeleteItems:this.permanentlyDeleteItems}),e=this.cannotDeleteItems.find(({reason:o})=>o==="hasDependentItems"),s=e?e.resultData??[]:t.flatMap(({usedByItems:o})=>o),r=e?s.length:t[0]?.usedByItemsCount,n=re({selectedItems:ie(t)}),l=n.find(({reason:o})=>o==="replacement"),c=l?.offendingItems??[],a=x(this.messages._t9nLocale,this.messages.replacementItem.isReplacementFor,c.length,{itemLink:"{itemLink}"});return d`${this.loadedItems.length===1&&["delete","permanentlyDelete"].includes(this.deleteMode)&&n.length>0?d`<div class="discouraged-items-warning"><calcite-notice kind=warning open><div slot=message>${l?a.split("{itemLink}").map((o,m)=>d`${m>0&&this.renderItemLinks(c,"delete-items-replacement-for")||""}${o}`):this.messages.deleteDiscouraged}</div>${!l&&d`<calcite-link .href=${`${$(this.portal)}${this.helpMap[120001208]||""}`} icon-end=launch slot=link>${this.messages.learnMoreAboutDeletingSourceItems}</calcite-link>`||""}</calcite-notice></div>`:null}${!this.cannotDeleteItems.some(({reason:o})=>o==="deleteProtected")&&d`<arcgis-portal-review-related-items .sourceItem=${this.loadedItems[0]??null} .relatedItems=${s} .relatedItemsCount=${r} .showDependentItems=${!!e} .portal=${this.portal} .user=${this.user}></arcgis-portal-review-related-items>`||""}`}renderDirectlyUsedByItemsNotice(){let t=new Set(this.itemsWithImpactedItems.flatMap(({usedByItems:s})=>s.map(({id:r})=>r))),e=this.messages.reviewRelatedItems.multiple.replace("{totalCount}",String(t.size));return d`<div class="panel__related-items-notice"><calcite-notice .kind=${this.reviewDecision?"brand":"warning"} icon open><div slot=message>${this.reviewDecision?this.messages.relatedItemsReviewed:e}</div><calcite-button appearance=transparent slot=actions-end @click=${()=>{this.hasReviewedSelectedItems=!0,this.reviewingDirectlyUsedByItems=!0}}>${this.messages.reviewItems}</calcite-button></calcite-notice></div>`}renderDeleteSummary(){return d`<div class="panel__content">${this.isLoading?d`<calcite-scrim loading></calcite-scrim>`:d`<calcite-panel>${this.renderRecycleBucket()}${this.renderDeprecateBucket()}${this.renderExcludeBucket()}${this.renderCannotDeleteBucket()}${this.renderPermanentlyDeleteBucket()}${this.loadedItems.length===1&&this.renderDirectlyUsedByItems()||""}${this.itemsHaveImpactedItems&&d`<div>${this.loadedItems.length>1?this.renderDirectlyUsedByItemsNotice():null}</div>`||""}</calcite-panel>`}</div>${this.itemsNeedReview&&!this.hasReviewedSelectedItems&&d`<div slot=content-bottom class="panel__checkbox-container"><calcite-checkbox class="panel__checkbox" .checked=${this.hasConfirmedReview} @calciteCheckboxChange=${t=>{this.hasConfirmedReview=t.target.checked}} .label=${this.messages.proceedWithDeletion} .labelText=${this.messages.proceedWithDeletion} required></calcite-checkbox></div>`||""}${!this.isLoading&&d`${this.loadedItems.length===1&&N(this.loadedItems[0]).contentStatus!=="deprecated"&&d`<calcite-button slot=footer-start kind=danger appearance=outline-fill .disabled=${!!this.submittingAction} .loading=${this.submittingAction==="deprecate"} @click=${this.handleDeprecate}>${this.messages.deprecateInstead}</calcite-button>`||""}<calcite-button slot=footer-end appearance=outline-fill @click=${this.handleDialogClose}>${this.messages.cancel}</calcite-button>${this.deleteMode!=="none"&&d`<calcite-button .disabled=${!this.deleteButtonEnabled||!!this.submittingAction} .loading=${this.submittingAction==="delete"} kind=danger slot=footer-end @click=${async()=>await this.handleDelete()}>${this.getConfirmButtonText()}</calcite-button>`||""}`||""}`}renderReviewItems(){return d`<div class="panel__content"><calcite-panel><arcgis-portal-delete-items-review .items=${this.itemsWithImpactedItems} .portal=${this.portal} .user=${this.user}></arcgis-portal-delete-items-review></calcite-panel></div><calcite-button slot=footer-start appearance=solid kind=neutral @click=${async()=>await this.handleReviewDecision("exclude")}>${this.messages.exclude}</calcite-button><calcite-button slot=footer-end appearance=outline-fill kind=danger @click=${async()=>await this.handleReviewDecision("deprecate")}>${this.messages.deprecateInstead}</calcite-button><calcite-button slot=footer-end appearance=solid kind=danger @click=${async()=>await this.handleReviewDecision("delete")}>${this.messages.proceedToDelete}</calcite-button>`}renderRecycleBucket(){if(!this.recycleItems||this.recycleItems.length===0)return null;let t=!this.portal.recycleBinEnabled;return this.renderBucket({icon:t?"trash":"recycle-bin",label:t?this.messages.summary.permanentDelete.delete:this.messages.summary.willBeRecycled,description:t?this.messages.summary.permanentDelete.default.single:this.messages.summary.canBeRecovered.single.replace("{days}","14"),updated:this.recycleItems.some(({kind:e,updatedStatus:s})=>s==="recycle"&&s!==e),bucket:this.recycleItems,additionalContent:t?void 0:d`<calcite-checkbox class="bucket__checkbox" .label=${this.messages.permanentlyDeleteInstead} .labelText=${this.messages.permanentlyDeleteInstead} @calciteCheckboxChange=${async e=>await this.handlePermanentlyDeleteOverrideChange(e.target.checked)} ${b(this.permanentlyDeleteCheckboxRef)}></calcite-checkbox>`})}renderDeprecateBucket(){return this.deprecateItems.length===0?null:this.renderBucket({icon:"circle-disallowed",label:this.messages.summary.deprecate.label,description:this.messages.summary.deprecate.message,updated:this.deprecateItems.some(({kind:t,updatedStatus:e})=>e!==t&&e==="deprecate"),bucket:this.deprecateItems})}renderExcludeBucket(){return this.excludeItems.length===0?null:this.renderBucket({icon:"remove-from-list",label:this.messages.summary.exclude.label,description:this.messages.summary.exclude.message,updated:this.excludeItems.some(({kind:t,updatedStatus:e})=>e!==t&&e==="exclude"),bucket:this.excludeItems})}renderCannotDeleteBucket(){if(!this.cannotDeleteItems||this.cannotDeleteItems.length===0)return null;let t=this.cannotDeleteItems?.[0]?.reason,e=this.cannotDeleteItems[0]?.resultData?.length??0,s=this.messages.summary.protectedGroup.hasDependentItemsDescription;return this.renderBucket({icon:"security",label:this.messages.summary.cannotDelete,description:t==="hasDependentItems"?e>1?s.singleMultipleDependentItems:s.singleOneDependentItem:this.messages.summary.protectedGroup.deleteProtectedDescription,bucket:this.cannotDeleteItems,updated:this.cannotDeleteItems.some(({item:r})=>r.id&&this.updatedCannotDeleteItemIds.has(r.id))})}renderPermanentlyDeleteBucket(){if(!this.permanentlyDeleteItems||this.permanentlyDeleteItems.length===0)return null;let t=!this.portal.recycleBinEnabled,e=this.permanentlyDeleteItems.some(s=>this.isPermanentlyDeleteOverrideActive(s));return this.renderBucket({icon:"trash",label:t?this.messages.summary.permanentDelete.delete:this.messages.summary.permanentlyDelete,description:t?this.messages.summary.permanentDelete.default.single:e?null:this.messages.summary.permanentDelete.notSupported.single,link:e?void 0:{href:`${$(this.portal)}${this.helpMap[120004692]||""}`,text:this.fieldDeleteMessages.learnMore??this.messages.moreInfo},bucket:this.permanentlyDeleteItems,dangerIcon:!t,additionalContent:!t&&e?d`<calcite-checkbox class="bucket__checkbox" checked .label=${this.messages.permanentlyDeleteInstead} .labelText=${this.messages.permanentlyDeleteInstead} @calciteCheckboxChange=${async s=>await this.handlePermanentlyDeleteOverrideChange(s.target.checked)} ${b(this.permanentlyDeleteCheckboxRef)}></calcite-checkbox>`:void 0})}render(){let{loadedItems:t,portal:e}=this;return!t||!e?null:d`<calcite-dialog modal .open=${this.active} width=s .heading=${this.getHeaderText()} heading-level=2 outside-close-disabled escape-disabled kind=danger @calciteDialogClose=${this.handleDialogClose}>${!this.isLoading||this.reviewingDirectlyUsedByItems?d`<div slot=heading><span>${this.getHeaderText()}</span><br><span class="header-description">${this.getHeaderDescription()}</span></div>`:void 0}${this.reviewingDirectlyUsedByItems?this.renderReviewItems():this.renderDeleteSummary()}</calcite-dialog>`}};L("arcgis-portal-delete-items",B);return B},"portal/PortalItem","request",a,c,e,g,h,i,j,k)
2
+ import k from"./3SCRMD7A.js";import j from"./HOOOFVRH.js";import i from"./6G6MIY3R.js";import h from"./SQCDEL42.js";import g from"./QKGHH3FS.js";import"./JOUR2FB2.js";import{a as N}from"./4KTRAA2J.js";import"./PKA745KL.js";import"./VDXESPJK.js";import"./DAAON2UO.js";import e from"./TZ6HFMZZ.js";import c from"./TIPQ2ZWK.js";import a from"./C5IKEISI.js";import{a as F,c as $}from"./H7DF6TTK.js";import{c as U}from"./KV4ZZSNW.js";import"./2FKNF2ZK.js";import{a as S}from"./AYHYABMC.js";import{b as E}from"./OQ3OHDEB.js";import"./I57CRKF7.js";import{I as A,J as b,K as P,L as w,N as M,Q as L,h as T,j as d,v as f}from"./3ZC26CT6.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([_,R,{b:v},,,,{a:x},{b:O},,{b:p}])=>{async function q(i,t,e=!1){try{let s=new Map;for(let n of i){let{id:l,owner:c}=n,a=s.get(c)??[];a.push(l),s.set(c,a)}let r=[];for(let[n,l]of s){let c=`${t.restUrl}/content/users/${encodeURIComponent(n)}/deleteItems`;for(let a of O(l,100)){let o=R(c,{method:"post",query:{f:"json",items:a.join(","),permanentDelete:e}});r.push(o.then(({data:m})=>m))}}return{result:(await Promise.all(r)).flatMap(({results:n})=>n)}}catch{return{error:{code:"unhandledError"}}}}async function W(i){let{item:t,portal:e,permanentlyDelete:s}=i,{id:r,owner:n}=t;if(!r||!n)return{error:{code:"unhandledError"}};let l=e.recycleBinEnabled&&!s?"/canRecycle":"/canDelete",c=`${e.restUrl}/content/users/${encodeURIComponent(n)}/items/${r}${l}`;try{return{result:(await R(c,{query:{f:"json"}})).data}}catch(a){let o=a.details?.raw;switch(o?.messageCode){case"CONT_00481":case"CONT_00483":case"CONT_00484":return{error:{code:"itemHasDependentItems"}};case"CONT_0048":return{error:{code:"itemDeleteProtected"}};case"CONT_0298":return{error:{code:"itemNotSupportedInRecycleBin"}};default:return{error:{code:"unhandledError",message:o?.message}}}}}async function Q(i,t){try{let e=`${i.itemUrl}/setContentStatus`;return{result:(await R(e,{query:{status:t??"",clearEmptyFields:!t,f:"json"},method:"post"})).data}}catch(e){return console.error(e),{error:{code:"unhandledError"}}}}function G(i,t){return(i.relatedItems??[]).map(e=>X(e,t))}function X(i,t){return i instanceof _?i:new _({...i,portal:t})}async function y({itemId:i,portal:t,relationship:e,includeRecycleBin:s,nextkey:r}){let{relationshipType:n,direction:l}=e,c=`${t.restUrl}/content/items/${i}/relatedItems`;try{let a=await v({url:c,portal:t,params:{includeRecycleBin:s,f:"json",relationshipType:n?Array.isArray(n)?n.join(","):n:void 0,direction:l,nextkey:r}});return{success:!0,result:{...a,relatedItems:G(a,t)}}}catch(a){return{success:!1,error:a}}}async function Y({itemId:i,portal:t,relationship:e,includeRecycleBin:s,num:r,nextkey:n}){let{relationshipRules:l,direction:c}=e,a=`${t.restUrl}/content/items/${i}/relatedItems`;try{let o=await v({url:a,portal:t,params:{includeRecycleBin:s,f:"json",...l?.length?{relationshipRules:l.join(",")}:{},includeSystemManaged:"true",excludedFlags:"legacy,exclude",num:r,direction:c,nextkey:n}});return{success:!0,result:{...o,relatedItems:G(o,t)}}}catch(o){return{success:!1,error:o}}}async function Z(i,t){let{id:e,type:s,typeKeywords:r=[]}=i;if(!e)return null;let n=["Scene Service","Map Service","WFS","OGCFeatureServer","Vector Tile Service","3DTiles Service"].includes(s),l=["Map Service","Vector Tile Service"].includes(s),c=o=>o?.typeKeywords?.includes("View Service")??!1,a=()=>n?[{relationshipType:["Service2Service"],direction:"reverse"},{relationshipType:["Service2Data"],direction:"forward"}]:r.includes("Bulk Published Service")?{relationshipType:["DataStore2BPService"],direction:"reverse"}:s==="Geoprocessing Service"&&r.includes("Notebook Web Tool")?{relationshipType:["Notebook2WebTool"],direction:"reverse"}:r.includes("Route Layer")?{relationshipType:["Service2Route"],direction:"reverse"}:s==="Mobile Application"?{relationshipType:["MobileApp2Code"],direction:"reverse"}:s==="Map Package"?{relationshipType:["Area2Package"],direction:"reverse"}:s==="Feature Service"?{relationshipType:["Service2Layer"],direction:"reverse"}:r.includes("Document")?{relationshipType:["Item2Attachment"],direction:"reverse"}:s==="Application Configuration"?{relationshipType:["Map2AppConfig"],direction:"reverse"}:{relationshipType:["Service2Data"],direction:"forward"};try{let o=a();if(!o)return null;if(!Array.isArray(o))return{sourceData:(await y({itemId:e,portal:t,relationship:o})).result?.relatedItems?.[0]??null,relationship:o};if(n){let m={relationshipType:["Service2Service"],direction:"reverse"},g=await y({itemId:e,portal:t,relationship:m}),h=g.result?.total?g.result.relatedItems.shift()??null:null;if(l&&!c(h)||!h){m={relationshipType:["Service2Data"],direction:"forward"};let I=await y({itemId:e,portal:t,relationship:m});return{sourceData:I.result?.total?I.result.relatedItems.shift()??h:h,relationship:m}}return{sourceData:h,relationship:m}}return null}catch(o){return console.error(o),{sourceData:null,relationship:{direction:"forward"}}}}async function ee(i,t){let{id:e,type:s,typeKeywords:r=[]}=i;try{let n=s==="Notebook"?{relationshipType:["Notebook2WebTool"],direction:"forward"}:r.includes("Has Related Route Layers")?{relationshipType:["Service2Route"],direction:"forward"}:r.includes("Hosted Service")||s==="Feature Service"?{relationshipType:["Service2Service"],direction:s==="Feed"?"reverse":"forward"}:s==="Data Store"||r.includes("ArcGIS Server")?{relationshipType:["DataStore2BPService"],direction:"forward"}:{relationshipType:["Service2Data"],direction:"reverse"},l=await y({itemId:e,portal:t,relationship:n,includeRecycleBin:!0});return{resultData:{items:l.result?.total?l.result.relatedItems:null,count:l.result?.total??0},relationship:n}}catch(n){return console.error(n),{resultData:{items:null,count:0},relationship:{direction:"forward"}}}}async function te(i,t){let{id:e}=i;try{return(await y({itemId:e,portal:t,relationship:{relationshipType:["ReplacementItem2Item"],direction:"forward"}})).result?.relatedItems??[]}catch(s){return console.error(s),[]}}function se({recycleItems:i,cannotDeleteItems:t,permanentlyDeleteItems:e}){return[...i,...t,...e]}function ie(i){return i.map(({item:t,sourceData:e,resultData:s,replacementItemFor:r})=>({item:t,sourceData:e,resultData:s,replacementItemFor:r}))}function K(i,t,e){return!t&&!!e?.length&&!p(i)}function ne({item:i,sourceData:t,resultData:e}){return!e?.some(s=>!s.inRecycleBin)||K(i,t,e)?!1:!V(i,e)&&!J(i,e)}function re({selectedItems:i}){let t=[];return t.push(...i.flatMap(({item:e,sourceData:s,resultData:r,replacementItemFor:n})=>{let l=K(e,s,r),c=!!(r?.some(a=>!a.inRecycleBin)&&!V(e,r)&&!J(e,r));return l&&c?[{item:e,reason:"dependent",offendingItems:r??void 0}]:n&&n?.length>0?[{item:e,reason:"replacement",offendingItems:n}]:[]})),t}function V(i,t){let e=t[0];return i.type==="Feed"&&p(i)&&t.length===1&&e?.type==="Feature Service"&&p(e)}function J(i,t){let e=t[0];return i.type==="Feature Service"&&p(i)&&t.length===1&&e?.type==="Feed"&&p(e)}function C(i){return i?i.filter(t=>t.type!=="Code Attachment"):null}function H(i){return!!(i&&"inRecycleBin"in i&&i.inRecycleBin===!0)}function u(i){return i.updatedStatus??i.kind}function k(i){return{...i,originalStatus:i.originalStatus??i.kind}}function ae(i,t){return{...i,kind:t,originalStatus:i.originalStatus??i.kind}}async function le(i,t){let e=await W({item:i,portal:t,permanentlyDelete:!1});if(e.error&&e.error.code!=="itemNotSupportedInRecycleBin")return{kind:"cannotDelete",errorCode:e.error.code};if(e.result?.success)return{kind:"recycle"};let s=await W({item:i,portal:t,permanentlyDelete:!0});return s.result?.success?{kind:"permanentlyDelete"}:{kind:"cannotDelete",errorCode:s.error?.code??"unhandledError"}}function ce(i){switch(i){case"itemHasDependentItems":return"hasDependentItems";case"itemDeleteProtected":return"deleteProtected";default:return"uncaught"}}async function oe(i,t){let e=await Y({itemId:i.id,portal:t,relationship:{direction:"forward"}}),s=await Z(i,t),r=await ee(i,t),n=await te(i,t),l=e.result?.relatedItems??[],c=C(l)??[],a=e.result?.aggregations?.total?.count,o=C(r.resultData.items),m=C(n),g=s?.sourceData,h={usedByItems:c,usedByItemsCount:a==null?c.length:Math.max(0,a-(l.length-c.length)),sourceData:g?.type==="Code Attachment"?null:g??null,resultData:o,replacementItemFor:m?.length?m:null},I=ne({item:i,...h}),D=await le(i,t);return D.kind==="cannotDelete"?k({item:i,...h,kind:"cannotDelete",reason:ce(D.errorCode)}):I?k({item:i,...h,kind:"cannotDelete",reason:"hasDependentItems"}):D.kind==="permanentlyDelete"?k({item:i,...h,kind:"permanentlyDelete",reason:"notSupported"}):k({item:i,...h,kind:D.kind})}async function de(i,t){let e=await Promise.all(i.map(async s=>await oe(s,t)));return me(e)}function me(i){let t=new Map;for(let e of i)e.item.id&&t.set(e.item.id,e);return i.map(e=>{if(e.kind!=="cannotDelete"||e.reason!=="hasDependentItems"||!e.item.id)return e;let s=he(e.resultData,t);if(s.length===0)return e;let r=s.every(l=>t.has(l)),n=s.every(l=>!t.get(l)?.item.protected);return r&&n?ae(e,"recycle"):e})}function he(i,t,e=new Set){if(!i?.length)return[];let s=i.filter(n=>!H(n)),r=new Set;for(;s.length>0;){let n=s.shift().id;if(!n||e.has(n))continue;e.add(n),r.add(n);let l=t.get(n)?.resultData??[];s.push(...l.filter(c=>!H(c)))}return[...r]}var ue=T`:host{display:block}calcite-dialog{--calcite-dialog-content-space: 0;--calcite-dialog-background-color: var(--calcite-color-background)}calcite-panel{display:flex;flex-direction:column;gap:.75rem;>*{margin-inline:.75rem}}.panel__content{width:100%;box-sizing:border-box}.single-item-bucket{--calcite-block-background-color: transparent;--calcite-block-border-color: transparent}.bucket__content{display:flex;align-items:flex-start;gap:.75rem;width:100%}.bucket__icon{flex-shrink:0}.bucket__icon--danger{color:var(--calcite-color-status-danger)}.bucket__details{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.bucket__header{font-weight:500}.bucket__label{margin-inline-end:.25rem}.bucket__checkbox{align-self:flex-start;margin-top:.5rem}.bucket__description{line-height:1.35;font-size:var(--calcite-font-size--1)}.bucket__link{display:flex;align-items:center;min-height:1.5rem}.item-link-content{position:relative;>arcgis-portal-item-type{margin-inline-end:.25rem;vertical-align:middle}}.panel__checkbox-container{width:100%;box-sizing:border-box;background-color:var(--calcite-color-foreground-1)}.panel__checkbox{padding-block:.75rem;padding-inline-start:.75rem}.panel__related-items{margin-top:1rem;border:1px solid var(--calcite-color-border-2)}.panel__related-items-icon{color:var(--calcite-color-status-warning)}.panel__related-items-notice{padding-bottom:.75rem}arcgis-portal-review-related-items{margin-bottom:.75rem}calcite-list{overflow:auto;min-block-size:0;max-height:min(250px,75vh)}.discouraged-items-warning{margin-bottom:.75rem}.header-description{font-size:var(--calcite-font-size--1);font-weight:400}`,z=new Map;async function pe(i,t){let e=F(i),s=JSON.stringify([e,t]),r=z.get(s);if(r)return r;try{let n=(await v({url:`${e}portals/helpmap`,portal:i,params:{culture:t}}))?.helpMap?.m??{};return z.set(s,n),n}catch{return{}}}var ge=i=>E((t,e)=>{let s,r;return e.onUpdate(()=>{let n=i.portal(),l=i.language(),c=n?.restUrl;c===s&&l===r||(s=c,r=l,e.exports={},!(!n||!c||!l)&&pe(n,l).then(a=>{e.exports=a}))}),{}});function j({id:i,linkText:t,label:e,placement:s,items:r,portal:n,user:l}){return d`<calcite-link id=${i??M} @keydown=${c=>{if(c.key===" "||c.key==="Enter"){let a=c.currentTarget.nextElementSibling;a&&(a.open=!a.open)}}}>${t}</calcite-link><calcite-popover .label=${e} .referenceElement=${i} .placement=${s} auto-close focus-trap-disabled @keydown=${c=>{if(c.key==="Tab"){let a=c.currentTarget;requestAnimationFrame(()=>{a.open=!1})}}} @calcitePopoverOpen=${c=>{c.currentTarget.querySelector("calcite-list-item")?.setFocus()}}><calcite-list .label=${e} selection-mode=none>${r.map(c=>d`<calcite-list-item .label=${c.title??""} @calciteListItemSelect=${()=>{let a=c.itemPageUrl;a&&window.open(a.replace("sharing/rest/",""),"_blank","noopener,noreferrer")}}><span slot=content-start><arcgis-portal-item-type .item=${c} .portal=${n} .user=${l} hide-text></arcgis-portal-item-type></span><span slot=content>${c.title}</span></calcite-list-item>`)}</calcite-list></calcite-popover>`}var B=class extends P{constructor(){super(...arguments),this.deleteStatusRequestId=0,this.updatedCannotDeleteItemIds=new Set,this.permanentlyDeleteCheckboxRef=A(),this.messages=S({blocking:!0}),this.fieldDeleteMessages=S({name:"portal-field-delete"}),this.helpMap=ge({portal:()=>this.portal,language:()=>this.messages._t9nLocale}),this.isLoading=!0,this.submittingAction=null,this.loadedItems=[],this.hasConfirmedReview=!1,this.hasReviewedSelectedItems=!1,this.cannotDeleteItems=[],this.recycleItems=[],this.permanentlyDeleteItems=[],this.deprecateItems=[],this.excludeItems=[],this.reviewingDirectlyUsedByItems=!1,this.reviewDecision=null,this.active=!0,this.items=[],this.itemIds=[],this.user=null,this.disableLinks=!1,this.arcgisClose=f(),this.arcgisConfirm=f(),this.arcgisError=f()}static{this.properties={isLoading:16,submittingAction:16,loadedItems:16,hasConfirmedReview:16,hasReviewedSelectedItems:16,cannotDeleteItems:16,recycleItems:16,permanentlyDeleteItems:16,deprecateItems:16,excludeItems:16,reviewingDirectlyUsedByItems:16,reviewDecision:16,active:5,items:0,itemIds:0,portal:0,user:0,disableLinks:5}}static{this.styles=ue}willUpdate(t){let e=t.has("items")||t.has("itemIds")||t.has("portal")||t.has("user")||t.has("active");this.active&&e&&(this.user??=this.portal?.user||null,this.resetState(),this.initializeItems(++this.deleteStatusRequestId))}async initializeItems(t){let{items:e,itemIds:s,portal:r}=this,n=e.length?e:await Promise.all(s.map(async l=>await new _({id:l,portal:r}).load()));t===this.deleteStatusRequestId&&(this.loadedItems=n,await this.determineDeleteStatus(t))}async handleReviewDecision(t){let e=this.itemsWithImpactedItems.map(({item:a})=>a),s=t==="delete"?"recycle":t==="deprecate"?"deprecate":"exclude",r=this.permanentlyDeleteItems.filter(a=>this.isPermanentlyDeleteOverrideActive(a)),n=this.permanentlyDeleteItems.filter(a=>!this.isPermanentlyDeleteOverrideActive(a)),l=[...this.recycleItems,...this.deprecateItems,...this.excludeItems,...r],c=t==="delete"&&l.some(a=>u(a)!=="recycle"&&e.some(({id:o})=>o===a.item.id));for(let a of l){if(!e.some(({id:m})=>m===a.item.id))continue;let o=a.originalStatus??a.kind;a.originalStatus=o,a.updatedStatus=s}if(this.reviewDecision={action:t,items:e},this.hasConfirmedReview=!0,this.reviewingDirectlyUsedByItems=!1,this.recycleItems=l.filter(a=>u(a)==="recycle"),this.deprecateItems=l.filter(a=>u(a)==="deprecate"),this.excludeItems=l.filter(a=>u(a)==="exclude"),this.permanentlyDeleteItems=n,t!=="delete"||c){this.isLoading=!0;let a=[...this.cannotDeleteItems,...this.recycleItems,...this.permanentlyDeleteItems].map(({item:o})=>o);await this.determineDeleteStatus(++this.deleteStatusRequestId,a)}}async updateAllContentStatus(t,e){return(await Promise.all(t.map(async s=>await Q(s,e)))).flatMap(({result:s})=>s?[s]:[])}async handleDelete(){if(!this.active||this.submittingAction)return;this.submittingAction="delete";let t={restUrl:this.portal.restUrl},{result:e=[]}=this.recycleItems.length?await q(this.recycleItems.map(({item:n})=>n),t):{result:[]},{result:s=[]}=this.permanentlyDeleteItems.length?await q(this.permanentlyDeleteItems.map(({item:n})=>n),t,!0):{result:[]},r=this.deprecateItems.length?await this.updateAllContentStatus(this.deprecateItems.map(({item:n})=>n),"deprecated"):null;this.arcgisConfirm.emit({deletedItems:e,permanentlyDeletedItems:s,deletedItemsCount:e.length,permanentlyDeletedItemsCount:s.length,deprecatedItems:r}),this.closeDialog()}async handleDeprecate(){if(!this.active||this.submittingAction)return;this.submittingAction="deprecate";let t=[...this.deprecateItems,...this.recycleItems,...this.cannotDeleteItems,...this.permanentlyDeleteItems].filter(Boolean),e=t.length?await this.updateAllContentStatus(t.map(({item:s})=>s),"deprecated"):null;this.arcgisConfirm.emit({deletedItems:null,permanentlyDeletedItems:null,deletedItemsCount:0,permanentlyDeletedItemsCount:0,deprecatedItems:e}),this.closeDialog()}handleDialogClose(){this.active&&this.closeDialog()}closeDialog(){this.active=!1,this.resetState(),this.arcgisClose.emit()}resetState(){this.isLoading=!0,this.submittingAction=null,this.loadedItems=[],this.hasConfirmedReview=!1,this.hasReviewedSelectedItems=!1,this.cannotDeleteItems=[],this.recycleItems=[],this.permanentlyDeleteItems=[],this.deprecateItems=[],this.excludeItems=[],this.reviewingDirectlyUsedByItems=!1,this.reviewDecision=null,this.updatedCannotDeleteItemIds.clear(),++this.deleteStatusRequestId}async determineDeleteStatus(t,e=this.loadedItems){let s=new Set(this.recycleItems.map(({item:n})=>n.id).filter(n=>!!n)),r=await de(e,this.portal);if(t===this.deleteStatusRequestId){this.cannotDeleteItems=r.filter(n=>u(n)==="cannotDelete");for(let n of this.cannotDeleteItems)n.item.id&&s.has(n.item.id)&&this.updatedCannotDeleteItemIds.add(n.item.id);this.recycleItems=r.filter(n=>u(n)==="recycle"),this.permanentlyDeleteItems=r.filter(n=>u(n)==="permanentlyDelete"),this.isLoading=!1}}get itemsWithImpactedItems(){let t=new Set(this.loadedItems.map(({id:e})=>e));return[...this.recycleItems,...this.deprecateItems,...this.excludeItems,...this.permanentlyDeleteItems.filter(e=>this.isPermanentlyDeleteOverrideActive(e))].map(e=>({...e,usedByItems:e.usedByItems.filter(({id:s})=>!t.has(s))})).filter(({usedByItems:e})=>e.length>0)}get itemsHaveImpactedItems(){return this.itemsWithImpactedItems.length>0}get itemsNeedReview(){return this.itemsWithImpactedItems.some(t=>["recycle","permanentlyDelete"].includes(u(t)))}isPermanentlyDeleteOverrideActive(t){return t.kind==="recycle"&&t.updatedStatus==="permanentlyDelete"}async handlePermanentlyDeleteOverrideChange(t){if(t){let e=this.recycleItems.map(s=>({...s,originalStatus:s.originalStatus??s.kind,updatedStatus:"permanentlyDelete"}));this.recycleItems=[],this.permanentlyDeleteItems=[...this.permanentlyDeleteItems,...e]}else{let e=this.permanentlyDeleteItems.filter(s=>this.isPermanentlyDeleteOverrideActive(s));this.permanentlyDeleteItems=this.permanentlyDeleteItems.filter(s=>!this.isPermanentlyDeleteOverrideActive(s)),this.recycleItems=[...this.recycleItems,...e.map(s=>({...s,updatedStatus:"recycle"}))]}await this.updateComplete,await new Promise(e=>requestAnimationFrame(()=>e())),await this.permanentlyDeleteCheckboxRef.value?.setFocus()}get deleteButtonEnabled(){return!this.isLoading&&(!this.itemsNeedReview||this.hasConfirmedReview)}get markedForDeprecation(){return this.reviewDecision?.action==="deprecate"?this.reviewDecision.items:[]}get deleteMode(){return[this.recycleItems,this.deprecateItems,this.excludeItems,this.permanentlyDeleteItems].filter(t=>t.length>0).length>1?"mixed":this.markedForDeprecation.length>0?"deprecate":this.permanentlyDeleteItems.length>0?"permanentlyDelete":this.recycleItems.length>0?"delete":(this.cannotDeleteItems.length>0,"none")}getHeaderText(){return this.reviewingDirectlyUsedByItems?this.messages.reviewItemsCount.replace("{count}",`${this.itemsWithImpactedItems.length}`):this.isLoading?"":this.loadedItems.length>0&&this.permanentlyDeleteItems.length===this.loadedItems.length?this.messages.permanentlyDelete:(this.items.length?this.items:this.itemIds).length===1?this.messages.deleteItem:this.messages.deleteItems}getHeaderDescription(){return this.loadedItems.length<=1?"":this.reviewingDirectlyUsedByItems?this.messages.reviewItemsDescription:this.messages.selectedItems.replace("{count}",`${this.loadedItems.length}`)}getConfirmButtonText(){switch(this.deleteMode){case"mixed":return this.messages.confirm;case"deprecate":return this.messages.deprecate;case"permanentlyDelete":return this.portal.recycleBinEnabled?this.messages.permanentlyDelete:this.messages.delete;case"delete":return this.messages.delete;default:return this.messages.delete}}renderBucket({icon:t,label:e,description:s,link:r,additionalContent:n,dangerIcon:l=!1,bucket:c}){return d`<calcite-block class=${w({"single-item-bucket":(this.items.length?this.items:this.itemIds).length===1})} scale=l expanded><div class="bucket__content"><calcite-icon class=${w({bucket__icon:!0,"bucket__icon--danger":l})} scale=l .icon=${t}></calcite-icon><div class="bucket__details"><div class="bucket__header"><span class="bucket__label">${e}</span><span>${this.renderBucketItems(c)}</span></div>${s&&d`<span class="bucket__description">${s}</span>`||""}${r&&d`<div class="bucket__link"><calcite-link .href=${r.href} target=_blank icon-start=launch>${r.text??this.messages.moreInfo}</calcite-link></div>`||""}${n}</div></div></calcite-block>`}renderBucketItems(t=[]){return this.renderItemLinks(t.map(({item:e})=>e))}renderItemLinks(t,e=`delete-items-bucket-${t.map(({id:s})=>s).join("-")}`){if(t.length===0)return null;if(t.length===1){let s=t[0],r=`${U({portal:this.portal})}/item.html?id=${s.id}`;return d`<calcite-link .href=${r} target=_blank><span class="item-link-content"><arcgis-portal-item-type .item=${s} .portal=${this.portal} .user=${this.user} hide-text></arcgis-portal-item-type><span>${s.title}</span></span></calcite-link>`}return j({id:e,linkText:t.length,label:this.messages.bucketItems.replace("{count}",String(t.length)),placement:"bottom-start",items:t,portal:this.portal,user:this.user})}renderRelatedItemsPopover(t){let e=t.flatMap(({usedByItems:s})=>s);return t.length>1||e.length===0?null:j({id:"delete-items-directly-used-by",linkText:x(this.messages._t9nLocale,this.messages.usedByOtherItems,e.length),label:this.messages.usedByPopover,placement:"auto",items:e,portal:this.portal,user:this.user})}renderDirectlyUsedByItems(){let t=se({recycleItems:this.recycleItems,cannotDeleteItems:this.cannotDeleteItems,permanentlyDeleteItems:this.permanentlyDeleteItems}),e=this.cannotDeleteItems.find(({reason:o})=>o==="hasDependentItems"),s=e?e.resultData??[]:t.flatMap(({usedByItems:o})=>o),r=e?s.length:t[0]?.usedByItemsCount,n=re({selectedItems:ie(t)}),l=n.find(({reason:o})=>o==="replacement"),c=l?.offendingItems??[],a=x(this.messages._t9nLocale,this.messages.replacementItem.isReplacementFor,c.length,{itemLink:"{itemLink}"});return d`${this.loadedItems.length===1&&["delete","permanentlyDelete"].includes(this.deleteMode)&&n.length>0?d`<div class="discouraged-items-warning"><calcite-notice kind=warning open><div slot=message>${l?a.split("{itemLink}").map((o,m)=>d`${m>0&&this.renderItemLinks(c,"delete-items-replacement-for")||""}${o}`):this.messages.deleteDiscouraged}</div>${!l&&d`<calcite-link .href=${`${$(this.portal)}${this.helpMap[120001208]||""}`} icon-end=launch slot=link>${this.messages.learnMoreAboutDeletingSourceItems}</calcite-link>`||""}</calcite-notice></div>`:null}${!this.cannotDeleteItems.some(({reason:o})=>o==="deleteProtected")&&d`<arcgis-portal-review-related-items .sourceItem=${this.loadedItems[0]??null} .relatedItems=${s} .relatedItemsCount=${r} .showDependentItems=${!!e} .portal=${this.portal} .user=${this.user}></arcgis-portal-review-related-items>`||""}`}renderDirectlyUsedByItemsNotice(){let t=new Set(this.itemsWithImpactedItems.flatMap(({usedByItems:s})=>s.map(({id:r})=>r))),e=this.messages.reviewRelatedItems.multiple.replace("{totalCount}",String(t.size));return d`<div class="panel__related-items-notice"><calcite-notice .kind=${this.reviewDecision?"brand":"warning"} icon open><div slot=message>${this.reviewDecision?this.messages.relatedItemsReviewed:e}</div><calcite-button appearance=transparent slot=actions-end @click=${()=>{this.hasReviewedSelectedItems=!0,this.reviewingDirectlyUsedByItems=!0}}>${this.messages.reviewItems}</calcite-button></calcite-notice></div>`}renderDeleteSummary(){return d`<div class="panel__content">${this.isLoading?d`<calcite-scrim loading></calcite-scrim>`:d`<calcite-panel>${this.renderRecycleBucket()}${this.renderDeprecateBucket()}${this.renderExcludeBucket()}${this.renderCannotDeleteBucket()}${this.renderPermanentlyDeleteBucket()}${this.loadedItems.length===1&&this.renderDirectlyUsedByItems()||""}${this.itemsHaveImpactedItems&&d`<div>${this.loadedItems.length>1?this.renderDirectlyUsedByItemsNotice():null}</div>`||""}</calcite-panel>`}</div>${this.itemsNeedReview&&!this.hasReviewedSelectedItems&&d`<div slot=content-bottom class="panel__checkbox-container"><calcite-checkbox class="panel__checkbox" .checked=${this.hasConfirmedReview} @calciteCheckboxChange=${t=>{this.hasConfirmedReview=t.target.checked}} .label=${this.messages.proceedWithDeletion} .labelText=${this.messages.proceedWithDeletion} required></calcite-checkbox></div>`||""}${!this.isLoading&&d`${this.loadedItems.length===1&&N(this.loadedItems[0]).contentStatus!=="deprecated"&&d`<calcite-button slot=footer-start kind=danger appearance=outline-fill .disabled=${!!this.submittingAction} .loading=${this.submittingAction==="deprecate"} @click=${this.handleDeprecate}>${this.messages.deprecateInstead}</calcite-button>`||""}<calcite-button slot=footer-end appearance=outline-fill @click=${this.handleDialogClose}>${this.messages.cancel}</calcite-button>${this.deleteMode!=="none"&&d`<calcite-button .disabled=${!this.deleteButtonEnabled||!!this.submittingAction} .loading=${this.submittingAction==="delete"} kind=danger slot=footer-end @click=${async()=>await this.handleDelete()}>${this.getConfirmButtonText()}</calcite-button>`||""}`||""}`}renderReviewItems(){return d`<div class="panel__content"><calcite-panel><arcgis-portal-delete-items-review .items=${this.itemsWithImpactedItems} .portal=${this.portal} .user=${this.user}></arcgis-portal-delete-items-review></calcite-panel></div><calcite-button slot=footer-start appearance=solid kind=neutral @click=${async()=>await this.handleReviewDecision("exclude")}>${this.messages.exclude}</calcite-button><calcite-button slot=footer-end appearance=outline-fill kind=danger @click=${async()=>await this.handleReviewDecision("deprecate")}>${this.messages.deprecateInstead}</calcite-button><calcite-button slot=footer-end appearance=solid kind=danger @click=${async()=>await this.handleReviewDecision("delete")}>${this.messages.proceedToDelete}</calcite-button>`}renderRecycleBucket(){if(!this.recycleItems||this.recycleItems.length===0)return null;let t=!this.portal.recycleBinEnabled;return this.renderBucket({icon:t?"trash":"recycle-bin",label:t?this.messages.summary.permanentDelete.delete:this.messages.summary.willBeRecycled,description:t?this.messages.summary.permanentDelete.default.single:this.messages.summary.canBeRecovered.single.replace("{days}","14"),updated:this.recycleItems.some(({kind:e,updatedStatus:s})=>s==="recycle"&&s!==e),bucket:this.recycleItems,additionalContent:t?void 0:d`<calcite-checkbox class="bucket__checkbox" .label=${this.messages.permanentlyDeleteInstead} .labelText=${this.messages.permanentlyDeleteInstead} @calciteCheckboxChange=${async e=>await this.handlePermanentlyDeleteOverrideChange(e.target.checked)} ${b(this.permanentlyDeleteCheckboxRef)}></calcite-checkbox>`})}renderDeprecateBucket(){return this.deprecateItems.length===0?null:this.renderBucket({icon:"circle-disallowed",label:this.messages.summary.deprecate.label,description:this.messages.summary.deprecate.message,updated:this.deprecateItems.some(({kind:t,updatedStatus:e})=>e!==t&&e==="deprecate"),bucket:this.deprecateItems})}renderExcludeBucket(){return this.excludeItems.length===0?null:this.renderBucket({icon:"remove-from-list",label:this.messages.summary.exclude.label,description:this.messages.summary.exclude.message,updated:this.excludeItems.some(({kind:t,updatedStatus:e})=>e!==t&&e==="exclude"),bucket:this.excludeItems})}renderCannotDeleteBucket(){if(!this.cannotDeleteItems||this.cannotDeleteItems.length===0)return null;let t=this.cannotDeleteItems?.[0]?.reason,e=this.cannotDeleteItems[0]?.resultData?.length??0,s=this.messages.summary.protectedGroup.hasDependentItemsDescription;return this.renderBucket({icon:"security",label:this.messages.summary.cannotDelete,description:t==="hasDependentItems"?e>1?s.singleMultipleDependentItems:s.singleOneDependentItem:this.messages.summary.protectedGroup.deleteProtectedDescription,bucket:this.cannotDeleteItems,updated:this.cannotDeleteItems.some(({item:r})=>r.id&&this.updatedCannotDeleteItemIds.has(r.id))})}renderPermanentlyDeleteBucket(){if(!this.permanentlyDeleteItems||this.permanentlyDeleteItems.length===0)return null;let t=!this.portal.recycleBinEnabled,e=this.permanentlyDeleteItems.some(s=>this.isPermanentlyDeleteOverrideActive(s));return this.renderBucket({icon:"trash",label:t?this.messages.summary.permanentDelete.delete:this.messages.summary.permanentlyDelete,description:t?this.messages.summary.permanentDelete.default.single:e?null:this.messages.summary.permanentDelete.notSupported.single,link:e?void 0:{href:`${$(this.portal)}${this.helpMap[120004692]||""}`,text:this.fieldDeleteMessages.learnMore??this.messages.moreInfo},bucket:this.permanentlyDeleteItems,dangerIcon:!t,additionalContent:!t&&e?d`<calcite-checkbox class="bucket__checkbox" checked .label=${this.messages.permanentlyDeleteInstead} .labelText=${this.messages.permanentlyDeleteInstead} @calciteCheckboxChange=${async s=>await this.handlePermanentlyDeleteOverrideChange(s.target.checked)} ${b(this.permanentlyDeleteCheckboxRef)}></calcite-checkbox>`:void 0})}render(){let{loadedItems:t,portal:e}=this;return!t||!e?null:d`<calcite-dialog modal .open=${this.active} width=s .heading=${this.getHeaderText()} heading-level=2 outside-close-disabled escape-disabled kind=danger @calciteDialogClose=${this.handleDialogClose}>${!this.isLoading||this.reviewingDirectlyUsedByItems?d`<div slot=heading><span>${this.getHeaderText()}</span><br><span class="header-description">${this.getHeaderDescription()}</span></div>`:void 0}${this.reviewingDirectlyUsedByItems?this.renderReviewItems():this.renderDeleteSummary()}</calcite-dialog>`}};L("arcgis-portal-delete-items",B);return B},"portal/PortalItem","request",a,c,e,g,h,i,j,k)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import b from"./TGCJUIEL.js";import a from"./TIPQ2ZWK.js";import{a as o}from"./YZTBAUIO.js";import{a as h}from"./FJ3I3AJE.js";import"./I6WGLIEC.js";import"./K2XSYDAP.js";import{L as n,R as r,h as c,j as e}from"./AICPYLWE.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([{c:f,d:d},{f:v}])=>{var C=c`.select-favorite-label{display:flex;justify-content:space-between;align-items:center}.favorite-actions{display:flex;justify-content:flex-end;gap:1.5rem;align-items:center}.classification-favorite-dialog{--calcite-dialog-content-space: 0;--calcite-dialog-background-color: "var(--calcite-color-foreground-2)"}.save-new-favorite-button{display:flex;justify-content:flex-end;margin-top:.25rem;margin-bottom:1rem}.classification-favorite-item{display:flex;justify-content:space-between;padding-top:.5rem;padding-bottom:.5rem;border-bottom:1px solid var(--calcite-color-border-1)}.classification-favorite-list,.classification-favorite-input-section{margin:1.75rem 1rem}`,l=class extends n{constructor(){super(...arguments),this.messages=h(),this.selectFavoriteClassification=i=>{let a=i.target.value;if(a){this.hasUpdateError=!1;let t=this.favoriteClassifications.find(({name:s})=>s===a);t&&this.updateClassificationData(t)}},this.uploadFavoriteClassificationValueHandle=async i=>{let a=await d(this.portalItem,this.favoriteClassifications);if(this.renderFavoriteClassificationError({alertIndicatorType:"success",alertIndicatorIcon:"check",alertIndicatorInfo:i}),a){let{result:t,error:s}=a;if(s){console.error(s),this.renderFavoriteClassificationError({alertIndicatorType:"danger",alertIndicatorIcon:"exclamation-mark-triangle",alertIndicatorInfo:this.messages.uploadClassificationFavoriteError??"Failed to upload classification favorites"});return}t&&this.renderFavoriteClassificationError({alertIndicatorType:"success",alertIndicatorIcon:"check",alertIndicatorInfo:i})}},this.retrieveFavoriteClassificationHandle=async()=>{let i=await f(this.portalItem);if(i){let{result:a,error:t}=i;if(t){console.error(t),this.renderFavoriteClassificationError({alertIndicatorType:"danger",alertIndicatorIcon:"exclamation-mark-triangle",alertIndicatorInfo:this.messages.retrieveClassificationFavoriteError??"Failed to retrieve classification favorites"});return}a&&this.resetFavoriteClassification(a.favorites)}},this.changeFavoriteClassificationName=i=>{let a=i.target.value;this.newFavoriteClassificationName=a,this.hasDuplicatedClassificationError=this.favoriteClassifications.some(t=>t.name===a)},this.saveNewFavoriteClassification=async()=>{let i=this.newFavoriteClassificationName;if(this.favoriteClassifications.some(s=>s.name===i)){this.hasDuplicatedClassificationError=!0;return}if(!i)return;let a=this.deleteNonEnabledAttributes(),t={name:i,classification:a};this.favoriteClassifications=[...this.favoriteClassifications,t],await this.uploadFavoriteClassificationValueHandle(this.messages.addClassificationFavoriteSuccessMessage??"Classification Favorite added successfully"),await this.retrieveFavoriteClassificationHandle(),this.showSaveClassificationDialog=!1},this.updateFavoriteClassification=async()=>{if(!this.selectedFavoriteClassificationName){this.hasUpdateError=!0;return}await this.addFavoriteClassification(this.selectedFavoriteClassificationName),await this.retrieveFavoriteClassificationHandle()},this.deleteNonEnabledAttributes=()=>{let i=structuredClone(this.portalItem?.classification??{}),a=Object.fromEntries(Object.entries(i).filter(([t])=>this.attributeExpressionResults?.get(t)?.enabled!==!1));return{...a,...v(this.portalItem,a)}},this.addFavoriteClassification=async i=>{let a=this.deleteNonEnabledAttributes(),t={name:i,classification:a},s=this.favoriteClassifications.findIndex(m=>m.name===i);s>=0?this.favoriteClassifications[s].classification=a:this.favoriteClassifications=[...this.favoriteClassifications,t],await this.uploadFavoriteClassificationValueHandle(this.messages.updateClassificationFavoriteSuccessMessage??"Classification Favorite updated successfully")},this.removeFavoriteClassification=async i=>{this.favoriteClassifications=this.favoriteClassifications.filter(a=>a.name!==i),this.favoriteClassifications.length===0&&(this.showManageClassificationDialog=!1),await this.uploadFavoriteClassificationValueHandle(this.messages.removeClassificationFavoriteSuccessMessage??"Classification Favorite removed successfully"),await this.retrieveFavoriteClassificationHandle()},this.newFavoriteClassificationName="",this.showManageClassificationDialog=!1,this.showSaveClassificationDialog=!1,this.hasDuplicatedClassificationError=!1,this.hasUpdateError=!1,this.alertIndicator={alertIndicatorType:"danger",alertIndicatorIcon:"exclamation-mark-triangle",alertIndicatorInfo:""},this.isNotificationModalActive=!1,this.favoriteClassifications=[],this.selectedFavoriteClassificationName="",this.resetFavoriteClassification=()=>{},this.updateClassificationData=()=>{},this.renderFavoriteClassificationError=i=>{let{alertIndicatorType:a,alertIndicatorIcon:t,alertIndicatorInfo:s}=i;return e`<calcite-alert .icon=${t} .label=${this.messages.classificationNotificationHandler??"Classification notification handler"} auto-close-duration=medium open .kind=${a} @calciteAlertClose=${()=>this.alertIndicator===null}><div slot=message>${s}</div></calcite-alert>`}}static{this.properties={newFavoriteClassificationName:16,showManageClassificationDialog:16,showSaveClassificationDialog:16,hasDuplicatedClassificationError:16,hasUpdateError:16,alertIndicator:16,isNotificationModalActive:16,portalItem:0,classificationValue:0,favoriteClassifications:0,selectedFavoriteClassificationName:1,attributeExpressionResults:0,resetFavoriteClassification:0,updateClassificationData:0}}static{this.styles=C}load(){this.newFavoriteClassificationName=this.classificationValue?.banner??""}onOpenFavoriteClassificationModal(){this.newFavoriteClassificationName=this.classificationValue?.banner??"",this.showSaveClassificationDialog=!0}getValidationMessage(){return this.newFavoriteClassificationName?this.hasDuplicatedClassificationError?this.messages.duplicatedClassificationError:"":this.messages.emptyFavoriteError}render(){return e`<div>${this.favoriteClassifications.length>0?e`<div><calcite-label><div class="select-favorite-label">${this.messages.applyClassificationFavoriteLabel}<calcite-link @click=${()=>this.showManageClassificationDialog=!0}>${this.messages.manageClassificationFavoriteBtn}</calcite-link></div><calcite-combobox label=select-calcite-combobox selection-mode=single .placeholder=${this.messages.selectFavoritePlaceholder} placeholder-icon=folder-star @calciteComboboxChange=${this.selectFavoriteClassification} .status=${this.hasUpdateError?"invalid":"idle"} .validationIcon=${this.hasUpdateError?"exclamation-mark-triangle":void 0} .validationMessage=${this.hasUpdateError?this.messages.updateWarning:""}>${o(this.favoriteClassifications,({name:i})=>i,({name:i})=>e`<calcite-combobox-item .selected=${this.selectedFavoriteClassificationName===i} icon=folder-star .value=${i} .heading=${i}></calcite-combobox-item>`)}</calcite-combobox></calcite-label><div class="favorite-actions"><calcite-link icon-start=refresh @click=${this.updateFavoriteClassification}>${this.messages.updateClassificationFavoriteBtn}</calcite-link><calcite-link icon-start=star @click=${this.onOpenFavoriteClassificationModal}>${this.messages.saveNewClassificationBtn}</calcite-link></div></div>`:e`<div class="save-new-favorite-button"><calcite-link icon-start=folder-star @click=${this.onOpenFavoriteClassificationModal}>${this.messages.saveNewClassificationFavoriteBtn}</calcite-link></div>`}<calcite-dialog class="classification-favorite-dialog" overlay-positioning=fixed .heading=${this.messages.manageClassificationFavoriteLabel} .open=${this.showManageClassificationDialog} modal placement=center scale=m outside-close-disabled @calciteDialogClose=${()=>this.showManageClassificationDialog=!1}><calcite-list class="classification-favorite-list" .label=${this.messages.classificationFavoriteListLabel??"Classification Favorite list label"} selection-appearance=border selection-mode=single-persist>${o(this.favoriteClassifications,({name:i})=>i,({name:i})=>e`<calcite-list-item .label=${i} .value=${i} class="classification-favorite-item"><div slot=content-end><calcite-icon icon=trash scale=s @click=${async()=>await this.removeFavoriteClassification(i)}></calcite-icon></div></calcite-list-item>`)}</calcite-list><calcite-button slot=footer-end scale=l @click=${()=>this.showManageClassificationDialog=!1}><div>${this.messages.favoriteClassificationBtnDone}</div></calcite-button></calcite-dialog><calcite-dialog class="classification-favorite-dialog" overlay-positioning=fixed .heading=${this.messages.addFavoriteDialogHeading} .open=${this.showSaveClassificationDialog} modal placement=center scale=m outside-close-disabled @calciteDialogClose=${()=>this.showSaveClassificationDialog=!1}><calcite-label class="classification-favorite-input-section">${this.messages.addClassificationFavorite}<calcite-input id=classification-favorite-name name=classification-favorite-name scale=m .value=${this.newFavoriteClassificationName} @calciteInputInput=${this.changeFavoriteClassificationName} .status=${!this.newFavoriteClassificationName||this.hasDuplicatedClassificationError?"invalid":"idle"} validation-icon=exclamation-mark-triangle .validationMessage=${this.getValidationMessage()}></calcite-input></calcite-label><calcite-button scale=l slot=footer-end @click=${this.saveNewFavoriteClassification}>${this.messages.favoriteClassificationBtnDone}</calcite-button></calcite-dialog></div>`}};r("arcgis-portal-classification-favorite",l);return l},a,b)
2
+ import b from"./TGCJUIEL.js";import a from"./TIPQ2ZWK.js";import{a as o}from"./YTVLEHJT.js";import{a as h}from"./AYHYABMC.js";import"./OQ3OHDEB.js";import"./I57CRKF7.js";import{K as n,Q as r,h as c,j as e}from"./3ZC26CT6.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([{c:f,d:d},{f:v}])=>{var C=c`.select-favorite-label{display:flex;justify-content:space-between;align-items:center}.favorite-actions{display:flex;justify-content:flex-end;gap:1.5rem;align-items:center}.classification-favorite-dialog{--calcite-dialog-content-space: 0;--calcite-dialog-background-color: "var(--calcite-color-foreground-2)"}.save-new-favorite-button{display:flex;justify-content:flex-end;margin-top:.25rem;margin-bottom:1rem}.classification-favorite-item{display:flex;justify-content:space-between;padding-top:.5rem;padding-bottom:.5rem;border-bottom:1px solid var(--calcite-color-border-1)}.classification-favorite-list,.classification-favorite-input-section{margin:1.75rem 1rem}`,l=class extends n{constructor(){super(...arguments),this.messages=h(),this.selectFavoriteClassification=i=>{let a=i.target.value;if(a){this.hasUpdateError=!1;let t=this.favoriteClassifications.find(({name:s})=>s===a);t&&this.updateClassificationData(t)}},this.uploadFavoriteClassificationValueHandle=async i=>{let a=await d(this.portalItem,this.favoriteClassifications);if(this.renderFavoriteClassificationError({alertIndicatorType:"success",alertIndicatorIcon:"check",alertIndicatorInfo:i}),a){let{result:t,error:s}=a;if(s){console.error(s),this.renderFavoriteClassificationError({alertIndicatorType:"danger",alertIndicatorIcon:"exclamation-mark-triangle",alertIndicatorInfo:this.messages.uploadClassificationFavoriteError??"Failed to upload classification favorites"});return}t&&this.renderFavoriteClassificationError({alertIndicatorType:"success",alertIndicatorIcon:"check",alertIndicatorInfo:i})}},this.retrieveFavoriteClassificationHandle=async()=>{let i=await f(this.portalItem);if(i){let{result:a,error:t}=i;if(t){console.error(t),this.renderFavoriteClassificationError({alertIndicatorType:"danger",alertIndicatorIcon:"exclamation-mark-triangle",alertIndicatorInfo:this.messages.retrieveClassificationFavoriteError??"Failed to retrieve classification favorites"});return}a&&this.resetFavoriteClassification(a.favorites)}},this.changeFavoriteClassificationName=i=>{let a=i.target.value;this.newFavoriteClassificationName=a,this.hasDuplicatedClassificationError=this.favoriteClassifications.some(t=>t.name===a)},this.saveNewFavoriteClassification=async()=>{let i=this.newFavoriteClassificationName;if(this.favoriteClassifications.some(s=>s.name===i)){this.hasDuplicatedClassificationError=!0;return}if(!i)return;let a=this.deleteNonEnabledAttributes(),t={name:i,classification:a};this.favoriteClassifications=[...this.favoriteClassifications,t],await this.uploadFavoriteClassificationValueHandle(this.messages.addClassificationFavoriteSuccessMessage??"Classification Favorite added successfully"),await this.retrieveFavoriteClassificationHandle(),this.showSaveClassificationDialog=!1},this.updateFavoriteClassification=async()=>{if(!this.selectedFavoriteClassificationName){this.hasUpdateError=!0;return}await this.addFavoriteClassification(this.selectedFavoriteClassificationName),await this.retrieveFavoriteClassificationHandle()},this.deleteNonEnabledAttributes=()=>{let i=structuredClone(this.portalItem?.classification??{}),a=Object.fromEntries(Object.entries(i).filter(([t])=>this.attributeExpressionResults?.get(t)?.enabled!==!1));return{...a,...v(this.portalItem,a)}},this.addFavoriteClassification=async i=>{let a=this.deleteNonEnabledAttributes(),t={name:i,classification:a},s=this.favoriteClassifications.findIndex(m=>m.name===i);s>=0?this.favoriteClassifications[s].classification=a:this.favoriteClassifications=[...this.favoriteClassifications,t],await this.uploadFavoriteClassificationValueHandle(this.messages.updateClassificationFavoriteSuccessMessage??"Classification Favorite updated successfully")},this.removeFavoriteClassification=async i=>{this.favoriteClassifications=this.favoriteClassifications.filter(a=>a.name!==i),this.favoriteClassifications.length===0&&(this.showManageClassificationDialog=!1),await this.uploadFavoriteClassificationValueHandle(this.messages.removeClassificationFavoriteSuccessMessage??"Classification Favorite removed successfully"),await this.retrieveFavoriteClassificationHandle()},this.newFavoriteClassificationName="",this.showManageClassificationDialog=!1,this.showSaveClassificationDialog=!1,this.hasDuplicatedClassificationError=!1,this.hasUpdateError=!1,this.alertIndicator={alertIndicatorType:"danger",alertIndicatorIcon:"exclamation-mark-triangle",alertIndicatorInfo:""},this.isNotificationModalActive=!1,this.favoriteClassifications=[],this.selectedFavoriteClassificationName="",this.resetFavoriteClassification=()=>{},this.updateClassificationData=()=>{},this.renderFavoriteClassificationError=i=>{let{alertIndicatorType:a,alertIndicatorIcon:t,alertIndicatorInfo:s}=i;return e`<calcite-alert .icon=${t} .label=${this.messages.classificationNotificationHandler??"Classification notification handler"} auto-close-duration=medium open .kind=${a} @calciteAlertClose=${()=>this.alertIndicator===null}><div slot=message>${s}</div></calcite-alert>`}}static{this.properties={newFavoriteClassificationName:16,showManageClassificationDialog:16,showSaveClassificationDialog:16,hasDuplicatedClassificationError:16,hasUpdateError:16,alertIndicator:16,isNotificationModalActive:16,portalItem:0,classificationValue:0,favoriteClassifications:0,selectedFavoriteClassificationName:1,attributeExpressionResults:0,resetFavoriteClassification:0,updateClassificationData:0}}static{this.styles=C}load(){this.newFavoriteClassificationName=this.classificationValue?.banner??""}onOpenFavoriteClassificationModal(){this.newFavoriteClassificationName=this.classificationValue?.banner??"",this.showSaveClassificationDialog=!0}getValidationMessage(){return this.newFavoriteClassificationName?this.hasDuplicatedClassificationError?this.messages.duplicatedClassificationError:"":this.messages.emptyFavoriteError}render(){return e`<div>${this.favoriteClassifications.length>0?e`<div><calcite-label><div class="select-favorite-label">${this.messages.applyClassificationFavoriteLabel}<calcite-link @click=${()=>this.showManageClassificationDialog=!0}>${this.messages.manageClassificationFavoriteBtn}</calcite-link></div><calcite-combobox label=select-calcite-combobox selection-mode=single .placeholder=${this.messages.selectFavoritePlaceholder} placeholder-icon=folder-star @calciteComboboxChange=${this.selectFavoriteClassification} .status=${this.hasUpdateError?"invalid":"idle"} .validationIcon=${this.hasUpdateError?"exclamation-mark-triangle":void 0} .validationMessage=${this.hasUpdateError?this.messages.updateWarning:""}>${o(this.favoriteClassifications,({name:i})=>i,({name:i})=>e`<calcite-combobox-item .selected=${this.selectedFavoriteClassificationName===i} icon=folder-star .value=${i} .heading=${i}></calcite-combobox-item>`)}</calcite-combobox></calcite-label><div class="favorite-actions"><calcite-link icon-start=refresh @click=${this.updateFavoriteClassification}>${this.messages.updateClassificationFavoriteBtn}</calcite-link><calcite-link icon-start=star @click=${this.onOpenFavoriteClassificationModal}>${this.messages.saveNewClassificationBtn}</calcite-link></div></div>`:e`<div class="save-new-favorite-button"><calcite-link icon-start=folder-star @click=${this.onOpenFavoriteClassificationModal}>${this.messages.saveNewClassificationFavoriteBtn}</calcite-link></div>`}<calcite-dialog class="classification-favorite-dialog" overlay-positioning=fixed .heading=${this.messages.manageClassificationFavoriteLabel} .open=${this.showManageClassificationDialog} modal placement=center scale=m outside-close-disabled @calciteDialogClose=${()=>this.showManageClassificationDialog=!1}><calcite-list class="classification-favorite-list" .label=${this.messages.classificationFavoriteListLabel??"Classification Favorite list label"} selection-appearance=border selection-mode=single-persist>${o(this.favoriteClassifications,({name:i})=>i,({name:i})=>e`<calcite-list-item .label=${i} .value=${i} class="classification-favorite-item"><div slot=content-end><calcite-icon icon=trash scale=s @click=${async()=>await this.removeFavoriteClassification(i)}></calcite-icon></div></calcite-list-item>`)}</calcite-list><calcite-button slot=footer-end scale=l @click=${()=>this.showManageClassificationDialog=!1}><div>${this.messages.favoriteClassificationBtnDone}</div></calcite-button></calcite-dialog><calcite-dialog class="classification-favorite-dialog" overlay-positioning=fixed .heading=${this.messages.addFavoriteDialogHeading} .open=${this.showSaveClassificationDialog} modal placement=center scale=m outside-close-disabled @calciteDialogClose=${()=>this.showSaveClassificationDialog=!1}><calcite-label class="classification-favorite-input-section">${this.messages.addClassificationFavorite}<calcite-input id=classification-favorite-name name=classification-favorite-name scale=m .value=${this.newFavoriteClassificationName} @calciteInputInput=${this.changeFavoriteClassificationName} .status=${!this.newFavoriteClassificationName||this.hasDuplicatedClassificationError?"invalid":"idle"} validation-icon=exclamation-mark-triangle .validationMessage=${this.getValidationMessage()}></calcite-input></calcite-label><calcite-button scale=l slot=footer-end @click=${this.saveNewFavoriteClassification}>${this.messages.favoriteClassificationBtnDone}</calcite-button></calcite-dialog></div>`}};r("arcgis-portal-classification-favorite",l);return l},a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{a as F}from"./GUL7EIJ4.js";import e from"./6G6MIY3R.js";import{a as g,b as U,c as _}from"./SRWFOV5W.js";import"./JOUR2FB2.js";import{a as R,c as v}from"./MSSJRDR7.js";import"./VDXESPJK.js";import"./DAAON2UO.js";import c from"./TZ6HFMZZ.js";import b from"./TIPQ2ZWK.js";import{a as E}from"./TWCJJCPC.js";import a from"./C5IKEISI.js";import"./H7DF6TTK.js";import"./KV4ZZSNW.js";import"./2FKNF2ZK.js";import{c as L}from"./I6WGLIEC.js";import"./K2XSYDAP.js";import{J as S,K as y,L as k,M as w,R as P,h as T,j as o,w as d}from"./AICPYLWE.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([{a:C},,{b:D},{d:O}])=>{async function Q(n,e={}){return await n.queryGroups(e)}var N=n=>g.includes(n)?n:"@",V=L(n=>{let e=[],a=async s=>await C({requester:async()=>await O(n.portal,s,{num:3}),key:"items",id:s}),l=async s=>await C({requester:async()=>await Q(n.portal,{query:`title:${s}`,num:3}),key:"groups",id:s}),i=F(async(s,t)=>{n.isFetchingEntities=!0;let r=s.toLowerCase();switch(N(t)){case"@":let h=10;n.filteredItemsInfo={type:"user",items:e.filter(c=>c.username?.toLowerCase().includes(r)||c.fullName?.toLowerCase().includes(r)).slice(0,h)};break;case"#":let{result:u}=await a(r);n.filteredItemsInfo={type:"item",items:u?.results??[]};break;case"$":let{results:m}=await l(r);n.filteredItemsInfo={type:"group",items:m};break}(n.filteredItemsInfo?.items?.length??0)===0&&await n.closePopover(),n.isFetchingEntities=!1},400);return{fetchUsers:async()=>{try{let{users:s}=await D(n.portal);e=s??[]}catch(s){e=[],console.error("error fetching org users:",s)}},filterItems:i,getItemText:(s,t)=>{let r="";switch(N(t)){case"@":r=s.username;break;case"#":r=s.title??"";break;case"$":r=s.title??"";break}return r.trim()}}}),A=({id:n,label:e,selected:a,description:l,contentStart:i,onSelect:s})=>E(n,o`<calcite-list-item class=${w({selected:a})} .label=${e} .description=${l} .selected=${a} @pointerdown=${async t=>{t.preventDefault(),t.stopPropagation(),await s()}} ${y(t=>{a&&t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})})}>${i}</calcite-list-item>`),G=T`.selected{--calcite-list-background-color: var(--calcite-color-foreground-2)}.mentionable-list{max-height:13rem;overflow-y:auto;padding:.25rem;width:min(100vw,24rem)}.mentionable-list--loading{min-height:10rem}`,M=class extends k{constructor(){super(...arguments),this.calciteTextAreaRef=S(),this.mentionableEntityController=V(this),this.handleInput=e=>{let{bubbleNewValueChange:a,checkForMention:l}=this,i=e.target.value;i||v(this.el),this._value=i,a(this._value);let s=this.nativeTextAreaRef?.selectionStart??0;l(i,s)},this.handleKeyDown=e=>{if(!this.popoverOpen){this.arcgisUserMentionableTextAreaKeyDown.emit(e),this.arcgisMentionableTextAreaKeyDown.emit(e);return}switch(e.key){case"ArrowDown":e.preventDefault(),this.selectedItemIndex=Math.min(this.selectedItemIndex+1,this.filteredItems.length-1);break;case"ArrowUp":e.preventDefault(),this.selectedItemIndex=Math.max(this.selectedItemIndex-1,0);break;case"Enter":e.preventDefault(),this.selectItem(this.filteredItems[this.selectedItemIndex]);break;case"Escape":e.preventDefault(),this.closePopover.bind(this)();break}},this.handleClosePopover=()=>{this.popoverOpen=!1,this.currentMentionQuery="",this.selectedItemIndex=0,this.currentStarter=null},this.bubbleNewValueChange=e=>{this.arcgisUserMentionableTextAreaChange.emit(e),this.arcgisMentionableTextAreaChange.emit(e)},this.checkForMention=(e,a)=>{let l=e.substring(0,a),i=_(l,this.starters??g);if(i){let{starter:s}=i;this.currentStarter=s,this.filterMentionItems(i),this.popoverOpen=!0;return}this.handleClosePopover()},this.filterMentionItems=e=>{let{mentionText:a,query:l,starter:i,startIndex:s}=e;this.currentMentionQuery=a,this.mentionStartPosition=s;let t=l.toLowerCase();this.mentionableEntityController.filterItems(t,i),this.selectedItemIndex=0},this.popoverOpen=!1,this.currentMentionQuery="",this.mentionStartPosition=0,this.selectedItemIndex=0,this.currentStarter=null,this._value="",this.filteredItemsInfo=null,this.isFetchingEntities=!1,this.popoverPlacement="bottom-start",this.disabled=!1,this.scale="m",this.rows=3,this.starters=g,this.readOnly=!1,this.arcgisMentionableSelectedIndexChange=d(),this.arcgisMentionableTextAreaChange=d(),this.arcgisMentionableTextAreaKeyDown=d(),this.arcgisUserMentionableTextAreaChange=d(),this.arcgisUserMentionableTextAreaKeyDown=d(),this.renderItemInfo=()=>{let{filteredItemsInfo:e,selectedItemIndex:a,portal:l}=this;if(!e)return null;let{items:i,type:s}=e;switch(s){case"user":return i.map((t,r)=>A({id:t.id,label:`@${t.username}`,description:t.fullName,selected:r===a,contentStart:o`<arcgis-portal-user-avatar slot=content-start .user=${t} .portal=${l} scale=m></arcgis-portal-user-avatar>`,onSelect:async()=>await this.selectItem(t)}));case"item":return i.map((t,r)=>A({id:t.id??`item-${r}`,label:`#${t.title}`,description:t.id??void 0,selected:r===a,onSelect:async()=>await this.selectItem(t),contentStart:o`<calcite-avatar slot=content-start .fullName=${t.title??void 0} .thumbnail=${t.thumbnailUrl??void 0} scale=m></calcite-avatar>`}));case"group":return i.map((t,r)=>A({id:t.id??`group-${r}`,label:`${t.title}`,description:t.id??void 0,selected:r===a,onSelect:async()=>await this.selectItem(t),contentStart:o`<calcite-avatar slot=content-start .fullName=${t.title??void 0} .thumbnail=${t.thumbnailUrl??void 0} scale=m></calcite-avatar>`}))}}}static{this.properties={popoverOpen:16,currentMentionQuery:16,mentionStartPosition:16,selectedItemIndex:16,currentStarter:16,_value:16,filteredItemsInfo:16,isFetchingEntities:16,popoverListLabel:1,popoverPlacement:1,disabled:5,portal:0,user:0,scale:1,value:1,maxLength:9,rows:9,starters:0,placeholder:1,readOnly:5}}static{this.styles=G}get filteredItems(){return this.filteredItemsInfo?.items??[]}async closePopover(){this.handleClosePopover()}async focusTextArea(){await this.calciteTextAreaRef.value?.setFocus()}async selectItem(e){let{currentStarter:a,_value:l,mentionStartPosition:i,currentMentionQuery:s,handleClosePopover:t,calciteTextAreaRef:r,nativeTextAreaRef:h,bubbleNewValueChange:u}=this;if(!e||!a)return;let m=this.mentionableEntityController.getItemText(e,a),c=m.replaceAll('"',"").trim(),p=/\s/u.test(c)?`${a}"${c}"`:`${a}${c}`,f=(l??"").substring(0,i),x=(l??"").substring(i+s.length),$=`${f}${p} ${x}`,b=U(e,a,m);b&&R(this.el,{text:p,part:b}),this._value=$,u(this._value);let I=i+p.length+1;t(),await this.updateComplete,r.value?.setFocus(),h&&(h.selectionEnd=I)}willUpdate(e){e.has("value")&&(this._value=this.value??"",this._value||v(this.el)),(e.has("portal")||e.has("user"))&&v(this.el),e.has("selectedItemIndex")&&this.arcgisMentionableSelectedIndexChange.emit(this.selectedItemIndex)}loaded(){this.updateComplete.then(()=>{let e=this.calciteTextAreaRef.value?.shadowRoot?.querySelector("textarea");e&&(this.nativeTextAreaRef=e)}),this.mentionableEntityController.fetchUsers()}render(){let{popoverPlacement:e,scale:a,_value:l,maxLength:i,rows:s,placeholder:t,readOnly:r,popoverOpen:h,closePopover:u,handleInput:m,handleKeyDown:c,disabled:p,isFetchingEntities:f,filteredItemsInfo:x,renderItemInfo:$,popoverListLabel:b}=this,I=this.calciteTextAreaRef.value,q=x?.items??[];return o`<calcite-text-area .placeholder=${t} .value=${l} .maxLength=${i} .rows=${s} .scale=${a} .readOnly=${r} .disabled=${p} @blur=${u} @calciteTextAreaInput=${m} @keydown=${c} ${y(this.calciteTextAreaRef)}></calcite-text-area>${I&&o`<calcite-popover .open=${h} .placement=${e} class="mention-popover" .label=${b} .referenceElement=${I} trigger-disabled pointer-disabled focus-trap-disabled><div class=${w({"mentionable-list":!0,"mentionable-list--loading":f})}>${f&&o`<calcite-scrim .loading=${f}></calcite-scrim>`||""}${q.length>0&&o`<calcite-list .label=${b}>${$()}</calcite-list>`||""}</div></calcite-popover>`||""}`}};P("arcgis-portal-mentionable-text-area",M);return M},a,b,c,e)
2
+ import{a as F}from"./GUL7EIJ4.js";import e from"./6G6MIY3R.js";import{a as g,b as U,c as _}from"./SRWFOV5W.js";import"./JOUR2FB2.js";import{a as R,c as v}from"./MSSJRDR7.js";import"./VDXESPJK.js";import"./DAAON2UO.js";import c from"./TZ6HFMZZ.js";import b from"./TIPQ2ZWK.js";import{a as E}from"./57MT7FOI.js";import a from"./C5IKEISI.js";import"./H7DF6TTK.js";import"./KV4ZZSNW.js";import"./2FKNF2ZK.js";import{c as L}from"./OQ3OHDEB.js";import"./I57CRKF7.js";import{I as S,J as y,K as k,L as w,Q as P,h as T,j as o,v as d}from"./3ZC26CT6.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([{a:C},,{b:D},{d:O}])=>{async function Q(n,e={}){return await n.queryGroups(e)}var N=n=>g.includes(n)?n:"@",V=L(n=>{let e=[],a=async s=>await C({requester:async()=>await O(n.portal,s,{num:3}),key:"items",id:s}),l=async s=>await C({requester:async()=>await Q(n.portal,{query:`title:${s}`,num:3}),key:"groups",id:s}),i=F(async(s,t)=>{n.isFetchingEntities=!0;let r=s.toLowerCase();switch(N(t)){case"@":let h=10;n.filteredItemsInfo={type:"user",items:e.filter(c=>c.username?.toLowerCase().includes(r)||c.fullName?.toLowerCase().includes(r)).slice(0,h)};break;case"#":let{result:u}=await a(r);n.filteredItemsInfo={type:"item",items:u?.results??[]};break;case"$":let{results:m}=await l(r);n.filteredItemsInfo={type:"group",items:m};break}(n.filteredItemsInfo?.items?.length??0)===0&&await n.closePopover(),n.isFetchingEntities=!1},400);return{fetchUsers:async()=>{try{let{users:s}=await D(n.portal);e=s??[]}catch(s){e=[],console.error("error fetching org users:",s)}},filterItems:i,getItemText:(s,t)=>{let r="";switch(N(t)){case"@":r=s.username;break;case"#":r=s.title??"";break;case"$":r=s.title??"";break}return r.trim()}}}),A=({id:n,label:e,selected:a,description:l,contentStart:i,onSelect:s})=>E(n,o`<calcite-list-item class=${w({selected:a})} .label=${e} .description=${l} .selected=${a} @pointerdown=${async t=>{t.preventDefault(),t.stopPropagation(),await s()}} ${y(t=>{a&&t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})})}>${i}</calcite-list-item>`),G=T`.selected{--calcite-list-background-color: var(--calcite-color-foreground-2)}.mentionable-list{max-height:13rem;overflow-y:auto;padding:.25rem;width:min(100vw,24rem)}.mentionable-list--loading{min-height:10rem}`,M=class extends k{constructor(){super(...arguments),this.calciteTextAreaRef=S(),this.mentionableEntityController=V(this),this.handleInput=e=>{let{bubbleNewValueChange:a,checkForMention:l}=this,i=e.target.value;i||v(this.el),this._value=i,a(this._value);let s=this.nativeTextAreaRef?.selectionStart??0;l(i,s)},this.handleKeyDown=e=>{if(!this.popoverOpen){this.arcgisUserMentionableTextAreaKeyDown.emit(e),this.arcgisMentionableTextAreaKeyDown.emit(e);return}switch(e.key){case"ArrowDown":e.preventDefault(),this.selectedItemIndex=Math.min(this.selectedItemIndex+1,this.filteredItems.length-1);break;case"ArrowUp":e.preventDefault(),this.selectedItemIndex=Math.max(this.selectedItemIndex-1,0);break;case"Enter":e.preventDefault(),this.selectItem(this.filteredItems[this.selectedItemIndex]);break;case"Escape":e.preventDefault(),this.closePopover.bind(this)();break}},this.handleClosePopover=()=>{this.popoverOpen=!1,this.currentMentionQuery="",this.selectedItemIndex=0,this.currentStarter=null},this.bubbleNewValueChange=e=>{this.arcgisUserMentionableTextAreaChange.emit(e),this.arcgisMentionableTextAreaChange.emit(e)},this.checkForMention=(e,a)=>{let l=e.substring(0,a),i=_(l,this.starters??g);if(i){let{starter:s}=i;this.currentStarter=s,this.filterMentionItems(i),this.popoverOpen=!0;return}this.handleClosePopover()},this.filterMentionItems=e=>{let{mentionText:a,query:l,starter:i,startIndex:s}=e;this.currentMentionQuery=a,this.mentionStartPosition=s;let t=l.toLowerCase();this.mentionableEntityController.filterItems(t,i),this.selectedItemIndex=0},this.popoverOpen=!1,this.currentMentionQuery="",this.mentionStartPosition=0,this.selectedItemIndex=0,this.currentStarter=null,this._value="",this.filteredItemsInfo=null,this.isFetchingEntities=!1,this.popoverPlacement="bottom-start",this.disabled=!1,this.scale="m",this.rows=3,this.starters=g,this.readOnly=!1,this.arcgisMentionableSelectedIndexChange=d(),this.arcgisMentionableTextAreaChange=d(),this.arcgisMentionableTextAreaKeyDown=d(),this.arcgisUserMentionableTextAreaChange=d(),this.arcgisUserMentionableTextAreaKeyDown=d(),this.renderItemInfo=()=>{let{filteredItemsInfo:e,selectedItemIndex:a,portal:l}=this;if(!e)return null;let{items:i,type:s}=e;switch(s){case"user":return i.map((t,r)=>A({id:t.id,label:`@${t.username}`,description:t.fullName,selected:r===a,contentStart:o`<arcgis-portal-user-avatar slot=content-start .user=${t} .portal=${l} scale=m></arcgis-portal-user-avatar>`,onSelect:async()=>await this.selectItem(t)}));case"item":return i.map((t,r)=>A({id:t.id??`item-${r}`,label:`#${t.title}`,description:t.id??void 0,selected:r===a,onSelect:async()=>await this.selectItem(t),contentStart:o`<calcite-avatar slot=content-start .fullName=${t.title??void 0} .thumbnail=${t.thumbnailUrl??void 0} scale=m></calcite-avatar>`}));case"group":return i.map((t,r)=>A({id:t.id??`group-${r}`,label:`${t.title}`,description:t.id??void 0,selected:r===a,onSelect:async()=>await this.selectItem(t),contentStart:o`<calcite-avatar slot=content-start .fullName=${t.title??void 0} .thumbnail=${t.thumbnailUrl??void 0} scale=m></calcite-avatar>`}))}}}static{this.properties={popoverOpen:16,currentMentionQuery:16,mentionStartPosition:16,selectedItemIndex:16,currentStarter:16,_value:16,filteredItemsInfo:16,isFetchingEntities:16,popoverListLabel:1,popoverPlacement:1,disabled:5,portal:0,user:0,scale:1,value:1,maxLength:9,rows:9,starters:0,placeholder:1,readOnly:5}}static{this.styles=G}get filteredItems(){return this.filteredItemsInfo?.items??[]}async closePopover(){this.handleClosePopover()}async focusTextArea(){await this.calciteTextAreaRef.value?.setFocus()}async selectItem(e){let{currentStarter:a,_value:l,mentionStartPosition:i,currentMentionQuery:s,handleClosePopover:t,calciteTextAreaRef:r,nativeTextAreaRef:h,bubbleNewValueChange:u}=this;if(!e||!a)return;let m=this.mentionableEntityController.getItemText(e,a),c=m.replaceAll('"',"").trim(),p=/\s/u.test(c)?`${a}"${c}"`:`${a}${c}`,f=(l??"").substring(0,i),x=(l??"").substring(i+s.length),$=`${f}${p} ${x}`,b=U(e,a,m);b&&R(this.el,{text:p,part:b}),this._value=$,u(this._value);let I=i+p.length+1;t(),await this.updateComplete,r.value?.setFocus(),h&&(h.selectionEnd=I)}willUpdate(e){e.has("value")&&(this._value=this.value??"",this._value||v(this.el)),(e.has("portal")||e.has("user"))&&v(this.el),e.has("selectedItemIndex")&&this.arcgisMentionableSelectedIndexChange.emit(this.selectedItemIndex)}loaded(){this.updateComplete.then(()=>{let e=this.calciteTextAreaRef.value?.shadowRoot?.querySelector("textarea");e&&(this.nativeTextAreaRef=e)}),this.mentionableEntityController.fetchUsers()}render(){let{popoverPlacement:e,scale:a,_value:l,maxLength:i,rows:s,placeholder:t,readOnly:r,popoverOpen:h,closePopover:u,handleInput:m,handleKeyDown:c,disabled:p,isFetchingEntities:f,filteredItemsInfo:x,renderItemInfo:$,popoverListLabel:b}=this,I=this.calciteTextAreaRef.value,q=x?.items??[];return o`<calcite-text-area .placeholder=${t} .value=${l} .maxLength=${i} .rows=${s} .scale=${a} .readOnly=${r} .disabled=${p} @blur=${u} @calciteTextAreaInput=${m} @keydown=${c} ${y(this.calciteTextAreaRef)}></calcite-text-area>${I&&o`<calcite-popover .open=${h} .placement=${e} class="mention-popover" .label=${b} .referenceElement=${I} trigger-disabled pointer-disabled focus-trap-disabled><div class=${w({"mentionable-list":!0,"mentionable-list--loading":f})}>${f&&o`<calcite-scrim .loading=${f}></calcite-scrim>`||""}${q.length>0&&o`<calcite-list .label=${b}>${$()}</calcite-list>`||""}</div></calcite-popover>`||""}`}};P("arcgis-portal-mentionable-text-area",M);return M},a,b,c,e)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import c from"./6G6MIY3R.js";import b from"./ATQT25TR.js";import a from"./TZ6HFMZZ.js";import{c as I}from"./KV4ZZSNW.js";import{a as n}from"./FJ3I3AJE.js";import{L as u,R as g,h,j as o}from"./AICPYLWE.js";export default $arcgis.t(([{a:c},{a:f,b:b},{c:w}])=>{var v=h`:host{display:block}.items-directly-using{display:flex;justify-content:space-between;align-items:center;padding-block-end:.75rem}.impacted-items-labels{display:flex;flex-direction:column}.impacted-items-title{font-weight:500}.impacted-items-access-count{font-size:var(--calcite-font-size--2)}.view-full-list{margin:.5rem 0}.items-list{max-block-size:250px;overflow-y:auto}calcite-block{--calcite-block-icon-start-color: var(--calcite-color-status-warning)}`,m=20,d=class extends u{constructor(){super(...arguments),this.messages=n({blocking:!0}),this.browserMessages=n({name:"portal-browser",blocking:!0}),this.deleteMessages=n({name:"portal-delete-items",blocking:!0}),this.userRequestId=0,this.itemGroups={},this.itemOwners={},this.sourceItem=null,this.relatedItems=[],this.showDependentItems=!1}static{this.properties={itemGroups:16,itemOwners:16,sourceItem:0,relatedItems:0,relatedItemsCount:9,showDependentItems:5,portal:0,user:0}}static{this.styles=[v,f]}willUpdate(e){(e.has("relatedItems")||e.has("portal")||e.has("user"))&&(this.itemGroups={},this.itemOwners={},this.loadGroupSharing(++this.userRequestId),this.loadItemOwners())}async loadItemOwners(){let{portal:e,relatedItems:s}=this;if(!e)return;let a=[...new Set(s.slice(0,m).map(t=>t.owner).filter(t=>!!t))],i=await Promise.all(a.map(async t=>[t,await c(t,e)]));this.itemOwners=Object.fromEntries(i)}async loadGroupSharing(e){let{portal:s,relatedItems:a}=this,i=this.user??s?.user;if(!s||!i?.username||!a.length)return;let t=await c(i.username,s);if(e!==this.userRequestId)return;let{result:r}=await w(s,t,a);e===this.userRequestId&&(this.itemGroups=r??{})}render(){let e=this.relatedItemsCount??this.relatedItems.length;if(!e&&!this.relatedItems.length)return null;let s=new Intl.NumberFormat(this.deleteMessages._t9nLocale),a=s.format(e),i=this.showDependentItems?this.deleteMessages.dependentItems:this.deleteMessages.impactedItems.title,t=this.showDependentItems?this.deleteMessages.itemsDependingOnThisItem:this.deleteMessages.deletingWillImpactOtherItems,r=this.portal&&this.sourceItem?`${I({portal:this.portal})}/item.html?id=${this.sourceItem.id}#usage`:void 0,p=()=>{r&&window.open(r,"_blank")};return o`<calcite-block .heading=${t.replace("{count}",a)} collapsible .label=${i} icon-start=exclamation-mark-triangle><div class="items-directly-using"><div class="impacted-items-labels"><span class="impacted-items-title">${i}</span>${!this.showDependentItems&&o`<span class="impacted-items-access-count">${this.deleteMessages.impactedItems.itemsYouHaveAccessTo.replace("{accessCount}",s.format(this.relatedItems.length)).replace("{totalCount}",a)}</span>`||""}</div><calcite-button appearance=transparent icon-end=launch @click=${p}>${this.deleteMessages.impactedItems["View usage"]}</calcite-button></div><div class="items-list"><calcite-list .label=${i}>${this.relatedItems.slice(0,m).map(l=>b({item:l,owner:this.itemOwners[l.owner],portal:this.portal,user:this.user,lang:this.messages._lang,modifiedLabel:this.browserMessages.filterDate.modified,access:{level:l.access,groupIds:l.id?this.itemGroups[l.id]:void 0}}))}</calcite-list>${this.relatedItems.length>m&&o`<calcite-button class="view-full-list" appearance=transparent icon-end=launch @click=${p}>${this.deleteMessages.impactedItems["View full list"]}</calcite-button>`||""}</div></calcite-block>`}};g("arcgis-portal-review-related-items",d);return d},a,b,c)
2
+ import c from"./6G6MIY3R.js";import b from"./QKGHH3FS.js";import a from"./TZ6HFMZZ.js";import{c as I}from"./KV4ZZSNW.js";import{a as n}from"./AYHYABMC.js";import{K as u,Q as g,h,j as o}from"./3ZC26CT6.js";export default $arcgis.t(([{a:c},{a:f,b:b},{c:w}])=>{var v=h`:host{display:block}.items-directly-using{display:flex;justify-content:space-between;align-items:center;padding-block-end:.75rem}.impacted-items-labels{display:flex;flex-direction:column}.impacted-items-title{font-weight:500}.impacted-items-access-count{font-size:var(--calcite-font-size--2)}.view-full-list{margin:.5rem 0}.items-list{max-block-size:250px;overflow-y:auto}calcite-block{--calcite-block-icon-start-color: var(--calcite-color-status-warning)}`,m=20,d=class extends u{constructor(){super(...arguments),this.messages=n({blocking:!0}),this.browserMessages=n({name:"portal-browser",blocking:!0}),this.deleteMessages=n({name:"portal-delete-items",blocking:!0}),this.userRequestId=0,this.itemGroups={},this.itemOwners={},this.sourceItem=null,this.relatedItems=[],this.showDependentItems=!1}static{this.properties={itemGroups:16,itemOwners:16,sourceItem:0,relatedItems:0,relatedItemsCount:9,showDependentItems:5,portal:0,user:0}}static{this.styles=[v,f]}willUpdate(e){(e.has("relatedItems")||e.has("portal")||e.has("user"))&&(this.itemGroups={},this.itemOwners={},this.loadGroupSharing(++this.userRequestId),this.loadItemOwners())}async loadItemOwners(){let{portal:e,relatedItems:s}=this;if(!e)return;let a=[...new Set(s.slice(0,m).map(t=>t.owner).filter(t=>!!t))],i=await Promise.all(a.map(async t=>[t,await c(t,e)]));this.itemOwners=Object.fromEntries(i)}async loadGroupSharing(e){let{portal:s,relatedItems:a}=this,i=this.user??s?.user;if(!s||!i?.username||!a.length)return;let t=await c(i.username,s);if(e!==this.userRequestId)return;let{result:r}=await w(s,t,a);e===this.userRequestId&&(this.itemGroups=r??{})}render(){let e=this.relatedItemsCount??this.relatedItems.length;if(!e&&!this.relatedItems.length)return null;let s=new Intl.NumberFormat(this.deleteMessages._t9nLocale),a=s.format(e),i=this.showDependentItems?this.deleteMessages.dependentItems:this.deleteMessages.impactedItems.title,t=this.showDependentItems?this.deleteMessages.itemsDependingOnThisItem:this.deleteMessages.deletingWillImpactOtherItems,r=this.portal&&this.sourceItem?`${I({portal:this.portal})}/item.html?id=${this.sourceItem.id}#usage`:void 0,p=()=>{r&&window.open(r,"_blank")};return o`<calcite-block .heading=${t.replace("{count}",a)} collapsible .label=${i} icon-start=exclamation-mark-triangle><div class="items-directly-using"><div class="impacted-items-labels"><span class="impacted-items-title">${i}</span>${!this.showDependentItems&&o`<span class="impacted-items-access-count">${this.deleteMessages.impactedItems.itemsYouHaveAccessTo.replace("{accessCount}",s.format(this.relatedItems.length)).replace("{totalCount}",a)}</span>`||""}</div><calcite-button appearance=transparent icon-end=launch @click=${p}>${this.deleteMessages.impactedItems["View usage"]}</calcite-button></div><div class="items-list"><calcite-list .label=${i}>${this.relatedItems.slice(0,m).map(l=>b({item:l,owner:this.itemOwners[l.owner],portal:this.portal,user:this.user,lang:this.messages._lang,modifiedLabel:this.browserMessages.filterDate.modified,access:{level:l.access,groupIds:l.id?this.itemGroups[l.id]:void 0}}))}</calcite-list>${this.relatedItems.length>m&&o`<calcite-button class="view-full-list" appearance=transparent icon-end=launch @click=${p}>${this.deleteMessages.impactedItems["View full list"]}</calcite-button>`||""}</div></calcite-block>`}};g("arcgis-portal-review-related-items",d);return d},a,b,c)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{i as o}from"./AICPYLWE.js";var c={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},n=Symbol(),e=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,s)=>{this.o=t,this.h=s})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,s,r){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof s=="object"?s:{task:s,args:r};this.v=i.task,this.j=i.args,this.m=i.argsEqual??u,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),s=this.O;this.O=t,t===s||t===void 0||s!==void 0&&this.m(s,t)||await this.run(t)}async run(t){let s,r;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let a=!1;try{s=await this.v(t,{signal:this.q.signal})}catch(l){a=!0,r=l}if(this.p===i){if(s===n)this.i=0;else{if(a===!1){try{this.k?.(s)}catch{}this.i=2,this.o?.(s)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=s,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},u=(h,t)=>h===t||h.length===t.length&&h.every(((s,r)=>!o(s,t[r])));export{c as a,e as b};
2
+ import{i as o}from"./3ZC26CT6.js";var c={INITIAL:0,PENDING:1,COMPLETE:2,ERROR:3},n=Symbol(),e=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,s)=>{this.o=t,this.h=s})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,s,r){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof s=="object"?s:{task:s,args:r};this.v=i.task,this.j=i.args,this.m=i.argsEqual??u,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),s=this.O;this.O=t,t===s||t===void 0||s!==void 0&&this.m(s,t)||await this.run(t)}async run(t){let s,r;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let a=!1;try{s=await this.v(t,{signal:this.q.signal})}catch(l){a=!0,r=l}if(this.p===i){if(s===n)this.i=0;else{if(a===!1){try{this.k?.(s)}catch{}this.i=2,this.o?.(s)}else{try{this.A?.(r)}catch{}this.i=3,this.h?.(r)}this.u=s,this.l=r}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},u=(h,t)=>h===t||h.length===t.length&&h.every(((s,r)=>!o(s,t[r])));export{c as a,e as b};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{d as m,e as c,f as d,g as f,u as C}from"./AICPYLWE.js";var P=t=>(...p)=>{let s=c(),e=new t(...p),o=e.exports;m(s.at(-1));let n=e.component.manager;n.W(e,o),e.watchExports(n.W.bind(n,e)),d(e);let r=[e.component,...s].reverse();return C(r,a=>a===void 0?void 0:E(e,a,o),o)},E=(t,{host:p,key:s,isReactive:e},o)=>{let n=p,r=n[s]!==t.exports,a=n[s]!==o,g=o!==t.exports;if(r&&!a&&g&&(n[s]=t.exports),p===t.component){if(e){let i=t.component.manager;a&&i.W(t,n[s]),t.onUpdate(v=>{if(v.has(s)){let x=n[s];x!==t.exports&&i.W(t,x)}})}t.O=e?void 0:s}let h=t.component.constructor.elementProperties.get(s)?.readOnly;t.watchExports(()=>{n[s]!==t.exports&&(h?f(()=>{n[s]=t.exports}):n[s]=t.exports)})};export{P as a};
2
+ import{d as m,e as c,f as d,g as f,t as C}from"./3ZC26CT6.js";var P=t=>(...p)=>{let s=c(),e=new t(...p),o=e.exports;m(s.at(-1));let n=e.component.manager;n.W(e,o),e.watchExports(n.W.bind(n,e)),d(e);let r=[e.component,...s].reverse();return C(r,a=>a===void 0?void 0:E(e,a,o),o)},E=(t,{host:p,key:s,isReactive:e},o)=>{let n=p,r=n[s]!==t.exports,a=n[s]!==o,g=o!==t.exports;if(r&&!a&&g&&(n[s]=t.exports),p===t.component){if(e){let i=t.component.manager;a&&i.W(t,n[s]),t.onUpdate(v=>{if(v.has(s)){let x=n[s];x!==t.exports&&i.W(t,x)}})}t.O=e?void 0:s}let h=t.component.constructor.elementProperties.get(s)?.readOnly;t.watchExports(()=>{n[s]!==t.exports&&(h?f(()=>{n[s]=t.exports}):n[s]=t.exports)})};export{P as a};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import c from"./TNRHHR67.js";import b from"./5SKCVK2P.js";import a from"./C5FTQSU6.js";import"./AYHYABMC.js";import"./OQ3OHDEB.js";import"./I57CRKF7.js";import"./3ZC26CT6.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import f from"./5RHV5HXF.js";import e from"./PMV65NI5.js";import d from"./P3GNUA6J.js";import"./YRLNSQ23.js";import"./4QYVBXZT.js";import"./4KTRAA2J.js";import"./PKA745KL.js";import"./VDXESPJK.js";import"./DAAON2UO.js";import c from"./TZ6HFMZZ.js";import b from"./TIPQ2ZWK.js";import"./57MT7FOI.js";import"./YTVLEHJT.js";import a from"./C5IKEISI.js";import"./H7DF6TTK.js";import"./KV4ZZSNW.js";import"./2FKNF2ZK.js";import"./AYHYABMC.js";import"./OQ3OHDEB.js";import"./I57CRKF7.js";import"./3ZC26CT6.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([,,,,,{g:a}])=>{return a},a,b,c,d,e,f)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{a as m}from"./FJ3I3AJE.js";import"./I6WGLIEC.js";import"./K2XSYDAP.js";import{L as l,M as y,R as c,h as o,j as t}from"./AICPYLWE.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";var u=o`:host{display:inline-flex;align-items:center;line-height:1.35;--sublayer-type-font-size: var(--calcite-font-size--1)}.sublayer-type{display:inline-flex;align-items:center;max-width:100%;min-width:0}.text{flex:1 1 0%;margin-inline-start:.5rem;color:inherit}.name{font-weight:500;font-size:var(--sublayer-type-font-size);overflow-wrap:anywhere;white-space:normal}.name--underline{text-decoration:underline}.type{font-weight:400;color:var(--calcite-color-text-2);font-size:var(--sublayer-type-font-size)}`;function d({geometry:s,type:e}){if(e!==void 0)switch(e){case"Annotation Layer":return{icon:"layer-annotation",type:"annotation",isGeometry:!1};case"Dimension Layer":return{icon:"layer-dimension",type:"dimension",isGeometry:!1};case"Utility Network Layer":return{icon:"utility-network-layer",type:"utility network",isGeometry:!1};case"Catalog Layer":return{icon:"catalog-dataset",type:"catalog",isGeometry:!1};case"Parcel Layer":return{icon:"parcel-layer",type:"parcel",isGeometry:!1};case"Oriented Imagery Layer":return{icon:"oriented-imagery-layer",type:"oriented imagery",isGeometry:!1};case"Table":return{icon:"table",type:"table",isGeometry:!0}}switch(s){case"point":case"esriGeometryPoint":return{type:"point",icon:"point",isGeometry:!0};case"esriGeometryMultipoint":case"multipoint":return{type:"multipoint",icon:"layer-points",isGeometry:!0};case"line":case"polyline":case"esriGeometryPolyline":return{type:"line",icon:"line",isGeometry:!0};case"polygon":case"esriGeometryPolygon":return{type:"polygon",icon:"polygon",isGeometry:!0};case"multipatch":case"esriGeometryMultiPatch":return{type:"multipatch",icon:"cube",isGeometry:!0};default:return{type:"table",icon:"table",isGeometry:!0}}}var n=class extends l{constructor(){super(...arguments),this.messages=m({blocking:!0}),this.hideName=!1,this.hideIcon=!1,this.hideType=!1,this.underline=!1}static{this.properties={geometry:1,type:1,scale:3,name:1,hideName:5,hideIcon:5,hideType:5,underline:5,renderer:0}}static{this.styles=u}render(){if(!this.messages._lang)return null;let e=d({type:this.type,geometry:this.geometry});if(this.renderer)return this.renderer({...e,name:this.name??""});let{hideIcon:a,hideName:i,hideType:r,underline:p}=this;return i&&a&&r?null:t`<div class="sublayer-type">${!a&&t`<calcite-icon .icon=${e.icon} .scale=${this.scale}></calcite-icon>`||""}${(!i||!r)&&t`<div class="text">${!i&&t`<div class=${y({name:!0,"name--underline":p})}>${this.name??""}</div>`||""}${!r&&t`<div class="type">${this.messages[e.type]}</div>`||""}</div>`||""}</div>`}};c("arcgis-portal-sublayer-type",n);export{n as ArcgisPortalSublayerType};
2
+ import{a as m}from"./AYHYABMC.js";import"./OQ3OHDEB.js";import"./I57CRKF7.js";import{K as l,L as y,Q as c,h as o,j as t}from"./3ZC26CT6.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";var u=o`:host{display:inline-flex;align-items:center;line-height:1.35;--sublayer-type-font-size: var(--calcite-font-size--1)}.sublayer-type{display:inline-flex;align-items:center;max-width:100%;min-width:0}.text{flex:1 1 0%;margin-inline-start:.5rem;color:inherit}.name{font-weight:500;font-size:var(--sublayer-type-font-size);overflow-wrap:anywhere;white-space:normal}.name--underline{text-decoration:underline}.type{font-weight:400;color:var(--calcite-color-text-2);font-size:var(--sublayer-type-font-size)}`;function d({geometry:s,type:e}){if(e!==void 0)switch(e){case"Annotation Layer":return{icon:"layer-annotation",type:"annotation",isGeometry:!1};case"Dimension Layer":return{icon:"layer-dimension",type:"dimension",isGeometry:!1};case"Utility Network Layer":return{icon:"utility-network-layer",type:"utility network",isGeometry:!1};case"Catalog Layer":return{icon:"catalog-dataset",type:"catalog",isGeometry:!1};case"Parcel Layer":return{icon:"parcel-layer",type:"parcel",isGeometry:!1};case"Oriented Imagery Layer":return{icon:"oriented-imagery-layer",type:"oriented imagery",isGeometry:!1};case"Table":return{icon:"table",type:"table",isGeometry:!0}}switch(s){case"point":case"esriGeometryPoint":return{type:"point",icon:"point",isGeometry:!0};case"esriGeometryMultipoint":case"multipoint":return{type:"multipoint",icon:"layer-points",isGeometry:!0};case"line":case"polyline":case"esriGeometryPolyline":return{type:"line",icon:"line",isGeometry:!0};case"polygon":case"esriGeometryPolygon":return{type:"polygon",icon:"polygon",isGeometry:!0};case"multipatch":case"esriGeometryMultiPatch":return{type:"multipatch",icon:"cube",isGeometry:!0};default:return{type:"table",icon:"table",isGeometry:!0}}}var n=class extends l{constructor(){super(...arguments),this.messages=m({blocking:!0}),this.hideName=!1,this.hideIcon=!1,this.hideType=!1,this.underline=!1}static{this.properties={geometry:1,type:1,scale:3,name:1,hideName:5,hideIcon:5,hideType:5,underline:5,renderer:0}}static{this.styles=u}render(){if(!this.messages._lang)return null;let e=d({type:this.type,geometry:this.geometry});if(this.renderer)return this.renderer({...e,name:this.name??""});let{hideIcon:a,hideName:i,hideType:r,underline:p}=this;return i&&a&&r?null:t`<div class="sublayer-type">${!a&&t`<calcite-icon .icon=${e.icon} .scale=${this.scale}></calcite-icon>`||""}${(!i||!r)&&t`<div class="text">${!i&&t`<div class=${y({name:!0,"name--underline":p})}>${this.name??""}</div>`||""}${!r&&t`<div class="type">${this.messages[e.type]}</div>`||""}</div>`||""}</div>`}};c("arcgis-portal-sublayer-type",n);export{n as ArcgisPortalSublayerType};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import a from"./3SCRMD7A.js";import{b as z}from"./OR6T5SB3.js";import{a as E}from"./H7DF6TTK.js";import"./KV4ZZSNW.js";import"./2FKNF2ZK.js";import{a as B}from"./FJ3I3AJE.js";import"./I6WGLIEC.js";import"./K2XSYDAP.js";import{J as S,K as C,L as j,P as D,R as J,h as M,j as g,p as N,r as A,s as R,w as F}from"./AICPYLWE.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([le,be,we,Ie,$,de,b,pe,fe,P,X,T,ee,{h:W,j:q,k:G,l:U,m:V,n:H,o:Q,p:K,q:Y,r:Z}])=>{var L=(i=>(i.expression="expression/",i))(L||{});function I(i){return i!=null}function se(i,e,s){let t=e.fieldName;if(t.includes(L.expression)){let r=s.get(t);return r?.title?r.title:t}else return ee.supportsFieldConfiguration(i)&&i.getFieldConfiguration(t)?i.getFieldAlias(t)||t:e.label||t}function te(i,e,s){let t="";if(/^raster.(?:item|service)pixelvalue/iu.test(i))t="number";else if(e.has(i)){let r=e.get(i);t=r.type?r.type.toLowerCase():""}else if(s.has(i)){let r=s.get(i);t=r.returnType?r.returnType.toLowerCase():""}else t="number";return t}async function ie(i){return new Map((await me(i)).filter(e=>e.visible).map(e=>[e.name,e]))}function re(i){let e=new Map;return i?.expressionInfos&&i.expressionInfos.forEach(s=>{let t=`${L.expression}${s.name}`;e.set(t,s)}),e}async function me(i){return await new Promise((e,s)=>{switch(i.type){case"feature":case"ogc-feature":case"stream":e(i.fields);break;case"sublayer":{let t=i,r=t?.layer;r?.portalItem&&r.url.includes("https://demographics")&&r.url.includes(".arcgis.com")?r.portalItem?.fetchData().then(a=>{if(a?.thematicGroup){let n=new Map(t.fields.map(o=>[o.name,o])),c=a.thematicGroup.fieldNames,p=[];c.forEach(o=>{n.has(o)&&p.push(n.get(o))}),e(p)}else e(t.fields)}).catch(a=>{s(new Error(a))}):e(t.fields);break}case"imagery":case"imagery-tile":case"wcs":e(i.rasterFields);break;default:e("fields"in i?i.fields??[]:[])}})}function d(i,e){return!i||!e?!1:i.toLocaleLowerCase()===e.toLocaleLowerCase()}async function ae(i,e,s,t){if(!s)return!1;let r=["feature","oriented-imagery"].includes(e.type),a=t?.item??e.portalItem,n=e.sourceJSON;if(!r||!a||!a.portal.user||!U(a)||G(a)||V(a)||H(n)||a.portal.isPortal&&q(a)||["oid","global-id","geometry"].includes(s.type)||await ue(e,s.name,t))return!1;let c=e.sourceJSON.geometryProperties,p=c?.shapeLengthFieldName,o=c?.shapeAreaFieldName;if(d(p,s.name)||d(o,s.name))return!1;let l=e.editFieldsInfo;if(l&&(d(l.creationDateField,s.name)||d(l.creatorField,s.name)||d(l.editDateField,s.name)||d(l.editorField,s.name))||d(e.objectIdField,s.name)||d(e.displayField,s.name)||d(e.typeIdField,s.name)||d(e.subtypeField,s.name)||e.timeInfo&&(d(e.timeInfo.startField,s.name)||d(e.timeInfo.endField,s.name)||d(e.timeInfo.trackIdField,s.name)))return!1;if(!t?.ignoreLayerRenderer&&e.featureReduction){let f=new Set;if(await b.collectFeatureReductionFields(f,e,e.featureReduction),Array.from(f).some(y=>d(y,s.name)))return!1}if(!t?.ignoreLayerRenderer&&(await b.getRendererFields(e.renderer,e.fieldsIndex)).some(f=>d(f,s.name)))return!1;if(!t?.ignoreLayerLabelingInfo){let f=e.labelingInfo?.map(y=>y.labelExpressionInfo?.expression);if(f&&((await b.getExpressionFields(e,f)).some(y=>d(y,s.name))||await ne(e,s,"layer")))return!1}if(!t?.ignoreLayerDefinitionExpression&&e.definitionExpression&&(await T.parseWhereClause(e.definitionExpression,e.fieldsIndex)).fieldNames.some(f=>d(f,s.name))||await he(e,s,t)||await _e(e,s))return!1;if(await ye(e,s))return await Promise.resolve(!1);if(await ve(e,s))return await Promise.resolve(!1);if(ge(i,e,s)||e.relationships?.map(f=>f.keyField)?.some(f=>d(f,s.name)))return!1;let u=W(a,a.portal.user),w=t?.userItemInfo?.userGroups??await Q(e)??[],_=t?.userItemInfo?.itemGroups??await K(e)??[],v=Z(w,_);if(!u&&!v)return!1;let m=t?.userItemInfo?.relatedItems??await Y(a.id,a.portal,{relationshipType:"Service2Service"});return!(m?.data?.relatedItems&&m.data.relatedItems.some(f=>["WMTS","Map Service","Vector Tile Service"].includes(f.type)))}async function ue(i,e,s){let t=`${i.url}/${i.layerId}/fieldGroups`;try{let r=s?.userItemInfo&&"fieldGroups"in s.userItemInfo?s.userItemInfo.fieldGroups:(await X(t,{query:{f:"json"},responseType:"json"}))?.data?.fieldGroups;return r?r.some(a=>a.fields.some(n=>d(n,e))):!1}catch{return!1}}function ge(i,e,s){if(!i)return!1;let t=i.map?.applicationProperties?.viewing?.search;if(t){let r=t.layers?.find(a=>a.id===e.id);if(r){let a=r?.field?.name;if(a)return d(a,s.name)}}return!1}async function ne(i,e,s){let t=s==="layer"?i.labelingInfo?.filter(n=>I(n.where)):i.sourceJSON?.drawingInfo?.labelingInfo?.filter(n=>I(n.where));if(!t?.length)return!1;let r=[...await Promise.all(t.map(async n=>await T.parseWhereClause(n.where,i.fieldsIndex)))],a=!1;for(let n=0;n<r.length;n++){let c=r[n].fieldNames?.some(p=>d(p,e.name));if(!a&&c){a=!0;break}}return await Promise.resolve(a)}async function he(i,e,s){let t=i.portalItem;if(!t)return!1;let r=`${E(t.portal)}content/items/${t.id}/data`,a=(s?.userItemInfo?.itemData??await X(r,{query:{f:"json"},responseType:"json"}))?.data;if(!a)return!1;if(a?.layers){let n=a.layers.find(l=>l.id===i.layerId),c=n?.layerDefinition?.drawingInfo?.renderer,p=n?.layerDefinition?.featureReduction,o=n?.layerDefinition?.definitionExpression;if(!c&&!p&&!o)return!1;if(!s?.ignoreItemRenderer&&c){let l=P.fromJSON(c);if((await b.getRendererFields(l,i.fieldsIndex)).some(u=>d(u,e.name)))return!0}if(!s?.ignoreItemFeatureReduction&&p&&await oe(i,e,p)||o&&(await T.parseWhereClause(o,i.fieldsIndex)).fieldNames.some(l=>d(l,e.name)))return!0}return!1}async function _e(i,e){let s=i.sourceJSON,t=s?.drawingInfo?.renderer,r=s?.featureReduction;if(!t&&!r)return!1;if(t){let a=P.fromJSON(t);if((await b.getRendererFields(a,i.fieldsIndex)).some(n=>d(n,e.name)))return!0}return!!(r&&await oe(i,e,r))}async function ye(i,e){let s=i.sourceJSON?.drawingInfo?.labelingInfo;if(!s)return await Promise.resolve(!1);let t=s?.map(r=>r.labelExpressionInfo?.expression);if(t){if((await b.getExpressionFields(i,t)).some(r=>d(r,e.name)))return await Promise.resolve(!0);if(await ne(i,e,"service"))return await Promise.resolve(!0)}return await Promise.resolve(!1)}async function ve(i,e){let s=i.sourceJSON?.definitionQuery;return s?(await T.parseWhereClause(s,i.fieldsIndex)).fieldNames.some(t=>d(t,e.name))?await Promise.resolve(!0):await Promise.resolve(!1):await Promise.resolve(!1)}async function oe(i,e,s){let t=s.type==="binning"?pe.fromJSON(s):fe.fromJSON(s),r=new Set;return await b.collectFeatureReductionFields(r,i,t),!!Array.from(r).some(a=>d(a,e.name))}var h=new Map;h.set("oid","key");h.set("guid","key");h.set("global-id","key");h.set("blob","binary");h.set("integer","integer");h.set("small-integer","integer");h.set("big-integer","integer");h.set("single","number");h.set("double","number");h.set("long","number");h.set("number","number");h.set("date","date-time");h.set("date-only","calendar");h.set("time-only","clock");h.set("timestamp-offset","time-zone");h.set("string","string");var Ne=({fieldType:i})=>g`<calcite-icon scale=s .icon=${h.get(i)}></calcite-icon>`,Fe=["esrignss_speed","esrignss_direction","esrisnsr_azimuth","esrignss_positionsourcetype","esrignss_receiver","esrignss_h_rms","esrignss_v_rms","esrignss_latitude","esrignss_longitude","esrignss_altitude","esrignss_pdop","esrignss_hdop","esrignss_vdop","esrignss_fixtype","esrignss_correctionage","esrignss_stationid","esrignss_numsats","esrignss_fixdatetime","esrignss_avg_h_rms","esrignss_avg_v_rms","esrignss_avg_positions","esrignss_h_stddev","esrignss_correction_source_name","esrignss_correction_source_type","esrignss_custom_attributes","esrignss_h_95_status","esrignss_ntrip_mount_point","esrignss_antenna_height","esrignss_orthometric_height","esrignss_profile_has_hor_xform","esrignss_profile_hor_xform","esrignss_receiver_gcs","esrignss_receiver_gcs_wkid","esrignss_receiver_geoid","esrignss_receiver_ref_epoch","esrisnsr_tilt_azimuth_accuracy","esrisnsr_tilt_azimuth","esrisnsr_tilt_angle_accuracy","esrisnsr_tilt_angle","esrignss_tilt_compensated","esrignss_cp1_latitude","esrignss_cp1_longitude","esrignss_cp1_altitude","esrignss_cp1_h_rms","esrignss_cp1_v_rms","esrignss_cp1_fixdatetime","esrignss_cp1_fixtype","esrignss_cp1_corr_age","esrignss_cp1_stationid","esrignss_cp1_numsats","esrignss_cp1_pdop","esrignss_cp1_hdop","esrignss_cp1_vdop","esrignss_cp1_avg_h_rms","esrignss_cp1_avg_v_rms","esrignss_cp1_avg_positions","esrignss_cp1_h_stddev","esrisnsr_cp1_slope_dist","esrisnsr_cp1_inclination","esrisnsr_cp1_azimuth","esrignss_cp2_latitude","esrignss_cp2_longitude","esrignss_cp2_altitude","esrignss_cp2_h_rms","esrignss_cp2_v_rms","esrignss_cp2_fixdatetime","esrignss_cp2_fixtype","esrignss_cp2_corr_age","esrignss_cp2_stationid","esrignss_cp2_numsats","esrignss_cp2_pdop","esrignss_cp2_hdop","esrignss_cp2_vdop","esrignss_cp2_avg_h_rms","esrignss_cp2_avg_v_rms","esrignss_cp2_avg_positions","esrignss_cp2_h_stddev","esrisnsr_cp2_slope_dist","esrisnsr_cp2_inclination","esrisnsr_cp2_azimuth","esrisnsr_offset_method","esrisnsr_offset_device","esrisnsr_offset_laser_height","esrisnsr_offset_laser_target_ht","esrisnsr_offset_mag_var","esrignss_worst_h_rms","esrignss_worst_v_rms","esrignss_worst_fixtype","esrignss_manual_locations"],Ee=M`.dialog{--calcite-dialog-max-size-y: 60%}.dialog-content-wrapper{position:relative;min-height:100px}.hide-overflow{overflow:hidden}.field-icons{padding:0 var(--calcite-spacing-lg);display:flex;align-items:center}.warning{border-bottom:var(--calcite-border-width-sm) solid var(--calcite-color-border-3);margin-bottom:var(--calcite-spacing-md)}.warning-message{font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-bold)}.loader-container{position:absolute;height:100%;width:100%;top:0;right:0;display:none;z-index:40;overflow:hidden;background:#fffffff2;padding:0}.active{display:flex;flex-direction:column;align-items:center;justify-content:center}.loader{padding:0}.loader-text{font-weight:var(--calcite-font-weight-medium);text-align:center;margin-right:6.25rem;margin-left:6.25rem}`,k=class extends j{constructor(){super(...arguments),this.arcadeExpMap=new Map,this.cancelNode=S(),this.dialogNode=S(),this.layerFields=[],this.layerFieldsMap=new Map,this.messages=B({blocking:!0}),this.deleteInProgress=!1,this.fieldsAreDeletable=!1,this._propWatcherTask=new z(this,{task:async([e,s])=>{let t=I(e)&&I(s);if(I(e)||N("error",this,A("layer")),I(s)||N("error",this,A("fieldNames")),!t)throw new Error("Required properties are missing");this._propWatcherTask.autoRun=!1,await this.processProps()},args:()=>[this.layer,this.fieldNames]}),this.arcgisBeforeModalClose=F(),this.arcgisClose=F(),this.arcgisBeforeDelete=F(),this.arcgisFieldsDeleted=F()}static{this.properties={config:0,fieldNames:0,layer:0,mapView:0,options:0}}static{this.styles=Ee}async processProps(){let{layer:e,mapView:s,fieldNames:t}=this;if(!e||!t){this.fieldsAreDeletable=!1;return}e.loaded||await e.load(),this.layerFields=e.fields.filter(a=>t.includes(a.name));let r=t.some(a=>!e.fields.find(n=>n.name===a));if(!this.layerFields?.length||r)this.fieldsAreDeletable=!1;else{let a=await Promise.all(this.layerFields.map(async n=>await ae(s,e,n,this.options)));if(this.fieldsAreDeletable=a.every(n=>n),!this.fieldsAreDeletable)return}if(this.layerFieldsMap=await ie(e),this.options?.ignorePopupTemplate||(this.arcadeExpMap=re(e.popupTemplate)),this.portal=e.portalItem?.portal??this.options?.portal,this.item=e.portalItem??this.options?.item,!this.item){this.fieldsAreDeletable=!1;return}await Ie.getCredential(this.item.url.replace("rest/services","rest/admin/services"))}getFieldLabel(e){let{layer:s,arcadeExpMap:t}=this;if(this.options?.ignorePopupTemplate)return this.getFieldDisplayNameFromLayerFields(e);{let r=(s.popupTemplate??s.createPopupTemplate())?.fieldInfos?.find(a=>a.fieldName===e);return r?se(s,r,t):this.getFieldDisplayNameFromLayerFields(e)}}getFieldDisplayNameFromLayerFields(e){let{layer:s}=this,t=this.layerFieldsMap.get(e);return de.supportsFieldConfiguration(s)?s.getFieldAlias(e):t.alias??t.name}async deleteFields(){let{layer:e,fieldNames:s}=this,t=`${e.url.replace("/rest/services","/rest/admin/services")}/${e.layerId}/deleteFromDefinition`,r={fields:s.map(n=>({name:n}))},a={deleteFromDefinition:JSON.stringify(r)};await $(t,{query:{...a,f:"json",async:!1},method:"post",responseType:"json"}).then(async n=>{if(n.data?.success){let c=`${e.url}/${e.layerId}`;s.forEach(o=>{e.type==="feature"&&e.floorInfo?.floorField===o&&(e.floorInfo=null)});let p=await $(c,{query:{f:"json"},responseType:"json"});if(p){let o=p.data;this.currentLayerInfo=p.data,o&&(this.updateTypesAndTemplatesOnLayer(),s.forEach(l=>{o.templates?.length?o.templates.forEach(u=>delete u.prototype.attributes[l]):o.types?.forEach(u=>{u.templates.forEach(w=>delete w.prototype.attributes[l])})}),this.updateFeatureService(o))}else this.handleError()}else this.handleError()},()=>this.handleError())}updateTypesAndTemplatesOnLayer(){let{currentLayerInfo:e}=this,s=e;if(s.templates?.length){let t=this.updateTemplatesList(s.templates);s.templates=t}else if(s.types){let t=s.types;s.types=[],t.forEach(r=>{r.templates=this.updateTemplatesList(r.templates),this.addType(s,r)})}}updateTemplatesList(e){let{currentLayerInfo:s,messages:t}=this,r=[];return(e??[]).forEach(a=>{let n=new be;n.description=a.description??"",n.name=a.name||t.newFeature,n.drawingTool=a.drawingTool||"point";let c={};s.fields.forEach(o=>{let l=!1;for(let u=0;u<a.prototype.attributes.length;u++)if(a.prototype.attributes[u]===o.name){l=!0,c[o.name]=a.prototype.attributes[o.name];break}!l&&o.editable&&!Fe.includes(o.name)&&(c[o.name]=o.defaultValue||null)});let p=new we({attributes:c});n.prototype=p,r.push(n)}),r}addType(e,s){e.types?e.types.some(t=>t.id===s.id)||e.types.push(s):e.types=[s]}async updateFeatureService(e){let{layer:s,fieldNames:t}=this,r={templates:e.templates,types:e.types},a=`${s.url.replace("/rest/services","/rest/admin/services")}/${s.layerId}/updateDefinition`,n={f:"json",updateDefinition:JSON.stringify(r)};await $(a,{query:{...n,f:"json"},method:"post",responseType:"json"}).then(async c=>{if(c.data?.success){let p=`${E(this.portal)}content/items/${this.item.id}/data`;if(this.options?.ignorePopupTemplate||t.forEach(o=>{s.popupTemplate?.fieldInfos&&(s.popupTemplate.fieldInfos=s.popupTemplate.fieldInfos.filter(l=>l.fieldName!==o)),s.popupTemplate?.content?.forEach((l,u)=>{l.type==="fields"&&l.fieldInfos&&((s.popupTemplate?.content)[u].fieldInfos=(s.popupTemplate?.content)[u].fieldInfos?.filter(w=>w.fieldName!==o))})}),s.attributeTableTemplate){let o=s.attributeTableTemplate.clone();o.elements=o.elements.filter(l=>!(l.type==="field"&&t.includes(l.fieldName))),o.orderByFields=o.orderByFields.filter(l=>!t.includes(l.field)),s.attributeTableTemplate=o}if(s.fieldConfigurations?.length){let o=le.clone(s.fieldConfigurations).filter(l=>!t.includes(l.name));s.fieldConfigurations=o}await $(p,{query:{f:"json"},responseType:"json"}).then(async o=>{let l=o.data;if(l?.layers||l?.tables){let u=s.isTable,w=u?l.tables:l.layers,_=w?.find(v=>v.id===s.layerId);if(t.forEach(v=>{_?.attributeTableInfo?.attributeTableElements&&(_.attributeTableInfo.attributeTableElements=_.attributeTableInfo.attributeTableElements.map(m=>{if(m.type==="field")return m.fieldName===v?void 0:m;if(m.type==="group"&&Array.isArray(m.attributeTableElements)){let f=m.attributeTableElements.filter(y=>!(y.type==="field"&&y.fieldName===v));return f.length?{...m,attributeTableElements:f}:void 0}return m}).filter(Boolean),_.attributeTableInfo.orderByFields=_.attributeTableInfo.orderByFields.filter(m=>m.field!==v))}),_?.layerDefinition?.fieldConfigurations&&(_.layerDefinition.fieldConfigurations=_.layerDefinition.fieldConfigurations.filter(v=>!t.includes(v.name))),_?.popupInfo){t.forEach(y=>{_.popupInfo.fieldInfos=_.popupInfo.fieldInfos.filter(x=>x.fieldName!==y),_.popupInfo.popupElements?.forEach((x,O)=>{x.type==="fields"&&x.fieldInfos&&(_.popupInfo.popupElements[O].fieldInfos=_.popupInfo.popupElements[O].fieldInfos.filter(ce=>ce.fieldName!==y))})});let v=`${E(this.portal)}content/users/${this.item.owner}/items/${this.item.id}/update`,m={};u?(m.tables=w,l.layers&&(m.layers=l.layers)):(m.layers=w,l.tables&&(m.tables=l.tables));let f={f:"json",text:JSON.stringify(m)};await $(v,{query:{...f},method:"post",responseType:"json"}).then(y=>{y.data?.success?this.handleSuccess():this.handleError()},()=>this.handleError())}else this.handleSuccess()}else o.httpStatus===200&&(!o.data||JSON.stringify(o.data)==="{}")?this.handleSuccess():this.handleError()},()=>this.handleError())}},()=>this.handleError())}handleSuccess(){this.arcgisFieldsDeleted.emit(),this.dialogNode?.value&&(this.dialogNode.value.open=!1),this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("success"):this.displaySuccessAlert()}handleError(e){this.dialogNode?.value&&(this.dialogNode.value.open=!1),e?this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("read-only-error"):this.displayReadOnlyErrorAlert():this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("error"):this.displayErrorAlert()}displaySuccessAlert(){let{messages:e,fieldNames:s}=this;this.successAlertNode&&(this.successAlertNode.parentElement?.removeChild(this.successAlertNode),this.successAlertNode=void 0),this.successAlertNode=D(g`<calcite-alert .label=${s.length===1?e.fieldDeleted:e.fieldsDeleted} kind=success icon=check-circle auto-close open><div slot=message>${s.length===1?e.fieldDeleted:e.fieldsDeleted}</div></calcite-alert>`),document.body.append(this.successAlertNode)}displayErrorAlert(){let{messages:e}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=D(g`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close open><div slot=message>${e.fieldDeletionUnsuccessful}</div></calcite-alert>`),document.body.append(this.errorAlertNode)}displayReadOnlyErrorAlert(){let{messages:e,portal:s}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=D(g`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close auto-close-duration=slow open><div slot=title>${e.error}</div><div slot=message>${s.isPortal?e.readOnlyErrorMessageEnterprise:e.readOnlyErrorMessage}</div>${!s.isPortal&&g`<calcite-link slot=link target=_blank href=https://status.arcgis.com>${e.healthDashboard}</calcite-link>`||""}</calcite-alert>`),document.body.append(this.errorAlertNode)}render(){let{messages:e,fieldsAreDeletable:s,fieldNames:t,deleteInProgress:r}=this;return g`<calcite-dialog class="dialog" width=s open modal outside-close-disabled escape-disabled @calciteDialogClose=${()=>this.arcgisClose.emit()} .heading=${t?.length===1?e.deleteField:e.deleteFields} ${C(this.dialogNode)}>${this._propWatcherTask.render({pending:()=>g`<div class="dialog-content-wrapper hide-overflow"><div class="loader-container active"><calcite-loader class="loader" .label=${e.fields}></calcite-loader></div></div>`,error:()=>g`<div class="dialog-content-wrapper">${this.renderError()}</div>`,complete:()=>(s||(t?.length?t?.length===1?N("error",this,"Field cannot be deleted"):N("error",this,"One or more fields cannot be deleted"):N("error",this,R("fieldNames"))),s?g`<div class=${`dialog-content-wrapper ${r?"hide-overflow":""}`}>${this.renderDeleteLoader()}<calcite-label>${t.length===1?e.deletePrompt:e.deleteMultiplePrompt}</calcite-label>${this.renderFieldsPreview()}</div>${this.renderCancelButton()}${this.renderDeleteButton()}`:g`<div class="dialog-content-wrapper">${this.renderError()}</div>`)})}</calcite-dialog>`}renderError(){let{messages:e}=this;return g`<div class="loader-container active"><div class="loader-text">${e.errorOccurred}</div></div>`}renderDeleteLoader(){let{messages:e,fieldNames:s,deleteInProgress:t}=this;return g`<div class=${`loader-container ${t?"active":""}`}><calcite-loader class="loader" .label=${s.length===1?e.deletingField:e.deletingFields} .hidden=${!t}></calcite-loader><div class="loader-text">${s.length===1?e.deletingField:e.deletingFields}</div></div>`}renderFieldsPreview(){let{fieldNames:e,layerFields:s,layerFieldsMap:t,arcadeExpMap:r,messages:a}=this;return g`<calcite-list .label=${a.fields}>${e.map(n=>{let c=s.find(p=>p.name===n);return g`<calcite-list-item .label=${this.getFieldLabel(n)} .description=${`{${n}}`} .value=${n} .disabled=${!c.editable}><div slot=actions-end class="field-icons">${Ne({fieldType:te(n,t,r)})}</div></calcite-list-item>`})}</calcite-list>`}renderCancelButton(){let{messages:e}=this;return g`<calcite-button @click=${()=>this.dialogNode.value.open=!1} slot=footer-end appearance=outline ${C(this.cancelNode)}>${e.cancel}</calcite-button>`}renderDeleteButton(){let{messages:e,fieldNames:s}=this;return g`<calcite-button kind=danger slot=footer-end @click=${async t=>{let{portal:r}=this;t.currentTarget.disabled=!0,this.cancelNode.value.disabled=!0,this.dialogNode.value.closeDisabled=!0,r.sourceJSON?.isReadOnly?this.handleError(!0):(this.deleteInProgress=!0,this.requestUpdate(),this.arcgisBeforeDelete.emit(),await this.deleteFields())}}>${s.length===1?e.deleteField:e.deleteFieldsWithNumber.replace("${number}",`${s.length}`)}</calcite-button>`}};J("arcgis-portal-field-delete",k);return k},"core/lang","layers/support/FeatureTemplate","Graphic","identity/IdentityManager","request","applications/PortalApp/layerUtils","layers/support/fieldUtils","layers/support/FeatureReductionBinning","layers/support/FeatureReductionCluster","renderers/support/jsonUtils","request","core/sql","applications/PortalApp/layerUtils",a)
2
+ import a from"./3SCRMD7A.js";import{b as z}from"./HXFKOELM.js";import{a as E}from"./H7DF6TTK.js";import"./KV4ZZSNW.js";import"./2FKNF2ZK.js";import{a as B}from"./AYHYABMC.js";import"./OQ3OHDEB.js";import"./I57CRKF7.js";import{I as S,J as C,K as j,O as D,Q as J,h as M,j as g,o as N,q as A,r as R,v as F}from"./3ZC26CT6.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([le,be,we,Ie,$,de,b,pe,fe,P,X,T,ee,{h:W,j:q,k:G,l:U,m:V,n:H,o:Q,p:K,q:Y,r:Z}])=>{var L=(i=>(i.expression="expression/",i))(L||{});function I(i){return i!=null}function se(i,e,s){let t=e.fieldName;if(t.includes(L.expression)){let r=s.get(t);return r?.title?r.title:t}else return ee.supportsFieldConfiguration(i)&&i.getFieldConfiguration(t)?i.getFieldAlias(t)||t:e.label||t}function te(i,e,s){let t="";if(/^raster.(?:item|service)pixelvalue/iu.test(i))t="number";else if(e.has(i)){let r=e.get(i);t=r.type?r.type.toLowerCase():""}else if(s.has(i)){let r=s.get(i);t=r.returnType?r.returnType.toLowerCase():""}else t="number";return t}async function ie(i){return new Map((await me(i)).filter(e=>e.visible).map(e=>[e.name,e]))}function re(i){let e=new Map;return i?.expressionInfos&&i.expressionInfos.forEach(s=>{let t=`${L.expression}${s.name}`;e.set(t,s)}),e}async function me(i){return await new Promise((e,s)=>{switch(i.type){case"feature":case"ogc-feature":case"stream":e(i.fields);break;case"sublayer":{let t=i,r=t?.layer;r?.portalItem&&r.url.includes("https://demographics")&&r.url.includes(".arcgis.com")?r.portalItem?.fetchData().then(a=>{if(a?.thematicGroup){let n=new Map(t.fields.map(o=>[o.name,o])),c=a.thematicGroup.fieldNames,p=[];c.forEach(o=>{n.has(o)&&p.push(n.get(o))}),e(p)}else e(t.fields)}).catch(a=>{s(new Error(a))}):e(t.fields);break}case"imagery":case"imagery-tile":case"wcs":e(i.rasterFields);break;default:e("fields"in i?i.fields??[]:[])}})}function d(i,e){return!i||!e?!1:i.toLocaleLowerCase()===e.toLocaleLowerCase()}async function ae(i,e,s,t){if(!s)return!1;let r=["feature","oriented-imagery"].includes(e.type),a=t?.item??e.portalItem,n=e.sourceJSON;if(!r||!a||!a.portal.user||!U(a)||G(a)||V(a)||H(n)||a.portal.isPortal&&q(a)||["oid","global-id","geometry"].includes(s.type)||await ue(e,s.name,t))return!1;let c=e.sourceJSON.geometryProperties,p=c?.shapeLengthFieldName,o=c?.shapeAreaFieldName;if(d(p,s.name)||d(o,s.name))return!1;let l=e.editFieldsInfo;if(l&&(d(l.creationDateField,s.name)||d(l.creatorField,s.name)||d(l.editDateField,s.name)||d(l.editorField,s.name))||d(e.objectIdField,s.name)||d(e.displayField,s.name)||d(e.typeIdField,s.name)||d(e.subtypeField,s.name)||e.timeInfo&&(d(e.timeInfo.startField,s.name)||d(e.timeInfo.endField,s.name)||d(e.timeInfo.trackIdField,s.name)))return!1;if(!t?.ignoreLayerRenderer&&e.featureReduction){let f=new Set;if(await b.collectFeatureReductionFields(f,e,e.featureReduction),Array.from(f).some(y=>d(y,s.name)))return!1}if(!t?.ignoreLayerRenderer&&(await b.getRendererFields(e.renderer,e.fieldsIndex)).some(f=>d(f,s.name)))return!1;if(!t?.ignoreLayerLabelingInfo){let f=e.labelingInfo?.map(y=>y.labelExpressionInfo?.expression);if(f&&((await b.getExpressionFields(e,f)).some(y=>d(y,s.name))||await ne(e,s,"layer")))return!1}if(!t?.ignoreLayerDefinitionExpression&&e.definitionExpression&&(await T.parseWhereClause(e.definitionExpression,e.fieldsIndex)).fieldNames.some(f=>d(f,s.name))||await he(e,s,t)||await _e(e,s))return!1;if(await ye(e,s))return await Promise.resolve(!1);if(await ve(e,s))return await Promise.resolve(!1);if(ge(i,e,s)||e.relationships?.map(f=>f.keyField)?.some(f=>d(f,s.name)))return!1;let u=W(a,a.portal.user),w=t?.userItemInfo?.userGroups??await Q(e)??[],_=t?.userItemInfo?.itemGroups??await K(e)??[],v=Z(w,_);if(!u&&!v)return!1;let m=t?.userItemInfo?.relatedItems??await Y(a.id,a.portal,{relationshipType:"Service2Service"});return!(m?.data?.relatedItems&&m.data.relatedItems.some(f=>["WMTS","Map Service","Vector Tile Service"].includes(f.type)))}async function ue(i,e,s){let t=`${i.url}/${i.layerId}/fieldGroups`;try{let r=s?.userItemInfo&&"fieldGroups"in s.userItemInfo?s.userItemInfo.fieldGroups:(await X(t,{query:{f:"json"},responseType:"json"}))?.data?.fieldGroups;return r?r.some(a=>a.fields.some(n=>d(n,e))):!1}catch{return!1}}function ge(i,e,s){if(!i)return!1;let t=i.map?.applicationProperties?.viewing?.search;if(t){let r=t.layers?.find(a=>a.id===e.id);if(r){let a=r?.field?.name;if(a)return d(a,s.name)}}return!1}async function ne(i,e,s){let t=s==="layer"?i.labelingInfo?.filter(n=>I(n.where)):i.sourceJSON?.drawingInfo?.labelingInfo?.filter(n=>I(n.where));if(!t?.length)return!1;let r=[...await Promise.all(t.map(async n=>await T.parseWhereClause(n.where,i.fieldsIndex)))],a=!1;for(let n=0;n<r.length;n++){let c=r[n].fieldNames?.some(p=>d(p,e.name));if(!a&&c){a=!0;break}}return await Promise.resolve(a)}async function he(i,e,s){let t=i.portalItem;if(!t)return!1;let r=`${E(t.portal)}content/items/${t.id}/data`,a=(s?.userItemInfo?.itemData??await X(r,{query:{f:"json"},responseType:"json"}))?.data;if(!a)return!1;if(a?.layers){let n=a.layers.find(l=>l.id===i.layerId),c=n?.layerDefinition?.drawingInfo?.renderer,p=n?.layerDefinition?.featureReduction,o=n?.layerDefinition?.definitionExpression;if(!c&&!p&&!o)return!1;if(!s?.ignoreItemRenderer&&c){let l=P.fromJSON(c);if((await b.getRendererFields(l,i.fieldsIndex)).some(u=>d(u,e.name)))return!0}if(!s?.ignoreItemFeatureReduction&&p&&await oe(i,e,p)||o&&(await T.parseWhereClause(o,i.fieldsIndex)).fieldNames.some(l=>d(l,e.name)))return!0}return!1}async function _e(i,e){let s=i.sourceJSON,t=s?.drawingInfo?.renderer,r=s?.featureReduction;if(!t&&!r)return!1;if(t){let a=P.fromJSON(t);if((await b.getRendererFields(a,i.fieldsIndex)).some(n=>d(n,e.name)))return!0}return!!(r&&await oe(i,e,r))}async function ye(i,e){let s=i.sourceJSON?.drawingInfo?.labelingInfo;if(!s)return await Promise.resolve(!1);let t=s?.map(r=>r.labelExpressionInfo?.expression);if(t){if((await b.getExpressionFields(i,t)).some(r=>d(r,e.name)))return await Promise.resolve(!0);if(await ne(i,e,"service"))return await Promise.resolve(!0)}return await Promise.resolve(!1)}async function ve(i,e){let s=i.sourceJSON?.definitionQuery;return s?(await T.parseWhereClause(s,i.fieldsIndex)).fieldNames.some(t=>d(t,e.name))?await Promise.resolve(!0):await Promise.resolve(!1):await Promise.resolve(!1)}async function oe(i,e,s){let t=s.type==="binning"?pe.fromJSON(s):fe.fromJSON(s),r=new Set;return await b.collectFeatureReductionFields(r,i,t),!!Array.from(r).some(a=>d(a,e.name))}var h=new Map;h.set("oid","key");h.set("guid","key");h.set("global-id","key");h.set("blob","binary");h.set("integer","integer");h.set("small-integer","integer");h.set("big-integer","integer");h.set("single","number");h.set("double","number");h.set("long","number");h.set("number","number");h.set("date","date-time");h.set("date-only","calendar");h.set("time-only","clock");h.set("timestamp-offset","time-zone");h.set("string","string");var Ne=({fieldType:i})=>g`<calcite-icon scale=s .icon=${h.get(i)}></calcite-icon>`,Fe=["esrignss_speed","esrignss_direction","esrisnsr_azimuth","esrignss_positionsourcetype","esrignss_receiver","esrignss_h_rms","esrignss_v_rms","esrignss_latitude","esrignss_longitude","esrignss_altitude","esrignss_pdop","esrignss_hdop","esrignss_vdop","esrignss_fixtype","esrignss_correctionage","esrignss_stationid","esrignss_numsats","esrignss_fixdatetime","esrignss_avg_h_rms","esrignss_avg_v_rms","esrignss_avg_positions","esrignss_h_stddev","esrignss_correction_source_name","esrignss_correction_source_type","esrignss_custom_attributes","esrignss_h_95_status","esrignss_ntrip_mount_point","esrignss_antenna_height","esrignss_orthometric_height","esrignss_profile_has_hor_xform","esrignss_profile_hor_xform","esrignss_receiver_gcs","esrignss_receiver_gcs_wkid","esrignss_receiver_geoid","esrignss_receiver_ref_epoch","esrisnsr_tilt_azimuth_accuracy","esrisnsr_tilt_azimuth","esrisnsr_tilt_angle_accuracy","esrisnsr_tilt_angle","esrignss_tilt_compensated","esrignss_cp1_latitude","esrignss_cp1_longitude","esrignss_cp1_altitude","esrignss_cp1_h_rms","esrignss_cp1_v_rms","esrignss_cp1_fixdatetime","esrignss_cp1_fixtype","esrignss_cp1_corr_age","esrignss_cp1_stationid","esrignss_cp1_numsats","esrignss_cp1_pdop","esrignss_cp1_hdop","esrignss_cp1_vdop","esrignss_cp1_avg_h_rms","esrignss_cp1_avg_v_rms","esrignss_cp1_avg_positions","esrignss_cp1_h_stddev","esrisnsr_cp1_slope_dist","esrisnsr_cp1_inclination","esrisnsr_cp1_azimuth","esrignss_cp2_latitude","esrignss_cp2_longitude","esrignss_cp2_altitude","esrignss_cp2_h_rms","esrignss_cp2_v_rms","esrignss_cp2_fixdatetime","esrignss_cp2_fixtype","esrignss_cp2_corr_age","esrignss_cp2_stationid","esrignss_cp2_numsats","esrignss_cp2_pdop","esrignss_cp2_hdop","esrignss_cp2_vdop","esrignss_cp2_avg_h_rms","esrignss_cp2_avg_v_rms","esrignss_cp2_avg_positions","esrignss_cp2_h_stddev","esrisnsr_cp2_slope_dist","esrisnsr_cp2_inclination","esrisnsr_cp2_azimuth","esrisnsr_offset_method","esrisnsr_offset_device","esrisnsr_offset_laser_height","esrisnsr_offset_laser_target_ht","esrisnsr_offset_mag_var","esrignss_worst_h_rms","esrignss_worst_v_rms","esrignss_worst_fixtype","esrignss_manual_locations"],Ee=M`.dialog{--calcite-dialog-max-size-y: 60%}.dialog-content-wrapper{position:relative;min-height:100px}.hide-overflow{overflow:hidden}.field-icons{padding:0 var(--calcite-spacing-lg);display:flex;align-items:center}.warning{border-bottom:var(--calcite-border-width-sm) solid var(--calcite-color-border-3);margin-bottom:var(--calcite-spacing-md)}.warning-message{font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-bold)}.loader-container{position:absolute;height:100%;width:100%;top:0;right:0;display:none;z-index:40;overflow:hidden;background:#fffffff2;padding:0}.active{display:flex;flex-direction:column;align-items:center;justify-content:center}.loader{padding:0}.loader-text{font-weight:var(--calcite-font-weight-medium);text-align:center;margin-right:6.25rem;margin-left:6.25rem}`,k=class extends j{constructor(){super(...arguments),this.arcadeExpMap=new Map,this.cancelNode=S(),this.dialogNode=S(),this.layerFields=[],this.layerFieldsMap=new Map,this.messages=B({blocking:!0}),this.deleteInProgress=!1,this.fieldsAreDeletable=!1,this._propWatcherTask=new z(this,{task:async([e,s])=>{let t=I(e)&&I(s);if(I(e)||N("error",this,A("layer")),I(s)||N("error",this,A("fieldNames")),!t)throw new Error("Required properties are missing");this._propWatcherTask.autoRun=!1,await this.processProps()},args:()=>[this.layer,this.fieldNames]}),this.arcgisBeforeModalClose=F(),this.arcgisClose=F(),this.arcgisBeforeDelete=F(),this.arcgisFieldsDeleted=F()}static{this.properties={config:0,fieldNames:0,layer:0,mapView:0,options:0}}static{this.styles=Ee}async processProps(){let{layer:e,mapView:s,fieldNames:t}=this;if(!e||!t){this.fieldsAreDeletable=!1;return}e.loaded||await e.load(),this.layerFields=e.fields.filter(a=>t.includes(a.name));let r=t.some(a=>!e.fields.find(n=>n.name===a));if(!this.layerFields?.length||r)this.fieldsAreDeletable=!1;else{let a=await Promise.all(this.layerFields.map(async n=>await ae(s,e,n,this.options)));if(this.fieldsAreDeletable=a.every(n=>n),!this.fieldsAreDeletable)return}if(this.layerFieldsMap=await ie(e),this.options?.ignorePopupTemplate||(this.arcadeExpMap=re(e.popupTemplate)),this.portal=e.portalItem?.portal??this.options?.portal,this.item=e.portalItem??this.options?.item,!this.item){this.fieldsAreDeletable=!1;return}await Ie.getCredential(this.item.url.replace("rest/services","rest/admin/services"))}getFieldLabel(e){let{layer:s,arcadeExpMap:t}=this;if(this.options?.ignorePopupTemplate)return this.getFieldDisplayNameFromLayerFields(e);{let r=(s.popupTemplate??s.createPopupTemplate())?.fieldInfos?.find(a=>a.fieldName===e);return r?se(s,r,t):this.getFieldDisplayNameFromLayerFields(e)}}getFieldDisplayNameFromLayerFields(e){let{layer:s}=this,t=this.layerFieldsMap.get(e);return de.supportsFieldConfiguration(s)?s.getFieldAlias(e):t.alias??t.name}async deleteFields(){let{layer:e,fieldNames:s}=this,t=`${e.url.replace("/rest/services","/rest/admin/services")}/${e.layerId}/deleteFromDefinition`,r={fields:s.map(n=>({name:n}))},a={deleteFromDefinition:JSON.stringify(r)};await $(t,{query:{...a,f:"json",async:!1},method:"post",responseType:"json"}).then(async n=>{if(n.data?.success){let c=`${e.url}/${e.layerId}`;s.forEach(o=>{e.type==="feature"&&e.floorInfo?.floorField===o&&(e.floorInfo=null)});let p=await $(c,{query:{f:"json"},responseType:"json"});if(p){let o=p.data;this.currentLayerInfo=p.data,o&&(this.updateTypesAndTemplatesOnLayer(),s.forEach(l=>{o.templates?.length?o.templates.forEach(u=>delete u.prototype.attributes[l]):o.types?.forEach(u=>{u.templates.forEach(w=>delete w.prototype.attributes[l])})}),this.updateFeatureService(o))}else this.handleError()}else this.handleError()},()=>this.handleError())}updateTypesAndTemplatesOnLayer(){let{currentLayerInfo:e}=this,s=e;if(s.templates?.length){let t=this.updateTemplatesList(s.templates);s.templates=t}else if(s.types){let t=s.types;s.types=[],t.forEach(r=>{r.templates=this.updateTemplatesList(r.templates),this.addType(s,r)})}}updateTemplatesList(e){let{currentLayerInfo:s,messages:t}=this,r=[];return(e??[]).forEach(a=>{let n=new be;n.description=a.description??"",n.name=a.name||t.newFeature,n.drawingTool=a.drawingTool||"point";let c={};s.fields.forEach(o=>{let l=!1;for(let u=0;u<a.prototype.attributes.length;u++)if(a.prototype.attributes[u]===o.name){l=!0,c[o.name]=a.prototype.attributes[o.name];break}!l&&o.editable&&!Fe.includes(o.name)&&(c[o.name]=o.defaultValue||null)});let p=new we({attributes:c});n.prototype=p,r.push(n)}),r}addType(e,s){e.types?e.types.some(t=>t.id===s.id)||e.types.push(s):e.types=[s]}async updateFeatureService(e){let{layer:s,fieldNames:t}=this,r={templates:e.templates,types:e.types},a=`${s.url.replace("/rest/services","/rest/admin/services")}/${s.layerId}/updateDefinition`,n={f:"json",updateDefinition:JSON.stringify(r)};await $(a,{query:{...n,f:"json"},method:"post",responseType:"json"}).then(async c=>{if(c.data?.success){let p=`${E(this.portal)}content/items/${this.item.id}/data`;if(this.options?.ignorePopupTemplate||t.forEach(o=>{s.popupTemplate?.fieldInfos&&(s.popupTemplate.fieldInfos=s.popupTemplate.fieldInfos.filter(l=>l.fieldName!==o)),s.popupTemplate?.content?.forEach((l,u)=>{l.type==="fields"&&l.fieldInfos&&((s.popupTemplate?.content)[u].fieldInfos=(s.popupTemplate?.content)[u].fieldInfos?.filter(w=>w.fieldName!==o))})}),s.attributeTableTemplate){let o=s.attributeTableTemplate.clone();o.elements=o.elements.filter(l=>!(l.type==="field"&&t.includes(l.fieldName))),o.orderByFields=o.orderByFields.filter(l=>!t.includes(l.field)),s.attributeTableTemplate=o}if(s.fieldConfigurations?.length){let o=le.clone(s.fieldConfigurations).filter(l=>!t.includes(l.name));s.fieldConfigurations=o}await $(p,{query:{f:"json"},responseType:"json"}).then(async o=>{let l=o.data;if(l?.layers||l?.tables){let u=s.isTable,w=u?l.tables:l.layers,_=w?.find(v=>v.id===s.layerId);if(t.forEach(v=>{_?.attributeTableInfo?.attributeTableElements&&(_.attributeTableInfo.attributeTableElements=_.attributeTableInfo.attributeTableElements.map(m=>{if(m.type==="field")return m.fieldName===v?void 0:m;if(m.type==="group"&&Array.isArray(m.attributeTableElements)){let f=m.attributeTableElements.filter(y=>!(y.type==="field"&&y.fieldName===v));return f.length?{...m,attributeTableElements:f}:void 0}return m}).filter(Boolean),_.attributeTableInfo.orderByFields=_.attributeTableInfo.orderByFields.filter(m=>m.field!==v))}),_?.layerDefinition?.fieldConfigurations&&(_.layerDefinition.fieldConfigurations=_.layerDefinition.fieldConfigurations.filter(v=>!t.includes(v.name))),_?.popupInfo){t.forEach(y=>{_.popupInfo.fieldInfos=_.popupInfo.fieldInfos.filter(x=>x.fieldName!==y),_.popupInfo.popupElements?.forEach((x,O)=>{x.type==="fields"&&x.fieldInfos&&(_.popupInfo.popupElements[O].fieldInfos=_.popupInfo.popupElements[O].fieldInfos.filter(ce=>ce.fieldName!==y))})});let v=`${E(this.portal)}content/users/${this.item.owner}/items/${this.item.id}/update`,m={};u?(m.tables=w,l.layers&&(m.layers=l.layers)):(m.layers=w,l.tables&&(m.tables=l.tables));let f={f:"json",text:JSON.stringify(m)};await $(v,{query:{...f},method:"post",responseType:"json"}).then(y=>{y.data?.success?this.handleSuccess():this.handleError()},()=>this.handleError())}else this.handleSuccess()}else o.httpStatus===200&&(!o.data||JSON.stringify(o.data)==="{}")?this.handleSuccess():this.handleError()},()=>this.handleError())}},()=>this.handleError())}handleSuccess(){this.arcgisFieldsDeleted.emit(),this.dialogNode?.value&&(this.dialogNode.value.open=!1),this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("success"):this.displaySuccessAlert()}handleError(e){this.dialogNode?.value&&(this.dialogNode.value.open=!1),e?this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("read-only-error"):this.displayReadOnlyErrorAlert():this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("error"):this.displayErrorAlert()}displaySuccessAlert(){let{messages:e,fieldNames:s}=this;this.successAlertNode&&(this.successAlertNode.parentElement?.removeChild(this.successAlertNode),this.successAlertNode=void 0),this.successAlertNode=D(g`<calcite-alert .label=${s.length===1?e.fieldDeleted:e.fieldsDeleted} kind=success icon=check-circle auto-close open><div slot=message>${s.length===1?e.fieldDeleted:e.fieldsDeleted}</div></calcite-alert>`),document.body.append(this.successAlertNode)}displayErrorAlert(){let{messages:e}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=D(g`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close open><div slot=message>${e.fieldDeletionUnsuccessful}</div></calcite-alert>`),document.body.append(this.errorAlertNode)}displayReadOnlyErrorAlert(){let{messages:e,portal:s}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=D(g`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close auto-close-duration=slow open><div slot=title>${e.error}</div><div slot=message>${s.isPortal?e.readOnlyErrorMessageEnterprise:e.readOnlyErrorMessage}</div>${!s.isPortal&&g`<calcite-link slot=link target=_blank href=https://status.arcgis.com>${e.healthDashboard}</calcite-link>`||""}</calcite-alert>`),document.body.append(this.errorAlertNode)}render(){let{messages:e,fieldsAreDeletable:s,fieldNames:t,deleteInProgress:r}=this;return g`<calcite-dialog class="dialog" width=s open modal outside-close-disabled escape-disabled @calciteDialogClose=${()=>this.arcgisClose.emit()} .heading=${t?.length===1?e.deleteField:e.deleteFields} ${C(this.dialogNode)}>${this._propWatcherTask.render({pending:()=>g`<div class="dialog-content-wrapper hide-overflow"><div class="loader-container active"><calcite-loader class="loader" .label=${e.fields}></calcite-loader></div></div>`,error:()=>g`<div class="dialog-content-wrapper">${this.renderError()}</div>`,complete:()=>(s||(t?.length?t?.length===1?N("error",this,"Field cannot be deleted"):N("error",this,"One or more fields cannot be deleted"):N("error",this,R("fieldNames"))),s?g`<div class=${`dialog-content-wrapper ${r?"hide-overflow":""}`}>${this.renderDeleteLoader()}<calcite-label>${t.length===1?e.deletePrompt:e.deleteMultiplePrompt}</calcite-label>${this.renderFieldsPreview()}</div>${this.renderCancelButton()}${this.renderDeleteButton()}`:g`<div class="dialog-content-wrapper">${this.renderError()}</div>`)})}</calcite-dialog>`}renderError(){let{messages:e}=this;return g`<div class="loader-container active"><div class="loader-text">${e.errorOccurred}</div></div>`}renderDeleteLoader(){let{messages:e,fieldNames:s,deleteInProgress:t}=this;return g`<div class=${`loader-container ${t?"active":""}`}><calcite-loader class="loader" .label=${s.length===1?e.deletingField:e.deletingFields} .hidden=${!t}></calcite-loader><div class="loader-text">${s.length===1?e.deletingField:e.deletingFields}</div></div>`}renderFieldsPreview(){let{fieldNames:e,layerFields:s,layerFieldsMap:t,arcadeExpMap:r,messages:a}=this;return g`<calcite-list .label=${a.fields}>${e.map(n=>{let c=s.find(p=>p.name===n);return g`<calcite-list-item .label=${this.getFieldLabel(n)} .description=${`{${n}}`} .value=${n} .disabled=${!c.editable}><div slot=actions-end class="field-icons">${Ne({fieldType:te(n,t,r)})}</div></calcite-list-item>`})}</calcite-list>`}renderCancelButton(){let{messages:e}=this;return g`<calcite-button @click=${()=>this.dialogNode.value.open=!1} slot=footer-end appearance=outline ${C(this.cancelNode)}>${e.cancel}</calcite-button>`}renderDeleteButton(){let{messages:e,fieldNames:s}=this;return g`<calcite-button kind=danger slot=footer-end @click=${async t=>{let{portal:r}=this;t.currentTarget.disabled=!0,this.cancelNode.value.disabled=!0,this.dialogNode.value.closeDisabled=!0,r.sourceJSON?.isReadOnly?this.handleError(!0):(this.deleteInProgress=!0,this.requestUpdate(),this.arcgisBeforeDelete.emit(),await this.deleteFields())}}>${s.length===1?e.deleteField:e.deleteFieldsWithNumber.replace("${number}",`${s.length}`)}</calcite-button>`}};J("arcgis-portal-field-delete",k);return k},"core/lang","layers/support/FeatureTemplate","Graphic","identity/IdentityManager","request","applications/PortalApp/layerUtils","layers/support/fieldUtils","layers/support/FeatureReductionBinning","layers/support/FeatureReductionCluster","renderers/support/jsonUtils","request","core/sql","applications/PortalApp/layerUtils",a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import a from"./RHCRPJWS.js";import{d as g}from"./VDXESPJK.js";import{c as $}from"./2FKNF2ZK.js";import{a as F}from"./FJ3I3AJE.js";import{J as x,K as b,L as _,M as s,N as v,R as y,h as u,j as o,w as p}from"./AICPYLWE.js";export default $arcgis.t(([{watch:l},h,{substitute:B},{a:k,b:S,c:R,d:P}])=>{var U=u`:host{position:relative;display:flex;height:100%;flex-direction:column;overflow-y:auto;overflow-x:hidden;background-color:var(--calcite-color-background);--arcgis-browser-max-width: 100%;--arcgis-browser-pane-width: 18.75rem;--arcgis-browser-pane-z-index: 11;container-type:inline-size;container-name:portal-browser}:host([height="auto"]){height:auto;min-height:100%;flex:1 1 100%}.wrapper{display:flex;height:100%;flex-direction:column;overflow:hidden}.wrapper--fixed{overflow:hidden}.wrapper--auto{flex:1 1 100%}.wrapper--full{transform:translate(0)}.panel{display:flex;height:100%;flex-direction:column;overflow:hidden}.panel--fixed{transform:translateZ(0)}.top-bar{position:sticky;top:0;right:0;left:0;z-index:20;flex-shrink:0;flex-grow:0;border-bottom:1px solid var(--calcite-color-border-3)}.scrolling{position:relative;display:flex;min-height:0px;width:100%;flex:1 1 0%;flex-direction:column}.scrolling--panel{overflow-y:scroll}@supports (scrollbar-gutter: stable){.scrolling--panel{scrollbar-gutter:stable;overflow-y:auto}}.scrolling--full{overflow:hidden}.preview-position{position:absolute;inset:0;margin-inline:auto;width:100%;max-width:var(--arcgis-browser-max-width)}.preview-position--with-top-bar{top:3rem}.preview-desktop{width:100%}.two-up{margin-left:auto;margin-right:auto;display:flex;width:100%;flex:1 1 auto;flex-direction:row;max-width:var(--arcgis-browser-max-width)}.two-up.small{margin-top:-1px}.two-up--fullscreen{height:100%;overflow:hidden}.content__start{margin-inline-end:.25rem;padding-inline:1rem}.content{position:relative;display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;overflow:hidden}.content--full{overflow-y:scroll}@supports (scrollbar-gutter: stable){.content--full{scrollbar-gutter:stable;overflow-y:auto}}.content__top{position:relative;display:flex;height:1.5rem;flex-grow:0;align-items:center;justify-content:space-between;padding-top:1.25rem;padding-bottom:.75rem;font-size:1.125rem;color:var(--calcite-color-text-1);z-index:2}.content__top__end{margin-inline-start:auto;display:grid;gap:.5rem;grid-auto-flow:column}.actions,.filter-status{flex:1 1 0%}.content__view{margin-inline-end:.25rem;min-width:0px;flex:1 1 0%;padding-inline:var(--arcgis-browser-content-padding, 1rem)}.content__view--padded-bottom{padding-bottom:1rem}.content__view--no-filters{margin-inline-start:.25rem;padding-inline-start:var(--arcgis-browser-content-padding, 1rem)}.pane{pointer-events:none;visibility:hidden;display:flex;height:100%;background-color:var(--calcite-color-background);opacity:0;transition-duration:var(--calcite-internal-animation-timing-medium);transition-property:transform,visibility,opacity;border-left:1px solid var(--calcite-color-border-3);border-right:1px solid var(--calcite-color-border-3)}.pane--open{pointer-events:auto;visibility:visible;opacity:1;transform:translate(0);box-shadow:4px 0 16px #0000000f}.preview{width:0px;flex-shrink:0;flex-grow:0;position:absolute;top:0;bottom:0;inset-inline-start:0;transition-duration:var(--calcite-internal-animation-timing-medium);transition-property:width;z-index:var(--arcgis-browser-pane-z-index)}.preview--fixed{position:fixed}.preview--active{overflow:auto;width:var(--arcgis-browser-pane-width);box-shadow:#0000000f 4px 0 16px}.filter-panel,.preview-panel{position:relative;height:100%;background-color:var(--calcite-color-background)}.filter-panel__content{padding:.75rem 1rem 0}.filter-status--mobile{width:100%}.filter-status--active{display:block}.popover-contents{width:var(--arcgis-browser-popover-width);height:var(--arcgis-browser-popover-height)}.sheet{pointer-events:none;position:fixed;inset:0;z-index:110}.sheet--top-bar{top:3rem;overflow:hidden}.sheet__background{position:absolute;inset:0;opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s,outline 0s,outline-offset 0s;background-color:#0003}.sheet__background--hidden{display:none}.sheet--active .sheet__background{opacity:1}.sheet--active{pointer-events:auto;opacity:1}.sheet__contents{position:absolute;inset:0;opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s,outline 0s,outline-offset 0s;top:3rem;transform:translate3d(0,24px,0)}.sheet__contents--full{top:0;--tw-shadow: 0 2px 12px -4px rgba(0, 0, 0, .2), 0 2px 4px -2px rgba(0, 0, 0, .16);--tw-shadow-colored: 0 2px 12px -4px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);inset-inline-end:0;width:100%;border:1px solid var(--calcite-color-border-3);border-inline-start:1px solid var(--calcite-color-border-3);transform:translate3d(0,24px,0)}.sheet--active .sheet__contents{opacity:1;transform:translateZ(0)}.hide{display:none}.aria-hidden{height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;position:absolute;top:0;bottom:0;width:0px;inset-inline-end:0}.content__view--flex{display:flex;flex-direction:column}.cover{display:flex;flex:1 1 0%;align-items:flex-start;justify-content:center;overflow:auto;padding-bottom:1rem;padding-top:.25rem}.no-results{height:100%;width:100%;flex:1 1 0%;text-align:center;font-size:.875rem;color:var(--calcite-color-text-2)}::slotted([slot="no-results"]){width:100%}::slotted([slot="no-content"]){width:100%}.results-wrapper{flex:1 1 0%}.results-wrapper--spaced{padding-top:1.5rem}.loader{margin-top:min(8rem,30vh);--calcite-loader-padding: 0}.filters{box-sizing:border-box;flex-grow:0;padding-inline:1.5rem 0;width:var(--arcgis-browser-pane-width)}.filters--sticky{position:sticky;top:0;height:100%}.filters__content{overflow-y:auto;height:100%;padding-top:1.5rem;box-sizing:border-box;scrollbar-gutter:stable}.filters--empty{display:none}.filters--active{opacity:1;transform:translateZ(0)}.filters__title{margin:0 0 1rem;padding:0 0 1rem;font-size:1.125rem;font-weight:500;color:var(--calcite-color-text-1);padding-inline-start:.75rem;border-bottom:1px solid var(--calcite-color-border-3)}.range{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.875rem;color:var(--calcite-color-text-1)}.container{display:flex;height:100%;width:100%;flex-direction:column;background-color:var(--calcite-color-background)}.container__header{display:flex;flex:0 1 auto;flex-direction:row;background-color:var(--calcite-color-foreground-1);border-bottom:1px solid var(--calcite-color-border-3)}.container__header__text{margin:0;flex:1 1 0%;padding:.875rem .75rem;font-size:1rem;font-weight:500;color:var(--calcite-color-text-2)}.container__content{flex:1 1 0%;overflow:auto}.container__footer{box-sizing:border-box;width:100%;flex:0 1 auto;background-color:var(--calcite-color-foreground-1);padding:.5rem}.small .filters{padding:0}.small .filters__content{padding-left:1rem;padding-right:1rem}.small .content__view{padding-inline:.5rem;margin-inline:0}.small .content__view--panel{padding-inline:0}.small .content__start{margin-inline:0;padding-inline:.5rem}@container portal-browser (max-width: 640px){:host{--arcgis-browser-pane-width: 100%}}.scrim__find{margin-top:3.5rem;opacity:.6;transition-property:opacity;transition-duration:.15s;--calcite-scrim-background: rgba(0, 0, 0, .6)}`;function C(d){return{...d,value:void 0,..."additionalParams"in d?{additionalParams:void 0}:{}}}function I(d,t={}){let{hiddenFilterIds:e,preservedFilterIds:i}=t,a=new Set([...e||[],...i||[]]);return Object.entries(d).reduce((r,[n,c])=>a.has(n)?(r[n]=c,r):(r[n]=C(c),r),{})}function q(d){let t=Math.max(d?.total??0,0),e=d?.results?.length??0;if(!t||!e)return{start:0,end:0,total:t};let i=Math.max(d?.start??1,1),a=Math.min(i+e-1,t);return{start:i,end:a,total:t}}var A=49,f=class extends _{constructor(){super(...arguments),this._messages=F({blocking:!0}),this._previewContainer=x(),this.toggleScrim=t=>{this.scrimActive=t.detail},this.checkFlowItem=()=>{this.flowItem=g(this.el,"calcite-flow-item")},this.handleResize=()=>{requestAnimationFrame(this.updatePreviewPosition)},this.updatePreviewPosition=()=>{if(this.formFactor==="small"||this.height!=="auto"||!this._previewContainer)return;this.checkFlowItem();let t=this._previewContainer.value?.getBoundingClientRect();if(!t)return;let{x:e,y:i,height:a,right:r,width:n}=t,c=a+i,m=window.innerWidth-document.body.offsetWidth,w=window.innerWidth<n||window.innerWidth<window.outerWidth&&window.innerWidth<=n+m;this.previewBoundingBox={top:Math.max(i,0),left:e,right:w?0:window.outerWidth-r-m,bottom:c>window.innerHeight?0:window.innerHeight-c}},this.pageRangeText="",this.noResults=!1,this.initialHide=!0,this.scrimActive=!1,this.panel=!1,this.preview=!1,this.loading=!1,this.hideContentTop=!1,this.alwaysShowSelection=!1,this.alwaysShowContent=!1,this.response={nextStart:-1,num:0,results:[],start:1,total:0},this.store=R(),this.formFactor="large",this.searchTerm="",this.height="full",this.arcgisAriaUpdate=p(),this.arcgisBrowserFilterClear=p(),this.arcgisBrowserFilterRemove=p(),this.ariaUpdate=p()}static{this.properties={pageRangeText:16,noResults:16,previewBoundingBox:16,initialHide:16,scrimActive:16,flowItem:16,panel:5,preview:5,loading:5,hideContentTop:5,hideTopBar:5,selected:0,alwaysShowSelection:5,alwaysShowContent:5,response:0,store:0,formFactor:1,searchTerm:1,height:3,hideFilters:5,showPreSearch:5,rangeFormatter:0,alwaysShowPagination:5}}static{this.styles=U}async scrollToTop(){this.renderRoot.querySelector(".top-bar")?.scrollIntoView({behavior:"smooth",block:"nearest"})}connectedCallback(){super.connectedCallback(),window.addEventListener("scroll",this.handleResize),window.addEventListener("resize",this.handleResize),this.el.addEventListener("arcgisItemBrowserScrimToggle",this.toggleScrim),this.checkFlowItem(),this.attachStoreWatchers()}willUpdate(t){t.has("store")&&this.attachStoreWatchers(),t.has("response")&&this.updatePage(this.response)}firstUpdated(){requestAnimationFrame(this.updatePreviewPosition)}disconnectedCallback(){this.removePreviewWatcher?.(),this.removeStoreWatcher?.(),window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleResize),this.el.removeEventListener("arcgisItemBrowserScrimToggle",this.toggleScrim),super.disconnectedCallback()}attachStoreWatchers(){if(this.removePreviewWatcher?.(),this.removeStoreWatcher?.(),!this.store)return;this.removePreviewWatcher=P(this.store,this.updatePreviewPosition);let t=[l(()=>this.store.type,()=>this.requestUpdate()),l(()=>this.store.width,()=>this.requestUpdate()),l(()=>this.store.height,()=>this.requestUpdate()),l(()=>this.store.filtersEmpty,()=>this.requestUpdate()),l(()=>this.store.topbarEmpty,()=>this.requestUpdate()),l(()=>this.store.sortEmpty,()=>this.requestUpdate()),l(()=>this.store.filtersExpanded,()=>this.requestUpdate()),l(()=>this.store.panel,()=>this.requestUpdate()),l(()=>this.store.preview,()=>this.requestUpdate()),l(()=>this.store.searchTerm,()=>this.requestUpdate()),l(()=>this.store.hiddenFilters,()=>this.requestUpdate()),l(()=>this.store.filters,()=>this.requestUpdate()),l(()=>this.store.recycleBin,()=>this.requestUpdate())];this.removeStoreWatcher=()=>{t.forEach(e=>e.remove())}}async updatePage(t){let[e,i]=await this.updatePageRange(t);this.pageRangeText=e,this.arcgisAriaUpdate.emit(i),this.el.dispatchEvent(new CustomEvent("ariaUpdate",{detail:i})),this.noResults=S(this.store)&&this.store.recycleBin?t.results.length===0:(t?.total??0)===0,this.initialHide=!1}async updatePageRange(t){let{start:e,end:i,total:a}=q(t),r=h.formatNumber(e,{maximumFractionDigits:0}),n=h.formatNumber(i,{maximumFractionDigits:0}),c=`${h.formatNumber(a,{maximumFractionDigits:0})}${a>=1e4?"+":""}`,m=h.formatNumber(t.results?.length??0,{maximumFractionDigits:0}),w=h.formatNumber(Math.max(Math.ceil(e/Math.max(t.num||1,1)),1),{maximumFractionDigits:0});if(this.rangeFormatter)return await this.rangeFormatter({start:r,end:n,total:c,results:{items:m,page:w}});let E=this._messages.browser.pageRange,T=this._messages.browser.pageRangeAria,W=B(E,{start:r,end:n,total:c}),z=B(T,{start:r,end:n,total:c});return[W,z]}hasActiveFilter(t){return Object.values(t.filters).filter(({id:e})=>!$(k,e)).some(e=>!!e.value||e.id==="collaborations")}removeFilter(t){let e=this.store.filters[t];if(!e)return;let i=C(e),a={...this.store.filters,[t]:i};this.store.filters=a,this.arcgisBrowserFilterRemove.emit(t)}clearFilters(){let t=I(this.store.filters,{hiddenFilterIds:this.store.hiddenFilters,preservedFilterIds:["folder","group","contentType"]});this.store.filters=t,this.arcgisBrowserFilterClear.emit(null)}renderNoResults(){let t=this.noResults&&!this.loading&&!this.showPreSearch,e=this.hasActiveFilter(this.store)||!!this.searchTerm;return t?o`<div class="cover"><div class="no-results">${e?o`<slot name=no-results></slot>`:o`<slot name=no-content></slot>`}</div></div>`:null}renderPopoverContents(t,e,i){let a=this.flowItem?this.flowItem.offsetHeight:this.store.height,r=this.formFactor==="small"&&this.hasActiveFilter(this.store)&&!this.hideFilters;return this.el.style.setProperty("--arcgis-browser-popover-width",i?"100%":`${this.store.width||0}px`),this.el.style.setProperty("--arcgis-browser-popover-height",i?"100%":`${a||0}px`),o`<div class="popover-contents"><div class=${s({hide:!e,"preview-panel":!0})}><slot name=preview></slot></div><div class=${s({hide:!t,"filter-panel":!0})}><article class="container"><header class="container__header"><h2 class="container__header__text">${this._messages.browser?.refineContent}</h2><calcite-action .text=${this._messages.browser?.close} scale=m icon=x @click=${()=>{this.store.filtersExpanded=!1}}></calcite-action></header><div class="container__content"><div class="container__content__scroll"><slot name=filters-top></slot>${(this.store.panel||i)&&o`<div class="filter-container__content"><slot name=sort></slot></div>`||""}<slot name=filters></slot></div></div><div class=${s({"filter-status--mobile":!0,container__footer:!0,hide:!r})}><arcgis-portal-browser-filter-status class="filter-status" .filters=${this.store.filters} .hiddenFilterIds=${this.store.hiddenFilters||[]} .componentWidth=${this.store.width||this.flowItem?.offsetWidth||window.innerWidth} .browserWidth=${window.innerWidth} @arcgisBrowserFilterClear=${()=>this.clearFilters()} @arcgisBrowserFilterRemove=${n=>this.removeFilter(n.detail)}></arcgis-portal-browser-filter-status></div></article></div></div>`}renderFlow(){let t=!!this.store.panel,e=!!this.store.filtersExpanded&&(!this.store.filtersEmpty||!this.store.sortEmpty&&t),i=!!this.store.preview,a=!this.store.panel&&document.documentElement.clientWidth>(this.store.width||0);return o`<div class=${s({panel:!0,"panel--fixed":a})}>${!this.hideTopBar&&o`<div class=${s({"top-bar":!0,"top-bar--small":this.formFactor==="small"})}><slot name=top-bar></slot></div>`||""}<div class="scrolling scrolling--panel"><div class=${s({"two-up":!0,[this.formFactor]:!0})}><div class="content"><div><slot name=primary-filter></slot></div><div class="content__start"><slot name=content-start></slot></div>${this.loading&&!this.alwaysShowContent&&o`<div class="content__view content__view--flex"><div class="cover"><calcite-loader class="loader" label></calcite-loader></div></div>`||""}${this.noResults&&!this.loading&&o`<div class="content__view content__view--flex"><div class="cover">${this.renderNoResults()}</div></div>`||""}<div class=${s({hide:this.loading||this.noResults,content__view:!0,"content__view--panel":!!this.store.panel,"content__view--flex":!this.loading&&!this.noResults})}>${!this.store.panel&&!this.hideContentTop&&o`<div class="content__top"><span class=${s({selection:!0,hide:!this.alwaysShowSelection})}><slot name=selection></slot></span>${!this.loading&&o`<span class="range">${this.pageRangeText}</span>`||""}<span class="actions"><slot name=actions></slot></span><div class="content__top__end"><slot name=view></slot>${!t&&o`<slot name=sort></slot>`||""}</div></div>`||""}<div class="flow-content"><slot name=content></slot></div><slot name=pagination></slot><slot name=content-end></slot></div></div></div><slot name=scroll-end></slot></div>${!this.store.panel||window.innerWidth<(this.store.width||0)*2?o`<div class=${s({sheet:!0,"sheet--active":e||i,"sheet--top-bar":a})}><div class=${s({sheet__background:!0,"sheet__background--hidden":a})}></div><div class=${s({sheet__contents:!0,"sheet__contents--full":a})}>${this.renderPopoverContents(e,i,!0)}</div></div>`:o`<calcite-popover overlay-positioning=fixed .open=${i||e} label=filters .referenceElement=${this.flowItem||this.el} offset-skidding=0 offset-distance=0 trigger-disabled pointer-disabled .placement=${this.store.panel?"trailing":"auto"} @calcitePopoverOpen=${r=>{(!this.store.panel||window.innerWidth<(this.store.width||0)*2)&&(r.currentTarget.style.transform="none")}} .focusTrapOptions=${{setReturnFocus:r=>{if(!(r instanceof HTMLElement))return r;let n=g(r,"arcgis-portal-item-card, arcgis-portal-group-card");return n?.restoreFocus?(n.restoreFocus(),!1):r}}}>${this.renderPopoverContents(e,i)}</calcite-popover>`}</div>`}render(){let t=this.height==="auto",e=this.height==="full",i=!!this.store.preview,a=`${(this.store.height||window.innerHeight)-A}px`,r=t?{}:{maxHeight:a};return this.formFactor==="small"?this.renderFlow():o`<div class=${s({wrapper:!0,"wrapper--fixed":!!this.store.filtersExpanded,"wrapper--auto":t,"wrapper--full":e})}>${!this.hideTopBar&&o`<div class="top-bar"><slot name=top-bar></slot></div>`||""}<slot name=top-bar-end></slot><div class=${s({"preview-position":!0,"preview-position--with-top-bar":!this.store.topbarEmpty})} ${b(this._previewContainer)}><div class=${s({preview:!0,"preview--active":i,"preview--fixed":t})} style=${v(t&&this.previewBoundingBox?{top:`${this.previewBoundingBox.top||0}px`,...document.dir==="rtl"?{right:`${this.previewBoundingBox.right||0}px`}:{left:`${this.previewBoundingBox.left||0}px`},bottom:`${this.previewBoundingBox.bottom||0}px`}:{})}><div class=${s({pane:!0,"pane--open":i})}><div class="preview-desktop"><slot name=preview></slot></div></div></div></div><div class=${s({scrolling:!0,"scrolling--full":!t||this.panel})}>${this.scrimActive&&o`<calcite-scrim class="scrim__find"></calcite-scrim>`||""}<div class=${s({"two-up":!0,"two-up--fullscreen":e,[this.formFactor]:!0})}><div class=${s({filters:!0,"filters--sticky":!t,"filters--empty":this.store.filtersEmpty&&!this.store.preview,"filters--active":!!this.store.filtersExpanded})} style=${v(e?{}:r)}><div class="filters__content" style=${v(e?{}:r)}><slot name=filters></slot></div></div><div class=${s({content:!0,"content--full":e})}><div class="content__start"><slot name=content-start></slot></div><div class=${s({content__view:!0,"content__view--no-filters":this.store.filtersEmpty&&!this.store.preview,"content__view--flex":!0})}>${!this.hideContentTop&&o`<div class="content__top">${this.showPreSearch?null:o`<div class="content__top__summary"><span class=${s({selection:!0,hide:!this.alwaysShowSelection})}><slot name=selection></slot></span>${!this.loading&&o`<span class="range">${this.pageRangeText}<slot name=range-end></slot></span>`||""}</div>`}<span class="actions"><slot name=actions></slot></span><div class="content__top__end"><slot name=view></slot><slot name=sort></slot></div></div>`||""}${this.loading&&(!this.alwaysShowContent||this.initialHide)&&o`<div class="cover"><calcite-loader class="loader" .label=${this._messages.browser?.loading??""}></calcite-loader></div>`||""}${this.renderNoResults()}${!this.loading&&this.showPreSearch&&o`<div class="cover"><div class="no-results"><slot name=pre-search></slot></div></div>`||""}<div class=${s({hide:!!this.showPreSearch||this.loading&&!this.alwaysShowContent||!this.loading&&this.noResults||this.initialHide,"results-wrapper--spaced":this.hideContentTop,"results-wrapper":!0})}><slot name=content></slot></div><div class=${s({hide:this.loading||this.noResults&&!this.alwaysShowPagination})}><slot name=pagination></slot><slot name=content-end></slot></div></div></div></div><slot name=scroll-end></slot></div></div>`}};y("arcgis-portal-browser",f);return{a:C,b:I,c:f}},"core/reactiveUtils","intl","intl",a)
2
+ import a from"./5SKCVK2P.js";import{d as g}from"./VDXESPJK.js";import{c as $}from"./2FKNF2ZK.js";import{a as F}from"./AYHYABMC.js";import{I as x,J as b,K as _,L as s,M as v,Q as y,h as u,j as o,v as p}from"./3ZC26CT6.js";export default $arcgis.t(([{watch:l},h,{substitute:B},{a:k,b:S,c:R,d:P}])=>{var U=u`:host{position:relative;display:flex;height:100%;flex-direction:column;overflow-y:auto;overflow-x:hidden;background-color:var(--calcite-color-background);--arcgis-browser-max-width: 100%;--arcgis-browser-pane-width: 18.75rem;--arcgis-browser-pane-z-index: 11;container-type:inline-size;container-name:portal-browser}:host([height="auto"]){height:auto;min-height:100%;flex:1 1 100%}.wrapper{display:flex;height:100%;flex-direction:column;overflow:hidden}.wrapper--fixed{overflow:hidden}.wrapper--auto{flex:1 1 100%}.wrapper--full{transform:translate(0)}.panel{display:flex;height:100%;flex-direction:column;overflow:hidden}.panel--fixed{transform:translateZ(0)}.top-bar{position:sticky;top:0;right:0;left:0;z-index:20;flex-shrink:0;flex-grow:0;border-bottom:1px solid var(--calcite-color-border-3)}.scrolling{position:relative;display:flex;min-height:0px;width:100%;flex:1 1 0%;flex-direction:column}.scrolling--panel{overflow-y:scroll}@supports (scrollbar-gutter: stable){.scrolling--panel{scrollbar-gutter:stable;overflow-y:auto}}.scrolling--full{overflow:hidden}.preview-position{position:absolute;inset:0;margin-inline:auto;width:100%;max-width:var(--arcgis-browser-max-width)}.preview-position--with-top-bar{top:3rem}.preview-desktop{width:100%}.two-up{margin-left:auto;margin-right:auto;display:flex;width:100%;flex:1 1 auto;flex-direction:row;max-width:var(--arcgis-browser-max-width)}.two-up.small{margin-top:-1px}.two-up--fullscreen{height:100%;overflow:hidden}.content__start{margin-inline-end:.25rem;padding-inline:1rem}.content{position:relative;display:flex;min-width:0px;flex:1 1 0%;flex-direction:column;overflow:hidden}.content--full{overflow-y:scroll}@supports (scrollbar-gutter: stable){.content--full{scrollbar-gutter:stable;overflow-y:auto}}.content__top{position:relative;display:flex;height:1.5rem;flex-grow:0;align-items:center;justify-content:space-between;padding-top:1.25rem;padding-bottom:.75rem;font-size:1.125rem;color:var(--calcite-color-text-1);z-index:2}.content__top__end{margin-inline-start:auto;display:grid;gap:.5rem;grid-auto-flow:column}.actions,.filter-status{flex:1 1 0%}.content__view{margin-inline-end:.25rem;min-width:0px;flex:1 1 0%;padding-inline:var(--arcgis-browser-content-padding, 1rem)}.content__view--padded-bottom{padding-bottom:1rem}.content__view--no-filters{margin-inline-start:.25rem;padding-inline-start:var(--arcgis-browser-content-padding, 1rem)}.pane{pointer-events:none;visibility:hidden;display:flex;height:100%;background-color:var(--calcite-color-background);opacity:0;transition-duration:var(--calcite-internal-animation-timing-medium);transition-property:transform,visibility,opacity;border-left:1px solid var(--calcite-color-border-3);border-right:1px solid var(--calcite-color-border-3)}.pane--open{pointer-events:auto;visibility:visible;opacity:1;transform:translate(0);box-shadow:4px 0 16px #0000000f}.preview{width:0px;flex-shrink:0;flex-grow:0;position:absolute;top:0;bottom:0;inset-inline-start:0;transition-duration:var(--calcite-internal-animation-timing-medium);transition-property:width;z-index:var(--arcgis-browser-pane-z-index)}.preview--fixed{position:fixed}.preview--active{overflow:auto;width:var(--arcgis-browser-pane-width);box-shadow:#0000000f 4px 0 16px}.filter-panel,.preview-panel{position:relative;height:100%;background-color:var(--calcite-color-background)}.filter-panel__content{padding:.75rem 1rem 0}.filter-status--mobile{width:100%}.filter-status--active{display:block}.popover-contents{width:var(--arcgis-browser-popover-width);height:var(--arcgis-browser-popover-height)}.sheet{pointer-events:none;position:fixed;inset:0;z-index:110}.sheet--top-bar{top:3rem;overflow:hidden}.sheet__background{position:absolute;inset:0;opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s,outline 0s,outline-offset 0s;background-color:#0003}.sheet__background--hidden{display:none}.sheet--active .sheet__background{opacity:1}.sheet--active{pointer-events:auto;opacity:1}.sheet__contents{position:absolute;inset:0;opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s,outline 0s,outline-offset 0s;top:3rem;transform:translate3d(0,24px,0)}.sheet__contents--full{top:0;--tw-shadow: 0 2px 12px -4px rgba(0, 0, 0, .2), 0 2px 4px -2px rgba(0, 0, 0, .16);--tw-shadow-colored: 0 2px 12px -4px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);inset-inline-end:0;width:100%;border:1px solid var(--calcite-color-border-3);border-inline-start:1px solid var(--calcite-color-border-3);transform:translate3d(0,24px,0)}.sheet--active .sheet__contents{opacity:1;transform:translateZ(0)}.hide{display:none}.aria-hidden{height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;position:absolute;top:0;bottom:0;width:0px;inset-inline-end:0}.content__view--flex{display:flex;flex-direction:column}.cover{display:flex;flex:1 1 0%;align-items:flex-start;justify-content:center;overflow:auto;padding-bottom:1rem;padding-top:.25rem}.no-results{height:100%;width:100%;flex:1 1 0%;text-align:center;font-size:.875rem;color:var(--calcite-color-text-2)}::slotted([slot="no-results"]){width:100%}::slotted([slot="no-content"]){width:100%}.results-wrapper{flex:1 1 0%}.results-wrapper--spaced{padding-top:1.5rem}.loader{margin-top:min(8rem,30vh);--calcite-loader-padding: 0}.filters{box-sizing:border-box;flex-grow:0;padding-inline:1.5rem 0;width:var(--arcgis-browser-pane-width)}.filters--sticky{position:sticky;top:0;height:100%}.filters__content{overflow-y:auto;height:100%;padding-top:1.5rem;box-sizing:border-box;scrollbar-gutter:stable}.filters--empty{display:none}.filters--active{opacity:1;transform:translateZ(0)}.filters__title{margin:0 0 1rem;padding:0 0 1rem;font-size:1.125rem;font-weight:500;color:var(--calcite-color-text-1);padding-inline-start:.75rem;border-bottom:1px solid var(--calcite-color-border-3)}.range{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.875rem;color:var(--calcite-color-text-1)}.container{display:flex;height:100%;width:100%;flex-direction:column;background-color:var(--calcite-color-background)}.container__header{display:flex;flex:0 1 auto;flex-direction:row;background-color:var(--calcite-color-foreground-1);border-bottom:1px solid var(--calcite-color-border-3)}.container__header__text{margin:0;flex:1 1 0%;padding:.875rem .75rem;font-size:1rem;font-weight:500;color:var(--calcite-color-text-2)}.container__content{flex:1 1 0%;overflow:auto}.container__footer{box-sizing:border-box;width:100%;flex:0 1 auto;background-color:var(--calcite-color-foreground-1);padding:.5rem}.small .filters{padding:0}.small .filters__content{padding-left:1rem;padding-right:1rem}.small .content__view{padding-inline:.5rem;margin-inline:0}.small .content__view--panel{padding-inline:0}.small .content__start{margin-inline:0;padding-inline:.5rem}@container portal-browser (max-width: 640px){:host{--arcgis-browser-pane-width: 100%}}.scrim__find{margin-top:3.5rem;opacity:.6;transition-property:opacity;transition-duration:.15s;--calcite-scrim-background: rgba(0, 0, 0, .6)}`;function C(d){return{...d,value:void 0,..."additionalParams"in d?{additionalParams:void 0}:{}}}function I(d,t={}){let{hiddenFilterIds:e,preservedFilterIds:i}=t,a=new Set([...e||[],...i||[]]);return Object.entries(d).reduce((r,[n,c])=>a.has(n)?(r[n]=c,r):(r[n]=C(c),r),{})}function q(d){let t=Math.max(d?.total??0,0),e=d?.results?.length??0;if(!t||!e)return{start:0,end:0,total:t};let i=Math.max(d?.start??1,1),a=Math.min(i+e-1,t);return{start:i,end:a,total:t}}var A=49,f=class extends _{constructor(){super(...arguments),this._messages=F({blocking:!0}),this._previewContainer=x(),this.toggleScrim=t=>{this.scrimActive=t.detail},this.checkFlowItem=()=>{this.flowItem=g(this.el,"calcite-flow-item")},this.handleResize=()=>{requestAnimationFrame(this.updatePreviewPosition)},this.updatePreviewPosition=()=>{if(this.formFactor==="small"||this.height!=="auto"||!this._previewContainer)return;this.checkFlowItem();let t=this._previewContainer.value?.getBoundingClientRect();if(!t)return;let{x:e,y:i,height:a,right:r,width:n}=t,c=a+i,m=window.innerWidth-document.body.offsetWidth,w=window.innerWidth<n||window.innerWidth<window.outerWidth&&window.innerWidth<=n+m;this.previewBoundingBox={top:Math.max(i,0),left:e,right:w?0:window.outerWidth-r-m,bottom:c>window.innerHeight?0:window.innerHeight-c}},this.pageRangeText="",this.noResults=!1,this.initialHide=!0,this.scrimActive=!1,this.panel=!1,this.preview=!1,this.loading=!1,this.hideContentTop=!1,this.alwaysShowSelection=!1,this.alwaysShowContent=!1,this.response={nextStart:-1,num:0,results:[],start:1,total:0},this.store=R(),this.formFactor="large",this.searchTerm="",this.height="full",this.arcgisAriaUpdate=p(),this.arcgisBrowserFilterClear=p(),this.arcgisBrowserFilterRemove=p(),this.ariaUpdate=p()}static{this.properties={pageRangeText:16,noResults:16,previewBoundingBox:16,initialHide:16,scrimActive:16,flowItem:16,panel:5,preview:5,loading:5,hideContentTop:5,hideTopBar:5,selected:0,alwaysShowSelection:5,alwaysShowContent:5,response:0,store:0,formFactor:1,searchTerm:1,height:3,hideFilters:5,showPreSearch:5,rangeFormatter:0,alwaysShowPagination:5}}static{this.styles=U}async scrollToTop(){this.renderRoot.querySelector(".top-bar")?.scrollIntoView({behavior:"smooth",block:"nearest"})}connectedCallback(){super.connectedCallback(),window.addEventListener("scroll",this.handleResize),window.addEventListener("resize",this.handleResize),this.el.addEventListener("arcgisItemBrowserScrimToggle",this.toggleScrim),this.checkFlowItem(),this.attachStoreWatchers()}willUpdate(t){t.has("store")&&this.attachStoreWatchers(),t.has("response")&&this.updatePage(this.response)}firstUpdated(){requestAnimationFrame(this.updatePreviewPosition)}disconnectedCallback(){this.removePreviewWatcher?.(),this.removeStoreWatcher?.(),window.removeEventListener("resize",this.handleResize),window.removeEventListener("scroll",this.handleResize),this.el.removeEventListener("arcgisItemBrowserScrimToggle",this.toggleScrim),super.disconnectedCallback()}attachStoreWatchers(){if(this.removePreviewWatcher?.(),this.removeStoreWatcher?.(),!this.store)return;this.removePreviewWatcher=P(this.store,this.updatePreviewPosition);let t=[l(()=>this.store.type,()=>this.requestUpdate()),l(()=>this.store.width,()=>this.requestUpdate()),l(()=>this.store.height,()=>this.requestUpdate()),l(()=>this.store.filtersEmpty,()=>this.requestUpdate()),l(()=>this.store.topbarEmpty,()=>this.requestUpdate()),l(()=>this.store.sortEmpty,()=>this.requestUpdate()),l(()=>this.store.filtersExpanded,()=>this.requestUpdate()),l(()=>this.store.panel,()=>this.requestUpdate()),l(()=>this.store.preview,()=>this.requestUpdate()),l(()=>this.store.searchTerm,()=>this.requestUpdate()),l(()=>this.store.hiddenFilters,()=>this.requestUpdate()),l(()=>this.store.filters,()=>this.requestUpdate()),l(()=>this.store.recycleBin,()=>this.requestUpdate())];this.removeStoreWatcher=()=>{t.forEach(e=>e.remove())}}async updatePage(t){let[e,i]=await this.updatePageRange(t);this.pageRangeText=e,this.arcgisAriaUpdate.emit(i),this.el.dispatchEvent(new CustomEvent("ariaUpdate",{detail:i})),this.noResults=S(this.store)&&this.store.recycleBin?t.results.length===0:(t?.total??0)===0,this.initialHide=!1}async updatePageRange(t){let{start:e,end:i,total:a}=q(t),r=h.formatNumber(e,{maximumFractionDigits:0}),n=h.formatNumber(i,{maximumFractionDigits:0}),c=`${h.formatNumber(a,{maximumFractionDigits:0})}${a>=1e4?"+":""}`,m=h.formatNumber(t.results?.length??0,{maximumFractionDigits:0}),w=h.formatNumber(Math.max(Math.ceil(e/Math.max(t.num||1,1)),1),{maximumFractionDigits:0});if(this.rangeFormatter)return await this.rangeFormatter({start:r,end:n,total:c,results:{items:m,page:w}});let E=this._messages.browser.pageRange,T=this._messages.browser.pageRangeAria,W=B(E,{start:r,end:n,total:c}),z=B(T,{start:r,end:n,total:c});return[W,z]}hasActiveFilter(t){return Object.values(t.filters).filter(({id:e})=>!$(k,e)).some(e=>!!e.value||e.id==="collaborations")}removeFilter(t){let e=this.store.filters[t];if(!e)return;let i=C(e),a={...this.store.filters,[t]:i};this.store.filters=a,this.arcgisBrowserFilterRemove.emit(t)}clearFilters(){let t=I(this.store.filters,{hiddenFilterIds:this.store.hiddenFilters,preservedFilterIds:["folder","group","contentType"]});this.store.filters=t,this.arcgisBrowserFilterClear.emit(null)}renderNoResults(){let t=this.noResults&&!this.loading&&!this.showPreSearch,e=this.hasActiveFilter(this.store)||!!this.searchTerm;return t?o`<div class="cover"><div class="no-results">${e?o`<slot name=no-results></slot>`:o`<slot name=no-content></slot>`}</div></div>`:null}renderPopoverContents(t,e,i){let a=this.flowItem?this.flowItem.offsetHeight:this.store.height,r=this.formFactor==="small"&&this.hasActiveFilter(this.store)&&!this.hideFilters;return this.el.style.setProperty("--arcgis-browser-popover-width",i?"100%":`${this.store.width||0}px`),this.el.style.setProperty("--arcgis-browser-popover-height",i?"100%":`${a||0}px`),o`<div class="popover-contents"><div class=${s({hide:!e,"preview-panel":!0})}><slot name=preview></slot></div><div class=${s({hide:!t,"filter-panel":!0})}><article class="container"><header class="container__header"><h2 class="container__header__text">${this._messages.browser?.refineContent}</h2><calcite-action .text=${this._messages.browser?.close} scale=m icon=x @click=${()=>{this.store.filtersExpanded=!1}}></calcite-action></header><div class="container__content"><div class="container__content__scroll"><slot name=filters-top></slot>${(this.store.panel||i)&&o`<div class="filter-container__content"><slot name=sort></slot></div>`||""}<slot name=filters></slot></div></div><div class=${s({"filter-status--mobile":!0,container__footer:!0,hide:!r})}><arcgis-portal-browser-filter-status class="filter-status" .filters=${this.store.filters} .hiddenFilterIds=${this.store.hiddenFilters||[]} .componentWidth=${this.store.width||this.flowItem?.offsetWidth||window.innerWidth} .browserWidth=${window.innerWidth} @arcgisBrowserFilterClear=${()=>this.clearFilters()} @arcgisBrowserFilterRemove=${n=>this.removeFilter(n.detail)}></arcgis-portal-browser-filter-status></div></article></div></div>`}renderFlow(){let t=!!this.store.panel,e=!!this.store.filtersExpanded&&(!this.store.filtersEmpty||!this.store.sortEmpty&&t),i=!!this.store.preview,a=!this.store.panel&&document.documentElement.clientWidth>(this.store.width||0);return o`<div class=${s({panel:!0,"panel--fixed":a})}>${!this.hideTopBar&&o`<div class=${s({"top-bar":!0,"top-bar--small":this.formFactor==="small"})}><slot name=top-bar></slot></div>`||""}<div class="scrolling scrolling--panel"><div class=${s({"two-up":!0,[this.formFactor]:!0})}><div class="content"><div><slot name=primary-filter></slot></div><div class="content__start"><slot name=content-start></slot></div>${this.loading&&!this.alwaysShowContent&&o`<div class="content__view content__view--flex"><div class="cover"><calcite-loader class="loader" label></calcite-loader></div></div>`||""}${this.noResults&&!this.loading&&o`<div class="content__view content__view--flex"><div class="cover">${this.renderNoResults()}</div></div>`||""}<div class=${s({hide:this.loading||this.noResults,content__view:!0,"content__view--panel":!!this.store.panel,"content__view--flex":!this.loading&&!this.noResults})}>${!this.store.panel&&!this.hideContentTop&&o`<div class="content__top"><span class=${s({selection:!0,hide:!this.alwaysShowSelection})}><slot name=selection></slot></span>${!this.loading&&o`<span class="range">${this.pageRangeText}</span>`||""}<span class="actions"><slot name=actions></slot></span><div class="content__top__end"><slot name=view></slot>${!t&&o`<slot name=sort></slot>`||""}</div></div>`||""}<div class="flow-content"><slot name=content></slot></div><slot name=pagination></slot><slot name=content-end></slot></div></div></div><slot name=scroll-end></slot></div>${!this.store.panel||window.innerWidth<(this.store.width||0)*2?o`<div class=${s({sheet:!0,"sheet--active":e||i,"sheet--top-bar":a})}><div class=${s({sheet__background:!0,"sheet__background--hidden":a})}></div><div class=${s({sheet__contents:!0,"sheet__contents--full":a})}>${this.renderPopoverContents(e,i,!0)}</div></div>`:o`<calcite-popover overlay-positioning=fixed .open=${i||e} label=filters .referenceElement=${this.flowItem||this.el} offset-skidding=0 offset-distance=0 trigger-disabled pointer-disabled .placement=${this.store.panel?"trailing":"auto"} @calcitePopoverOpen=${r=>{(!this.store.panel||window.innerWidth<(this.store.width||0)*2)&&(r.currentTarget.style.transform="none")}} .focusTrapOptions=${{setReturnFocus:r=>{if(!(r instanceof HTMLElement))return r;let n=g(r,"arcgis-portal-item-card, arcgis-portal-group-card");return n?.restoreFocus?(n.restoreFocus(),!1):r}}}>${this.renderPopoverContents(e,i)}</calcite-popover>`}</div>`}render(){let t=this.height==="auto",e=this.height==="full",i=!!this.store.preview,a=`${(this.store.height||window.innerHeight)-A}px`,r=t?{}:{maxHeight:a};return this.formFactor==="small"?this.renderFlow():o`<div class=${s({wrapper:!0,"wrapper--fixed":!!this.store.filtersExpanded,"wrapper--auto":t,"wrapper--full":e})}>${!this.hideTopBar&&o`<div class="top-bar"><slot name=top-bar></slot></div>`||""}<slot name=top-bar-end></slot><div class=${s({"preview-position":!0,"preview-position--with-top-bar":!this.store.topbarEmpty})} ${b(this._previewContainer)}><div class=${s({preview:!0,"preview--active":i,"preview--fixed":t})} style=${v(t&&this.previewBoundingBox?{top:`${this.previewBoundingBox.top||0}px`,...document.dir==="rtl"?{right:`${this.previewBoundingBox.right||0}px`}:{left:`${this.previewBoundingBox.left||0}px`},bottom:`${this.previewBoundingBox.bottom||0}px`}:{})}><div class=${s({pane:!0,"pane--open":i})}><div class="preview-desktop"><slot name=preview></slot></div></div></div></div><div class=${s({scrolling:!0,"scrolling--full":!t||this.panel})}>${this.scrimActive&&o`<calcite-scrim class="scrim__find"></calcite-scrim>`||""}<div class=${s({"two-up":!0,"two-up--fullscreen":e,[this.formFactor]:!0})}><div class=${s({filters:!0,"filters--sticky":!t,"filters--empty":this.store.filtersEmpty&&!this.store.preview,"filters--active":!!this.store.filtersExpanded})} style=${v(e?{}:r)}><div class="filters__content" style=${v(e?{}:r)}><slot name=filters></slot></div></div><div class=${s({content:!0,"content--full":e})}><div class="content__start"><slot name=content-start></slot></div><div class=${s({content__view:!0,"content__view--no-filters":this.store.filtersEmpty&&!this.store.preview,"content__view--flex":!0})}>${!this.hideContentTop&&o`<div class="content__top">${this.showPreSearch?null:o`<div class="content__top__summary"><span class=${s({selection:!0,hide:!this.alwaysShowSelection})}><slot name=selection></slot></span>${!this.loading&&o`<span class="range">${this.pageRangeText}<slot name=range-end></slot></span>`||""}</div>`}<span class="actions"><slot name=actions></slot></span><div class="content__top__end"><slot name=view></slot><slot name=sort></slot></div></div>`||""}${this.loading&&(!this.alwaysShowContent||this.initialHide)&&o`<div class="cover"><calcite-loader class="loader" .label=${this._messages.browser?.loading??""}></calcite-loader></div>`||""}${this.renderNoResults()}${!this.loading&&this.showPreSearch&&o`<div class="cover"><div class="no-results"><slot name=pre-search></slot></div></div>`||""}<div class=${s({hide:!!this.showPreSearch||this.loading&&!this.alwaysShowContent||!this.loading&&this.noResults||this.initialHide,"results-wrapper--spaced":this.hideContentTop,"results-wrapper":!0})}><slot name=content></slot></div><div class=${s({hide:this.loading||this.noResults&&!this.alwaysShowPagination})}><slot name=pagination></slot><slot name=content-end></slot></div></div></div></div><slot name=scroll-end></slot></div></div>`}};y("arcgis-portal-browser",f);return{a:C,b:I,c:f}},"core/reactiveUtils","intl","intl",a)