@arcgis/portal-components 6.0.0-next.16 → 6.0.0-next.18

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 (99) hide show
  1. package/dist/cdn/2V3QCHGP.js +2 -0
  2. package/dist/cdn/{7GOPVQZP.js → 3F4VSZT3.js} +1 -1
  3. package/dist/cdn/5ZU6KAGX.js +66 -0
  4. package/dist/cdn/7JEYW5OA.js +2 -0
  5. package/dist/cdn/7VTDDO2O.js +2 -0
  6. package/dist/cdn/AL2HHH7T.js +2 -0
  7. package/dist/cdn/{33O4LI3R.js → AODUG34O.js} +1 -1
  8. package/dist/cdn/{FF2IT35O.js → CSRJXUID.js} +1 -1
  9. package/dist/cdn/DELNTRCT.js +2 -0
  10. package/dist/cdn/FSRBM4UA.js +2 -0
  11. package/dist/cdn/HZTWCOYQ.js +2 -0
  12. package/dist/cdn/K3GAZFRI.js +63 -0
  13. package/dist/cdn/{TRMFL7PT.js → KCQV2RU6.js} +1 -1
  14. package/dist/cdn/LH4E6B5Z.js +2 -0
  15. package/dist/cdn/{4AJW7TXX.js → NOGXUEXV.js} +1 -1
  16. package/dist/cdn/{7MDMAKNO.js → OPBUKZVI.js} +1 -1
  17. package/dist/cdn/OPHXWCKO.js +2 -0
  18. package/dist/cdn/PXG2SRSN.js +2 -0
  19. package/dist/cdn/{W7NFQS67.js → R2TAEKFV.js} +1 -1
  20. package/dist/cdn/{66PLI3XK.js → RCCW6IUO.js} +1 -1
  21. package/dist/cdn/TMRRWKIA.js +79 -0
  22. package/dist/cdn/ULGME5RT.js +2 -0
  23. package/dist/cdn/{Z44I2CVX.js → UMEKDIME.js} +1 -1
  24. package/dist/cdn/URCKNKEP.js +2 -0
  25. package/dist/cdn/V4HA2VX4.js +2 -0
  26. package/dist/cdn/{IJ76WUCD.js → V5PD3E3W.js} +18 -18
  27. package/dist/cdn/VILDP7WM.js +2 -0
  28. package/dist/cdn/{2W4ZEY3I.js → XDIDJH5L.js} +1 -1
  29. package/dist/cdn/XJ4QHAGD.js +2 -0
  30. package/dist/cdn/XMV3LCRM.js +2 -0
  31. package/dist/cdn/XT6IKL7A.js +2 -0
  32. package/dist/cdn/Y5VUMGKH.js +3 -0
  33. package/dist/cdn/YHGQPXC4.js +2 -0
  34. package/dist/cdn/{HOOOFVRH.js → YT5ON4CK.js} +1 -1
  35. package/dist/cdn/{REWOUYVV.js → ZGARJUX7.js} +1 -1
  36. package/dist/cdn/assets/portal-ai-assistant/t9n/messages.en.json +1 -1
  37. package/dist/cdn/assets/portal-entity-picker/t9n/messages.en.json +1 -1
  38. package/dist/cdn/assets/portal-item-share-summary/t9n/messages.en.json +1 -0
  39. package/dist/cdn/index.js +1 -1
  40. package/dist/cdn/main.css +1 -1
  41. package/dist/chunks/groups2.js +26 -0
  42. package/dist/chunks/item.js +29 -28
  43. package/dist/chunks/portalEntitySelection.js +9 -8
  44. package/dist/chunks/string.js +13 -9
  45. package/dist/chunks/ui.js +1 -0
  46. package/dist/components/arcgis-portal-ai-assistant/customElement.d.ts +12 -0
  47. package/dist/components/arcgis-portal-ai-assistant/customElement.js +233 -228
  48. package/dist/components/arcgis-portal-ai-assistant/index.js +3 -0
  49. package/dist/components/arcgis-portal-ai-assistant/types/portalEntityTools.d.ts +1 -0
  50. package/dist/components/arcgis-portal-ai-assistant-interrupt/customElement.d.ts +12 -0
  51. package/dist/components/arcgis-portal-ai-assistant-interrupt/customElement.js +20 -19
  52. package/dist/components/arcgis-portal-entity-picker/customElement.d.ts +29 -0
  53. package/dist/components/arcgis-portal-entity-picker/customElement.js +196 -120
  54. package/dist/components/arcgis-portal-entity-picker/index.js +2 -0
  55. package/dist/components/arcgis-portal-group-browser/customElement.js +78 -88
  56. package/dist/components/arcgis-portal-group-browser/types.d.ts +2 -7
  57. package/dist/components/arcgis-portal-item-card/customElement.d.ts +6 -2
  58. package/dist/components/arcgis-portal-item-card/customElement.js +92 -91
  59. package/dist/components/arcgis-portal-item-card/index.js +1 -1
  60. package/dist/components/arcgis-portal-item-share-summary/customElement.d.ts +106 -0
  61. package/dist/components/arcgis-portal-item-share-summary/customElement.js +169 -0
  62. package/dist/components/arcgis-portal-item-share-summary/index.d.ts +1 -0
  63. package/dist/components/arcgis-portal-item-share-summary/index.js +5 -0
  64. package/dist/components/arcgis-portal-mentionable-text-area/customElement.js +17 -19
  65. package/dist/components/arcgis-portal-navigation/customElement.js +1 -1
  66. package/dist/components/arcgis-portal-user-popup/customElement.js +1 -1
  67. package/dist/docs/api.json +1 -1
  68. package/dist/docs/docs.json +1 -1
  69. package/dist/docs/vscode.html-custom-data.json +1 -1
  70. package/dist/docs/web-types.json +1 -1
  71. package/dist/index.d.ts +4 -0
  72. package/dist/loader.js +7 -6
  73. package/dist/services/groups.d.ts +9 -0
  74. package/dist/types/item.d.ts +3 -3
  75. package/dist/types/lumina.d.ts +11 -6
  76. package/dist/types/preact.d.ts +12 -6
  77. package/dist/types/react.d.ts +13 -6
  78. package/dist/types/stencil.d.ts +11 -6
  79. package/package.json +9 -9
  80. package/dist/cdn/36WCJDSE.js +0 -2
  81. package/dist/cdn/63C5KHJE.js +0 -2
  82. package/dist/cdn/6G6MIY3R.js +0 -2
  83. package/dist/cdn/6MVERAK7.js +0 -2
  84. package/dist/cdn/7M6OSITT.js +0 -2
  85. package/dist/cdn/CHZFGIWM.js +0 -2
  86. package/dist/cdn/DCIJJNO3.js +0 -2
  87. package/dist/cdn/EJZ4LX4Z.js +0 -2
  88. package/dist/cdn/G44SM52C.js +0 -2
  89. package/dist/cdn/HA35MMMF.js +0 -2
  90. package/dist/cdn/JOUR2FB2.js +0 -3
  91. package/dist/cdn/JZ7EM2ZO.js +0 -66
  92. package/dist/cdn/LZESRAYF.js +0 -66
  93. package/dist/cdn/P7ZCCDSD.js +0 -2
  94. package/dist/cdn/R5DXQCCJ.js +0 -2
  95. package/dist/cdn/R7XRTDY6.js +0 -2
  96. package/dist/cdn/T333LJ4L.js +0 -2
  97. package/dist/cdn/WFU6WGTW.js +0 -78
  98. package/dist/cdn/ZACZJ2SR.js +0 -2
  99. /package/dist/cdn/{GGDOGNH4.js → UUITDWRA.js} +0 -0
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{a as F}from"./4KTRAA2J.js";import{a as b}from"./ULGME5RT.js";import{b as B}from"./KV4ZZSNW.js";import{a as U}from"./2FKNF2ZK.js";import{a as P}from"./AYHYABMC.js";import{I as w,J as f,K as C,L as c,N as _,Q as S,h as T,j as t,v as h}from"./3ZC26CT6.js";export default $arcgis.t(([{formatDate:z,substitute:$}])=>{var H=T`:host{display:block;min-width:0;container-type:inline-size;container-name:portal-item-card}.item-card{position:relative;display:flex;min-height:100%;flex-direction:column;color:var(--calcite-color-text-1);opacity:0;box-shadow:none;transition-duration:.15s;outline-color:transparent;background-color:var(--calcite-color-foreground-1);transition-property:background-color,outline,outline-offset,opacity;border:1px solid var(--calcite-color-border-3);&:focus{z-index:10;outline:2px solid var(--calcite-color-brand);outline-offset:-2px}}.item-card--loaded{opacity:1}.item-card--selected{border-color:var(--calcite-color-brand)}.item-card--previewed{outline:1px solid var(--calcite-color-brand);outline-offset:-2px}.item-card--hoverable{cursor:pointer}.item-card--disabled{opacity:.5;pointer-events:none}.item-card__upper{flex:1 1 0%;background-color:var(--calcite-color-foreground-1);transition:all var(--calcite-animation-timing) ease-in-out 0s,outline 0s,outline-offset 0s}.item-card__upper:hover{background-color:var(--calcite-color-background)}.item-card__upper--link{color:var(--calcite-color-text-1);text-decoration-line:none;outline-color:transparent;&:focus{z-index:10;outline:2px solid var(--calcite-color-brand);outline-offset:2px}}.item-card__upper:hover .item-card__hover-text,.item-card:focus .item-card__hover-text{opacity:1}.item-card__top{padding:.75rem}.item-card__content{display:flex;min-width:0;flex:1 1 0%;flex-direction:column}.item-card__content-end{min-width:0;margin-block-start:.25rem}.item-card__title{margin:0;overflow-wrap:break-word;padding:0;font-size:.875rem;font-weight:500;line-height:1.375}.item-card__title--grid{font-size:.875rem}.item-card__title--padded{margin-bottom:.25rem}.item-card__title__span{position:relative;display:inline;border-style:none;background-color:transparent;padding:0;transition:all var(--calcite-animation-timing) ease-in-out 0s,outline 0s,outline-offset 0s;background-image:linear-gradient(transparent,transparent);background-position-x:0%,100%;background-position-y:min(1.25em,100%);background-repeat:no-repeat,no-repeat;background-size:100% 1px,100% 1px}.item-card--previewed .item-card__title__span,.item-card__upper--link:hover .item-card__title__span{background-image:linear-gradient(var(--calcite-color-text-3),var(--calcite-color-text-3))}.item-card__summary{margin:0;flex:1 1 0%;color:var(--calcite-color-text-2);display:none;overflow-wrap:break-word;padding:0;font-size:.875rem;line-height:1.25}.item-card__detail--updated-full.item-card__divider{display:none}.item-card__details{margin-block-start:.25rem;display:flex;flex-direction:row}.item-card__detail{font-size:.75rem;line-height:1.35;color:var(--calcite-color-text-2)}.item-card__divider{display:flex;align-items:center;flex:0 0 auto}.item-card__divider:not([empty]):before{content:"";height:1.25rem;width:1px;background-color:var(--calcite-color-border-1);margin-inline:.75rem}.item-card__divider:first-child:before{display:none}.item-card__thumbnail{margin:0;width:5rem;height:3.5rem;margin-inline-start:.5rem;flex:0 0 auto;overflow:hidden;border-radius:.125rem}.item-card__thumbnail--grid{position:relative;width:100%;height:auto;aspect-ratio:16 / 9;margin:0;margin-inline-start:0;border-radius:0;border-bottom:1px solid var(--calcite-color-foreground-2)}.item-card__thumbnail-image{width:100%;height:100%;object-fit:cover;display:block}.item-card__thumbnail-media{display:block;width:100%;height:100%}.item-card__thumbnail-fallback{width:100%;height:100%;background-color:var(--calcite-color-foreground-2);color:var(--calcite-color-text-3);display:flex;align-items:center;justify-content:center}.item-card__hover-text{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;opacity:0;color:var(--calcite-color-foreground-1);background-color:var(--calcite-color-transparent-scrim);font-size:.75rem;font-weight:500;text-align:center;transition:opacity var(--calcite-animation-timing) ease-in-out}.item-card__badges{display:flex;flex-wrap:wrap}.item-card__badges--compact{max-width:100%}.item-card__badges--responsive{display:none}.item-card__footer{margin-top:auto;display:flex;align-items:center;background-color:var(--calcite-color-foreground-1);padding:.25rem .75rem;border-top:1px solid var(--calcite-color-border-3)}.item-card__footer__start{display:flex;min-width:0;flex:1 1 0%;align-items:center;overflow:hidden;width:100%;margin-inline-end:.75rem}.item-card__footer__start--owner{margin-inline-start:-.25rem}.item-card__profile-wrap{max-width:100%;padding:.25rem}.item-card__owner{min-width:0}.item-card__footer-divider{height:1.25rem;width:1px;margin-inline:.75rem;background-color:var(--calcite-color-border-input)}.item-card__preview-button{margin-inline-end:.5rem}.item-card__footer arcgis-portal-item-favorite,.item-card__footer arcgis-portal-item-actions{display:inline-flex;align-items:center}.item-card__access-wrap{display:flex;align-items:center}.item-card-flex{display:flex}.item-card-flex-1{min-width:0;flex:1 1 0%}.item-card__input{margin-inline-end:1rem;margin-top:.125rem}.item-card__title+.item-card__input{margin-inline-start:1rem;margin-inline-end:0}.item-card__input--compact{height:100%;display:flex;align-items:center}.item-card-item-type{min-width:0}.screen-readers-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}@container portal-item-card (max-width: 320px){.item-card__title,.item-card__title--grid{font-size:.75rem}.item-card:not(.item-card--grid) .item-card__thumbnail{width:3.4375rem;margin-inline-start:.75rem}.item-card__footer__start{margin-inline-end:.5rem}.item-card__detail--updated-short{display:none}}@container portal-item-card (min-width: 321px) and (max-width: 480px){.item-card__title{font-size:.875rem}}@container portal-item-card (min-width: 481px){.item-card__top{padding:1rem}.item-card__title{font-size:1.125rem}.item-card__title--padded{margin-bottom:.5rem}.item-card__detail{font-size:.875rem}.item-card__footer{padding:.5rem 1rem}.item-card:not(.item-card--grid) .item-card__thumbnail{width:8rem;margin-inline-start:2rem}.item-card__summary{display:block}}@container portal-item-card (min-width: 641px){.item-card__badges--compact{display:none}.item-card__badges--responsive{display:flex}.item-card__summary{display:block}.item-card__footer{flex-wrap:nowrap;gap:0}.item-card__footer__start{width:auto;margin-inline-end:.75rem}.item-card__detail--updated-short{display:none}.item-card__detail--updated-full.item-card__divider{display:flex}.item-card:not(.item-card--grid) .item-card__thumbnail{height:4rem}}`,y=class extends C{constructor(){super(),this.messages=P({blocking:!0}),this.sectionEl=w(),this.linkEl=w(),this.handleCardClick=e=>{if(!(this.link||this.disabled||e?.target?.closest(".item-card__footer"))){if(this.preview==="top"&&!this.recycleBin){this.arcgisItemBrowserCardPreview.emit(this.item);return}if(this.selection==="single"){this.selected=!0,this.arcgisItemCardSelect.emit({item:this.item,selected:!0});return}this.selection==="multiple"&&(this.selected=!this.selected,this.arcgisItemCardSelect.emit({item:this.item,selected:this.selected}))}},this.isLoaded=!1,this.cardWidth=0,this.selected=!1,this.selection="none",this.view="list",this.previewed=!1,this.showOwner=!0,this.showDateUpdated=!0,this.showItemType=!0,this.showItemTypeHosted=!1,this.showSummary=!1,this.showBadges=!0,this.showBadgeTooltips=!0,this.showFavorite=!1,this.showFavoriteInActionsMenu=!1,this.showAccess=!1,this.showThumbnail=!0,this.newTab=!1,this.disableSelection=!1,this.disabled=!1,this.actions=[],this.recycleBin=!1,this.arcgisItemBrowserCardPreview=h(),this.arcgisItemCardActionsOpen=h(),this.arcgisItemCardInternalUIAction=h(),this.arcgisItemCardSelect=h(),this.manager.onLifecycle(()=>{let e,a=new ResizeObserver(([s])=>{e!==void 0&&(cancelAnimationFrame(e),e=void 0);let n=s.contentRect.width;n>0&&n!==this.cardWidth&&(e=requestAnimationFrame(()=>{e=void 0,this.cardWidth=n}))});return a.observe(this.el),()=>{a.disconnect(),e!==void 0&&cancelAnimationFrame(e)}})}static{this.properties={isLoaded:16,cardWidth:16,item:0,user:0,portal:0,selected:7,selection:1,view:1,preview:1,previewed:5,name:1,showOwner:5,showDateUpdated:5,showItemType:5,showItemTypeHosted:5,showSummary:5,showBadges:5,showBadgeTooltips:5,showFavorite:5,showFavoriteInActionsMenu:5,showAccess:5,groups:0,userGroups:0,showThumbnail:5,link:1,linkHandler:0,newTab:5,disableSelection:5,disabled:7,userPopupZIndex:9,actions:0,recycleBin:5,hideActionsStart:5}}static{this.styles=H}get sourceJSON(){return F(this.item)}async restoreFocus(){if(await this.updateComplete,this.link&&this.linkEl.value){this.linkEl.value.focus();return}this.sectionEl.value?.focus()}firstUpdated(){requestAnimationFrame(()=>{this.isLoaded=!0})}getMessage(e,a=""){let s=this.messages[e];return typeof s=="string"?s:a}getResolvedBaseUrl(){return this.portal?`${B({portal:this.portal,usePortalHostname:!this.portal.user})}/home`:""}handleSharingSlotChange(){this.requestUpdate()}renderUpdatedDetails(e){return t`<span class="item-card__detail item-card__detail--updated-short item-card__divider">${z(e,{dateStyle:"medium"})}</span><span class="item-card__detail item-card__detail--updated-full item-card__divider">${$(this.messages.lastUpdated??"",{date:z(e,{dateStyle:"medium"})})}</span>`}renderSelectionInput(e,a=!1){let{selection:s,disableSelection:n,name:g,messages:v,item:d}=this,l={"item-card__input":!0,"item-card__input--compact":a};switch(s){case"single":return t`<calcite-radio-button class=${c(l)} .checked=${e} .disabled=${n} .value=${d.title??""} .name=${g} @click=${r=>{r.stopPropagation()}} @calciteRadioButtonChange=${()=>{this.selected=!0,this.arcgisItemCardSelect.emit({item:d,selected:!0})}}><span class="screen-readers-only">${$(v.select??"",{title:d.title??""})}</span></calcite-radio-button>`;case"multiple":return t`<calcite-checkbox class=${c(l)} .checked=${e} .disabled=${n} @click=${r=>{r.stopPropagation(),r.preventDefault()}} @calciteCheckboxChange=${()=>{this.selected=!e,this.arcgisItemCardSelect.emit({item:d,selected:!e})}}><span class="screen-readers-only">${d.title??""}</span></calcite-checkbox>`;case"none":return null;default:return U(s)}}renderThumbnail(e,a){return this.showThumbnail?a?t`<figure class="item-card__thumbnail item-card__thumbnail--grid"><arcgis-portal-item-thumbnail class="item-card__thumbnail-media" .item=${e} .portal=${this.portal}></arcgis-portal-item-thumbnail>${this.preview==="top"&&!this.link&&t`<div class="item-card__hover-text">${this.previewed?this.messages.closePreview:this.messages.preview}</div>`||""}${this.link?.includes(`item.html?id=${e.id}`)&&t`<div class="item-card__hover-text">${this.messages.viewItemDetails}</div>`||""}</figure>`:t`<figure class="item-card__thumbnail"><arcgis-portal-item-thumbnail class="item-card__thumbnail-media" .item=${e} .portal=${this.portal}></arcgis-portal-item-thumbnail></figure>`:null}renderAccess(){if(!this.showAccess)return null;let e=Array.from(this.el.children).some(a=>a.getAttribute("slot")==="share-summary");return t`<div class="item-card__access-wrap" @click=${a=>{a.preventDefault(),a.stopPropagation()}} @keydown=${a=>{(a.key==="Enter"||a.key===" ")&&a.stopPropagation()}}><slot name=share-summary @slotchange=${this.handleSharingSlotChange}>${!e&&t`<arcgis-portal-item-share-summary .item=${this.item} .portal=${this.portal} .groups=${this.groups} .userGroups=${this.userGroups} .autoFetchGroups=${this.groups===void 0} .scale=${this.cardWidth<=b.xxs?"s":"m"} .showText=${this.view!=="grid"&&this.cardWidth>b.md} overlay-positioning=fixed></arcgis-portal-item-share-summary>`||""}</slot></div>`}renderBadges(){return!this.showBadges||!this.item||!this.portal?null:this.view==="grid"?t`<arcgis-portal-item-badges class="item-card__badges item-card__divider" .item=${this.item} .portal=${this.portal} .user=${this.user} scale=s appearance=outline-fill .showTooltips=${this.showBadgeTooltips} width=narrow></arcgis-portal-item-badges>`:t`<arcgis-portal-item-badges class="item-card__badges item-card__badges--compact item-card__divider" .item=${this.item} .portal=${this.portal} .user=${this.user} scale=s appearance=outline-fill .showTooltips=${this.showBadgeTooltips} width=narrow></arcgis-portal-item-badges><arcgis-portal-item-badges class="item-card__badges item-card__badges--responsive item-card__divider" .item=${this.item} .portal=${this.portal} .user=${this.user} scale=s appearance=outline-fill .showTooltips=${this.showBadgeTooltips} width=full></arcgis-portal-item-badges>`}render(){let{item:e,portal:a,user:s,selection:n,isLoaded:g,disabled:v,link:d,newTab:l}=this;if(!e||!a||!this.messages._lang)return;let r=this.sourceJSON,u=r.modified||e.modified,o=this.view==="grid",m=this.selected,x=this.preview==="action"&&!this.recycleBin,k=this.actions.length>0||this.showFavoriteInActionsMenu,I=this.showFavorite&&!this.showFavoriteInActionsMenu&&!!s,D=k||I||x,E=(this.showAccess||o&&this.showOwner)&&D,p=this.preview==="top"&&!d;return t`<section class=${c({"item-card":!0,"item-card--grid":o,"item-card--hoverable":n!=="none","item-card--selected":m,"item-card--disabled":v,"item-card--loaded":g,"item-card--previewed":this.previewed&&p})} @click=${d?void 0:this.handleCardClick} .tabIndex=${p?0:-1} .role=${p?"button":void 0} aria-haspopup=${(p?"dialog":void 0)??_} @keydown=${i=>{p&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this.handleCardClick())}} ${f(this.sectionEl)}><slot name=content-top></slot>${d?t`<a class="item-card__upper item-card__upper--link" href=${d??_} target=${(l?"_blank":void 0)??_} rel=${(l?"noopener noreferrer":void 0)??_} @click=${i=>{if(this.linkHandler&&!i.ctrlKey&&!i.metaKey){i.preventDefault(),this.linkHandler(this.item);return}let A=i.target;A instanceof HTMLElement&&A.closest(".item-card__footer")&&i.preventDefault()}} ${f(this.linkEl)}>${t`${o&&this.renderThumbnail(e,!0)||""}<div class="item-card-flex item-card__top">${!o&&this.renderSelectionInput(m,!0)||""}<div class="item-card-flex-1"><div class="item-card-flex"><div class="item-card__content"><div class="item-card-flex"><h3 class=${c({"item-card__title":!0,"item-card__title--grid":o,"item-card__title--padded":this.showItemType||this.showSummary&&!!r.snippet,"item-card-flex-1":!0})}><span class="item-card__title__span">${r.title??e.title??""}</span></h3>${o&&this.renderSelectionInput(m)||""}</div>${this.showSummary&&!!r.snippet&&t`<p class="item-card__summary">${r.snippet.length>250?`${r.snippet.substring(0,250)}...`:r.snippet}</p>`||""}<div class="item-card__details">${this.showItemType&&t`<arcgis-portal-item-type class="item-card__divider item-card-item-type" ellipsis .user=${s} .showHosted=${this.showItemTypeHosted} scale=s .item=${e} .portal=${a}></arcgis-portal-item-type>`||""}${this.showDateUpdated&&!!u&&this.renderUpdatedDetails(u)||""}${this.renderBadges()}</div></div>${!o&&this.renderThumbnail(e,!1)||""}</div><div class="item-card__content-end"><slot name=content-end></slot></div></div></div>`}</a>`:t`<div class="item-card__upper">${o&&this.renderThumbnail(e,!0)||""}<div class="item-card-flex item-card__top">${!o&&this.renderSelectionInput(m,!0)||""}<div class="item-card-flex-1"><div class="item-card-flex"><div class="item-card__content"><div class="item-card-flex"><h3 class=${c({"item-card__title":!0,"item-card__title--grid":o,"item-card__title--padded":this.showItemType||this.showSummary&&!!r.snippet,"item-card-flex-1":!0})}><span class="item-card__title__span">${r.title??e.title??""}</span></h3>${o&&this.renderSelectionInput(m)||""}</div>${this.showSummary&&!!r.snippet&&t`<p class="item-card__summary">${r.snippet.length>250?`${r.snippet.substring(0,250)}...`:r.snippet}</p>`||""}<div class="item-card__details">${this.showItemType&&t`<arcgis-portal-item-type class="item-card__divider item-card-item-type" ellipsis .user=${s} .showHosted=${this.showItemTypeHosted} scale=s .item=${e} .portal=${a}></arcgis-portal-item-type>`||""}${this.showDateUpdated&&!!u&&this.renderUpdatedDetails(u)||""}${this.renderBadges()}</div></div>${!o&&this.renderThumbnail(e,!1)||""}</div><div class="item-card__content-end"><slot name=content-end></slot></div></div></div></div>`}<div class="item-card__footer"><div class=${c({"item-card__footer__start":!0,"item-card__footer__start--owner":this.showOwner})}>${!this.hideActionsStart&&t`<slot name=actions-start></slot>`||""}${this.showOwner&&!!r.owner&&t`<div class="item-card__profile-wrap"><arcgis-portal-user-popup class="item-card__owner" .portal=${a} .username=${r.owner} .baseUrl=${this.getResolvedBaseUrl()} underline .zIndex=${this.userPopupZIndex} @arcgisUserPopupInternalUIAction=${i=>{i.stopPropagation(),this.arcgisItemCardInternalUIAction.emit(i.detail)}}></arcgis-portal-user-popup></div>`||""}</div>${this.renderAccess()}${E&&t`<span class="item-card__footer-divider"></span>`||""}${I&&t`<slot name=favorite-action><arcgis-portal-item-favorite .item=${e} .portal=${a} .user=${s} icon-only scale=s show-tooltip @arcgisItemFavoriteUpdate=${()=>{this.arcgisItemCardInternalUIAction.emit({category:"card action",action:"favorite"})}}></arcgis-portal-item-favorite></slot>`||""}${x&&t`<calcite-button scale=s class="item-card__preview-button" .appearance=${this.previewed?"solid":"outline"} kind=neutral @click=${i=>{i.preventDefault(),i.stopPropagation(),this.arcgisItemBrowserCardPreview.emit(this.item)}}>${this.messages.preview}</calcite-button>`||""}${k&&t`<arcgis-portal-item-actions .item=${e} .portal=${a} .user=${s} .actions=${this.actions} .label=${$(this.getMessage("itemActions","Item actions for {title}"),{title:r.title??e.title??""})} .showFavorite=${this.showFavoriteInActionsMenu&&!!s} @arcgisItemActionsOpen=${i=>{i.stopPropagation(),this.arcgisItemCardActionsOpen.emit({actions:this.actions,el:i.detail.el})}} @arcgisItemActionClick=${i=>{i.stopPropagation(),this.arcgisItemCardInternalUIAction.emit({category:"card action",action:"more options",attribute:i.detail})}} @arcgisItemFavoriteUpdate=${i=>{i.stopPropagation(),this.arcgisItemCardInternalUIAction.emit({category:"card action",action:"favorite"})}}></arcgis-portal-item-actions>`||""}<div @click=${i=>{i.stopPropagation()}}><slot name=actions-end></slot></div></div></section>`}};S("arcgis-portal-item-card",y);return y},"intl")
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import f from"./Z44I2CVX.js";import"./V6A6MKLU.js";import e from"./BULPEHX6.js";import"./SLQQ44IA.js";import"./4KTRAA2J.js";import"./PKA745KL.js";import"./VDXESPJK.js";import"./DAAON2UO.js";import d from"./TZ6HFMZZ.js";import c from"./TIPQ2ZWK.js";import b from"./C5IKEISI.js";import"./H7DF6TTK.js";import"./KV4ZZSNW.js";import"./2FKNF2ZK.js";import"./AYHYABMC.js";import"./OQ3OHDEB.js";import"./I57CRKF7.js";import{K as r,Q as o,h as i,j as a}from"./3ZC26CT6.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([,,,,{a:p}])=>{var n=i`:host{display:flex;flex-wrap:wrap;align-items:center}.portal-item-badges__badge{display:inline-block;margin-inline-end:.25rem}.portal-item-badges__badge:last-of-type{margin-inline-end:0}`,e=class extends r{constructor(){super(...arguments),this.badges=[],this.width="full",this.scale="m",this.showTooltips=!1,this.empty=!1}static{this.properties={badges:16,item:0,portal:0,user:0,width:1,appearance:1,scale:1,showTooltips:5,useProduction:5,empty:7}}static{this.styles=n}willUpdate(t){if(t.has("item")||t.has("portal")||t.has("user")){if(!this.item||!this.portal){this.badges=[],this.empty=!0;return}let s=p(this.item,this.portal,this.user);this.badges=s,this.empty=s.length===0}}render(){let{appearance:t,badges:s,scale:l,showTooltips:h,width:m}=this;return s.map(d=>a`<arcgis-portal-item-badge .appearance=${t} .badgeType=${d} class="portal-item-badges__badge" .item=${this.item} .portal=${this.portal} .user=${this.user} .scale=${l} .showTooltip=${h} .useProduction=${this.useProduction} .width=${m}></arcgis-portal-item-badge>`)}};o("arcgis-portal-item-badges",e);return e},b,c,d,e,f)
2
+ import f from"./UMEKDIME.js";import e from"./BULPEHX6.js";import"./V6A6MKLU.js";import"./SLQQ44IA.js";import"./4KTRAA2J.js";import"./PKA745KL.js";import"./VDXESPJK.js";import"./DAAON2UO.js";import d from"./TZ6HFMZZ.js";import c from"./TIPQ2ZWK.js";import b from"./C5IKEISI.js";import"./H7DF6TTK.js";import"./KV4ZZSNW.js";import"./2FKNF2ZK.js";import"./AYHYABMC.js";import"./OQ3OHDEB.js";import"./I57CRKF7.js";import{K as r,Q as o,h as i,j as a}from"./3ZC26CT6.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([,,,,{a:p}])=>{var n=i`:host{display:flex;flex-wrap:wrap;align-items:center}.portal-item-badges__badge{display:inline-block;margin-inline-end:.25rem}.portal-item-badges__badge:last-of-type{margin-inline-end:0}`,e=class extends r{constructor(){super(...arguments),this.badges=[],this.width="full",this.scale="m",this.showTooltips=!1,this.empty=!1}static{this.properties={badges:16,item:0,portal:0,user:0,width:1,appearance:1,scale:1,showTooltips:5,useProduction:5,empty:7}}static{this.styles=n}willUpdate(t){if(t.has("item")||t.has("portal")||t.has("user")){if(!this.item||!this.portal){this.badges=[],this.empty=!0;return}let s=p(this.item,this.portal,this.user);this.badges=s,this.empty=s.length===0}}render(){let{appearance:t,badges:s,scale:l,showTooltips:h,width:m}=this;return s.map(d=>a`<arcgis-portal-item-badge .appearance=${t} .badgeType=${d} class="portal-item-badges__badge" .item=${this.item} .portal=${this.portal} .user=${this.user} .scale=${l} .showTooltip=${h} .useProduction=${this.useProduction} .width=${m}></arcgis-portal-item-badge>`)}};o("arcgis-portal-item-badges",e);return e},b,c,d,e,f)
@@ -0,0 +1,66 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{a as W}from"./VXDDXPD7.js";import{e as ye}from"./DELNTRCT.js";import{a as $e}from"./DAAON2UO.js";import{a as be}from"./57MT7FOI.js";import{a as we}from"./2FKNF2ZK.js";import{a as U}from"./AYHYABMC.js";import"./OQ3OHDEB.js";import"./I57CRKF7.js";import{I as de,J as ke,K as fe,N as me,Q as xe,h as ge,j as $,v as X}from"./3ZC26CT6.js";import"./OUMTV5H5.js";import"./K3GAZFRI.js";import"./5PV2GUZW.js";function ee(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var I=ee();function Ce(r){I=r}var v={exec:()=>null};function E(r){let e=[];return t=>{let i=Math.max(0,Math.min(3,t-1)),n=e[i];return n||(n=r(i),e[i]=n),n}}function u(r,e=""){let t=typeof r=="string"?r:r.source,i={replace:(n,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(b.caret,"$1"),t=t.replace(n,a),i},getRegex:()=>new RegExp(t,e)};return i}var Fe=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),b={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:E(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:E(r=>new RegExp(`^ {0,${r}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:E(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:E(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:E(r=>new RegExp(`^ {0,${r}}(?:</?(?:${O})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,"i")),blockquoteBeginRegex:E(r=>new RegExp(`^ {0,${r}}>`))},Ge=/^(?:[ \t]*(?:\n|$))+/,Xe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ue=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,D=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,We=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,te=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Le=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,qe=u(Le).replace(/bull/g,te).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ke=u(Le).replace(/bull/g,te).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),re=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Je=/^[^\n]+/,ne=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ve=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ne).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ye=u(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,te).getRegex(),O="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ie=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,et=u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ie).replace("tag",O).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Be=r=>u(re).replace("hr",D).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",r).replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",O).getRegex(),tt=Be(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),rt=Be(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),nt=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",rt).getRegex(),se={blockquote:nt,code:Xe,def:Ve,fences:Ue,heading:We,hr:D,html:et,lheading:qe,list:Ye,newline:Ge,paragraph:tt,table:v,text:Je},Se=u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",D).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",O).getRegex(),it={...se,lheading:Ke,table:Se,paragraph:u(re).replace("hr",D).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Se).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag",O).getRegex()},st={...se,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:v,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(re).replace("hr",D).replace("heading",` *#{1,6} *[^
3
+ ]`).replace("lheading",qe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,at=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ze=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,ot=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,C=/[\s\p{P}\p{S}]/u,M=/[^\s\p{P}\p{S}]/u,ct=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,C).getRegex(),pt=/[\p{Pi}\p{Ps}"']/u,De=/(?!~)[\p{P}\p{S}]/u,ht=/(?!~)[\s\p{P}\p{S}]/u,ut=/(?:[^\s\p{P}\p{S}]|~)/u,gt=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Fe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Oe=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,dt=u(Oe,"u").replace(/punct/g,T).getRegex(),kt=u(Oe,"u").replace(/punct/g,De).getRegex(),ft=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,mt=u(ft,"u").replace(/openQuote/g,pt).replace(/punct/g,T).getRegex(),Me="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",xt=u(Me,"gu").replace(/notPunctSpace/g,M).replace(/punctSpace/g,C).replace(/punct/g,T).getRegex(),bt=u(Me,"gu").replace(/notPunctSpace/g,ut).replace(/punctSpace/g,ht).replace(/punct/g,De).getRegex(),wt="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",yt=u(wt,"gu").replace(/notPunctSpace/g,M).replace(/punctSpace/g,C).replace(/punct/g,T).getRegex(),$t=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,M).replace(/punctSpace/g,C).replace(/punct/g,T).getRegex(),St="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Rt=u(St,"gu").replace(/notPunctSpace/g,M).replace(/punctSpace/g,C).replace(/punct/g,T).getRegex(),Tt=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),At="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",zt=u(At,"gu").replace(/notPunctSpace/g,M).replace(/punctSpace/g,C).replace(/punct/g,T).getRegex(),_t=u(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),vt=u(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,T).getRegex(),Pt=u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),It=u(ie).replace("(?:-->|$)","-->").getRegex(),Et=u("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",It).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Qe=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,j=u(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Qe).getRegex(),Ct=u(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",j).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Lt=u(/^!?\[(label)\]\[(ref)\]/).replace("label",j).replace("ref",ne).getRegex(),qt=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",ne).getRegex(),Re=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Bt=u(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Qe).getRegex(),Zt=u("reflink|nolink(?!\\()","g").replace("reflink",u(/^!?\[(label)\]\[(ref)\]/).replace("label",Bt).replace("ref",Re).getRegex()).replace("nolink",u(/^!?\[(ref)\](?:\[\])?/).replace("ref",Re).getRegex()).getRegex(),Te=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Dt=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,Ot=u(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,Dt).getRegex(),le={_backpedal:v,anyPunctuation:_t,anyPunctuationOutsideCode:vt,autolink:Pt,blockSkip:gt,br:Ze,code:at,del:v,delLDelim:v,delRDelim:v,emStrongLDelim:dt,emStrongRDelimAst:xt,emStrongRDelimUnd:$t,escape:lt,link:Ct,nolink:qt,punctuation:ct,reflink:Lt,reflinkSearch:Zt,tag:Et,text:ot,url:v},Mt={...le,emStrongLDelim:mt,emStrongRDelimAst:yt,emStrongRDelimUnd:Rt,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",j).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",j).getRegex()},J={...le,emStrongRDelimAst:bt,emStrongLDelim:kt,delLDelim:Tt,delRDelim:zt,url:u(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Ot).replace("protocol",Te).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:u(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",Te).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Qt={...J,br:u(Ze).replace("{2,}","*").getRegex(),text:u(J.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Q={normal:se,gfm:it,pedantic:st},B={normal:le,gfm:J,breaks:Qt,pedantic:Mt},jt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ae=r=>jt[r];function w(r,e){if(e){if(b.escapeTest.test(r))return r.replace(b.escapeReplace,Ae)}else if(b.escapeTestNoEncode.test(r))return r.replace(b.escapeReplaceNoEncode,Ae);return r}function Ht(r){return b.numericCharacterReference.test(r)?r.replace(b.numericCharacterReferenceOrAmpersand,(e,t,i)=>{if(t===void 0&&i===void 0)return"&amp;";let n=t===void 0?Number.parseInt(i,16):Number.parseInt(t,10);return n===0||n>1114111||n>=55296&&n<=57343?"\uFFFD":n===38?"&amp;":String.fromCodePoint(n)}):r}function ze(r){try{r=encodeURI(r).replace(b.percentDecode,"%")}catch{return null}return r}function _e(r,e){let t=r.replace(b.findPipe,(s,a,l)=>{let p=!1,o=a;for(;--o>=0&&l[o]==="\\";)p=!p;return p?"|":" |"}),i=t.split(b.splitPipe),n=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(b.slashPipe,"|");return i}function A(r,e,t){let i=r.length;if(i===0)return"";let n=0;for(;n<i;){let s=r.charAt(i-n-1);if(s===e&&!t)n++;else if(s!==e&&t)n++;else break}return r.slice(0,i-n)}function ve(r){let e=r.split(`
4
+ `),t=e.length-1;for(;t>=0&&b.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
5
+ `)}function H(r){return r.trim().toLowerCase().toUpperCase().toLowerCase()}function Pe(r,e){if(r.indexOf(e[0])===-1&&r.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<r.length;i++)if(r[i]==="\\")i++;else if(r[i]===e[0])t++;else if(r[i]===e[1]&&(t--,t<0))return i;return t>0?-2:-1}function K(r,e=0){let t=e,i="";for(let n of r)if(n===" "){let s=4-t%4;i+=" ".repeat(s),t+=s}else i+=n,t++;return i}function Ie(r,e,t,i,n){let s=e.href,a=e.title||null,l=r[1].replace(n.other.outputLinkReplace,"$1"),p=r[0].charAt(0)==="!",o=i.state.inLink,c=i.state.linkEmitted,h=i.state.inRawBlock;i.state.inLink=!0,i.state.linkEmitted=!1;let k=i.inlineTokens(l),g=i.state.linkEmitted;if(i.state.linkEmitted=c,i.state.inLink=o,!p){if(g){i.state.inRawBlock=h;return}i.state.linkEmitted=!0}return{type:p?"image":"link",raw:t,href:s,title:a,text:l,tokens:k}}function Nt(r,e,t){let i=r.match(t.other.indentCodeCompensation);if(i===null)return e;let n=i[1];return e.split(`
6
+ `).map(s=>{let a=s.match(t.other.beginningSpace);if(a===null)return s;let[l]=a;return s.slice(Math.min(l.length,n.length))}).join(`
7
+ `)}function Ee(r,e,t,i){if(!e.includes("<"))return!1;for(let n=0;n<e.length;n++){if(e[n]==="\\"){n++;continue}if(e[n]==="`"){let l=i.inline.code.exec(e.slice(n));if(l){n+=l[0].length-1;continue}}if(e[n]!=="<")continue;let s=r.slice(t+n),a=i.inline.tag.exec(s)||i.inline.autolink.exec(s);if(a){if(a[0].length>e.length-n)return!0;n+=a[0].length-1}}return!1}var N=class{options;rules;lexer;constructor(r){this.options=r||I}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:ve(e[0]),i=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:i}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],i=Nt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let i=A(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceTabChar.test(i))&&(t=i.trim())}return{type:"heading",raw:A(e[0],`
8
+ `),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:A(e[0],`
9
+ `)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=A(e[0],`
10
+ `).split(`
11
+ `),i="",n="",s=[];for(;t.length>0;){let a=!1,l=[],p;for(p=0;p<t.length;p++)if(this.rules.other.blockquoteStart.test(t[p]))l.push(t[p]),a=!0;else if(!a)l.push(t[p]);else break;t=t.slice(p);let o=l.join(`
12
+ `),c=o.replace(this.rules.other.blockquoteSetextReplace,`
13
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
14
+ ${o}`:o,n=n?`${n}
15
+ ${c}`:c;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,s,!0),this.lexer.state.top=h,t.length===0)break;let k=s.at(-1);if(k?.type==="code"||k?.type==="heading"||k?.type==="hr"||k?.type==="html")break;if(k?.type==="blockquote"){let g=k,y=t.join(`
16
+ `),x=g.raw+`
17
+ `+y.replace(this.rules.other.blockquoteSetextReplace2,""),f=this.blockquote(x);s[s.length-1]=f;let z=x.substring(f.raw.length).replace(/^\n/,""),m=z?z.split(`
18
+ `).length:0,L=m?t.slice(0,-m):t;L.length>0&&(i=`${i}
19
+ ${L.join(`
20
+ `)}`),n=n.substring(0,n.length-g.text.length)+f.text;break}else if(k?.type==="list"){let g=k,y=g.raw+`
21
+ `+t.join(`
22
+ `),x=this.list(y);s[s.length-1]=x,i=i.substring(0,i.length-k.raw.length)+x.raw,n=n.substring(0,n.length-g.raw.length)+x.raw,t=y.substring(s.at(-1).raw.length).split(`
23
+ `);continue}}return{type:"blockquote",raw:i,tokens:s,text:n}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=r,i=()=>t.length-r.length,n=e[1].trim(),s=n.length>1,a={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");let l=this.rules.other.listItemRegex(n),p=!1;for(;r;){let c=!1,h="";if(!(e=l.exec(r))||this.rules.block.hr.test(r))break;let k=i();r=r.substring(e[0].length);let g=e[2].split(`
24
+ `,1)[0],y=e[1].length,x=this.options.pedantic?K(g,y):g.replace(this.rules.other.leadingSpaceTab,G=>K(G,y)),f=r.split(`
25
+ `,1)[0],z=!x.trim(),m=0;if(this.options.pedantic?(m=2,h=x.trimStart()):z?m=y+1:(m=x.search(this.rules.other.nonSpaceChar),m=m>4?1:m,h=x.slice(m),m+=y),z&&this.rules.other.blankLine.test(f)&&(r=r.substring(f.length+1),c=!0),!c){let G=this.rules.other.nextBulletRegex(m),ce=this.rules.other.hrRegex(m),pe=this.rules.other.fencesBeginRegex(m),he=this.rules.other.headingBeginRegex(m),je=this.rules.other.htmlBeginRegex(m),He=this.rules.other.blockquoteBeginRegex(m);for(;r;){let ue=r.split(`
26
+ `,1)[0],q;if(f=ue,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),q=f):q=f.replace(this.rules.other.leadingSpaceTab,Ne=>K(Ne)),pe.test(f)||he.test(f)||je.test(f)||He.test(f)||G.test(f)||ce.test(f))break;if(q.search(this.rules.other.nonSpaceChar)>=m||!f.trim())h+=`
27
+ `+q.slice(m);else{if(z||x.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||pe.test(x)||he.test(x)||ce.test(x))break;h+=`
28
+ `+f}z=!f.trim(),r=r.substring(ue.length+1),x=q.slice(m)}}let L=t.slice(k,i());a.loose||(p?a.loose=!0:this.rules.other.doubleBlankLine.test(L)&&(p=!0)),a.items.push({type:"list_item",raw:L,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]})}let o=a.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;a.raw=t.slice(0,i()).trimEnd();for(let c of a.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!a.loose){let h=c.tokens.filter(g=>g.type==="space"),k=h.length>0&&h.some(g=>this.rules.other.anyLine.test(g.raw));a.loose=k}for(let c of a.items){let h=c.tokens[0];if(c.task&&(h?.type==="text"||h?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let k=this.rules.other.listTaskCheckbox.exec(c.raw);if(k){let g={type:"checkbox",raw:k[0]+" ",checked:k[0]!=="[ ]"};c.checked=g.checked,a.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=g.raw+c.tokens[0].raw,c.tokens[0].text=g.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(g)):c.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):c.tokens.unshift(g)}}else c.task&&(c.task=!1)}if(a.loose)for(let c of a.items){c.loose=!0;for(let h of c.tokens)h.type==="text"&&(h.type="paragraph")}return a}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=ve(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(r){let e=this.rules.block.def.exec(r);if(e){if(!this.rules.other.startAngleBracket.test(e[2])&&Pe(e[2],"()")!==-1)return;let t=H(e[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:A(e[0],`
29
+ `),href:i,title:n}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=_e(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
30
+ `):[],s={type:"table",raw:A(e[0],`
31
+ `),header:[],align:[],rows:[]};if(t.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<t.length;a++)s.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:s.align[a]});for(let a of n)s.rows.push(_e(a,s.header.length).map((l,p)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[p]})));return s}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:A(e[0],`
32
+ `),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
33
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){if(this.lexer.state.linkParenPossible===!1)return;let e=this.rules.inline.link.exec(r);if(e){let t=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Ee(r,e[1],t,this.rules))return;let i=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let a=A(i.slice(0,-1),"\\");if((i.length-a.length)%2===0)return}else{let a=Pe(e[2],"()");if(a===-2)return;if(a>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let n=e[2],s="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(n);a&&(n=a[1],s=a[3])}else s=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?n=n.slice(1):n=n.slice(1,-1)),Ie(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let i=t[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Ee(r,t[1],i,this.rules))return;let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[H(n)];if(!s){let a=t[0].charAt(0);return{type:"text",raw:a,text:a}}return Ie(t,s,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let i=this.rules.inline.emStrongLDelim.exec(r);if(!(!i||!i[1]&&!i[2]&&!i[3]&&!i[4]||i[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[3])||!t||this.rules.inline.punctuation.exec(t))){let n=[...i[0]].length-1,s,a,l=n,p=0,o=i[0][0],c=t===o,h=o==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*r.length+n);(i=h.exec(e))!==null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s)continue;if(a=[...s].length,i[3]||i[4]){l+=a;continue}else if(i[5]||i[6]){if(n%3&&!((n+a)%3)){p+=a;continue}if(c)break}if(l-=a,l>0)continue;a=Math.min(a,a+l+p);let k=[...i[0]][0].length,g=r.slice(0,n+i.index+k+a);if(Math.min(n,a)%2){let x=g.slice(1,-1);return{type:"em",raw:g,text:x,tokens:this.lexer.inlineTokens(x)}}let y=g.slice(2,-2);return{type:"strong",raw:g,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return i&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let i=this.rules.inline.delLDelim.exec(r);if(i&&(!i[1]||!t||this.rules.inline.punctuation.exec(t))){let n=[...i[0]].length-1,s,a,l=n,p=this.rules.inline.delRDelim;for(p.lastIndex=0,e=e.slice(-1*r.length+n);(i=p.exec(e))!==null;){if(s=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!s||(a=[...s].length,a!==n))continue;if(i[3]||i[4]){l+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l);let o=[...i[0]][0].length,c=r.slice(0,n+i.index+o+a),h=c.slice(n,-n);return{type:"del",raw:c,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,i;return e[2]==="@"?(t=e[1],i="mailto:"+t):(t=e[1],i=t),{type:"link",raw:e[0],text:t,href:i,autolink:!0,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,i;if(e[2]==="@")t=e[0],i="mailto:"+t;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);t=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:t,href:i,autolink:!0,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:t?e[0]:Ht(e[0]),escaped:t}}}},S=class V{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||I,this.options.tokenizer=this.options.tokenizer||new N,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:b,block:Q.normal,inline:B.normal};this.options.pedantic?(t.block=Q.pedantic,t.inline=B.pedantic):this.options.gfm&&(t.block=Q.gfm,this.options.breaks?t.inline=B.breaks:t.inline=B.gfm),this.tokenizer.rules=t}static get rules(){return{block:Q,inline:B}}static lex(e,t){return new V(t).lex(e)}static lexInline(e,t){return new V(t).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
34
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let i=this.inlineQueue[t];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],i=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(b.tabCharGlobal," ").replace(b.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let s;if(this.options.extensions?.block?.some(l=>(s=l.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let l=t.at(-1);s.raw.length===1&&l!==void 0?l.raw+=`
35
+ `:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let l=t.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
36
+ `)?"":`
37
+ `)+s.raw,l.text+=`
38
+ `+s.text,this.inlineQueue.at(-1).src=l.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let l=t.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
39
+ `)?"":`
40
+ `)+s.raw,l.text+=`
41
+ `+s.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},t.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let a=e;if(this.options.extensions?.startBlock){let l=1/0,p=e.slice(1),o;this.options.extensions.startBlock.forEach(c=>{o=c.call({lexer:this},p),typeof o=="number"&&o>=0&&(l=Math.min(l,o))}),l<1/0&&l>=0&&(a=e.substring(0,l+1))}if(this.state.top&&(s=this.tokenizer.paragraph(a))){let l=t.at(-1);i&&l?.type==="paragraph"?(l.raw+=(l.raw.endsWith(`
42
+ `)?"":`
43
+ `)+s.raw,l.text+=`
44
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(s),i=a.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let l=t.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`
45
+ `)?"":`
46
+ `)+s.raw,l.text+=`
47
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(s);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes("["))return!1;let t=this.tokenizer.rules.inline.link;for(let i of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(i[0])&&e.charAt(i.index-1)!=="!")return!0;for(let i of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let n=i[0],s=n.lastIndexOf("[");if(!(n.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,H(n.slice(s+1,-1))))&&!(s>1&&this.linkInText(n.slice(1,s-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let i=this.state.linkParenPossible;this.state.linkParenPossible=i&&e.includes(")");try{return this.#e(e,t)}finally{this.state.linkParenPossible=i}}#e(e,t){let i=e;if(this.tokens.links&&e.includes("[")){let l=this.tokenizer.rules.inline.reflinkSearch,p=o=>{let c=o.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,H(o.slice(c+1,-1))))return o;if(c>1&&o.charAt(0)!=="!"){let h=o.slice(1,c-1);if(this.linkInText(h))return"["+h.replace(l,p)+"]["+"a".repeat(o.length-c-2)+"]"}return"["+"a".repeat(o.length-2)+"]"};i=i.replace(l,p)}i=i.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(l,p,o)=>o?"+".repeat(l.length):p?p+l.slice(p.length,-p.length).replace(/`/g,"+")+p:l),i=i.replace(this.tokenizer.rules.inline.blockSkip,(l,p,o)=>{let c=o?o.length:0;return l.slice(0,c)+"["+"a".repeat(l.length-c-2)+"]"}),i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let n=!1,s="",a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}n||(s=""),n=!1;let l;if(this.options.extensions?.inline?.some(o=>(l=o.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let o=t.at(-1);l.type==="text"&&o?.type==="text"?(o.raw+=l.raw,o.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,i,s)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,i,s)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let p=e;if(this.options.extensions?.startInline){let o=1/0,c=e.slice(1),h;this.options.extensions.startInline.forEach(k=>{h=k.call({lexer:this},c),typeof h=="number"&&h>=0&&(o=Math.min(o,h))}),o<1/0&&o>=0&&(p=e.substring(0,o+1))}if(l=this.tokenizer.inlineText(p)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(s=l.raw.slice(-1)),n=!0;let o=t.at(-1);o?.type==="text"?(o.raw+=l.raw,o.text+=l.text):t.push(l);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},F=class{options;parser;constructor(r){this.options=r||I}space(r){return""}code({text:r,lang:e,escaped:t}){let i=(e||"").match(b.notSpaceStart)?.[0],n=r?r.replace(b.endingNewline,"")+`
48
+ `:"";return i?'<pre><code class="language-'+w(i)+'">'+(t?n:w(n,!0))+`</code></pre>
49
+ `:"<pre><code>"+(t?n:w(n,!0))+`</code></pre>
50
+ `}blockquote({tokens:r}){return`<blockquote>
51
+ ${this.parser.parse(r)}</blockquote>
52
+ `}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
53
+ `}hr(r){return`<hr>
54
+ `}list(r){let e=r.ordered,t=r.start,i="";for(let a=0;a<r.items.length;a++){let l=r.items[a];i+=this.listitem(l)}let n=e?"ol":"ul",s=e&&t!==1?' start="'+t+'"':"";return"<"+n+s+`>
55
+ `+i+"</"+n+`>
56
+ `}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
57
+ `}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
58
+ `}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let i="";for(let n=0;n<r.rows.length;n++){let s=r.rows[n];t="";for(let a=0;a<s.length;a++)t+=this.tablecell(s[a]);i+=this.tablerow({text:t})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
59
+ <thead>
60
+ `+e+`</thead>
61
+ `+i+`</table>
62
+ `}tablerow({text:r}){return`<tr>
63
+ ${r}</tr>
64
+ `}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
65
+ `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${w(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,text:t,tokens:i,autolink:n}){let s=n?w(t,!0):this.parser.parseInline(i),a=ze(r);if(a===null)return s;r=w(a,n);let l='<a href="'+r+'"';return e&&(l+=' title="'+w(e)+'"'),l+=">"+s+"</a>",l}image({href:r,title:e,text:t,tokens:i}){i&&(t=this.parser.parseInline(i,this.parser.textRenderer));let n=ze(r);if(n===null)return w(t);r=n;let s=`<img src="${w(r)}" alt="${w(t)}"`;return e&&(s+=` title="${w(e)}"`),s+=">",s}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:w(r.text)}},ae=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},R=class Y{options;renderer;textRenderer;constructor(e){this.options=e||I,this.options.renderer=this.options.renderer||new F,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ae}static parse(e,t){return new Y(t).parse(e)}static parseInline(e,t){return new Y(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let i=0;i<e.length;i++){let n=e[i];if(this.options.extensions?.renderers?.[n.type]){let a=n,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(a.type)){t+=l||"";continue}}let s=n;switch(s.type){case"space":{t+=this.renderer.space(s);break}case"hr":{t+=this.renderer.hr(s);break}case"heading":{t+=this.renderer.heading(s);break}case"code":{t+=this.renderer.code(s);break}case"table":{t+=this.renderer.table(s);break}case"blockquote":{t+=this.renderer.blockquote(s);break}case"list":{t+=this.renderer.list(s);break}case"checkbox":{t+=this.renderer.checkbox(s);break}case"html":{t+=this.renderer.html(s);break}case"def":{t+=this.renderer.def(s);break}case"paragraph":{t+=this.renderer.paragraph(s);break}case"text":{t+=this.renderer.text(s);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let i="";for(let n=0;n<e.length;n++){let s=e[n];if(this.options.extensions?.renderers?.[s.type]){let l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(s.type)){i+=l||"";continue}}let a=s;switch(a.type){case"escape":{i+=t.text(a);break}case"html":{i+=t.html(a);break}case"link":{i+=t.link(a);break}case"image":{i+=t.image(a);break}case"checkbox":{i+=t.checkbox(a);break}case"strong":{i+=t.strong(a);break}case"em":{i+=t.em(a);break}case"codespan":{i+=t.codespan(a);break}case"br":{i+=t.br(a);break}case"del":{i+=t.del(a);break}case"text":{i+=t.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return i}},Z=class{options;block;constructor(r){this.options=r||I}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?S.lex:S.lexInline}provideParser(r=this.block){return r?R.parse:R.parseInline}};function _(r,e){if(Array.isArray(e))for(let t=0;t<e.length;t++)r.push(e[t]);else r.push(e)}var Ft=class{defaults=ee();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=R;Renderer=F;TextRenderer=ae;Lexer=S;Tokenizer=N;Hooks=Z;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let i of r)switch(_(t,e.call(this,i)),i.type){case"table":{let n=i;for(let s of n.header)_(t,this.walkTokens(s.tokens,e));for(let s of n.rows)for(let a of s)_(t,this.walkTokens(a.tokens,e));break}case"list":{let n=i;_(t,this.walkTokens(n.items,e));break}default:{let n=i;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(s=>{let a=n[s].flat(1/0);_(t,this.walkTokens(a,e))}):n.tokens&&_(t,this.walkTokens(n.tokens,e))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let i={...t};if(i.async=this.defaults.async||i.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let s=e.renderers[n.name];s?e.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=s.apply(this,a)),l}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[n.level];s?s.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),i.extensions=e),t.renderer){let n=this.defaults.renderer||new F(this.defaults);for(let s in t.renderer){if(!(s in n))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,l=t.renderer[a],p=n[a];n[a]=(...o)=>{let c=l.apply(n,o);return c===!1&&(c=p.apply(n,o)),c||""}}i.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new N(this.defaults);for(let s in t.tokenizer){if(!(s in n))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,l=t.tokenizer[a],p=n[a];n[a]=(...o)=>{let c=l.apply(n,o);return c===!1&&(c=p.apply(n,o)),c}}i.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new Z;for(let s in t.hooks){if(!(s in n))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,l=t.hooks[a],p=n[a];Z.passThroughHooks.has(s)?n[a]=o=>{if(this.defaults.async&&Z.passThroughHooksRespectAsync.has(s))return(async()=>{let h=await l.call(n,o);return p.call(n,h)})();let c=l.call(n,o);return p.call(n,c)}:n[a]=(...o)=>{if(this.defaults.async)return(async()=>{let h=await l.apply(n,o);return h===!1&&(h=await p.apply(n,o)),h})();let c=l.apply(n,o);return c===!1&&(c=p.apply(n,o)),c}}i.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,s=t.walkTokens;i.walkTokens=function(a){let l=[];return l.push(s.call(this,a)),n&&_(l,n.call(this,a)),l}}this.defaults={...this.defaults,...i}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return S.lex(r,e??this.defaults)}parser(r,e){return R.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let i={...t},n={...this.defaults,...i},s=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&i.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=r),n.async)return(async()=>{let a=n.hooks?await n.hooks.preprocess(e):e,l=await(n.hooks?await n.hooks.provideLexer(r):r?S.lex:S.lexInline)(a,n),p=n.hooks?await n.hooks.processAllTokens(l):l;n.walkTokens&&await Promise.all(this.walkTokens(p,n.walkTokens));let o=await(n.hooks?await n.hooks.provideParser(r):r?R.parse:R.parseInline)(p,n);return n.hooks?await n.hooks.postprocess(o):o})().catch(s);try{n.hooks&&(e=n.hooks.preprocess(e));let a=(n.hooks?n.hooks.provideLexer(r):r?S.lex:S.lexInline)(e,n);n.hooks&&(a=n.hooks.processAllTokens(a)),n.walkTokens&&this.walkTokens(a,n.walkTokens);let l=(n.hooks?n.hooks.provideParser(r):r?R.parse:R.parseInline)(a,n);return n.hooks&&(l=n.hooks.postprocess(l)),l}catch(a){return s(a)}}}onError(r,e){return t=>{if(t.message+=`
66
+ Please report this to https://github.com/markedjs/marked.`,r){let i="<p>An error occurred:</p><pre>"+w(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},P=new Ft;function d(r,e){return P.parse(r,e)}d.options=d.setOptions=function(r){return P.setOptions(r),d.defaults=P.defaults,Ce(d.defaults),d};d.getDefaults=ee;d.defaults=I;function Gt(...r){return P.use(...r),d.defaults=P.defaults,Ce(d.defaults),d}d.use=Gt;d.walkTokens=function(r,e){return P.walkTokens(r,e)};d.parseInline=P.parseInline;d.Parser=R;d.parser=R.parse;d.Renderer=F;d.TextRenderer=ae;d.Lexer=S;d.lexer=S.lex;d.Tokenizer=N;d.Hooks=Z;d.parse=d;var Wt=d.options,Kt=d.setOptions,Jt=d.walkTokens,Vt=d.parseInline;var Yt=R.parse,er=S.lex;var Xt=ge`:host{container-type:inline-size;display:block;min-inline-size:0}.interrupt-container{display:flex;flex-direction:column;gap:.75rem}.interrupt-actions,.interrupt-buttons{display:flex;justify-content:flex-end;gap:.5rem}.interrupt-message{white-space:normal}.interrupt-message :where(p){margin:0}.interrupt-message :where(ul,ol){margin:0;padding-inline-start:1.25rem}.entity-interrupt{background:var(--calcite-color-foreground-1);border-block-start:2px solid var(--calcite-color-brand);gap:0}.entity-heading{align-items:center;display:flex;gap:.75rem;padding:1rem 1rem .75rem}.entity-heading-icon{color:var(--calcite-color-brand);flex:none}.entity-heading-content{display:grid;gap:.25rem;min-inline-size:0}.entity-eyebrow{color:var(--calcite-color-text-3);font-size:var(--calcite-font-size-relative-sm);line-height:1.25}.entity-question{color:var(--calcite-color-text-1);font-size:var(--calcite-font-size-relative-md);font-weight:500;line-height:1.4;overflow-wrap:anywhere}.interrupt-picker{--arcgis-portal-entity-picker-results-max-block-size: min(22rem, 40vh);--arcgis-portal-entity-picker-selection-display: none;box-sizing:border-box;padding:0 1rem .75rem}.entity-interrupt .interrupt-actions{align-items:center;border-block-start:1px solid var(--calcite-color-border-3);display:grid;gap:.75rem;grid-template-columns:minmax(0,1fr) auto;min-block-size:2.25rem;padding:.625rem 1rem}.entity-selection{align-items:center;color:var(--calcite-color-text-2);display:flex;font-size:var(--calcite-font-size-relative-base);gap:.5rem;min-inline-size:0}.entity-selection calcite-icon{color:var(--calcite-color-status-success);flex:none}.entity-selection-label{flex:1;min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@container (max-width: 24rem){.entity-heading{padding:.875rem .75rem .625rem}.interrupt-picker{padding:0 .75rem .625rem}.entity-interrupt .interrupt-actions{gap:.5rem;grid-template-columns:minmax(0,1fr);padding:.625rem .75rem}.entity-selection:empty{display:none}}`;d.use({gfm:!0,breaks:!0,async:!1});var Ut=new $e,oe=class extends fe{constructor(){super(...arguments),this.#e=[],this._messages=U({blocking:!0}),this.pickerMessages=U({blocking:!0,name:"portal-entity-picker"}),this.pickerRef=de(),this.pickerKey=0,this.selectedEntity=null,this.selectionSubmitted=!1,this.arcgisCancel=X(),this.arcgisSubmit=X()}static{this.properties={selectedEntity:16,selectionSubmitted:16,type:1,message:1,options:0,portal:0,entityRequest:0,requestId:1}}static{this.styles=Xt}#e;get selectedReference(){return this.selectedEntity&&this.selectedEntity.entityType===this.entityRequest?.entityType?ye(this.selectedEntity):void 0}willUpdate(e){(e.has("entityRequest")||e.has("requestId")||e.has("portal"))&&(this.pickerKey+=1,this.selectedEntity=null,this.selectionSubmitted=!1,this.#e=[])}updated(e){this.isConnected&&this.entityRequest&&(e.has("entityRequest")||e.has("requestId")||e.has("portal"))&&this.pickerRef.value?.setFocus()}submit(){if(this.entityRequest){let e=this.selectedReference;if(!e||this.selectionSubmitted)return;this.selectionSubmitted=!0,this.arcgisSubmit.emit(JSON.stringify(e));return}this.arcgisSubmit.emit(this.type==="boolean-choice"?!0:this.#e)}_renderMessageContent(){let e=this.message??"",t=d.parse(e,{async:!1});return Ut.sanitize(t)}_renderInterruptInput(){let{_messages:e,type:t,options:i}=this;switch(t){case"single-select":return $`<calcite-list class="interrupt-list" .label=${e.singleSelectLabel} selection-mode=single-persist @calciteListChange=${n=>this.#e=n.target.selectedItems[0]?.value}>${i?.map(n=>$`<calcite-list-item .label=${n} .value=${n}></calcite-list-item>`)}</calcite-list>`;case"multi-select":return $`<calcite-list class="interrupt-list" .label=${e.multiSelectLabel} selection-mode=multiple @calciteListChange=${n=>this.#e=n.target.selectedItems.map(s=>s.value)}>${i?.map(n=>$`<calcite-list-item .label=${n} .value=${n}></calcite-list-item>`)}</calcite-list>`;case"text-input":return $`<calcite-input class="interrupt-input" .label=${e.textInputLabel} @calciteInputInput=${n=>this.#e=n.target.value}></calcite-input>`;case"boolean-choice":return null;default:return we(t)}}_renderInterruptButtons(e=!1){let{_messages:t,type:i,selectedReference:n}=this,s=i==="boolean-choice";return $`<div class="interrupt-buttons"><calcite-button .appearance=${e?"transparent":"outline"} .kind=${e?"neutral":void 0} @click=${()=>this.arcgisCancel.emit()}>${s?t.cancelButton:t.skipButton}</calcite-button><calcite-button appearance=solid .iconEnd=${e?"arrow-right":void 0} .disabled=${e&&(!n||this.selectionSubmitted)} @click=${this.submit}>${s?t.confirmButton:t.submitButton}</calcite-button></div>`}_renderEntityInterrupt(e){let{_messages:t,selectedReference:i}=this;return $`<div class="interrupt-container entity-interrupt"><div class="entity-heading"><calcite-icon class="entity-heading-icon" .icon=${e==="user"?"user":e==="group"?"group":"file"} scale=m></calcite-icon><div class="entity-heading-content"><span class="entity-eyebrow">${t.titleInput}</span><div class="interrupt-message entity-question">${W(this._renderMessageContent())}</div></div></div>${this.portal?be(this.pickerKey,$`<arcgis-portal-entity-picker class="interrupt-picker" .portal=${this.portal} .entityType=${e} .initialSearchTerm=${this.entityRequest?.searchTerm??""} mode=inline icon=search .selected=${this.selectedEntity} @arcgisSelectionChange=${({detail:n})=>{!this.selectionSubmitted&&(!n||n.entityType===this.entityRequest?.entityType)&&(this.selectedEntity=n)}} ${ke(this.pickerRef)}></arcgis-portal-entity-picker>`):this._renderInterruptInput()}<div class="interrupt-actions"><div class="entity-selection" role=status>${i&&$`<calcite-icon icon=check-circle scale=s></calcite-icon><span class="entity-selection-label" title=${i.label??me}>${i.label}</span><calcite-button appearance=transparent .disabled=${this.selectionSubmitted} icon-start=x kind=neutral .label=${this.pickerMessages.clearSelection} scale=s @click=${()=>{this.selectedEntity=null,this.pickerRef.value?.setFocus()}}></calcite-button>`||""}</div>${this._renderInterruptButtons(!0)}</div></div>`}render(){if(this.entityRequest)return this._renderEntityInterrupt(this.entityRequest.entityType);let{_messages:e,type:t}=this;return $`<div class="interrupt-container"><calcite-notice open kind=neutral width=full><div slot=title>${t==="boolean-choice"?e.titleConfirm:e.titleInput}</div><div slot=message class="interrupt-message">${W(this._renderMessageContent())}</div></calcite-notice>${this._renderInterruptInput()}<div class="interrupt-actions">${this._renderInterruptButtons()}</div></div>`}};xe("arcgis-portal-ai-assistant-interrupt",oe);export{oe as ArcgisPortalAiAssistantInterrupt};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import i from"./AL2HHH7T.js";import"./SRWFOV5W.js";import h from"./HZTWCOYQ.js";import"./Y5VUMGKH.js";import g from"./7HOK3ICE.js";import"./4QYVBXZT.js";import f from"./2V3QCHGP.js";import"./4KTRAA2J.js";import d from"./3K3BYENR.js";import"./PKA745KL.js";import"./VDXESPJK.js";import"./ULGME5RT.js";import"./DAAON2UO.js";import c from"./TZ6HFMZZ.js";import b from"./TIPQ2ZWK.js";import"./57MT7FOI.js";import"./4XIHI6AF.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{Q as e}from"./3ZC26CT6.js";import"./OUMTV5H5.js";import"./5PV2GUZW.js";export default $arcgis.t(([,,,,,,,r])=>{var t=class extends r{constructor(){super(...arguments),this.entityType="user",this.selected=null}static{this.properties={entityType:32,selected:0}}};e("arcgis-portal-user-picker",t);return t},a,b,c,d,f,g,h,i)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{c as l}from"./Y5VUMGKH.js";import b from"./TIPQ2ZWK.js";import a from"./C5IKEISI.js";import{a as u}from"./H7DF6TTK.js";export default $arcgis.t(([{b:c},{e:i}])=>{function w(r){return r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}var f=(r,t)=>[...Array(Math.ceil(r.length/t))].map((o,e)=>r.slice(t*e,t+t*e));async function E(r,t,o,e){let s=Object.fromEntries(o.flatMap(({id:n})=>n?[[n,[]]]:[]));if(!o.length)return{result:s};if(!t.groups)return{error:{code:"unhandledError"}};try{return(await Promise.all(f(t.groups,100).map(async n=>await c({url:`${u(r)}content/itemsgroups`,portal:r,params:{items:o.map(({id:a})=>a).join(","),groups:n.map(({id:a})=>a).join(",")},...e?{options:e}:{}})))).reduce((n,a)=>{for(let{groupId:m,items:p}of Object.values(a))for(let{itemId:d}of p)n[d]?.push(m);return n},s),{result:s}}catch{return{error:{code:"unhandledError"}}}}var j=async(r,t,o)=>{let e=l(t);if(!e)return{};try{return{result:await r.queryItems({...o,query:e})}}catch(s){return console.error(s),{error:{code:"unhandledError"}}}};async function q(r,t){if(!r||!t)return{result:null};let o=`${r.restUrl}/content/items/${t}/data`;return await i(o)}return{a:w,b:f,c:E,d:j,e:q}},a,b)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import b from"./HZTWCOYQ.js";import{c as G,d as T}from"./Y5VUMGKH.js";import{a as L}from"./VDXESPJK.js";import{a as m}from"./57MT7FOI.js";import a from"./C5IKEISI.js";import{a as A}from"./H7DF6TTK.js";import{a as F}from"./AYHYABMC.js";import{c as P}from"./OQ3OHDEB.js";import{I as f,J as $,K as C,M as I,Q as _,h as k,j as c,v as R}from"./3ZC26CT6.js";export default $arcgis.t(([{isAbortError:q},x,{b:O},{a:M}])=>{var B=["esri_livingatlas","esri_boundaries","esri_demographics","esri_nav","esri_webstyles"];function j(l){return L(l.trim()).replace(/[!*+\-&|()[\]{}^~?:"\\]/gu,"\\$&")}async function K({portal:l,searchTerm:e,num:t=100,query:r,signal:a}){let i=j(e),o=`${A(l)}portals/self/users/search`,s=[i?`(${i})`:void 0,r?.trim()?`(${r.trim()})`:void 0];l.isPortal&&s.push(...B.map(p=>`-username:${p}`));let u=o.includes("www.arcgis.com")&&l.isPortal?{disableIdentityLookup:!0,addTokenManually:!1}:{};return await O({url:o,portal:l,params:{num:Math.min(Math.max(t,1),100),q:s.filter(Boolean).join(" AND "),sortField:"relevance"},options:{...u,...a?{signal:a}:{}}})}function E(l,e){let t=["all"];return e==="user"||!l.user?.username||(e==="item"&&t.push("myContent"),t.push("myGroups"),l.user.orgId&&t.push("myOrganization")),t}function b(l){return`"${l.replace(/[\\"]/gu,"\\$&")}"`}async function H(l){let{portal:e,entityType:t,searchTerm:r,signal:a}=l,i=Math.min(Math.max(l.num??10,1),100),o=l.scope??"all";try{if(a?.throwIfAborted(),!E(e,t).includes(o))throw new Error(`Search scope "${o}" is unavailable for ${t} searches.`);if(t==="user")return{result:{entityType:t,result:await K({portal:e,searchTerm:r,num:i,query:l.query,...a?{signal:a}:{}})}};let s=G(r);if(!s)return{};let u,p=e.user;if(o==="myContent"&&p)u=`owner:${b(p.username)}`;else if(o==="myOrganization"&&p?.orgId)u=`orgid:${b(p.orgId)}`;else if(o==="myGroups"&&p){if(t==="group"){let n=await M(e,{num:i,q:T(s,l.query),searchUserAccess:"groupMember",searchUserName:p.username},{signal:a});return{result:{entityType:t,result:new x({results:n.results,total:n.total})}}}let y=await p.fetchGroups();if(a?.throwIfAborted(),!y.length)return{result:{entityType:t,result:new x({results:[],total:0})}};u=y.map(({id:n})=>{if(!n)throw new Error("A membership group is missing its ID.");return`group:${b(n)}`}).join(" OR ")}let d={num:i,query:T(s,l.query,u)};return t==="group"?{result:{entityType:t,result:await e.queryGroups(d,{signal:a})}}:{result:{entityType:t,result:await e.queryItems(d,{signal:a})}}}catch(s){if(a?.aborted||q(s))throw s;return console.error(s),{error:{code:"unhandledError"}}}}var Q=l=>P((e,t)=>{let r={searchTerm:"",scope:"all",isSearching:!1,searchFailed:!1},a,i,o=n=>{r={...r,...n},t.exports={...r,setSearchTerm:d,setScope:y}},s=()=>{a!==void 0&&(clearTimeout(a),a=void 0),i?.abort(),i=void 0},u=async(n,h)=>{let{entityType:v,num:z,portal:D,query:U}=e,{scope:S}=r;try{let{error:g,result:N}=await H({portal:D,entityType:v,searchTerm:n,num:z,query:U,signal:h,...S==="all"?{}:{scope:S}});h.aborted||o({searchFailed:!!g,searchResult:N,isSearching:!1})}catch(g){!h.aborted&&!q(g)&&(console.error(g),o({searchFailed:!0,searchResult:void 0,isSearching:!1}))}},p=n=>{let h=n.searchTerm.trim();if(s(),o({...n,searchFailed:!1,searchResult:void 0,isSearching:!!h}),l(!!h),h){i=new AbortController;let{signal:v}=i;a=setTimeout(()=>{a=void 0,u(h,v)},400)}},d=n=>{p({searchTerm:n,scope:r.scope})},y=n=>{n!==r.scope&&p({searchTerm:r.searchTerm,scope:n})};return t.onUpdate(n=>{(n.has("portal")||n.has("entityType")||n.has("query")||n.has("num")||n.has("initialSearchTerm"))&&p({searchTerm:e.initialSearchTerm,scope:n.has("portal")||n.has("entityType")?"all":r.scope})}),t.onDisconnected(s),{...r,setSearchTerm:d,setScope:y}}),J=k`:host{display:block;inline-size:100%}.entity-picker{display:flex;flex-direction:column;gap:.5rem;min-inline-size:16rem}.entity-picker__results{max-block-size:var(--arcgis-portal-entity-picker-results-max-block-size, 22rem);overflow-y:auto}.entity-picker__cards{display:flex;flex-direction:column;gap:.5rem}.entity-picker__status{color:var(--calcite-color-text-3);font-size:.875rem;margin:0;padding:.75rem}.entity-picker__selection{align-items:center;display:var(--arcgis-portal-entity-picker-selection-display, flex);gap:.5rem}.entity-picker__selection-label{flex:1;min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.entity-picker__input{inline-size:100%}`,w=class extends C{constructor(){super(...arguments),this._messages=F({blocking:!0,name:"portal-entity-picker"}),this.inputRef=f(),this.inputContainerRef=f(),this.resizeObserver=null,this.searchController=Q(e=>{(!e||this.mode==="popover")&&(this.popoverOpen=e)})(this),this.popoverOpen=!1,this.popoverWidth=0,this.entityType="group",this.mode="inline",this.selectionMode="single",this.selected=null,this.initialSearchTerm="",this.num=10,this.arcgisSelectionChange=R()}static{this.properties={popoverOpen:16,popoverWidth:16,portal:0,entityType:1,mode:1,selectionMode:1,selected:0,query:1,initialSearchTerm:1,num:9,icon:1,messageOverrides:0}}static{this.styles=J}get searchLabel(){let{entityType:e,_messages:t}=this;return e==="group"?t.searchGroups:e==="item"?t.searchItems:t.searchUsers}get selectedLabel(){let{entityType:e,selected:t}=this;if(t?.entityType===e)return t.entityType==="user"?t.entity.fullName||t.entity.username:t.entity.title||t.entity.id||void 0}async togglePicker(e){this.mode==="popover"&&(this.popoverOpen=e,await this.updateComplete,await this.setFocus())}async setFocus(){await this.inputRef.value?.setFocus()}firstUpdated(){this.updatePopoverWidth(),!(typeof ResizeObserver>"u"||!this.inputContainerRef.value)&&(this.resizeObserver=new ResizeObserver(()=>this.updatePopoverWidth()),this.resizeObserver.observe(this.inputContainerRef.value))}willUpdate(e){e.has("mode")&&this.mode==="inline"&&(this.popoverOpen=!1)}disconnectedCallback(){this.resizeObserver?.disconnect(),this.resizeObserver=null,super.disconnectedCallback()}updatePopoverWidth(){requestAnimationFrame(()=>{this.popoverWidth=this.inputContainerRef.value?.offsetWidth??0})}emitSelection(e){this.arcgisSelectionChange.emit(e),this.mode==="popover"&&this.togglePicker(!1)}getFocusableResults(){let e=Array.from(this.renderRoot.querySelector('slot[name="list-start"]')?.assignedElements({flatten:!0})??[]).filter(r=>r instanceof HTMLElement&&(r.tagName==="CALCITE-LIST-ITEM"||r.tabIndex>=0)),t=Array.from(this.renderRoot.querySelectorAll("calcite-list-item, arcgis-portal-group-card, arcgis-portal-item-card"));return[...e,...t]}async focusResult(e){if(e.tagName==="CALCITE-LIST-ITEM"){await e.setFocus();return}if(e.tagName==="ARCGIS-PORTAL-GROUP-CARD"){await e.restoreFocus();return}if(e.tagName==="ARCGIS-PORTAL-ITEM-CARD"){await e.restoreFocus();return}e.focus()}async focusResultAt(e){let t=this.getFocusableResults();if(!t.length)return;let r=(e+t.length)%t.length;await this.focusResult(t[r])}handleResultsKeyDown(e){if(e.defaultPrevented)return;let t=this.getFocusableResults(),r=e.composedPath(),a=t.findIndex(o=>r.includes(o));if(a===-1)return;if(this.mode==="inline"&&(e.key==="ArrowDown"||e.key==="ArrowUp")){e.preventDefault(),this.focusResultAt(a+(e.key==="ArrowDown"?1:-1));return}let i=t[a];if(i.tagName==="ARCGIS-PORTAL-GROUP-CARD"&&(e.key==="Enter"||e.key===" ")){e.preventDefault();let{group:o}=i;this.emitSelection({entityType:"group",entity:o});return}if(i.tagName==="ARCGIS-PORTAL-ITEM-CARD"&&(e.key==="Enter"||e.key===" ")){e.preventDefault();let{item:o}=i;this.emitSelection({entityType:"item",entity:o})}}renderScopeSelector(){let{entityType:e,portal:t,_messages:r}=this,{scope:a}=this.searchController,i=E(t,e);return i.length<=1?null:c`<calcite-select .label=${r.searchIn} scale=m @calciteSelectChange=${o=>{let s=i.find(u=>u===o.target.value);s&&this.searchController.setScope(s)}}>${i.map(o=>c`<calcite-option .selected=${o===a} .value=${o}>${o==="all"?e==="item"?r.allContent:r.allGroups:r[o]}</calcite-option>`)}</calcite-select>`}renderGroup(e){return m(e.id,c`<calcite-list-item .label=${e.title||e.id||""} .description=${[e.owner,e.access].filter(Boolean).join(" \xB7 ")} .selected=${this.selected?.entityType==="group"&&this.selected.entity.id===e.id} @calciteListItemSelect=${()=>this.emitSelection({entityType:"group",entity:e})}><calcite-avatar slot=content-start .fullName=${e.title??void 0} .thumbnail=${e.thumbnailUrl??void 0} scale=m></calcite-avatar></calcite-list-item>`)}renderInlineGroup(e){return m(e.id,c`<arcgis-portal-group-card .group=${e} .portal=${this.portal} .preview=${this.selectionMode==="none"?"top":void 0} .selected=${this.selected?.entityType==="group"&&this.selected.entity.id===e.id} .selection=${this.selectionMode} @arcgisGroupBrowserCardPreview=${()=>this.emitSelection({entityType:"group",entity:e})} @arcgisGroupCardSelect=${({detail:t})=>{t.selected&&this.emitSelection({entityType:"group",entity:t.group})}} .user=${this.portal.user??void 0} view=compact></arcgis-portal-group-card>`)}renderItem(e){return m(e.id,c`<calcite-list-item .label=${e.title||e.id||""} .description=${[e.type,e.owner].filter(Boolean).join(" \xB7 ")} .selected=${this.selected?.entityType==="item"&&this.selected.entity.id===e.id} @calciteListItemSelect=${()=>this.emitSelection({entityType:"item",entity:e})}><calcite-avatar slot=content-start .fullName=${e.title??void 0} .thumbnail=${e.thumbnailUrl??void 0} scale=m></calcite-avatar></calcite-list-item>`)}renderInlineItem(e){return m(e.id,c`<arcgis-portal-item-card .item=${e} .portal=${this.portal} .preview=${this.selectionMode==="none"?"top":void 0} .selected=${this.selected?.entityType==="item"&&this.selected.entity.id===e.id} .selection=${this.selectionMode} @arcgisItemBrowserCardPreview=${()=>this.emitSelection({entityType:"item",entity:e})} @arcgisItemCardSelect=${({detail:t})=>{t.selected&&this.emitSelection({entityType:"item",entity:t.item})}} .user=${this.portal.user??void 0} view=list></arcgis-portal-item-card>`)}renderUser(e){return m(e.username,c`<calcite-list-item .label=${e.fullName||e.username} .description=${e.username} .selected=${this.selected?.entityType==="user"&&this.selected.entity.username===e.username} @calciteListItemSelect=${()=>this.emitSelection({entityType:"user",entity:e})}><arcgis-portal-user-avatar slot=content-start .portal=${this.portal} .user=${e} scale=m></arcgis-portal-user-avatar></calcite-list-item>`)}renderSearchResults(){let{entityType:e,_messages:t}=this,{isSearching:r,searchFailed:a,searchResult:i,searchTerm:o}=this.searchController;if(!o.trim())return null;if(r)return c`<div role=status><calcite-loader .label=${t.searching} scale=s></calcite-loader></div>`;if(a)return c`<p class="entity-picker__status" role=alert>${t.searchFailed}</p>`;if(!(i?.result.results??[]).length){let s=e==="group"?t.noGroupsFound:e==="item"?t.noItemsFound:t.noUsersFound;return c`<p class="entity-picker__status" role=status>${s}</p>`}return this.mode==="inline"&&i?.entityType==="group"?c`<div class="entity-picker__cards"><slot name=list-start></slot>${i.result.results.map(s=>this.renderInlineGroup(s))}</div>`:this.mode==="inline"&&i?.entityType==="item"?c`<div class="entity-picker__cards"><slot name=list-start></slot>${i.result.results.map(s=>this.renderInlineItem(s))}</div>`:c`<calcite-list interaction-mode=interactive .label=${this.searchLabel} .selectionMode=${this.mode==="inline"&&this.selectionMode==="single"?"single-persist":"none"}><slot name=list-start></slot>${i?.entityType==="group"?i.result.results.map(s=>this.renderGroup(s)):i?.entityType==="item"?i.result.results.map(s=>this.renderItem(s)):i?.result.results.map(s=>this.renderUser(s))}</calcite-list>`}renderPicker(e=!0){return c`<div class="entity-picker">${this.selectedLabel&&c`<div class="entity-picker__selection"><span class="entity-picker__selection-label">${this.selectedLabel}</span><calcite-button appearance=transparent icon-start=x kind=neutral .label=${this._messages.clearSelection} @click=${()=>this.arcgisSelectionChange.emit(null)} scale=s></calcite-button></div>`||""}${this.renderScopeSelector()}<div class="entity-picker__input" ${$(this.inputContainerRef)}><calcite-input .icon=${this.icon} .clearable=${this.mode==="inline"} .label=${this.searchLabel} .placeholder=${this.searchLabel} .value=${this.searchController.searchTerm} @click=${()=>{this.mode==="popover"&&this.searchController.searchTerm.trim()&&(this.popoverOpen=!0)}} @keydown=${t=>{(t.key==="ArrowDown"||t.key==="ArrowUp")&&this.searchController.searchResult?.result.results.length&&(t.preventDefault(),this.focusResultAt(t.key==="ArrowDown"?0:-1))}} @focus=${()=>{this.mode==="popover"&&this.searchController.searchTerm.trim()&&(this.popoverOpen=!0)}} @calciteInputInput=${t=>{this.searchController.setSearchTerm(t.target.value)}} ${$(this.inputRef)}></calcite-input></div>${e&&c`<div class="entity-picker__results" @keydown=${this.handleResultsKeyDown}>${this.renderSearchResults()}</div>`||""}</div>`}render(){return this.mode==="inline"?this.renderPicker():c`${this.renderPicker(!1)}<calcite-popover .label=${this.searchLabel} .open=${this.popoverOpen} placement=bottom-start .referenceElement=${this.inputContainerRef.value} trigger-disabled @calcitePopoverClose=${e=>{!e.target.open&&this.popoverOpen&&(this.popoverOpen=!1,requestAnimationFrame(()=>{this.setFocus()}))}}><div class="entity-picker__results" style=${I({inlineSize:this.popoverWidth?`${this.popoverWidth}px`:void 0})}>${this.renderSearchResults()}</div></calcite-popover>`}};_("arcgis-portal-entity-picker",w);return w},"core/promiseUtils","portal/PortalQueryResult",a,b)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{$ as ec,Aa as mc,B as La,Ba as dc,C as Ua,D as Ha,Da as gc,E as kn,F as Ba,G as Zs,H as G,I as En,J as $t,K as Cn,L as Be,M as Ga,N as Wa,O as Ka,P as qa,Q as za,R as Ja,V as Ya,W as Xa,Y as Qa,Z as Za,_ as ei,aa as tc,ba as rc,c as Oa,ca as ti,da as nc,ea as sc,f as nr,g as Xs,ga as ic,h as ge,ha as oc,i as Rr,j as Na,k as sr,l as Pa,la as ac,o as Qs,p as Ra,pa as cc,qa as xn,ra as lc,s as Ma,t as st,ta as uc,u as ja,ua as ir,v as Da,va as hc,w as $a,x as Va,xa as pc,y as Fa,ya as ri,z as Mr,za as fc}from"./IJ76WUCD.js";import{$ as Zt,$a as ke,Aa as Nr,Ba as Pr,Ca as _a,D as Ws,Ea as Js,F as Oe,Fa as ya,G as Ks,H as fa,Ha as wa,Ia as ba,J as Dt,La as yt,M as ma,Na as va,O as da,Oa as Sa,P as vn,Pa as tr,Qa as ka,Sa as Ea,Ta as Ca,Ua as xa,V as qs,Va as Ta,Wa as rr,Xa as Ys,Y as Q,Ya as Z,Za as Ia,a as O,aa as zs,ab as Aa,bb as nt,e as aa,f as ca,g as la,h as ua,i as ha,ia as _t,j as pa,k as Ae,ma as er,na as Sn,sa as Ne,x as X,za as ga}from"./GGDOGNH4.js";import{o as wt}from"./JZ7EM2ZO.js";function _c(e,t){if(e!=null){if(typeof e!="number"||Number.isNaN(e)||e<=0)throw new Error(`${t} must be greater than 0`);return e}}function bt(e){if(e==null)return;let t=typeof e=="number"?{runTimeout:e}:e,r=t.refreshOn??"auto";if(r!=="auto"&&r!=="heartbeat")throw new Error('refreshOn must be "auto" or "heartbeat"');let n=_c(t.runTimeout,"runTimeout"),s=_c(t.idleTimeout,"idleTimeout");if(!(n===void 0&&s===void 0))return{runTimeout:n,idleTimeout:s,refreshOn:r}}var W="__start__",K="__end__",We="__input__";var vt="__error__",Dr="__error_source_node__",Tn="__pregel_ns_writes";function yc(){let e=typeof process<"u"?process.env?.LANGGRAPH_DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT:void 0;if(e!==void 0&&e!==""){let t=Number.parseInt(e,10);if(Number.isFinite(t)&&t>0)return t}return 5e3}var oe="__pregel_send",Ke="__pregel_call",le="__pregel_read",Ee="__pregel_checkpointer",Ft="__pregel_resuming",or="__pregel_task_id",$r="__pregel_stream",Lh="__pregel_resume_value",Lt="__pregel_resume_map",ue="__pregel_scratchpad",St="__pregel_previous",Uh="__pregel_durability",kt="checkpoint_id",ve="checkpoint_ns",wc="__pregel_node_finished",Vr="__pregel_node_error",ae="checkpoint_map",In="__pregel_replay_state",bc="__pregel_abort_signals",L="__interrupt__",he="__resume__",Fr="__no_writes__",Et="__return__",Ct="__previous__",z="langsmith:hidden";var si="__self__",qe="__pregel_tasks",pe="__pregel_push",An="__pregel_pull",fe="00000000-0000-0000-0000-000000000000",vc=[z,We,L,he,vt,Dr,Fr,oe,le,Ee,Uh,$r,Ft,or,Ke,Lh,ue,St,ae,ve,kt,In],ni=Symbol.for("langgraph.command"),Sc=class{[ni];constructor(e){this[ni]=e}};function On(e){let t=e;return t!=null&&typeof t.node=="string"&&t.args!==void 0}var Vt=class{lg_name="Send";node;args;timeout;constructor(e,t,r){this.node=e,this.args=jr(t),this.timeout=bt(r?.timeout)}toJSON(){return{lg_name:this.lg_name,node:this.node,args:this.args,timeout:this.timeout}}};function ee(e){return e instanceof Vt}var Ge="__overwrite__",Hh=class{lg_name="Overwrite";[Ge];constructor(e){this[Ge]=e}get value(){return this[Ge]}toJSON(){return{[Ge]:this[Ge]}}static isInstance(e){return!e||typeof e!="object"?!1:"__overwrite__"in e||"lg_name"in e&&e.lg_name==="Overwrite"}};function Pe(e){if(typeof e=="object"&&e!==null){if("__overwrite__"in e)return[!0,e[Ge]];let t=e;if(t.type==="__overwrite__"&&"value"in t)return[!0,t.value]}return[!1,void 0]}function Ut(e){return Pe(e)[0]}function Ht(e){return!e||typeof e!="object"||!("__interrupt__"in e)?!1:Array.isArray(e[L])}var _e=class extends Sc{lg_name="Command";lc_direct_tool_output=!0;graph;update;resume;goto=[];static PARENT="__parent__";constructor(e){super(e),this.resume=e.resume,this.graph=e.graph,this.update=e.update,e.goto&&(this.goto=Array.isArray(e.goto)?jr(e.goto):[jr(e.goto)])}_updateAsTuples(){return this.update&&typeof this.update=="object"&&!Array.isArray(this.update)?Object.entries(this.update):Array.isArray(this.update)&&this.update.every(e=>Array.isArray(e)&&e.length===2&&typeof e[0]=="string")?this.update:[["__root__",this.update]]}toJSON(){let e;return typeof this.goto=="string"?e=this.goto:ee(this.goto)?e=this.goto.toJSON():e=this.goto?.map(t=>typeof t=="string"?t:t.toJSON()),{lg_name:this.lg_name,update:this.update,resume:this.resume,goto:e}}};function ne(e){return typeof e!="object"||e==null?!1:"lg_name"in e&&e.lg_name==="Command"}function Bh(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function jr(e,t=new Map){if(e!=null&&typeof e=="object"){if(t.has(e))return t.get(e);let r;if(Array.isArray(e))r=[],t.set(e,r),e.forEach((n,s)=>{r[s]=jr(n,t)});else if(e instanceof _e||e instanceof Vt||!Bh(e))r=e,t.set(e,r);else if(ne(e))r=new _e(e),t.set(e,r);else if(On(e))r=new Vt(e.node,e.args,e.timeout!==void 0?{timeout:e.timeout}:void 0),t.set(e,r);else if("lc_serializable"in e&&e.lc_serializable)r=e,t.set(e,r);else{r={},t.set(e,r);for(let[n,s]of Object.entries(e))r[n]=jr(s,t)}return r}return e}var Ce=class extends Error{lc_error_code;constructor(e,t){let r=e??"";t?.lc_error_code&&(r=`${r}
2
+ import{$ as ec,Aa as mc,B as La,Ba as dc,C as Ua,D as Ha,Da as gc,E as kn,F as Ba,G as Zs,H as G,I as En,J as $t,K as Cn,L as Be,M as Ga,N as Wa,O as Ka,P as qa,Q as za,R as Ja,V as Ya,W as Xa,Y as Qa,Z as Za,_ as ei,aa as tc,ba as rc,c as Oa,ca as ti,da as nc,ea as sc,f as nr,g as Xs,ga as ic,h as ge,ha as oc,i as Rr,j as Na,k as sr,l as Pa,la as ac,o as Qs,p as Ra,pa as cc,qa as xn,ra as lc,s as Ma,t as st,ta as uc,u as ja,ua as ir,v as Da,va as hc,w as $a,x as Va,xa as pc,y as Fa,ya as ri,z as Mr,za as fc}from"./V5PD3E3W.js";import{$ as Zt,$a as ke,Aa as Nr,Ba as Pr,Ca as _a,D as Ws,Ea as Js,F as Oe,Fa as ya,G as Ks,H as fa,Ha as wa,Ia as ba,J as Dt,La as yt,M as ma,Na as va,O as da,Oa as Sa,P as vn,Pa as tr,Qa as ka,Sa as Ea,Ta as Ca,Ua as xa,V as qs,Va as Ta,Wa as rr,Xa as Ys,Y as Q,Ya as Z,Za as Ia,a as O,aa as zs,ab as Aa,bb as nt,e as aa,f as ca,g as la,h as ua,i as ha,ia as _t,j as pa,k as Ae,ma as er,na as Sn,sa as Ne,x as X,za as ga}from"./UUITDWRA.js";import{o as wt}from"./K3GAZFRI.js";function _c(e,t){if(e!=null){if(typeof e!="number"||Number.isNaN(e)||e<=0)throw new Error(`${t} must be greater than 0`);return e}}function bt(e){if(e==null)return;let t=typeof e=="number"?{runTimeout:e}:e,r=t.refreshOn??"auto";if(r!=="auto"&&r!=="heartbeat")throw new Error('refreshOn must be "auto" or "heartbeat"');let n=_c(t.runTimeout,"runTimeout"),s=_c(t.idleTimeout,"idleTimeout");if(!(n===void 0&&s===void 0))return{runTimeout:n,idleTimeout:s,refreshOn:r}}var W="__start__",K="__end__",We="__input__";var vt="__error__",Dr="__error_source_node__",Tn="__pregel_ns_writes";function yc(){let e=typeof process<"u"?process.env?.LANGGRAPH_DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT:void 0;if(e!==void 0&&e!==""){let t=Number.parseInt(e,10);if(Number.isFinite(t)&&t>0)return t}return 5e3}var oe="__pregel_send",Ke="__pregel_call",le="__pregel_read",Ee="__pregel_checkpointer",Ft="__pregel_resuming",or="__pregel_task_id",$r="__pregel_stream",Lh="__pregel_resume_value",Lt="__pregel_resume_map",ue="__pregel_scratchpad",St="__pregel_previous",Uh="__pregel_durability",kt="checkpoint_id",ve="checkpoint_ns",wc="__pregel_node_finished",Vr="__pregel_node_error",ae="checkpoint_map",In="__pregel_replay_state",bc="__pregel_abort_signals",L="__interrupt__",he="__resume__",Fr="__no_writes__",Et="__return__",Ct="__previous__",z="langsmith:hidden";var si="__self__",qe="__pregel_tasks",pe="__pregel_push",An="__pregel_pull",fe="00000000-0000-0000-0000-000000000000",vc=[z,We,L,he,vt,Dr,Fr,oe,le,Ee,Uh,$r,Ft,or,Ke,Lh,ue,St,ae,ve,kt,In],ni=Symbol.for("langgraph.command"),Sc=class{[ni];constructor(e){this[ni]=e}};function On(e){let t=e;return t!=null&&typeof t.node=="string"&&t.args!==void 0}var Vt=class{lg_name="Send";node;args;timeout;constructor(e,t,r){this.node=e,this.args=jr(t),this.timeout=bt(r?.timeout)}toJSON(){return{lg_name:this.lg_name,node:this.node,args:this.args,timeout:this.timeout}}};function ee(e){return e instanceof Vt}var Ge="__overwrite__",Hh=class{lg_name="Overwrite";[Ge];constructor(e){this[Ge]=e}get value(){return this[Ge]}toJSON(){return{[Ge]:this[Ge]}}static isInstance(e){return!e||typeof e!="object"?!1:"__overwrite__"in e||"lg_name"in e&&e.lg_name==="Overwrite"}};function Pe(e){if(typeof e=="object"&&e!==null){if("__overwrite__"in e)return[!0,e[Ge]];let t=e;if(t.type==="__overwrite__"&&"value"in t)return[!0,t.value]}return[!1,void 0]}function Ut(e){return Pe(e)[0]}function Ht(e){return!e||typeof e!="object"||!("__interrupt__"in e)?!1:Array.isArray(e[L])}var _e=class extends Sc{lg_name="Command";lc_direct_tool_output=!0;graph;update;resume;goto=[];static PARENT="__parent__";constructor(e){super(e),this.resume=e.resume,this.graph=e.graph,this.update=e.update,e.goto&&(this.goto=Array.isArray(e.goto)?jr(e.goto):[jr(e.goto)])}_updateAsTuples(){return this.update&&typeof this.update=="object"&&!Array.isArray(this.update)?Object.entries(this.update):Array.isArray(this.update)&&this.update.every(e=>Array.isArray(e)&&e.length===2&&typeof e[0]=="string")?this.update:[["__root__",this.update]]}toJSON(){let e;return typeof this.goto=="string"?e=this.goto:ee(this.goto)?e=this.goto.toJSON():e=this.goto?.map(t=>typeof t=="string"?t:t.toJSON()),{lg_name:this.lg_name,update:this.update,resume:this.resume,goto:e}}};function ne(e){return typeof e!="object"||e==null?!1:"lg_name"in e&&e.lg_name==="Command"}function Bh(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function jr(e,t=new Map){if(e!=null&&typeof e=="object"){if(t.has(e))return t.get(e);let r;if(Array.isArray(e))r=[],t.set(e,r),e.forEach((n,s)=>{r[s]=jr(n,t)});else if(e instanceof _e||e instanceof Vt||!Bh(e))r=e,t.set(e,r);else if(ne(e))r=new _e(e),t.set(e,r);else if(On(e))r=new Vt(e.node,e.args,e.timeout!==void 0?{timeout:e.timeout}:void 0),t.set(e,r);else if("lc_serializable"in e&&e.lc_serializable)r=e,t.set(e,r);else{r={},t.set(e,r);for(let[n,s]of Object.entries(e))r[n]=jr(s,t)}return r}return e}var Ce=class extends Error{lc_error_code;constructor(e,t){let r=e??"";t?.lc_error_code&&(r=`${r}
3
3
 
4
4
  Troubleshooting URL: https://docs.langchain.com/oss/javascript/langgraph/${t.lc_error_code}/
5
5
  `),super(r),this.lc_error_code=t?.lc_error_code}},Nn=class extends Ce{get is_bubble_up(){return!0}},ii=class extends Ce{constructor(e,t){super(e,t),this.name="GraphRecursionError"}static get unminifiable_name(){return"GraphRecursionError"}},Bt=class extends Ce{constructor(e,t){super(e,t),this.name="GraphValueError"}static get unminifiable_name(){return"GraphValueError"}},Pn=class extends Nn{reason;constructor(e="shutdown",t){super(`Graph drained: ${e}`,t),this.name="GraphDrained",this.reason=e}static get unminifiable_name(){return"GraphDrained"}};function Rn(e){return e!==void 0&&e.name===Pn.unminifiable_name}var it=class extends Nn{interrupts;constructor(e,t){super(JSON.stringify(e,null,2),t),this.name="GraphInterrupt",this.interrupts=e??[]}static get unminifiable_name(){return"GraphInterrupt"}},Mn=class extends it{constructor(e,t){super([{value:e}],t),this.name="NodeInterrupt"}static get unminifiable_name(){return"NodeInterrupt"}},jn=class{node;error;constructor(e,t){this.node=e,this.error=t}static get unminifiable_name(){return"NodeError"}};function Gh(e){return e!=null&&typeof e=="object"&&e.constructor!=null&&e.constructor.unminifiable_name===jn.unminifiable_name}var Dn=class extends Nn{command;constructor(e){super(),this.name="ParentCommand",this.command=e}static get unminifiable_name(){return"ParentCommand"}};function oi(e){return e!==void 0&&e.name===Dn.unminifiable_name}function xt(e){return e!==void 0&&e.is_bubble_up===!0}function ot(e){return e!==void 0&&[it.unminifiable_name,Mn.unminifiable_name].includes(e.name)}var $n=class extends Ce{node;kind;timeout;elapsed;runTimeout;idleTimeout;constructor(e,t){let{node:r,elapsed:n,kind:s,runTimeout:i,idleTimeout:o}=e,a,c;if(s==="idle"){if(o===void 0)throw new Error("idleTimeout is required when kind='idle'");c=o,a=`Node "${r}" exceeded its idle timeout of ${o}ms without making progress (elapsed: ${n}ms).`}else{if(i===void 0)throw new Error("runTimeout is required when kind='run'");c=i,a=`Node "${r}" exceeded its run timeout of ${i}ms (elapsed: ${n}ms).`}super(a,t),this.name="NodeTimeoutError",this.node=r,this.kind=s,this.timeout=c,this.elapsed=n,this.runTimeout=i,this.idleTimeout=o}static get unminifiable_name(){return"NodeTimeoutError"}};function Wh(e){return e!==void 0&&e.name===$n.unminifiable_name}var Vn=class extends Ce{constructor(e,t){super(e,t),this.name="EmptyInputError"}static get unminifiable_name(){return"EmptyInputError"}},$=class extends Ce{constructor(e,t){let r=Error.stackTraceLimit;Error.stackTraceLimit=0,super(e,t),Error.stackTraceLimit=r,this.name="EmptyChannelError"}static get unminifiable_name(){return"EmptyChannelError"}},R=class extends Ce{constructor(e,t){super(e,t),this.name="InvalidUpdateError"}static get unminifiable_name(){return"InvalidUpdateError"}},Kh=class extends Ce{constructor(e,t){super(e,t),this.name="MultipleSubgraphError"}static get unminifiable_name(){return"MultipleSubgraphError"}},ai=class extends Ce{constructor(e,t){super(e,t),this.name="UnreachableNodeError"}static get unminifiable_name(){return"UnreachableNodeError"}},qh=class extends Ce{constructor(e,t){super(e,t),this.name="RemoteException"}static get unminifiable_name(){return"RemoteException"}},Lr=class extends Ce{constructor(e,t){super(e,t),this.name="StateGraphInputError",this.message="Invalid StateGraph input. Make sure to pass a valid StateDefinition, Annotation.Root, or Zod schema."}static get unminifiable_name(){return"StateGraphInputError"}},zh=()=>(globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")]===void 0&&(globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")]=new Set),globalThis[Symbol.for("LG_CHECKPOINT_SEEN_NS_SET")]);var ci=0,Ur=0;function Hr(e){let t=Date.now();return t<=ci?(Ur+=1,Ur>=1e4&&(Ur=0,t=ci+1)):Ur=0,ci=t,_a({clockseq:e,msecs:t,nsecs:Ur})}function ze(e,t){let r=t.replace(/-/g,"").match(/.{2}/g).map(n=>parseInt(n,16));return Pr(e,new Uint8Array(r))}var Br="__pregel_tasks",li="__error__",Gt="__scheduled__",ui="__interrupt__",hi="__resume__",ar=class{lg_name="DeltaSnapshot";value;constructor(e){this.value=e}};function pi(e){return e!=null&&typeof e=="object"&&e.lg_name==="DeltaSnapshot"}var kc="[...]",Jh="[Circular]",Fn=[],cr=[];function Yh(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Ec(e,t,r,n){typeof n>"u"&&(n=Yh()),mi(e,"",0,[],void 0,0,n);var s;try{cr.length===0?s=JSON.stringify(e,t,r):s=JSON.stringify(e,Xh(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Fn.length!==0;){var i=Fn.pop();i.length===4?Object.defineProperty(i[0],i[1],i[3]):i[0][i[1]]=i[2]}}return s}function fi(e,t,r,n){var s=Object.getOwnPropertyDescriptor(n,r);s.get!==void 0?s.configurable?(Object.defineProperty(n,r,{value:e}),Fn.push([n,r,t,s])):cr.push([t,r,e]):(n[r]=e,Fn.push([n,r,t]))}function mi(e,t,r,n,s,i,o){i+=1;var a;if(typeof e=="object"&&e!==null){for(a=0;a<n.length;a++)if(n[a]===e){fi(Jh,e,t,s);return}if(typeof o.depthLimit<"u"&&i>o.depthLimit){fi(kc,e,t,s);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){fi(kc,e,t,s);return}if(n.push(e),Array.isArray(e))for(a=0;a<e.length;a++)mi(e[a],a,a,n,e,i,o);else{var c=Object.keys(e);for(a=0;a<c.length;a++){var l=c[a];mi(e[l],l,a,n,e,i,o)}}n.pop()}}function Xh(e){return e=typeof e<"u"?e:function(t,r){return r},function(t,r){if(cr.length>0)for(var n=0;n<cr.length;n++){var s=cr[n];if(s[1]===t&&s[0]===r){r=s[2],cr.splice(n,1);break}}return e.call(this,t,r)}}var Cc=[];var xc=O({});var Tc=O({});var Ic=O({BaseChatMessageHistory:()=>di,BaseListChatMessageHistory:()=>Ln,InMemoryChatMessageHistory:()=>Qh}),di=class extends Ae{async addMessages(e){for(let t of e)await this.addMessage(t)}},Ln=class extends Ae{addUserMessage(e){return this.addMessage(new _t(e))}addAIMessage(e){return this.addMessage(new Q(e))}async addMessages(e){for(let t of e)await this.addMessage(t)}clear(){throw new Error("Not implemented.")}},Qh=class extends Ln{lc_namespace=["langchain","stores","message","in_memory"];messages=[];constructor(e){super(...arguments),this.messages=e??[]}async getMessages(){return this.messages}async addMessage(e){this.messages.push(e)}async clear(){this.messages=[]}};var Se=class{pageContent;metadata;id;constructor(e){this.pageContent=e.pageContent!==void 0?e.pageContent.toString():"",this.metadata=e.metadata??{},this.id=e.id}};var gi=class extends G{lc_namespace=["langchain_core","documents","transformers"];invoke(e,t){return this.transformDocuments(e)}},Ac=class extends gi{async transformDocuments(e){let t=[];for(let r of e){let n=await this._transformDocument(r);t.push(n)}return t}};var Oc=O({BaseDocumentTransformer:()=>gi,Document:()=>Se,MappingDocumentTransformer:()=>Ac});var Nc=O({BaseDocumentLoader:()=>_i}),_i=class{};var Pc=O({LangSmithLoader:()=>Zh}),Zh=class extends _i{datasetId;datasetName;exampleIds;asOf;splits;inlineS3Urls;offset;limit;metadata;filter;contentKey;formatContent;client;constructor(e){if(super(),e.client&&e.clientConfig)throw new Error("client and clientConfig cannot both be provided.");this.client=e.client??new va(e?.clientConfig),this.contentKey=e.contentKey?e.contentKey.split("."):[],this.formatContent=e.formatContent??ep,this.datasetId=e.datasetId,this.datasetName=e.datasetName,this.exampleIds=e.exampleIds,this.asOf=e.asOf,this.splits=e.splits,this.inlineS3Urls=e.inlineS3Urls,this.offset=e.offset,this.limit=e.limit,this.metadata=e.metadata,this.filter=e.filter}async load(){let e=[];for await(let t of this.client.listExamples({datasetId:this.datasetId,datasetName:this.datasetName,exampleIds:this.exampleIds,asOf:this.asOf,splits:this.splits,inlineS3Urls:this.inlineS3Urls,offset:this.offset,limit:this.limit,metadata:this.metadata,filter:this.filter})){let r=t.inputs;for(let i of this.contentKey)r=r[i];let n=this.formatContent(r),s=t;["created_at","modified_at"].forEach(i=>{i in s&&typeof s[i]=="object"&&(s[i]=s[i].toString())}),e.push({pageContent:n,metadata:s})}return e}};function ep(e){if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}var lr=class extends Ae{lc_namespace=["langchain_core","example_selectors","base"]};var yi=class{async getPromptAsync(e,t){return this.getPrompt(e).partial(t?.partialVariables??{})}},Rc=class extends yi{defaultPrompt;conditionals;constructor(e,t=[]){super(),this.defaultPrompt=e,this.conditionals=t}getPrompt(e){for(let[t,r]of this.conditionals)if(t(e))return r;return this.defaultPrompt}};function Mc(e){return e._modelType()==="base_llm"}function jc(e){return e._modelType()==="base_chat_model"}function Dc(e){return e.split(/\n| /).length}var $c=class Vc extends lr{examples=[];examplePrompt;getTextLength=Dc;maxLength=2048;exampleTextLengths=[];constructor(t){super(t),this.examplePrompt=t.examplePrompt,this.maxLength=t.maxLength??2048,this.getTextLength=t.getTextLength??Dc}async addExample(t){this.examples.push(t);let r=await this.examplePrompt.format(t);this.exampleTextLengths.push(this.getTextLength(r))}async calculateExampleTextLengths(t,r){if(t.length>0)return t;let{examples:n,examplePrompt:s}=r;return(await Promise.all(n.map(i=>s.format(i)))).map(i=>this.getTextLength(i))}async selectExamples(t){let r=Object.values(t).join(" "),n=this.maxLength-this.getTextLength(r),s=0,i=[];for(;n>0&&s<this.examples.length;){let o=n-this.exampleTextLengths[s];if(o<0)break;i.push(this.examples[s]),n=o,s+=1}return i}static async fromExamples(t,r){let n=new Vc(r);return await Promise.all(t.map(s=>n.addExample(s))),n}};function wi(e){return Object.keys(e).sort().map(t=>e[t])}var Fc=class Lc extends lr{vectorStoreRetriever;exampleKeys;inputKeys;constructor(t){if(super(t),this.exampleKeys=t.exampleKeys,this.inputKeys=t.inputKeys,t.vectorStore!==void 0)this.vectorStoreRetriever=t.vectorStore.asRetriever({k:t.k??4,filter:t.filter});else if(t.vectorStoreRetriever)this.vectorStoreRetriever=t.vectorStoreRetriever;else throw new Error('You must specify one of "vectorStore" and "vectorStoreRetriever".')}async addExample(t){let r=wi((this.inputKeys??Object.keys(t)).reduce((n,s)=>({...n,[s]:t[s]}),{})).join(" ");await this.vectorStoreRetriever.addDocuments([new Se({pageContent:r,metadata:t})])}async selectExamples(t){let r=wi((this.inputKeys??Object.keys(t)).reduce((s,i)=>({...s,[i]:t[i]}),{})).join(" "),n=(await this.vectorStoreRetriever.invoke(r)).map(s=>s.metadata);return this.exampleKeys?n.map(s=>this.exampleKeys.reduce((i,o)=>({...i,[o]:s[o]}),{})):n}static async fromExamples(t,r,n,s={}){let i=s.inputKeys??null,o=t.map(c=>wi(i?i.reduce((l,u)=>({...l,[u]:c[u]}),{}):c).join(" ")),a=await n.fromTexts(o,t,r,s);return new Lc({vectorStore:a,k:s.k??4,exampleKeys:s.exampleKeys,inputKeys:s.inputKeys})}};var Uc=O({BaseExampleSelector:()=>lr,BasePromptSelector:()=>yi,ConditionalPromptSelector:()=>Rc,LengthBasedExampleSelector:()=>$c,SemanticSimilarityExampleSelector:()=>Fc,isChatModel:()=>jc,isLLM:()=>Mc});var Gr="10f90ea3-90a4-4962-bf75-83a0f3c1c62a",Hc=class extends Ae{lc_namespace=["langchain","recordmanagers"]};var bi=class{uid;hash_;contentHash;metadataHash;pageContent;metadata;keyEncoder=ja;constructor(e){this.uid=e.uid,this.pageContent=e.pageContent,this.metadata=e.metadata}makeDefaultKeyEncoder(e){this.keyEncoder=e}calculateHashes(){let e=["hash_","content_hash","metadata_hash"];for(let r of e)if(r in this.metadata)throw new Error(`Metadata cannot contain key ${r} as it is reserved for internal use. Restricted keys: [${e.join(", ")}]`);let t=this._hashStringToUUID(this.pageContent);try{let r=this._hashNestedDictToUUID(this.metadata);this.contentHash=t,this.metadataHash=r}catch(r){throw new Error(`Failed to hash metadata: ${r}. Please use a dict that can be serialized using json.`)}this.hash_=this._hashStringToUUID(this.contentHash+this.metadataHash),this.uid||(this.uid=this.hash_)}toDocument(){return new Se({pageContent:this.pageContent,metadata:this.metadata})}static fromDocument(e,t){let r=new this({pageContent:e.pageContent,metadata:e.metadata,uid:t||e.uid});return r.calculateHashes(),r}_hashStringToUUID(e){return Pr(this.keyEncoder(e),Gr)}_hashNestedDictToUUID(e){let t=JSON.stringify(e,Object.keys(e).sort());return Pr(this.keyEncoder(t),Gr)}};function vi(e,t){let r=[],n=[];return t.forEach(s=>{n.push(s),n.length>=e&&(r.push(n),n=[])}),n.length>0&&r.push(n),r}function Si(e){let t=new Set,r=[];for(let n of e){if(!n.hash_)throw new Error("Hashed document does not have a hash");t.has(n.hash_)||(t.add(n.hash_),r.push(n))}return r}function ki(e){if(e===null)return t=>null;if(typeof e=="string")return t=>t.metadata[e];if(typeof e=="function")return e;throw new Error(`sourceIdKey should be null, a string or a function, got ${typeof e}`)}var Ei=e=>"load"in e&&typeof e.load=="function"&&"loadAndSplit"in e&&typeof e.loadAndSplit=="function";async function Bc(e){let{docsSource:t,recordManager:r,vectorStore:n,options:s}=e,{batchSize:i=100,cleanup:o,sourceIdKey:a,cleanupBatchSize:c=1e3,forceUpdate:l=!1}=s??{};if(o==="incremental"&&!a)throw new Error("sourceIdKey is required when cleanup mode is incremental. Please provide through 'options.sourceIdKey'.");let u=Ei(t)?await t.load():t,h=ki(a??null),p=await r.getTime(),f=0,m=0,d=0,_=0,g=vi(i??100,u);for(let y of g){let S=Si(y.map(x=>bi.fromDocument(x))),w=S.map(x=>h(x));o==="incremental"&&S.forEach((x,F)=>{if(w[F]===null)throw new Error("sourceIdKey must be provided when cleanup is incremental")});let C=await r.exists(S.map(x=>x.uid)),T=[],k=[],b=[],I=new Set;if(S.forEach((x,F)=>{if(C[F])if(l)I.add(x.uid);else{b.push(x.uid);return}T.push(x.uid),k.push(x.toDocument())}),b.length>0&&(await r.update(b,{timeAtLeast:p}),_+=b.length),k.length>0&&(await n.addDocuments(k,{ids:T}),f+=k.length-I.size,d+=I.size),await r.update(S.map(x=>x.uid),{timeAtLeast:p,groupIds:w}),o==="incremental"){w.forEach(F=>{if(!F)throw new Error("Source id cannot be null")});let x=await r.listKeys({before:p,groupIds:w});x.length>0&&(await n.delete({ids:x}),await r.deleteKeys(x),m+=x.length)}}if(o==="full"){let y=await r.listKeys({before:p,limit:c});for(;y.length>0;)await n.delete({ids:y}),await r.deleteKeys(y),m+=y.length,y=await r.listKeys({before:p,limit:c})}return{numAdded:f,numDeleted:m,numUpdated:d,numSkipped:_}}var Gc=O({RecordManager:()=>Hc,UUIDV5_NAMESPACE:()=>Gr,_HashedDocument:()=>bi,_batch:()=>vi,_deduplicateInOrder:()=>Si,_getSourceIdAssigner:()=>ki,_isBaseDocumentLoader:()=>Ei,index:()=>Bc});var Wc=O({});var Kc=O({});var qc=O({BaseMemory:()=>tp,getInputValue:()=>rp,getOutputValue:()=>np,getPromptInputKey:()=>sp}),tp=class{},zc=(e,t)=>{if(t!==void 0)return e[t];let r=Object.keys(e);if(r.length===1)return e[r[0]]},rp=(e,t)=>{let r=zc(e,t);if(!r){let n=Object.keys(e);throw new Error(`input values have ${n.length} keys, you must specify an input key or pass only 1 key as input`)}return r},np=(e,t)=>{let r=zc(e,t);if(!r&&r!==""){let n=Object.keys(e);throw new Error(`output values have ${n.length} keys, you must specify an output key or pass only 1 key as output`)}return r};function sp(e,t){let r=Object.keys(e).filter(n=>!t.includes(n)&&n!=="stop");if(r.length!==1)throw new Error(`One input key expected, but got ${r.length}`);return r[0]}var Ci=class extends ti{static lc_name(){return"OutputFunctionsParser"}lc_namespace=["langchain","output_parsers","openai_functions"];lc_serializable=!0;argsOnly=!0;constructor(e){super(),this.argsOnly=e?.argsOnly??this.argsOnly}async parseResult(e){if("message"in e[0]){let t=e[0].message.additional_kwargs.function_call;if(!t)throw new Error(`No function_call in message ${JSON.stringify(e)}`);if(!t.arguments)throw new Error(`No arguments in function_call ${JSON.stringify(e)}`);return this.argsOnly?t.arguments:JSON.stringify(t)}else throw new Error(`No message in generations ${JSON.stringify(e)}`)}},xi=class extends sc{static lc_name(){return"JsonOutputFunctionsParser"}lc_namespace=["langchain","output_parsers","openai_functions"];lc_serializable=!0;outputParser;argsOnly=!0;constructor(e){super(e),this.argsOnly=e?.argsOnly??this.argsOnly,this.outputParser=new Ci(e)}_diff(e,t){if(t)return La(e??{},t)}async parsePartialResult(e){let t=e[0];if(!t.message)return;let{message:r}=t,n=r.additional_kwargs.function_call;if(n)return this.argsOnly?qs(n.arguments):{...n,arguments:qs(n.arguments)}}async parseResult(e){let t=await this.outputParser.parseResult(e);if(!t)throw new Error(`No result from "OutputFunctionsParser" ${JSON.stringify(e)}`);return this.parse(t)}async parse(e){let t=JSON.parse(e);return this.argsOnly||(t.arguments=JSON.parse(t.arguments)),t}getFormatInstructions(){return""}},Jc=class extends ti{static lc_name(){return"JsonKeyOutputFunctionsParser"}lc_namespace=["langchain","output_parsers","openai_functions"];lc_serializable=!0;outputParser=new xi;attrName;get lc_aliases(){return{attrName:"key_name"}}constructor(e){super(e),this.attrName=e.attrName}async parseResult(e){return(await this.outputParser.parseResult(e))[this.attrName]}};var Yc=O({JsonKeyOutputFunctionsParser:()=>Jc,JsonOutputFunctionsParser:()=>xi,OutputFunctionsParser:()=>Ci});var Je=class extends G{lc_serializable=!0;lc_namespace=["langchain_core","prompts",this._getPromptType()];get lc_attributes(){return{partialVariables:void 0}}inputVariables;outputParser;partialVariables;metadata;tags;constructor(e){super(e);let{inputVariables:t}=e;if(t.includes("stop"))throw new Error("Cannot have an input variable named 'stop', as it is used internally, please rename.");Object.assign(this,e)}async mergePartialAndUserVariables(e){let t=this.partialVariables??{},r={};for(let[n,s]of Object.entries(t))typeof s=="string"?r[n]=s:r[n]=await s();return{...r,...e}}async invoke(e,t){let r={...this.metadata,...t?.metadata},n=[...this.tags??[],...t?.tags??[]];return this._callWithConfig(s=>this.formatPromptValue(s),e,{...t,tags:n,metadata:r,runType:"prompt"})}};var at=class extends Je{async formatPromptValue(e){return new Wa(await this.format(e))}};var ip=Object.prototype.toString,hr=Array.isArray||function(t){return ip.call(t)==="[object Array]"};function Ii(e){return typeof e=="function"}function op(e){return hr(e)?"array":typeof e}function Ti(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Xc(e,t){return e!=null&&typeof e=="object"&&t in e}function ap(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}var cp=RegExp.prototype.test;function lp(e,t){return cp.call(e,t)}var up=/\S/;function hp(e){return!lp(up,e)}var pp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};function fp(e){return String(e).replace(/[&<>"'`=\/]/g,function(r){return pp[r]})}var mp=/\s*/,dp=/\s+/,Qc=/\s*=/,gp=/\s*\}/,_p=/#|\^|\/|>|\{|&|=|!/;function yp(e,t){if(!e)return[];var r=!1,n=[],s=[],i=[],o=!1,a=!1,c="",l=0;function u(){if(o&&!a)for(;i.length;)delete s[i.pop()];else i=[];o=!1,a=!1}var h,p,f;function m(b){if(typeof b=="string"&&(b=b.split(dp,2)),!hr(b)||b.length!==2)throw new Error("Invalid tags: "+b);h=new RegExp(Ti(b[0])+"\\s*"),p=new RegExp("\\s*"+Ti(b[1])),f=new RegExp("\\s*"+Ti("}"+b[1]))}m(t||xe.tags);for(var d=new Kr(e),_,g,y,S,w,C;!d.eos();){if(_=d.pos,y=d.scanUntil(h),y)for(var T=0,k=y.length;T<k;++T)S=y.charAt(T),hp(S)?(i.push(s.length),c+=S):(a=!0,r=!0,c+=" "),s.push(["text",S,_,_+1]),_+=1,S===`
@@ -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"./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)
2
+ import k from"./3SCRMD7A.js";import j from"./YT5ON4CK.js";import i from"./7VTDDO2O.js";import h from"./SQCDEL42.js";import g from"./QKGHH3FS.js";import"./Y5VUMGKH.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)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{o as e}from"./K3GAZFRI.js";var l=["item","group","user"],c=e.object({entityType:e.enum(l),searchTerm:e.string().trim().min(1).optional().describe("Suggested search text from the unresolved name or title. Omit when no search text is known.")}),u=c.extend({kind:e.literal("portal-entity-selection"),portalContext:e.object({portalUrl:e.string().min(1),username:e.string().min(1)}).optional()}),a=e.string().trim().min(1),s=e.string().trim().min(1),m=e.discriminatedUnion("entityType",[e.object({entityType:e.literal("item"),id:s,label:a}),e.object({entityType:e.literal("group"),id:s,label:a}),e.object({entityType:e.literal("user"),id:s.optional(),label:a,username:e.string().trim().min(1)})]);function f(i){return l.filter(t=>i?.[t]!==!1)}function b(i){let t=u.safeParse(i);return t.success?t.data:void 0}function g(i){let{entity:t,entityType:r}=i,n=r==="user"?{entityType:r,id:t.id||void 0,label:t.fullName||t.username,username:t.username}:{entityType:r,id:t.id,label:t.title||t.id},o=m.safeParse(n);return o.success?o.data:void 0}function T(i,t){if(typeof i=="string")try{let r=JSON.parse(i),n=m.safeParse(r);return n.success&&n.data.entityType===t?n.data:void 0}catch{return}}export{c as a,m as b,f as c,b as d,g as e,T as f};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import c from"./AJ5H2JMU.js";import b from"./5SKCVK2P.js";import a from"./C5FTQSU6.js";import"./PXG2SRSN.js";import"./VDXESPJK.js";import"./ULGME5RT.js";import"./DAAON2UO.js";import"./57MT7FOI.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(([,,a])=>{return a},a,b,c)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import b from"./C5IKEISI.js";import{a}from"./H7DF6TTK.js";export default $arcgis.t(([m,{b:n}])=>{async function f(r,o,p={}){let t=await n({url:`${a(r)}community/groups`,portal:r,params:o,options:p});return{...t,results:t.results.map(u=>{let s=m.fromJSON(u);return s.portal=r,s})}}async function l(r,o={}){return await r.queryGroups(o)}return{a:f,b:l}},"portal/PortalGroup",b)