@telia-ace/conversational-hub-bot-provider 0.0.8 → 0.0.10

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,18 +1,18 @@
1
- "use strict";var ke=Object.defineProperty;var Ne=(t,e,o)=>e in t?ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var P=(t,e,o)=>(Ne(t,typeof e!="symbol"?e+"":e,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),s=require("./index-93631b28.js"),b=require("react");require("react-dom");function H(t={}){const{phrase:e="",category:o,guideCategory:n,contactCategory:i,take:r,connectionKey:c,accordion:a,id:l,uriName:d,sorting:g,tag:f,tagId:y,tagTitle:v,...p}=t,m={};return Object.keys(p).forEach(h=>{typeof t[h]=="string"&&(m[h]=t[h])}),typeof e=="string"&&e.length&&(m.phrase=e),e===null&&(m.phrase=e),typeof n=="string"&&n!=="0"&&(m.guideCategory=n),typeof n=="number"&&n!==0&&(m.guideCategory=n),typeof n=="object"&&n!==null&&(typeof n.id=="string"&&n.id!=="0"&&(m.guideCategory=n.id),typeof n.id=="number"&&n.id!==0&&(m.guideCategory=n.id)),typeof i=="string"&&i!=="0"&&(m.contactCategory=i),typeof i=="number"&&i!==0&&(m.contactCategory=i),typeof i=="object"&&i!==null&&(typeof i.id=="string"&&i.id!=="0"&&(m.contactCategory=i.id),typeof i.id=="number"&&i.id!==0&&(m.contactCategory=i.id)),typeof o=="string"&&o!=="0"&&(m.category=o),typeof o=="number"&&o!==0&&(m.category=o),typeof o=="object"&&o!==null&&(typeof o.id=="string"&&o.id!=="0"&&(m.category=o.id),typeof o.id=="number"&&o.id!==0&&(m.category=o.id)),l&&(m.id=l),d&&(+m.category||+m.guideCategory||+m.guide||+m.contactCategory||+m.contactMethod)&&(m.uriName=d),c&&(m.connectionKey=c),r&&(m.take=r),g&&(m.sorting=g),typeof a=="string"&&a.length>0&&(m.accordion=a),typeof f=="string"&&f!=="0"&&(m.tag=f),typeof f=="number"&&f!==0&&(m.tag=f),Array.isArray(f)&&f.length&&(m.tag=f),(typeof y=="string"||typeof y=="number")&&(m.tagId=y),typeof v=="string"&&(m.tagTitle=v),typeof m.tag=="string"&&(m.tag=m.tag.split(",")),m}const ee=t=>{if(!t)return"";const e=[{from:/[äæǽ]+/gi,to:"ae"},{from:/[öœ]+/gi,to:"oe"},{from:/[ü]+/gi,to:"ue"},{from:/[Ä]+/gi,to:"Ae"},{from:/[Ü]+/gi,to:"Ue"},{from:/[Ö]+/gi,to:"Oe"},{from:/[ÀÁÂÃÄÅǺĀĂĄǍΑΆẢẠẦẪẨẬẰẮẴẲẶА]+/gi,to:"A"},{from:/[àáâãåǻāăąǎªαάảạầấẫẩậằắẵẳặа]+/gi,to:"a"},{from:/[Б]+/gi,to:"B"},{from:/[б]+/gi,to:"b"},{from:/[ÇĆĈĊČ]+/gi,to:"C"},{from:/[çćĉċč]+/gi,to:"c"},{from:/[Д]+/gi,to:"D"},{from:/[д]+/gi,to:"d"},{from:/[ÐĎĐΔ]+/gi,to:"Dj"},{from:/[ðďđδ]+/gi,to:"dj"},{from:/[ÈÉÊËĒĔĖĘĚΕΈẼẺẸỀẾỄỂỆЕЭ]+/gi,to:"E"},{from:/[èéêëēĕėęěέεẽẻẹềếễểệеэ]+/gi,to:"e"},{from:/[Ф]+/gi,to:"F"},{from:/[ф]+/gi,to:"f"},{from:/[ĜĞĠĢΓГҐ]+/gi,to:"G"},{from:/[ĝğġģγгґ]+/gi,to:"g"},{from:/[ĤĦ]+/gi,to:"H"},{from:/[ĥħ]+/gi,to:"h"},{from:/[ÌÍÎÏĨĪĬǏĮİΗΉΊΙΪỈỊИЫ]+/gi,to:"I"},{from:/[ìíîïĩīĭǐįıηήίιϊỉịиыї]+/gi,to:"i"},{from:/[Ĵ]+/gi,to:"J"},{from:/[ĵ]+/gi,to:"j"},{from:/[ĶΚК]+/gi,to:"K"},{from:/[ķκк]+/gi,to:"k"},{from:/[ĹĻĽĿŁΛЛ]+/gi,to:"L"},{from:/[ĺļľŀłλл]+/gi,to:"l"},{from:/[М]+/gi,to:"M"},{from:/[м]+/gi,to:"m"},{from:/[ÑŃŅŇΝН]+/gi,to:"N"},{from:/[ñńņňʼnνн]+/gi,to:"n"},{from:/[ÒÓÔÕŌŎǑŐƠØǾΟΌΩΏỎỌỒỐỖỔỘỜỚỠỞỢО]+/gi,to:"O"},{from:/[òóôõōŏǒőơøǿºοόωώỏọồốỗổộờớỡởợо]+/gi,to:"o"},{from:/[П]+/gi,to:"P"},{from:/[п]+/gi,to:"p"},{from:/[ŔŖŘΡР]+/gi,to:"R"},{from:/[ŕŗřρр]+/gi,to:"r"},{from:/[ŚŜŞȘŠΣС]+/gi,to:"S"},{from:/[śŝşșšſσςс]+/gi,to:"s"},{from:/[ȚŢŤŦτТ]+/gi,to:"T"},{from:/[țţťŧт]+/gi,to:"t"},{from:/[ÙÚÛŨŪŬŮŰŲƯǓǕǗǙǛŨỦỤỪỨỮỬỰУ]+/gi,to:"U"},{from:/[ùúûũūŭůűųưǔǖǘǚǜυύϋủụừứữửựу]+/gi,to:"u"},{from:/[ÝŸŶΥΎΫỲỸỶỴЙ]+/gi,to:"Y"},{from:/[ýÿŷỳỹỷỵй]+/gi,to:"y"},{from:/[В]+/gi,to:"V"},{from:/[в]+/gi,to:"v"},{from:/[Ŵ]+/gi,to:"W"},{from:/[ŵ]+/gi,to:"w"},{from:/[ŹŻŽΖЗ]+/gi,to:"Z"},{from:/[źżžζз]+/gi,to:"z"},{from:/[ÆǼ]+/gi,to:"AE"},{from:/[ß]+/gi,to:"ss"},{from:/[IJ]+/gi,to:"IJ"},{from:/[ij]+/gi,to:"ij"},{from:/[Œ]+/gi,to:"OE"},{from:/[ƒ]+/gi,to:"f"},{from:/[ξ]+/gi,to:"ks"},{from:/[π]+/gi,to:"p"},{from:/[β]+/gi,to:"v"},{from:/[μ]+/gi,to:"m"},{from:/[ψ]+/gi,to:"ps"},{from:/[Ё]+/gi,to:"Yo"},{from:/[ё]+/gi,to:"yo"},{from:/[Є]+/gi,to:"Ye"},{from:/[є]+/gi,to:"ye"},{from:/[Ї]+/gi,to:"Yi"},{from:/[Ж]+/gi,to:"Zh"},{from:/[ж]+/gi,to:"zh"},{from:/[Х]+/gi,to:"Kh"},{from:/[х]+/gi,to:"kh"},{from:/[Ц]+/gi,to:"Ts"},{from:/[ц]+/gi,to:"ts"},{from:/[Ч]+/gi,to:"Ch"},{from:/[ч]+/gi,to:"ch"},{from:/[Ш]+/gi,to:"Sh"},{from:/[ш]+/gi,to:"sh"},{from:/[Щ]+/gi,to:"Shch"},{from:/[щ]+/gi,to:"shch"},{from:/[ЪъЬь]+/gi,to:""},{from:/[Ю]+/gi,to:"Yu"},{from:/[ю]+/gi,to:"yu"},{from:/[Я]+/gi,to:"Ya"},{from:/[я]+/gi,to:"ya"}],o=/[^a-zA-Z0-9]+/g,n=/[-]$/;let i=t;for(const r in e)e.hasOwnProperty(r)&&e[r].from.test(t)&&(i=i.replace(e[r].from,e[r].to));return i=i.replace(o,"-"),i=i.replace(n,""),i=i.toLowerCase(),i||"humany"},je=(t,e)=>{if(!t||!e)return!0;let o=e.parentNode,n=!1;for(;o!==null;)o===t&&(n=!0),o=o.parentNode;return n},te=(t={})=>(Object.keys(t).forEach(e=>{(t[e]===null||typeof t[e]>"u")&&delete t[e]}),t),_=(t,e)=>{let o=!0;return Object.keys(t).length!==Object.keys(e).length||Object.keys(t).some(i=>!Object.keys(e).some(c=>i===c))?!1:(Object.keys(t).forEach(i=>{if(o){const r=typeof t[i]>"u"?"":t[i],c=typeof e[i]>"u"?"":e[i];o=r.toString()===c.toString()}}),o)},fe=()=>b.useContext(s.ComponentNodeContext),Me=(t,e)=>{const o=fe(),n=s.useContainer(),[i,r]=b.useState(void 0),c=s.useIsMounted(),a=t||o.type||"";return b.useEffect(()=>{if(a){let l;return(e||n).getAsync("componentResolver").then(d=>{if(c.current){const g=d.getComponent(a);r(g)}l=d.registerResolver(a,g=>{c.current&&r(g)})}),()=>{l&&l()}}},[c,a,e,n]),i},ze=()=>b.useContext(s.ConversationContext),Te=()=>{const t=s.useComponentPlatform(),e=fe(),[o,n]=b.useState([]),[i,r]=b.useState();return b.useEffect(()=>{if(t&&e){const c=new s.ComponentQuery(t).withId(e.id),a=t.actions(c,e.type||s.uuid());r(a),o!==null&&(o.forEach(l=>{a.dispatch(l.key,l.data).then(d=>l.resolve(d)).catch(d=>l.reject(d))}),n(null))}},[t,e.id]),(c,a)=>o!==null?new Promise((l,d)=>{o.push({key:c,data:a,resolve:l,reject:d})}):i.dispatch(c,a)},Re=()=>{const[t,e]=b.useState(!1);return b.useEffect(()=>{const o=()=>{e(!1)},n=i=>{i.keyCode===9&&e(!0)};return window.addEventListener("keydown",n),window.addEventListener("click",o),()=>{window.removeEventListener("keydown",n),window.removeEventListener("click",o)}},[]),t},ie=t=>{const e=s.useContainer(),o=s.useRouter(),[n,i]=b.useState({name:"",params:{}}),r=s.useIsMounted();return b.useEffect(()=>{const c=(t||e).get("$widget");if(!c)return;const{events:a}=c;return a.subscribe("router:change",(d,{next:{routeData:g}})=>{if(r.current){const{name:f,params:y}=g;te(y),i({name:f,params:y})}})},[r,t,e]),b.useEffect(()=>{if(o&&o.history&&r.current){const c=o.getRouteData(),{name:a,params:l}=c;te(l),i({name:a,params:l})}},[o,r]),n};var ue=(t=>(t.HH_MM="hh:mm",t.YYYY_MM_DD="yyyy-mm-dd",t.YYYY_MM_DD_HH_MM="yyyy-mm-dd hh:mm",t))(ue||{});const he=({className:t="",format:e="hh:mm",timestamp:o})=>u.jsx("span",{className:s.appendClassNames(t,"humany-timestamp"),children:Ie(o,e)}),ne=t=>`0${t}`.slice(-2);function Ie(t,e){const o=new Date(t),n=o.toTimeString().split(" ")[0].split(":"),i=n.length>1?`${n[0]}:${n[1]}`:n[0],r=o.getFullYear(),c=o.getMonth()+1,a=o.getDate(),l=`${r}-${ne(c)}-${ne(a)}`;return e==="yyyy-mm-dd"?l:e==="hh:mm"?i:`${l} ${i}`}var K=(t=>(t.guide="guide",t.link="link",t.default="default",t))(K||{});const re=t=>Promise.resolve().then(()=>require("./index-373df3a5.js")).then(({ServiceClient:e,ServiceProxy:o})=>t.get("settings").then(n=>{const{name:i,events:r}=t.get("$widget"),{data:{projection:c="",site:a="current",forceHttps:l=!1}}=n,d=new o(c,{credentials:"same-origin"}),g=new e(d,{funnel:i.replace("_contact-method","").replace("_contact",""),site:Ee(a,l)},null,t);return r.subscribe("widget:settings-updated",(f,{data:y})=>{y&&y.projection!==c&&g.proxy.setBaseUrl(y.projection)}),g})),Ee=(t,e)=>()=>{const o=i=>{const r=document.createElement("a");return r.href=i,r};let n=window.location;return t==="referrer"&&document.referrer&&(n=o(document.referrer)),[e?"https:":"","//",n.host,n.pathname].join("")},B=t=>{if(t){const{Type:e,Content:o}=t;if(e&&o)return{type:e,content:o}}},oe=t=>t.map(e=>{const o={id:e.Id.toString(),title:e.Name,symbol:B(e.DefaultIcon),activeSymbol:e.ActiveIcon&&B(e.ActiveIcon),description:e.Description||e.Attributes&&e.Attributes.description||"",matches:e.GuidesCount};return e.Children&&e.Children.length&&(o.items=oe(e.Children)),o}),A=(t,e)=>t.filter(({Type:o})=>o===e).map(({Id:o,Title:n,Body:i})=>({id:o.toString(),title:n,body:i})),W=t=>t.map(({Id:e,Title:o,DefaultIcon:n,ListNotices:i,Notices:r})=>({id:e.toString(),title:o,symbol:B(n),defaultHeaderOptions:{visible:!!i.length},notifications:(i||[]).concat(r||[]).map(({Id:c,Title:a,Body:l,Type:d,Modified:g})=>({id:c.toString(),title:a,body:l,modified:g,expandable:d==="listNotice"}))})),Z=({Id:t,Title:e,DefaultIcon:o,Exits:[n],ExitType:i,ConfirmationText:r,ExpandFormAutomatically:c,Form:a,Description:l},d)=>{const{Adapter:g}=n||{Adapter:{}},{ClientName:f="",Settings:y={},CustomClientName:v=""}=g,p={id:t.toString(),title:e,description:l,symbol:B(o),clientName:f==="custom.adapter"?v:f,expanded:!0,inline:!0,body:{}};if(f.indexOf("phone")>-1||f.indexOf("freetext")>-1){const{displayTextBeforeClick:m,textBeforeClick:h}=y;m==="true"&&(p.expanded=!1,p.title=h),f.indexOf("phone.text")>-1?p.body.phoneNumber=y.phoneNumber:p.body.freetext=y.freetext}return(f.indexOf("chat.popup")>-1||f.indexOf("link")>-1||f==="custom.adapter"&&i==="custom")&&(p.body=y,p.body.confirmationFallback=r),f.indexOf("ace")>-1&&(p.body=y),a&&a.HasValueComponents&&(d?p.body.form=s.FormBuilder.fromLegacyForm(t.toString(),a,d).get():p.body.form=s.FormBuilder.fromLegacyForm(t.toString(),a).get(),c||(p.expanded=p.inline=!1)),p},D=(t=[])=>t.map(({Id:e,Title:o,TotalMatches:n,Symbol:i,DefaultIcon:r,ActiveIcon:c})=>({id:e.toString(),title:o,matches:n,symbol:B(r||i),defaultIcon:B(r),activeIcon:B(c)})),J=t=>t.map(({Id:e,Title:o,Tags:n,FirstPublishedDate:i,Modified:r})=>({id:e.toString(),title:o,tags:D(n),published:i,modified:r})),Ae=(t,e)=>{switch(t){case R.MatchByCategory:case R.Match:{const o={guides:[],matches:0,topNotifications:[],middleNotifications:[],bottomNotifications:[],notificationLists:[],tags:[],byCategory:[]},{Matches:n,TotalMatches:i,Notices:r,NoticeLists:c,Tags:a,ByCategory:l}=e;return o.guides=J(n),o.matches=i,o.byCategory=(l||[]).map(({Id:d,Matches:g,TotalMatches:f})=>({id:d,guides:J(g),matches:f})),o.tags=D(a),o.notificationLists=W(c||[]),o.topNotifications=A(r||[],"noticeRowTop"),o.middleNotifications=A(r||[],"noticeRowMiddle"),o.bottomNotifications=A(r||[],"footerNotice"),o}case R.Categories:{const{Children:o,GuidesCountTotal:n}=e;return{categories:oe(o||[]),matches:n}}case R.Guide:{const{Id:o,Title:n,Body:i,Related:r,Options:c,ConnectionId:a,ContactMethods:l,EnableFeedback:d,HandoverExists:g,FirstPublishedDate:f,Modified:y,ModifiedByDisplayName:v,FirstPublishedByDisplayName:p,Categories:m,Tags:h,SeoMetaDescription:x,SeoAllowIndex:C,Perspectives:N,PerspectiveKey:w,Translations:j}=e,$=w||Object.values(N).find(M=>M===a)||N.Default||null,q={guide:{id:o.toString(),title:n,body:i,modified:y,published:f,modifiedBy:v,publishedBy:p,connection:a,categories:m,hasHandover:g,allowFeedback:d,seoMetaDescription:x,seoAllowIndex:C,perspectives:N,perspective:$,translations:Object.keys(j||{}).reduce((M,I)=>(M[I]=j[I].toString(),M),{})},related:J(r||[]),dialog:[],contactMethods:(l||[]).map(M=>Z(M)),tags:D(h)};return(c||[]).forEach(({CanAccess:M,Description:I,ConnectionId:L,Properties:S})=>{if(!M)return;const z={id:o.toString(),title:I,connection:L,connectionKey:S.ConnectionKey,type:K.default,parent:{id:o.toString(),title:n,tags:D(h)}};if(S.Type==="Guide"||S.Type==="Link")switch(S.Id&&(z.id=S.Id.toString()),S.Uri&&(z.href=S.Uri),S.Target&&(z.target=S.Target),S.Type){case"Guide":z.type=K.guide;break;case"Link":z.type=K.link;break}q.dialog.push(z)}),q}case R.Contacts:{const{Children:o,Matches:n,Notices:i,NoticeLists:r}=e;return{contactMethods:(n||[]).map(a=>Z(a)),categories:oe(o||[]),topNotifications:A(i||[],"noticeRowTop"),middleNotifications:A(i||[],"noticeRowMiddle"),bottomNotifications:A(i||[],"footerNotice"),notificationLists:W(r||[])}}case R.ContactMethod:{const{ContactMethod:o}=e;return Z(o||{})}case R.Tags:case R.TagsOnGuides:return D(e||[]);case R.Notifications:{const{Notices:o,NoticeLists:n}=e;return{topNotifications:A(o||[],"noticeRowTop"),middleNotifications:A(o||[],"noticeRowMiddle"),bottomNotifications:A(o||[],"footerNotice"),notificationLists:W(n||[])}}default:return{}}};var ge=(t=>(t.Guide="guide",t.Guides="guides",t.GuidesByCategory="guides-by-category",t.RowNotifications="row-notices",t.NotificationLists="notification-lists",t.GuideCategories="guide-categories",t.ContactMethodCategories="contact-method-categories",t.ContactMethod="contact-method",t.ContactMethods="contact-methods",t.Tags="tags",t.TagsOnGuides="tagsonguides",t))(ge||{}),R=(t=>(t.Match="match",t.Categories="categories",t.Guide="guide",t.Contacts="contacts",t.ContactMethod="contact-method",t.MatchByCategory="match-by-category",t.Tags="tags",t.TagsOnGuides="tagsonguides",t.Notifications="notifications",t))(R||{});const ae=t=>{switch(t){case"guides":return"match";case"guides-by-category":return"match-by-category";case"guide":return"guide";case"guide-categories":return"categories";case"contact-method-categories":case"contact-methods":return"contacts";case"contact-method":return"contact-method";case"tags":return"tags";case"tagsonguides":return"tagsonguides";case"notification-lists":case"row-notices":return"notifications";default:throw"error"}},Le=async t=>{const{invoke:e}=t.get("$widget");return await e("renderState")===s.WidgetRenderState.hidden};class G{constructor(e,o){P(this,"queries",new Map);P(this,"lastTake",0);P(this,"events");P(this,"getUnresolvedQueries",()=>{let e=0;return this.queries.forEach((o,n)=>{o.some(r=>!r.resolved)&&(e=1)}),e});this.container=e,this.matchingClient=o,this.events=e.get("$widget").events,this.events.subscribe("widget:settings-updated",()=>this.queries=new Map),this.events.subscribe("widget:render-state-changed",(n,{next:i,previous:r})=>{r===s.WidgetRenderState.hidden&&i===s.WidgetRenderState.open&&this.fetchAllUnresolvedQueries()})}static getInstance(e,o="dataClient"){return s.lock(this)(()=>e.getAsync(o).then(async n=>{let i=await e.getAsync("matchingClient");i||(i=await re(e),e.registerAsync("matchingClient",()=>i));let r=n;return r||(r=new G(e,i),e.registerAsync(o,()=>r)),r}))}fetch(e,o,n){return new Promise((i,r)=>{o.take&&(this.lastTake=+(o.take||0)),te(o);const c=ae(e);let a=this.queries.get(c)||[],l=a.find(d=>_(d.params,o))||null;if(l&&(n!=null&&n.noCache)){const d=a.findIndex(g=>_(g.params,o));a=[...a.slice(0,d),...a.slice(d+1)],l=null}if(l){const d=a.indexOf(l);if(l.resolved?(this.events.dispatch("data-client:fetched",{params:o,type:c,response:l.data,unresolvedQueries:this.getUnresolvedQueries()}),this.track(l.data,c,l.error),l.data&&l.error?r({error:l.error}):i(l.data)):l.resolvers.push({resolve:i,reject:r}),a.splice(d,1),a.push(l),this.queries.set(c,a),!l.loading&&!l.resolved)return this.runQuery(c,o)}else return a.push({params:o,resolved:!1,loading:!0,data:{},resolvers:[{resolve:i,reject:r}]}),this.queries.set(c,a),this.runQuery(c,o)}).then(i=>s.deepClone(i))}read(e,o){const{select:n}=o,i=ae(e);return(this.queries.get(i)||[]).reduce((a,l)=>{if(typeof n=="function"){const d=n(l.data);d&&a.push(d)}else a.push(l.data);return a},[])}feedback(e,o,n){return this.matchingClient.giveFeedback(e,o,n)}setLoadingStatus(e,o,n){const i=this.queries.get(e)||[],r=i.find(c=>_(c.params,o));r&&(r.loading=n),this.queries.set(e,i)}async runQuery(e,o){const{searchPhrase:n="",categories:i="0",contactMethodCategoryId:r="0",contactMethodId:c="0",tagId:a=void 0,take:l=5,connection:d="",guideId:g,expandCategories:f="descendants",currentCategory:y,sorting:v="popularity-descending",guideIds:p=[]}=o,m=n.toString().trim();if(await Le(this.container))return Promise.resolve();switch(e){case"match":{const h=x=>{const[C,N]=x.split("-");return{type:new Map([["popularity","popularity"],["alphabetic","title"],["modified","lastModified"],["published","firstPublished"]]).get(C),direction:N}};return p.length?this.matchingClient.customRequest("guides","POST",{configuration:{ids:p,take:+l}}).then(x=>x&&this.handleResponse(x,e,o)):this.matchingClient.match(m,{categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a,sorting:h(v),ids:p}).then(x=>x&&this.handleResponse(x,e,o))}case"match-by-category":return this.matchingClient.match(m,{groupByCategory:!0,categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"guide":return this.matchingClient.getGuide(g,{connectionId:d}).then(h=>{h&&this.handleResponse(h,e,o)}).catch(h=>{const x={message:"Something went wrong.",status:h.status||400};x.status===404&&(x.message="The guide could not be found."),this.handleResponse({},e,o,x)});case"categories":return this.matchingClient.getCategories({phrase:m,expand:f,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"contacts":return g?this.matchingClient.contactMethods(+g,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o)):this.matchingClient.contacts(+r,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o));case"contact-method":return this.matchingClient.getContactMethod(+c,{guideId:g,currentCategory:y}).then(h=>h&&this.handleResponse(h,e,o));case"tags":return this.matchingClient.customRequest("tags","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o));case"tagsonguides":return this.matchingClient.customRequest("tagsonguides","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i],tags:a}}).then(h=>h&&this.handleResponse(h,e,o));case"notifications":return this.matchingClient.customRequest("notices","GET",{configuration:{phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o))}}handleResponse(e={},o,n,i){const r=this.queries.get(o)||[],c=r.find(a=>_(a.params,n));if(c){const a=i||Ae(o,e);this.track(a,o,i),c.resolvers.forEach(d=>{i?d.reject({error:a}):d.resolve(a)});const l=r.indexOf(c);l>-1&&r.splice(l,1),r.push({...c,error:i,resolvers:[],data:a,resolved:!0}),this.setLoadingStatus(o,n,!1),this.queries.set(o,r),i||this.events.dispatch("data-client:fetched",{type:o,params:n,response:a,unresolvedQueries:this.getUnresolvedQueries()})}}fetchAllUnresolvedQueries(){for(const[e,o]of this.queries)o.filter(n=>!n.resolved).forEach(n=>{this.runQuery(e,n.params)})}track(e={},o,n){const i=this.container.get("$widget");i&&!n?i.events.dispatch("tracking:service-client-response",{type:o,data:e}):i&&i.events.dispatch("tracking:service-client-error",{type:o,error:n})}static create(e){return e.getAsync("matchingClient").then(async o=>{if(o)return new G(e,o);const n=await re(e);return e.registerAsync("matchingClient",()=>n),new G(e,n)})}getClient(){return this.matchingClient}}const Be=({title:t="",className:e,id:o,parent:n,connection:i,type:r,target:c,href:a,children:l,connectionKey:d})=>{const g={},{name:f,params:y}=ie();switch(r){case"default":case"guide":const{id:v,title:p}=n;let m=d||i;v!==o&&!d&&(m=void 0),g.routeName=f,g.params=H({...y,guide:o,connection:m,uriName:ee(o===v?p:t)});break;case"link":g.href=a,g.target=c;break}return u.jsx(s.Link,{className:s.appendClassNames(e,"humany-dialog-link"),...g,children:l||u.jsxs(u.Fragment,{children:[r==="link"&&u.jsx(s.Icon,{faIcon:"link"}),u.jsx("span",{children:t})]})})};b.forwardRef(({className:t,dialog:e,...o},n)=>e.length?u.jsx(Oe,{className:s.appendClassNames(t,"humany-dialog"),items:e,renderItem:i=>u.jsx("li",{"data-dialog":i.connection,children:u.jsx(Be,{...i})},i.connection),...o,ref:n}):null);const Oe=s.newStyled(s.List)`
2
- ${s.list}
1
+ "use strict";var ke=Object.defineProperty;var Ne=(t,e,o)=>e in t?ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var P=(t,e,o)=>(Ne(t,typeof e!="symbol"?e+"":e,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),n=require("./index-d19a1921.js"),b=require("react");require("react-dom");function H(t={}){const{phrase:e="",category:o,guideCategory:s,contactCategory:i,take:r,connectionKey:c,accordion:a,id:l,uriName:d,sorting:g,tag:f,tagId:y,tagTitle:v,...p}=t,m={};return Object.keys(p).forEach(h=>{typeof t[h]=="string"&&(m[h]=t[h])}),typeof e=="string"&&e.length&&(m.phrase=e),e===null&&(m.phrase=e),typeof s=="string"&&s!=="0"&&(m.guideCategory=s),typeof s=="number"&&s!==0&&(m.guideCategory=s),typeof s=="object"&&s!==null&&(typeof s.id=="string"&&s.id!=="0"&&(m.guideCategory=s.id),typeof s.id=="number"&&s.id!==0&&(m.guideCategory=s.id)),typeof i=="string"&&i!=="0"&&(m.contactCategory=i),typeof i=="number"&&i!==0&&(m.contactCategory=i),typeof i=="object"&&i!==null&&(typeof i.id=="string"&&i.id!=="0"&&(m.contactCategory=i.id),typeof i.id=="number"&&i.id!==0&&(m.contactCategory=i.id)),typeof o=="string"&&o!=="0"&&(m.category=o),typeof o=="number"&&o!==0&&(m.category=o),typeof o=="object"&&o!==null&&(typeof o.id=="string"&&o.id!=="0"&&(m.category=o.id),typeof o.id=="number"&&o.id!==0&&(m.category=o.id)),l&&(m.id=l),d&&(+m.category||+m.guideCategory||+m.guide||+m.contactCategory||+m.contactMethod)&&(m.uriName=d),c&&(m.connectionKey=c),r&&(m.take=r),g&&(m.sorting=g),typeof a=="string"&&a.length>0&&(m.accordion=a),typeof f=="string"&&f!=="0"&&(m.tag=f),typeof f=="number"&&f!==0&&(m.tag=f),Array.isArray(f)&&f.length&&(m.tag=f),(typeof y=="string"||typeof y=="number")&&(m.tagId=y),typeof v=="string"&&(m.tagTitle=v),typeof m.tag=="string"&&(m.tag=m.tag.split(",")),m}const ee=t=>{if(!t)return"";const e=[{from:/[äæǽ]+/gi,to:"ae"},{from:/[öœ]+/gi,to:"oe"},{from:/[ü]+/gi,to:"ue"},{from:/[Ä]+/gi,to:"Ae"},{from:/[Ü]+/gi,to:"Ue"},{from:/[Ö]+/gi,to:"Oe"},{from:/[ÀÁÂÃÄÅǺĀĂĄǍΑΆẢẠẦẪẨẬẰẮẴẲẶА]+/gi,to:"A"},{from:/[àáâãåǻāăąǎªαάảạầấẫẩậằắẵẳặа]+/gi,to:"a"},{from:/[Б]+/gi,to:"B"},{from:/[б]+/gi,to:"b"},{from:/[ÇĆĈĊČ]+/gi,to:"C"},{from:/[çćĉċč]+/gi,to:"c"},{from:/[Д]+/gi,to:"D"},{from:/[д]+/gi,to:"d"},{from:/[ÐĎĐΔ]+/gi,to:"Dj"},{from:/[ðďđδ]+/gi,to:"dj"},{from:/[ÈÉÊËĒĔĖĘĚΕΈẼẺẸỀẾỄỂỆЕЭ]+/gi,to:"E"},{from:/[èéêëēĕėęěέεẽẻẹềếễểệеэ]+/gi,to:"e"},{from:/[Ф]+/gi,to:"F"},{from:/[ф]+/gi,to:"f"},{from:/[ĜĞĠĢΓГҐ]+/gi,to:"G"},{from:/[ĝğġģγгґ]+/gi,to:"g"},{from:/[ĤĦ]+/gi,to:"H"},{from:/[ĥħ]+/gi,to:"h"},{from:/[ÌÍÎÏĨĪĬǏĮİΗΉΊΙΪỈỊИЫ]+/gi,to:"I"},{from:/[ìíîïĩīĭǐįıηήίιϊỉịиыї]+/gi,to:"i"},{from:/[Ĵ]+/gi,to:"J"},{from:/[ĵ]+/gi,to:"j"},{from:/[ĶΚК]+/gi,to:"K"},{from:/[ķκк]+/gi,to:"k"},{from:/[ĹĻĽĿŁΛЛ]+/gi,to:"L"},{from:/[ĺļľŀłλл]+/gi,to:"l"},{from:/[М]+/gi,to:"M"},{from:/[м]+/gi,to:"m"},{from:/[ÑŃŅŇΝН]+/gi,to:"N"},{from:/[ñńņňʼnνн]+/gi,to:"n"},{from:/[ÒÓÔÕŌŎǑŐƠØǾΟΌΩΏỎỌỒỐỖỔỘỜỚỠỞỢО]+/gi,to:"O"},{from:/[òóôõōŏǒőơøǿºοόωώỏọồốỗổộờớỡởợо]+/gi,to:"o"},{from:/[П]+/gi,to:"P"},{from:/[п]+/gi,to:"p"},{from:/[ŔŖŘΡР]+/gi,to:"R"},{from:/[ŕŗřρр]+/gi,to:"r"},{from:/[ŚŜŞȘŠΣС]+/gi,to:"S"},{from:/[śŝşșšſσςс]+/gi,to:"s"},{from:/[ȚŢŤŦτТ]+/gi,to:"T"},{from:/[țţťŧт]+/gi,to:"t"},{from:/[ÙÚÛŨŪŬŮŰŲƯǓǕǗǙǛŨỦỤỪỨỮỬỰУ]+/gi,to:"U"},{from:/[ùúûũūŭůűųưǔǖǘǚǜυύϋủụừứữửựу]+/gi,to:"u"},{from:/[ÝŸŶΥΎΫỲỸỶỴЙ]+/gi,to:"Y"},{from:/[ýÿŷỳỹỷỵй]+/gi,to:"y"},{from:/[В]+/gi,to:"V"},{from:/[в]+/gi,to:"v"},{from:/[Ŵ]+/gi,to:"W"},{from:/[ŵ]+/gi,to:"w"},{from:/[ŹŻŽΖЗ]+/gi,to:"Z"},{from:/[źżžζз]+/gi,to:"z"},{from:/[ÆǼ]+/gi,to:"AE"},{from:/[ß]+/gi,to:"ss"},{from:/[IJ]+/gi,to:"IJ"},{from:/[ij]+/gi,to:"ij"},{from:/[Œ]+/gi,to:"OE"},{from:/[ƒ]+/gi,to:"f"},{from:/[ξ]+/gi,to:"ks"},{from:/[π]+/gi,to:"p"},{from:/[β]+/gi,to:"v"},{from:/[μ]+/gi,to:"m"},{from:/[ψ]+/gi,to:"ps"},{from:/[Ё]+/gi,to:"Yo"},{from:/[ё]+/gi,to:"yo"},{from:/[Є]+/gi,to:"Ye"},{from:/[є]+/gi,to:"ye"},{from:/[Ї]+/gi,to:"Yi"},{from:/[Ж]+/gi,to:"Zh"},{from:/[ж]+/gi,to:"zh"},{from:/[Х]+/gi,to:"Kh"},{from:/[х]+/gi,to:"kh"},{from:/[Ц]+/gi,to:"Ts"},{from:/[ц]+/gi,to:"ts"},{from:/[Ч]+/gi,to:"Ch"},{from:/[ч]+/gi,to:"ch"},{from:/[Ш]+/gi,to:"Sh"},{from:/[ш]+/gi,to:"sh"},{from:/[Щ]+/gi,to:"Shch"},{from:/[щ]+/gi,to:"shch"},{from:/[ЪъЬь]+/gi,to:""},{from:/[Ю]+/gi,to:"Yu"},{from:/[ю]+/gi,to:"yu"},{from:/[Я]+/gi,to:"Ya"},{from:/[я]+/gi,to:"ya"}],o=/[^a-zA-Z0-9]+/g,s=/[-]$/;let i=t;for(const r in e)e.hasOwnProperty(r)&&e[r].from.test(t)&&(i=i.replace(e[r].from,e[r].to));return i=i.replace(o,"-"),i=i.replace(s,""),i=i.toLowerCase(),i||"humany"},je=(t,e)=>{if(!t||!e)return!0;let o=e.parentNode,s=!1;for(;o!==null;)o===t&&(s=!0),o=o.parentNode;return s},te=(t={})=>(Object.keys(t).forEach(e=>{(t[e]===null||typeof t[e]>"u")&&delete t[e]}),t),_=(t,e)=>{let o=!0;return Object.keys(t).length!==Object.keys(e).length||Object.keys(t).some(i=>!Object.keys(e).some(c=>i===c))?!1:(Object.keys(t).forEach(i=>{if(o){const r=typeof t[i]>"u"?"":t[i],c=typeof e[i]>"u"?"":e[i];o=r.toString()===c.toString()}}),o)},fe=()=>b.useContext(n.ComponentNodeContext),Me=(t,e)=>{const o=fe(),s=n.useContainer(),[i,r]=b.useState(void 0),c=n.useIsMounted(),a=t||o.type||"";return b.useEffect(()=>{if(a){let l;return(e||s).getAsync("componentResolver").then(d=>{if(c.current){const g=d.getComponent(a);r(g)}l=d.registerResolver(a,g=>{c.current&&r(g)})}),()=>{l&&l()}}},[c,a,e,s]),i},ze=()=>b.useContext(n.ConversationContext),Te=()=>{const t=n.useComponentPlatform(),e=fe(),[o,s]=b.useState([]),[i,r]=b.useState();return b.useEffect(()=>{if(t&&e){const c=new n.ComponentQuery(t).withId(e.id),a=t.actions(c,e.type||n.uuid());r(a),o!==null&&(o.forEach(l=>{a.dispatch(l.key,l.data).then(d=>l.resolve(d)).catch(d=>l.reject(d))}),s(null))}},[t,e.id]),(c,a)=>o!==null?new Promise((l,d)=>{o.push({key:c,data:a,resolve:l,reject:d})}):i.dispatch(c,a)},Re=()=>{const[t,e]=b.useState(!1);return b.useEffect(()=>{const o=()=>{e(!1)},s=i=>{i.keyCode===9&&e(!0)};return window.addEventListener("keydown",s),window.addEventListener("click",o),()=>{window.removeEventListener("keydown",s),window.removeEventListener("click",o)}},[]),t},ie=t=>{const e=n.useContainer(),o=n.useRouter(),[s,i]=b.useState({name:"",params:{}}),r=n.useIsMounted();return b.useEffect(()=>{const c=(t||e).get("$widget");if(!c)return;const{events:a}=c;return a.subscribe("router:change",(d,{next:{routeData:g}})=>{if(r.current){const{name:f,params:y}=g;te(y),i({name:f,params:y})}})},[r,t,e]),b.useEffect(()=>{if(o&&o.history&&r.current){const c=o.getRouteData(),{name:a,params:l}=c;te(l),i({name:a,params:l})}},[o,r]),s};var ue=(t=>(t.HH_MM="hh:mm",t.YYYY_MM_DD="yyyy-mm-dd",t.YYYY_MM_DD_HH_MM="yyyy-mm-dd hh:mm",t))(ue||{});const he=({className:t="",format:e="hh:mm",timestamp:o})=>u.jsx("span",{className:n.appendClassNames(t,"humany-timestamp"),children:Ie(o,e)}),se=t=>`0${t}`.slice(-2);function Ie(t,e){const o=new Date(t),s=o.toTimeString().split(" ")[0].split(":"),i=s.length>1?`${s[0]}:${s[1]}`:s[0],r=o.getFullYear(),c=o.getMonth()+1,a=o.getDate(),l=`${r}-${se(c)}-${se(a)}`;return e==="yyyy-mm-dd"?l:e==="hh:mm"?i:`${l} ${i}`}var K=(t=>(t.guide="guide",t.link="link",t.default="default",t))(K||{});const re=t=>Promise.resolve().then(()=>require("./index-373df3a5.js")).then(({ServiceClient:e,ServiceProxy:o})=>t.get("settings").then(s=>{const{name:i,events:r}=t.get("$widget"),{data:{projection:c="",site:a="current",forceHttps:l=!1}}=s,d=new o(c,{credentials:"same-origin"}),g=new e(d,{funnel:i.replace("_contact-method","").replace("_contact",""),site:Ee(a,l)},null,t);return r.subscribe("widget:settings-updated",(f,{data:y})=>{y&&y.projection!==c&&g.proxy.setBaseUrl(y.projection)}),g})),Ee=(t,e)=>()=>{const o=i=>{const r=document.createElement("a");return r.href=i,r};let s=window.location;return t==="referrer"&&document.referrer&&(s=o(document.referrer)),[e?"https:":"","//",s.host,s.pathname].join("")},B=t=>{if(t){const{Type:e,Content:o}=t;if(e&&o)return{type:e,content:o}}},oe=t=>t.map(e=>{const o={id:e.Id.toString(),title:e.Name,symbol:B(e.DefaultIcon),activeSymbol:e.ActiveIcon&&B(e.ActiveIcon),description:e.Description||e.Attributes&&e.Attributes.description||"",matches:e.GuidesCount};return e.Children&&e.Children.length&&(o.items=oe(e.Children)),o}),A=(t,e)=>t.filter(({Type:o})=>o===e).map(({Id:o,Title:s,Body:i})=>({id:o.toString(),title:s,body:i})),W=t=>t.map(({Id:e,Title:o,DefaultIcon:s,ListNotices:i,Notices:r})=>({id:e.toString(),title:o,symbol:B(s),defaultHeaderOptions:{visible:!!i.length},notifications:(i||[]).concat(r||[]).map(({Id:c,Title:a,Body:l,Type:d,Modified:g})=>({id:c.toString(),title:a,body:l,modified:g,expandable:d==="listNotice"}))})),Z=({Id:t,Title:e,DefaultIcon:o,Exits:[s],ExitType:i,ConfirmationText:r,ExpandFormAutomatically:c,Form:a,Description:l},d)=>{const{Adapter:g}=s||{Adapter:{}},{ClientName:f="",Settings:y={},CustomClientName:v=""}=g,p={id:t.toString(),title:e,description:l,symbol:B(o),clientName:f==="custom.adapter"?v:f,expanded:!0,inline:!0,body:{}};if(f.indexOf("phone")>-1||f.indexOf("freetext")>-1){const{displayTextBeforeClick:m,textBeforeClick:h}=y;m==="true"&&(p.expanded=!1,p.title=h),f.indexOf("phone.text")>-1?p.body.phoneNumber=y.phoneNumber:p.body.freetext=y.freetext}return(f.indexOf("chat.popup")>-1||f.indexOf("link")>-1||f==="custom.adapter"&&i==="custom")&&(p.body=y,p.body.confirmationFallback=r),f.indexOf("ace")>-1&&(p.body=y),a&&a.HasValueComponents&&(d?p.body.form=n.FormBuilder.fromLegacyForm(t.toString(),a,d).get():p.body.form=n.FormBuilder.fromLegacyForm(t.toString(),a).get(),c||(p.expanded=p.inline=!1)),p},D=(t=[])=>t.map(({Id:e,Title:o,TotalMatches:s,Symbol:i,DefaultIcon:r,ActiveIcon:c})=>({id:e.toString(),title:o,matches:s,symbol:B(r||i),defaultIcon:B(r),activeIcon:B(c)})),J=t=>t.map(({Id:e,Title:o,Tags:s,FirstPublishedDate:i,Modified:r})=>({id:e.toString(),title:o,tags:D(s),published:i,modified:r})),Ae=(t,e)=>{switch(t){case R.MatchByCategory:case R.Match:{const o={guides:[],matches:0,topNotifications:[],middleNotifications:[],bottomNotifications:[],notificationLists:[],tags:[],byCategory:[]},{Matches:s,TotalMatches:i,Notices:r,NoticeLists:c,Tags:a,ByCategory:l}=e;return o.guides=J(s),o.matches=i,o.byCategory=(l||[]).map(({Id:d,Matches:g,TotalMatches:f})=>({id:d,guides:J(g),matches:f})),o.tags=D(a),o.notificationLists=W(c||[]),o.topNotifications=A(r||[],"noticeRowTop"),o.middleNotifications=A(r||[],"noticeRowMiddle"),o.bottomNotifications=A(r||[],"footerNotice"),o}case R.Categories:{const{Children:o,GuidesCountTotal:s}=e;return{categories:oe(o||[]),matches:s}}case R.Guide:{const{Id:o,Title:s,Body:i,Related:r,Options:c,ConnectionId:a,ContactMethods:l,EnableFeedback:d,HandoverExists:g,FirstPublishedDate:f,Modified:y,ModifiedByDisplayName:v,FirstPublishedByDisplayName:p,Categories:m,Tags:h,SeoMetaDescription:x,SeoAllowIndex:C,Perspectives:N,PerspectiveKey:w,Translations:j}=e,$=w||Object.values(N).find(M=>M===a)||N.Default||null,q={guide:{id:o.toString(),title:s,body:i,modified:y,published:f,modifiedBy:v,publishedBy:p,connection:a,categories:m,hasHandover:g,allowFeedback:d,seoMetaDescription:x,seoAllowIndex:C,perspectives:N,perspective:$,translations:Object.keys(j||{}).reduce((M,I)=>(M[I]=j[I].toString(),M),{})},related:J(r||[]),dialog:[],contactMethods:(l||[]).map(M=>Z(M)),tags:D(h)};return(c||[]).forEach(({CanAccess:M,Description:I,ConnectionId:L,Properties:S})=>{if(!M)return;const z={id:o.toString(),title:I,connection:L,connectionKey:S.ConnectionKey,type:K.default,parent:{id:o.toString(),title:s,tags:D(h)}};if(S.Type==="Guide"||S.Type==="Link")switch(S.Id&&(z.id=S.Id.toString()),S.Uri&&(z.href=S.Uri),S.Target&&(z.target=S.Target),S.Type){case"Guide":z.type=K.guide;break;case"Link":z.type=K.link;break}q.dialog.push(z)}),q}case R.Contacts:{const{Children:o,Matches:s,Notices:i,NoticeLists:r}=e;return{contactMethods:(s||[]).map(a=>Z(a)),categories:oe(o||[]),topNotifications:A(i||[],"noticeRowTop"),middleNotifications:A(i||[],"noticeRowMiddle"),bottomNotifications:A(i||[],"footerNotice"),notificationLists:W(r||[])}}case R.ContactMethod:{const{ContactMethod:o}=e;return Z(o||{})}case R.Tags:case R.TagsOnGuides:return D(e||[]);case R.Notifications:{const{Notices:o,NoticeLists:s}=e;return{topNotifications:A(o||[],"noticeRowTop"),middleNotifications:A(o||[],"noticeRowMiddle"),bottomNotifications:A(o||[],"footerNotice"),notificationLists:W(s||[])}}default:return{}}};var ge=(t=>(t.Guide="guide",t.Guides="guides",t.GuidesByCategory="guides-by-category",t.RowNotifications="row-notices",t.NotificationLists="notification-lists",t.GuideCategories="guide-categories",t.ContactMethodCategories="contact-method-categories",t.ContactMethod="contact-method",t.ContactMethods="contact-methods",t.Tags="tags",t.TagsOnGuides="tagsonguides",t))(ge||{}),R=(t=>(t.Match="match",t.Categories="categories",t.Guide="guide",t.Contacts="contacts",t.ContactMethod="contact-method",t.MatchByCategory="match-by-category",t.Tags="tags",t.TagsOnGuides="tagsonguides",t.Notifications="notifications",t))(R||{});const ae=t=>{switch(t){case"guides":return"match";case"guides-by-category":return"match-by-category";case"guide":return"guide";case"guide-categories":return"categories";case"contact-method-categories":case"contact-methods":return"contacts";case"contact-method":return"contact-method";case"tags":return"tags";case"tagsonguides":return"tagsonguides";case"notification-lists":case"row-notices":return"notifications";default:throw"error"}},Le=async t=>{const{invoke:e}=t.get("$widget");return await e("renderState")===n.WidgetRenderState.hidden};class G{constructor(e,o){P(this,"queries",new Map);P(this,"lastTake",0);P(this,"events");P(this,"getUnresolvedQueries",()=>{let e=0;return this.queries.forEach((o,s)=>{o.some(r=>!r.resolved)&&(e=1)}),e});this.container=e,this.matchingClient=o,this.events=e.get("$widget").events,this.events.subscribe("widget:settings-updated",()=>this.queries=new Map),this.events.subscribe("widget:render-state-changed",(s,{next:i,previous:r})=>{r===n.WidgetRenderState.hidden&&i===n.WidgetRenderState.open&&this.fetchAllUnresolvedQueries()})}static getInstance(e,o="dataClient"){return n.lock(this)(()=>e.getAsync(o).then(async s=>{let i=await e.getAsync("matchingClient");i||(i=await re(e),e.registerAsync("matchingClient",()=>i));let r=s;return r||(r=new G(e,i),e.registerAsync(o,()=>r)),r}))}fetch(e,o,s){return new Promise((i,r)=>{o.take&&(this.lastTake=+(o.take||0)),te(o);const c=ae(e);let a=this.queries.get(c)||[],l=a.find(d=>_(d.params,o))||null;if(l&&(s!=null&&s.noCache)){const d=a.findIndex(g=>_(g.params,o));a=[...a.slice(0,d),...a.slice(d+1)],l=null}if(l){const d=a.indexOf(l);if(l.resolved?(this.events.dispatch("data-client:fetched",{params:o,type:c,response:l.data,unresolvedQueries:this.getUnresolvedQueries()}),this.track(l.data,c,l.error),l.data&&l.error?r({error:l.error}):i(l.data)):l.resolvers.push({resolve:i,reject:r}),a.splice(d,1),a.push(l),this.queries.set(c,a),!l.loading&&!l.resolved)return this.runQuery(c,o)}else return a.push({params:o,resolved:!1,loading:!0,data:{},resolvers:[{resolve:i,reject:r}]}),this.queries.set(c,a),this.runQuery(c,o)}).then(i=>n.deepClone(i))}read(e,o){const{select:s}=o,i=ae(e);return(this.queries.get(i)||[]).reduce((a,l)=>{if(typeof s=="function"){const d=s(l.data);d&&a.push(d)}else a.push(l.data);return a},[])}feedback(e,o,s){return this.matchingClient.giveFeedback(e,o,s)}setLoadingStatus(e,o,s){const i=this.queries.get(e)||[],r=i.find(c=>_(c.params,o));r&&(r.loading=s),this.queries.set(e,i)}async runQuery(e,o){const{searchPhrase:s="",categories:i="0",contactMethodCategoryId:r="0",contactMethodId:c="0",tagId:a=void 0,take:l=5,connection:d="",guideId:g,expandCategories:f="descendants",currentCategory:y,sorting:v="popularity-descending",guideIds:p=[]}=o,m=s.toString().trim();if(await Le(this.container))return Promise.resolve();switch(e){case"match":{const h=x=>{const[C,N]=x.split("-");return{type:new Map([["popularity","popularity"],["alphabetic","title"],["modified","lastModified"],["published","firstPublished"]]).get(C),direction:N}};return p.length?this.matchingClient.customRequest("guides","POST",{configuration:{ids:p,take:+l}}).then(x=>x&&this.handleResponse(x,e,o)):this.matchingClient.match(m,{categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a,sorting:h(v),ids:p}).then(x=>x&&this.handleResponse(x,e,o))}case"match-by-category":return this.matchingClient.match(m,{groupByCategory:!0,categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"guide":return this.matchingClient.getGuide(g,{connectionId:d}).then(h=>{h&&this.handleResponse(h,e,o)}).catch(h=>{const x={message:"Something went wrong.",status:h.status||400};x.status===404&&(x.message="The guide could not be found."),this.handleResponse({},e,o,x)});case"categories":return this.matchingClient.getCategories({phrase:m,expand:f,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"contacts":return g?this.matchingClient.contactMethods(+g,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o)):this.matchingClient.contacts(+r,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o));case"contact-method":return this.matchingClient.getContactMethod(+c,{guideId:g,currentCategory:y}).then(h=>h&&this.handleResponse(h,e,o));case"tags":return this.matchingClient.customRequest("tags","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o));case"tagsonguides":return this.matchingClient.customRequest("tagsonguides","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i],tags:a}}).then(h=>h&&this.handleResponse(h,e,o));case"notifications":return this.matchingClient.customRequest("notices","GET",{configuration:{phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o))}}handleResponse(e={},o,s,i){const r=this.queries.get(o)||[],c=r.find(a=>_(a.params,s));if(c){const a=i||Ae(o,e);this.track(a,o,i),c.resolvers.forEach(d=>{i?d.reject({error:a}):d.resolve(a)});const l=r.indexOf(c);l>-1&&r.splice(l,1),r.push({...c,error:i,resolvers:[],data:a,resolved:!0}),this.setLoadingStatus(o,s,!1),this.queries.set(o,r),i||this.events.dispatch("data-client:fetched",{type:o,params:s,response:a,unresolvedQueries:this.getUnresolvedQueries()})}}fetchAllUnresolvedQueries(){for(const[e,o]of this.queries)o.filter(s=>!s.resolved).forEach(s=>{this.runQuery(e,s.params)})}track(e={},o,s){const i=this.container.get("$widget");i&&!s?i.events.dispatch("tracking:service-client-response",{type:o,data:e}):i&&i.events.dispatch("tracking:service-client-error",{type:o,error:s})}static create(e){return e.getAsync("matchingClient").then(async o=>{if(o)return new G(e,o);const s=await re(e);return e.registerAsync("matchingClient",()=>s),new G(e,s)})}getClient(){return this.matchingClient}}const Be=({title:t="",className:e,id:o,parent:s,connection:i,type:r,target:c,href:a,children:l,connectionKey:d})=>{const g={},{name:f,params:y}=ie();switch(r){case"default":case"guide":const{id:v,title:p}=s;let m=d||i;v!==o&&!d&&(m=void 0),g.routeName=f,g.params=H({...y,guide:o,connection:m,uriName:ee(o===v?p:t)});break;case"link":g.href=a,g.target=c;break}return u.jsx(n.Link,{className:n.appendClassNames(e,"humany-dialog-link"),...g,children:l||u.jsxs(u.Fragment,{children:[r==="link"&&u.jsx(n.Icon,{faIcon:"link"}),u.jsx("span",{children:t})]})})};b.forwardRef(({className:t,dialog:e,...o},s)=>e.length?u.jsx(Oe,{className:n.appendClassNames(t,"humany-dialog"),items:e,renderItem:i=>u.jsx("li",{"data-dialog":i.connection,children:u.jsx(Be,{...i})},i.connection),...o,ref:s}):null);const Oe=n.newStyled(n.List)`
2
+ ${n.list}
3
3
  a {
4
4
  min-width: 150px;
5
5
  max-width: 400px;
6
6
  display: block;
7
7
  white-space: normal;
8
- ${t=>{var e,o;return((e=t.theme.colors)==null?void 0:e.primary)&&s.invertedHoverButton({primaryColor:(o=t.theme.colors)==null?void 0:o.primary,secondaryColor:"#FFFFFF",theme:t.theme})}}
8
+ ${t=>{var e,o;return((e=t.theme.colors)==null?void 0:e.primary)&&n.invertedHoverButton({primaryColor:(o=t.theme.colors)==null?void 0:o.primary,secondaryColor:"#FFFFFF",theme:t.theme})}}
9
9
  }
10
10
 
11
11
  i {
12
12
  margin: 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}} 0 0;
