@esri/solutions-components 1.2.0-next.131 → 1.2.0-next.132

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.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
2
- import f from"./K7QPA2E6.js";import"./KISABCMW.js";import e from"./TYCZQV4N.js";import d from"./TIUYIRSM.js";import c from"./4YJ7ZD32.js";import"./I5GF7UR6.js";import b from"./YV3EI5XV.js";import a from"./6KLGSVI4.js";import"./W4773WDH.js";import"./77CU4WA2.js";import"./4Q4PZB7R.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(([,,,,,a])=>{return a},a,b,c,d,e,f)
2
+ import f from"./LGWDPFR4.js";import"./KISABCMW.js";import e from"./TYCZQV4N.js";import d from"./TIUYIRSM.js";import c from"./4YJ7ZD32.js";import"./I5GF7UR6.js";import b from"./YV3EI5XV.js";import a from"./6KLGSVI4.js";import"./W4773WDH.js";import"./77CU4WA2.js";import"./4Q4PZB7R.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(([,,,,,a])=>{return a},a,b,c,d,e,f)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
2
- import t from"./AJUED7I2.js";import s from"./TLHZREWE.js";import r from"./Q4XPFYA2.js";import"./M3L2UEHW.js";import q from"./LQQZM2CG.js";import o from"./JXAGLAH5.js";import m from"./PL3NZFP4.js";import j from"./K7QPA2E6.js";import"./KISABCMW.js";import i from"./TYCZQV4N.js";import h from"./TIUYIRSM.js";import g from"./4YJ7ZD32.js";import e from"./LU6E7GNX.js";import"./YUDZU2OW.js";import"./I5GF7UR6.js";import d from"./YV3EI5XV.js";import c from"./6KLGSVI4.js";import{a as w,b as k}from"./W4773WDH.js";import{a as u}from"./77CU4WA2.js";import"./4Q4PZB7R.js";import{a as f}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 C}from"./RFGSSUZF.js";import{F as a,G as l,H as S,J as b,h as v,i as p,r as n}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([,,,{c:I,k:_,l:x,n:c},,,,{b:D},,,{g:$,h:A},,{a:m},,,{a:y,b:T}])=>{var L=v`.back-color-override{background-color:var(--calcite-color-foreground-2);--calcite-tab-border-color: var(--calcite-color-foreground-3)}.display-none{display:none!important}.height-100{height:100%}calcite-tab-nav{padding-bottom:6px;padding-top:6px}calcite-tabs{--calcite-tab-border-color: var(--calcite-color-border-3);--calcite-color-focus: transparent;height:100%}.tab-space-0{--calcite-tab-content-space-y: var(--calcite-spacing-none)}.tab-space-md{--calcite-tab-content-space-y: var(--calcite-spacing-md)}solutions-searchsort-toolbar,solutions-deploy-app-nav,solution-details-panel,solutions-resources-shell,solutions-deployed-shell,solutions-all-shell,calcite-tab-nav,solution-deployed-card-panel{width:1440px;display:block;max-width:96vw;padding-right:var(--calcite-spacing-none);padding-left:var(--calcite-spacing-none);margin-left:auto;margin-right:auto;box-sizing:border-box}.border{height:var(--calcite-spacing-px);border-bottom-color:var(--calcite-color-border-3);border-bottom-style:solid;border-bottom-width:var(--calcite-border-width-sm);box-sizing:border-box}.overflow-auto{overflow:auto}solution-details-panel{scroll-margin-top:3rem}`,g=class extends S{constructor(){super(),this.initTitleOrId="",this.sortType="relevance",this.useLocalAppConfig=!1,this.authentication=void 0,this._isLoaded=!1,this.isMobile=!1,this._activeTab="all-solutions",this._translations=f({name:"solutions-deploy-app",blocking:!0}),this._agoTerms=`${x}`,this._allCards=[],this._allShell=a(),this._allTab=a(),this._allTabTitle=a(),this._resourcesTab=a(),this._resourcesTabTitle=a(),this._categories=[],this._configContextProvider=u({context:k}),this._delay=!1,this._deployAppNav=a(),this._deployedCardPanel=a(),this._deployedCardTab=a(),this._deployedCardTabTitle=a(),this._detailsShell=a(),this._detailsTab=a(),this._detailsTabTitle=a(),this._forceInit=!1,this._getSuggested=!1,this._isMobileContextProvider=u({context:w}),this._mySolutionsShell=a(),this._mySolutionsTab=a(),this._mySolutionsTabTitle=a(),this._sortField="relevance",this._sortOrder="desc",this._telemetryManager=new m,this.deployAppTabSelected=n(),this.detailsCardSelected=n(),this.deployedCardSelected=n(),this.metaTagStringsReady=n(),this.listenOn(window,"detailsCardSelected",this._detailsCardSelected),this.listenOn(window,"deployedCardSelected",this._deployedCardSelected),this.listenOn(window,"displayDeployedCard",this._handleDeployedCardDisplay),this.listenOn(window,"navTabSelected",this._setActiveTab),this._mediaQueryChange=this._mediaQueryChange.bind(this)}static{this.properties={appConfig:1,initTab:1,initTitleOrId:1,sortType:1,useLocalAppConfig:5,authentication:16,_isLoaded:16,isMobile:16,_activeTab:16,_translations:16}}static{this.styles=L}get _telemetry(){return this._configContextProvider.value?.telemetrySession}async selectTab(t,e){if(console.log("selectTab"),this._isLoaded||this._forceInit){let i=this._getDefaultSearchOptions(e);switch(t.tabType){case"all-solutions":this._allTab.value.selected=!0,this._allTabTitle.value.selected=!0,i&&await this._allShell.value?.searchSolutions(i);break;case"resources":this._resourcesTab.value.selected=!0,this._resourcesTabTitle.value.selected=!0;break;case"deployed-card":if(this.authentication?.IsSignedIn){if(this._forceInit=!0,this._isLoaded=!1,this._cardsFetcherDeployed&&await this._getDeployedSolutions(),this._deployedSolutions?.cards?.length>0){let s;this._deployedSolutions.cards.some(o=>o.id===t.tabTitleOrId?(s=o,this.deployedCardSelected.emit({card:s}),!0):!1),this._isLoaded=!0,this._forceInit=!1}break}else return this.selectTab({tabTitleOrId:"",tabType:"deployments"},e);case"details":if(this._allCards){let s=$(this._allCards,t.tabTitleOrId);s=s||A(this._allCards,t.tabTitleOrId),s?(this._detailsTab.value.selected=!0,this._detailsTabTitle.value.selected=!0,this.detailsCardSelected.emit(s)):(t.tabType="all-solutions",this._allTab.value.selected=!0,this._allTabTitle.value.selected=!0)}break;case"deployments":this._mySolutionsTab.value.selected=!0,this._mySolutionsTabTitle.value.selected=!0,i&&await this._mySolutionsShell.value?.searchSolutions(i);break}return this._setActiveTab(new CustomEvent("setActiveTab",{detail:t})),this._blurTabs(),!0}else return this._initTab=t,this._initFilters=e,!1}async connectedCallback(){super.connectedCallback(),this._mediaQuery=window.matchMedia("(max-width: 800px)"),this._mediaQuery.addEventListener("change",this._mediaQueryChange),this._mediaQueryChange(this._mediaQuery)}async load(){this.useLocalAppConfig&&(this.appConfig=D)}render(){let t=this._isLoaded?"display-none":"",e=this._isLoaded?"":"display-none";return p`<calcite-shell><solutions-deploy-app-nav .appConfig=${this.appConfig} .initTab=${this.initTab} @authInit=${this._handleAuthInit} slot=header ${l(this._deployAppNav)}></solutions-deploy-app-nav>${this._isSearchToolbarShowing()&&p`<div class="border" slot=header></div>`||""}<solutions-searchsort-toolbar .isMobile=${this.isMobile} slot=header></solutions-searchsort-toolbar><calcite-loader class=${b(t)} id=solutions-loader .label=${this._translations.fetchingAllSolutions}></calcite-loader><calcite-tabs class=${b(e)} scale=l><calcite-tab-nav class="display-none" slot=title-group><calcite-tab-title ${l(this._allTabTitle)}>${this._translations.allSolutions}</calcite-tab-title><calcite-tab-title ${l(this._mySolutionsTabTitle)}>${this._translations.mySolutions}</calcite-tab-title><calcite-tab-title ${l(this._resourcesTabTitle)}>${this._translations.solutionResources}</calcite-tab-title><calcite-tab-title class="display-none" ${l(this._detailsTabTitle)}></calcite-tab-title><calcite-tab-title class="display-none" ${l(this._deployedCardTabTitle)}></calcite-tab-title></calcite-tab-nav><calcite-tab class="back-color-override tab-space-0" selected ${l(this._allTab)}><solutions-all-shell class="height-100" ${l(this._allShell)}></solutions-all-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${l(this._mySolutionsTab)}><solutions-deployed-shell class="height-100" ${l(this._mySolutionsShell)}></solutions-deployed-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${l(this._resourcesTab)}><solutions-resources-shell class="height-100"></solutions-resources-shell></calcite-tab><calcite-tab class="back-color-override" ${l(this._detailsTab)}><solution-details-panel class="height-100" ${l(this._detailsShell)}></solution-details-panel></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${l(this._deployedCardTab)}><solution-deployed-card-panel class="shell-container height-100" ${l(this._deployedCardPanel)}></solution-deployed-card-panel></calcite-tab></calcite-tabs></calcite-shell>`}loaded(){this._setScrollbarGutters()}disconnectedCallback(){super.disconnectedCallback(),this._mediaQuery?.removeEventListener("change",this._mediaQueryChange)}async _handleAuthInit(t){let e=t.detail;e.telemetrySession||(e.telemetrySession=m.getDisabledSession()),this._configContextProvider.setValue(e),e.authentication&&(this.authentication=e.authentication),this._cardsFetcherDeployed=new y(e.locale,e.orgUrl,e.portalURL),this._cardsFetcher=new y(e.locale,e.orgUrl,e.portalURL),await this._getSolutions(e.primarySolutionsGroupId,e.agoBasedEnterpriseSolutionsGroupId),this._configContextProvider.value.allCards=this._allCards,this._configContextProvider.value.anonAgolSession=this._cardsFetcher.anonAgolSession,this._configContextProvider.value.agolPortalUrl=this._cardsFetcher.agolPortalUrl,await this._initializeTelemetry(),this._isLoaded=!0,this._setRefreshInterval(),this._initTab?(console.log("do not check signin here"),this.selectTab(this._initTab,this._initFilters),this._logTabViewTelemetry(this._initTab.tabType),this._initTab=void 0,this._initFilters=void 0):this.authentication?.IsSignedIn?this.initTab==="details"||this.initTab==="deployed-card"||(this._logTabViewTelemetry(this._activeTab),this._emitMetaTagStrings(this._activeTab)):(console.log("should this one stay?"),this.selectTab({tabTitleOrId:"",tabType:"all-solutions"},this._initFilters))}_mediaQueryChange(t){this.isMobile=t.matches,this._isMobileContextProvider.setValue(this.isMobile)}_setActiveTab(t){let e=t.detail.tabType,i=this._activeTab!==e;switch(this._activeTab=e,i&&this._logTabViewTelemetry(e),e){case"all-solutions":this._allTabTitle.value?.click();break;case"deployments":this._mySolutionsTabTitle.value?.click();break;case"resources":this._resourcesTabTitle.value?.click();break;case"deployed-card":this._deployedCardTabTitle.value?.click();break;case"details":this._detailsTabTitle.value?.click();break}e!=="details"&&e!=="deployed-card"&&(this._deployAppNav.value.activateMenuItem(e),this.deployAppTabSelected.emit(e),this._emitMetaTagStrings(e))}_logTabViewTelemetry(t,e){let i;switch(t){case"all-solutions":i=c.ALL_SOLUTIONS;break;case"deployments":i=c.DEPLOYMENTS;break;case"resources":i=c.RESOURCES;break;case"details":i=c.SOLUTION_DETAILS;break;case"deployed-card":i=c.DEPLOYMENTS;break}if(!((t==="details"||t==="deployed-card")&&!e)&&i){let s=[];if((t==="details"||t==="deployed-card")&&e){let r=e;s.push(r.title||""),s.push(r.deployCommonId||""),s.push(r.deployVersion||"")}let o=t==="deployed-card"?"Open":"View";this._telemetry?.logEvent({category:i,action:o,dimensions:s.length>0?s:void 0})}}_emitMetaTagStrings(t,e){let i="",s="";switch(t){case"all-solutions":i=this._translations.metaAllSolutionsTitle,s=this._translations.metaAllSolutionsDescription;break;case"deployments":case"deployed-card":i=this._translations.metaDeploymentsTitle,s=this._translations.metaDeploymentsDescription;break;case"resources":i=this._translations.metaResourcesTitle,s=this._translations.metaResourcesDescription;break;case"details":e&&(i=this._translations.metaDetailsTitle.replace("{title}",e.title),s=e.snippet);break}this.metaTagStringsReady.emit({pageType:t,title:i,description:s,detailTemplate:e})}_detailsCardSelected(t){this._activeTab="details",this._detailsTabTitle.value.selected=!0,this._detailsTab.value.selected=!0,this._deployAppNav.value.clearMenuItems(),t?.detail&&(this._selectedDetailsCard=t.detail),this._logTabViewTelemetry("details",this._selectedDetailsCard),this._emitMetaTagStrings("details",this._selectedDetailsCard)}_deployedCardSelected(t){this._activeTab="deployed-card",this._deployedCardTabTitle.value.selected=!0,this._deployedCardTab.value.selected=!0,this._deployAppNav.value.clearMenuItems(),t?.detail?.card&&(this._selectedDeployedCard=t.detail.card),this._logTabViewTelemetry("deployed-card",this._selectedDeployedCard),this._emitMetaTagStrings("deployed-card")}_handleDeployedCardDisplay(t){let{card:e,cardRef:i}=t.detail;this.deployedCardSelected.emit({card:e,cardRef:i})}async _initializeTelemetry(){let t=this._configContextProvider.value;if(!this.authentication||!t)return;let e=await this._telemetryManager.initializeTelemetry(this.authentication,t);this._configContextProvider.value.telemetrySession=e}async _getSolutions(t,e){let i=await this._cardsFetcher?.requestAvailableSolutionCards({q:this._agoTerms,filter:"type:Solution",sortField:this._sortField,sortOrder:this._sortOrder,nextStart:-1,categories:this._categories,delay:this._delay,getSuggested:this._getSuggested},t,e,this._configContextProvider.value.userSession,this._configContextProvider.value.isEnterprise,{num:1e3});return this._allCards.length===0&&i?.cards&&(this._allCards=i?.cards),this._allCards}async _getDeployedSolutions(){let t=this._configContextProvider.value.authentication,e=this._configContextProvider.value.userSession;t&&e&&t.IsSignedIn&&(I(t)?this._deployedSolutions=await T(t,e,this._cardsFetcher,this._cardsFetcherDeployed,_,"created","desc",!1,[],[],"My organization's solutions"):this._deployedSolutions=await T(t,e,this._cardsFetcher,this._cardsFetcherDeployed,_,"created"))}_blurTabs(){this._allTabTitle.value?.blur(),this._resourcesTabTitle.value?.blur(),this._detailsTabTitle.value?.blur(),this._mySolutionsTabTitle.value?.blur()}_isSearchToolbarShowing(){return this._activeTab==="all-solutions"||this._activeTab==="deployments"&&this.authentication?.IsSignedIn===!0}_getDefaultSearchOptions(t){let e;if(t){let i=t.domain,s=t.industry,o=t.offerType,r=t.searchTerm,O="",d=t.sortField,h=t.owner;e=i||s?{type:i?"domain":s?"industry":""}:void 0,i&&(e=e?{...e,domain:i}:{domain:i}),s&&(e=e?{...e,industry:s}:{industry:s}),r&&(e=e?{...e,searchTerm:r}:{searchTerm:r}),e&&(e={...e,displayValue:O}),d&&(e=e?{...e,sortType:d}:{sortType:d}),o&&(d=o.toLowerCase(),e=e?{...e,sortType:d}:{sortType:d}),h&&(e=e?{...e,owner:h}:{owner:h})}return e}_setScrollbarGutters(){let t=this._detailsTab.value?.shadowRoot?.firstElementChild;t?.style&&(t.style.scrollbarGutter="stable both-edges");let e=this._deployedCardTab.value?.shadowRoot?.firstElementChild;e?.style&&(e.style.scrollbarGutter="stable both-edges")}_setRefreshInterval(){let{userSession:t,authentication:e}=this._configContextProvider.value;if(t&&t.tokenDuration&&e?.IsSignedIn){let i=t.tokenDuration*.95;setInterval(async()=>{await t.refreshCredentials()},i)}}};C("solutions-deploy-app",g);return g},"identity/IdentityManager","identity/OAuthInfo","portal/Portal",c,d,e,g,h,i,j,m,o,q,r,s,t)
2
+ import t from"./AJUED7I2.js";import s from"./TLHZREWE.js";import r from"./Q4XPFYA2.js";import"./M3L2UEHW.js";import q from"./LQQZM2CG.js";import o from"./JXAGLAH5.js";import m from"./PL3NZFP4.js";import j from"./LGWDPFR4.js";import"./KISABCMW.js";import i from"./TYCZQV4N.js";import h from"./TIUYIRSM.js";import g from"./4YJ7ZD32.js";import e from"./LU6E7GNX.js";import"./YUDZU2OW.js";import"./I5GF7UR6.js";import d from"./YV3EI5XV.js";import c from"./6KLGSVI4.js";import{a as w,b as k}from"./W4773WDH.js";import{a as u}from"./77CU4WA2.js";import"./4Q4PZB7R.js";import{a as f}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 C}from"./RFGSSUZF.js";import{F as a,G as l,H as S,J as b,h as v,i as p,r as n}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([,,,{c:I,k:_,l:x,n:c},,,,{b:D},,,{g:$,h:A},,{a:m},,,{a:y,b:T}])=>{var L=v`.back-color-override{background-color:var(--calcite-color-foreground-2);--calcite-tab-border-color: var(--calcite-color-foreground-3)}.display-none{display:none!important}.height-100{height:100%}calcite-tab-nav{padding-bottom:6px;padding-top:6px}calcite-tabs{--calcite-tab-border-color: var(--calcite-color-border-3);--calcite-color-focus: transparent;height:100%}.tab-space-0{--calcite-tab-content-space-y: var(--calcite-spacing-none)}.tab-space-md{--calcite-tab-content-space-y: var(--calcite-spacing-md)}solutions-searchsort-toolbar,solutions-deploy-app-nav,solution-details-panel,solutions-resources-shell,solutions-deployed-shell,solutions-all-shell,calcite-tab-nav,solution-deployed-card-panel{width:1440px;display:block;max-width:96vw;padding-right:var(--calcite-spacing-none);padding-left:var(--calcite-spacing-none);margin-left:auto;margin-right:auto;box-sizing:border-box}.border{height:var(--calcite-spacing-px);border-bottom-color:var(--calcite-color-border-3);border-bottom-style:solid;border-bottom-width:var(--calcite-border-width-sm);box-sizing:border-box}.overflow-auto{overflow:auto}solution-details-panel{scroll-margin-top:3rem}`,g=class extends S{constructor(){super(),this.initTitleOrId="",this.sortType="relevance",this.useLocalAppConfig=!1,this.authentication=void 0,this._isLoaded=!1,this.isMobile=!1,this._activeTab="all-solutions",this._translations=f({name:"solutions-deploy-app",blocking:!0}),this._agoTerms=`${x}`,this._allCards=[],this._allShell=a(),this._allTab=a(),this._allTabTitle=a(),this._resourcesTab=a(),this._resourcesTabTitle=a(),this._categories=[],this._configContextProvider=u({context:k}),this._delay=!1,this._deployAppNav=a(),this._deployedCardPanel=a(),this._deployedCardTab=a(),this._deployedCardTabTitle=a(),this._detailsShell=a(),this._detailsTab=a(),this._detailsTabTitle=a(),this._forceInit=!1,this._getSuggested=!1,this._isMobileContextProvider=u({context:w}),this._mySolutionsShell=a(),this._mySolutionsTab=a(),this._mySolutionsTabTitle=a(),this._sortField="relevance",this._sortOrder="desc",this._telemetryManager=new m,this.deployAppTabSelected=n(),this.detailsCardSelected=n(),this.deployedCardSelected=n(),this.metaTagStringsReady=n(),this.listenOn(window,"detailsCardSelected",this._detailsCardSelected),this.listenOn(window,"deployedCardSelected",this._deployedCardSelected),this.listenOn(window,"displayDeployedCard",this._handleDeployedCardDisplay),this.listenOn(window,"navTabSelected",this._setActiveTab),this._mediaQueryChange=this._mediaQueryChange.bind(this)}static{this.properties={appConfig:1,initTab:1,initTitleOrId:1,sortType:1,useLocalAppConfig:5,authentication:16,_isLoaded:16,isMobile:16,_activeTab:16,_translations:16}}static{this.styles=L}get _telemetry(){return this._configContextProvider.value?.telemetrySession}async selectTab(t,e){if(console.log("selectTab"),this._isLoaded||this._forceInit){let i=this._getDefaultSearchOptions(e);switch(t.tabType){case"all-solutions":this._allTab.value.selected=!0,this._allTabTitle.value.selected=!0,i&&await this._allShell.value?.searchSolutions(i);break;case"resources":this._resourcesTab.value.selected=!0,this._resourcesTabTitle.value.selected=!0;break;case"deployed-card":if(this.authentication?.IsSignedIn){if(this._forceInit=!0,this._isLoaded=!1,this._cardsFetcherDeployed&&await this._getDeployedSolutions(),this._deployedSolutions?.cards?.length>0){let s;this._deployedSolutions.cards.some(o=>o.id===t.tabTitleOrId?(s=o,this.deployedCardSelected.emit({card:s}),!0):!1),this._isLoaded=!0,this._forceInit=!1}break}else return this.selectTab({tabTitleOrId:"",tabType:"deployments"},e);case"details":if(this._allCards){let s=$(this._allCards,t.tabTitleOrId);s=s||A(this._allCards,t.tabTitleOrId),s?(this._detailsTab.value.selected=!0,this._detailsTabTitle.value.selected=!0,this.detailsCardSelected.emit(s)):(t.tabType="all-solutions",this._allTab.value.selected=!0,this._allTabTitle.value.selected=!0)}break;case"deployments":this._mySolutionsTab.value.selected=!0,this._mySolutionsTabTitle.value.selected=!0,i&&await this._mySolutionsShell.value?.searchSolutions(i);break}return this._setActiveTab(new CustomEvent("setActiveTab",{detail:t})),this._blurTabs(),!0}else return this._initTab=t,this._initFilters=e,!1}async connectedCallback(){super.connectedCallback(),this._mediaQuery=window.matchMedia("(max-width: 800px)"),this._mediaQuery.addEventListener("change",this._mediaQueryChange),this._mediaQueryChange(this._mediaQuery)}async load(){this.useLocalAppConfig&&(this.appConfig=D)}render(){let t=this._isLoaded?"display-none":"",e=this._isLoaded?"":"display-none";return p`<calcite-shell><solutions-deploy-app-nav .appConfig=${this.appConfig} .initTab=${this.initTab} @authInit=${this._handleAuthInit} slot=header ${l(this._deployAppNav)}></solutions-deploy-app-nav>${this._isSearchToolbarShowing()&&p`<div class="border" slot=header></div>`||""}<solutions-searchsort-toolbar .isMobile=${this.isMobile} slot=header></solutions-searchsort-toolbar><calcite-loader class=${b(t)} id=solutions-loader .label=${this._translations.fetchingAllSolutions}></calcite-loader><calcite-tabs class=${b(e)} scale=l><calcite-tab-nav class="display-none" slot=title-group><calcite-tab-title ${l(this._allTabTitle)}>${this._translations.allSolutions}</calcite-tab-title><calcite-tab-title ${l(this._mySolutionsTabTitle)}>${this._translations.mySolutions}</calcite-tab-title><calcite-tab-title ${l(this._resourcesTabTitle)}>${this._translations.solutionResources}</calcite-tab-title><calcite-tab-title class="display-none" ${l(this._detailsTabTitle)}></calcite-tab-title><calcite-tab-title class="display-none" ${l(this._deployedCardTabTitle)}></calcite-tab-title></calcite-tab-nav><calcite-tab class="back-color-override tab-space-0" selected ${l(this._allTab)}><solutions-all-shell class="height-100" ${l(this._allShell)}></solutions-all-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${l(this._mySolutionsTab)}><solutions-deployed-shell class="height-100" ${l(this._mySolutionsShell)}></solutions-deployed-shell></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${l(this._resourcesTab)}><solutions-resources-shell class="height-100"></solutions-resources-shell></calcite-tab><calcite-tab class="back-color-override" ${l(this._detailsTab)}><solution-details-panel class="height-100" ${l(this._detailsShell)}></solution-details-panel></calcite-tab><calcite-tab class="back-color-override tab-space-0" ${l(this._deployedCardTab)}><solution-deployed-card-panel class="shell-container height-100" ${l(this._deployedCardPanel)}></solution-deployed-card-panel></calcite-tab></calcite-tabs></calcite-shell>`}loaded(){this._setScrollbarGutters()}disconnectedCallback(){super.disconnectedCallback(),this._mediaQuery?.removeEventListener("change",this._mediaQueryChange)}async _handleAuthInit(t){let e=t.detail;e.telemetrySession||(e.telemetrySession=m.getDisabledSession()),this._configContextProvider.setValue(e),e.authentication&&(this.authentication=e.authentication),this._cardsFetcherDeployed=new y(e.locale,e.orgUrl,e.portalURL),this._cardsFetcher=new y(e.locale,e.orgUrl,e.portalURL),await this._getSolutions(e.primarySolutionsGroupId,e.agoBasedEnterpriseSolutionsGroupId),this._configContextProvider.value.allCards=this._allCards,this._configContextProvider.value.anonAgolSession=this._cardsFetcher.anonAgolSession,this._configContextProvider.value.agolPortalUrl=this._cardsFetcher.agolPortalUrl,await this._initializeTelemetry(),this._isLoaded=!0,this._setRefreshInterval(),this._initTab?(console.log("do not check signin here"),this.selectTab(this._initTab,this._initFilters),this._logTabViewTelemetry(this._initTab.tabType),this._initTab=void 0,this._initFilters=void 0):this.authentication?.IsSignedIn?this.initTab==="details"||this.initTab==="deployed-card"||(this._logTabViewTelemetry(this._activeTab),this._emitMetaTagStrings(this._activeTab)):(console.log("should this one stay?"),this.selectTab({tabTitleOrId:"",tabType:"all-solutions"},this._initFilters))}_mediaQueryChange(t){this.isMobile=t.matches,this._isMobileContextProvider.setValue(this.isMobile)}_setActiveTab(t){let e=t.detail.tabType,i=this._activeTab!==e;switch(this._activeTab=e,i&&this._logTabViewTelemetry(e),e){case"all-solutions":this._allTabTitle.value?.click();break;case"deployments":this._mySolutionsTabTitle.value?.click();break;case"resources":this._resourcesTabTitle.value?.click();break;case"deployed-card":this._deployedCardTabTitle.value?.click();break;case"details":this._detailsTabTitle.value?.click();break}e!=="details"&&e!=="deployed-card"&&(this._deployAppNav.value.activateMenuItem(e),this.deployAppTabSelected.emit(e),this._emitMetaTagStrings(e))}_logTabViewTelemetry(t,e){let i;switch(t){case"all-solutions":i=c.ALL_SOLUTIONS;break;case"deployments":i=c.DEPLOYMENTS;break;case"resources":i=c.RESOURCES;break;case"details":i=c.SOLUTION_DETAILS;break;case"deployed-card":i=c.DEPLOYMENTS;break}if(!((t==="details"||t==="deployed-card")&&!e)&&i){let s=[];if((t==="details"||t==="deployed-card")&&e){let r=e;s.push(r.title||""),s.push(r.deployCommonId||""),s.push(r.deployVersion||"")}let o=t==="deployed-card"?"Open":"View";this._telemetry?.logEvent({category:i,action:o,dimensions:s.length>0?s:void 0})}}_emitMetaTagStrings(t,e){let i="",s="";switch(t){case"all-solutions":i=this._translations.metaAllSolutionsTitle,s=this._translations.metaAllSolutionsDescription;break;case"deployments":case"deployed-card":i=this._translations.metaDeploymentsTitle,s=this._translations.metaDeploymentsDescription;break;case"resources":i=this._translations.metaResourcesTitle,s=this._translations.metaResourcesDescription;break;case"details":e&&(i=this._translations.metaDetailsTitle.replace("{title}",e.title),s=e.snippet);break}this.metaTagStringsReady.emit({pageType:t,title:i,description:s,detailTemplate:e})}_detailsCardSelected(t){this._activeTab="details",this._detailsTabTitle.value.selected=!0,this._detailsTab.value.selected=!0,this._deployAppNav.value.clearMenuItems(),t?.detail&&(this._selectedDetailsCard=t.detail),this._logTabViewTelemetry("details",this._selectedDetailsCard),this._emitMetaTagStrings("details",this._selectedDetailsCard)}_deployedCardSelected(t){this._activeTab="deployed-card",this._deployedCardTabTitle.value.selected=!0,this._deployedCardTab.value.selected=!0,this._deployAppNav.value.clearMenuItems(),t?.detail?.card&&(this._selectedDeployedCard=t.detail.card),this._logTabViewTelemetry("deployed-card",this._selectedDeployedCard),this._emitMetaTagStrings("deployed-card")}_handleDeployedCardDisplay(t){let{card:e,cardRef:i}=t.detail;this.deployedCardSelected.emit({card:e,cardRef:i})}async _initializeTelemetry(){let t=this._configContextProvider.value;if(!this.authentication||!t)return;let e=await this._telemetryManager.initializeTelemetry(this.authentication,t);this._configContextProvider.value.telemetrySession=e}async _getSolutions(t,e){let i=await this._cardsFetcher?.requestAvailableSolutionCards({q:this._agoTerms,filter:"type:Solution",sortField:this._sortField,sortOrder:this._sortOrder,nextStart:-1,categories:this._categories,delay:this._delay,getSuggested:this._getSuggested},t,e,this._configContextProvider.value.userSession,this._configContextProvider.value.isEnterprise,{num:1e3});return this._allCards.length===0&&i?.cards&&(this._allCards=i?.cards),this._allCards}async _getDeployedSolutions(){let t=this._configContextProvider.value.authentication,e=this._configContextProvider.value.userSession;t&&e&&t.IsSignedIn&&(I(t)?this._deployedSolutions=await T(t,e,this._cardsFetcher,this._cardsFetcherDeployed,_,"created","desc",!1,[],[],"My organization's solutions"):this._deployedSolutions=await T(t,e,this._cardsFetcher,this._cardsFetcherDeployed,_,"created"))}_blurTabs(){this._allTabTitle.value?.blur(),this._resourcesTabTitle.value?.blur(),this._detailsTabTitle.value?.blur(),this._mySolutionsTabTitle.value?.blur()}_isSearchToolbarShowing(){return this._activeTab==="all-solutions"||this._activeTab==="deployments"&&this.authentication?.IsSignedIn===!0}_getDefaultSearchOptions(t){let e;if(t){let i=t.domain,s=t.industry,o=t.offerType,r=t.searchTerm,O="",d=t.sortField,h=t.owner;e=i||s?{type:i?"domain":s?"industry":""}:void 0,i&&(e=e?{...e,domain:i}:{domain:i}),s&&(e=e?{...e,industry:s}:{industry:s}),r&&(e=e?{...e,searchTerm:r}:{searchTerm:r}),e&&(e={...e,displayValue:O}),d&&(e=e?{...e,sortType:d}:{sortType:d}),o&&(d=o.toLowerCase(),e=e?{...e,sortType:d}:{sortType:d}),h&&(e=e?{...e,owner:h}:{owner:h})}return e}_setScrollbarGutters(){let t=this._detailsTab.value?.shadowRoot?.firstElementChild;t?.style&&(t.style.scrollbarGutter="stable both-edges");let e=this._deployedCardTab.value?.shadowRoot?.firstElementChild;e?.style&&(e.style.scrollbarGutter="stable both-edges")}_setRefreshInterval(){let{userSession:t,authentication:e}=this._configContextProvider.value;if(t&&t.tokenDuration&&e?.IsSignedIn){let i=t.tokenDuration*.95;setInterval(async()=>{await t.refreshCredentials()},i)}}};C("solutions-deploy-app",g);return g},"identity/IdentityManager","identity/OAuthInfo","portal/Portal",c,d,e,g,h,i,j,m,o,q,r,s,t)
@@ -1,65 +1,65 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
2
- import b from"./YV3EI5XV.js";import a from"./6KLGSVI4.js";import{b as be}from"./W4773WDH.js";import{b as xe}from"./77CU4WA2.js";import"./4Q4PZB7R.js";import{a as me}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 fe}from"./RFGSSUZF.js";import{G as H,H as ge,J as ke,L as j,h as le,i as m,k as ce,l as Z,m as R,r as he,w as pe,x as ue,y as de}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([{n:we},{r:_e}])=>{var C=class extends de{constructor(e){if(super(e),this.it=Z,e.type!==pe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Z||e==null)return this._t=void 0,this.it=e;if(e===ce)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:[]}}};C.directiveName="unsafeHTML",C.resultType=1;var G=ue(C);var Ue=le`: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-background);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);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}`;function Y(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var I=Y();function Ae(n){I=n}var P={exec:()=>null};function d(n,e=""){let t=typeof n=="string"?n:n.source,i={replace:(s,a)=>{let r=typeof a=="string"?a:a.source;return r=r.replace(w.caret,"$1"),t=t.replace(s,r),i},getRegex:()=>new RegExp(t,e)};return i}var Fe=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),w={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,listReplaceTabs:/^\t+/,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:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i")},De=/^(?:[ \t]*(?:\n|$))+/,Oe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ze=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,E=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,He=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ee=/(?:[*+-]|\d{1,9}[.)])/,Ie=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ce=d(Ie).replace(/bull/g,ee).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(),je=d(Ie).replace(/bull/g,ee).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(),te=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ge=/^[^\n]+/,se=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,We=d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",se).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Xe=d(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ee).getRegex(),D="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",ne=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Je=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",ne).replace("tag",D).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ze=d(te).replace("hr",E).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D).getRegex(),Ke=d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ze).getRegex(),ie={blockquote:Ke,code:Oe,def:We,fences:Ze,heading:He,hr:E,html:Je,lheading:Ce,list:Xe,newline:De,paragraph:ze,table:P,text:Ge},ye=d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",E).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D).getRegex(),Ve={...ie,lheading:je,table:ye,paragraph:d(te).replace("hr",E).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ye).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D).getRegex()},Ye={...ie,html:d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ne).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:P,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:d(te).replace("hr",E).replace("heading",` *#{1,6} *[^
3
- ]`).replace("lheading",Ce).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},et=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,tt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Le=/^( {2,}|\\)\n(?!\s*$)/,st=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,O=/[\p{P}\p{S}]/u,re=/[\s\p{P}\p{S}]/u,qe=/[^\s\p{P}\p{S}]/u,nt=d(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,re).getRegex(),Pe=/(?!~)[\p{P}\p{S}]/u,it=/(?!~)[\s\p{P}\p{S}]/u,rt=/(?:[^\s\p{P}\p{S}]|~)/u,at=d(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Fe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ee=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ot=d(Ee,"u").replace(/punct/g,O).getRegex(),lt=d(Ee,"u").replace(/punct/g,Pe).getRegex(),Be="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ct=d(Be,"gu").replace(/notPunctSpace/g,qe).replace(/punctSpace/g,re).replace(/punct/g,O).getRegex(),ht=d(Be,"gu").replace(/notPunctSpace/g,rt).replace(/punctSpace/g,it).replace(/punct/g,Pe).getRegex(),pt=d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qe).replace(/punctSpace/g,re).replace(/punct/g,O).getRegex(),ut=d(/\\(punct)/,"gu").replace(/punct/g,O).getRegex(),dt=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(),gt=d(ne).replace("(?:-->|$)","-->").getRegex(),kt=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",gt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Q=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,ft=d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Me=d(/^!?\[(label)\]\[(ref)\]/).replace("label",Q).replace("ref",se).getRegex(),Ne=d(/^!?\[(ref)\](?:\[\])?/).replace("ref",se).getRegex(),mt=d("reflink|nolink(?!\\()","g").replace("reflink",Me).replace("nolink",Ne).getRegex(),ve=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ae={_backpedal:P,anyPunctuation:ut,autolink:dt,blockSkip:at,br:Le,code:tt,del:P,emStrongLDelim:ot,emStrongRDelimAst:ct,emStrongRDelimUnd:pt,escape:et,link:ft,nolink:Ne,punctuation:nt,reflink:Me,reflinkSearch:mt,tag:kt,text:st,url:P},xt={...ae,link:d(/^!?\[(label)\]\((.*?)\)/).replace("label",Q).getRegex(),reflink:d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Q).getRegex()},W={...ae,emStrongRDelimAst:ht,emStrongLDelim:lt,url:d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ve).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",ve).getRegex()},bt={...W,br:d(Le).replace("{2,}","*").getRegex(),text:d(W.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},N={normal:ie,gfm:Ve,pedantic:Ye},z={normal:ae,gfm:W,breaks:bt,pedantic:xt},wt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Se=n=>wt[n];function S(n,e){if(e){if(w.escapeTest.test(n))return n.replace(w.escapeReplace,Se)}else if(w.escapeTestNoEncode.test(n))return n.replace(w.escapeReplaceNoEncode,Se);return n}function $e(n){try{n=encodeURI(n).replace(w.percentDecode,"%")}catch{return null}return n}function Te(n,e){let t=n.replace(w.findPipe,(a,r,l)=>{let o=!1,h=r;for(;--h>=0&&l[h]==="\\";)o=!o;return o?"|":" |"}),i=t.split(w.splitPipe),s=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(w.slashPipe,"|");return i}function L(n,e,t){let i=n.length;if(i===0)return"";let s=0;for(;s<i&&n.charAt(i-s-1)===e;)s++;return n.slice(0,i-s)}function _t(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<n.length;i++)if(n[i]==="\\")i++;else if(n[i]===e[0])t++;else if(n[i]===e[1]&&(t--,t<0))return i;return t>0?-2:-1}function Re(n,e,t,i,s){let a=e.href,r=e.title||null,l=n[1].replace(s.other.outputLinkReplace,"$1");i.state.inLink=!0;let o={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:a,title:r,text:l,tokens:i.inlineTokens(l)};return i.state.inLink=!1,o}function yt(n,e,t){let i=n.match(t.other.indentCodeCompensation);if(i===null)return e;let s=i[1];return e.split(`
2
+ import b from"./YV3EI5XV.js";import a from"./6KLGSVI4.js";import{b as be}from"./W4773WDH.js";import{b as xe}from"./77CU4WA2.js";import"./4Q4PZB7R.js";import{a as me}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 fe}from"./RFGSSUZF.js";import{G as H,H as ge,J as ke,L as j,h as le,i as m,k as ce,l as Z,m as R,r as he,w as pe,x as ue,y as de}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([{n:we},{r:_e}])=>{var C=class extends de{constructor(e){if(super(e),this.it=Z,e.type!==pe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Z||e==null)return this._t=void 0,this.it=e;if(e===ce)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:[]}}};C.directiveName="unsafeHTML",C.resultType=1;var G=ue(C);var Ue=le`: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-background);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);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}a{color:var(--calcite-color-text-link)}`;function Y(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var I=Y();function Ae(i){I=i}var P={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(w.caret,"$1"),t=t.replace(s,r),n},getRegex:()=>new RegExp(t,e)};return n}var Fe=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),w={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,listReplaceTabs:/^\t+/,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")},De=/^(?:[ \t]*(?:\n|$))+/,Oe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ze=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,E=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,He=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ee=/(?:[*+-]|\d{1,9}[.)])/,Ie=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ce=d(Ie).replace(/bull/g,ee).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(),je=d(Ie).replace(/bull/g,ee).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(),te=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ge=/^[^\n]+/,se=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,We=d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",se).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Xe=d(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ee).getRegex(),D="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ie=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Je=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",ie).replace("tag",D).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ze=d(te).replace("hr",E).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D).getRegex(),Ke=d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ze).getRegex(),ne={blockquote:Ke,code:Oe,def:We,fences:Ze,heading:He,hr:E,html:Je,lheading:Ce,list:Xe,newline:De,paragraph:ze,table:P,text:Ge},ye=d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",E).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D).getRegex(),Ve={...ne,lheading:je,table:ye,paragraph:d(te).replace("hr",E).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ye).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",D).getRegex()},Ye={...ne,html:d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:P,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:d(te).replace("hr",E).replace("heading",` *#{1,6} *[^
3
+ ]`).replace("lheading",Ce).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},et=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,tt=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Le=/^( {2,}|\\)\n(?!\s*$)/,st=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,O=/[\p{P}\p{S}]/u,re=/[\s\p{P}\p{S}]/u,qe=/[^\s\p{P}\p{S}]/u,it=d(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,re).getRegex(),Pe=/(?!~)[\p{P}\p{S}]/u,nt=/(?!~)[\s\p{P}\p{S}]/u,rt=/(?:[^\s\p{P}\p{S}]|~)/u,at=d(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Fe?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Ee=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ot=d(Ee,"u").replace(/punct/g,O).getRegex(),lt=d(Ee,"u").replace(/punct/g,Pe).getRegex(),Be="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ct=d(Be,"gu").replace(/notPunctSpace/g,qe).replace(/punctSpace/g,re).replace(/punct/g,O).getRegex(),ht=d(Be,"gu").replace(/notPunctSpace/g,rt).replace(/punctSpace/g,nt).replace(/punct/g,Pe).getRegex(),pt=d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qe).replace(/punctSpace/g,re).replace(/punct/g,O).getRegex(),ut=d(/\\(punct)/,"gu").replace(/punct/g,O).getRegex(),dt=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(),gt=d(ie).replace("(?:-->|$)","-->").getRegex(),kt=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",gt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Q=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,ft=d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Me=d(/^!?\[(label)\]\[(ref)\]/).replace("label",Q).replace("ref",se).getRegex(),Ne=d(/^!?\[(ref)\](?:\[\])?/).replace("ref",se).getRegex(),mt=d("reflink|nolink(?!\\()","g").replace("reflink",Me).replace("nolink",Ne).getRegex(),ve=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ae={_backpedal:P,anyPunctuation:ut,autolink:dt,blockSkip:at,br:Le,code:tt,del:P,emStrongLDelim:ot,emStrongRDelimAst:ct,emStrongRDelimUnd:pt,escape:et,link:ft,nolink:Ne,punctuation:it,reflink:Me,reflinkSearch:mt,tag:kt,text:st,url:P},xt={...ae,link:d(/^!?\[(label)\]\((.*?)\)/).replace("label",Q).getRegex(),reflink:d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Q).getRegex()},W={...ae,emStrongRDelimAst:ht,emStrongLDelim:lt,url:d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ve).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",ve).getRegex()},bt={...W,br:d(Le).replace("{2,}","*").getRegex(),text:d(W.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},N={normal:ne,gfm:Ve,pedantic:Ye},z={normal:ae,gfm:W,breaks:bt,pedantic:xt},wt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Se=i=>wt[i];function S(i,e){if(e){if(w.escapeTest.test(i))return i.replace(w.escapeReplace,Se)}else if(w.escapeTestNoEncode.test(i))return i.replace(w.escapeReplaceNoEncode,Se);return i}function $e(i){try{i=encodeURI(i).replace(w.percentDecode,"%")}catch{return null}return i}function Te(i,e){let t=i.replace(w.findPipe,(a,r,l)=>{let o=!1,h=r;for(;--h>=0&&l[h]==="\\";)o=!o;return o?"|":" |"}),n=t.split(w.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(w.slashPipe,"|");return n}function L(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 _t(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 Re(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 yt(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 U=class{options;rules;lexer;constructor(n){this.options=n||I}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:L(t,`
6
- `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],i=yt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:i}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let i=L(t,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(t=i.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:L(e[0],`
7
- `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=L(e[0],`
5
+ `)}var U=class{options;rules;lexer;constructor(i){this.options=i||I}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:L(t,`
6
+ `)}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],n=yt(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=L(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:L(e[0],`
7
+ `)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=L(e[0],`
8
8
  `).split(`
