@esri/solutions-components 1.2.0-next.190 → 1.2.0-next.192

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 (121) hide show
  1. package/dist/cdn/2FB7PLHA.js +2 -0
  2. package/dist/cdn/{2Z4TOYVC.js → 35BKTK23.js} +1 -1
  3. package/dist/cdn/3IXJ77QG.js +2 -0
  4. package/dist/cdn/4PJLBC3H.js +2 -0
  5. package/dist/cdn/5DYEGOFQ.js +2 -0
  6. package/dist/cdn/{BHSNNVIL.js → 5YSQ2CW2.js} +1 -1
  7. package/dist/cdn/{V25NUVVQ.js → 6MYF74WP.js} +1 -1
  8. package/dist/cdn/6OWU7VAP.js +2 -0
  9. package/dist/cdn/AIU3MGAJ.js +2 -0
  10. package/dist/cdn/AXJNTXWG.js +2 -0
  11. package/dist/cdn/BFRGKEST.js +2 -0
  12. package/dist/cdn/{OUH4HVG4.js → BTHN6PO3.js} +21 -21
  13. package/dist/cdn/CA5SSBGK.js +2 -0
  14. package/dist/cdn/DMQY2YSV.js +2 -0
  15. package/dist/cdn/DZEATYCC.js +2 -0
  16. package/dist/cdn/FCTLSKQC.js +2 -0
  17. package/dist/cdn/{HEW273HR.js → FKEZD3IR.js} +3 -3
  18. package/dist/cdn/GNHKPEWB.js +2 -0
  19. package/dist/cdn/HRR3S4YS.js +2 -0
  20. package/dist/cdn/HTILYSMI.js +2 -0
  21. package/dist/cdn/K2TGYZ23.js +2 -0
  22. package/dist/cdn/{W4DGTEPL.js → KMFPTAQU.js} +1 -1
  23. package/dist/cdn/LOQNTCQ5.js +2 -0
  24. package/dist/cdn/LT22II6J.js +2 -0
  25. package/dist/cdn/OSY6VKW4.js +2 -0
  26. package/dist/cdn/{Y4QWAYNX.js → PK5GAZJJ.js} +1 -1
  27. package/dist/cdn/PYFPZPMP.js +2 -0
  28. package/dist/cdn/QCI2IO23.js +2 -0
  29. package/dist/cdn/{KEWRBJOT.js → QU7HKK7N.js} +3 -3
  30. package/dist/cdn/U6K37QQX.js +2 -0
  31. package/dist/cdn/V562ZRP5.js +2 -0
  32. package/dist/cdn/VFSFRIPI.js +2 -0
  33. package/dist/cdn/WT64QMSP.js +2 -0
  34. package/dist/cdn/XCOHDOZB.js +2 -0
  35. package/dist/cdn/{AS6FGEVT.js → XGT7USWV.js} +1 -1
  36. package/dist/cdn/XVCTCPQP.js +2 -0
  37. package/dist/cdn/YBCBDSHJ.js +2 -0
  38. package/dist/cdn/YN2Q4YSJ.js +2 -0
  39. package/dist/cdn/Z7S7SUZV.js +2 -0
  40. package/dist/cdn/ZBVU5UTY.js +2 -0
  41. package/dist/cdn/ZEIBUDIU.js +2 -0
  42. package/dist/cdn/ZLVZRRWC.js +2 -0
  43. package/dist/cdn/index.js +1 -1
  44. package/dist/chunks/cardFetchingUtils.js +13 -13
  45. package/dist/chunks/interfaces.js +155 -151
  46. package/dist/chunks/solution-deploy-dialog.js +9 -10
  47. package/dist/chunks/solutions-deploy-app-nav.js +23 -24
  48. package/dist/components/arcgis-solutions-assistant/customElement.js +15 -15
  49. package/dist/components/create-feature/customElement.d.ts +2 -0
  50. package/dist/components/create-feature/customElement.js +6 -7
  51. package/dist/components/crowdsource-reporter/customElement.js +3 -3
  52. package/dist/components/layer-list/customElement.js +32 -32
  53. package/dist/components/layer-table/customElement.js +1 -1
  54. package/dist/components/solution-configure-titles/customElement.js +4 -5
  55. package/dist/components/solution-delete-dialog/customElement.js +6 -7
  56. package/dist/components/solution-deploy-dialog/customElement.js +3 -4
  57. package/dist/components/solution-deployed-card/customElement.js +2 -3
  58. package/dist/components/solution-deployed-card-panel/customElement.js +10 -11
  59. package/dist/components/solution-details-card/customElement.js +1 -2
  60. package/dist/components/solution-details-panel/customElement.js +43 -42
  61. package/dist/components/solution-resource-card/customElement.js +6 -7
  62. package/dist/components/solution-snapshot-gallery/customElement.js +7 -8
  63. package/dist/components/solution-social-share/customElement.js +2 -3
  64. package/dist/components/solution-user-avatar/customElement.js +7 -8
  65. package/dist/components/solutions-all-panel/customElement.js +17 -18
  66. package/dist/components/solutions-all-shell/customElement.js +64 -28
  67. package/dist/components/solutions-all-shell/index.js +1 -0
  68. package/dist/components/solutions-deploy-app/customElement.js +59 -23
  69. package/dist/components/solutions-deploy-app-nav/customElement.js +2 -3
  70. package/dist/components/solutions-deploy-app-nav/index.js +3 -3
  71. package/dist/components/solutions-deployed-panel/customElement.js +11 -12
  72. package/dist/components/solutions-deployed-shell/customElement.js +11 -11
  73. package/dist/components/solutions-filter-panel/customElement.js +68 -65
  74. package/dist/components/solutions-resources-shell/customElement.js +47 -10
  75. package/dist/components/solutions-searchsort-toolbar/customElement.js +6 -7
  76. package/dist/docs/api.json +1 -1
  77. package/dist/docs/docs.json +1 -1
  78. package/dist/docs/vscode.html-custom-data.json +1 -1
  79. package/dist/docs/web-types.json +1 -1
  80. package/dist/loader.js +1 -1
  81. package/dist/solutions-components_commit.txt +8 -5
  82. package/dist/types/lumina.d.ts +1 -1
  83. package/dist/types/preact.d.ts +1 -1
  84. package/dist/types/react.d.ts +1 -1
  85. package/dist/types/stencil.d.ts +1 -1
  86. package/package.json +1 -1
  87. package/dist/cdn/3A7PC2RZ.js +0 -2
  88. package/dist/cdn/3HWKU2CT.js +0 -2
  89. package/dist/cdn/4CPDEFIT.js +0 -2
  90. package/dist/cdn/4N5LEYZP.js +0 -2
  91. package/dist/cdn/7BDPZCCN.js +0 -2
  92. package/dist/cdn/7M3GJY6J.js +0 -2
  93. package/dist/cdn/BEC6A65P.js +0 -2
  94. package/dist/cdn/BT66JT22.js +0 -2
  95. package/dist/cdn/C7DWPTJL.js +0 -2
  96. package/dist/cdn/CN4TSLTZ.js +0 -2
  97. package/dist/cdn/DOFNBU4Q.js +0 -2
  98. package/dist/cdn/DSH7QIEF.js +0 -2
  99. package/dist/cdn/FP5UBHCW.js +0 -2
  100. package/dist/cdn/FPW3BDJT.js +0 -2
  101. package/dist/cdn/FWFL23CM.js +0 -2
  102. package/dist/cdn/I3ERNQTX.js +0 -2
  103. package/dist/cdn/LN36O3EB.js +0 -2
  104. package/dist/cdn/LPPOTZKI.js +0 -2
  105. package/dist/cdn/MVNKOMSZ.js +0 -2
  106. package/dist/cdn/OQVULF2Q.js +0 -2
  107. package/dist/cdn/PFQDRDKQ.js +0 -2
  108. package/dist/cdn/PJ2IZ77K.js +0 -2
  109. package/dist/cdn/QPEQNTE2.js +0 -2
  110. package/dist/cdn/R6QJKOAM.js +0 -2
  111. package/dist/cdn/RG6FVRCW.js +0 -2
  112. package/dist/cdn/RZKHWRGX.js +0 -2
  113. package/dist/cdn/TA7XOCI6.js +0 -2
  114. package/dist/cdn/U3MPHGGT.js +0 -2
  115. package/dist/cdn/VFROSB3U.js +0 -2
  116. package/dist/cdn/VHA56S7W.js +0 -2
  117. package/dist/cdn/W4773WDH.js +0 -2
  118. package/dist/cdn/WI7VFPQ3.js +0 -2
  119. package/dist/cdn/Y2S3AB43.js +0 -2
  120. package/dist/cdn/ZVLL5DZC.js +0 -2
  121. package/dist/chunks/deployAppContexts.js +0 -9