13
13
  }
14
- `;s.newStyled(s.ItemList)`
15
- ${s.itemList}
14
+ `;n.newStyled(n.ItemList)`
15
+ ${n.itemList}
16
16
  font-family: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.type}};
17
17
  padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
18
18
  > ul > li {
@@ -20,13 +20,13 @@
20
20
  font-weight: 300;
21
21
  font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
22
22
  }
23
- `;s.newStyled.div`
23
+ `;n.newStyled.div`
24
24
  background: #fff;
25
25
  border: #ccc 1px solid;
26
26
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
27
27
  font-family: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.type}};
28
28
  font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
29
- `;s.newStyled.div`
29
+ `;n.newStyled.div`
30
30
  padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
31
31
  padding-bottom: 0;
32
32
  font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
@@ -50,7 +50,7 @@
50
50
  i {
51
51
  margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
52
52
  }
53
- `;s.newStyled(s.List)`
53
+ `;n.newStyled(n.List)`
54
54
  list-style: none;
55
55
  padding: 0;
56
56
  margin: 0;
@@ -73,11 +73,11 @@
73
73
  }
74
74
  }
75
75
  }
76
- `;s.newStyled(s.ItemList)`
77
- ${s.itemList}
76
+ `;n.newStyled(n.ItemList)`
77
+ ${n.itemList}
78
78
  font-family: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.type}};