9
- `),i="",s="",a=[];for(;t.length>0;){let r=!1,l=[],o;for(o=0;o<t.length;o++)if(this.rules.other.blockquoteStart.test(t[o]))l.push(t[o]),r=!0;else if(!r)l.push(t[o]);else break;t=t.slice(o);let h=l.join(`
9
+ `),n="",s="",a=[];for(;t.length>0;){let r=!1,l=[],o;for(o=0;o<t.length;o++)if(this.rules.other.blockquoteStart.test(t[o]))l.push(t[o]),r=!0;else if(!r)l.push(t[o]);else break;t=t.slice(o);let h=l.join(`
10
10
  `),c=h.replace(this.rules.other.blockquoteSetextReplace,`
11
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
11
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
12
12
  ${h}`:h,s=s?`${s}
13
13
  ${c}`:c;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,a,!0),this.lexer.state.top=g,t.length===0)break;let p=a.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let u=p,f=u.raw+`
14
14
  `+t.join(`
15
- `),b=this.blockquote(f);a[a.length-1]=b,i=i.substring(0,i.length-u.raw.length)+b.raw,s=s.substring(0,s.length-u.text.length)+b.text;break}else if(p?.type==="list"){let u=p,f=u.raw+`
15
+ `),b=this.blockquote(f);a[a.length-1]=b,n=n.substring(0,n.length-u.raw.length)+b.raw,s=s.substring(0,s.length-u.text.length)+b.text;break}else if(p?.type==="list"){let u=p,f=u.raw+`
16
16
  `+t.join(`