@@ -1,8 +1,8 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
2
- import a from"./MVNKOMSZ.js";import{b as _e}from"./W4773WDH.js";import{b as we}from"./77CU4WA2.js";import"./T4PIUXJ7.js";import{a as be}from"./6D3THEX6.js";import"./5IZMQFRP.js";import"./FOQPGXXA.js";import"./ED6SUP22.js";import"./E6P6PYNW.js";import"./IKKBLHLZ.js";import"./CUA2IUXX.js";import"./4UZDZNJD.js";import"./KOTG6W5Z.js";import"./6SC7YR5Y.js";import"./Z6NOHRUL.js";import"./GVM4XYEI.js";import"./NGDVSE4Z.js";import"./BTNJZZQQ.js";import"./ZYQ4P2ON.js";import"./5MKH4QDV.js";import"./3GWWHA4S.js";import"./3YYHZQJB.js";import"./JEJ23R3P.js";import"./TONS7KZJ.js";import"./Q62UEPOL.js";import"./44A5XEM4.js";import{b as xe}from"./RFGSSUZF.js";import{G,H as me,J as W,L as X,h as pe,i as m,k as ue,l as j,m as T,r as de,w as ge,x as ke,y as fe}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([{I:ye,q:ve,r:Q}])=>{var L=class extends fe{constructor(e){if(super(e),this.it=j,e.type!==ge.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===j||e==null)return this._t=void 0,this.it=e;if(e===ue)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};L.directiveName="unsafeHTML",L.resultType=1;var J=ke(L);var Fe=pe`:host{display:block;height:100%}.display-flex-row{display:flex;flex-direction:row}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-foreground-3);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-background);border-radius:10px;padding:10px}.chat-panel{--calcite-dialog-header-background-color: var(--calcite-color-brand);--calcite-dialog-header-action-background-color: var(--calcite-color-brand);--calcite-dialog-heading-text-color: var(--calcite-color-background);--calcite-dialog-header-action-text-color: var(--calcite-color-background);--calcite-dialog-header-action-text-color-press: var(--calcite-color-background);--calcite-dialog-min-size-y: 90vh;--calcite-dialog-max-size-y: 90vh}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-background, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-foreground-2);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-foreground-3);--calcite-card-border-color: var(--calcite-color-foreground-3);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-foreground-3);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-foreground-3);--calcite-card-border-color: var(--calcite-color-foreground-3)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-foreground-3)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-background)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;function se(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var A=se();function Ce(i){A=i}var R={exec:()=>null};function d(i,e=""){let t=typeof i=="string"?i:i.source,n={replace:(s,a)=>{let r=typeof a=="string"?a:a.source;return r=r.replace(b.caret,"$1"),t=t.replace(s,r),n},getRegex:()=>new RegExp(t,e)};return n}var Oe=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),b={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,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,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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}>`)},Ze=/^(?:[ \t]*(?:\n|$))+/,He=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,je=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,B=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ge=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ne=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ze=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Le=d(ze).replace(/bull/g,ne).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}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),We=d(ze).replace(/bull/g,ne).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}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ie=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Xe=/^[^\n]+/,re=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Je=d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",re).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ke=d(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ne).getRegex(),Z="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",ae=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ve=d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ae).replace("tag",Z).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Pe=d(ie).replace("hr",B).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z).getRegex(),Ye=d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Pe).getRegex(),oe={blockquote:Ye,code:He,def:Je,fences:je,heading:Ge,hr:B,html:Ve,lheading:Le,list:Ke,newline:Ze,paragraph:Pe,table:R,text:Xe},Se=d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",B).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z).getRegex(),et={...oe,lheading:We,table:Se,paragraph:d(ie).replace("hr",B).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Se).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z).getRegex()},tt={...oe,html:d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae).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:R,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:d(ie).replace("hr",B).replace("heading",` *#{1,6} *[^
3
- ]`).replace("lheading",Le).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},st=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,nt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qe=/^( {2,}|\\)\n(?!\s*$)/,it=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,H=/[\p{P}\p{S}]/u,le=/[\s\p{P}\p{S}]/u,Ee=/[^\s\p{P}\p{S}]/u,rt=d(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,le).getRegex(),Be=/(?!~)[\p{P}\p{S}]/u,at=/(?!~)[\s\p{P}\p{S}]/u,ot=/(?:[^\s\p{P}\p{S}]|~)/u,Me=/(?![*_])[\p{P}\p{S}]/u,lt=/(?![*_])[\s\p{P}\p{S}]/u,ct=/(?:[^\s\p{P}\p{S}]|[*_])/u,ht=d(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Oe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ne=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,pt=d(Ne,"u").replace(/punct/g,H).getRegex(),ut=d(Ne,"u").replace(/punct/g,Be).getRegex(),Qe="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",dt=d(Qe,"gu").replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,le).replace(/punct/g,H).getRegex(),gt=d(Qe,"gu").replace(/notPunctSpace/g,ot).replace(/punctSpace/g,at).replace(/punct/g,Be).getRegex(),kt=d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,le).replace(/punct/g,H).getRegex(),ft=d(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Me).getRegex(),mt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",xt=d(mt,"gu").replace(/notPunctSpace/g,ct).replace(/punctSpace/g,lt).replace(/punct/g,Me).getRegex(),bt=d(/\\(punct)/,"gu").replace(/punct/g,H).getRegex(),wt=d(/^<(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(),_t=d(ae).replace("(?:-->|$)","-->").getRegex(),vt=d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_t).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),U=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,yt=d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",U).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),De=d(/^!?\[(label)\]\[(ref)\]/).replace("label",U).replace("ref",re).getRegex(),Ue=d(/^!?\[(ref)\](?:\[\])?/).replace("ref",re).getRegex(),St=d("reflink|nolink(?!\\()","g").replace("reflink",De).replace("nolink",Ue).getRegex(),$e=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ce={_backpedal:R,anyPunctuation:bt,autolink:wt,blockSkip:ht,br:qe,code:nt,del:R,delLDelim:R,delRDelim:R,emStrongLDelim:pt,emStrongRDelimAst:dt,emStrongRDelimUnd:kt,escape:st,link:yt,nolink:Ue,punctuation:rt,reflink:De,reflinkSearch:St,tag:vt,text:it,url:R},$t={...ce,link:d(/^!?\[(label)\]\((.*?)\)/).replace("label",U).getRegex(),reflink:d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",U).getRegex()},K={...ce,emStrongRDelimAst:gt,emStrongLDelim:ut,delLDelim:ft,delRDelim:xt,url:d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",$e).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",$e).getRegex()},Tt={...K,br:d(qe).replace("{2,}","*").getRegex(),text:d(K.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},D={normal:oe,gfm:et,pedantic:tt},P={normal:ce,gfm:K,breaks:Tt,pedantic:$t},Rt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Te=i=>Rt[i];function S(i,e){if(e){if(b.escapeTest.test(i))return i.replace(b.escapeReplace,Te)}else if(b.escapeTestNoEncode.test(i))return i.replace(b.escapeReplaceNoEncode,Te);return i}function Re(i){try{i=encodeURI(i).replace(b.percentDecode,"%")}catch{return null}return i}function Ie(i,e){let t=i.replace(b.findPipe,(a,r,l)=>{let o=!1,h=r;for(;--h>=0&&l[h]==="\\";)o=!o;return o?"|":" |"}),n=t.split(b.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(b.slashPipe,"|");return n}function q(i,e,t){let n=i.length;if(n===0)return"";let s=0;for(;s<n&&i.charAt(n-s-1)===e;)s++;return i.slice(0,n-s)}function It(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<i.length;n++)if(i[n]==="\\")n++;else if(i[n]===e[0])t++;else if(i[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function At(i,e=0){let t=e,n="";for(let s of i)if(s===" "){let a=4-t%4;n+=" ".repeat(a),t+=a}else n+=s,t++;return n}function Ae(i,e,t,n,s){let a=e.href,r=e.title||null,l=i[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;let o={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:a,title:r,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,o}function Ct(i,e,t){let n=i.match(t.other.indentCodeCompensation);if(n===null)return e;let s=n[1];return e.split(`
2
+ import a from"./XVCTCPQP.js";import{b as we}from"./77CU4WA2.js";import"./T4PIUXJ7.js";import{a as be}from"./6D3THEX6.js";import"./5IZMQFRP.js";import"./FOQPGXXA.js";import"./ED6SUP22.js";import"./E6P6PYNW.js";import"./IKKBLHLZ.js";import"./CUA2IUXX.js";import"./4UZDZNJD.js";import"./KOTG6W5Z.js";import"./6SC7YR5Y.js";import"./Z6NOHRUL.js";import"./GVM4XYEI.js";import"./NGDVSE4Z.js";import"./BTNJZZQQ.js";import"./ZYQ4P2ON.js";import"./5MKH4QDV.js";import"./3GWWHA4S.js";import"./3YYHZQJB.js";import"./JEJ23R3P.js";import"./TONS7KZJ.js";import"./Q62UEPOL.js";import"./44A5XEM4.js";import{b as me}from"./RFGSSUZF.js";import{G,H as xe,J as W,L as X,h as pe,i as x,k as ue,l as j,m as T,r as de,w as ge,x as ke,y as fe}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([{K:ye,b:_e,s:ve,t:Q}])=>{var L=class extends fe{constructor(e){if(super(e),this.it=j,e.type!==ge.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===j||e==null)return this._t=void 0,this.it=e;if(e===ue)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};L.directiveName="unsafeHTML",L.resultType=1;var J=ke(L);var Ue=pe`:host{display:block;height:100%}.display-flex-row{display:flex;flex-direction:row}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-foreground-3);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-background);border-radius:10px;padding:10px}.chat-panel{--calcite-dialog-header-background-color: var(--calcite-color-brand);--calcite-dialog-header-action-background-color: var(--calcite-color-brand);--calcite-dialog-heading-text-color: var(--calcite-color-background);--calcite-dialog-header-action-text-color: var(--calcite-color-background);--calcite-dialog-header-action-text-color-press: var(--calcite-color-background);--calcite-color-focus: var(--calcite-color-background);--calcite-dialog-min-size-y: 90vh;--calcite-dialog-max-size-y: 90vh}.chat-panel calcite-card,.chat-panel calcite-text-area,.chat-panel calcite-button:not(.icon-color-background),.chat-panel .chat-messages,.chat-panel .chat-input{--calcite-color-focus: var(--calcite-color-brand)}.assistant-followup-chip:focus{outline:2px solid var(--calcite-color-brand)}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-background, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-foreground-2);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-foreground-3);--calcite-card-border-color: var(--calcite-color-foreground-3);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-foreground-3);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-foreground-3);--calcite-card-border-color: var(--calcite-color-foreground-3)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-foreground-3)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.solution-card:focus{outline:2px solid var(--calcite-color-brand)}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-background)}.icon-color-background:focus{--calcite-color-focus: var(--calcite-color-background)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;function se(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var A=se();function Ce(i){A=i}var R={exec:()=>null};function d(i,e=""){let t=typeof i=="string"?i:i.source,n={replace:(s,a)=>{let r=typeof a=="string"?a:a.source;return r=r.replace(b.caret,"$1"),t=t.replace(s,r),n},getRegex:()=>new RegExp(t,e)};return n}var Oe=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),b={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,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,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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}>`)},Ze=/^(?:[ \t]*(?:\n|$))+/,He=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,je=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,B=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ge=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ne=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ze=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Le=d(ze).replace(/bull/g,ne).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}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),We=d(ze).replace(/bull/g,ne).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}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ie=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Xe=/^[^\n]+/,re=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Je=d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",re).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ke=d(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ne).getRegex(),Z="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",ae=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ve=d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ae).replace("tag",Z).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Pe=d(ie).replace("hr",B).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z).getRegex(),Ye=d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Pe).getRegex(),oe={blockquote:Ye,code:He,def:Je,fences:je,heading:Ge,hr:B,html:Ve,lheading:Le,list:Ke,newline:Ze,paragraph:Pe,table:R,text:Xe},Se=d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",B).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z).getRegex(),et={...oe,lheading:We,table:Se,paragraph:d(ie).replace("hr",B).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Se).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z).getRegex()},tt={...oe,html:d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ae).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:R,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:d(ie).replace("hr",B).replace("heading",` *#{1,6} *[^
3
+ ]`).replace("lheading",Le).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},st=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,nt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qe=/^( {2,}|\\)\n(?!\s*$)/,it=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,H=/[\p{P}\p{S}]/u,le=/[\s\p{P}\p{S}]/u,Ee=/[^\s\p{P}\p{S}]/u,rt=d(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,le).getRegex(),Be=/(?!~)[\p{P}\p{S}]/u,at=/(?!~)[\s\p{P}\p{S}]/u,ot=/(?:[^\s\p{P}\p{S}]|~)/u,Me=/(?![*_])[\p{P}\p{S}]/u,lt=/(?![*_])[\s\p{P}\p{S}]/u,ct=/(?:[^\s\p{P}\p{S}]|[*_])/u,ht=d(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Oe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ne=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,pt=d(Ne,"u").replace(/punct/g,H).getRegex(),ut=d(Ne,"u").replace(/punct/g,Be).getRegex(),Qe="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",dt=d(Qe,"gu").replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,le).replace(/punct/g,H).getRegex(),gt=d(Qe,"gu").replace(/notPunctSpace/g,ot).replace(/punctSpace/g,at).replace(/punct/g,Be).getRegex(),kt=d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,le).replace(/punct/g,H).getRegex(),ft=d(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Me).getRegex(),xt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",mt=d(xt,"gu").replace(/notPunctSpace/g,ct).replace(/punctSpace/g,lt).replace(/punct/g,Me).getRegex(),bt=d(/\\(punct)/,"gu").replace(/punct/g,H).getRegex(),wt=d(/^<(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(),_t=d(ae).replace("(?:-->|$)","-->").getRegex(),vt=d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_t).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),F=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,yt=d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",F).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),De=d(/^!?\[(label)\]\[(ref)\]/).replace("label",F).replace("ref",re).getRegex(),Fe=d(/^!?\[(ref)\](?:\[\])?/).replace("ref",re).getRegex(),St=d("reflink|nolink(?!\\()","g").replace("reflink",De).replace("nolink",Fe).getRegex(),$e=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ce={_backpedal:R,anyPunctuation:bt,autolink:wt,blockSkip:ht,br:qe,code:nt,del:R,delLDelim:R,delRDelim:R,emStrongLDelim:pt,emStrongRDelimAst:dt,emStrongRDelimUnd:kt,escape:st,link:yt,nolink:Fe,punctuation:rt,reflink:De,reflinkSearch:St,tag:vt,text:it,url:R},$t={...ce,link:d(/^!?\[(label)\]\((.*?)\)/).replace("label",F).getRegex(),reflink:d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",F).getRegex()},K={...ce,emStrongRDelimAst:gt,emStrongLDelim:ut,delLDelim:ft,delRDelim:mt,url:d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",$e).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",$e).getRegex()},Tt={...K,br:d(qe).replace("{2,}","*").getRegex(),text:d(K.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},D={normal:oe,gfm:et,pedantic:tt},P={normal:ce,gfm:K,breaks:Tt,pedantic:$t},Rt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Te=i=>Rt[i];function S(i,e){if(e){if(b.escapeTest.test(i))return i.replace(b.escapeReplace,Te)}else if(b.escapeTestNoEncode.test(i))return i.replace(b.escapeReplaceNoEncode,Te);return i}function Re(i){try{i=encodeURI(i).replace(b.percentDecode,"%")}catch{return null}return i}function Ie(i,e){let t=i.replace(b.findPipe,(a,r,l)=>{let o=!1,h=r;for(;--h>=0&&l[h]==="\\";)o=!o;return o?"|":" |"}),n=t.split(b.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(b.slashPipe,"|");return n}function q(i,e,t){let n=i.length;if(n===0)return"";let s=0;for(;s<n&&i.charAt(n-s-1)===e;)s++;return i.slice(0,n-s)}function It(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<i.length;n++)if(i[n]==="\\")n++;else if(i[n]===e[0])t++;else if(i[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function At(i,e=0){let t=e,n="";for(let s of i)if(s===" "){let a=4-t%4;n+=" ".repeat(a),t+=a}else n+=s,t++;return n}function Ae(i,e,t,n,s){let a=e.href,r=e.title||null,l=i[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;let o={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:a,title:r,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,o}function Ct(i,e,t){let n=i.match(t.other.indentCodeCompensation);if(n===null)return e;let s=n[1];return e.split(`
4
4
  `).map(a=>{let r=a.match(t.other.beginningSpace);if(r===null)return a;let[l]=r;return l.length>=s.length?a.slice(s.length):a}).join(`
5
- `)}var F=class{options;rules;lexer;constructor(i){this.options=i||A}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:q(t,`
5
+ `)}var U=class{options;rules;lexer;constructor(i){this.options=i||A}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:q(t,`
6
6
  `)}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],n=Ct(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:n}}}heading(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let n=q(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(t=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){let e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:q(e[0],`
7
7
  `)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=q(e[0],`
8
8
  `).split(`