79
79
  > div {
80
- ${t=>{var e;return s.headingElement(t)("> h1",s.css`
80
+ ${t=>{var e;return n.headingElement(t)("> h1",n.css`
81
81
  font-size: ${(e=t.theme.fonts)==null?void 0:e.normal};
82
82
  line-height: 1.2em;
83
83
  `)}}
@@ -97,7 +97,7 @@
97
97
  }
98
98
  }
99
99
  }
100
- `;const qe=t=>s.css`
100
+ `;const qe=t=>n.css`
101
101
  ${t["data-loading"]&&"position: relative;"};
102
102
  ${t["data-loading"]&&"min-height: 150px;"}
103
103
  > * {
@@ -107,17 +107,17 @@
107
107
  .humany-loader {
108
108
  opacity: ${t["data-loading"]?"1":"0"};
109
109
  }
110
- `;s.newStyled(s.Icon)`
110
+ `;n.newStyled(n.Icon)`
111
111
  && {
112
112
  font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
113
113
  }
114
114
  width: 1.2em;
115
- `;s.newStyled(s.Text)`
115
+ `;n.newStyled(n.Text)`
116
116
  font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.medium}};
117
117
  font-weight: normal;
118
118
  line-height: 1.2em;
119
119
  color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
120
- `;const Fe=s.newStyled(s.Button)`
120
+ `;const Fe=n.newStyled(n.Button)`
121
121
  display: flex;
122
122
  align-items: center;
123
123
 
@@ -128,11 +128,11 @@
128
128
  `}}
129
129
 
130
130
  &:focus-visible {
131
- ${t=>t["data-has-label"]==="true"&&s.paddedBorderTabStyle}
131
+ ${t=>t["data-has-label"]==="true"&&n.paddedBorderTabStyle}
132
132
 
133
133
  svg, i {
134
- ${t=>t["data-has-label"]==="false"&&t["data-has-symbol"]==="true"&&s.css`
135
- ${s.paddedBorderTabStyle(t)}
134
+ ${t=>t["data-has-label"]==="false"&&t["data-has-symbol"]==="true"&&n.css`
135
+ ${n.paddedBorderTabStyle(t)}
136
136
  box-sizing: content-box;
137
137
  `}
138
138
  }
@@ -142,7 +142,7 @@
142
142
  flex: 1;
143
143
  font-weight: 300;
144
144
  }
145
- `,Pe=({addFavoriteTooltip:t,removeFavoriteCancelLabel:e,removeFavoriteConfirmLabel:o,removeFavoriteHeader:n,removeFavoriteLabel:i,removeFavoriteTooltip:r,id:c,isFavorite:a,guideTitle:l,buttonLabel:d="",actions:{addFavorite:g,removeFavorite:f}})=>{const y=b.useCallback(()=>{f(c)},[c,f]),v=b.useCallback(()=>{g(c)},[c,g]),p=`${a?r:t}${l?`: "${l}"`:""}`;return a?u.jsx(s.Confirm,{trigger:u.jsxs(ce,{className:"humany-favorite-button",title:p,"aria-label":p,"data-favorite":"true","data-has-label":d?"true":"false","data-has-symbol":"true",children:[u.jsx(s.SymbolBadge,{size:16,symbol:{type:"Svg",content:"star-empty"}}),d&&u.jsx(s.StyledText,{children:d})]}),onConfirm:y,cancelLabel:e,confirmLabel:o,header:n,text:i}):u.jsxs(ce,{className:"humany-favorite-button",title:p,"aria-label":p,onClick:v,"data-favorite":"false","data-has-label":d?"true":"false","data-has-symbol":"true",children:[u.jsx(s.SymbolBadge,{size:16,symbol:{type:"Svg",content:"star-empty"}}),d&&u.jsx(s.StyledText,{children:d})]})},ce=s.newStyled(Fe)`
145
+ `,Pe=({addFavoriteTooltip:t,removeFavoriteCancelLabel:e,removeFavoriteConfirmLabel:o,removeFavoriteHeader:s,removeFavoriteLabel:i,removeFavoriteTooltip:r,id:c,isFavorite:a,guideTitle:l,buttonLabel:d="",actions:{addFavorite:g,removeFavorite:f}})=>{const y=b.useCallback(()=>{f(c)},[c,f]),v=b.useCallback(()=>{g(c)},[c,g]),p=`${a?r:t}${l?`: "${l}"`:""}`;return a?u.jsx(n.Confirm,{trigger:u.jsxs(ce,{className:"humany-favorite-button",title:p,"aria-label":p,"data-favorite":"true","data-has-label":d?"true":"false","data-has-symbol":"true",children:[u.jsx(n.SymbolBadge,{size:16,symbol:{type:"Svg",content:"star-empty"}}),d&&u.jsx(n.StyledText,{children:d})]}),onConfirm:y,cancelLabel:e,confirmLabel:o,header:s,text:i}):u.jsxs(ce,{className:"humany-favorite-button",title:p,"aria-label":p,onClick:v,"data-favorite":"false","data-has-label":d?"true":"false","data-has-symbol":"true",children:[u.jsx(n.SymbolBadge,{size:16,symbol:{type:"Svg",content:"star-empty"}}),d&&u.jsx(n.StyledText,{children:d})]})},ce=n.newStyled(Fe)`
146
146
  grid-area: favorite;
147
147
 
148
148
  &:focus-visible {
@@ -163,12 +163,12 @@
163
163
  }
164
164
  }
165
165
 
166
- ${t=>{var e,o,n,i,r,c,a;return((e=t.theme.colors)==null?void 0:e.text)&&s.css`
166
+ ${t=>{var e,o,s,i,r,c,a;return((e=t.theme.colors)==null?void 0:e.text)&&n.css`
167
167
  svg {
168
168
  stroke: ${(o=t.theme.colors)==null?void 0:o.text};
169
169
 
170
170
  path {
171
- stroke: ${(n=t.theme.colors)==null?void 0:n.text};
171
+ stroke: ${(s=t.theme.colors)==null?void 0:s.text};
172
172
  }
173
173
 
174
174
  ${t["data-favorite"]==="true"&&`
@@ -198,12 +198,12 @@
198
198
  }
199
199
  }
200
200
  `}}
201
- `;b.forwardRef(({onFeedback:t=()=>{},direction:e="horizontal",className:o,header:n,positive:i,negative:r,selected:c,...a},l)=>u.jsxs(Ge,{className:s.appendClassNames(o,"humany-feedback"),"data-direction":e,...s.convertToStringAttributes(a),ref:l,children:[!!n&&u.jsx(De,{children:n}),u.jsxs(le,{className:"humany-feedback-button",disabled:!!c,"data-selected":c==="positive","data-direction":e,onClick:()=>t("positive"),children:[u.jsx(s.Icon,{faIcon:"smile-o"}),u.jsx("span",{children:i})]}),u.jsxs(le,{className:"humany-feedback-button",disabled:!!c,"data-selected":c==="negative","data-direction":e,onClick:()=>t("negative"),children:[u.jsx(s.Icon,{faIcon:"frown-o"}),u.jsx("span",{children:r})]})]}));const De=s.newStyled(s.StyledText)`
201
+ `;b.forwardRef(({onFeedback:t=()=>{},direction:e="horizontal",className:o,header:s,positive:i,negative:r,selected:c,...a},l)=>u.jsxs(Ge,{className:n.appendClassNames(o,"humany-feedback"),"data-direction":e,...n.convertToStringAttributes(a),ref:l,children:[!!s&&u.jsx(De,{children:s}),u.jsxs(le,{className:"humany-feedback-button",disabled:!!c,"data-selected":c==="positive","data-direction":e,onClick:()=>t("positive"),children:[u.jsx(n.Icon,{faIcon:"smile-o"}),u.jsx("span",{children:i})]}),u.jsxs(le,{className:"humany-feedback-button",disabled:!!c,"data-selected":c==="negative","data-direction":e,onClick:()=>t("negative"),children:[u.jsx(n.Icon,{faIcon:"frown-o"}),u.jsx("span",{children:r})]})]}));const De=n.newStyled(n.StyledText)`
202
202
  font-weight: normal;
203
203
  margin: 0 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
204
204
  font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
205
205
  display: block;
206
- `,le=s.newStyled(s.Button)`
206
+ `,le=n.newStyled(n.Button)`
207
207
  display: inline-block;
208
208
  font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
209
209
  font-weight: 300;
@@ -211,22 +211,22 @@
211
211
  margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
212
212
  }
213
213
 
214
- ${t=>{var e,o;return t["data-direction"]==="horizontal"&&s.css`
214
+ ${t=>{var e,o;return t["data-direction"]==="horizontal"&&n.css`
215
215
  width: 225px;
216
216
  max-width: calc(50% - ${(e=t.theme.sizes)==null?void 0:e.large} - ${(o=t.theme.sizes)==null?void 0:o.small});
217
217
  `}}
218
218
 
219
- ${t=>t["data-direction"]==="vertical"&&s.css`
219
+ ${t=>t["data-direction"]==="vertical"&&n.css`
220
220
  min-width: 190px;
221
221
  `}
222
222
 
223
- ${t=>{var e,o;return((e=t.theme.colors)==null?void 0:e.primary)&&s.invertedHoverButton({active:t["data-selected"],primaryColor:(o=t.theme.colors)==null?void 0:o.primary,secondaryColor:"#FFFFFF",theme:t.theme})}}
223
+ ${t=>{var e,o;return((e=t.theme.colors)==null?void 0:e.primary)&&n.invertedHoverButton({active:t["data-selected"],primaryColor:(o=t.theme.colors)==null?void 0:o.primary,secondaryColor:"#FFFFFF",theme:t.theme})}}
224
224
 
225
225
  i {
226
226
  margin: 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}} 0 0;
227
227
  }
228
- `,Ge=s.newStyled.div`
229
- ${t=>{var e;return t["data-direction"]==="vertical"&&s.css`
228
+ `,Ge=n.newStyled.div`
229
+ ${t=>{var e;return t["data-direction"]==="vertical"&&n.css`
230
230
  > button {
231
231
  width: 100%;
232
232
  &:not(:last-child) {
@@ -234,16 +234,16 @@
234
234
  }
235
235
  }
236
236
  `}}
237
- `,He=()=>{const t=s.useContainer(),[e,o]=b.useState([]),n=t.get("favorites");b.useEffect(()=>{if(n){o(n.get());const{events:l}=t.get("$widget");return l.subscribe("widget:favorites-updated",(g,{updated:f})=>{o([...f])})}},[]);const i=l=>n?n.add(l):Promise.resolve([]),r=l=>n?n.remove(l):Promise.resolve([]),c=()=>n?n.clear():Promise.resolve([]),a=b.useCallback(l=>e.indexOf(l)>-1?r(l):i(l),[e]);return[e,b.useMemo(()=>({addFavorite:i,removeFavorite:r,clearFavorites:c,toggleFavorite:a}),[e])]},Ye=({format:t=ue.YYYY_MM_DD_HH_MM,className:e="",byLabel:o="",modifiedLabel:n="",publishedLabel:i="",modifiedBy:r="",publishedBy:c="",showModified:a=!1,showPublished:l=!1,modified:d,published:g})=>{const f=l&&g?u.jsx(de,{format:t,timestamp:g}):null,y=a&&d?u.jsx(de,{format:t,timestamp:d}):null;return!f&&!y?null:u.jsxs(X,{className:s.appendClassNames(e,"humany-metadata"),children:[f&&u.jsxs(X,{className:"humany-published",children:[i,f,o&&c&&` ${o.replace("{{editor}}",c)}`]}),y&&u.jsxs(X,{className:"humany-modified",children:[f&&", ",n,y,o&&r&&` ${o.replace("{{editor}}",r)}`]})]})},de=s.newStyled(he)`
237
+ `,He=()=>{const t=n.useContainer(),[e,o]=b.useState([]),s=t.get("favorites");b.useEffect(()=>{if(s){o(s.get());const{events:l}=t.get("$widget");return l.subscribe("widget:favorites-updated",(g,{updated:f})=>{o([...f])})}},[]);const i=l=>s?s.add(l):Promise.resolve([]),r=l=>s?s.remove(l):Promise.resolve([]),c=()=>s?s.clear():Promise.resolve([]),a=b.useCallback(l=>e.indexOf(l)>-1?r(l):i(l),[e]);return[e,b.useMemo(()=>({addFavorite:i,removeFavorite:r,clearFavorites:c,toggleFavorite:a}),[e])]},Ye=({format:t=ue.YYYY_MM_DD_HH_MM,className:e="",byLabel:o="",modifiedLabel:s="",publishedLabel:i="",modifiedBy:r="",publishedBy:c="",showModified:a=!1,showPublished:l=!1,modified:d,published:g})=>{const f=l&&g?u.jsx(de,{format:t,timestamp:g}):null,y=a&&d?u.jsx(de,{format:t,timestamp:d}):null;return!f&&!y?null:u.jsxs(X,{className:n.appendClassNames(e,"humany-metadata"),children:[f&&u.jsxs(X,{className:"humany-published",children:[i,f,o&&c&&` ${o.replace("{{editor}}",c)}`]}),y&&u.jsxs(X,{className:"humany-modified",children:[f&&", ",s,y,o&&r&&` ${o.replace("{{editor}}",r)}`]})]})},de=n.newStyled(he)`
238
238
  &:not(:first-child) {
239
239
  margin-left: 4px;
240
240
  }
241
241
  &:not(:last-child) {
242
242
  margin-right: 4px;
243
243
  }
244
- `,X=s.newStyled(s.Text)`
244
+ `,X=n.newStyled(n.Text)`
245
245
  font-style: italic;
246
- `,Ue=({tags:t})=>t.filter(e=>e.symbol).length?u.jsx(Qe,{className:"humany-guide-list-tags",items:t,renderItem:({id:e,symbol:o,title:n})=>o&&u.jsx("li",{"data-tag":e,children:u.jsx(Ve,{size:18,symbol:o,title:n})},e)}):null;b.forwardRef(({title:t,id:e,route:o,symbolSize:n,collapseUri:i,children:r},c)=>{const{params:a}=ie();return u.jsxs(_e,{ref:c,"data-guide":e,children:[u.jsx(s.TextLink,{title:t,"aria-label":t,routeName:o,params:H({...a,uriName:i||void 0,id:void 0,guide:void 0,accordion:void 0}),text:t,children:u.jsx(s.SymbolBadge,{size:n,symbol:{type:"Svg",content:"caret-up"}})}),r]})});const _e=s.newStyled.li`
246
+ `,Ue=({tags:t})=>t.filter(e=>e.symbol).length?u.jsx(Qe,{className:"humany-guide-list-tags",items:t,renderItem:({id:e,symbol:o,title:s})=>o&&u.jsx("li",{"data-tag":e,children:u.jsx(Ve,{size:18,symbol:o,title:s})},e)}):null;b.forwardRef(({title:t,id:e,route:o,symbolSize:s,collapseUri:i,children:r},c)=>{const{params:a}=ie();return u.jsxs(_e,{ref:c,"data-guide":e,children:[u.jsx(n.TextLink,{title:t,"aria-label":t,routeName:o,params:H({...a,uriName:i||void 0,id:void 0,guide:void 0,accordion:void 0}),text:t,children:u.jsx(n.SymbolBadge,{size:s,symbol:{type:"Svg",content:"caret-up"}})}),r]})});const _e=n.newStyled.li`
247
247
  > a {
248
248
  grid-column: 1/-1;
249
249
  font-weight: bold;
@@ -253,8 +253,8 @@
253
253
  > div {
254
254
  grid-column: 1/-1;
255
255
  }
256
- `;b.forwardRef(({expandable:t=!1,routing:e={},paramMappers:o={},symbolSize:n=11,pageRole:i="link",pageCaret:r="down",showTags:c=!1,showFavoriteToggle:a=!1,localPaging:l=!1,onItemClick:d=()=>{},dispatch:g=()=>{},metadata:f={},pageLabel:y,className:v,children:p,items:m,renderItem:h,addFavoriteTooltip:x,removeFavoriteCancelLabel:C,removeFavoriteConfirmLabel:N,removeFavoriteHeader:w,removeFavoriteLabel:j,removeFavoriteTooltip:$,searchResultsEmptyLabel:q,...M},I)=>{const L=Re(),S=b.useRef(),z=s.usePrevious(m),{guide:ye="guide",page:pe="index"}=e,{guide:be=({id:k})=>H({guide:k}),page:se=()=>H()}=o,[ve,xe]=He();b.useImperativeHandle(I,()=>S.current);const Q=k=>{const{id:E,title:T,tags:O,published:Y,modified:F,publishedBy:U,modifiedBy:V}=k;return u.jsxs("li",{"data-guide":E,"has-metadata":(!!(f!=null&&f.showPublished)&&!!Y||!!(f!=null&&f.showModified)&&!!F).toString(),children:[u.jsx(s.TextLink,{className:"humany-guide-link",title:T,"aria-label":T,routeName:ye,onClick:Se=>d(Se,k),params:be(k),text:T,children:u.jsx(s.SymbolBadge,{size:n,symbol:{type:"Svg",content:t?"caret-down":"caret-right"}})}),a&&u.jsx(Pe,{guideTitle:T,addFavoriteTooltip:x,removeFavoriteCancelLabel:C,removeFavoriteConfirmLabel:N,removeFavoriteHeader:w,removeFavoriteLabel:j,removeFavoriteTooltip:$,isFavorite:ve.indexOf(E)>-1,actions:xe,id:E}),c&&u.jsx(Ue,{tags:O}),u.jsx(We,{...f,indent:t?void 0:n,modified:F,published:Y,publishedBy:U,modifiedBy:V})]},E)},we=b.useCallback((k,E,T)=>h?h(k,E,T,Q):Q(k),[h,Q]),$e=b.useCallback(k=>{l&&(k.preventDefault(),g("page",se()))},[g,l]);b.useEffect(()=>{if(z&&z.length<m.length&&S.current){const k=S.current.querySelectorAll(".humany-guide-list > ul > li"),E=k[z.length];if(k.length===m.length&&z.length){const T=k[z.length];if(T){const O=T.querySelector(".humany-guide-link");O&&O.focus()}}else E&&new MutationObserver((O,Y)=>{O.forEach(F=>{if(F.addedNodes){const U=Array.from(F.addedNodes).find(V=>V.tagName==="A");U&&je(S.current,document.activeElement)&&(L&&U.focus(),Y.disconnect())}})}).observe(E,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})}});const Ce=!!Object.keys(f).filter(k=>typeof f[k]<"u").length;return u.jsxs(Ke,{className:s.appendClassNames(v,"humany-guide-list"),"data-item-count":m.length,items:m,renderItem:we,isTabbing:L,expandable:t?"true":"false","grid-items":c||a||Ce?"true":"false",...s.convertToStringAttributes(M),ref:S,children:[y?u.jsx(s.TextLink,{text:y,title:y,"aria-label":y,routeName:pe,role:i,params:se(),onClick:$e,children:u.jsx(s.SymbolBadge,{size:n,symbol:{type:"Svg",content:`caret-${r}`}})}):null,p,!M["data-loading"]&&m.length===0&&u.jsx("p",{children:q})]})});const Ke=s.newStyled(s.ItemList)`
257
- ${s.itemList}
256
+ `;b.forwardRef(({expandable:t=!1,routing:e={},paramMappers:o={},symbolSize:s=11,pageRole:i="link",pageCaret:r="down",showTags:c=!1,showFavoriteToggle:a=!1,localPaging:l=!1,onItemClick:d=()=>{},dispatch:g=()=>{},metadata:f={},pageLabel:y,className:v,children:p,items:m,renderItem:h,addFavoriteTooltip:x,removeFavoriteCancelLabel:C,removeFavoriteConfirmLabel:N,removeFavoriteHeader:w,removeFavoriteLabel:j,removeFavoriteTooltip:$,searchResultsEmptyLabel:q,...M},I)=>{const L=Re(),S=b.useRef(),z=n.usePrevious(m),{guide:ye="guide",page:pe="index"}=e,{guide:be=({id:k})=>H({guide:k}),page:ne=()=>H()}=o,[ve,xe]=He();b.useImperativeHandle(I,()=>S.current);const Q=k=>{const{id:E,title:T,tags:O,published:Y,modified:F,publishedBy:U,modifiedBy:V}=k;return u.jsxs("li",{"data-guide":E,"has-metadata":(!!(f!=null&&f.showPublished)&&!!Y||!!(f!=null&&f.showModified)&&!!F).toString(),children:[u.jsx(n.TextLink,{className:"humany-guide-link",title:T,"aria-label":T,routeName:ye,onClick:Se=>d(Se,k),params:be(k),text:T,children:u.jsx(n.SymbolBadge,{size:s,symbol:{type:"Svg",content:t?"caret-down":"caret-right"}})}),a&&u.jsx(Pe,{guideTitle:T,addFavoriteTooltip:x,removeFavoriteCancelLabel:C,removeFavoriteConfirmLabel:N,removeFavoriteHeader:w,removeFavoriteLabel:j,removeFavoriteTooltip:$,isFavorite:ve.indexOf(E)>-1,actions:xe,id:E}),c&&u.jsx(Ue,{tags:O}),u.jsx(We,{...f,indent:t?void 0:s,modified:F,published:Y,publishedBy:U,modifiedBy:V})]},E)},we=b.useCallback((k,E,T)=>h?h(k,E,T,Q):Q(k),[h,Q]),$e=b.useCallback(k=>{l&&(k.preventDefault(),g("page",ne()))},[g,l]);b.useEffect(()=>{if(z&&z.length<m.length&&S.current){const k=S.current.querySelectorAll(".humany-guide-list > ul > li"),E=k[z.length];if(k.length===m.length&&z.length){const T=k[z.length];if(T){const O=T.querySelector(".humany-guide-link");O&&O.focus()}}else E&&new MutationObserver((O,Y)=>{O.forEach(F=>{if(F.addedNodes){const U=Array.from(F.addedNodes).find(V=>V.tagName==="A");U&&je(S.current,document.activeElement)&&(L&&U.focus(),Y.disconnect())}})}).observe(E,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})}});const Ce=!!Object.keys(f).filter(k=>typeof f[k]<"u").length;return u.jsxs(Ke,{className:n.appendClassNames(v,"humany-guide-list"),"data-item-count":m.length,items:m,renderItem:we,isTabbing:L,expandable:t?"true":"false","grid-items":c||a||Ce?"true":"false",...n.convertToStringAttributes(M),ref:S,children:[y?u.jsx(n.TextLink,{text:y,title:y,"aria-label":y,routeName:pe,role:i,params:ne(),onClick:$e,children:u.jsx(n.SymbolBadge,{size:s,symbol:{type:"Svg",content:`caret-${r}`}})}):null,p,!M["data-loading"]&&m.length===0&&u.jsx("p",{children:q})]})});const Ke=n.newStyled(n.ItemList)`
257
+ ${n.itemList}
258
258
  padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
259
259
  overflow: auto;
260
260
  justify-content: flex-start;
@@ -263,13 +263,13 @@
263
263
  text-decoration: none;
264
264
 
265
265
  > div {
266
- ${t=>s.headingElement(t)("> h1",s.css`
266
+ ${t=>n.headingElement(t)("> h1",n.css`
267
267
  white-space: pre-wrap;
268
268
  `)}
269
269
  }
270
270
 
271
271
  > ul > li {
272
- ${t=>{var e,o;return t["grid-items"]==="true"&&s.css`
272
+ ${t=>{var e,o;return t["grid-items"]==="true"&&n.css`
273
273
  display: grid;
274
274
  grid-template-columns: auto 1fr 1fr;
275
275
  gap: 0px 0px;
@@ -319,7 +319,7 @@
319
319
  }
320
320
  }
321
321
 
322
- ${t=>{var e;return t.expandable==="true"&&s.css`
322
+ ${t=>{var e;return t.expandable==="true"&&n.css`
323
323
  display: flex;
324
324
  flex-direction: row-reverse;
325
325
  justify-content: flex-end;
@@ -336,7 +336,7 @@
336
336
  `}}
337
337
 
338
338
  &:focus-visible {
339
- ${s.borderTabStyle}
339
+ ${n.borderTabStyle}
340
340
  text-decoration: underline;
341
341
  }
342
342
 
@@ -367,12 +367,12 @@
367
367
  }
368
368
 
369
369
  &:focus-visible {
370
- ${s.borderTabStyle}
370
+ ${n.borderTabStyle}
371
371
  text-decoration: underline;
372
372
  }
373
373
  }
374
- `,Qe=s.newStyled(s.List)`
375
- ${s.list}
374
+ `,Qe=n.newStyled(n.List)`
375
+ ${n.list}
376
376
  display: flex;
377
377
  margin: 0 0 0 auto;
378
378
  grid-area: tags;
@@ -384,7 +384,7 @@
384
384
  align-items: center;
385
385
  justify-content: space-between;
386
386
  }
387
- `,Ve=s.newStyled(s.SymbolBadge)`
387
+ `,Ve=n.newStyled(n.SymbolBadge)`
388
388
  display: block;
389
389
  color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
390
390
  ${t=>{if(t.symbol.type==="Uri")return`
@@ -393,17 +393,17 @@
393
393
  `;if(t.symbol.type==="FontAwesome")return`
394
394
  font-size: ${t.size}px;
395
395
  `}}
396
- `,We=s.newStyled(Ye)`
396
+ `,We=n.newStyled(Ye)`
397
397
  grid-area: metadata;
398
398
  text-overflow: ellipsis;
399
399
  overflow: hidden;
400
400
  font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
401
401
  ${t=>{var e;return typeof t.indent=="number"&&`text-indent: calc(${(e=t.theme.sizes)==null?void 0:e.small} * 2 + ${t.indent}px);`}}
402
- `,Ze=s.keyframes`
402
+ `,Ze=n.keyframes`
403
403
  100% {
404
404
  transform: rotate(360deg);
405
405
  }
406
- `,Je=s.keyframes`
406
+ `,Je=n.keyframes`
407
407
  0% {
408
408
  stroke-dasharray: 1, 200;
409
409
  stroke-dashoffset: 0;
@@ -416,7 +416,7 @@
416
416
  stroke-dasharray: 89, 200;
417
417
  stroke-dashoffset: -124px;
418
418
  }
419
- `;s.newStyled.svg`
419
+ `;n.newStyled.svg`
420
420
  animation: ${Ze} 2s linear infinite;
421
421
  height: 100%;
422
422
  transform-origin: center center;
@@ -428,7 +428,7 @@
428
428
  right: 0;
429
429
  margin: auto;
430
430
  transition: 200ms ease-out opacity;
431
- `;s.newStyled.div`
431
+ `;n.newStyled.div`
432
432
  position: absolute;
433
433
  top: 0;
434
434
  bottom: 0;
@@ -447,7 +447,7 @@
447
447
  .humany-spinner-svg {
448
448
  opacity: ${t=>t["data-loading"]?"1":"0"};
449
449
  }
450
- `;s.newStyled.div`
450
+ `;n.newStyled.div`
451
451
  position: relative;
452
452
  margin: 0 auto;
453
453
  width: 100px;
@@ -456,14 +456,14 @@
456
456
  display: block;
457
457
  padding-top: 100%;
458
458
  }
459
- `;s.newStyled.circle`
459
+ `;n.newStyled.circle`
460
460
  stroke-dasharray: 1, 200;
461
461
  stroke-dashoffset: 0;
462
462
  animation: ${Je} 1.5s ease-in-out infinite;
463
463
  stroke-linecap: round;
464
464
  stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
465
465
  stroke-width: 2px;
466
- `;s.newStyled(s.Button)`
466
+ `;n.newStyled(n.Button)`
467
467
  display: flex;
468
468
  justify-content: space-between;
469
469
  align-items: center;
@@ -482,21 +482,21 @@
482
482
  white-space: nowrap;
483
483
  }
484
484
  &:focus-visible {
485
- ${s.borderTabStyle}
485
+ ${n.borderTabStyle}
486
486
  span {
487
487
  color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
488
488
  text-decoration: underline;
489
489
  }
490
490
  }
491
- `;s.newStyled(s.ItemList)`
491
+ `;n.newStyled(n.ItemList)`
492
492
  ${qe}
493
- ${s.itemList}
493
+ ${n.itemList}
494
494
  overflow: hidden;
495
495
  justify-content: flex-start;
496
496
  padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
497
- ${t=>!t["data-show-header"]&&s.css`
497
+ ${t=>!t["data-show-header"]&&n.css`
498
498
  > div {
499
- ${s.headingElement(t)("h1",s.css`
499
+ ${n.headingElement(t)("h1",n.css`
500
500
  display: none;
501
501
  `)}
502
502
  }
@@ -507,24 +507,24 @@
507
507
  text-decoration: underline;
508
508
  }
509
509
  }
510
- `;s.newStyled(s.Paragraph)`
511
- ${s.genericHtml}
510
+ `;n.newStyled(n.Paragraph)`
511
+ ${n.genericHtml}
512
512
  font-weight: 300;
513
513
 
514
514
  p {
515
515
  white-space: normal;
516
516
  }
517
- `;s.newStyled.li`
517
+ `;n.newStyled.li`
518
518
  .humany-paragraph {
519
519
  display: none;
520
520
  &:not(:only-child) {
521
- ${t=>{var e,o,n;return((e=t.theme.sizes)==null?void 0:e.cardinal)&&((o=t.theme.sizes)==null?void 0:o.normal)&&s.css`
522
- margin: ${(n=t.theme.sizes)==null?void 0:n.normal} 0;
521
+ ${t=>{var e,o,s;return((e=t.theme.sizes)==null?void 0:e.cardinal)&&((o=t.theme.sizes)==null?void 0:o.normal)&&n.css`
522
+ margin: ${(s=t.theme.sizes)==null?void 0:s.normal} 0;
523
523
  `}}
524
524
  }
525
525
  }
526
526
 
527
- ${t=>t["data-expanded"]&&s.css`
527
+ ${t=>t["data-expanded"]&&n.css`
528
528
  .humany-paragraph {
529
529
  display: block;
530
530
  }
@@ -535,31 +535,31 @@
535
535
  font-weight: 300;
536
536
  color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.accent}};
537
537
  }
538
- `;s.newStyled(s.SymbolBadge)`
538
+ `;n.newStyled(n.SymbolBadge)`
539
539
  margin: 0 0 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
540
540
  line {
541
541
  stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
542
542
  }
543
- `;s.newStyled(he)`
543
+ `;n.newStyled(he)`
544
544
  font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
545
545
  font-weight: 300;
546
- `;s.newStyled(s.Paragraph)`
547
- ${t=>{var e;return s.headingElement(t)("h1",s.css`
546
+ `;n.newStyled(n.Paragraph)`
547
+ ${t=>{var e;return n.headingElement(t)("h1",n.css`
548
548
  font-weight: normal;
549
549
  font-size: ${(e=t.theme.fonts)==null?void 0:e.medium};
550
550
  `)}}
551
- `;const Xe=s.newStyled(s.Html)`
552
- ${s.genericHtml}
551
+ `;const Xe=n.newStyled(n.Html)`
552
+ ${n.genericHtml}
553
553
  font-weight: 300;
554
554
  line-height: 1.5em;
555
555
  button:focus-visible {
556
- ${s.borderTabStyle};
556
+ ${n.borderTabStyle};
557
557
  }
558
558
 
559
559
  a:focus-visible {
560
- ${s.linkTabStyle};
560
+ ${n.linkTabStyle};
561
561
  }
562
- `,et=t=>{const e=Me(t.clientName),{params:{contactCategory:o,guideCategory:n,phrase:i}}=ie();if(typeof e>"u")return null;if(e===null)return process.env.NODE_ENV!=="production"?u.jsx(it,{title:`client-name: ${t.clientName}, id: ${t.id}`,className:"humany-non-resolved-contact-method",children:u.jsx(s.Typography,{variant:"h5",children:"Non resolved Contact Method type"})}):null;const r=(c={})=>{const a={...t,...c},{id:l,title:d,clientName:g,symbol:f,inline:y,onClick:v=()=>{},description:p,htmlParseInstruction:m,className:h,disabled:x,guideId:C,dispatch:N=()=>{},expanded:w}=a,j=y?{onKeyDown:$=>{$.key&&$.key==="Enter"&&(v($,a),$.defaultPrevented||!w&&N("expand",l))},onClick:$=>{v($,a),$.defaultPrevented||!w&&N("expand",l)}}:{onClick:$=>v($,a),routeName:"contact-method",params:H({contactCategory:o,guideId:C,guideCategory:n,phrase:i,contactMethod:l,uriName:ee(d)})};return u.jsxs(ot,{title:d,"aria-label":d,className:h,disabled:x,description:p,"data-client-name":g,...c,...j,children:[f&&u.jsx(s.SymbolBadge,{symbol:f}),p?u.jsxs("div",{className:"humany-contact-link-rich-content",children:[u.jsx(me,{children:d}),u.jsx(Xe,{html:p,htmlParseInstruction:m})]}):u.jsx(me,{children:d})]})};return t.expanded?u.jsx(b.Suspense,{fallback:null,children:u.jsx(e,{...t,renderDefault:r})}):r()},tt=t=>{var e,o,n,i,r,c,a,l;return s.css`
562
+ `,et=t=>{const e=Me(t.clientName),{params:{contactCategory:o,guideCategory:s,phrase:i}}=ie();if(typeof e>"u")return null;if(e===null)return process.env.NODE_ENV!=="production"?u.jsx(it,{title:`client-name: ${t.clientName}, id: ${t.id}`,className:"humany-non-resolved-contact-method",children:u.jsx(n.Typography,{variant:"h5",children:"Non resolved Contact Method type"})}):null;const r=(c={})=>{const a={...t,...c},{id:l,title:d,clientName:g,symbol:f,inline:y,onClick:v=()=>{},description:p,htmlParseInstruction:m,className:h,disabled:x,guideId:C,dispatch:N=()=>{},expanded:w}=a,j=y?{onKeyDown:$=>{$.key&&$.key==="Enter"&&(v($,a),$.defaultPrevented||!w&&N("expand",l))},onClick:$=>{v($,a),$.defaultPrevented||!w&&N("expand",l)}}:{onClick:$=>v($,a),routeName:"contact-method",params:H({contactCategory:o,guideId:C,guideCategory:s,phrase:i,contactMethod:l,uriName:ee(d)})};return u.jsxs(ot,{title:d,"aria-label":d,className:h,disabled:x,description:p,"data-client-name":g,...c,...j,children:[f&&u.jsx(n.SymbolBadge,{symbol:f}),p?u.jsxs("div",{className:"humany-contact-link-rich-content",children:[u.jsx(me,{children:d}),u.jsx(Xe,{html:p,htmlParseInstruction:m})]}):u.jsx(me,{children:d})]})};return t.expanded?u.jsx(b.Suspense,{fallback:null,children:u.jsx(e,{...t,renderDefault:r})}):r()},tt=t=>{var e,o,s,i,r,c,a,l;return n.css`
563
563
  display: flex;
564
564
  padding: ${(e=t.theme.sizes)==null?void 0:e.large};
565
565
  ${t.description?"":"align-items: center;"}
@@ -569,7 +569,7 @@
569
569
  color: ${(o=t.theme.colors)==null?void 0:o.text};
570
570
  }
571
571
  i {
572
- font-size: ${(n=t.theme.fonts)==null?void 0:n.large};
572
+ font-size: ${(s=t.theme.fonts)==null?void 0:s.large};
573
573
  margin: 0 ${(i=t.theme.sizes)==null?void 0:i.large} 0 0;
574
574
  min-height: ${(r=t.theme.fonts)==null?void 0:r.large};
575
575
  min-width: ${(c=t.theme.fonts)==null?void 0:c.large};
@@ -578,25 +578,25 @@
578
578
  vertical-align: bottom;
579
579
  color: ${(l=t.theme.colors)==null?void 0:l.text};
580
580
  }
581
- `},me=s.newStyled(s.StyledText)`
581
+ `},me=n.newStyled(n.StyledText)`
582
582
  line-height: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.large}};
583
- `,ot=s.newStyled(s.Link)`
583
+ `,ot=n.newStyled(n.Link)`
584
584
  ${t=>tt(t)}
585
585
 
586
586
  &:focus-visible {
587
- ${s.borderTabStyle};
587
+ ${n.borderTabStyle};
588
588
  }
589
- `,it=s.newStyled.div`
589
+ `,it=n.newStyled.div`
590
590
  text-align: center;
591
591
  display: block;
592
592
  ${t=>{var e,o;return typeof((e=t.theme.colors)==null?void 0:e.warning)<"u"&&`color: ${(o=t.theme.colors)==null?void 0:o.warning};`}}
593
- `,st=t=>{var e,o,n;return s.css`
594
- ${s.itemList(t)}
593
+ `,nt=t=>{var e,o,s;return n.css`
594
+ ${n.itemList(t)}
595
595
 
596
596
  > div {
597
597
  padding: ${(e=t.theme.sizes)==null?void 0:e.large};
598
598
 
599
- ${s.headingElement(t)("h1",s.css`
599
+ ${n.headingElement(t)("h1",n.css`
600
600
  margin: 0;
601
601
  `)}
602
602
  }
@@ -634,11 +634,11 @@
634
634
 
635
635
  @media (hover: hover) {
636
636
  a:hover {
637
- background-color: ${(n=t.theme.colors)==null?void 0:n.accent};
637
+ background-color: ${(s=t.theme.colors)==null?void 0:s.accent};
638
638
  }
639
639
  }
640
- `};s.newStyled(s.ItemList)`
641
- ${t=>st(t)}
642
- `;const nt=({contactMethodId:t,guideId:e,groupId:o,className:n,container:i})=>{var f,y,v;const[r,c]=b.useState(),a=Te(),l=b.useRef(!0),d=ze();console.log("¤¤¤Container",i),b.useEffect(()=>{const{events:p}=i==null?void 0:i.get("$widget"),m=p.subscribe("conversational-hub-provider:form-submitted",async(x,C)=>{var I;if(((I=C.form.meta)==null?void 0:I.groupId)!==o||C.id!==(r==null?void 0:r.id))return;d&&(C.form.meta||(C.form.meta={}),C.form.meta.conversation=d);const N=await(i==null?void 0:i.getAsync("contactMethods")),w={...r,body:{...r.body,form:C.form}},{errors:j,valid:$,errorTypes:q}=await N.validate(w);if(!$){const L=new s.FormBuilder(r.body.form);c(void 0),L.setValidationErrors(j),w.body={...w.body,form:L.get()},c({...w});return}const M=await N.submit(w);w.confirmation=M,c(w)}),h=p.subscribe("bot-provider:evaluate",async(x,C)=>{if(C.id!==t)return;const w=await(await(i==null?void 0:i.getAsync("contactMethods"))).evaluate(r);let j={...r,body:{...r.body,form:w}};const $=s.updateForm(j,{submit:"Submit",errors:{},meta:{groupId:o}});j={...j,body:$},c(j)});return()=>{m(),h()}},[i,r,c,d]);const g=b.useCallback(async p=>{const h=await(await G.getInstance(i)).fetch(ge.ContactMethod,{contactMethodId:p,guideId:e},{noCache:!0}),x=s.updateForm(h,{submit:"Submit",errors:{},meta:{groupId:o}});if(h.body=x,h.body.guideId=e,!l.current)return null;c(h)},[l]);return b.useEffect(()=>(g(t),()=>{l.current=!1}),[t,g]),r?u.jsx(rt,{...r,body:{...r.body,form:r.body.form?{...r.body.form,data:(f=r.body.form)==null?void 0:f.data,layout:{...r.body.form.layout},meta:(y=r.body.form)==null?void 0:y.meta,schema:(v=r.body.form)==null?void 0:v.schema}:void 0,guideId:r.body.guideId},inline:!0,expanded:!0,dispatch:a,className:s.appendClassNames("humany-bot-contact-method",n)}):null},rt=s.newStyled(et)`
640
+ `};n.newStyled(n.ItemList)`
641
+ ${t=>nt(t)}
642
+ `;const st=({contactMethodId:t,guideId:e,groupId:o,className:s})=>{var f,y,v;const[i,r]=b.useState(),c=n.useContainer(),a=Te(),l=b.useRef(!0),d=ze();b.useEffect(()=>{const{events:p}=c.get("$widget"),m=p.subscribe("conversational-hub-provider:form-submitted",async(x,C)=>{var I;if(((I=C.form.meta)==null?void 0:I.groupId)!==o||C.id!==(i==null?void 0:i.id))return;d&&(C.form.meta||(C.form.meta={}),C.form.meta.conversation=d);const N=await c.getAsync("contactMethods"),w={...i,body:{...i.body,form:C.form}},{errors:j,valid:$,errorTypes:q}=await N.validate(w);if(!$){const L=new n.FormBuilder(i.body.form);r(void 0),L.setValidationErrors(j),w.body={...w.body,form:L.get()},r({...w});return}const M=await N.submit(w);w.confirmation=M,r(w)}),h=p.subscribe("bot-provider:evaluate",async(x,C)=>{if(C.id!==t)return;const w=await(await c.getAsync("contactMethods")).evaluate(i);let j={...i,body:{...i.body,form:w}};const $=n.updateForm(j,{submit:"Submit",errors:{},meta:{groupId:o}});j={...j,body:$},r(j)});return()=>{m(),h()}},[c,i,r,d]);const g=b.useCallback(async p=>{const h=await(await G.getInstance(c)).fetch(ge.ContactMethod,{contactMethodId:p,guideId:e},{noCache:!0}),x=n.updateForm(h,{submit:"Submit",errors:{},meta:{groupId:o}});if(h.body=x,h.body.guideId=e,!l.current)return null;r(h)},[l]);return b.useEffect(()=>(g(t),()=>{l.current=!1}),[t,g]),i?u.jsx(rt,{...i,body:{...i.body,form:i.body.form?{...i.body.form,data:(f=i.body.form)==null?void 0:f.data,layout:{...i.body.form.layout},meta:(y=i.body.form)==null?void 0:y.meta,schema:(v=i.body.form)==null?void 0:v.schema}:void 0,guideId:i.body.guideId},inline:!0,expanded:!0,dispatch:a,className:n.appendClassNames("humany-bot-contact-method",s)}):null},rt=n.newStyled(et)`
643
643
  padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}} ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
644
- `;exports.default=nt;
644
+ `;exports.default=st;