17
- `),b=this.list(f);a[a.length-1]=b,i=i.substring(0,i.length-p.raw.length)+b.raw,s=s.substring(0,s.length-u.raw.length)+b.raw,t=f.substring(a.at(-1).raw.length).split(`
18
- `);continue}}return{type:"blockquote",raw:i,tokens:a,text:s}}}list(n){let e=this.rules.block.list.exec(n);if(e){let t=e[1].trim(),i=t.length>1,s={type:"list",raw:"",ordered:i,start:i?+t.slice(0,-1):"",loose:!1,items:[]};t=i?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=i?t:"[*+-]");let a=this.rules.other.listItemRegex(t),r=!1;for(;n;){let o=!1,h="",c="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;h=e[0],n=n.substring(h.length);let g=e[2].split(`
19
- `,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),p=n.split(`
17
+ `),b=this.list(f);a[a.length-1]=b,n=n.substring(0,n.length-p.raw.length)+b.raw,s=s.substring(0,s.length-u.raw.length)+b.raw,t=f.substring(a.at(-1).raw.length).split(`
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 g=e[2].split(`
19
+ `,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),p=i.split(`
20
20
  `,1)[0],u=!g.trim(),f=0;if(this.options.pedantic?(f=2,c=g.trimStart()):u?f=e[1].length+1:(f=e[2].search(this.rules.other.nonSpaceChar),f=f>4?1:f,c=g.slice(f),f+=e[1].length),u&&this.rules.other.blankLine.test(p)&&(h+=p+`
21
- `,n=n.substring(p.length+1),o=!0),!o){let b=this.rules.other.nextBulletRegex(f),B=this.rules.other.hrRegex(f),M=this.rules.other.fencesBeginRegex(f),x=this.rules.other.headingBeginRegex(f),_=this.rules.other.htmlBeginRegex(f);for(;n;){let $=n.split(`
21
+ `,i=i.substring(p.length+1),o=!0),!o){let b=this.rules.other.nextBulletRegex(f),B=this.rules.other.hrRegex(f),M=this.rules.other.fencesBeginRegex(f),x=this.rules.other.headingBeginRegex(f),_=this.rules.other.htmlBeginRegex(f);for(;i;){let $=i.split(`
22
22
  `,1)[0],T;if(p=$,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),T=p):T=p.replace(this.rules.other.tabCharGlobal," "),M.test(p)||x.test(p)||_.test(p)||b.test(p)||B.test(p))break;if(T.search(this.rules.other.nonSpaceChar)>=f||!p.trim())c+=`
23
23
  `+T.slice(f);else{if(u||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||M.test(g)||x.test(g)||B.test(g))break;c+=`
24
24
  `+p}!u&&!p.trim()&&(u=!0),h+=$+`
25
- `,n=n.substring($.length+1),g=T.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(g=>g.type==="space"),c=h.length>0&&h.some(g=>this.rules.other.anyLine.test(g.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(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=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:i,title:s}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Te(e[1]),i=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
26
- `):[],a={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===i.length){for(let r of i)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(Te(r,a.header.length).map((l,o)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[o]})));return a}}lheading(n){let e=this.rules.block.lheading.exec(n);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(n){let e=this.rules.block.paragraph.exec(n);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(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);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(n){let e=this.rules.inline.link.exec(n);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=L(t.slice(0,-1),"\\");if((t.length-a.length)%2===0)return}else{let a=_t(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 i=e[2],s="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(i);a&&(i=a[1],s=a[3])}else s=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?i=i.slice(1):i=i.slice(1,-1)),Re(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let i=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[i.toLowerCase()];if(!s){let a=t[0].charAt(0);return{type:"text",raw:a,text:a}}return Re(t,s,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let i=this.rules.inline.emStrongLDelim.exec(n);if(!(!i||i[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!t||this.rules.inline.punctuation.exec(t))){let s=[...i[0]].length-1,a,r,l=s,o=0,h=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+s);(i=h.exec(e))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(r=[...a].length,i[3]||i[4]){l+=r;continue}else if((i[5]||i[6])&&s%3&&!((s+r)%3)){o+=r;continue}if(l-=r,l>0)continue;r=Math.min(r,r+l+o);let c=[...i[0]][0].length,g=n.slice(0,s+i.index+c+r);if(Math.min(s,r)%2){let u=g.slice(1,-1);return{type:"em",raw:g,text:u,tokens:this.lexer.inlineTokens(u)}}let p=g.slice(2,-2);return{type:"strong",raw:g,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return i&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n){let e=this.rules.inline.del.exec(n);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,i;return e[2]==="@"?(t=e[1],i="mailto:"+t):(t=e[1],i=t),{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let t,i;if(e[2]==="@")t=e[0],i="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."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:t,href:i,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},y=class X{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||I,this.options.tokenizer=this.options.tokenizer||new 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:w,block:N.normal,inline:z.normal};this.options.pedantic?(t.block=N.pedantic,t.inline=z.pedantic):this.options.gfm&&(t.block=N.gfm,this.options.breaks?t.inline=z.breaks:t.inline=z.gfm),this.tokenizer.rules=t}static get rules(){return{block:N,inline:z}}static lex(e,t){return new X(t).lex(e)}static lexInline(e,t){return new X(t).inlineTokens(e)}lex(e){e=e.replace(w.carriageReturn,`
28
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let i=this.inlineQueue[t];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],i=!1){for(this.options.pedantic&&(e=e.replace(w.tabCharGlobal," ").replace(w.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+=`
25
+ `,i=i.substring($.length+1),g=T.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(g=>g.type==="space"),c=h.length>0&&h.some(g=>this.rules.other.anyLine.test(g.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=Te(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
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(Te(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=L(t.slice(0,-1),"\\");if((t.length-a.length)%2===0)return}else{let a=_t(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)),Re(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 Re(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,g=i.slice(0,s+n.index+c+r);if(Math.min(s,r)%2){let u=g.slice(1,-1);return{type:"em",raw:g,text:u,tokens:this.lexer.inlineTokens(u)}}let p=g.slice(2,-2);return{type:"strong",raw:g,text:p,tokens:this.lexer.inlineTokens(p)}}}}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){let e=this.rules.inline.del.exec(i);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}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}}}},y=class X{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||I,this.options.tokenizer=this.options.tokenizer||new 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:w,block:N.normal,inline:z.normal};this.options.pedantic?(t.block=N.pedantic,t.inline=z.pedantic):this.options.gfm&&(t.block=N.gfm,this.options.breaks?t.inline=z.breaks:t.inline=z.gfm),this.tokenizer.rules=t}static get rules(){return{block:N,inline:z}}static lex(e,t){return new X(t).lex(e)}static lexInline(e,t){return new X(t).inlineTokens(e)}lex(e){e=e.replace(w.carriageReturn,`
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(w.tabCharGlobal," ").replace(w.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
  `)?"":`
31
31
  `)+s.raw,r.text+=`
32
32
  `+s.text,this.inlineQueue.at(-1).src=r.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let r=t.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=(r.raw.endsWith(`
33
33
  `)?"":`
34
34
  `)+s.raw,r.text+=`
35
- `+s.raw,this.inlineQueue.at(-1).src=r.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},t.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let a=e;if(this.options.extensions?.startBlock){let r=1/0,l=e.slice(1),o;this.options.extensions.startBlock.forEach(h=>{o=h.call({lexer:this},l),typeof o=="number"&&o>=0&&(r=Math.min(r,o))}),r<1/0&&r>=0&&(a=e.substring(0,r+1))}if(this.state.top&&(s=this.tokenizer.paragraph(a))){let r=t.at(-1);i&&r?.type==="paragraph"?(r.raw+=(r.raw.endsWith(`
35
+ `+s.raw,this.inlineQueue.at(-1).src=r.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},t.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let a=e;if(this.options.extensions?.startBlock){let r=1/0,l=e.slice(1),o;this.options.extensions.startBlock.forEach(h=>{o=h.call({lexer:this},l),typeof o=="number"&&o>=0&&(r=Math.min(r,o))}),r<1/0&&r>=0&&(a=e.substring(0,r+1))}if(this.state.top&&(s=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type==="paragraph"?(r.raw+=(r.raw.endsWith(`
36
36
  `)?"":`
37
37
  `)+s.raw,r.text+=`
38
- `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(s),i=a.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let r=t.at(-1);r?.type==="text"?(r.raw+=(r.raw.endsWith(`
38
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(s),n=a.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let r=t.at(-1);r?.type==="text"?(r.raw+=(r.raw.endsWith(`
39
39
  `)?"":`
40
40
  `)+s.raw,r.text+=`
41
- `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(s);continue}if(e){let r="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let i=e,s=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)o.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,s.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)a=s[2]?s[2].length:0,i=i.slice(0,s.index+a)+"["+"a".repeat(s[0].length-a-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let r=!1,l="";for(;e;){r||(l=""),r=!1;let o;if(this.options.extensions?.inline?.some(c=>(o=c.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let c=t.at(-1);o.type==="text"&&c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,i,l)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,g=e.slice(1),p;this.options.extensions.startInline.forEach(u=>{p=u.call({lexer:this},g),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(o=this.tokenizer.inlineText(h)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(l=o.raw.slice(-1)),r=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):t.push(o);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}},F=class{options;parser;constructor(n){this.options=n||I}space(n){return""}code({text:n,lang:e,escaped:t}){let i=(e||"").match(w.notSpaceStart)?.[0],s=n.replace(w.endingNewline,"")+`
42
- `;return i?'<pre><code class="language-'+S(i)+'">'+(t?s:S(s,!0))+`</code></pre>
41
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(s);continue}if(e){let r="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,s=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)a=s[2]?s[2].length:0,n=n.slice(0,s.index+a)+"["+"a".repeat(s[0].length-a-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,l="";for(;e;){r||(l=""),r=!1;let o;if(this.options.extensions?.inline?.some(c=>(o=c.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let c=t.at(-1);o.type==="text"&&c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,l)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,g=e.slice(1),p;this.options.extensions.startInline.forEach(u=>{p=u.call({lexer:this},g),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(o=this.tokenizer.inlineText(h)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(l=o.raw.slice(-1)),r=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=o.raw,c.text+=o.text):t.push(o);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}},F=class{options;parser;constructor(i){this.options=i||I}space(i){return""}code({text:i,lang:e,escaped:t}){let n=(e||"").match(w.notSpaceStart)?.[0],s=i.replace(w.endingNewline,"")+`
42
+ `;return n?'<pre><code class="language-'+S(n)+'">'+(t?s:S(s,!0))+`</code></pre>
43
43
  `:"<pre><code>"+(t?s:S(s,!0))+`</code></pre>
44
- `}blockquote({tokens:n}){return`<blockquote>
45
- ${this.parser.parse(n)}</blockquote>
46
- `}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`<h${e}>${this.parser.parseInline(n)}</h${e}>
47
- `}hr(n){return`<hr>
48
- `}list(n){let e=n.ordered,t=n.start,i="";for(let r=0;r<n.items.length;r++){let l=n.items[r];i+=this.listitem(l)}let s=e?"ol":"ul",a=e&&t!==1?' start="'+t+'"':"";return"<"+s+a+`>
49
- `+i+"</"+s+`>
50
- `}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
51
- `}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
52
- `}table(n){let e="",t="";for(let s=0;s<n.header.length;s++)t+=this.tablecell(n.header[s]);e+=this.tablerow({text:t});let i="";for(let s=0;s<n.rows.length;s++){let a=n.rows[s];t="";for(let r=0;r<a.length;r++)t+=this.tablecell(a[r]);i+=this.tablerow({text:t})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
44
+ `}blockquote({tokens:i}){return`<blockquote>
45
+ ${this.parser.parse(i)}</blockquote>
46
+ `}html({text:i}){return i}def(i){return""}heading({tokens:i,depth:e}){return`<h${e}>${this.parser.parseInline(i)}</h${e}>
47
+ `}hr(i){return`<hr>
48
+ `}list(i){let e=i.ordered,t=i.start,n="";for(let r=0;r<i.items.length;r++){let l=i.items[r];n+=this.listitem(l)}let s=e?"ol":"ul",a=e&&t!==1?' start="'+t+'"':"";return"<"+s+a+`>
49
+ `+n+"</"+s+`>
50
+ `}listitem(i){return`<li>${this.parser.parse(i.tokens)}</li>
51
+ `}checkbox({checked:i}){return"<input "+(i?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:i}){return`<p>${this.parser.parseInline(i)}</p>
52
+ `}table(i){let e="",t="";for(let s=0;s<i.header.length;s++)t+=this.tablecell(i.header[s]);e+=this.tablerow({text:t});let n="";for(let s=0;s<i.rows.length;s++){let a=i.rows[s];t="";for(let r=0;r<a.length;r++)t+=this.tablecell(a[r]);n+=this.tablerow({text:t})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
53
53
  <thead>
54
54
  `+e+`</thead>
55
- `+i+`</table>
56
- `}tablerow({text:n}){return`<tr>
57
- ${n}</tr>
58
- `}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
59
- `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${S(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let i=this.parser.parseInline(t),s=$e(n);if(s===null)return i;n=s;let a='<a href="'+n+'"';return e&&(a+=' title="'+S(e)+'"'),a+=">"+i+"</a>",a}image({href:n,title:e,text:t,tokens:i}){i&&(t=this.parser.parseInline(i,this.parser.textRenderer));let s=$e(n);if(s===null)return S(t);n=s;let a=`<img src="${n}" alt="${t}"`;return e&&(a+=` title="${S(e)}"`),a+=">",a}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:S(n.text)}},oe=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},v=class J{options;renderer;textRenderer;constructor(e){this.options=e||I,this.options.renderer=this.options.renderer||new F,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new oe}static parse(e,t){return new J(t).parse(e)}static parseInline(e,t){return new J(t).parseInline(e)}parse(e){let t="";for(let i=0;i<e.length;i++){let s=e[i];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 i="";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)){i+=l||"";continue}}let r=a;switch(r.type){case"escape":{i+=t.text(r);break}case"html":{i+=t.html(r);break}case"link":{i+=t.link(r);break}case"image":{i+=t.image(r);break}case"checkbox":{i+=t.checkbox(r);break}case"strong":{i+=t.strong(r);break}case"em":{i+=t.em(r);break}case"codespan":{i+=t.codespan(r);break}case"br":{i+=t.br(r);break}case"del":{i+=t.del(r);break}case"text":{i+=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 i}},q=class{options;block;constructor(n){this.options=n||I}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?y.lex:y.lexInline}provideParser(){return this.block?v.parse:v.parseInline}},vt=class{defaults=Y();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=v;Renderer=F;TextRenderer=oe;Lexer=y;Tokenizer=U;Hooks=q;constructor(...n){this.use(...n)}walkTokens(n,e){let t=[];for(let i of n)switch(t=t.concat(e.call(this,i)),i.type){case"table":{let s=i;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=i;t=t.concat(this.walkTokens(s.items,e));break}default:{let s=i;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(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let i={...t};if(i.async=this.defaults.async||i.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)}),i.extensions=e),t.renderer){let s=this.defaults.renderer||new F(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||""}}i.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}}i.tokenizer=s}if(t.hooks){let s=this.defaults.hooks||new q;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];q.passThroughHooks.has(a)?s[r]=h=>{if(this.defaults.async&&q.passThroughHooksRespectAsync.has(a))return(async()=>{let g=await l.call(s,h);return o.call(s,g)})();let c=l.call(s,h);return o.call(s,c)}:s[r]=(...h)=>{if(this.defaults.async)return(async()=>{let g=await l.apply(s,h);return g===!1&&(g=await o.apply(s,h)),g})();let c=l.apply(s,h);return c===!1&&(c=o.apply(s,h)),c}}i.hooks=s}if(t.walkTokens){let s=this.defaults.walkTokens,a=t.walkTokens;i.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,...i}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return y.lex(n,e??this.defaults)}parser(n,e){return v.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let i={...t},s={...this.defaults,...i},a=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.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=n),s.async)return(async()=>{let r=s.hooks?await s.hooks.preprocess(e):e,l=await(s.hooks?await s.hooks.provideLexer():n?y.lex:y.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():n?v.parse:v.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():n?y.lex:y.lexInline)(e,s);s.hooks&&(r=s.hooks.processAllTokens(r)),s.walkTokens&&this.walkTokens(r,s.walkTokens);let l=(s.hooks?s.hooks.provideParser():n?v.parse:v.parseInline)(r,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(r){return a(r)}}}onError(n,e){return t=>{if(t.message+=`
60
- Please report this to https://github.com/markedjs/marked.`,n){let i="<p>An error occurred:</p><pre>"+S(t.message+"",!0)+"</pre>";return e?Promise.resolve(i):i}if(e)return Promise.reject(t);throw t}}},A=new vt;function k(n,e){return A.parse(n,e)}k.options=k.setOptions=function(n){return A.setOptions(n),k.defaults=A.defaults,Ae(k.defaults),k};k.getDefaults=Y;k.defaults=I;k.use=function(...n){return A.use(...n),k.defaults=A.defaults,Ae(k.defaults),k};k.walkTokens=function(n,e){return A.walkTokens(n,e)};k.parseInline=A.parseInline;k.Parser=v;k.parser=v.parse;k.Renderer=F;k.TextRenderer=oe;k.Lexer=y;k.lexer=y.lex;k.Tokenizer=U;k.Hooks=q;k.parse=k;k.options;k.setOptions;k.use;k.walkTokens;k.parseInline;v.parse;y.lex;var K=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 i=t.end-t.start,s=this._pendingText.substring(0,i);this._displayedText+=s,this._pendingText=this._pendingText.substring(i)}else this._displayedText+=e,this._pendingText=this._pendingText.substring(1)}else this._displayedText+=e,this._pendingText=this._pendingText.substring(1)}}_matchMarkdownPattern(e,t){let i=[/<sup>\[\[[^\]]+\]\]\([^)]+\)<\/sup>/,/\[\[[^\]]+\]\]\([^)]+\)/,/\[[^\]]+\]\([^)]+\)/,/!\[[^\]]*\]\([^)]+\)/],s=e.substring(t);for(let a of i){let r=s.match(a);if(r&&r.index===0)return{start:t,end:t+r[0].length}}return null}},St="https://links.esri.com/solutions/agol-organizational-account",$t="https://links.esri.com/solutions/configure-assistants",V=class extends ge{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=me({name:"arcgis-solutions-assistant",blocking:!0}),this._isTyping=!1,this._configContextConsumer=xe({context:be,subscribe:!0,callback:e=>{e?.userSession&&!this.userFirstName&&this._loadUserFirstName(),e?.authentication?.PortalSubset?.orgSettings&&(this._orgSettings=e?.authentication?.PortalSubset?.orgSettings,this._getAIServiceUrl())}}),this.closeAssistant=he(),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 i={author:"human",conversationId:this.conversationStore.conversationId?this.conversationStore.conversationId:"",message:e,render:this._renderSimpleTextMessage(e,"human","","Other")};this.messages=[...this.messages,i];let s=await this.requestAIServer(t,this.solutionAIurl);this.loopRequest(s,this.solutionAIurl)}else{let i={author:"human",message:e,render:this._renderSimpleTextMessage(e,"human","","Other")};this.messages=[...this.messages,i];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 i=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),g=new K(this._currentResponse),p={author:"ai",conversationId:e.conversationId,message:e.message??"",render:c};for(this.messages.push(p),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(g,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(g,this._currentResponse,r,l,o)),e=await this.requestAIServer(x,a);else e=await this.requestAIServer(x,a)}this._isLoading=!1;let{context:u}=this.conversationStore,f=this.messages.length>=2?this._getMostRecentQuestion():"",b=typeof f=="string"?"":f?.message??"",B=_e(i),M=s||u?.intent||"Unknown";if(this._telemetry?.logEvent({category:we.ASSISTANT,action:"Chat",dimensions:[M],metrics:[B]}),u&&u.intent)switch(u.intent){case"Recommend solution":{if(u.results){let x=u.results,_=x.map(Qe=>`- ${Qe.title}`).join(`
55
+ `+n+`</table>
56
+ `}tablerow({text:i}){return`<tr>
57
+ ${i}</tr>
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=$e(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=$e(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)}},oe=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}},v=class J{options;renderer;textRenderer;constructor(e){this.options=e||I,this.options.renderer=this.options.renderer||new F,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new oe}static parse(e,t){return new J(t).parse(e)}static parseInline(e,t){return new J(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}},q=class{options;block;constructor(i){this.options=i||I}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?y.lex:y.lexInline}provideParser(){return this.block?v.parse:v.parseInline}},vt=class{defaults=Y();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=v;Renderer=F;TextRenderer=oe;Lexer=y;Tokenizer=U;Hooks=q;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 F(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 q;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];q.passThroughHooks.has(a)?s[r]=h=>{if(this.defaults.async&&q.passThroughHooksRespectAsync.has(a))return(async()=>{let g=await l.call(s,h);return o.call(s,g)})();let c=l.call(s,h);return o.call(s,c)}:s[r]=(...h)=>{if(this.defaults.async)return(async()=>{let g=await l.apply(s,h);return g===!1&&(g=await o.apply(s,h)),g})();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 y.lex(i,e??this.defaults)}parser(i,e){return v.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?y.lex:y.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?v.parse:v.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?y.lex:y.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?v.parse:v.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}}},A=new vt;function k(i,e){return A.parse(i,e)}k.options=k.setOptions=function(i){return A.setOptions(i),k.defaults=A.defaults,Ae(k.defaults),k};k.getDefaults=Y;k.defaults=I;k.use=function(...i){return A.use(...i),k.defaults=A.defaults,Ae(k.defaults),k};k.walkTokens=function(i,e){return A.walkTokens(i,e)};k.parseInline=A.parseInline;k.Parser=v;k.parser=v.parse;k.Renderer=F;k.TextRenderer=oe;k.Lexer=y;k.lexer=y.lex;k.Tokenizer=U;k.Hooks=q;k.parse=k;k.options;k.setOptions;k.use;k.walkTokens;k.parseInline;v.parse;y.lex;var K=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}},St="https://links.esri.com/solutions/agol-organizational-account",$t="https://links.esri.com/solutions/configure-assistants",V=class extends ge{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=me({name:"arcgis-solutions-assistant",blocking:!0}),this._isTyping=!1,this._configContextConsumer=xe({context:be,subscribe:!0,callback:e=>{e?.userSession&&!this.userFirstName&&this._loadUserFirstName(),e?.authentication?.PortalSubset?.orgSettings&&(this._orgSettings=e?.authentication?.PortalSubset?.orgSettings,this._getAIServiceUrl())}}),this.closeAssistant=he(),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),g=new K(this._currentResponse),p={author:"ai",conversationId:e.conversationId,message:e.message??"",render:c};for(this.messages.push(p),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(g,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(g,this._currentResponse,r,l,o)),e=await this.requestAIServer(x,a);else e=await this.requestAIServer(x,a)}this._isLoading=!1;let{context:u}=this.conversationStore,f=this.messages.length>=2?this._getMostRecentQuestion():"",b=typeof f=="string"?"":f?.message??"",B=_e(n),M=s||u?.intent||"Unknown";if(this._telemetry?.logEvent({category:we.ASSISTANT,action:"Chat",dimensions:[M],metrics:[B]}),u&&u.intent)switch(u.intent){case"Recommend solution":{if(u.results){let x=u.results,_=x.map(Qe=>`- ${Qe.title}`).join(`
61
61
  `),$=this._renderSuggestedSolutions(x),T=this._renderFeedback(this._currentResponse+`
62
- `+_,b,this.conversationStore.conversationId,u.intent);R($,l),R(T,o)}else l.innerHTML="";this._scrollToBottom();break}default:{let x=this._renderFeedback(this._currentResponse,b,this.conversationStore.conversationId,u.intent);R(x,o),this._scrollToBottom();break}}else{if(u&&u.results&&!u.intent)for(let x of u.results){let _=this._renderSolutionsQuestionTable(x.ref,x.followupQuestions),$=this._renderFeedback(this._currentResponse,b,this.conversationStore.conversationId,"Solution question");R(_,l),R($,o)}else if(u&&u.kind&&u.kind.toLowerCase()==="ArcGISErrorAsContext".toLowerCase()){let x=this._renderFeedback(this._currentResponse,b,this.conversationStore.conversationId,"Error");R(x,o)}this._scrollToBottom()}}async requestAIServer(e,t){try{let i=this._configContextConsumer.value?.userSession?.token??"",s=await(await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",token:i},body:JSON.stringify(e)})).json();if(s)return s;throw new Error("No data returned")}catch(i){throw new Error(`Request failed: ${i}`)}}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),i=Object.values(this._translations.defaultFollowUpQuestions),s=this._renderSolutionQuestionFollowup(i);this.messages=[{author:"ai",conversationId:"",message:t,render:this._renderSimpleTextMessage(t,"ai","","Other",void 0,s)}]}(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,i,s){let a=Date.now();return m`
62
+ `+_,b,this.conversationStore.conversationId,u.intent);R($,l),R(T,o)}else l.innerHTML="";this._scrollToBottom();break}default:{let x=this._renderFeedback(this._currentResponse,b,this.conversationStore.conversationId,u.intent);R(x,o),this._scrollToBottom();break}}else{if(u&&u.results&&!u.intent)for(let x of u.results){let _=this._renderSolutionsQuestionTable(x.ref,x.followupQuestions),$=this._renderFeedback(this._currentResponse,b,this.conversationStore.conversationId,"Solution question");R(_,l),R($,o)}else if(u&&u.kind&&u.kind.toLowerCase()==="ArcGISErrorAsContext".toLowerCase()){let x=this._renderFeedback(this._currentResponse,b,this.conversationStore.conversationId,"Error");R(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)}]}(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`
63
63
  <div>
64
64
  <calcite-button
65
65
  appearance='transparent'
@@ -68,7 +68,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let i="<p>An error
68
68
  icon-start='thumbs-up'
69
69
  label='position feedback'
70
70
  kind='neutral'
71
- @click=${()=>{this._sendFeedback(e,t,"Good",i,s)}}
71
+ @click=${()=>{this._sendFeedback(e,t,"Good",n,s)}}
72
72
  >
73
73
  </calcite-button>
74
74
  <calcite-tooltip placement='bottom' reference-element='good-${a}'>
@@ -82,7 +82,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let i="<p>An error
82
82
  icon-start='thumbs-down'
83
83
  label='position feedback'
84
84
  kind='neutral'
85
- @click=${()=>{this._sendFeedback(e,t,"Bad",i,s)}}
85
+ @click=${()=>{this._sendFeedback(e,t,"Bad",n,s)}}
86
86
  >
87
87
  </calcite-button>
88
88
  <calcite-tooltip placement='bottom' reference-element='bad-${a}'>
@@ -122,7 +122,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let i="<p>An error
122
122
  ${t}
123
123
  </calcite-chip>
124
124
  `)}
125
- `}_renderSolutionsQuestionTable(e,t){let i=this._renderSolutionQuestionReferences(e),s=this._renderSolutionQuestionFollowup(t);return m`
125
+ `}_renderSolutionsQuestionTable(e,t){let n=this._renderSolutionQuestionReferences(e),s=this._renderSolutionQuestionFollowup(t);return m`
126
126
  <div slot='description' class='message-content'>
127
127
  <div style='display: flex; justify-content: flex-start;'>
128
128
  <calcite-button
@@ -137,7 +137,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let i="<p>An error
137
137
  </div>
138
138
 
139
139
  <div class='references-container collapsed'>
140
- ${i}
140
+ ${n}
141
141
  </div>
142
142
  </div>
143
143
 
@@ -163,8 +163,8 @@ Please report this to https://github.com/markedjs/marked.`,n){let i="<p>An error
163
163
  <span slot='description' class='solution-snippet'>${e.snippet}</span>
164
164
  </calcite-card>
165
165
  </a>
166
- `}_renderResponseBlock(e,t,i,s){return m`<calcite-card id=${s??j} class="system-message display-none">${e}${t}${i}</calcite-card>`}_renderSimpleTextMessage(e,t,i,s,a,r){let l=this.messages.length>=2?this._getMostRecentQuestion():"",o=typeof l=="string"?"":l?.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=${ke(t==="human"?"user-message":"system-message")}><div class="message-content">${G(e)}${r}${t==="ai"&&i!==""&&this._renderFeedback(e,o,i,s)||""}</div></calcite-card>`}_renderSuggestedSolutions(e){let t=e.map(i=>this._renderSolutionCard(i));return m`
166
+ `}_renderResponseBlock(e,t,n,s){return m`<calcite-card id=${s??j} class="system-message display-none">${e}${t}${n}</calcite-card>`}_renderSimpleTextMessage(e,t,n,s,a,r){let l=this.messages.length>=2?this._getMostRecentQuestion():"",o=typeof l=="string"?"":l?.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=${ke(t==="human"?"user-message":"system-message")}><div class="message-content">${G(e)}${r}${t==="ai"&&n!==""&&this._renderFeedback(e,o,n,s)||""}</div></calcite-card>`}_renderSuggestedSolutions(e){let t=e.map(n=>this._renderSolutionCard(n));return m`
167
167
  <div class='message-content'>
168
168
  ${t}
169
169
  </div>
170
- `}_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??j} 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">${G(this._translations.noPermissionMessage.replace("{{orgUrl}}",St).replace("{{configAI}}",$t))}</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" ${H(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 ${H(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 @click=${()=>{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,i,s,a){let r=`https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(i)}&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 i=t.currentTarget;i.iconStart="check",setTimeout(()=>{i.iconStart="copy"},3e3)}_startTypeWriter(e,t,i,s,a){if(t.length>0){e.setText(t);let r=async()=>{e.updateDisplayText();let l=e.getText(),o=await k.parse(l);i.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)}}};fe("arcgis-solutions-assistant",V);return V},a,b)
170
+ `}_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??j} 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">${G(this._translations.noPermissionMessage.replace("{{orgUrl}}",St).replace("{{configAI}}",$t))}</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" ${H(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 ${H(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 @click=${()=>{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)}}};fe("arcgis-solutions-assistant",V);return V},a,b)