@@ -18,13 +18,13 @@ ${c}`:c;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
18
18
  `);continue}}return{type:"blockquote",raw:n,tokens:a,text:s}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),n=t.length>1,s={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let a=this.rules.other.listItemRegex(t),r=!1;for(;i;){let o=!1,h="",c="";if(!(e=a.exec(i))||this.rules.block.hr.test(i))break;h=e[0],i=i.substring(h.length);let p=At(e[2].split(`
19
19
  `,1)[0],e[1].length),u=i.split(`
20
20
  `,1)[0],g=!p.trim(),f=0;if(this.options.pedantic?(f=2,c=p.trimStart()):g?f=e[1].length+1:(f=p.search(this.rules.other.nonSpaceChar),f=f>4?1:f,c=p.slice(f),f+=e[1].length),g&&this.rules.other.blankLine.test(u)&&(h+=u+`
21
- `,i=i.substring(u.length+1),o=!0),!o){let w=this.rules.other.nextBulletRegex(f),M=this.rules.other.hrRegex(f),N=this.rules.other.fencesBeginRegex(f),x=this.rules.other.headingBeginRegex(f),_=this.rules.other.htmlBeginRegex(f),C=this.rules.other.blockquoteBeginRegex(f);for(;i;){let z=i.split(`
22
- `,1)[0],$;if(u=z,this.options.pedantic?(u=u.replace(this.rules.other.listReplaceNesting," "),$=u):$=u.replace(this.rules.other.tabCharGlobal," "),N.test(u)||x.test(u)||_.test(u)||C.test(u)||w.test(u)||M.test(u))break;if($.search(this.rules.other.nonSpaceChar)>=f||!u.trim())c+=`
23
- `+$.slice(f);else{if(g||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||N.test(p)||x.test(p)||M.test(p))break;c+=`
21
+ `,i=i.substring(u.length+1),o=!0),!o){let w=this.rules.other.nextBulletRegex(f),M=this.rules.other.hrRegex(f),N=this.rules.other.fencesBeginRegex(f),m=this.rules.other.headingBeginRegex(f),_=this.rules.other.htmlBeginRegex(f),C=this.rules.other.blockquoteBeginRegex(f);for(;i;){let z=i.split(`
22
+ `,1)[0],$;if(u=z,this.options.pedantic?(u=u.replace(this.rules.other.listReplaceNesting," "),$=u):$=u.replace(this.rules.other.tabCharGlobal," "),N.test(u)||m.test(u)||_.test(u)||C.test(u)||w.test(u)||M.test(u))break;if($.search(this.rules.other.nonSpaceChar)>=f||!u.trim())c+=`
23
+ `+$.slice(f);else{if(g||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||N.test(p)||m.test(p)||M.test(p))break;c+=`
24
24
  `+u}g=!u.trim(),h+=z+`
25
25
  `,i=i.substring(z.length+1),p=$.slice(f)}}s.loose||(r?s.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(r=!0)),s.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),s.raw+=h}let l=s.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let o of s.items){if(this.lexer.state.top=!1,o.tokens=this.lexer.blockTokens(o.text,[]),o.task){if(o.text=o.text.replace(this.rules.other.listReplaceTask,""),o.tokens[0]?.type==="text"||o.tokens[0]?.type==="paragraph"){o.tokens[0].raw=o.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),o.tokens[0].text=o.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let c=this.lexer.inlineQueue.length-1;c>=0;c--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)){this.lexer.inlineQueue[c].src=this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask,"");break}}let h=this.rules.other.listTaskCheckbox.exec(o.raw);if(h){let c={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};o.checked=c.checked,s.loose?o.tokens[0]&&["paragraph","text"].includes(o.tokens[0].type)&&"tokens"in o.tokens[0]&&o.tokens[0].tokens?(o.tokens[0].raw=c.raw+o.tokens[0].raw,o.tokens[0].text=c.raw+o.tokens[0].text,o.tokens[0].tokens.unshift(c)):o.tokens.unshift({type:"paragraph",raw:c.raw,text:c.raw,tokens:[c]}):o.tokens.unshift(c)}}if(!s.loose){let h=o.tokens.filter(p=>p.type==="space"),c=h.length>0&&h.some(p=>this.rules.other.anyLine.test(p.raw));s.loose=c}}if(s.loose)for(let o of s.items){o.loose=!0;for(let h of o.tokens)h.type==="text"&&(h.type="paragraph")}return s}}html(i){let e=this.rules.block.html.exec(i);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(i){let e=this.rules.block.def.exec(i);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:n,title:s}}}table(i){let e=this.rules.block.table.exec(i);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Ie(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
26
26
  `):[],a={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===n.length){for(let r of n)this.rules.other.tableAlignRight.test(r)?a.align.push("right"):this.rules.other.tableAlignCenter.test(r)?a.align.push("center"):this.rules.other.tableAlignLeft.test(r)?a.align.push("left"):a.align.push(null);for(let r=0;r<t.length;r++)a.header.push({text:t[r],tokens:this.lexer.inline(t[r]),header:!0,align:a.align[r]});for(let r of s)a.rows.push(Ie(r,a.header.length).map((l,o)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[o]})));return a}}lheading(i){let e=this.rules.block.lheading.exec(i);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(i){let e=this.rules.block.paragraph.exec(i);if(e){let t=e[1].charAt(e[1].length-1)===`
27
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){let e=this.rules.inline.tag.exec(i);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(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let a=q(t.slice(0,-1),"\\");if((t.length-a.length)%2===0)return}else{let a=It(e[2],"()");if(a===-2)return;if(a>-1){let r=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,r).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(t)?n=n.slice(1):n=n.slice(1,-1)),Ae(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(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[n.toLowerCase()];if(!s){let a=t[0].charAt(0);return{type:"text",raw:a,text:a}}return Ae(t,s,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(i);if(!(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!t||this.rules.inline.punctuation.exec(t))){let s=[...n[0]].length-1,a,r,l=s,o=0,h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*i.length+s);(n=h.exec(e))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a)continue;if(r=[...a].length,n[3]||n[4]){l+=r;continue}else if((n[5]||n[6])&&s%3&&!((s+r)%3)){o+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l+o);let c=[...n[0]][0].length,p=i.slice(0,s+n.index+c+r);if(Math.min(s,r)%2){let g=p.slice(1,-1);return{type:"em",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}let u=p.slice(2,-2);return{type:"strong",raw:p,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i,e,t=""){let n=this.rules.inline.delLDelim.exec(i);if(n&&(!n[1]||!t||this.rules.inline.punctuation.exec(t))){let s=[...n[0]].length-1,a,r,l=s,o=this.rules.inline.delRDelim;for(o.lastIndex=0,e=e.slice(-1*i.length+s);(n=o.exec(e))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a||(r=[...a].length,r!==s))continue;if(n[3]||n[4]){l+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l);let h=[...n[0]][0].length,c=i.slice(0,s+n.index+h+r),p=c.slice(s,-s);return{type:"del",raw:c,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},v=class V{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||A,this.options.tokenizer=this.options.tokenizer||new F,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:b,block:D.normal,inline:P.normal};this.options.pedantic?(t.block=D.pedantic,t.inline=P.pedantic):this.options.gfm&&(t.block=D.gfm,this.options.breaks?t.inline=P.breaks:t.inline=P.gfm),this.tokenizer.rules=t}static get rules(){return{block:D,inline:P}}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,`
27
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){let e=this.rules.inline.tag.exec(i);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(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let a=q(t.slice(0,-1),"\\");if((t.length-a.length)%2===0)return}else{let a=It(e[2],"()");if(a===-2)return;if(a>-1){let r=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,r).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(t)?n=n.slice(1):n=n.slice(1,-1)),Ae(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(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[n.toLowerCase()];if(!s){let a=t[0].charAt(0);return{type:"text",raw:a,text:a}}return Ae(t,s,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(i);if(!(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!t||this.rules.inline.punctuation.exec(t))){let s=[...n[0]].length-1,a,r,l=s,o=0,h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*i.length+s);(n=h.exec(e))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a)continue;if(r=[...a].length,n[3]||n[4]){l+=r;continue}else if((n[5]||n[6])&&s%3&&!((s+r)%3)){o+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l+o);let c=[...n[0]][0].length,p=i.slice(0,s+n.index+c+r);if(Math.min(s,r)%2){let g=p.slice(1,-1);return{type:"em",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}let u=p.slice(2,-2);return{type:"strong",raw:p,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i,e,t=""){let n=this.rules.inline.delLDelim.exec(i);if(n&&(!n[1]||!t||this.rules.inline.punctuation.exec(t))){let s=[...n[0]].length-1,a,r,l=s,o=this.rules.inline.delRDelim;for(o.lastIndex=0,e=e.slice(-1*i.length+s);(n=o.exec(e))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a||(r=[...a].length,r!==s))continue;if(n[3]||n[4]){l+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l);let h=[...n[0]][0].length,c=i.slice(0,s+n.index+h+r),p=c.slice(s,-s);return{type:"del",raw:c,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},v=class V{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||A,this.options.tokenizer=this.options.tokenizer||new U,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:b,block:D.normal,inline:P.normal};this.options.pedantic?(t.block=D.pedantic,t.inline=P.pedantic):this.options.gfm&&(t.block=D.gfm,this.options.breaks?t.inline=P.breaks:t.inline=P.gfm),this.tokenizer.rules=t}static get rules(){return{block:D,inline:P}}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,`
28
28
  `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(b.tabCharGlobal," ").replace(b.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(r=>(s=r.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 r=t.at(-1);s.raw.length===1&&r!==void 0?r.raw+=`
29
29
  `:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let r=t.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=(r.raw.endsWith(`
30
30
  `)?"":`
@@ -56,10 +56,10 @@ ${this.parser.parse(i)}</blockquote>
56
56
  `}tablerow({text:i}){return`<tr>
57
57
  ${i}</tr>
58
58
  `}tablecell(i){let e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
59
- `}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${S(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let n=this.parser.parseInline(t),s=Re(i);if(s===null)return n;i=s;let a='<a href="'+i+'"';return e&&(a+=' title="'+S(e)+'"'),a+=">"+n+"</a>",a}image({href:i,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let s=Re(i);if(s===null)return S(t);i=s;let a=`<img src="${i}" alt="${t}"`;return e&&(a+=` title="${S(e)}"`),a+=">",a}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:S(i.text)}},he=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}checkbox({raw:i}){return i}},y=class Y{options;renderer;textRenderer;constructor(e){this.options=e||A,this.options.renderer=this.options.renderer||new O,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new he}static parse(e,t){return new Y(t).parse(e)}static parseInline(e,t){return new Y(t).parseInline(e)}parse(e){let t="";for(let n=0;n<e.length;n++){let s=e[n];if(this.options.extensions?.renderers?.[s.type]){let r=s,l=this.options.extensions.renderers[r.type].call({parser:this},r);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(r.type)){t+=l||"";continue}}let a=s;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let r='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(r),"";throw new Error(r)}}}return t}parseInline(e,t=this.renderer){let n="";for(let s=0;s<e.length;s++){let a=e[s];if(this.options.extensions?.renderers?.[a.type]){let l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=l||"";continue}}let r=a;switch(r.type){case"escape":{n+=t.text(r);break}case"html":{n+=t.html(r);break}case"link":{n+=t.link(r);break}case"image":{n+=t.image(r);break}case"checkbox":{n+=t.checkbox(r);break}case"strong":{n+=t.strong(r);break}case"em":{n+=t.em(r);break}case"codespan":{n+=t.codespan(r);break}case"br":{n+=t.br(r);break}case"del":{n+=t.del(r);break}case"text":{n+=t.text(r);break}default:{let l='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}},E=class{options;block;constructor(i){this.options=i||A}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}emStrongMask(i){return i}provideLexer(){return this.block?v.lex:v.lexInline}provideParser(){return this.block?y.parse:y.parseInline}},zt=class{defaults=se();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=y;Renderer=O;TextRenderer=he;Lexer=v;Tokenizer=F;Hooks=E;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let n of i)switch(t=t.concat(e.call(this,n)),n.type){case"table":{let s=n;for(let a of s.header)t=t.concat(this.walkTokens(a.tokens,e));for(let a of s.rows)for(let r of a)t=t.concat(this.walkTokens(r.tokens,e));break}case"list":{let s=n;t=t.concat(this.walkTokens(s.items,e));break}default:{let s=n;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(a=>{let r=s[a].flat(1/0);t=t.concat(this.walkTokens(r,e))}):s.tokens&&(t=t.concat(this.walkTokens(s.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let n={...t};if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let a=e.renderers[s.name];a?e.renderers[s.name]=function(...r){let l=s.renderer.apply(this,r);return l===!1&&(l=a.apply(this,r)),l}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[s.level];a?a.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),t.renderer){let s=this.defaults.renderer||new O(this.defaults);for(let a in t.renderer){if(!(a in s))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let r=a,l=t.renderer[r],o=s[r];s[r]=(...h)=>{let c=l.apply(s,h);return c===!1&&(c=o.apply(s,h)),c||""}}n.renderer=s}if(t.tokenizer){let s=this.defaults.tokenizer||new F(this.defaults);for(let a in t.tokenizer){if(!(a in s))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let r=a,l=t.tokenizer[r],o=s[r];s[r]=(...h)=>{let c=l.apply(s,h);return c===!1&&(c=o.apply(s,h)),c}}n.tokenizer=s}if(t.hooks){let s=this.defaults.hooks||new E;for(let a in t.hooks){if(!(a in s))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let r=a,l=t.hooks[r],o=s[r];E.passThroughHooks.has(a)?s[r]=h=>{if(this.defaults.async&&E.passThroughHooksRespectAsync.has(a))return(async()=>{let p=await l.call(s,h);return o.call(s,p)})();let c=l.call(s,h);return o.call(s,c)}:s[r]=(...h)=>{if(this.defaults.async)return(async()=>{let p=await l.apply(s,h);return p===!1&&(p=await o.apply(s,h)),p})();let c=l.apply(s,h);return c===!1&&(c=o.apply(s,h)),c}}n.hooks=s}if(t.walkTokens){let s=this.defaults.walkTokens,a=t.walkTokens;n.walkTokens=function(r){let l=[];return l.push(a.call(this,r)),s&&(l=l.concat(s.call(this,r))),l}}this.defaults={...this.defaults,...n}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return v.lex(i,e??this.defaults)}parser(i,e){return y.parse(i,e??this.defaults)}parseMarkdown(i){return(e,t)=>{let n={...t},s={...this.defaults,...n},a=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.async===!1)return a(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 a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=i),s.async)return(async()=>{let r=s.hooks?await s.hooks.preprocess(e):e,l=await(s.hooks?await s.hooks.provideLexer():i?v.lex:v.lexInline)(r,s),o=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(o,s.walkTokens));let h=await(s.hooks?await s.hooks.provideParser():i?y.parse:y.parseInline)(o,s);return s.hooks?await s.hooks.postprocess(h):h})().catch(a);try{s.hooks&&(e=s.hooks.preprocess(e));let r=(s.hooks?s.hooks.provideLexer():i?v.lex:v.lexInline)(e,s);s.hooks&&(r=s.hooks.processAllTokens(r)),s.walkTokens&&this.walkTokens(r,s.walkTokens);let l=(s.hooks?s.hooks.provideParser():i?y.parse:y.parseInline)(r,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(r){return a(r)}}}onError(i,e){return t=>{if(t.message+=`
60
- Please report this to https://github.com/markedjs/marked.`,i){let n="<p>An error occurred:</p><pre>"+S(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},I=new zt;function k(i,e){return I.parse(i,e)}k.options=k.setOptions=function(i){return I.setOptions(i),k.defaults=I.defaults,Ce(k.defaults),k};k.getDefaults=se;k.defaults=A;k.use=function(...i){return I.use(...i),k.defaults=I.defaults,Ce(k.defaults),k};k.walkTokens=function(i,e){return I.walkTokens(i,e)};k.parseInline=I.parseInline;k.Parser=y;k.parser=y.parse;k.Renderer=O;k.TextRenderer=he;k.Lexer=v;k.lexer=v.lex;k.Tokenizer=F;k.Hooks=E;k.parse=k;k.options;k.setOptions;k.use;k.walkTokens;k.parseInline;y.parse;v.lex;var ee=class{constructor(e=""){this._text="",this._displayedText="",this._pendingText="",this._text=e,this._pendingText=e}setText(e){this._text=e,this._displayedText&&e.includes(this._displayedText)?this._pendingText=e.substring(this._displayedText.length):(this._pendingText=this._text,this._displayedText="")}getText(){return this._displayedText}clearText(){this._displayedText="",this._text="",this._pendingText=""}updateDisplayText(){if(this._pendingText.length>0){let e=this._pendingText[0];if(e==="["||e==="<"||e==="!"){let t=this._matchMarkdownPattern(this._displayedText+this._pendingText,this._displayedText.length);if(t){let n=t.end-t.start,s=this._pendingText.substring(0,n);this._displayedText+=s,this._pendingText=this._pendingText.substring(n)}else this._displayedText+=e,this._pendingText=this._pendingText.substring(1)}else this._displayedText+=e,this._pendingText=this._pendingText.substring(1)}}_matchMarkdownPattern(e,t){let n=[/<sup>\[\[[^\]]+\]\]\([^)]+\)<\/sup>/,/\[\[[^\]]+\]\]\([^)]+\)/,/\[[^\]]+\]\([^)]+\)/,/!\[[^\]]*\]\([^)]+\)/],s=e.substring(t);for(let a of n){let r=s.match(a);if(r&&r.index===0)return{start:t,end:t+r[0].length}}return null}},Lt="https://links.esri.com/solutions/agol-organizational-account",Pt="https://links.esri.com/solutions/configure-assistants",te=class extends me{constructor(){super(),this.serverRoot="https://aiservices-beta.arcgis.com",this.open=!1,this.userFirstName="",this.conversationStore={conversationId:null,inquiryId:null,ackSequenceNumber:null},this._currentResponse="",this._isAutoScroll=!1,this._isLoading=!1,this._isLoadingText="",this.messages=[],this._orgSettings={aiAssistantsEnabled:!1,blockBetaApps:!0,colocateCompute:!1},this._translations=be({name:"arcgis-solutions-assistant",blocking:!0}),this._isTyping=!1,this._configContextConsumer=we({context:_e,subscribe:!0,callback:e=>{e?.userSession&&!this.userFirstName&&this._loadUserFirstName(),e?.authentication?.PortalSubset?.orgSettings&&(this._orgSettings=e?.authentication?.PortalSubset?.orgSettings,this._getAIServiceUrl())}}),this.closeAssistant=de(),this._resetConversation=()=>{this.conversationStore.conversationId=null,this.conversationStore.inquiryId=null,this.conversationStore.ackSequenceNumber=null},this._setMessageContainerRef=e=>{this._chatContainer=e},this._setInputRef=e=>{this._inputRef=e,this._inputRef.addEventListener("keydown",t=>{t.key==="Enter"&&!t.shiftKey&&!this._isLoading&&!this._isTyping&&(t.preventDefault(),this._inputRef&&(this.handleSendMessage(this._inputRef.value.trim()),this._inputRef.value=""))}),setTimeout(()=>{this._inputRef?.focus()},100)},this._submitQuestion=e=>{this.handleSendMessage(e)},this._handleSignIn=()=>{this._configContextConsumer.value?.authentication?.signIn("aiOpen")},this._checkURLOpenParameter=()=>{this.open=this._configContextConsumer.value?.authentication?.SignInParam==="aiOpen"||this.open},this.listenOn(window,"submitQuestion",e=>{this._submitQuestion(e.detail)})}static{this.properties={serverRoot:1,open:5,userFirstName:1,conversationStore:16,_currentResponse:16,_isAutoScroll:16,_isLoading:16,_isLoadingText:16,messages:16,_orgSettings:16,_translations:16,_isTyping:16}}static{this.styles=Fe}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}get solutionAIurl(){return`${this.serverRoot}/skills/solution_deployment/chat`}get docAIurl(){return`${this.serverRoot}/skills/doc_ai_assistant/chat`}async handleSendMessage(e){this._isLoading=!0;let t={message:e,context:{debug:!1,kind:"SolutionRequest"}};if(this.conversationStore.conversationId!==null){t.conversationId=this.conversationStore.conversationId;let n={author:"human",conversationId:this.conversationStore.conversationId?this.conversationStore.conversationId:"",message:e,render:this._renderSimpleTextMessage(e,"human","","Other")};this.messages=[...this.messages,n];let s=await this.requestAIServer(t,this.solutionAIurl);this.loopRequest(s,this.solutionAIurl)}else{let n={author:"human",message:e,render:this._renderSimpleTextMessage(e,"human","","Other")};this.messages=[...this.messages,n];let s=await this.requestAIServer(t,this.solutionAIurl);this.conversationStore.conversationId=s.conversationId,this.conversationStore.inquiryId=s.inquiryId,this.conversationStore.ackSequenceNumber=s.sequenceNumber,this.loopRequest(s,this.solutionAIurl)}}async loopRequest(e,t){let n=Date.now(),s,a=t;this._isLoading=!0;let r=document.createElement("div");r.classList.add("response-message","message-content");let l=document.createElement("div");l.classList.add("display-none");let o=document.createElement("div");o.classList.add("display-none");let h=e.conversationId+Date.now(),c=this._renderResponseBlock(r,l,o,h),p=new ee(this._currentResponse),u={author:"ai",conversationId:e.conversationId,message:e.message??"",render:c};for(this.messages.push(u),this.requestUpdate(),this._isAutoScroll=!0;e.hasMore;){await new Promise(_=>setTimeout(_,500));let x={conversationId:e.conversationId,ackSequenceNumber:e.sequenceNumber,inquiryId:e.inquiryId};if(e.context)if(this.conversationStore.context=e.context,e.context.results&&!e.context.intent)for(let _ of e.context.results)this._currentResponse=_.reply,this._currentResponse!==""&&(this._isLoading=!1,this._isTyping=!0,this._showCardById(h),this._startTypeWriter(p,this._currentResponse,r,l,o)),e=await this.requestAIServer(x,a);else if(e.context.intent==="Solution question"){s=e.context.intent;let _={message:e.message,conversationId:x.conversationId,context:{kind:"DocAIAssistantRequest",filters:{products:"ArcGIS Solutions"}}};a=this.docAIurl,e=await this.requestAIServer(_,a)}else this._currentResponse=e.message??"",e.context.kind&&e.context.kind.toLowerCase()==="ArcGISErrorAsContext".toLowerCase()&&(this._currentResponse=this._translations.genericErrorMessage),this._currentResponse!==""&&(this._isLoading=!1,this._isTyping=!0,this._showCardById(h),this._startTypeWriter(p,this._currentResponse,r,l,o)),e=await this.requestAIServer(x,a);else e=await this.requestAIServer(x,a)}this._isLoading=!1;let{context:g}=this.conversationStore,f=this.messages.length>=2?this._getMostRecentQuestion():"",w=typeof f=="string"?"":f?.message??"",M=ve(n),N=s||g?.intent||"Unknown";if(this._telemetry?.logEvent({category:ye.ASSISTANT,action:"Chat",dimensions:[N],metrics:[M]}),g&&g.intent)switch(g.intent){case"Recommend solution":{if(g.results){let x=g.results,_=x.map($=>`- ${$.title}`).join(`
61
- `),C=this._renderSuggestedSolutions(x),z=this._renderFeedback(this._currentResponse+`
62
- `+_,w,this.conversationStore.conversationId,g.intent);T(C,l),T(z,o)}else l.innerHTML="";this._scrollToBottom();break}default:{let x=this._renderFeedback(this._currentResponse,w,this.conversationStore.conversationId,g.intent);T(x,o),this._scrollToBottom();break}}else{if(g&&g.results&&!g.intent)for(let x of g.results){let _=this._renderSolutionsQuestionTable(x.ref,x.followupQuestions),C=this._renderFeedback(this._currentResponse,w,this.conversationStore.conversationId,"Solution question");T(_,l),T(C,o)}else if(g&&g.kind&&g.kind.toLowerCase()==="ArcGISErrorAsContext".toLowerCase()){let x=this._renderFeedback(this._currentResponse,w,this.conversationStore.conversationId,"Error");T(x,o)}this._scrollToBottom()}}async requestAIServer(e,t){try{let n=this._configContextConsumer.value?.userSession?.token??"",s=await(await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",token:n},body:JSON.stringify(e)})).json();if(s)return s;throw new Error("No data returned")}catch(n){throw new Error(`Request failed: ${n}`)}}resetChat(){let e=this.messages[this.messages.length-1];if(e.author!=="system"&&e.conversationId!=="-1"){this._resetConversation();let t={author:"system",conversationId:"-1",message:this._translations.newConversationStarted,render:this._renderSimpleTextMessage(this._translations.newConversationStarted,"system","","Other","speech-bubble-plus")};this.messages=[...this.messages,t],this._inputRef&&(this._inputRef.value="")}}loaded(){this._checkURLOpenParameter();let e=this._chatContainer;e&&e.addEventListener("scroll",()=>{this._isAutoScroll=this._isAtBottom(e)})}firstUpdated(e){this._loadUserFirstName()}willUpdate(e){if(this._configContextConsumer.value?.userSession?.token&&this._configContextConsumer.value?.authentication?.CanUseAI&&this.messages.length===0&&this._translations.defaultStartUpMessage){let t=this._translations.defaultStartUpMessage.replace("{{name}}",this.userFirstName),n=Object.values(this._translations.defaultFollowUpQuestions),s=this._renderSolutionQuestionFollowup(n);this.messages=[{author:"ai",conversationId:"",message:t,render:this._renderSimpleTextMessage(t,"ai","","Other",void 0,s,"margin-top-0")}]}(e.has("_isLoading")||e.has("_isTyping"))&&this.renderRoot.querySelectorAll(".assistant-followup-chip").forEach(t=>{t.disabled=this._isLoading||this._isTyping})}updated(e){(e.size||this._isLoading)&&this._scrollToBottom()}_renderFeedback(e,t,n,s){let a=Date.now();return m`
59
+ `}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${S(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let n=this.parser.parseInline(t),s=Re(i);if(s===null)return n;i=s;let a='<a href="'+i+'"';return e&&(a+=' title="'+S(e)+'"'),a+=">"+n+"</a>",a}image({href:i,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let s=Re(i);if(s===null)return S(t);i=s;let a=`<img src="${i}" alt="${t}"`;return e&&(a+=` title="${S(e)}"`),a+=">",a}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:S(i.text)}},he=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}checkbox({raw:i}){return i}},y=class Y{options;renderer;textRenderer;constructor(e){this.options=e||A,this.options.renderer=this.options.renderer||new O,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new he}static parse(e,t){return new Y(t).parse(e)}static parseInline(e,t){return new Y(t).parseInline(e)}parse(e){let t="";for(let n=0;n<e.length;n++){let s=e[n];if(this.options.extensions?.renderers?.[s.type]){let r=s,l=this.options.extensions.renderers[r.type].call({parser:this},r);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(r.type)){t+=l||"";continue}}let a=s;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let r='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(r),"";throw new Error(r)}}}return t}parseInline(e,t=this.renderer){let n="";for(let s=0;s<e.length;s++){let a=e[s];if(this.options.extensions?.renderers?.[a.type]){let l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=l||"";continue}}let r=a;switch(r.type){case"escape":{n+=t.text(r);break}case"html":{n+=t.html(r);break}case"link":{n+=t.link(r);break}case"image":{n+=t.image(r);break}case"checkbox":{n+=t.checkbox(r);break}case"strong":{n+=t.strong(r);break}case"em":{n+=t.em(r);break}case"codespan":{n+=t.codespan(r);break}case"br":{n+=t.br(r);break}case"del":{n+=t.del(r);break}case"text":{n+=t.text(r);break}default:{let l='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}},E=class{options;block;constructor(i){this.options=i||A}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}emStrongMask(i){return i}provideLexer(){return this.block?v.lex:v.lexInline}provideParser(){return this.block?y.parse:y.parseInline}},zt=class{defaults=se();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=y;Renderer=O;TextRenderer=he;Lexer=v;Tokenizer=U;Hooks=E;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let n of i)switch(t=t.concat(e.call(this,n)),n.type){case"table":{let s=n;for(let a of s.header)t=t.concat(this.walkTokens(a.tokens,e));for(let a of s.rows)for(let r of a)t=t.concat(this.walkTokens(r.tokens,e));break}case"list":{let s=n;t=t.concat(this.walkTokens(s.items,e));break}default:{let s=n;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(a=>{let r=s[a].flat(1/0);t=t.concat(this.walkTokens(r,e))}):s.tokens&&(t=t.concat(this.walkTokens(s.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let n={...t};if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let a=e.renderers[s.name];a?e.renderers[s.name]=function(...r){let l=s.renderer.apply(this,r);return l===!1&&(l=a.apply(this,r)),l}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[s.level];a?a.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),t.renderer){let s=this.defaults.renderer||new O(this.defaults);for(let a in t.renderer){if(!(a in s))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let r=a,l=t.renderer[r],o=s[r];s[r]=(...h)=>{let c=l.apply(s,h);return c===!1&&(c=o.apply(s,h)),c||""}}n.renderer=s}if(t.tokenizer){let s=this.defaults.tokenizer||new U(this.defaults);for(let a in t.tokenizer){if(!(a in s))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let r=a,l=t.tokenizer[r],o=s[r];s[r]=(...h)=>{let c=l.apply(s,h);return c===!1&&(c=o.apply(s,h)),c}}n.tokenizer=s}if(t.hooks){let s=this.defaults.hooks||new E;for(let a in t.hooks){if(!(a in s))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let r=a,l=t.hooks[r],o=s[r];E.passThroughHooks.has(a)?s[r]=h=>{if(this.defaults.async&&E.passThroughHooksRespectAsync.has(a))return(async()=>{let p=await l.call(s,h);return o.call(s,p)})();let c=l.call(s,h);return o.call(s,c)}:s[r]=(...h)=>{if(this.defaults.async)return(async()=>{let p=await l.apply(s,h);return p===!1&&(p=await o.apply(s,h)),p})();let c=l.apply(s,h);return c===!1&&(c=o.apply(s,h)),c}}n.hooks=s}if(t.walkTokens){let s=this.defaults.walkTokens,a=t.walkTokens;n.walkTokens=function(r){let l=[];return l.push(a.call(this,r)),s&&(l=l.concat(s.call(this,r))),l}}this.defaults={...this.defaults,...n}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return v.lex(i,e??this.defaults)}parser(i,e){return y.parse(i,e??this.defaults)}parseMarkdown(i){return(e,t)=>{let n={...t},s={...this.defaults,...n},a=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.async===!1)return a(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 a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=i),s.async)return(async()=>{let r=s.hooks?await s.hooks.preprocess(e):e,l=await(s.hooks?await s.hooks.provideLexer():i?v.lex:v.lexInline)(r,s),o=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(o,s.walkTokens));let h=await(s.hooks?await s.hooks.provideParser():i?y.parse:y.parseInline)(o,s);return s.hooks?await s.hooks.postprocess(h):h})().catch(a);try{s.hooks&&(e=s.hooks.preprocess(e));let r=(s.hooks?s.hooks.provideLexer():i?v.lex:v.lexInline)(e,s);s.hooks&&(r=s.hooks.processAllTokens(r)),s.walkTokens&&this.walkTokens(r,s.walkTokens);let l=(s.hooks?s.hooks.provideParser():i?y.parse:y.parseInline)(r,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(r){return a(r)}}}onError(i,e){return t=>{if(t.message+=`
60
+ Please report this to https://github.com/markedjs/marked.`,i){let n="<p>An error occurred:</p><pre>"+S(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},I=new zt;function k(i,e){return I.parse(i,e)}k.options=k.setOptions=function(i){return I.setOptions(i),k.defaults=I.defaults,Ce(k.defaults),k};k.getDefaults=se;k.defaults=A;k.use=function(...i){return I.use(...i),k.defaults=I.defaults,Ce(k.defaults),k};k.walkTokens=function(i,e){return I.walkTokens(i,e)};k.parseInline=I.parseInline;k.Parser=y;k.parser=y.parse;k.Renderer=O;k.TextRenderer=he;k.Lexer=v;k.lexer=v.lex;k.Tokenizer=U;k.Hooks=E;k.parse=k;k.options;k.setOptions;k.use;k.walkTokens;k.parseInline;y.parse;v.lex;var ee=class{constructor(e=""){this._text="",this._displayedText="",this._pendingText="",this._text=e,this._pendingText=e}setText(e){this._text=e,this._displayedText&&e.includes(this._displayedText)?this._pendingText=e.substring(this._displayedText.length):(this._pendingText=this._text,this._displayedText="")}getText(){return this._displayedText}clearText(){this._displayedText="",this._text="",this._pendingText=""}updateDisplayText(){if(this._pendingText.length>0){let e=this._pendingText[0];if(e==="["||e==="<"||e==="!"){let t=this._matchMarkdownPattern(this._displayedText+this._pendingText,this._displayedText.length);if(t){let n=t.end-t.start,s=this._pendingText.substring(0,n);this._displayedText+=s,this._pendingText=this._pendingText.substring(n)}else this._displayedText+=e,this._pendingText=this._pendingText.substring(1)}else this._displayedText+=e,this._pendingText=this._pendingText.substring(1)}}_matchMarkdownPattern(e,t){let n=[/<sup>\[\[[^\]]+\]\]\([^)]+\)<\/sup>/,/\[\[[^\]]+\]\]\([^)]+\)/,/\[[^\]]+\]\([^)]+\)/,/!\[[^\]]*\]\([^)]+\)/],s=e.substring(t);for(let a of n){let r=s.match(a);if(r&&r.index===0)return{start:t,end:t+r[0].length}}return null}},Lt="https://links.esri.com/solutions/agol-organizational-account",Pt="https://links.esri.com/solutions/configure-assistants",te=class extends xe{constructor(){super(),this.serverRoot="https://aiservices-beta.arcgis.com",this.open=!1,this.userFirstName="",this.conversationStore={conversationId:null,inquiryId:null,ackSequenceNumber:null},this._currentResponse="",this._isAutoScroll=!1,this._isLoading=!1,this._isLoadingText="",this.messages=[],this._orgSettings={aiAssistantsEnabled:!1,blockBetaApps:!0,colocateCompute:!1},this._translations=be({name:"arcgis-solutions-assistant",blocking:!0}),this._isTyping=!1,this._configContextConsumer=we({context:_e,subscribe:!0,callback:e=>{e?.userSession&&!this.userFirstName&&this._loadUserFirstName(),e?.authentication?.PortalSubset?.orgSettings&&(this._orgSettings=e?.authentication?.PortalSubset?.orgSettings,this._getAIServiceUrl())}}),this.closeAssistant=de(),this._resetConversation=()=>{this.conversationStore.conversationId=null,this.conversationStore.inquiryId=null,this.conversationStore.ackSequenceNumber=null},this._setMessageContainerRef=e=>{this._chatContainer=e},this._setInputRef=e=>{this._inputRef=e,this._inputRef.addEventListener("keydown",t=>{t.key==="Enter"&&!t.shiftKey&&!this._isLoading&&!this._isTyping&&(t.preventDefault(),this._inputRef&&(this.handleSendMessage(this._inputRef.value.trim()),this._inputRef.value=""))}),setTimeout(()=>{this._inputRef?.focus()},100)},this._submitQuestion=e=>{this.handleSendMessage(e)},this._handleSignIn=()=>{this._configContextConsumer.value?.authentication?.signIn("aiOpen")},this._checkURLOpenParameter=()=>{this.open=this._configContextConsumer.value?.authentication?.SignInParam==="aiOpen"||this.open},this.listenOn(window,"submitQuestion",e=>{this._submitQuestion(e.detail)})}static{this.properties={serverRoot:1,open:5,userFirstName:1,conversationStore:16,_currentResponse:16,_isAutoScroll:16,_isLoading:16,_isLoadingText:16,messages:16,_orgSettings:16,_translations:16,_isTyping:16}}static{this.styles=Ue}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}get solutionAIurl(){return`${this.serverRoot}/skills/solution_deployment/chat`}get docAIurl(){return`${this.serverRoot}/skills/doc_ai_assistant/chat`}async handleSendMessage(e){this._isLoading=!0;let t={message:e,context:{debug:!1,kind:"SolutionRequest"}};if(this.conversationStore.conversationId!==null){t.conversationId=this.conversationStore.conversationId;let n={author:"human",conversationId:this.conversationStore.conversationId?this.conversationStore.conversationId:"",message:e,render:this._renderSimpleTextMessage(e,"human","","Other")};this.messages=[...this.messages,n];let s=await this.requestAIServer(t,this.solutionAIurl);this.loopRequest(s,this.solutionAIurl)}else{let n={author:"human",message:e,render:this._renderSimpleTextMessage(e,"human","","Other")};this.messages=[...this.messages,n];let s=await this.requestAIServer(t,this.solutionAIurl);this.conversationStore.conversationId=s.conversationId,this.conversationStore.inquiryId=s.inquiryId,this.conversationStore.ackSequenceNumber=s.sequenceNumber,this.loopRequest(s,this.solutionAIurl)}}async loopRequest(e,t){let n=Date.now(),s,a=t;this._isLoading=!0;let r=document.createElement("div");r.classList.add("response-message","message-content");let l=document.createElement("div");l.classList.add("display-none");let o=document.createElement("div");o.classList.add("display-none");let h=e.conversationId+Date.now(),c=this._renderResponseBlock(r,l,o,h),p=new ee(this._currentResponse),u={author:"ai",conversationId:e.conversationId,message:e.message??"",render:c};for(this.messages.push(u),this.requestUpdate(),this._isAutoScroll=!0;e.hasMore;){await new Promise(_=>setTimeout(_,500));let m={conversationId:e.conversationId,ackSequenceNumber:e.sequenceNumber,inquiryId:e.inquiryId};if(e.context)if(this.conversationStore.context=e.context,e.context.results&&!e.context.intent)for(let _ of e.context.results)this._currentResponse=_.reply,this._currentResponse!==""&&(this._isLoading=!1,this._isTyping=!0,this._showCardById(h),this._startTypeWriter(p,this._currentResponse,r,l,o)),e=await this.requestAIServer(m,a);else if(e.context.intent==="Solution question"){s=e.context.intent;let _={message:e.message,conversationId:m.conversationId,context:{kind:"DocAIAssistantRequest",filters:{products:"ArcGIS Solutions"}}};a=this.docAIurl,e=await this.requestAIServer(_,a)}else this._currentResponse=e.message??"",e.context.kind&&e.context.kind.toLowerCase()==="ArcGISErrorAsContext".toLowerCase()&&(this._currentResponse=this._translations.genericErrorMessage),this._currentResponse!==""&&(this._isLoading=!1,this._isTyping=!0,this._showCardById(h),this._startTypeWriter(p,this._currentResponse,r,l,o)),e=await this.requestAIServer(m,a);else e=await this.requestAIServer(m,a)}this._isLoading=!1;let{context:g}=this.conversationStore,f=this.messages.length>=2?this._getMostRecentQuestion():"",w=typeof f=="string"?"":f?.message??"",M=ve(n),N=s||g?.intent||"Unknown";if(this._telemetry?.logEvent({category:ye.ASSISTANT,action:"Chat",dimensions:[N],metrics:[M]}),g&&g.intent)switch(g.intent){case"Recommend solution":{if(g.results){let m=g.results,_=m.map($=>`- ${$.title}`).join(`
61
+ `),C=this._renderSuggestedSolutions(m),z=this._renderFeedback(this._currentResponse+`
62
+ `+_,w,this.conversationStore.conversationId,g.intent);T(C,l),T(z,o)}else l.innerHTML="";this._scrollToBottom();break}default:{let m=this._renderFeedback(this._currentResponse,w,this.conversationStore.conversationId,g.intent);T(m,o),this._scrollToBottom();break}}else{if(g&&g.results&&!g.intent)for(let m of g.results){let _=this._renderSolutionsQuestionTable(m.ref,m.followupQuestions),C=this._renderFeedback(this._currentResponse,w,this.conversationStore.conversationId,"Solution question");T(_,l),T(C,o)}else if(g&&g.kind&&g.kind.toLowerCase()==="ArcGISErrorAsContext".toLowerCase()){let m=this._renderFeedback(this._currentResponse,w,this.conversationStore.conversationId,"Error");T(m,o)}this._scrollToBottom()}}async requestAIServer(e,t){try{let n=this._configContextConsumer.value?.userSession?.token??"",s=await(await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",token:n},body:JSON.stringify(e)})).json();if(s)return s;throw new Error("No data returned")}catch(n){throw new Error(`Request failed: ${n}`)}}resetChat(){let e=this.messages[this.messages.length-1];if(e.author!=="system"&&e.conversationId!=="-1"){this._resetConversation();let t={author:"system",conversationId:"-1",message:this._translations.newConversationStarted,render:this._renderSimpleTextMessage(this._translations.newConversationStarted,"system","","Other","speech-bubble-plus")};this.messages=[...this.messages,t],this._inputRef&&(this._inputRef.value="")}}loaded(){this._checkURLOpenParameter();let e=this._chatContainer;e&&e.addEventListener("scroll",()=>{this._isAutoScroll=this._isAtBottom(e)})}firstUpdated(e){this._loadUserFirstName()}willUpdate(e){if(this._configContextConsumer.value?.userSession?.token&&this._configContextConsumer.value?.authentication?.CanUseAI&&this.messages.length===0&&this._translations.defaultStartUpMessage){let t=this._translations.defaultStartUpMessage.replace("{{name}}",this.userFirstName),n=Object.values(this._translations.defaultFollowUpQuestions),s=this._renderSolutionQuestionFollowup(n);this.messages=[{author:"ai",conversationId:"",message:t,render:this._renderSimpleTextMessage(t,"ai","","Other",void 0,s,"margin-top-0")}]}(e.has("_isLoading")||e.has("_isTyping"))&&this.renderRoot.querySelectorAll(".assistant-followup-chip").forEach(t=>{let n=this._isLoading||this._isTyping;t.disabled=n,t.tabIndex=n?-1:0})}updated(e){(e.size||this._isLoading)&&this._scrollToBottom()}_renderFeedback(e,t,n,s){let a=Date.now();return x`
63
63
  <div>
64
64
  <calcite-button
65
65
  appearance='transparent'
@@ -103,28 +103,28 @@ Please report this to https://github.com/markedjs/marked.`,i){let n="<p>An error
103
103
  <span>${this._translations.tooltips.copyButton}</span>
104
104
  </calcite-tooltip>
105
105
  </div>
106
- `}_renderSolutionQuestionReferences(e){return m`
107
- ${e.map(t=>m`
106
+ `}_renderSolutionQuestionReferences(e){return x`
107
+ ${e.map(t=>x`
108
108
  <div class='message-content-pad'>
109
109
  <a href=${t.url} target='_blank'>
110
110
  ${t.title}
111
111
  </a>
112
112
  </div>
113
113
  `)}
114
- `}_renderSolutionQuestionFollowup(e){return m`
115
- ${e.map(t=>m`
114
+ `}_renderSolutionQuestionFollowup(e){return x`
115
+ ${e.map(t=>x`
116
116
  <calcite-chip
117
117
  class='chip-content cursor-pointer assistant-followup-chip'
118
118
  kind='brand'
119
119
  label=${t}
120
120
  tabindex='0'
121
- @click=${()=>{this._submitFollowupQuestion(t)}}
122
- @keydown=${n=>{Q(n,()=>this._submitFollowupQuestion(t))}}
121
+ @click=${n=>{n.currentTarget.disabled||this._submitFollowupQuestion(t)}}
122
+ @keydown=${n=>{n.currentTarget.disabled||Q(n,()=>this._submitFollowupQuestion(t))}}
123
123
  >
124
124
  ${t}
125
125
  </calcite-chip>
126
126
  `)}
127
- `}_renderSolutionsQuestionTable(e,t){let n=this._renderSolutionQuestionReferences(e),s=this._renderSolutionQuestionFollowup(t);return m`
127
+ `}_renderSolutionsQuestionTable(e,t){let n=this._renderSolutionQuestionReferences(e),s=this._renderSolutionQuestionFollowup(t);return x`
128
128
  <div slot='description' class='message-content'>
129
129
  <div style='display: flex; justify-content: flex-start;'>
130
130
  <calcite-button
@@ -146,7 +146,7 @@ Please report this to https://github.com/markedjs/marked.`,i){let n="<p>An error
146
146
  <div class='padding-top-10'>
147
147
  ${s}
148
148
  </div>
149
- `}_renderSolutionCard(e){return m`
149
+ `}_renderSolutionCard(e){return x`
150
150
  <a
151
151
  class='solution-card'
152
152
  id='${e.id}'
@@ -167,8 +167,8 @@ Please report this to https://github.com/markedjs/marked.`,i){let n="<p>An error
167
167
  <span slot='description' class='solution-snippet'>${e.snippet}</span>
168
168
  </calcite-card>
169
169
  </a>
170
- `}_renderResponseBlock(e,t,n,s){return m`<calcite-card id=${s??X} class="system-message display-none">${e}${t}${n}</calcite-card>`}_renderSimpleTextMessage(e,t,n,s,a,r,l){let o=this.messages.length>=2?this._getMostRecentQuestion():"",h=typeof o=="string"?"":o?.message??"";return t==="system"?m`<div class="message-content message-content-alignment">${a&&m`<calcite-icon .icon=${a}></calcite-icon>`||""}${e}</div>`:m`<calcite-card class=${W(t==="human"?"user-message":"system-message")}><div class=${W(l?`${l} message-content`:"message-content")}>${J(e)}${r}${t==="ai"&&n!==""&&this._renderFeedback(e,h,n,s)||""}</div></calcite-card>`}_renderSuggestedSolutions(e){let t=e.map(n=>this._renderSolutionCard(n));return m`
170
+ `}_renderResponseBlock(e,t,n,s){return x`<calcite-card id=${s??X} class="system-message display-none">${e}${t}${n}</calcite-card>`}_renderSimpleTextMessage(e,t,n,s,a,r,l){let o=this.messages.length>=2?this._getMostRecentQuestion():"",h=typeof o=="string"?"":o?.message??"";return t==="system"?x`<div class="message-content message-content-alignment">${a&&x`<calcite-icon .icon=${a}></calcite-icon>`||""}${e}</div>`:x`<calcite-card class=${W(t==="human"?"user-message":"system-message")}><div class=${W(l?`${l} message-content`:"message-content")}>${J(e)}${r}${t==="ai"&&n!==""&&this._renderFeedback(e,h,n,s)||""}</div></calcite-card>`}_renderSuggestedSolutions(e){let t=e.map(n=>this._renderSolutionCard(n));return x`
171
171
  <div class='message-content'>
172
172
  ${t}
173
173
  </div>
174
- `}_renderNoSign(){return m`<calcite-notice open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage??X} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`}_renderNoPermission(){return m`<calcite-notice open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${J(this._translations.noPermissionMessage.replace("{{orgUrl}}",Lt).replace("{{configAI}}",Pt))}</div></calcite-notice>`}render(){return m`<calcite-dialog class="chat-panel" .open=${this.open} .heading=${this._translations.solutionAssistantTitle} placement=bottom-start @calciteDialogClose=${()=>{this.closeAssistant.emit(!0),this.open=!1}}><span class="chat-panel-heading" slot=header-content><span class="padding-right-8">${this._translations.solutionAssistantTitle}</span><calcite-chip .label=${this._translations.betaTag} .value=${this._translations.betaTag}>${this._translations.betaTag}</calcite-chip></span>${this.messages.length>1?m`<calcite-button appearance=transparent class="icon-color-background" .disabled=${!!this._isLoading||this._isTyping} id=newChatButton icon-end=speech-bubble-plus kind=neutral label="New conversation" @click=${this.resetChat} scale=l slot=header-actions-end></calcite-button><calcite-tooltip placement=bottom reference-element=newChatButton><span>${this._translations.tooltips.newConversation}</span></calcite-tooltip>`:""}<div class="chat-messages" ${G(this._setMessageContainerRef)}>${this.messages.map(e=>e.render)}${this._isLoading&&m`<calcite-card class="loader-message"><div class="message-content display-flex-row"><calcite-loader .label=${this._isLoadingText} inline scale=s></calcite-loader>${this._isLoadingText!=""&&m`<div class="padding-left-10">${this._isLoadingText}</div>`||""}</div></calcite-card>`||""}${this._chatContainer&&!this._isAtBottom(this._chatContainer)&&!this._isAutoScroll&&m`<calcite-fab icon=arrow-down @click=${()=>{this._isAutoScroll=!0,this._scrollToBottom(),setTimeout(()=>{this.requestUpdate()},100)}} scale=m></calcite-fab>`||""}${this._configContextConsumer.value?.userSession?.token?this._configContextConsumer.value?.authentication?.CanUseAI?"":this._renderNoPermission():this._renderNoSign()}</div><div slot=footer class="width-100"><div class="chat-input"><calcite-text-area .disabled=${!this._configContextConsumer.value?.userSession?.token||!this._configContextConsumer.value?.authentication?.CanUseAI} resize=none rows=3 .placeholder=${this._translations.sendMessage} value ${G(this._setInputRef)}></calcite-text-area><calcite-button appearance=outline .disabled=${!!this._isLoading||this._isTyping||!this._configContextConsumer.value?.userSession?.token||!this._configContextConsumer.value?.authentication?.CanUseAI} icon-start=send id=sendQuestion kind=neutral icon-flip-rtl=start @click=${()=>{this._inputRef&&(this.handleSendMessage(this._inputRef.value.trim()),this._inputRef.value="")}} @keydown=${e=>Q(e,()=>{this._inputRef&&(this.handleSendMessage(this._inputRef.value.trim()),this._inputRef.value="")})}></calcite-button><calcite-tooltip placement=bottom reference-element=sendQuestion><span>${this._translations.tooltips.sendQuestion}</span></calcite-tooltip></div><div class="disclaimer-div padding-top-10" slot=footer><calcite-icon icon=information scale=s></calcite-icon>${this._translations.disclaimerMessage}<a href=https://links.esri.com/solutions/security-concern target=_blank>${this._translations.reportConcern}</a></div></div></calcite-dialog>`}_scrollToBottom(){this._chatContainer&&this._isAutoScroll&&setTimeout(()=>{this._chatContainer&&(this._chatContainer.scrollTop=this._chatContainer.scrollHeight)},100)}_emitItemIdFromAI(e){let t=new CustomEvent("solutionIDFromAssistant",{detail:e,bubbles:!0,composed:!0});window.dispatchEvent(t)}_submitFollowupQuestion(e){let t=new CustomEvent("submitQuestion",{detail:e,bubbles:!0,composed:!0});window.dispatchEvent(t)}_getMostRecentQuestion(){return[...this.messages].reverse().find(e=>e.author==="human")||null}_sendFeedback(e,t,n,s,a){let r=`https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(n)}&field:question=${encodeURIComponent(t)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({intent:a}))}&field:conversation_id=${encodeURIComponent(s)}&field:version=${encodeURIComponent("v1")}`;window.open(r,"_blank")}_copyResponseToClipboard(e,t){navigator.clipboard.writeText(e);let n=t.currentTarget;n.iconStart="check",setTimeout(()=>{n.iconStart="copy"},3e3)}_startTypeWriter(e,t,n,s,a){if(t.length>0){e.setText(t);let r=async()=>{e.updateDisplayText();let l=e.getText(),o=await k.parse(l);n.innerHTML=o.replace(/<a\s+/g,'<a target="_blank" '),l.length<this._currentResponse.length?(this._scrollToBottom(),setTimeout(r,5)):(this._isTyping=!1,this._isAutoScroll=!1,s.classList.remove("display-none"),a.classList.remove("display-none"))};r()}}_showCardById(e){let t=this.renderRoot.querySelector(`#${e}`);t&&t.classList.remove("display-none")}_isAtBottom(e){return e.scrollTop+e.clientHeight>=e.scrollHeight-5}async _loadUserFirstName(){try{let e=await this._configContextConsumer.value?.userSession?.getUser();if(e?.fullName){let t=e.fullName.split(" ")[0];this.userFirstName=t}}catch{}}_getAIServiceUrl(){if(this._configContextConsumer.value){let e=this._configContextConsumer.value;e.authentication&&e.authentication?.Portal&&e.authentication?.Portal.helperServices.aiAssistantServices&&(this.serverRoot=e.authentication?.Portal.helperServices.aiAssistantServices.url)}}};xe("arcgis-solutions-assistant",te);return te},a)
174
+ `}_renderNoSign(){return x`<calcite-notice open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage??X} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`}_renderNoPermission(){return x`<calcite-notice open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${J(this._translations.noPermissionMessage.replace("{{orgUrl}}",Lt).replace("{{configAI}}",Pt))}</div></calcite-notice>`}render(){return x`<calcite-dialog class="chat-panel" .open=${this.open} .heading=${this._translations.solutionAssistantTitle} placement=bottom-start @calciteDialogClose=${()=>{this.closeAssistant.emit(!0),this.open=!1}}><span class="chat-panel-heading" slot=header-content><span class="padding-right-8">${this._translations.solutionAssistantTitle}</span><calcite-chip .label=${this._translations.betaTag} .value=${this._translations.betaTag}>${this._translations.betaTag}</calcite-chip></span>${this.messages.length>1?x`<calcite-button appearance=transparent class="icon-color-background" .disabled=${!!this._isLoading||this._isTyping} id=newChatButton icon-end=speech-bubble-plus kind=neutral label="New conversation" @click=${this.resetChat} scale=l slot=header-actions-end></calcite-button><calcite-tooltip placement=bottom reference-element=newChatButton><span>${this._translations.tooltips.newConversation}</span></calcite-tooltip>`:""}<div class="chat-messages" ${G(this._setMessageContainerRef)}>${this.messages.map(e=>e.render)}${this._isLoading&&x`<calcite-card class="loader-message"><div class="message-content display-flex-row"><calcite-loader .label=${this._isLoadingText} inline scale=s></calcite-loader>${this._isLoadingText!=""&&x`<div class="padding-left-10">${this._isLoadingText}</div>`||""}</div></calcite-card>`||""}${this._chatContainer&&!this._isAtBottom(this._chatContainer)&&!this._isAutoScroll&&x`<calcite-fab icon=arrow-down @click=${()=>{this._isAutoScroll=!0,this._scrollToBottom(),setTimeout(()=>{this.requestUpdate()},100)}} scale=m></calcite-fab>`||""}${this._configContextConsumer.value?.userSession?.token?this._configContextConsumer.value?.authentication?.CanUseAI?"":this._renderNoPermission():this._renderNoSign()}</div><div slot=footer class="width-100"><div class="chat-input"><calcite-text-area .disabled=${!this._configContextConsumer.value?.userSession?.token||!this._configContextConsumer.value?.authentication?.CanUseAI} resize=none rows=3 .placeholder=${this._translations.sendMessage} value ${G(this._setInputRef)}></calcite-text-area><calcite-button appearance=outline .disabled=${!!this._isLoading||this._isTyping||!this._configContextConsumer.value?.userSession?.token||!this._configContextConsumer.value?.authentication?.CanUseAI} icon-start=send id=sendQuestion kind=neutral icon-flip-rtl=start @click=${()=>{this._inputRef&&(this.handleSendMessage(this._inputRef.value.trim()),this._inputRef.value="")}} @keydown=${e=>Q(e,()=>{this._inputRef&&(this.handleSendMessage(this._inputRef.value.trim()),this._inputRef.value="")})}></calcite-button><calcite-tooltip placement=bottom reference-element=sendQuestion><span>${this._translations.tooltips.sendQuestion}</span></calcite-tooltip></div><div class="disclaimer-div padding-top-10" slot=footer><calcite-icon icon=information scale=s></calcite-icon>${this._translations.disclaimerMessage}<a href=https://links.esri.com/solutions/security-concern target=_blank>${this._translations.reportConcern}</a></div></div></calcite-dialog>`}_scrollToBottom(){this._chatContainer&&this._isAutoScroll&&setTimeout(()=>{this._chatContainer&&(this._chatContainer.scrollTop=this._chatContainer.scrollHeight)},100)}_emitItemIdFromAI(e){let t=new CustomEvent("solutionIDFromAssistant",{detail:e,bubbles:!0,composed:!0});window.dispatchEvent(t)}_submitFollowupQuestion(e){let t=new CustomEvent("submitQuestion",{detail:e,bubbles:!0,composed:!0});window.dispatchEvent(t)}_getMostRecentQuestion(){return[...this.messages].reverse().find(e=>e.author==="human")||null}_sendFeedback(e,t,n,s,a){let r=`https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(n)}&field:question=${encodeURIComponent(t)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({intent:a}))}&field:conversation_id=${encodeURIComponent(s)}&field:version=${encodeURIComponent("v1")}`;window.open(r,"_blank")}_copyResponseToClipboard(e,t){navigator.clipboard.writeText(e);let n=t.currentTarget;n.iconStart="check",setTimeout(()=>{n.iconStart="copy"},3e3)}_startTypeWriter(e,t,n,s,a){if(t.length>0){e.setText(t);let r=async()=>{e.updateDisplayText();let l=e.getText(),o=await k.parse(l);n.innerHTML=o.replace(/<a\s+/g,'<a target="_blank" '),l.length<this._currentResponse.length?(this._scrollToBottom(),setTimeout(r,5)):(this._isTyping=!1,this._isAutoScroll=!1,s.classList.remove("display-none"),a.classList.remove("display-none"))};r()}}_showCardById(e){let t=this.renderRoot.querySelector(`#${e}`);t&&t.classList.remove("display-none")}_isAtBottom(e){return e.scrollTop+e.clientHeight>=e.scrollHeight-5}async _loadUserFirstName(){try{let e=await this._configContextConsumer.value?.userSession?.getUser();if(e?.fullName){let t=e.fullName.split(" ")[0];this.userFirstName=t}}catch{}}_getAIServiceUrl(){if(this._configContextConsumer.value){let e=this._configContextConsumer.value;e.authentication&&e.authentication?.Portal&&e.authentication?.Portal.helperServices.aiAssistantServices&&(this.serverRoot=e.authentication?.Portal.helperServices.aiAssistantServices.url)}}};me("arcgis-solutions-assistant",te);return te},a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
2
+ import{a as x}from"./YUDZU2OW.js";import d from"./XVCTCPQP.js";import{b as c}from"./77CU4WA2.js";import{a as b}from"./6D3THEX6.js";import{b as m}from"./RFGSSUZF.js";import{F as r,G as a,H as _,J as o,K as n,h as f,i as s,r as g}from"./5CQPQ7AE.js";export default $arcgis.t(([{D:h,E:d,K:p,a:v,b:y}])=>{var w=f`.display-flex{display:flex}.border-override{border-top-width:var(--calcite-border-width-none);border-bottom-width:var(--calcite-border-width-none)}.header-override{--calcite-panel-header-content-space: 0px;--calcite-panel-header-background-color: var(--calcite-color-foreground-2)}.panel-override{--calcite-panel-background-color: var(--calcite-color-foreground-2);--calcite-panel-border-color: none}.label-override{--calcite-label-margin-bottom: 0px;font-weight:var(--calcite-font-weight-medium)}.header-button-padding{padding-top:var(--calcite-spacing-sm);padding-bottom:var(--calcite-spacing-sm);padding-inline-start:var(--calcite-spacing-lg);padding-inline-end:var(--calcite-spacing-lg)}.padding-start{padding-inline-start:var(--calcite-spacing-lg)}.align-items-center{align-items:center}.justify-content-end{justify-content:end}.filter-width-350{--calcite-shell-panel-width: 350px}.z-index-1{z-index:1}.z-index-2{z-index:2}h1{font-weight:unset;margin:0;padding:0}@media(max-width:800px){.filter{display:none}}.mock-fab{--calcite-fab-shadow-internal: 0 6px 20px -4px rgba(0, 0, 0, .1), 0 4px 12px -2px rgba(0, 0, 0, .08);box-shadow:var(--calcite-fab-shadow, var(--calcite-fab-shadow-internal));--calcite-button-background-color: var(--calcite-fab-background-color);--calcite-button-border-color: var(--calcite-fab-border-color);--calcite-button-text-color: var(--calcite-fab-text-color);--calcite-button-loader-color: var(--calcite-fab-loader-color)}.background-override{--calcite-shell-panel-background-color: var(--calcite-color-foreground-3);--calcite-panel-background-color: var(--calcite-color-foreground-3)}.chips-container{display:flex;flex-wrap:wrap;align-items:center;gap:var(--calcite-spacing-xs);flex:1;padding-block:var(--calcite-spacing-xs)}.header-content-wrapper{min-height:50px;flex-wrap:wrap;gap:var(--calcite-spacing-xs);padding-inline-start:var(--calcite-spacing-md)}.position-relative{position:relative}.height-100{height:100%}.border-none{border:none}.height-50{height:50px}.padding-top-3{padding-top:3px}.chip-group{max-width:100%}.chip-group{display:flex;flex-wrap:wrap}.responsive-chip{max-width:100%}.responsive-chip .chip-text{display:inline-flex;align-items:center;line-height:1;max-width:100%}@media(max-width:800px){.responsive-chip{max-width:100%;min-width:0}.responsive-chip .chip-text{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}}`,u=class extends _{constructor(){super(),this.solutionsCount=0,this._isLoading=!0,this._filterOpen=!0,this._filters={categories:[],searchTerm:""},this._isMobile=!1,this._translations=b({name:"solutions-all-shell",blocking:!0}),this._allSolutionsPanelRef=r(),this._solutionsFilterPanelRef=r(),this._mainPanelRef=r(),this._panelFixed=!1,this._configContextConsumer=c({context:y,subscribe:!0}),this._isMobileContextConsumer=c({context:v,subscribe:!0,callback:e=>this._isMobile=e}),this.filterRemoved=g(),this.listenOn(window,"searchChanged",e=>{e.detail&&e.detail.scope==="all-solutions"&&this._filterApplied(e.detail.option,e.detail.logSearchTelemetry)}),this.listenOn(window,"toggleFilter",this._toggleFilter),this.listenOn(window,"cardsFetched",()=>{this._isLoading=!1})}static{this.properties={solutionsCount:9,_isLoading:16,_filterOpen:16,_filters:16,_isMobile:16,_translations:16}}static{this.styles=w}willUpdate(e){e.has("_isMobile")&&(this._filterOpen=!this._isMobile)}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}async searchSolutions(e){if(this._allSolutionsPanelRef.value.setSearchOptions(e),"industry"in e||"domain"in e){e.displayValue=e.domain||e.industry;let t=e.industry?Object.entries(h).find(([,l])=>l===e.industry)?.[0]:void 0,i=e.domain?Object.entries(d).find(([,l])=>l===e.domain)?.[0]:void 0;e.industry=t||"",e.domain=i||"",e.value=i||t||"",this._solutionsFilterPanelRef.value.changeIndustryFilter(e.industry,e.domain,e.displayValue,!0)}else("searchTerm"in e||"sortType"in e)&&("searchTerm"in e&&(this._filters.searchTerm=e.searchTerm),this._allSolutionsPanelRef.value?.searchSolutions(e))}async load(){this._isMobileContextConsumer.value&&(this._isMobile=this._isMobileContextConsumer.value)}updated(){this._fixPanelContentWrapperFocus()}_fixPanelContentWrapperFocus(){if(!this._panelFixed&&this._mainPanelRef.value){let e=this._mainPanelRef.value;e.componentOnReady?.().then(()=>{if(e.shadowRoot){let t=e.shadowRoot.querySelector(".content-wrapper");t&&(t.tabIndex=-1,this._panelFixed=!0,this._setupPanelObserver())}}).catch(()=>{this._panelFixed=!0})}}_setupPanelObserver(){if(this._panelObserver)return;this._panelObserver=new MutationObserver(t=>{t.forEach(i=>{if(i.type==="attributes"&&i.attributeName==="tabindex"){let l=i.target;l.classList.contains("content-wrapper")&&l.tabIndex===0&&(l.tabIndex=-1)}})});let e=this._mainPanelRef.value;if(e?.shadowRoot){let t=e.shadowRoot.querySelector(".content-wrapper");t&&this._panelObserver.observe(t,{attributes:!0,attributeFilter:["tabindex"]})}}disconnectedCallback(){super.disconnectedCallback(),this._panelObserver?.disconnect()}render(){let e=this._isMobile?"justify-content-end":"",t=this._isLoading?"display-none":"";return s`<calcite-shell class=${`position-relative ${t}`}>${this._isMobile?"":this._getFilterPanel()}<h1 class="height-100"><calcite-panel class="border-override header-override panel-override z-index-1" ${a(this._mainPanelRef)}><div class=${o(this._isMobile?`header-content-wrapper ${e}`:`display-flex align-items-center header-content-wrapper ${e}`)} slot=header-content><calcite-label class="label-override padding-top-3">${this._translations.numberOfSolutions.replace("{{count}}",this.solutionsCount.toString())}</calcite-label><div class="chips-container">${this._renderChips()}${this._filters.categories&&this._filters.categories?.length>0&&s`<calcite-button appearance=transparent icon-start=reset kind=neutral @click=${()=>{this._filters={...this._filters,categories:[]},this._allSolutionsPanelRef.value?.searchSolutions(this._filters.categories),this.filterRemoved.emit([])}} .label=${this._translations.clearIndustryFilter}>${this._translations.clearIndustryFilter}</calcite-button>`||""}</div></div>${this._isMobile&&this._getFilterPanel()||""}${this._getSolutionsAllPanel()}</calcite-panel></h1></calcite-shell>`}_getFilterPanel(){let e=this._filterOpen?{display:"flex"}:"";return this._isMobile?s`<calcite-panel class=${`border-none ${this._filterOpen?"background-override":"filter background-override"}`} id=solutions-all-shell-panel-start style=${n(e)}><solutions-filter-panel class="height-100" @applyFilter=${t=>{this._filterApplied(t.detail)}} ${a(this._solutionsFilterPanelRef)}></solutions-filter-panel></calcite-panel>`:s`<calcite-shell-panel class="filter background-override filter-width-350" id=solutions-all-shell-panel-start slot=panel-start style=${n(e)}><calcite-panel class="border-none"><solutions-filter-panel class="height-100" @applyFilter=${t=>{this._filterApplied(t.detail)}} ${a(this._solutionsFilterPanelRef)}></solutions-filter-panel></calcite-panel></calcite-shell-panel>`}_getSolutionsAllPanel(){let e=this._isMobile&&this._filterOpen?{display:"none"}:"";return s`<solutions-all-panel @cardsFetched=${this._updateSolutionCount} style=${n(e)} ${a(this._allSolutionsPanelRef)}></solutions-all-panel>`}_renderChips(){if(!this._filters.categories)return;let e=this._filters.categories.filter(t=>t.type==="industry"||t.type==="domain");if(e.length!==0)return s`<calcite-chip-group class="chip-group" label>${x(e,t=>`${t.type}:${t.value}`,t=>s`<calcite-chip appearance=outline-fill class=${o(this._isMobile?"responsive-chip":"padding-start responsive-chip")} closable .label=${t.displayValue} @calciteChipClose=${()=>this._chipClosed(t.displayValue,t.type)} .value=${t.displayValue}>${t.displayValue}</calcite-chip>`)}</calcite-chip-group>`}_updateSolutionCount(e){this.solutionsCount=e.detail}_chipClosed(e,t){if(this._filters.categories){if(t==="industry")this._filters.categories=[];else{let i=this._filters.categories.filter(l=>l.displayValue!==e&&l.type!==t);this._filters.categories=i}this._filters.categories.length>0?this._allSolutionsPanelRef.value?.searchSolutions(this._filters.categories):this._filters.searchTerm!==""?(this._allSolutionsPanelRef.value?.searchSolutions(this._filters.categories),this._allSolutionsPanelRef.value?.searchSolutions({searchTerm:this._filters.searchTerm})):this._allSolutionsPanelRef.value?.searchSolutions(),this.filterRemoved.emit(this._filters.categories)}}_toggleFilter(){this._filterOpen=!this._filterOpen}_logFilterTelemetry(e){if((e.type==="industry"||e.type==="domain")&&e.industry){let t=[h[e.industry]];if(e.domain){let i=d[e.domain];t.push(i)}this._telemetry?.logEvent({category:p.ALL_SOLUTIONS,action:"Filter",dimensions:t})}}_filterApplied(e,t){if(this._filters.categories)if(e){let i=e;if("displayValue"in e)this._filters.categories.push(e),this._logFilterTelemetry(e);else if(Array.isArray(e)&&e.length>0){e.length>=2&&(i=[e[e.length-1]]),this._filters={categories:e,searchTerm:this._filters.searchTerm};let l=e[e.length-1];l&&this._logFilterTelemetry(l)}if("searchTerm"in i&&(this._filters.searchTerm=i.searchTerm,t&&i.searchTerm)){this._telemetry?.logEvent({category:p.ALL_SOLUTIONS,action:"Search",dimensions:[i.searchTerm]});return}this._allSolutionsPanelRef.value?.searchSolutions(i)}else this._filters.categories=[],this._allSolutionsPanelRef.value?.searchSolutions()}};m("solutions-all-shell",u);return u},d)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
2
+ import g from"./LOQNTCQ5.js";import e from"./VTCGJW3Y.js";import"./5XHAT3I6.js";import"./UHIFNZFJ.js";import"./DC5KIXAN.js";import"./YMMGYOOO.js";import d from"./XVCTCPQP.js";import"./77CU4WA2.js";import"./T4PIUXJ7.js";import c from"./7YWKXUNB.js";import a from"./CQPE3DP5.js";import{a as y}from"./6D3THEX6.js";import"./5IZMQFRP.js";import"./FOQPGXXA.js";import"./ED6SUP22.js";import"./E6P6PYNW.js";import"./IKKBLHLZ.js";import"./CUA2IUXX.js";import"./4UZDZNJD.js";import"./KOTG6W5Z.js";import"./6SC7YR5Y.js";import"./Z6NOHRUL.js";import"./GVM4XYEI.js";import"./NGDVSE4Z.js";import"./BTNJZZQQ.js";import"./ZYQ4P2ON.js";import"./5MKH4QDV.js";import"./3GWWHA4S.js";import"./3YYHZQJB.js";import"./JEJ23R3P.js";import"./TONS7KZJ.js";import"./Q62UEPOL.js";import"./44A5XEM4.js";import{b as u}from"./RFGSSUZF.js";import{G as f,H as b,h as p,i as m}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([])=>{var v=p`.height-51{height:51px}.width-51{width:51px}`,h=class extends b{constructor(){super(),this._translations=y({name:"field-selection",blocking:!0}),this._fieldSortOrder="default",this._selectedFields=[],this._fieldVisibilityPopoverClickHandler=i=>{this._fieldVisibilityPopoverNode?this._isInNode(i.target,"arcgis-field-pick-list")||(document.body.removeChild(this._fieldVisibilityPopoverNode),this._fieldVisibilityPopoverNode=void 0,document.removeEventListener("click",this._fieldVisibilityPopoverClickHandler)):document.removeEventListener("click",this._fieldVisibilityPopoverClickHandler)},this.listenOn(window,"columnReorder",this.handleColumnReorder,{capture:!0})}static{this.properties={configExtraFields:1,layer:0,mapView:0,table:0,tableRef:0,_translations:16}}static{this.styles=v}render(){return m`<calcite-action alignment=center appearance=solid class="height-51 width-51" id=solutions-field-selection .text=${this._translations.fieldVisibility} scale=m @click=${()=>this._handleFieldVisibilityClick()} @mouseover=${()=>this._addTableTooltip(this._fieldVisibilityActionNode,this._translations.fieldVisibility)} @mouseout=${()=>this._removeTableTooltip()} @focus=${()=>this._addTableTooltip(this._fieldVisibilityActionNode,this._translations.fieldVisibility)} ${f(i=>this._fieldVisibilityActionNode=i)}><calcite-icon scale=s icon=gear></calcite-icon></calcite-action>`}handleColumnReorder(){this._fieldSortOrder="default",this._fieldVisibilityPopoverNode&&(this.removeFieldsPickList(),this._handleFieldVisibilityClick())}_handleFieldVisibilityClick(){if(this._fieldVisibilityPopoverNode)return;let i=this.table?.tableTemplate?.columnTemplates;if(this.layer&&this.mapView&&i&&this._fieldVisibilityActionNode){document.removeEventListener("click",this._fieldVisibilityPopoverClickHandler);let t=this.table.fieldColumns.map(l=>({alias:l.field.alias,description:l.field.description,name:l.field.name,type:l.field.type}));if(this._hasAttachmentsEnabled(this.layer)){let l="Attachments";if(this._shouldShowField(l.toUpperCase(),!1)){if(!i.some(s=>s.fieldName.toUpperCase()===l.toUpperCase())){let s={fieldName:l,type:"attachment",visible:!0};i.push(s)}t.push({name:l,alias:"Photos and files",type:"none",description:l})}}if(this.table.relatedRecordsEnabled&&this.layer.relationships&&this.layer.relationships.length>0){let l=this.layer.parent;this.layer.relationships.forEach(s=>{let o,d=this._shouldShowField(s.name||"",!0);if(!i.some(a=>a.fieldName.toLowerCase()===s.name?.toLowerCase()?(o=s.name,!0):!1))if(s.name){o=s.name;let a={fieldName:o,type:"relationship",visible:!0};d=this._shouldShowField(o,!0),i.push(a)}else{let a=[...l?.layers||[],...l?.tables],c;if(a.some(n=>n.layerId===s.relatedTableId?(c=n,!0):!1),c){o=c.title,s.name=o;let n={fieldName:o,type:"relationship",visible:!0};d=this._shouldShowField(o,!0),i.push(n)}}o&&d&&t.push({name:o,alias:`Related ${o}`,type:"none",description:`related:${o}`})})}let e=this._fieldVisibilityPopoverNode?this._fieldVisibilityPopoverNode:document.createElement("arcgis-field-pick-list");e.layer=this.layer,e.fields=t,e.showFieldInfo=!0,e.showFieldName=!0,e.showDescription=!1,e.showSelectionAll=!0,e.hideCancel=!0,e.hideSort=!1,e.showFilterLength=5,e.multiple=!0,e.heading=this._translations.fieldVisibility,e.okBtnText=this._translations.doneWithFieldChanges,e.filterPlaceholderText=this._translations.filterFields,e.sortBy=this._fieldSortOrder??"default";let r=this.table?.visibleColumns.map(l=>l.fieldName.startsWith("EsriFeatureTableRelationshipColumn")||l.fieldName.startsWith("EsriFeatureTableAttachmentsColumn")?l.effectiveLabel:l.fieldName);e.selectedFields=i.reduce((l,s)=>((r?r.indexOf(s.fieldName)>-1:s.visible)&&l.push(s.fieldName),l),[]),this._selectedFields=e.selectedFields,e.style.minHeight="340px",e.popoverProps={refElement:this._fieldVisibilityActionNode,popoverWidth:300,placement:"bottom-end",offsetDistance:-20,triggerDisabled:!1,autoClose:!1},e.addEventListener("arcgisChange",l=>{l.stopPropagation();let s=l.detail.selectedFields,o=this._getDifference(s,this._selectedFields),d=this._getDifference(this._selectedFields,s);o.concat(d).forEach(a=>{let c=this.layer?.relationships?.map(n=>n.name)||[];if(a==="Attachments"){let n=this.table.columns.find(_=>"onShowAttachments"in _);n.hidden=d.indexOf(a)>-1}else c.indexOf(a)>-1?this.table.columns.filter(n=>"relationshipId"in n).forEach(n=>{d.indexOf(a)>-1,a==n.effectiveLabel&&(n.hidden=d.indexOf(a)>-1)}):this.table.toggleColumnVisibility(a)}),this._selectedFields=s,this._updateTable(this.table.tableTemplate)}),e.addEventListener("arcgisSortByChange",l=>{l.stopPropagation(),this._fieldSortOrder=l.detail,this._sortFields(l.detail)}),e.addEventListener("arcgisClose",()=>{this._closePopovers(),setTimeout(()=>this._fieldVisibilityActionNode.setFocus(),200)}),document.body.appendChild(e),this._fieldVisibilityPopoverNode=e,setTimeout(()=>document.addEventListener("click",this._fieldVisibilityPopoverClickHandler),200)}}_shouldShowField(i,t){return(this.configExtraFields||[]).some(e=>t?e.replace("related:","").toUpperCase()===i.toUpperCase():e.toUpperCase()===i.toUpperCase())}removeFieldsPickList(){this._fieldVisibilityPopoverNode&&(document.body.removeChild(this._fieldVisibilityPopoverNode),this._fieldVisibilityPopoverNode=void 0)}_sortFields(i){let t=this.table.tableTemplate.columnTemplates,e=this._getSortOrder(i),r=t.filter(s=>s.type!=="attachment"&&s.type!=="relationship").sort((s,o)=>{let d=e.indexOf(s.fieldName),a=e.indexOf(o.fieldName);return d===-1&&a!==-1?1:d!==-1&&a===-1?-1:d===-1&&a===-1?0:d-a}),l=t.filter(s=>s.type==="attachment"||s.type==="relationship");this.tableRef.setColumnOrder([...r,...l]),this._updateTable(this.table.tableTemplate)}_getSortOrder(i){let t=[...this.layer.fields];return i==="display"?t.sort((e,r)=>e.alias.localeCompare(r.alias)):i==="field"?t.sort((e,r)=>e.name.localeCompare(r.name)):i==="type"&&t.sort((e,r)=>e.type.localeCompare(r.type)),t.map(e=>e.name)}_getDifference(i,t){return i.filter(e=>!t.includes(e))}_updateTable(i){this.table.tableTemplate=i,this._isStandardView()&&this._syncAttributeTableTemplate()}async _syncAttributeTableTemplate(){let i=this.table.layer;if(i.attributeTableTemplate){let{_modules:t}=this,e=i.attributeTableTemplate.clone();t?.attributeTableTemplateUtils.syncAttributeTableTemplate(this.table,e),JSON.stringify(e)!==JSON.stringify(i.attributeTableTemplate)&&(i.attributeTableTemplate=e)}if(i.attributeTableTemplate?.orderByFields?.length>1){let t=i.attributeTableTemplate.clone(),e=this.table.activeSortOrders[0];t.orderByFields=[{field:e.fieldName,order:e.direction}],i.attributeTableTemplate=t,this._syncColumnDirectionsWithOrderByFields()}}_syncColumnDirectionsWithOrderByFields(){let i=this.table.activeSortOrders[0]?.fieldName;this.table.columns.forEach(t=>{"fieldName"in t&&t.fieldName!==i&&(t.direction=void 0)}),this.table.tableTemplate?.columnTemplates.forEach(t=>{"fieldName"in t&&t.fieldName!==i&&(t.direction=void 0)})}_isStandardView(){return!this.table.relatedTable&&!this.table.attachmentsViewOptions.objectId}_closePopovers(){document.removeEventListener("click",this._fieldVisibilityPopoverClickHandler),this._fieldVisibilityPopoverNode&&(document.body.removeChild(this._fieldVisibilityPopoverNode),this._fieldVisibilityPopoverNode=void 0)}_addTableTooltip(i,t){let e=document.createElement("calcite-tooltip");e.className="table-tooltip",e.referenceElement=i,e.placement="trailing-start",e.open=!0;let r=document.createElement("div");r.className="tooltip",r.innerHTML=t,e.append(r),document.body.append(e)}_removeTableTooltip(){document.querySelectorAll(".table-tooltip").forEach(i=>i.parentNode?.removeChild(i))}_isInNode(i,t){for(;i;){if(i.nodeName===t.toUpperCase())return!0;i=i.parentElement}return!1}_hasAttachmentsEnabled(i){if(!i?.capabilities)return!1;let{capabilities:{data:{supportsAttachment:t},operations:{supportsQueryAttachments:e}}}=i;return t&&e}};u("field-selection",h);return h},a,c,d,e,g)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
2
+ import{a as F}from"./YUDZU2OW.js";import a from"./XVCTCPQP.js";import{b as g}from"./77CU4WA2.js";import{a as I}from"./6D3THEX6.js";import{b}from"./RFGSSUZF.js";import{H as S,J as N,h as A,i as c,r as m}from"./5CQPQ7AE.js";export default $arcgis.t(([{D:y,K:T,a:C,b:R,t:_}])=>{var v=A`.width-full{width:100%}calcite-panel{--calcite-panel-background-color: var(--calcite-color-foreground-1);--calcite-panel-footer-space: var(--calcite-spacing-sm)}.border-color{--calcite-block-border-color: transparent}calcite-block{margin:0;--calcite-block-content-space: 0}.tree-padding{padding:0 .2rem}.display-none{display:none}`,f={PUBLICSAFETY:["EMERGENCYMANAGEMENT","FIRESERVICE","LAWENFORCEMENT"],STATEANDLOCALGOVERNMENT:["AGRICULTURE","AIRPORT","ASSESSMENTANDTAXATION","ELECTIONS","EMERGENCYMANAGEMENT","FIRESERVICE","FISHANDWILDLIFE","HEALTHANDHUMANSERVICES","LAWENFORCEMENT","NATURALRESOURCES","PARKS","PLANNINGANDDEVELOPMENT","PUBLICWORKS","TRANSPORTATION"],UTILITIES:["DISTRICTENERGY","ELECTRIC","GAS","SEWER","STORMWATER","WATER"]},O=Object.keys(y).reduce((u,t)=>{let e=t;return u[e]=f[e]??[],u},{}),E=class extends S{constructor(){super(),this.hideIndustryFilter=!1,this.isAIDialogOpen=!1,this.showReset=!1,this._activeFilterSettings={categories:[]},this._isMobile=!1,this._translations=I({name:"solutions-filter-panel",blocking:!0}),this._userFirstName="",this._configContextConsumer=g({context:R,subscribe:!0,callback:t=>{t?.userSession&&!this._userFirstName&&this._loadUserFirstName()}}),this._isMobileContextConsumer=g({context:C,subscribe:!0,callback:t=>this._isMobile=t}),this.applyFilter=m(),this.toggleFilter=m(),this._handleFilterRemoved=t=>{let e=t.detail;Array.isArray(e)&&(this._activeFilterSettings={...this._activeFilterSettings,categories:[...e]})},this._industryMatchName=t=>{let e=Object.keys(this._translations.industries).find(r=>r.toUpperCase()===t.replaceAll(" ","").toUpperCase());return e&&e in this._translations.industries?this._translations.industries[e]:t},this.listenOn(window,"filterRemoved",this._handleFilterRemoved),this.listenOn(window,"closeAssistant",()=>{this.isAIDialogOpen=!1}),this.listenOn(window,"openAssistant",()=>{this.isAIDialogOpen=!0})}static{this.properties={hideIndustryFilter:5,isAIDialogOpen:5,showReset:5,_activeFilterSettings:16,_isMobile:16,_translations:16,_userFirstName:16}}static{this.styles=v}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}changeIndustryFilter(t,e,r,h){if(t!==""||e!==""){let n=[];if(e!==""){let i=y[t];n=[{displayValue:this._industryMatchName(i),type:"industry",value:t,industry:t,domain:""},{displayValue:r,type:"domain",value:e,industry:t,domain:e}]}else n=[{displayValue:r,type:e!==""?"domain":"industry",value:e!==""?e:t,industry:t,domain:e}];this._activeFilterSettings={...this._activeFilterSettings,categories:[...n]},h&&this.applyFilter.emit(n)}else{let n={displayValue:r,type:"industry",value:t,industry:t,domain:e};this._activeFilterSettings={...this._activeFilterSettings,categories:[n]},h&&this.applyFilter.emit(n)}}clearFilters(){this.changeIndustryFilter("","",""),this.applyFilter.emit(null)}async load(){await this._loadUserFirstName(),this._isMobileContextConsumer.value&&(this._isMobile=this._isMobileContextConsumer.value)}render(){return c`<calcite-panel description heading>${this.showReset&&c`<calcite-action appearance=solid icon=reset @click=${()=>{this.clearFilters()}} slot=header-actions-end .text=${this._translations.resetFilters} text-enabled></calcite-action>`||""}<calcite-block-group .label=${this._translations.filters} scale=l>${!this.hideIndustryFilter&&this.renderIndustryBlock()||""}</calcite-block-group><calcite-button id=solutions-assistant-button icon-start=speech-bubbles label="Solutions Assistant" @click=${()=>{this._telemetry?.logEvent({category:T.ASSISTANT,action:"Open"}),this.isAIDialogOpen=!0}} round scale=l slot=footer-start></calcite-button><calcite-tooltip reference-element=solutions-assistant-button placement=right slot=footer-start offset-distance=10 open><span>${this._translations.assistant.welcomeTip}</span></calcite-tooltip><arcgis-solutions-assistant .open=${this.isAIDialogOpen} .userFirstName=${this._userFirstName}></arcgis-solutions-assistant></calcite-panel>`}renderIndustryBlock(){let t=(i,a)=>!this._activeFilterSettings||!this._activeFilterSettings.categories?!1:this._activeFilterSettings.categories.some(s=>s.industry===i&&(s.domain??"")===a),e=i=>!this._activeFilterSettings||!this._activeFilterSettings.categories?!1:this._activeFilterSettings.categories.some(a=>a.industry===i&&(a.domain??"")===""),r=(i,a)=>a.length>0&&(e(i)||this._activeFilterSettings.categories?.some(s=>s.industry===i&&!!s.domain&&a.includes(s.domain))===!0),h=(i,a)=>F(a,s=>s,s=>{let o=Object.keys(this._translations.industriesDomain).find(l=>l.toUpperCase()===s.toUpperCase()),d=o&&o in this._translations.industriesDomain?this._translations.industriesDomain[o]:s,p=t(i,s);return c`<calcite-tree-item .label=${d} @click=${l=>{l.detail!==0&&this.changeIndustryFilter(i,s,d,!0)}} @keydown=${l=>{_(l,()=>{this.changeIndustryFilter(i,s,d,!0)})}} .selected=${p||void 0}>${d}</calcite-tree-item>`}),n=F(Object.entries(O),([i,a])=>i,([i,a])=>{let s=this._industryMatchName(i),o=a,d=e(i),p=r(i,o);return c`<calcite-tree-item .label=${s} @click=${l=>{l.detail!==0&&this.changeIndustryFilter(i,"",s,!0)}} @keydown=${l=>{_(l,()=>{this.changeIndustryFilter(i,"",s,!0)})}} .selected=${d||void 0} .expanded=${p?!0:void 0}>${s}${o.length>0&&c`<calcite-tree slot=children selection-mode=multiple>${h(i,o)}</calcite-tree>`||""}</calcite-tree-item>`});return c`<calcite-block description expanded class="border-color" .heading=${this._translations.industriesHeader} .label=${this._translations.industriesHeader}><calcite-action class=${N(this._isMobile?"":"display-none")} icon=x @click=${this._toggleFilter} slot=content-end text></calcite-action><calcite-tree selection-mode=single-persist class="tree-padding">${n}</calcite-tree></calcite-block>`}_toggleFilter(){this.toggleFilter.emit()}async _loadUserFirstName(){try{let t=await this._configContextConsumer.value?.userSession?.getUser();if(t?.fullName){let e=t.fullName.split(" ")[0];this._userFirstName=e}}catch{}}};b("solutions-filter-panel",E);return E},a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
2
+ import b from"./FKEZD3IR.js";import a from"./XVCTCPQP.js";import"./77CU4WA2.js";import"./T4PIUXJ7.js";import"./6D3THEX6.js";import"./5IZMQFRP.js";import"./FOQPGXXA.js";import"./ED6SUP22.js";import"./E6P6PYNW.js";import"./IKKBLHLZ.js";import"./CUA2IUXX.js";import"./4UZDZNJD.js";import"./KOTG6W5Z.js";import"./6SC7YR5Y.js";import"./Z6NOHRUL.js";import"./GVM4XYEI.js";import"./NGDVSE4Z.js";import"./BTNJZZQQ.js";import"./ZYQ4P2ON.js";import"./5MKH4QDV.js";import"./3GWWHA4S.js";import"./3YYHZQJB.js";import"./JEJ23R3P.js";import"./TONS7KZJ.js";import"./Q62UEPOL.js";import"./44A5XEM4.js";import"./RFGSSUZF.js";import"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([,{c:o}])=>{return o},a,b)