@memori.ai/memori-webcomponent 6.5.0 → 6.5.2

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.
@@ -247,4 +247,4 @@ const ux="144",dx={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},hx={ROTATE:0,
247
247
  * @license qrcode.react
248
248
  * Copyright (c) Paul O'Shannessy
249
249
  * SPDX-License-Identifier: ISC
250
- */function HU(e,t=0){const n=[];return e.forEach((function(e,r){let i=null;e.forEach((function(o,s){if(!o&&null!==i)return n.push(`M${i+t} ${r+t}h${s-i}v1H${i+t}z`),void(i=null);if(s!==e.length-1)o&&null===i&&(i=s);else{if(!o)return;null===i?n.push(`M${s+t},${r+t} h1v1H${s+t}z`):n.push(`M${i+t},${r+t} h${s+1-i}v1H${i+t}z`)}}))})),n.join("")}function GU(e,t){return e.slice().map(((e,n)=>n<t.y||n>=t.y+t.h?e:e.map(((e,n)=>(n<t.x||n>=t.x+t.w)&&e))))}function VU(e,t,n,r){if(null==r)return null;const i=n?4:0,o=e.length+2*i,s=Math.floor(.1*t),a=o/t,l=(r.width||s)*a,c=(r.height||s)*a,u=null==r.x?e.length/2-l/2:r.x*a,d=null==r.y?e.length/2-c/2:r.y*a;let h=null;if(r.excavate){let e=Math.floor(u),t=Math.floor(d);h={x:e,y:t,w:Math.ceil(l+u-e),h:Math.ceil(c+d-t)}}return{x:u,y:d,h:c,w:l,excavation:h}}var WU=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}();function qU(e){const n=e,{value:r,size:i=BU,level:o=zU,bgColor:s=FU,fgColor:a=UU,includeMargin:l=jU,style:u,imageSettings:d}=n,h=NU(n,["value","size","level","bgColor","fgColor","includeMargin","style","imageSettings"]),p=null==d?void 0:d.src,f=(0,c.useRef)(null),m=(0,c.useRef)(null),[g,v]=(0,c.useState)(!1);(0,c.useEffect)((()=>{if(null!=f.current){const e=f.current,t=e.getContext("2d");if(!t)return;let n=LU.QrCode.encodeText(r,DU[o]).getModules();const c=l?4:0,u=n.length+2*c,h=VU(n,i,l,d),p=m.current,g=null!=h&&null!==p&&p.complete&&0!==p.naturalHeight&&0!==p.naturalWidth;g&&null!=h.excavation&&(n=GU(n,h.excavation));const v=window.devicePixelRatio||1;e.height=e.width=i*v;const y=i/u*v;t.scale(y,y),t.fillStyle=s,t.fillRect(0,0,u,u),t.fillStyle=a,WU?t.fill(new Path2D(HU(n,c))):n.forEach((function(e,n){e.forEach((function(e,r){e&&t.fillRect(r+c,n+c,1,1)}))})),g&&t.drawImage(p,h.x+c,h.y+c,h.w,h.h)}})),(0,c.useEffect)((()=>{v(!1)}),[p]);const y=OU({height:i,width:i},u);let b=null;return null!=p&&(b=t(c).createElement("img",{src:p,key:p,style:{display:"none"},onLoad:()=>{v(!0)},ref:m})),t(c).createElement(t(c).Fragment,null,t(c).createElement("canvas",OU({style:y,height:i,width:i,ref:f},h)),b)}var KU=({tenant:e,url:n,title:r="",className:i,baseUrl:o,primary:a=!0,showQrCode:l=!0,align:u="right"})=>{const{t:d}=xe(),[h,p]=(0,c.useState)(n),f=(0,c.useMemo)((()=>(null==e?void 0:e.theme)?`${null!=o?o:"https://aisuru.com"}/images/${e.theme}/square_logo.png`:`${null!=o?o:"https://aisuru.com"}/images/memori_logo.png`),[e,o]);(0,c.useEffect)((()=>{n||p(window.location.href)}),[n]);const m=[{id:"facebook",title:"Facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${h}`,icon:bU},{id:"twitter",title:"Twitter",url:`https://twitter.com/intent/tweet?url=${h}`,icon:SU},{id:"linkedin",title:"LinkedIn",url:`https://www.linkedin.com/shareArticle?mini=true&title=${r}&url=${h}`,icon:xU},{id:"whatsapp",title:"Whatsapp",url:`https://api.whatsapp.com/send?phone=&text=${h}`,icon:wU},{id:"telegram",title:"Telegram",url:`https://t.me/share/url?text=${r}&url=${h}`,icon:TU},{id:"email",title:"Email",url:`mailto:?subject=${(null==r?void 0:r.length)>0?r:n}&body=${h}`,icon:_U}];return(0,s.jsxs)(Pv,{as:"div",className:t(ws)("memori-share-button",{"memori-share-button--align-left":"left"===u}),children:[(0,s.jsx)(Pv.Button,{className:t(ws)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button",i,{"memori-button--primary":a}),title:d("widget.share")||void 0,children:(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)(CU,{})})}),(0,s.jsxs)(Pv.Items,{className:"memori-share-button--overlay",as:"ul",children:[(0,s.jsx)(Pv.Item,{as:"li",className:"memori-share-button--li",children:(0,s.jsx)(xf,{className:"memori-share-button--link",ghost:!0,icon:(0,s.jsx)(oS,{}),onClick:()=>{h&&navigator.clipboard.writeText(h)},children:d("copyToClipboard")||void 0})},"copy"),m.map((e=>{var n;return(0,s.jsx)(Pv.Item,{as:"li",className:"memori-share-button--li",children:(0,s.jsxs)("a",{className:t(ws)("memori-button","memori-button--with-icon","memori-button--ghost","memori-button--padded","memori-share-button--link"),href:null!==(n=e.url)&&void 0!==n?n:"",target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)(e.icon,{})}),e.title]})},e.id)})),l&&(0,s.jsxs)(Pv.Item,{as:"li",className:"memori-share-button--li-qr-code",children:[(0,s.jsx)(qU,{id:"qr-canvas",value:null!=h?h:"",size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H",includeMargin:!1,imageSettings:{src:f,x:void 0,y:void 0,height:32,width:32,excavate:!0}}),(0,s.jsx)("div",{children:(0,s.jsx)(xf,{onClick:()=>{const e=document.getElementById("qr-canvas");if(!e)return;const t=document.createElement("a");t.href=e.toDataURL(),t.download=`memori-${r}-share.png`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},icon:(0,s.jsx)(AU,{}),title:"Download QR",children:"Download"})})]},"qrcode")]})]})};var JU=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M290 236.4l43.9-43.9a8.01 8.01 0 0 0-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0 0 13.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 0 0 0 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 0 0-11.3 0l-42.4 42.3a8.03 8.03 0 0 0 0 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 0 0 4.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 0 0-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 0 0-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z"})});var QU=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",focusable:"false",role:"img",className:e,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2","aria-label":t,children:[(0,s.jsx)("path",{d:"M23 4L23 10 17 10"}),(0,s.jsx)("path",{d:"M1 20L1 14 7 14"}),(0,s.jsx)("path",{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"})]});var YU=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6c-.3 1.5-.4 3-.4 4.4 0 14.4 11.6 26 26 26h723c1.5 0 3-.1 4.4-.4 14.2-2.4 23.7-15.9 21.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"})});var ZU=({className:e,memori:n,tenant:r,history:i,position:o,setShowPositionDrawer:a,setShowSettingsDrawer:l,setShowKnownFactsDrawer:u,setShowExpertsDrawer:d,speakerMuted:h,setSpeakerMuted:p,hasUserActivatedSpeak:f=!1,showShare:m=!0,showSettings:g=!0,showSpeaker:v=!0,showReload:y=!1,showClear:b=!1,showLogin:S=!0,setShowLoginDrawer:x,clearHistory:w,loginToken:_,user:C,sessionID:A})=>{const{t:E}=xe(),[T,M]=(0,c.useState)(!1),[I,R]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{document.fullscreenEnabled&&M(!0)}),[]),(0,s.jsxs)("div",{className:t(ws)("memori-header",e),children:[y&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--reload",title:E("reload")||"Reload",icon:(0,s.jsx)(QU,{}),onClick:()=>{window.location.reload()}}),b&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--clear",title:E("clearHistory")||"Clear chat",icon:(0,s.jsx)(YU,{}),onClick:w}),n.needsPosition&&o&&(0,s.jsxs)("div",{className:"memori-header--position",children:[0!==o.latitude&&0!==o.longitude&&(0,s.jsx)("span",{className:"memori-header--position-placeName",children:o.placeName}),(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--position",title:E("widget.position")||"Position",icon:(0,s.jsx)(nx,{}),onClick:()=>a(!0)})]}),T&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--fullscreen",title:I?E("fullscreenExit")||"Exit fullscreen":E("fullscreenEnter")||"Enter fullscreen",icon:I?(0,s.jsx)(US,{}):(0,s.jsx)(JU,{}),onClick:()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen(),R(!1)):(document.documentElement.requestFullscreen(),R(!0))}}),n.enableDeepThought&&!!_&&(null==C?void 0:C.pAndCUAccepted)&&(0,s.jsx)(xf,{primary:!!A&&!!f,shape:"circle",icon:(0,s.jsx)(ex,{}),className:"memori-header--button memori-header--button--knownfacts",disabled:!f||!A,onClick:()=>u(!0),title:E("knownFacts.title")||"Known facts"}),n.enableBoardOfExperts&&(0,s.jsx)(xf,{primary:!0,shape:"circle",icon:(0,s.jsx)($S,{}),className:"memori-header--button memori-header--button--experts",disabled:!f||!A,onClick:()=>d(!0),title:E("widget.showExpertsInTheBoard")||"Experts in this board"}),v&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--speaker",icon:h?(0,s.jsx)(JF,{}):(0,s.jsx)(YF,{}),onClick:()=>p(!h),title:E("widget.sound")||"Sound"}),(0,s.jsx)(vU,{history:i,memori:n,className:"memori-header--button memori-header--button--export",disabled:!f||0===i.length}),g&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button-settings",icon:(0,s.jsx)(yU,{}),onClick:()=>l(!0),title:E("widget.settings")||"Settings"}),m&&(0,s.jsx)(KU,{className:"memori-header--button memori-header--button-share",title:n.name,tenant:r,showQrCode:!0,align:"left"}),S&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button-login",icon:(0,s.jsx)(pv,{}),onClick:()=>x(!0),title:_?E("login.user")||"User":E("login.login")||"Login"})]})};var XU=({tenant:e,userLang:t="en",integrationID:n,memoriHash:r})=>{const i="memorytwin"===(null==e?void 0:e.theme)?"memorytwin":"twincreator"===(null==e?void 0:e.theme)?"twincreator":"aisuru";return(0,s.jsxs)("div",{className:"memori--powered-by",children:[(0,s.jsx)("img",{src:`https://aisuru.com/images/${i}/logo.png`,alt:""}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"sr-only",children:"Powered by"}),(0,s.jsx)("a",{href:`https://memori.ai/${"it"===(null==t?void 0:t.toLowerCase())?"it":"en"}${n?`?integrationID=${n}`:""}${r?`${n?"&":"?"}memori=${r}`:""}`,target:"_blank",rel:"noopener noreferrer",children:"Memori.AI"})]})]})},$U=(c=o("85Hg2"),c=o("85Hg2"),(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))($U||{})),ej=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(ej||{}),tj=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(tj||{}),nj=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.SetOrientation=3]="SetOrientation",e[e.GoToOption=4]="GoToOption",e[e.Search=5]="Search",e[e.ClearSearch=6]="ClearSearch",e[e.RegisterOption=7]="RegisterOption",e[e.UnregisterOption=8]="UnregisterOption",e))(nj||{});function rj(e,t=(e=>e)){let n=null!==e.activeOptionIndex?e.options[e.activeOptionIndex]:null,r=Cp(t(e.options.slice()),(e=>e.dataRef.current.domRef.current)),i=n?r.indexOf(n):null;return-1===i&&(i=null),{options:r,activeOptionIndex:i}}let ij={1:e=>e.disabled||1===e.listboxState?e:{...e,activeOptionIndex:null,listboxState:1},0(e){if(e.disabled||0===e.listboxState)return e;let t=e.activeOptionIndex,{value:n,mode:r,compare:i}=e.propsRef.current,o=e.options.findIndex((e=>{let t=e.dataRef.current.value;return lh(r,{1:()=>n.some((e=>i(e,t))),0:()=>i(n,t)})}));return-1!==o&&(t=o),{...e,listboxState:0,activeOptionIndex:t}},2:(e,t)=>e.disabled===t.disabled?e:{...e,disabled:t.disabled},3:(e,t)=>e.orientation===t.orientation?e:{...e,orientation:t.orientation},4(e,t){var n;if(e.disabled||1===e.listboxState)return e;let r=rj(e),i=dm(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeOptionIndex:i,activationTrigger:null!=(n=t.trigger)?n:1}},5:(e,t)=>{if(e.disabled||1===e.listboxState)return e;let n=""!==e.searchQuery?0:1,r=e.searchQuery+t.value.toLowerCase(),i=(null!==e.activeOptionIndex?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find((e=>{var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(r))})),o=i?e.options.indexOf(i):-1;return-1===o||o===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:o,activationTrigger:1}},6:e=>e.disabled||1===e.listboxState||""===e.searchQuery?e:{...e,searchQuery:""},7:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},r=rj(e,(e=>[...e,n]));if(null===e.activeOptionIndex){let{value:i,mode:o,compare:s}=e.propsRef.current,a=t.dataRef.current.value;lh(o,{1:()=>i.some((e=>s(e,a))),0:()=>s(i,a)})&&(r.activeOptionIndex=r.options.indexOf(n))}return{...e,...r}},8:(e,t)=>{let n=rj(e,(e=>{let n=e.findIndex((e=>e.id===t.id));return-1!==n&&e.splice(n,1),e}));return{...e,...n,activationTrigger:1}}},oj=(0,c.createContext)(null);function sj(e){let t=(0,c.useContext)(oj);if(null===t){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,sj),t}return t}function aj(e,t){return lh(t.type,ij,e,t)}oj.displayName="ListboxContext";let lj=c.Fragment,cj=mh((function(e,n){let{value:r,defaultValue:i,name:o,onChange:s,by:a=((e,t)=>e===t),disabled:l=!1,horizontal:u=!1,multiple:d=!1,...h}=e;const p=u?"horizontal":"vertical";let f=Ph(n),[m,g]=gm(r,s,i),v=(0,c.useReducer)(aj,{listboxState:1,propsRef:{current:{value:m,onChange:g,mode:d?1:0,compare:Mh("string"==typeof a?(e,t)=>{let n=a;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:a)}},labelRef:(0,c.createRef)(),buttonRef:(0,c.createRef)(),optionsRef:(0,c.createRef)(),disabled:l,orientation:p,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1}),[{listboxState:y,propsRef:b,optionsRef:S,buttonRef:x},w]=v;b.current.value=m,b.current.mode=d?1:0,_h((()=>{b.current.onChange=e=>lh(b.current.mode,{0:()=>g(e),1(){let t=b.current.value.slice(),{compare:n}=b.current,r=t.findIndex((t=>n(t,e)));return-1===r?t.push(e):t.splice(r,1),g(t)}})}),[g,b]),_h((()=>w({type:2,disabled:l})),[l]),_h((()=>w({type:3,orientation:p})),[p]),rf([x,S],((e,t)=>{var n;w({type:1}),Sp(t,bp.Loose)||(e.preventDefault(),null==(n=x.current)||n.focus())}),0===y);let _=(0,c.useMemo)((()=>({open:0===y,disabled:l,value:m})),[y,l,m]),C={ref:f};return t(c).createElement(oj.Provider,{value:v},t(c).createElement(xh,{value:lh(y,{0:bh.Open,1:bh.Closed})},null!=o&&null!=m&&hm({[o]:m}).map((([e,n])=>t(c).createElement(dp,{features:up.Hidden,...gh({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:e,value:n})}))),hh({ourProps:C,theirProps:h,slot:_,defaultTag:lj,name:"Listbox"})))})),uj=mh((function(e,t){var n;let[r,i]=sj("Listbox.Button"),o=Ph(r.buttonRef,t),s=`headlessui-listbox-button-${cp()}`,a=Uh(),l=Mh((e=>{switch(e.key){case ip.Space:case ip.Enter:case ip.ArrowDown:e.preventDefault(),i({type:0}),a.nextFrame((()=>{r.propsRef.current.value||i({type:4,focus:um.First})}));break;case ip.ArrowUp:e.preventDefault(),i({type:0}),a.nextFrame((()=>{r.propsRef.current.value||i({type:4,focus:um.Last})}))}})),u=Mh((e=>{if(e.key===ip.Space)e.preventDefault()})),d=Mh((e=>{if(op(e.currentTarget))return e.preventDefault();0===r.listboxState?(i({type:1}),a.nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),i({type:0}))})),h=sm((()=>{if(r.labelRef.current)return[r.labelRef.current.id,s].join(" ")}),[r.labelRef.current,s]),p=(0,c.useMemo)((()=>({open:0===r.listboxState,disabled:r.disabled,value:r.propsRef.current.value})),[r]),f=e;return hh({ourProps:{ref:o,id:s,type:lm(e,r.buttonRef),"aria-haspopup":!0,"aria-controls":null==(n=r.optionsRef.current)?void 0:n.id,"aria-expanded":r.disabled?void 0:0===r.listboxState,"aria-labelledby":h,disabled:r.disabled,onKeyDown:l,onKeyUp:u,onClick:d},theirProps:f,slot:p,defaultTag:"button",name:"Listbox.Button"})})),dj=mh((function(e,t){let[n]=sj("Listbox.Label"),r=`headlessui-listbox-label-${cp()}`;return hh({ourProps:{ref:Ph(n.labelRef,t),id:r,onClick:Mh((()=>{var e;return null==(e=n.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))},theirProps:e,slot:(0,c.useMemo)((()=>({open:0===n.listboxState,disabled:n.disabled})),[n]),defaultTag:"label",name:"Listbox.Label"})})),hj=uh.RenderStrategy|uh.Static,pj=mh((function(e,t){var n;let[r,i]=sj("Listbox.Options"),o=Ph(r.optionsRef,t),s=`headlessui-listbox-options-${cp()}`,a=Uh(),l=Uh(),u=Sh(),d=null!==u?u===bh.Open:0===r.listboxState;(0,c.useEffect)((()=>{var e;let t=r.optionsRef.current;!t||0===r.listboxState&&t!==(null==(e=hp(t))?void 0:e.activeElement)&&t.focus({preventScroll:!0})}),[r.listboxState,r.optionsRef]);let h=Mh((e=>{switch(l.dispose(),e.key){case ip.Space:if(""!==r.searchQuery)return e.preventDefault(),e.stopPropagation(),i({type:5,value:e.key});case ip.Enter:if(e.preventDefault(),e.stopPropagation(),null!==r.activeOptionIndex){let{dataRef:e}=r.options[r.activeOptionIndex];r.propsRef.current.onChange(e.current.value)}0===r.propsRef.current.mode&&(i({type:1}),Nh().nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})})));break;case lh(r.orientation,{vertical:ip.ArrowDown,horizontal:ip.ArrowRight}):return e.preventDefault(),e.stopPropagation(),i({type:4,focus:um.Next});case lh(r.orientation,{vertical:ip.ArrowUp,horizontal:ip.ArrowLeft}):return e.preventDefault(),e.stopPropagation(),i({type:4,focus:um.Previous});case ip.Home:case ip.PageUp:return e.preventDefault(),e.stopPropagation(),i({type:4,focus:um.First});case ip.End:case ip.PageDown:return e.preventDefault(),e.stopPropagation(),i({type:4,focus:um.Last});case ip.Escape:return e.preventDefault(),e.stopPropagation(),i({type:1}),a.nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case ip.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(i({type:5,value:e.key}),l.setTimeout((()=>i({type:6})),350))}})),p=sm((()=>{var e,t,n;return null!=(n=null==(e=r.labelRef.current)?void 0:e.id)?n:null==(t=r.buttonRef.current)?void 0:t.id}),[r.labelRef.current,r.buttonRef.current]),f=(0,c.useMemo)((()=>({open:0===r.listboxState})),[r]),m=e;return hh({ourProps:{"aria-activedescendant":null===r.activeOptionIndex||null==(n=r.options[r.activeOptionIndex])?void 0:n.id,"aria-multiselectable":1===r.propsRef.current.mode||void 0,"aria-labelledby":p,"aria-orientation":r.orientation,id:s,onKeyDown:h,role:"listbox",tabIndex:0,ref:o},theirProps:m,slot:f,defaultTag:"ul",features:hj,visible:d,name:"Listbox.Options"})})),fj=mh((function(e,t){let{disabled:n=!1,value:r,...i}=e,[o,s]=sj("Listbox.Option"),a=`headlessui-listbox-option-${cp()}`,l=null!==o.activeOptionIndex&&o.options[o.activeOptionIndex].id===a,{value:u,compare:d}=o.propsRef.current,h=lh(o.propsRef.current.mode,{1:()=>u.some((e=>d(e,r))),0:()=>d(u,r)}),p=(0,c.useRef)(null),f=Ph(t,p);_h((()=>{if(0!==o.listboxState||!l||0===o.activationTrigger)return;let e=Nh();return e.requestAnimationFrame((()=>{var e,t;null==(t=null==(e=p.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})),e.dispose}),[p,l,o.listboxState,o.activationTrigger,o.activeOptionIndex]);let m=(0,c.useRef)({disabled:n,value:r,domRef:p});_h((()=>{m.current.disabled=n}),[m,n]),_h((()=>{m.current.value=r}),[m,r]),_h((()=>{var e,t;m.current.textValue=null==(t=null==(e=p.current)?void 0:e.textContent)?void 0:t.toLowerCase()}),[m,p]);let g=Mh((()=>o.propsRef.current.onChange(r)));_h((()=>(s({type:7,id:a,dataRef:m}),()=>s({type:8,id:a}))),[m,a]);let v=Mh((e=>{if(n)return e.preventDefault();g(),0===o.propsRef.current.mode&&(s({type:1}),Nh().nextFrame((()=>{var e;return null==(e=o.buttonRef.current)?void 0:e.focus({preventScroll:!0})})))})),y=Mh((()=>{if(n)return s({type:4,focus:um.Nothing});s({type:4,focus:um.Specific,id:a})})),b=Mh((()=>{n||l||s({type:4,focus:um.Specific,id:a,trigger:0})})),S=Mh((()=>{n||!l||s({type:4,focus:um.Nothing})})),x=(0,c.useMemo)((()=>({active:l,selected:h,disabled:n})),[l,h,n]);return hh({ourProps:{id:a,ref:f,role:"option",tabIndex:!0===n?void 0:-1,"aria-disabled":!0===n||void 0,"aria-selected":h,disabled:void 0,onClick:v,onFocus:y,onPointerMove:b,onMouseMove:b,onPointerLeave:S,onMouseLeave:S},theirProps:i,slot:x,defaultTag:"li",name:"Listbox.Option"})})),mj=Object.assign(cj,{Button:uj,Label:dj,Options:pj,Option:fj});var gj=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false",role:"img",className:e,fill:"currentColor","aria-label":t,children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z",clipRule:"evenodd"})});const vj={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},yj=(0,c.memo)((({defaultDate:e,onChange:t,disabled:n=!1})=>{const{t:r,i18n:i}=xe(),[o,a]=(0,c.useState)(e?"string"==typeof e?_s.DateTime.fromISO(e):_s.DateTime.fromJSDate(e):_s.DateTime.now());return(0,c.useEffect)((()=>{t(o)}),[o,t]),(0,s.jsxs)("div",{className:"memori--date-selector",children:[(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(mj,{value:o,onChange:e=>{a(e)},disabled:n,name:"day",children:[(0,s.jsxs)(mj.Label,{className:"memori--date-selector__select-label",children:[r("day"),":"]}),(0,s.jsxs)(mj.Button,{"aria-label":r("day"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:o.day}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(gj,{})})]}),(0,s.jsx)(np,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(mj.Options,{className:"memori--date-selector__select-options",children:[...Array(31).keys()].map((e=>(0,s.jsx)(mj.Option,{value:o.set({day:e+1}),className:"memori--date-selector__select-option",children:e+1},e)))})})]})}),(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(mj,{value:o,onChange:e=>{a(e)},disabled:n,name:"month",children:[(0,s.jsxs)(mj.Label,{className:"memori--date-selector__select-label",children:[r("month"),":"]}),(0,s.jsxs)(mj.Button,{"aria-label":r("month"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:vj["it"===i.language?"it":"en"][o.month-1]}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(gj,{})})]}),(0,s.jsx)(np,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(mj.Options,{className:"memori--date-selector__select-options",children:vj["it"===i.language?"it":"en"].map((e=>(0,s.jsx)(mj.Option,{className:"memori--date-selector__select-option",value:o.set({month:vj["it"===i.language?"it":"en"].findIndex((t=>t===e))+1}),children:e},e)))})})]})}),(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(mj,{value:o,onChange:e=>{a(e)},disabled:n,name:"year",children:[(0,s.jsxs)(mj.Label,{className:"memori--date-selector__select-label",children:[r("year"),":"]}),(0,s.jsxs)(mj.Button,{"aria-label":r("year"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:o.year}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(gj,{})})]}),(0,s.jsx)(np,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(mj.Options,{className:"memori--date-selector__select-options",children:[...Array(_s.DateTime.now().year-1899).keys()].sort(((e,t)=>t-e)).map((e=>(0,s.jsx)(mj.Option,{value:o.set({year:e+1900}),className:"memori--date-selector__select-option",children:e+1900},e)))})})]})})]})}));yj.displayName="DateSelector";var bj=yj;c=o("85Hg2");var Sj=({visible:e=!1,onClose:n,minAge:r})=>{const{t:i}=xe(),[o,a]=(0,c.useState)(),[l,u]=(0,c.useState)(),[d,h]=(0,c.useState)(!1),p=(0,c.useCallback)((()=>{if(h(!0),!o)return t(Ju).error(i("requiredField")),u(i("requiredField")||"Required field"),void h(!1);if(_s.DateTime.now().diff(o,"years").years<r)return t(Ju).error(i("underageTwinSession",{age:r})),u(i("underageTwinSession",{age:r})||`You must be at least ${r} years old to interact with this Twin`),void h(!1);n(o.toJSDate().toISOString())}),[o,r,n,i]);return(0,s.jsxs)(Gm,{open:e,title:i("ageVerification"),className:"age-verification-modal",closable:!0,onClose:()=>n(),children:[(0,s.jsx)("p",{children:i("ageVerificationText",{minAge:r})}),(0,s.jsxs)("form",{className:"age-verification-form",onSubmit:e=>{e.preventDefault(),p()},children:[(0,s.jsx)("div",{className:"form-item",children:(0,s.jsxs)("fieldset",{name:"birthDate",children:[(0,s.jsx)("legend",{className:"sr-only",children:i("birthDate")}),(0,s.jsx)(bj,{defaultDate:new Date(Date.now()),onChange:e=>{a(e)}}),(0,s.jsx)("p",{className:"form-item-help",children:i("birthDateHelper")}),l&&(0,s.jsx)("p",{className:"form-item-error",children:l})]})}),(0,s.jsx)("div",{className:"form-item form-submit",children:(0,s.jsx)(xf,{primary:!0,htmlType:"submit",className:"age-verification-submit",loading:d,disabled:!o,children:i("confirm")})})]})]})};c=o("85Hg2");var xj=({label:e,className:n,disabled:r=!1,indeterminate:i=!1,checked:o,children:a,onChange:l,name:u,...d})=>{const h=(0,c.useRef)(null);return(0,c.useEffect)((()=>{h.current&&(h.current.indeterminate=i)}),[h,i]),(0,s.jsxs)("label",{className:t(ws)("memori-checkbox",n,{"memori-checkbox--disabled":r,"memori-checkbox--indeterminate":i}),children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{ref:h,type:"checkbox",...d,name:u,disabled:r,checked:o||i,className:"memori-checkbox--input",onChange:l}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),!!(null==e?void 0:e.length)&&(0,s.jsx)("span",{className:"memori-checkbox--text",children:e})]})};c=o("85Hg2");var wj=({className:e,value:n,name:r,displayValue:i,options:o,onChange:a,disabled:l=!1,label:u,placeholder:d})=>(0,s.jsx)("div",{className:t(ws)("memori-select",e),children:(0,s.jsxs)(mj,{value:n,onChange:e=>{a(e)},disabled:l,name:r,children:[u&&(0,s.jsxs)(mj.Label,{className:"memori-select--label",children:[u,":"]}),(0,s.jsxs)(mj.Button,{"aria-label":u,className:"memori-select--button",children:[(0,s.jsx)("span",{className:t(ws)("memori-select--value",{"memori-select--value-placeholder":!n}),children:n?i||n:d}),(0,s.jsx)("span",{className:"memori-select--icon",children:(0,s.jsx)(gj,{})})]}),(0,s.jsx)(np,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(mj.Options,{className:"memori-select--options",children:o.map((e=>(0,s.jsx)(mj.Option,{value:e.value,className:"memori-select--option",children:e.label},e.value)))})})]})});const _j={muteSpeaker:"@memori:muteSpeaker",microphoneMode:"@memori:microphoneMode",continuousSpeechTimeout:"@memori:continuousSpeechTimeout",sendOnEnter:"@memori:sendOnEnter",birthDate:"@memori:birthDate",controlsPosition:"@memori:controlsPosition",hideEmissions:"@memori:hideEmissions",loginToken:"@memori:loginToken",location:"@memori:location"},Cj=(e,t)=>{var n;try{const r=window.localStorage.getItem(null!==(n=_j[e])&&void 0!==n?n:e);if(!r)return t;try{return JSON.parse(r)}catch(e){return r}}catch(e){return console.error("error",e),t}},Aj=(e,t)=>{var n;try{window.localStorage.setItem(null!==(n=_j[e])&&void 0!==n?n:e,t.toString())}catch(e){console.error("error",e)}},Ej=e=>{var t;try{window.localStorage.removeItem(null!==(t=_j[e])&&void 0!==t?t:e)}catch(e){console.error("error",e)}},Tj=[2,3,5,10,15,20,30,60];var Mj=({open:e,layout:t="DEFAULT",onClose:n,microphoneMode:r="HOLD_TO_TALK",continuousSpeechTimeout:i,setMicrophoneMode:o,setContinuousSpeechTimeout:a,controlsPosition:l,setControlsPosition:c,hideEmissions:u,setHideEmissions:d,additionalSettings:h})=>{const{t:p}=xe();return(0,s.jsxs)(_f,{className:"memori-settings-drawer",open:e,onClose:n,title:p("widget.settings")||"Settings",description:p("write_and_speak.settingsHeaderLabel"),children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"#microphoneMode",children:[p("write_and_speak.microphoneMode")||"Microphone mode",":"]}),(0,s.jsxs)(BS,{id:"microphoneMode",name:"microphoneMode",value:r,defaultValue:r,className:"memori-settings-drawer--microphoneMode-radio",onChange:e=>{let t="CONTINUOUS"===e?"CONTINUOUS":"HOLD_TO_TALK";o(t),Aj("microphoneMode",t)},children:[(0,s.jsx)(BS.Option,{value:"HOLD_TO_TALK",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked:e})=>(0,s.jsx)(xf,{primary:e,outlined:!e,children:p("write_and_speak.holdToSpeak")||"Hold to speak"})}),(0,s.jsx)(BS.Option,{value:"CONTINUOUS",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked:e})=>(0,s.jsx)(xf,{primary:e,outlined:!e,children:p("write_and_speak.continuousSpeechLabel")||"Continuous speech"})})]})]}),"CONTINUOUS"===r&&(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(wj,{label:p("write_and_speak.secondsLabel")||"Seconds",placeholder:p("write_and_speak.secondsLabel")||"Seconds",options:Tj.map((e=>({value:e,label:e}))),value:i,onChange:e=>{a(e),Aj("continuousSpeechTimeout",e)}})}),"TOTEM"===t&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"#controlsPosition",children:[p("write_and_speak.controlsPosition")||"Controls",":"]}),(0,s.jsxs)(BS,{id:"controlsPosition",name:"controlsPosition",value:l,defaultValue:l,className:"memori-settings-drawer--controlsposition-radio",onChange:e=>{c(e),Aj("controlsPosition",e)},children:[(0,s.jsx)(BS.Option,{value:"center",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(xf,{primary:e,outlined:!e,children:p("center")||"Center"})}),(0,s.jsx)(BS.Option,{value:"bottom",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(xf,{primary:e,outlined:!e,children:p("bottom")||"Bottom"})})]})]}),(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(xj,{label:p("write_and_speak.hideEmissionsLabel")||"Hide emissions",name:"hideControls",checked:u,onChange:e=>{d(e.target.checked),Aj("hideEmissions",e.target.checked)}})})]}),h&&(0,s.jsx)("div",{className:"memori-settings-drawer--field controls",children:h})]})};c=o("85Hg2");var Ij=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"})});var Rj=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M15 18L9 12 15 6"})});var Pj=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M9 18L15 12 9 6"})});var kj=({apiURL:e,sessionID:n,memori:r,visible:i=!0,initialKnownFacts:o=[],closeDrawer:a})=>{var l;const{t:u}=xe(),d=Y(e),{getKnownFactsPaginated:h,deleteKnownFact:p}=d.knownFacts,[f,m]=(0,c.useState)(o),[g,v]=(0,c.useState)(25),[y,b]=(0,c.useState)(0),[S,x]=(0,c.useState)(null!==(l=null==o?void 0:o.length)&&void 0!==l?l:0),[w,_]=(0,c.useState)(!1),C=async(e,r,i)=>{if(n||e){_(!0);try{const{knownFacts:o,count:s,...a}=await h(null!=e?e:n,null!=r?r:y,null!=i?i:g);m(null!=o?o:[]),x(null!=s?s:0),0!==a.resultCode&&(console.error(a),t(Ju).error(u(Hv(a.resultCode))))}catch(e){console.error("KNOWN_FACTS/FETCH",e),m(null!=o?o:[])}_(!1)}};(0,c.useEffect)((()=>{C()}),[]);const[A,E]=(0,c.useState)(!1),[T,M]=(0,c.useState)(),[I,R]=(0,c.useState)([]);return(0,s.jsxs)(_f,{open:i,width:"80%",className:"memori-known-facts-drawer",onClose:()=>a(),title:u("knownFacts.title"),children:[(0,s.jsx)("p",{children:u("knownFacts.description",{memoriName:r.name})}),(0,s.jsxs)(Sf,{spinning:w,children:[(0,s.jsxs)("div",{className:"memori-known-facts-actions",children:[(0,s.jsxs)(xf,{primary:!0,danger:!0,onClick:()=>{E(!0)},className:"memori-known-facts-delete-selected",disabled:0===(null==I?void 0:I.length),icon:(0,s.jsx)(Ij,{}),loading:w,children:[u("selected")," (",null==I?void 0:I.length,")"]}),(0,s.jsx)(Gm,{className:"memori-known-facts-modal",open:A,closable:!0,title:I.length>1?u("knownFacts.deleteSelectedConfirmTitle"):u("knownFacts.deleteConfirmTitle"),description:I.length>1?u("knownFacts.deleteSelectedConfirmMessage",{number:I.length}):u("knownFacts.deleteConfirmMessage"),onClose:()=>{E(!1)},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(xf,{ghost:!0,onClick:()=>{E(!1)},children:u("cancel")}),(0,s.jsx)(xf,{primary:!0,danger:!0,onClick:async()=>{try{const e=I.map((e=>p(n,e)));Promise.all(e).then((e=>{if(e.every((e=>0===e.resultCode)))t(Ju).success(u("knownFacts.deleteSuccess")),R([]),C(),E(!1);else{let n=e.find((e=>0!==e.resultCode));console.error(n),void 0!==(null==n?void 0:n.resultCode)&&t(Ju).error(u(Hv(null==n?void 0:n.resultCode)))}}))}catch(e){let n=e;t(Ju).error(u("Error")+n.message)}},children:u("confirm")})]})})]}),S>25&&(0,s.jsxs)("nav",{className:"memori--table--pagination",children:[S>g&&(0,s.jsxs)("div",{className:"memori--table--pagination--pages",children:[(0,s.jsx)(xf,{shape:"circle",disabled:0===y||y<g,padded:!1,title:u("previous")||"Previous",icon:(0,s.jsx)(Rj,{}),onClick:()=>{let e=(y/g-1)*g;b(e),C(void 0,e,g)}}),(0,s.jsxs)("span",{className:"memori--table--pagination--pages--current",children:[Math.ceil(y/g)+1," /"," ",Math.ceil(S/g)]}),(0,s.jsx)(xf,{shape:"circle",padded:!1,title:u("next")||"Next",icon:(0,s.jsx)(Pj,{}),disabled:(y/g+1)*g>=S,onClick:()=>{let e=(y/g+1)*g;b(e),C(void 0,e,g)}})]}),(0,s.jsx)(wj,{options:[{label:`25 / ${u("page")||"page"}`,value:25},{label:`50 / ${u("page")||"page"}`,value:50},{label:`100 / ${u("page")||"page"}`,value:100}],value:g,displayValue:`${g} / ${u("page")||"page"}`,onChange:e=>{v(e),b(0),C(void 0,0,e)}})]}),(0,s.jsxs)("table",{className:"memori--table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"memori--table--column-centered",children:(0,s.jsx)(xj,{checked:!!(null==f?void 0:f.length)&&(null==I?void 0:I.length)===f.length,indeterminate:!!(null==f?void 0:f.length)&&!!(null==I?void 0:I.length)&&(null==I?void 0:I.length)!==(null==f?void 0:f.length),onChange:e=>{e.target.checked?R(f.map((e=>e.knownFactID))):R([])}})}),(0,s.jsx)("th",{children:u("knownFacts.text")}),(0,s.jsx)("th",{className:"mobile-hidden",children:u("createdAt")}),(0,s.jsx)("th",{className:"memori--table--column-right",children:u("actions")})]})}),(0,s.jsx)("tbody",{children:f.map((e=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"memori--table--column-centered",children:(0,s.jsx)(xj,{checked:null==I?void 0:I.includes(e.knownFactID),onChange:t=>{t.target.checked?R((t=>[...new Set([...t,e.knownFactID])])):R((t=>t.filter((t=>t!==e.knownFactID))))}})}),(0,s.jsx)("td",{children:e.text}),(0,s.jsx)("td",{className:"mobile-hidden",children:(0,s.jsx)("span",{className:"memori--table--date",children:e.creationTimestamp?new Intl.DateTimeFormat("it",{dateStyle:"short",timeStyle:"short"}).format(new Date(e.creationTimestamp)):"-"})}),(0,s.jsx)("td",{className:"memori--table--column-right",children:(0,s.jsxs)("div",{className:"memori--table--action-column",children:[(0,s.jsx)(xf,{danger:!0,ghost:!0,shape:"circle",icon:(0,s.jsx)(Ij,{}),disabled:(null==I?void 0:I.length)>0,title:u("delete")||"Delete",onClick:()=>M(e.knownFactID)}),(0,s.jsx)(Gm,{className:"memori-known-facts-modal",open:T===e.knownFactID,closable:!0,title:u("knownFacts.deleteConfirmTitle"),description:u("knownFacts.deleteConfirmMessage"),onClose:()=>{M(void 0)},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(xf,{ghost:!0,onClick:()=>{M(void 0)},children:u("cancel")}),(0,s.jsx)(xf,{primary:!0,danger:!0,onClick:async()=>{try{const r=await p(n,e.knownFactID);0===r.resultCode?(t(Ju).success(u("knownFacts.deleteSuccess")),R([]),C(),M(void 0)):(console.error(r),t(Ju).error(u(Hv(r.resultCode),{ns:"common"})))}catch(e){let n=e;t(Ju).error(u("Error")+n.message)}},children:u("confirm")})]})})]})})]},e.knownFactID)))})]})]})]})};var Oj=({open:e=!1,baseUrl:t,apiUrl:n,tenant:r,experts:i,onClose:o})=>{const{t:a}=xe();return(0,s.jsx)(_f,{open:e,onClose:o,className:"memori--experts-drawer",title:(0,s.jsx)("h2",{className:"memori--experts-drawer--title",children:a("widget.expertsInTheBoard")}),children:(0,s.jsx)("ul",{className:"memori--experts-drawer--list",children:i.map((e=>(0,s.jsxs)("li",{className:"memori--experts-drawer--item",children:[(0,s.jsx)("figure",{className:"memori--experts-drawer--avatar",children:(0,s.jsx)("img",{src:`${n}/api/v1/memoriai/memori/avatar/${e.expertMemoriID}`,alt:e.name,onError:e=>{e.currentTarget.src=hv({tenantID:null==r?void 0:r.id,type:"avatar",baseURL:t}),e.currentTarget.onerror=null}})}),(0,s.jsxs)("div",{className:"memori--experts-drawer--content",children:[(0,s.jsx)("h3",{className:"memori--experts-drawer--name",children:e.name}),(0,s.jsx)("p",{className:"memori--experts-drawer--description",children:e.description})]})]},e.expertID)))})})};c=o("85Hg2"),c=o("85Hg2");const Nj=["memori","private","public","api","404","500","it","en","account","auth","logout","privacy_and_cookie","unauthorized","users","virtual_spaces"];var Lj=({tenant:e,apiUrl:n,onLogin:r,goToLogin:i,__TEST__waitingForOtp:o=!1})=>{const{t:a,i18n:l}=xe(),u="it"===l.language?"it":"en",d=Y(n),{userSignUp:h,userConfirmSignUp:p,resendVerificationCode:f}=d.backend,[m,g]=(0,c.useState)(),[v,y]=(0,c.useState)(),[b,S]=(0,c.useState)(),[x,w]=(0,c.useState)(),_=!b||b&&$f.test(b),C=_&&b&&b.length>=24,A=!b||0===b.length,E=!_||A?0:b.length<8?15:b.length>=32?100:(b.length-8)*(50/24)+50,[T,M]=(0,c.useState)(!1),[I,R]=(0,c.useState)(!1),[P,k]=(0,c.useState)(o),[O,N]=(0,c.useState)(null),[L,D]=(0,c.useState)();(0,c.useEffect)((()=>{D(window.location.href)}),[]);return P?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async n=>{var i,o,s;n.preventDefault();const l=n.currentTarget,c=null!==(i=l.tenant.value)&&void 0!==i?i:e.id,u=null!==(o=l.userName.value)&&void 0!==o?o:v,d=null!==(s=l.password.value)&&void 0!==s?s:b,h=l.verificationCode.value;M(!0),N(null);try{const{user:e,token:n,...i}=await p({tenant:c,userName:u,password:d,verificationCode:h});0!==i.resultCode?(console.error(i),t(Ju).error(a(Hv(i.resultCode)))):e&&n&&(t(Ju).success(a("success")),r(e,n))}catch(e){let n=e;console.error("[validate otp]",n),(null==n?void 0:n.message)&&t(Ju).error(n.message)}finally{M(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"userName",value:v}),(0,s.jsx)("input",{type:"hidden",name:"password",value:b}),(0,s.jsx)("input",{type:"hidden",name:"tenant",value:e.id}),(0,s.jsxs)("label",{htmlFor:"#verificationCode",children:[a("login.otpCode"),(0,s.jsx)("input",{id:"verificationCode",name:"verificationCode",type:"text",required:!0,autoComplete:"one-time-code",placeholder:a("login.otpCode")||"OTP"})]}),(0,s.jsx)("p",{children:(0,s.jsx)(xf,{outlined:!0,onClick:async n=>{if(n.preventDefault(),v){R(!0);try{const n=await f({tenant:null==e?void 0:e.id,userName:v});0===n.resultCode?t(Ju).success(a("resentVerificationCode")):(console.error(n),t(Ju).error(a(Hv(n.resultCode))))}catch(e){let n=e;console.error("[resend otp]",n),(null==n?void 0:n.message)&&t(Ju).error(n.message)}finally{R(!1)}}},loading:I,children:a("login.resendVerificationCode")})}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:T,children:a("confirm")})]}),O&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:O})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async n=>{var r,i,o,s,l,c,u;n.preventDefault();const d=n.currentTarget,p=null!==(r=d.tenant.value)&&void 0!==r?r:e.id,f=(null!==(i=d.eMail.value)&&void 0!==i?i:m).toLowerCase(),g=null!==(o=d.userName.value)&&void 0!==o?o:v,y=d.password.value,b=new Date(null===(s=d.birthDate)||void 0===s?void 0:s.value).toISOString(),S=null===(l=d.tnCAndPPAccepted)||void 0===l?void 0:l.checked,x=null===(c=d.pAndCUAccepted)||void 0===c?void 0:c.checked,w=null===(u=d.referral)||void 0===u?void 0:u.value;if(!(f&&g&&y&&b&&S))return void N(a("missingData"));M(!0),N(null);if(((new Date).getTime()-new Date(b).getTime())/1e3/60/60/24/365<14)return t(Ju).error(a("login.underage",{age:14})),void N(a("login.underage",{age:14}));try{const{user:e,...n}=await h({tenant:p,eMail:f,userName:g,password:y,birthDate:b,tnCAndPPAccepted:S,tnCAndPPAcceptanceDate:(new Date).toISOString(),pAndCUAccepted:x,pAndCUAcceptanceDate:(new Date).toISOString(),referral:w});0!==n.resultCode?(console.error(n),t(Ju).error(a(Hv(n.resultCode)))):e&&(t(Ju).success(a("success")),k(!0))}catch(e){let n=e;console.error("[signup]",n),(null==n?void 0:n.message)&&t(Ju).error(n.message)}finally{M(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"tenant",value:e.id}),(0,s.jsx)("input",{type:"hidden",name:"referral",value:L}),(0,s.jsxs)("label",{htmlFor:"#eMail",children:[a("login.email"),(0,s.jsx)("input",{type:"email",name:"eMail",id:"eMail",required:!0,autoComplete:"email",placeholder:a("login.email")||"Email",onChange:e=>g(e.target.value),"aria-invalid":!!(null==m?void 0:m.length)&&!em.test(m)})]}),!!(null==m?void 0:m.length)&&!em.test(m)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.emailFormatError")}),(0,s.jsxs)("label",{htmlFor:"userName",children:[a("login.username"),(0,s.jsx)("input",{type:"text",name:"userName",id:"userName",required:!0,autoComplete:"username",placeholder:a("login.username")||"Username",onFocus:()=>{if(!(null==v?void 0:v.length)&&(null==m?void 0:m.length)){let e=(e=>e.split("@")[0].replace(/[^a-zA-Z0-9]/g,""))(m);const t=document.getElementById("userName");t&&(t.value=e,y(e))}},onChange:e=>y(e.target.value),"aria-invalid":!!(null==v?void 0:v.length)&&(Nj.includes(v.toLowerCase())||!tm.test(v))})]}),!!(null==v?void 0:v.length)&&Nj.includes(v.toLowerCase())&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.usernameContainsReservedWord")}),!!(null==v?void 0:v.length)&&!tm.test(v)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.usernameFormatError")}),(0,s.jsxs)("label",{htmlFor:"#birthDate",children:[a("login.birthDate"),(0,s.jsx)("input",{id:"birthDate",name:"birthDate",type:"date",required:!0,autoComplete:"bday"})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:a("login.birthDateHelper")})}),(0,s.jsxs)("label",{htmlFor:"#password",children:[a("login.password"),(0,s.jsx)("input",{id:"password",name:"password",type:"password",required:!0,autoComplete:"new-password",placeholder:a("login.password")||"Password",onChange:e=>S(e.target.value),"aria-invalid":!_})]}),!_&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[a("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:a("login.confirmPassword")||"Password",onChange:e=>w(e.target.value),"aria-invalid":!!(null==b?void 0:b.length)&&!!(null==x?void 0:x.length)&&b!==x})]}),!!(null==b?void 0:b.length)&&!!(null==x?void 0:x.length)&&b!==x&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:E,id:"password-strength-meter"}),(0,s.jsx)("small",{children:a("login.pwd"+(C?"Strong":_?"Acceptable":"Weak"))}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",required:!0,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[a("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${u}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:a("login.privacyAndCookiePolicy")})," ",a("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${u}/tos`,target:"_blank",rel:"noopener noreferrer",children:a("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[a("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",a("login.optional"),")"]})})]})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:a("login.deepThoughtExplaination")})}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:T,children:a("login.signUp")}),(0,s.jsxs)("p",{className:"memori--login-drawer--signup",children:[a("login.alreadyHaveAnAccount")," ",(0,s.jsx)(xf,{outlined:!0,onClick:i,children:a("login.backToLogin")})]})]}),O&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:O})]})};c=o("85Hg2");const Dj=["image/jpeg","image/png","image/jpg","image/gif"];var Bj=({user:e,loginToken:n,apiUrl:r,onUserUpdate:i})=>{const{t:o,i18n:a}=xe(),l="it"===a.language?"it":"en",u=Y(r),{updateUser:d,uploadAsset:h}=u.backend,[p,f]=(0,c.useState)(),[m,g]=(0,c.useState)(),[v,y]=(0,c.useState)(),b=!m||m&&$f.test(m),S=b&&m&&m.length>=24,x=!m||0===m.length,w=!b||x?0:m.length<8?15:m.length>=32?100:(m.length-8)*(50/24)+50,[_,C]=(0,c.useState)(!1),[A,E]=(0,c.useState)(null),T=async(e,r)=>{try{const{user:s,...a}=await d(n,e,r);0!==a.resultCode?(console.error(a),t(Ju).error(o(Hv(a.resultCode)))):s&&(t(Ju).success(o("success")),i(s))}catch(e){let n=e;console.error("[signup]",n),(null==n?void 0:n.message)&&t(Ju).error(n.message)}finally{C(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{className:"memori--login-drawer--edit-account-title",children:o("login.editAccount")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form memori--login-drawer--account-form",onSubmit:async r=>{var i,s,a,l,c;if(r.preventDefault(),!e.userID)return;const u=e.userID,d=r.currentTarget,f=null!==(i=d.eMail.value)&&void 0!==i?i:p,g=null!==(s=d.newPassword.value)&&void 0!==s?s:m,v=d.password.value,y=d.confirmPassword.value,b=null===(a=d.pAndCUAccepted)||void 0===a?void 0:a.checked,S=null===(c=null===(l=d.avatar)||void 0===l?void 0:l.files)||void 0===c?void 0:c[0];if(C(!0),E(null),(null==g?void 0:g.length)&&g!==y)return E(o("login.passwordMatchingError")),void C(!1);let x={...(null==f?void 0:f.length)&&f!==e.eMail?{eMail:f}:{},...g?{password:v,newPassword:g}:{},...void 0!==b&&b!==e.pAndCUAccepted?{pAndCUAccepted:b,pAndCUAcceptanceDate:(new Date).toISOString()}:{}};if(0!==Object.values(x).length)if(S){const e=new FileReader;e.onload=async e=>{var r,i;try{const{asset:s,...a}=await h(null!==(r=S.name)&&void 0!==r?r:"avatar",null===(i=e.target)||void 0===i?void 0:i.result,n);0!==a.resultCode?(console.error(a),t(Ju).error(o(Hv(a.resultCode)))):s&&(x.avatarURL=s.assetURL,await T(u,x))}catch(e){let n=e;console.error("[avatar upload]",n),(null==n?void 0:n.message)&&t(Ju).error(n.message)}},e.readAsDataURL(S)}else await T(u,x);else console.debug("No changes to submit")},children:[(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.emailChange")}),(0,s.jsxs)("label",{htmlFor:"#eMail",children:[o("login.email"),(0,s.jsx)("input",{type:"email",name:"eMail",id:"eMail",autoComplete:"email",placeholder:e.eMail,onChange:e=>f(e.target.value),"aria-invalid":!!(null==p?void 0:p.length)&&!em.test(p)})]}),!!(null==p?void 0:p.length)&&!em.test(p)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.emailFormatError")})]}),(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.passwordChange")}),(0,s.jsxs)("label",{htmlFor:"#password",children:[o("login.currentPassword"),(0,s.jsx)("input",{id:"password",name:"password",type:"password",autoComplete:"password",placeholder:o("login.currentPassword")||"Password"})]}),(0,s.jsxs)("label",{htmlFor:"#newPassword",children:[o("login.newPassword"),(0,s.jsx)("input",{id:"newPassword",name:"newPassword",type:"password",autoComplete:"new-password",placeholder:o("login.password")||"Password",onChange:e=>g(e.target.value),"aria-invalid":!b})]}),!b&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[o("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",autoComplete:"new-password",placeholder:o("login.confirmPassword")||"Password",onChange:e=>y(e.target.value),"aria-invalid":!!(null==m?void 0:m.length)&&!!(null==v?void 0:v.length)&&m!==v})]}),!!(null==m?void 0:m.length)&&!!(null==v?void 0:v.length)&&m!==v&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:w,id:"password-strength-meter"}),(0,s.jsx)("small",{children:o("login.pwd"+(S?"Strong":b?"Acceptable":"Weak"))})]}),(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.avatarChange")}),(0,s.jsxs)("label",{htmlFor:"#avatar",children:["Avatar",(0,s.jsx)("input",{type:"file",name:"avatar",id:"avatar",accept:Dj.join(", "),placeholder:e.avatarURL})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox memori-checkbox--disabled",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",disabled:!0,defaultChecked:e.tnCAndPPAccepted,checked:e.tnCAndPPAccepted,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[o("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${l}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:o("login.privacyAndCookiePolicy")})," ",o("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${l}/tos`,target:"_blank",rel:"noopener noreferrer",children:o("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",className:"memori-checkbox--input",defaultChecked:e.pAndCUAccepted}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsx)(mv,{align:"left",content:o("login.deepThoughtExplaination"),children:(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[o("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",o("login.optional"),")"]})})]})})]}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:_,children:o("login.save")})]}),A&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:A})]})};var zj=({open:e=!1,onClose:n,onLogin:r,onLogout:i,user:o,loginToken:a,tenant:l,apiUrl:u,__TEST__signup:d=!1,__TEST__needMissingData:h=!1,__TEST__waitingForOtp:p=!1,__TEST__changePwd:f=!1})=>{var m,g;const{t:v,i18n:y}=xe(),b="it"===y.language?"it":"en",S=Y(u),{userLogin:x,updateUser:w}=S.backend,_=(null==o?void 0:o.userID)&&a,[C,A]=(0,c.useState)(!1),[E,T]=(0,c.useState)(null),[M,I]=(0,c.useState)(d),[R,P]=(0,c.useState)(f?{flowID:"flowID",tenant:l.id,eMail:"email",userName:"username",password:"password"}:void 0),[k,O]=(0,c.useState)(h?{token:"token",birthDate:!0,tnCAndPPAccepted:!0}:{}),[N,L]=(0,c.useState)(),[D,B]=(0,c.useState)(),z=!N||N&&$f.test(N),F=z&&N&&N.length>=24,U=!N||0===N.length,j=!z||U?0:N.length<8?15:N.length>=32?100:(N.length-8)*(50/24)+50;return(0,s.jsx)(_f,{open:e,onClose:n,className:t(ws)("memori--login-drawer",{"memori--login-drawer--logged":_,"memori--login-drawer--signup":M}),title:(0,s.jsx)("span",{className:"memori--login-drawer--title",children:_?v("login.loggedDrawerTitle",{name:o.userName}):v(M?"login.signupDrawerTitle":"login.loginDrawerTitle")}),children:_?(0,s.jsxs)("div",{className:"memori--login-drawer--logged",children:[o.avatarURL&&(0,s.jsx)("figure",{className:"memori--login-drawer--avatar",children:(0,s.jsx)("img",{src:o.avatarURL,alt:o.userName})}),(0,s.jsx)(xf,{primary:!0,onClick:()=>{i()},children:v("login.logout")}),(0,s.jsx)(Bj,{user:o,loginToken:a,apiUrl:u,onUserUpdate:e=>r(e,a)})]}):(null===(m=null==k?void 0:k.token)||void 0===m?void 0:m.length)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{children:v("login.missingData")}),(0,s.jsx)("p",{children:v("login.missingDataHelper")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async e=>{var n,i,s;e.preventDefault();const a=e.currentTarget,l=null===(n=a.birthDate)||void 0===n?void 0:n.value,c=null===(i=a.tnCAndPPAccepted)||void 0===i?void 0:i.checked,u=null===(s=a.pAndCUAccepted)||void 0===s?void 0:s.checked;if(!(null==o?void 0:o.userID)||!(null==k?void 0:k.token))return;if(!l||!c)return void T(v("missingData"));let d={userID:o.userID,birthDate:(null==o?void 0:o.birthDate)||!k.birthDate?void 0:l,tnCAndPPAccepted:c||(null==o?void 0:o.tnCAndPPAccepted),tnCAndPPAcceptanceDate:c?(new Date).toISOString():void 0,pAndCUAccepted:u||(null==o?void 0:o.pAndCUAccepted),pAndCUAcceptanceDate:u?(new Date).toISOString():void 0};const{user:h,...p}=await w(k.token,o.userID,d);0!==p.resultCode?(console.error(p),t(Ju).error(v(Hv(p.resultCode))),T(p.resultMessage)):(t(Ju).success(v("success")),r(h||d,k.token))},children:[k.birthDate&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("label",{htmlFor:"#birthDate",children:[v("login.birthDate"),(0,s.jsx)("input",{id:"birthDate",name:"birthDate",type:"date",required:!0,autoComplete:"bday"})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.birthDateHelper")})})]}),(null==k?void 0:k.tnCAndPPAccepted)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[v("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${b}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:v("login.privacyAndCookiePolicy")})," ",v("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${b}/tos`,target:"_blank",rel:"noopener noreferrer",children:v("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",defaultChecked:null==o?void 0:o.pAndCUAccepted,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[v("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",v("login.optional"),")"]})})]})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.goToAccountToChangeYourPreferences")})}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.deepThoughtExplaination")})})]}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:C,children:v("login.save")})]})]}):(null==R?void 0:R.flowID)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:v("login.mustChangePassword")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async e=>{var n,i,o,s,a;e.preventDefault();const c=e.currentTarget,u=null!==(n=c.tenant.value)&&void 0!==n?n:l.id,d=null!==(i=c.flowID.value)&&void 0!==i?i:null==R?void 0:R.flowID,h=null!==(o=c.eMail.value)&&void 0!==o?o:null==R?void 0:R.eMail,p=null!==(s=c.userName.value)&&void 0!==s?s:null==R?void 0:R.userName,f=null!==(a=c.password.value)&&void 0!==a?a:null==R?void 0:R.password,m=c.newPassword.value;if(!(null==m?void 0:m.length)||!z)return void T(v("login.passwordFormatError"));A(!0);const g={tenant:u,flowID:d,eMail:h,userName:p,password:f,newPassword:m};try{const{user:e,token:n,...i}=await x(g);0!==i.resultCode?(console.error(i),t(Ju).error(v(Hv(i.resultCode))),T(i.resultMessage)):e&&n&&(t(Ju).success(v("success")),r(e||g,n))}catch(e){let n=e;console.error("[LOGIN/CHANGE PWD]",n),n.message&&(t(Ju).error(n.message),T(n.message))}finally{A(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"tenant",value:null!==(g=R.tenant)&&void 0!==g?g:null==l?void 0:l.id}),(0,s.jsx)("input",{type:"hidden",name:"flowID",value:R.flowID}),(0,s.jsx)("input",{type:"hidden",name:"eMail",value:R.eMail}),(0,s.jsx)("input",{type:"hidden",name:"userName",value:R.userName}),(0,s.jsx)("input",{type:"hidden",name:"password",value:R.password}),(0,s.jsxs)("label",{htmlFor:"#newPassword",children:[v("login.password"),(0,s.jsx)("input",{id:"newPassword",name:"newPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:v("login.password")||"Password",onChange:e=>L(e.target.value),"aria-invalid":!z})]}),!z&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:v("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[v("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:v("login.confirmPassword")||"Password",onChange:e=>B(e.target.value),"aria-invalid":!!(null==N?void 0:N.length)&&!!(null==D?void 0:D.length)&&N!==D})]}),!!(null==N?void 0:N.length)&&!!(null==D?void 0:D.length)&&N!==D&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:v("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:j,id:"password-strength-meter"}),(0,s.jsx)("small",{children:v("login.pwd"+(F?"Strong":z?"Acceptable":"Weak"))}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:C,children:v("confirm")})]})]}):M?(0,s.jsx)(Lj,{tenant:l,apiUrl:u,onLogin:r,goToLogin:()=>I(!1),__TEST__waitingForOtp:p}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:e=>{e.preventDefault();const n=e.currentTarget,i=n.userNameOrEmail.value,o=n.password.value,s=em.test(i),a=s?{tenant:null==l?void 0:l.id,eMail:i,password:o}:{tenant:null==l?void 0:l.id,userName:i,password:o};A(!0),T(null),x(a).then((e=>{var n,a,c,u,d;-14===e.resultCode?P({tenant:l.id,eMail:s?i:void 0,userName:s?void 0:i,password:o,flowID:e.flowID||(null===(n=e.user)||void 0===n?void 0:n.flowID)}):0!==e.resultCode?(console.error(e),t(Ju).error(v(Hv(e.resultCode))),T(e.resultMessage)):e.user&&e.token&&((null===(a=e.user)||void 0===a?void 0:a.tnCAndPPAccepted)&&(null===(c=e.user)||void 0===c?void 0:c.birthDate)?r(e.user,e.token):O({token:e.token,birthDate:!(null===(u=e.user)||void 0===u?void 0:u.birthDate),tnCAndPPAccepted:!(null===(d=e.user)||void 0===d?void 0:d.tnCAndPPAccepted)}))})).catch((e=>{console.error("[LOGIN]",e),e.message&&(t(Ju).error(e.message),T(e.message))})).finally((()=>{A(!1)}))},children:[(0,s.jsxs)("label",{htmlFor:"#userNameOrEmail",children:[v("login.userNameOrEmail"),(0,s.jsx)("input",{id:"userNameOrEmail",name:"userNameOrEmail",required:!0,autoComplete:"email",placeholder:"Username/email"})]}),(0,s.jsxs)("label",{htmlFor:"#password",children:["Password",(0,s.jsx)("input",{id:"password",name:"password",type:"password",required:!0,autoComplete:"password",placeholder:"Password"})]}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:C,children:v("login.login")}),(null==l?void 0:l.disableRegistration)?l.adminEmail?(0,s.jsxs)("div",{className:"memori--login-drawer--signup",children:[(0,s.jsx)("p",{children:v("login.registrationDisabled")}),(0,s.jsxs)("p",{children:[v("login.contactAdmin"),":"," ",(0,s.jsx)("a",{href:`mailto:${l.adminEmail}`,children:l.adminEmail})]})]}):null:(0,s.jsxs)("p",{className:"memori--login-drawer--signup",children:[v("login.newUserSignUp")," ",(0,s.jsx)(xf,{outlined:!0,onClick:()=>I(!0),children:v("login.signUp")})]})]}),E&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:E})]})})};var Fj=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,ChangeMode:d,changeModeProps:h,sessionId:p,hasUserActivatedSpeak:f,showInstruct:m=!1,loading:g=!1,poweredBy:v})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(Sf,{spinning:g,children:[m&&d&&h&&(0,s.jsx)(d,{...h}),e&&t&&(0,s.jsx)(e,{...t}),(0,s.jsxs)("div",{className:"memori--grid",children:[(0,s.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[n&&r&&(0,s.jsx)(n,{...r}),(0,s.jsx)("div",{id:"extension"})]}),(0,s.jsx)("div",{className:"memori--grid-column memori--grid-column-right",children:p&&f&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null}),v]})]})]});var Uj=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,ChangeMode:d,changeModeProps:h,sessionId:p,hasUserActivatedSpeak:f,showInstruct:m=!1,loading:g=!1,poweredBy:v})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(Sf,{spinning:g,className:"memori-totem-layout",children:[v,m&&d&&h&&(0,s.jsx)(d,{...h}),(0,s.jsx)("div",{className:"memori-totem-layout--header",children:e&&t&&(0,s.jsx)(e,{...t})}),(0,s.jsx)("div",{className:"memori-totem-layout--avatar",children:n&&r&&(0,s.jsx)(n,{...r})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-totem-layout--controls",children:p&&f&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null})]})]});var jj=({Header:e,headerProps:t,Chat:n,chatProps:r,StartPanel:i,startPanelProps:o,integrationStyle:a,integrationBackground:l,ChangeMode:c,changeModeProps:u,sessionId:d,hasUserActivatedSpeak:h,showInstruct:p=!1,loading:f=!1,poweredBy:m})=>(0,s.jsxs)(s.Fragment,{children:[a,l,(0,s.jsxs)(Sf,{spinning:f,className:"memori-chat-layout",children:[m,p&&c&&u&&(0,s.jsx)(c,{...u}),(0,s.jsx)("div",{className:"memori-chat-layout--header",children:e&&t&&(0,s.jsx)(e,{...t})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-chat-layout--controls",children:d&&h&&n&&r?(0,s.jsx)(n,{...r}):o?(0,s.jsx)(i,{...o}):null})]})]});c=o("85Hg2"),c=o("85Hg2");var Hj=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:u,ChangeMode:d,changeModeProps:h,sessionId:p,hasUserActivatedSpeak:f,showInstruct:m=!1,loading:g=!1,poweredBy:v})=>{var y,b;const{t:S}=xe(),[x,w]=(0,c.useState)(!0),[_,C]=(0,c.useState)(),A=(0,c.useMemo)((()=>null==o?void 0:o.stopAudio),[null==o?void 0:o.stopAudio]),E=e=>{w(e),C(e?void 0:(new Date).toISOString());try{null==A||A()}catch(e){console.log(e)}};return(0,s.jsx)("div",{className:"memori-website_assistant--"+(x?"collapsed":"expanded"),children:x?(0,s.jsx)("div",{className:"memori-website_assistant--trigger",children:(0,s.jsx)(xf,{className:"memori-website_assistant--trigger-button",ghost:!0,shape:"circle",onClick:()=>E(!1),title:S("expand")||"Expand",children:(0,s.jsx)(HF,{avatar:null==r?void 0:r.memori.avatarURL})})}):(0,s.jsxs)(s.Fragment,{children:[u,(0,s.jsxs)(Sf,{spinning:g,className:"memori-website_assistant-layout",children:[v,(0,s.jsx)("div",{className:"memori-website_assistant--close-button-wrapper",children:(0,s.jsx)(xf,{className:"memori-website_assistant--close-button",primary:!0,shape:"circle",onClick:()=>E(!0),icon:(0,s.jsx)(wf,{}),title:S("close")||"Close"})}),m&&d&&h&&(0,s.jsx)(d,{...h}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--header",children:e&&t&&(0,s.jsx)(e,{...t,showSettings:!1,showReload:!1})}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--avatar",children:n&&r&&(0,c.createElement)(n,{...r,integrationConfig:r.integrationConfig?{...r.integrationConfig,avatarURL:(null===(y=r.integrationConfig)||void 0===y?void 0:y.avatarURL)?`${null===(b=r.integrationConfig)||void 0===b?void 0:b.avatarURL.split("#")[0]}#${_}`:void 0}:{},key:_})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--controls",children:p&&f&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null})]})]})})};const{deleteSession:Gj,getStatistics:Vj,initSession:Wj}=Y(),qj=new Map([[0,"🆕"],[10,"🐹"],[20,"🐇"],[30,"🐰"],[40,"💡"],[50,"🏆"],[60,"🏅"],[70,"🥉"],[80,"🥈"],[90,"🥇"],[100,"🔥"],[110,"🎓"],[120,"🤖"],[130,"👾"],[150,"🌍"],[180,"💜"],[200,"💙"],[250,"🧡"],[300,"💚"],[350,"💛"],[400,"💖"],[450,"💝"],[500,"🖤"],[550,"❤️"],[600,"🧠"]]),Kj=e=>{const t=Array.from(qj.keys()).filter((t=>t<=e));if(t.length>0){const e=t[t.length-1];return qj.get(e)}return""},Jj=e=>{if("🆕"===e)return{points:10,badge:"🐹"};let t,n,r=!1;for(const[i,o]of qj){if(r){t=i,n=o;break}o===e&&(r=!0)}return n&&t?{points:t,badge:n}:void 0},Qj=e=>{let t=0;for(const[n,r]of qj)if(r===e){t=n;break}return t},Yj=e=>{const t=Math.round(e),n=Kj(t);return{points:t,badge:n,pointsForCurrentBadge:Qj(n),nextBadge:Jj(n)}},Zj=(e,t=!0,n=!1,r,i=!1,o=!1)=>{const s=new CustomEvent("MemoriTextEntered",{detail:{text:e,waitForPrevious:t,hidden:n,typingText:r,useLoaderTextAsMsg:i,hasBatchQueued:o}});document.dispatchEvent(s);window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak"))}),300)};let Xj,$j,eH,tH,nH,rH;window.getMemoriState=e=>{var t,n,r,i,o;let s=e?document.querySelector(`.memori-widget[data-memori-integration="${e}"]`)||(null===(n=null===(t=document.querySelector("memori-client"))||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector(".memori-widget[data-memori-integration]")):document.querySelector(".memori-widget")||(null===(i=null===(r=document.querySelector("memori-client"))||void 0===r?void 0:r.shadowRoot)||void 0===i?void 0:i.querySelector(".memori-widget"));if(!s)return null;let a=null===(o=s.dataset)||void 0===o?void 0:o.memoriEngineState;return a?JSON.parse(a):null},window.typeMessage=Zj,window.typeMessageHidden=(e,t=!0,n,r=!1,i=!1)=>Zj(e,t,!0,n,r,i),window.typeBatchMessages=e=>{function t(){var e,t,n,r;null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e||e.setAttribute("disabled","");const i="opacity: 0.5; touch-action: none; pointer-events: none;";null===(t=document.querySelector("textarea.memori-chat-textarea--input"))||void 0===t||t.setAttribute("style",i),null===(n=document.querySelector("button.memori-chat-inputs--send"))||void 0===n||n.setAttribute("style",i),null===(r=document.querySelector("button.memori-chat-inputs--mic"))||void 0===r||r.setAttribute("style",i)}function n(){var e,t,n,r;null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e||e.removeAttribute("disabled"),null===(t=document.querySelector("textarea.memori-chat-textarea--input"))||void 0===t||t.removeAttribute("style"),null===(n=document.querySelector("button.memori-chat-inputs--send"))||void 0===n||n.removeAttribute("style"),null===(r=document.querySelector("button.memori-chat-inputs--mic"))||void 0===r||r.removeAttribute("style")}function r(){var e;return!!(null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e?void 0:e.hasAttribute("disabled"))}const i=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent),o=function*(){yield*e}();t();const s=()=>{const e=o.next(),a=e.value;if(a){r()||t();let o=a.waitForPrevious;i&&(o=!1),Zj(a.message,o,a.hidden,a.typingText,a.useLoaderTextAsMsg,!e.done),i&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak")),n()}),3e3)}else r()&&n();if(e.done)return document.removeEventListener("MemoriEndSpeak",s),void(r()&&n())};document.addEventListener("MemoriEndSpeak",s),s()};let iH,oH=!1,sH=!1;var aH=({memori:e,memoriConfigs:n,memoriLang:r,multilingual:i,integration:o,layout:a="DEFAULT",customLayout:l,showInstruct:u=!1,showShare:d,preview:h=!1,embed:p=!1,showInputs:f=!0,showDates:m=!1,showContextPerLine:g=!1,showSettings:v=!0,showTypingText:y=!1,showClear:b=!1,showLogin:S=!1,showOnlyLastMessages:x,height:w="100vh",secret:_,baseUrl:C="https://aisuru.com",apiUrl:A="https://backend.memori.ai",initialContextVars:E,initialQuestion:T,ogImage:M,sessionID:I,tenant:R,personification:P,authToken:k,AZURE_COGNITIVE_SERVICES_TTS_KEY:O,defaultSpeakerActive:N=!0,onStateChange:L,additionalInfo:D,additionalSettings:B,customMediaRenderer:z,userAvatar:F})=>{var U,j,H,G,V,W,q,K,J,Q,Z,X,$,ee,te,ne,re,ie,oe,se,ae,le,ce,ue;const{t:de,i18n:he}=xe(),[pe,fe]=(0,c.useState)(!1);(0,c.useEffect)((()=>{fe(!0)}),[]);const me=Y(A),{initSession:ge,postTextEnteredEvent:ve,postPlaceChangedEvent:ye,postDateChangedEvent:be,postTimeoutEvent:Se,postTagChangedEvent:we,getSession:_e,getContentQualityIndexes:Ce,getExpertReferences:Ae}=me,[Ee,Te]=(0,c.useState)(!1),[Me,Ie]=(0,c.useState)(null!==(U=null==D?void 0:D.loginToken)&&void 0!==U?U:k),[Re,Pe]=(0,c.useState)({avatarURL:"string"==typeof F?F:void 0});(0,c.useEffect)((()=>{Me&&!(null==Re?void 0:Re.userID)&&S&&me.backend.getCurrentUser(Me).then((({user:e,resultCode:t})=>{e&&0===t?(Pe(e),Aj("loginToken",Me)):Ej("loginToken")}))}),[Me,null==Re?void 0:Re.userID]);const[ke,Oe]=(0,c.useState)(!1),[Ne,Le]=(0,c.useState)(!1),[De,Be]=(0,c.useState)(!1),ze=(null===(G=null===(H=null===(j=e.culture)||void 0===j?void 0:j.split("-"))||void 0===H?void 0:H[0])||void 0===G?void 0:G.toUpperCase())||(null===(K=null===(q=null===(W=null===(V=null==n?void 0:n.find((t=>t.memoriConfigID===e.memoriConfigurationID)))||void 0===V?void 0:V.culture)||void 0===W?void 0:W.split("-"))||void 0===q?void 0:q[0])||void 0===K?void 0:K.toUpperCase()),Fe=(null==o?void 0:o.customData)?JSON.parse(o.customData):null,Ue=void 0!==i?i:!!(null==Fe?void 0:Fe.multilanguage),je=null==Fe?void 0:Fe.forcedTimeout,[He,Ge]=(0,c.useState)(null!==(X=null!==(Z=null!==(Q=null!==(J=null!=r?r:null==Fe?void 0:Fe.lang)&&void 0!==J?J:ze)&&void 0!==Q?Q:null==Fe?void 0:Fe.uiLang)&&void 0!==Z?Z:he.language)&&void 0!==X?X:"IT"),[Ve,We]=(0,c.useState)(!1),[qe,Ke]=(0,c.useState)(!1),[Je,Qe]=(0,c.useState)(),Ye=a||(null==Fe?void 0:Fe.layout)||"DEFAULT",[Ze,Xe]=(0,c.useState)(!1),[$e,et]=(0,c.useState)(!1),[tt,nt]=(0,c.useState)(!1),[rt,it]=(0,c.useState)(!1),[ot,st]=(0,c.useState)(!1),[at,lt]=(0,c.useState)(!1),[ct,ut]=(0,c.useState)(!N),[dt,ht]=(0,c.useState)(!1),[pt,ft]=(0,c.useState)(2),[mt,gt]=(0,c.useState)(!1),[vt,yt]=(0,c.useState)("center"),[bt,St]=(0,c.useState)(!1);(0,c.useEffect)((()=>{gt(!!eH),sH=!!eH}),[eH]),(0,c.useEffect)((()=>{let e="bottom",t=Cj("microphoneMode","HOLD_TO_TALK");window.innerWidth<=768?(e="bottom",t="HOLD_TO_TALK"):e=window.matchMedia("(orientation: portrait)").matches||window.innerHeight>window.innerWidth?"center":"bottom",ut(Cj("muteSpeaker",!N)),oH=Cj("muteSpeaker",!N),ht("CONTINUOUS"===t),ft(Cj("continuousSpeechTimeout",2)),yt(Cj("controlsPosition",e)),St(Cj("hideEmissions",!1)),(null==D?void 0:D.loginToken)||k||(Ie(Cj("loginToken",void 0)),iH=Cj("loginToken",void 0))}),[]);const[xt,wt]=(0,c.useState)(_),[_t,Ct]=(0,c.useState)(),[At,Et]=(0,c.useState)(null),[Tt,Mt]=(0,c.useState)(),It=async(e,t)=>{var n;const r=null!=t?t:Vt;if(e&&r){const{currentState:t,...i}=await ye({sessionId:r,placeName:e.placeName,latitude:e.latitude,longitude:e.longitude,uncertaintyKm:null!==(n=e.uncertainty)&&void 0!==n?n:0});t&&0===i.resultCode&&Kt((e=>{var n;return{...e,...t,hints:(null===(n=t.hints)||void 0===n?void 0:n.length)?t.hints:null==e?void 0:e.hints}}))}};(0,c.useEffect)((()=>{const e=Cj("position",void 0);e&&Mt(e)}),[]);const[Rt,Pt]=(0,c.useState)(""),[kt,Ot]=(0,c.useState)(!1),[Nt,Lt]=(0,c.useState)([]),Dt=e=>{Lt((t=>{var n,r;return[...t,{...e,media:null!==(r=null===(n=e.media)||void 0===n?void 0:n.filter((e=>{var t;return!("text/javascript"===e.mimeType&&(null===(t=e.properties)||void 0===t?void 0:t.executable))})))&&void 0!==r?r:[]}]}))},Bt=async(n,r,i,o=!0,s,a=!1,l,c=!1,u=!1)=>{var d,h,p,f;const m=i||Vt||(null===(d=window.getMemoriState())||void 0===d?void 0:d.sessionID);if(!m||!(null==n?void 0:n.length))return;a||Dt({text:n,translatedText:s,fromUser:!0,media:null!=r?r:[],initial:Vt?!!i&&i!==Vt:!!i}),Ke(!0),Qe(l);let g=n,v=!1;if(o&&!Ee&&Ue&&He.toUpperCase()!==ze.toUpperCase()){g=(await dS(n,ze,He,C)).text}const{currentState:y,...b}=await ve({sessionId:m,text:g});if(0===b.resultCode&&y){const n=c&&l?l:null!==(h=y.emission)&&void 0!==h?h:null==qt?void 0:qt.emission;if("X4"===y.state&&e.giverTag){const{currentState:r,...i}=await we(m,e.giverTag);0===i.resultCode?(Jt(r),n&&(Dt({text:n,emitter:r.emitter,media:r.media,fromUser:!1,questionAnswered:g,contextVars:r.contextVars,date:r.currentDate,placeName:r.currentPlaceName,placeLatitude:r.currentLatitude,placeLongitude:r.currentLongitude,placeUncertaintyKm:r.currentUncertaintyKm,tag:r.currentTag,memoryTags:r.memoryTags}),hn(n))):(console.error(b,i),t(Ju).error(de(Hv(i.resultCode))),v=!0)}else if("X2d"===y.state&&e.giverTag){const{currentState:r,...i}=await ve({sessionId:m,text:Math.random().toString().substring(2,8)});if(0===i.resultCode){const{currentState:r,...i}=await we(m,e.giverTag);0===i.resultCode?(Jt(r),n&&(Dt({text:n,emitter:r.emitter,media:r.media,fromUser:!1,questionAnswered:g,contextVars:r.contextVars,date:r.currentDate,placeName:r.currentPlaceName,placeLatitude:r.currentLatitude,placeLongitude:r.currentLongitude,placeUncertaintyKm:r.currentUncertaintyKm,tag:r.currentTag,memoryTags:r.memoryTags}),hn(n))):(console.error(b,i),t(Ju).error(de(Hv(i.resultCode))),v=!0)}else console.error(b,i),t(Ju).error(de(Hv(i.resultCode))),v=!0}else He.toLowerCase()!==ze.toLowerCase()&&n&&!Ee&&Ue?zt(y,He,g).then((e=>{e.emission&&hn(e.emission)})):(Jt({...y,emission:n}),n&&(Dt({text:n,emitter:y.emitter,media:y.media,fromUser:!1,questionAnswered:g,generatedByAI:!!y.completion,contextVars:y.contextVars,date:y.currentDate,placeName:y.currentPlaceName,placeLatitude:y.currentLatitude,placeLongitude:y.currentLongitude,placeUncertaintyKm:y.currentUncertaintyKm,tag:y.currentTag,memoryTags:y.memoryTags}),hn(n)))}else 404===b.resultCode&&(Lt((e=>[...e.slice(0,e.length-1)])),Yt(!1,xt||e.secretToken,_t,Ee&&e.giverTag?e.giverTag:void 0,Ee&&e.giverPIN?e.giverPIN:void 0,{PATHNAME:window.location.pathname,ROUTE:(null===(f=null===(p=window.location.pathname)||void 0===p?void 0:p.split("/"))||void 0===f?void 0:f.pop())||"",...E||{}},T).then((e=>{console.info("session timeout"),(null==e?void 0:e.sessionID)&&setTimeout((()=>{Bt(n,r,null==e?void 0:e.sessionID)}),500)})));u||(Qe(void 0),Ke(!1))},zt=async(e,t,n)=>{var r,i,o;const s=null!==(r=e.emission)&&void 0!==r?r:null==qt?void 0:qt.emission;let a={...e},l=null;if(s&&!Ee&&ze.toUpperCase()!==t.toUpperCase()&&Ue){const r=await dS(s,t,ze,C);if(e.hints&&e.hints.length>0){const n=await Promise.all((null!==(i=e.hints)&&void 0!==i?i:[]).map((async e=>{var n;const r=await dS(e,t,ze,C);return{text:null!==(n=null==r?void 0:r.text)&&void 0!==n?n:e,originalText:e}})));a={...e,emission:r.text,translatedHints:n}}else a={...e,emission:r.text,hints:null!==(o=e.hints)&&void 0!==o?o:"G1"===e.state?null==qt?void 0:qt.hints:[]};r.text.length>0&&(l={text:r.text,emitter:e.emitter,media:e.media,fromUser:!1,questionAnswered:n,generatedByAI:!!e.completion,contextVars:e.contextVars,date:e.currentDate,placeName:e.currentPlaceName,placeLatitude:e.currentLatitude,placeLongitude:e.currentLongitude,placeUncertaintyKm:e.currentUncertaintyKm,tag:e.currentTag,memoryTags:e.memoryTags})}else a={...e,emission:s},s&&(l={text:s,emitter:e.emitter,media:e.media,fromUser:!1,questionAnswered:n,contextVars:e.contextVars,date:e.currentDate,placeName:e.currentPlaceName,placeLatitude:e.currentLatitude,placeLongitude:e.currentLongitude,placeUncertaintyKm:e.currentUncertaintyKm,tag:e.currentTag,memoryTags:e.memoryTags});return Jt(a),l&&Dt(l),a},Ft=void 0!==e.ageRestriction?e.ageRestriction:e.nsfw?18:e.enableCompletions?14:0,[Ut,jt]=(0,c.useState)(),[Ht,Gt]=(0,c.useState)(!1),[Vt,Wt]=(0,c.useState)(I),[qt,Kt]=(0,c.useState)(),Jt=e=>{var t;Kt(e),L&&L(e);const n=null===(t=null==e?void 0:e.media)||void 0===t?void 0:t.filter((e=>{var t;return"text/javascript"===e.mimeType&&!!(null===(t=e.properties)||void 0===t?void 0:t.executable)}));null==n||n.forEach((e=>{try{setTimeout((()=>{var t;console.log("snippet",e),new Function(null!==(t=e.content)&&void 0!==t?t:"")(),setTimeout((()=>{var e,t,n;null===(e=document.querySelector(".memori-chat--content"))||void 0===e||e.scrollTo(0,null!==(n=null===(t=document.querySelector(".memori-chat--content"))||void 0===t?void 0:t.scrollHeight)&&void 0!==n?n:0)}),400)}),1e3)}catch(e){console.error(e)}}))},Qt=async n=>{var r,i,o,s,a;let l=Cj("birthDate",void 0);if(Ut||l||!Ft)if("PUBLIC"===e.privacyType||e.secretToken||xt||_t){We(!0);try{if(!e.giverTag&&(null===(r=e.receivedInvitations)||void 0===r?void 0:r.length)){let t=e.receivedInvitations.find((e=>"GIVER"===e.type&&"ACCEPTED"===e.state));t&&(e.giverTag=t.tag,e.giverPIN=t.pin)}let l;try{l=window.location.href}catch(e){console.error(e)}const c=await ge({...n,tag:null!==(i=n.tag)&&void 0!==i?i:null==P?void 0:P.tag,pin:null!==(o=n.pin)&&void 0!==o?o:null==P?void 0:P.pin,additionalInfo:{...D||{},loginToken:null!==(a=null!==(s=null!=iH?iH:Me)&&void 0!==s?s:null==D?void 0:D.loginToken)&&void 0!==a?a:k,language:ln(He),referral:l}});if((null==c?void 0:c.sessionID)&&(null==c?void 0:c.currentState)&&0===c.resultCode)return Wt(c.sessionID),Tt&&It(Tt,c.sessionID),We(!1),{dialogState:c.currentState,sessionID:c.sessionID};(null==c?void 0:c.resultMessage.startsWith("This Memori is aged restricted"))?(console.error(c),t(Ju).error(de("underageTwinSession",{age:Ft})),Be(!0)):403===(null==c?void 0:c.resultCode)?(wt(void 0),Et("password")):(console.error(c),t(Ju).error(de(Hv(null==c?void 0:c.resultCode))),Be(!0))}catch(e){console.error(e),new Error("Error fetching session")}}else Et("password");else Gt(!0)},Yt=async(n=!1,r,i,o,s,a,l,c)=>{var u,d,h,p,f;We(!0);try{let m,g=Cj("birthDate",void 0);if(!c&&!g&&Ft)return void Gt(!0);if(!("PUBLIC"===e.privacyType||r||e.secretToken||xt||i||_t))return void Et("password");try{m=window.location.href}catch(e){console.error(e)}const{sessionID:v,currentState:y,...b}=await ge({memoriID:null!==(u=e.engineMemoriID)&&void 0!==u?u:"",password:r||xt||e.secretToken,recoveryTokens:i||_t,tag:o,pin:s,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:(null===(h=null===(d=window.location.pathname)||void 0===d?void 0:d.split("/"))||void 0===h?void 0:h.pop())||"",...a||{}},initialQuestion:l,birthDate:c||g||void 0,additionalInfo:{...D||{},loginToken:null!==(f=null!==(p=null!=iH?iH:Me)&&void 0!==p?p:null==D?void 0:D.loginToken)&&void 0!==f?f:k,language:ln(He),referral:m}});if(v&&y&&0===b.resultCode)return Wt(v),n&&(Jt(y),y.emission&&(Nt.length<=1?Lt([{text:y.emission,emitter:y.emitter,media:y.media,fromUser:!1,initial:!0,contextVars:y.contextVars,date:y.currentDate,placeName:y.currentPlaceName,placeLatitude:y.currentLatitude,placeLongitude:y.currentLongitude,placeUncertaintyKm:y.currentUncertaintyKm,tag:y.currentTag,memoryTags:y.memoryTags}]):Dt({text:y.emission,emitter:y.emitter,media:y.media,fromUser:!1,initial:!0,contextVars:y.contextVars,date:y.currentDate,placeName:y.currentPlaceName,placeLatitude:y.currentLatitude,placeLongitude:y.currentLongitude,placeUncertaintyKm:y.currentUncertaintyKm,tag:y.currentTag,memoryTags:y.memoryTags}))),Tt&&It(Tt,v),e.needsDateTime&&Xt({sessionID:v,state:y}),We(!1),{dialogState:y,sessionID:v};(null==b?void 0:b.resultMessage.startsWith("This Memori is aged restricted"))?(console.error(b),t(Ju).error(de("underageTwinSession",{age:Ft})),Be(!0)):403===(null==b?void 0:b.resultCode)?(wt(void 0),Et("password")):(console.error(b),t(Ju).error(de(Hv(b.resultCode))),Be(!0))}catch(e){console.error(e)}return We(!1),null},Zt=async(t,n,r,i)=>{var o,s,a,l,c;if(!t||!n)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState:t,resultCode:u}=await we(n,null!=r?r:Wv);if(0===u){let d=0;if(r!==Wv&&i&&("X1a"===t.state||"X1b"===t.state)){const{resultCode:e}=await ve({sessionId:n,text:null!=i?i:""});d=e}if(0===d){const{currentState:e,...t}=await _e(n);if(0===t.resultCode&&e)return{currentState:e,sessionId:n,...t}}else if([400,401,403,404,500].includes(u)){console.warn("[APPCONTEXT/CHANGETAG]",u);let t,n=Cj("birthDate",void 0);try{t=window.location.href}catch(e){console.error(e)}Qt({memoriID:null!==(o=e.engineMemoriID)&&void 0!==o?o:"",password:_||xt||e.secretToken,tag:e.giverTag,pin:e.giverPIN,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:(null===(a=null===(s=window.location.pathname)||void 0===s?void 0:s.split("/"))||void 0===a?void 0:a.pop())||"",...E||{}},initialQuestion:T,birthDate:Ut||n||void 0,additionalInfo:{...D||{},loginToken:null!==(c=null!==(l=null!=iH?iH:Me)&&void 0!==l?l:null==D?void 0:D.loginToken)&&void 0!==c?c:k,language:ln(He),referral:t}})}else if(t)return{currentState:t,sessionId:n,resultCode:u}}}catch(e){let t=e;return console.error("[APPCONTEXT/CHANGETAG]",t),Promise.reject(t)}return null};(0,c.useEffect)((()=>()=>{qt&&(null==qt?void 0:qt.currentTag)===e.giverTag||(async()=>{Vt&&e.giverTag&&e.giverPIN&&(Lt([]),await Zt(e.engineMemoriID,Vt,e.giverTag,e.giverPIN))})()}),[]);const Xt=(0,c.useCallback)((async({sessionID:t,date:n,state:r})=>{var i;const o=null!=t?t:Vt,s=null!=r?r:qt;if(!o||!e.needsDateTime||(null===(i=null==s?void 0:s.hints)||void 0===i?void 0:i.length))return;const a=(n?_s.DateTime.fromISO(n):_s.DateTime.now()).toUTC().toFormat("yyyy/MM/dd HH:mm:ss ZZ").split(":").slice(0,-1).join(":"),{currentState:l,...c}=await be(o,a);0===c.resultCode&&l&&Kt((e=>{var t;return{...e,...l,hints:(null===(t=l.hints)||void 0===t?void 0:t.length)?l.hints:null==e?void 0:e.hints}}))}),[qt,e.needsDateTime,Vt]);(0,c.useEffect)((()=>{if(Vt&&e.needsDateTime){Xt({sessionID:Vt,state:qt});let e=setInterval((()=>{Xt({sessionID:Vt})}),6e4);return()=>{clearInterval(e)}}}),[e.needsDateTime,Vt]);const[$t,en]=(0,c.useState)(),tn=(0,c.useRef)(),nn=()=>{$t&&(clearTimeout($t),en(void 0)),(null==tn?void 0:tn.current)&&(clearTimeout(tn.current),tn.current=void 0)},rn=()=>{nn(),mt||Rt.length||qe||kt||sn()},on=async()=>{var e;if(!Ze||mt||Rt.length||qe||kt)rn();else if(Vt&&Ze&&(null==qt?void 0:qt.acceptsTimeout)){const{currentState:t,...n}=await Se(Vt);if(0===n.resultCode&&t){const n=t.emission;if(!Ee&&Ue&&He!==(null==he?void 0:he.language)&&n&&n.length>0)zt({...t,emission:n},He).then((e=>{e.emission&&hn(e.emission)}));else{if(!(n&&n.length>0))return void rn();Dt({text:n,emitter:t.emitter,media:t.media,fromUser:!1,generatedByAI:!!t.completion,contextVars:t.contextVars,date:t.currentDate,placeName:t.currentPlaceName,placeLatitude:t.currentLatitude,placeLongitude:t.currentLongitude,placeUncertaintyKm:t.currentUncertaintyKm,tag:t.currentTag,memoryTags:t.memoryTags}),hn(n),Jt({...t,hints:null!==(e=t.hints)&&void 0!==e?e:"G1"===t.state?null==qt?void 0:qt.hints:[]})}}}},sn=()=>{let e=null==qt?void 0:qt.timeout;if(!e){let t=40,n=25;if(e=Math.floor(Math.random()*(t-n))+n,null==qt?void 0:qt.emission){e+=qt.emission.length/26.5}}if(je&&(e=je,null==qt?void 0:qt.emission)){e+=qt.emission.length/26.5}let t=setTimeout(on,1e3*e);en(t),tn.current=t};(0,c.useEffect)((()=>{(Rt.length||mt||qe)&&nn(),Vt&&!Rt.length&&rn()}),[null==qt?void 0:qt.acceptsTimeout,null==qt?void 0:qt.timeout,null==qt?void 0:qt.state,mt,Vt,Nt,Rt,qe,Ze]),(0,c.useEffect)((()=>()=>{Xe(!1),Le(!1),nn(),tn.current=void 0}),[]);const an=(0,c.useCallback)((t=>{var n,r,i,o;let s="",a=(null!==(o=null!==(i=null!=t?t:null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])&&void 0!==i?i:he.language)&&void 0!==o?o:"IT").toUpperCase(),l=e.voiceType;if(e.enableBoardOfExperts&&(null==qt?void 0:qt.emitter)){null==Vn||Vn.find((e=>e.name===(null==qt?void 0:qt.emitter)))}switch(a){case"IT":s=""+("MALE"===l?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":s=""+("MALE"===l?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":s=""+("MALE"===l?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":s=""+("MALE"===l?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":s=""+("MALE"===l?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":s=""+("MALE"===l?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":s=""+("MALE"===l?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":s=""+("MALE"===l?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;case"PL":s=""+("MALE"===l?"pl-PL-MarekNeural":"pl-PL-AgnieszkaNeural");break;case"FI":s=""+("MALE"===l?"fi-FI-HarriNeural":"fi-FI-SelmaNeural");break;case"EL":s=""+("MALE"===l?"el-GR-NestorasNeural":"el-GR-AthinaNeural");break;default:s=""+("MALE"===l?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return s}),[e.voiceType,e.enableBoardOfExperts,null==qt?void 0:qt.emitter,he.language,e.culture]),ln=t=>{var n,r;let i="";switch((t||(null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])||he.language||"IT").toUpperCase()){case"IT":default:i="it-IT";break;case"DE":i="de-DE";break;case"EN":i="en-GB";break;case"ES":i="es-ES";break;case"FR":i="fr-FR";break;case"PT":i="pt-PT";break;case"UK":i="uk-UK";break;case"RU":i="ru-RU";break;case"PL":i="pl-PL";break;case"FI":i="fi-FI";break;case"EL":i="el-GR"}return i},[cn,un]=(0,c.useState)();(0,c.useEffect)((()=>{(async()=>{try{const e=await fetch(`${C||"https://aisuru.com"}/api/lexiconmap`);return await e.json()}catch(e){console.error(e)}})().then((e=>{un(e)}))}),[]);const dn=()=>{const e=new CustomEvent("MemoriEndSpeak");document.dispatchEvent(e)},hn=e=>{if(!O||h)return void dn();if(wn(),h)return;if(ct||oH)return sH=!1,Ke(!1),dn(),void(dt&&bn());tH&&tH.pause();let t=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome"),n=/iPad|iPhone|iPod/.test(navigator.userAgent);if("interrupted"===nH.state)return void nH.resume().then((()=>hn(e)));if("closed"===nH.state){nH=new Qo;let e=nH.createBuffer(1,1e4,22050),t=nH.createBufferSource();t.buffer=e,t.connect(nH.destination)}else if("suspended"===nH.state){pn(),nH=new Qo;let e=nH.createBuffer(1,1e4,22050),t=nH.createBufferSource();t.buffer=e,t.connect(nH.destination)}if(!eH){n||(tH=new bs.SpeakerAudioDestination);let e=bs.AudioConfig.fromSpeakerOutput(tH);eH=new bs.SpeechSynthesizer($j,e)}const r=nH.createBufferSource();r.addEventListener("ended",(()=>{gt(!1),sH=!1})),tH.onAudioEnd=()=>{gt(!1),sH=!1,r.disconnect(),dn(),Tn()},eH.speakSsmlAsync(`<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" xml:lang="${ln(He)}"><voice name="${an(He)}"><s>${((e,t)=>{var n;if(!cn)return e;const r={...null!==(n=cn.common)&&void 0!==n?n:{},...(null==R?void 0:R.id)&&cn[R.id]?cn[R.id]:{}},i=Object.keys(r).map((e=>{var n;return{word:e,phoneme:null!==(n=r[e][t.toLowerCase()])&&void 0!==n?n:r[e].default,caseSensitive:r[e].caseSensitive}}));return i.reduce(((e,{word:t,phoneme:n,caseSensitive:r})=>e.replace(new RegExp(`\\b${t}\\b`,r?"g":"gi"),`<phoneme alphabet="ipa" ph="${n}">${t}</phoneme>`)),e)})((e=>{const t=document.createElement("textarea");return t.textContent=e,t.innerHTML})(im(e)),He.toLowerCase())}</s></voice></speak>`,(i=>{if(i){gt(!0),sH=!0;try{nH.decodeAudioData(i.audioData,(function(e){r.buffer=e,r.connect(nH.destination),(Nt.length<1||t&&n)&&r.start(0)})),nH.onstatechange=()=>{"suspended"===nH.state||"closed"===nH.state?(r.disconnect(),gt(!1),sH=!1):"interrupted"===nH.state&&nH.resume()},nH.resume(),eH&&(eH.close(),eH=null)}catch(t){console.error("speak error: ",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),gt(!1),sH=!1,eH&&(eH.close(),eH=null),dn()}}else nH.resume(),gt(!1),sH=!1,dn()}),(t=>{console.error("speak:",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),gt(!1),sH=!1,dn()})),Ke(!1)},pn=()=>{gt(!1),sH=!1;try{eH&&(eH.close(),eH=null),"closed"!==nH.state&&nH.close(),tH&&(tH.pause(),tH.close())}catch(e){console.error("stopAudio error: ",e)}};(0,c.useEffect)((()=>{let e=document.querySelector("#chat-fieldset textarea");e&&e.focus()}),[null==qt?void 0:qt.emission]);const[fn,mn]=(0,c.useState)(""),gn=()=>mn(""),[vn,yn]=(0,c.useState)(null),bn=()=>{let e=setTimeout((async()=>{_n();const e=rm(fn);e.length>0&&kt?(Bt(e),gn(),Pt("")):kt&&rn()}),1e3*pt);yn(e)},Sn=()=>{vn&&(clearTimeout(vn),yn(null))};(0,c.useEffect)((()=>{Sn(),dt&&bn(),rn()}),[fn]);const xn=()=>{if(O){_n(),mn(""),gn();try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(e){et(!0),$j||($j=bs.SpeechConfig.fromSubscription(O,"eastus"),$j.speechRecognitionLanguage=ln(He),$j.speechSynthesisLanguage=ln(He),$j.speechSynthesisVoiceName=an(He));const t=bs.AudioConfig.fromDefaultMicrophoneInput();Xj=new bs.SpeechRecognizer($j,t),Ot(!0),Xj.recognized=(e,t)=>{if(t.result.text)if(t.result.reason===bs.ResultReason.RecognizedSpeech){let e=t.result.text;if(mn(e||""),(null==e?void 0:e.length)>0){const t=rm(e);t.length>0&&Pt((e=>`${e} ${t}`))}}else t.result.reason===bs.ResultReason.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},Xj.canceled=(e,t)=>{t.reason===bs.CancellationReason.Error&&(console.debug(`"CANCELED: ErrorCode=${t.errorCode}`),console.debug(`"CANCELED: ErrorDetails=${t.errorDetails}`),console.debug("CANCELED: Did you set the speech resource key and region values?")),wn()},Xj.sessionStopped=(e,t)=>{wn()},gn(),Xj.startContinuousRecognitionAsync()})).catch(console.error)}catch(e){console.error(e)}}},wn=()=>{Xj&&(Xj.stopContinuousRecognitionAsync(),Xj.close(),Xj=null),Ot(!1)},_n=()=>{et(!1),wn(),Sn()},Cn=()=>{try{_n(),nn(),Le(!1),tn.current=void 0,pn()}catch(e){console.log("Error: resetUIEffects",e)}};(0,c.useEffect)((()=>()=>{Cn()}),[]),(0,c.useEffect)((()=>(document.addEventListener("MemoriResetUIEffects",Cn),()=>{document.removeEventListener("MemoriResetUIEffects",Cn)})),[]),(0,c.useEffect)((()=>{"Z0"===(null==qt?void 0:qt.state)&&_n()}),[null==qt?void 0:qt.state]);const[An,En]=(0,c.useState)(!1),Tn=(0,c.useCallback)((e=>{mt&&eH&&(eH.close(),eH=null),!dt||!$e&&An||(En(!0),xn())}),[dt,$e]);(0,c.useEffect)((()=>{Nt.length>1&&!mt&&dt&&($e||!An)?xn():mt&&kt&&wn()}),[mt]),(0,c.useEffect)((()=>{kt&&(_n(),gn(),Pt(""),xn())}),[ze]);const[Mn,In]=(0,c.useState)("keypress");(0,c.useEffect)((()=>{const e=Cj("sendOnEnter","keypress");window.innerWidth<=768?In("click"):In(e)}),[]),(0,c.useEffect)((()=>{Aj("sendOnEnter",Mn)}),[Mn]);const[Rn,Pn]=(0,c.useState)(),kn=null==Fe?void 0:Fe.globalBackground,On=kn?`url(${kn})`:null,Nn=o?{"--memori-chat-bubble-bg":"#fff",...Fe&&!u?{"--memori-text-color":null!==($=Fe.textColor)&&void 0!==$?$:"#000"}:{},...(null==Fe?void 0:Fe.buttonBgColor)?{"--memori-button-bg":Fe.buttonBgColor,"--memori-primary":Fe.buttonBgColor}:{},...(null==Fe?void 0:Fe.buttonTextColor)?{"--memori-button-text":Fe.buttonTextColor}:{},...(null==Fe?void 0:Fe.blurBackground)?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...(null==Fe?void 0:Fe.innerBgColor)?{"--memori-inner-bg":`rgba(${"dark"===Fe.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(ee=Fe.innerBgAlpha)&&void 0!==ee?ee:.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===Fe.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(te=null==Fe?void 0:Fe.innerBgAlpha)&&void 0!==te?te:.4})`}:{"--memori-inner-content-pad":"0px"}}:{},Ln=`\n ${h?"#preview,":"WEBSITE_ASSISTANT"===Ye?"":":root,"} .memori-widget, .memori-drawer, .memori-modal {\n ${Object.entries(Nn).map((([e,t])=>`${e}: ${t};`)).join("\n")}\n }\n `,Dn=void 0===(null==Fe?void 0:Fe.showAIicon)||(null==Fe?void 0:Fe.showAIicon),Bn=void 0===(null==Fe?void 0:Fe.showWhyThisAnswer)||(null==Fe?void 0:Fe.showWhyThisAnswer),[zn,Fn]=(0,c.useState)(!1);(0,c.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===Ye||"FULLPAGE"!==Ye)&&Fn(!0)}),[]);const[Un,jn]=(0,c.useState)();(0,c.useEffect)((()=>{e.engineMemoriID&&(async e=>{let t,n;try{const{contentQualityIndex:r,answerQualityIndex:i,unansweredQuestions:o,...s}=await Ce(e);0===s.resultCode&&(t=r,n=o)}catch(e){let t=e;console.error("[APPCONTEXT/QUERYGAMIFICATIONPOINTS]",t)}return{points:null!=t?t:0,unansweredQuestions:null!=n?n:0}})(e.engineMemoriID).then((e=>{jn(Yj(e.points))})).catch(console.error)}),[e.engineMemoriID]),(0,c.useEffect)((()=>{if(null==Fe?void 0:Fe.seoTitle){let e=document.createElement("meta");e.setAttribute("property","og:title"),e.setAttribute("content",Fe.seoTitle),document.head.append(e)}if(null==Fe?void 0:Fe.seoDescription){let e=document.createElement("meta");e.setAttribute("property","og:description"),e.setAttribute("content",Fe.seoDescription),document.head.append(e)}if(null==Fe?void 0:Fe.seoUrl){let e=document.createElement("meta");e.setAttribute("property","og:url"),e.setAttribute("content",Fe.seoUrl),document.head.append(e)}let t=M||e.avatarURL;if((null==Fe?void 0:Fe.seoImageShowAvatar)&&t){let e=document.createElement("meta");e.setAttribute("property","og:image"),e.setAttribute("content",t),document.head.append(e)}}),[Fe,e.avatarURL,M]);const Hn=(0,c.useCallback)((e=>{const{text:t,waitForPrevious:n,hidden:r,typingText:i,useLoaderTextAsMsg:o,hasBatchQueued:s}=e.detail;t&&(n&&!oH&&(sH||qe)?setTimeout((()=>{Hn(e)}),1e3):(wn(),pn(),Bt(t,void 0,void 0,void 0,void 0,r,i,o,s)))}),[Vt,mt,qe,He]);(0,c.useEffect)((()=>(document.addEventListener("MemoriTextEntered",Hn),()=>{document.removeEventListener("MemoriTextEntered",Hn)})),[Vt,He]);const Gn=(0,c.useCallback)((async t=>{var n,r,i,o,s,a,l,c,u,d,h,p,f,m,g,v,y,b;const S=(null==t?void 0:t.sessionID)||Vt,x=(null==t?void 0:t.dialogState)||qt;Le(!0);let w=document.getElementById("memori-audio"),C=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome");w&&C&&(w.muted=!1,w.play().catch((e=>{console.error("error playing intro audio",e)})));let A=Cj("birthDate",void 0),M=Ut||A||void 0;if(S||!Ft||M){if(!S&&"PUBLIC"!==e.privacyType&&!e.secretToken&&!xt&&!_t||!S&&De)return Et("password"),void Le(!1);if(!S){Le(!1),Be(!1);const t=await Qt({memoriID:e.engineMemoriID,password:_||xt||e.secretToken,tag:null==P?void 0:P.tag,pin:null==P?void 0:P.pin,initialContextVars:{PATHNAME:null===(n=window.location.pathname)||void 0===n?void 0:n.toUpperCase(),ROUTE:(null===(o=null===(i=null===(r=window.location.pathname)||void 0===r?void 0:r.split("/"))||void 0===i?void 0:i.pop())||void 0===o?void 0:o.toUpperCase())||"",...E||{}},initialQuestion:T,birthDate:M,additionalInfo:{...D||{},loginToken:null!==(a=null!==(s=null!=iH?iH:Me)&&void 0!==s?s:null==D?void 0:D.loginToken)&&void 0!==a?a:k,language:ln(He)}});return void((null==t?void 0:t.dialogState)?(Lt([]),zt(t.dialogState,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}))):await Gn(t||void 0))}if(I){const{currentState:t,...n}=await _e(S);if(0!==n.resultCode||!t)return console.debug("session expired, opening new session"),Be(!0),Wt(void 0),Le(!1),void await Gn();if(Lt([]),Tt&&It(Tt,S),e.needsDateTime&&Xt({sessionID:S,state:t}),Ee&&e.giverTag&&(null==qt?void 0:qt.currentTag)!==e.giverTag)try{console.debug("change tag #0"),await Zt(e.engineMemoriID,S,"-");const t=await Zt(e.engineMemoriID,S,e.giverTag,e.giverPIN);if(!t||0!==t.resultCode)throw console.error("session #1",t),new Error("No session");zt(t.currentState,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}))}catch(t){console.error("session #2",t),Yt(!0,null==e?void 0:e.secretToken,void 0,null==e?void 0:e.giverTag,null==e?void 0:e.giverPIN,{PATHNAME:null===(l=window.location.pathname)||void 0===l?void 0:l.toUpperCase(),ROUTE:(null===(d=null===(u=null===(c=window.location.pathname)||void 0===c?void 0:c.split("/"))||void 0===u?void 0:u.pop())||void 0===d?void 0:d.toUpperCase())||"",...E||{}},T,M).then((()=>{Xe(!0)}))}else if(!Ee&&P&&(null==qt?void 0:qt.currentTag)!==P.tag)try{console.debug("change tag #3"),await Zt(e.engineMemoriID,S,"-");const t=await Zt(e.engineMemoriID,S,P.tag,P.pin);if(!t||0!==t.resultCode)throw console.error("session #4",t),new Error("No session");zt(t.currentState,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}))}catch(t){console.error("session #5",t),Yt(!0,null==e?void 0:e.secretToken,void 0,P.tag,P.pin,{PATHNAME:null===(h=window.location.pathname)||void 0===h?void 0:h.toUpperCase(),ROUTE:(null===(m=null===(f=null===(p=window.location.pathname)||void 0===p?void 0:p.split("/"))||void 0===f?void 0:f.pop())||void 0===m?void 0:m.toUpperCase())||"",...E||{}},T,M).then((()=>{Xe(!0)}))}else if(Ee||P||(null==qt?void 0:qt.currentTag)===Wv)zt(t,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}));else try{console.debug("change tag #6"),await Zt(e.engineMemoriID,S,"-");const t=await Zt(e.engineMemoriID,S,Wv);if(!t||0!==t.resultCode)throw console.error("session #7",t),new Error("No session");zt(t.currentState,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}))}catch(t){console.error("session #8",t),Yt(!0,null==e?void 0:e.secretToken,void 0,void 0,void 0,{PATHNAME:null===(g=window.location.pathname)||void 0===g?void 0:g.toUpperCase(),ROUTE:(null===(b=null===(y=null===(v=window.location.pathname)||void 0===v?void 0:v.split("/"))||void 0===y?void 0:y.pop())||void 0===b?void 0:b.toUpperCase())||"",...E||{}},T,M).then((()=>{Xe(!0)}))}Tt&&It(Tt,S),e.needsDateTime&&Xt({sessionID:S,state:t})}else Lt([]),zt(x,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}))}else Gt(!0),Le(!1)}),[xt,e,_t,Ut,Vt,He,Tt]);(0,c.useEffect)((()=>{const t=document.querySelector(`memori-client[memoriname="${e.name}"]`)||document.querySelector(`memori-client[memoriid="${e.memoriID}"]`)||document.querySelector("memori-client");if(!t)return;const n=new MutationObserver(((e,t)=>{var n,r,i;for(const t of e)"attributes"===t.type&&"authtoken"===(null===(n=t.attributeName)||void 0===n?void 0:n.toLowerCase())&&("MEMORI-CLIENT"===t.target.nodeName?(Ie(t.target.getAttribute("authtoken")||void 0),iH=t.target.getAttribute("authtoken")||void 0):(Ie((null===(i=null===(r=t.target)||void 0===r?void 0:r.parentElement)||void 0===i?void 0:i.getAttribute("authtoken"))||void 0),iH=t.target.getAttribute("authtoken")||void 0))}));return n.observe(t,{attributes:!0,childList:!1,subtree:!1}),()=>{n.disconnect()}}),[]);const[Vn,Wn]=(0,c.useState)(),qn=(0,c.useCallback)((async()=>{if(Vt&&(null==e?void 0:e.enableBoardOfExperts))try{const{experts:e,count:t,...n}=await Ae(Vt);0===n.resultCode?Wn(e):console.warn("Error fetching experts",n)}catch(e){console.warn(e)}}),[Vt,null==e?void 0:e.enableBoardOfExperts]);(0,c.useEffect)((()=>{qn()}),[Vt,qn]);const Kn=void 0===x?"TOTEM"!==a&&"WEBSITE_ASSISTANT"!==a:!x,Jn={memori:e,tenant:R,history:Nt,showShare:null===(ne=null!=d?d:null==Fe?void 0:Fe.showShare)||void 0===ne||ne,position:Tt,setShowPositionDrawer:nt,setShowSettingsDrawer:it,setShowKnownFactsDrawer:st,setShowExpertsDrawer:lt,showSpeaker:!!O,speakerMuted:ct||oH,setSpeakerMuted:e=>{if(oH=!!e,ut(e),Aj("muteSpeaker",!!e),e)pn();else{nH=new Qo;let e=nH.createBuffer(1,1e4,22050),t=nH.createBufferSource();t.buffer=e,t.connect(nH.destination)}},showSettings:v,hasUserActivatedSpeak:Ze,showReload:"TOTEM"===Ye,showClear:b,clearHistory:()=>Lt((e=>e.slice(-1))),showLogin:S,setShowLoginDrawer:Oe,loginToken:Me,user:Re,sessionID:Vt},Qn={memori:e,integration:o,integrationConfig:Fe,tenant:R,instruct:Ee,avatar3dVisible:zn,setAvatar3dVisible:Fn,hasUserActivatedSpeak:Ze,isPlayingAudio:mt&&!ct,loading:!!qe,baseUrl:C,apiUrl:A},Yn={memori:e,tenant:R,gamificationLevel:Un,language:ze,userLang:He,setUserLang:Ge,baseUrl:C,apiUrl:A,position:Tt,openPositionDrawer:()=>nt(!0),integrationConfig:Fe,instruct:Ee,sessionId:Vt,clickedStart:Ne,onClickStart:Gn,initializeTTS:()=>{if(!O)return;$j=bs.SpeechConfig.fromSubscription(O,"eastus"),$j.speechSynthesisLanguage=ln(He),$j.speechSynthesisVoiceName=an(He),$j.speechRecognitionLanguage=ln(He),Zf()&&($j.speechSynthesisOutputFormat=bs.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3),nH=new Qo;let e=nH.createBuffer(1,1e4,22050),t=nH.createBufferSource();t.buffer=e,t.connect(nH.destination),tH=new bs.SpeakerAudioDestination;let n=bs.AudioConfig.fromSpeakerOutput(tH);eH=new bs.SpeechSynthesizer($j,n)},isUserLoggedIn:!!Me&&!!(null==Re?void 0:Re.userID),showLogin:S,setShowLoginDrawer:Oe,user:Re},Zn={memori:e,sessionID:Vt||"",tenant:R,translateTo:Ue&&He.toUpperCase()!==(null===(ae=null!==(se=null!==(oe=null===(ie=null===(re=e.culture)||void 0===re?void 0:re.split("-"))||void 0===ie?void 0:ie[0])&&void 0!==oe?oe:he.language)&&void 0!==se?se:"IT")||void 0===ae?void 0:ae.toUpperCase())?He:void 0,baseUrl:C,apiUrl:A,layout:a,memoriTyping:qe,typingText:Je,showTypingText:y,history:Kn?Nt:Nt.slice(-2),authToken:null!==(ce=null!==(le=null!=Me?Me:iH)&&void 0!==le?le:null==D?void 0:D.loginToken)&&void 0!==ce?ce:k,dialogState:qt,setDialogState:Jt,pushMessage:Dt,simulateUserPrompt:(e,t)=>{wn(),pn(),Bt(e,void 0,void 0,!1,t)},showDates:m,showContextPerLine:g,showAIicon:Dn,showWhyThisAnswer:Bn,client:me,selectReceiverTag:async n=>{var r;if(Vt)try{const{currentState:i,...o}=await we(Vt,n);if(0===o.resultCode)if(Dt({text:n,fromUser:!0}),"X4"===i.state&&e.giverTag){const{currentState:n,...r}=await me.postTagChangedEvent(Vt,e.giverTag);0===r.resultCode?(Jt(n),n.emission&&Dt({text:n.emission,emitter:n.emitter,media:n.media,fromUser:!1,contextVars:n.contextVars,date:n.currentDate,placeName:n.currentPlaceName,placeLatitude:n.currentLatitude,placeLongitude:n.currentLongitude,placeUncertaintyKm:n.currentUncertaintyKm,tag:n.currentTag,memoryTags:n.memoryTags})):(console.error(r),t(Ju).error(de(Hv(r.resultCode))))}else Jt(i),i.emission&&Dt({text:i.emission,emitter:i.emitter,media:i.media,fromUser:!1,contextVars:i.contextVars,date:i.currentDate,placeName:i.currentPlaceName,placeLatitude:i.currentLatitude,placeLongitude:i.currentLongitude,placeUncertaintyKm:i.currentUncertaintyKm,tag:i.currentTag,memoryTags:i.memoryTags});else console.error(o,n,null===(r=null==qt?void 0:qt.knownTags)||void 0===r?void 0:r[n]),t(Ju).error(de(Hv(o.resultCode)))}catch(e){let n=e;console.error(n),t(Ju).error(n.message)}},preview:h,sendOnEnter:Mn,setSendOnEnter:In,microphoneMode:dt?"CONTINUOUS":"HOLD_TO_TALK",attachmentsMenuOpen:Rn,setAttachmentsMenuOpen:Pn,instruct:Ee,showInputs:f,showMicrophone:!!O,userMessage:Rt,onChangeUserMessage:e=>{if(!e||"\n"===e||""===e.trim())return Pt(""),void rn();Pt(e),nn()},sendMessage:e=>{pn(),wn(),Bt(e),Pt(""),gn()},stopListening:_n,startListening:xn,stopAudio:pn,resetTranscript:gn,listening:kt,isPlayingAudio:mt,customMediaRenderer:z,user:Re,userAvatar:F,experts:Vn},Xn=o&&On?(0,s.jsx)("div",{className:"memori--global-background",children:(0,s.jsx)("div",{className:"memori--global-background-image",style:{backgroundImage:On}})}):(0,s.jsx)("div",{className:"memori--global-background no-background-image"}),$n=o?(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:Ln}}):null,er={canInstruct:!!e.giverTag,instruct:!!Ee,onChangeMode:e=>{Te("instruct"===e),Xe(!1),Le(!1)}},tr=(0,s.jsx)(XU,{tenant:R,userLang:He,integrationID:null==o?void 0:o.integrationID,memoriHash:`${e.ownerTenantName}-${e.ownerUserName}-${e.name}`}),nr=l||("TOTEM"===Ye?Uj:"CHAT"===Ye?jj:"FULLPAGE"===Ye?Fj:"WEBSITE_ASSISTANT"===Ye?Hj:Fj);return(0,s.jsxs)("div",{className:t(ws)("memori","memori-widget",`memori-layout-${a.toLowerCase()}`,`memori-controls-${vt.toLowerCase()}`,`memori--avatar-${(null==Fe?void 0:Fe.avatar)||"default"}`,{"memori--preview":h,"memori--embed":p,"memori--with-integration":o,"memori--with-speechkey":!!O,"memori--active":Ze,"memori--hide-emissions":bt,"memori--has-active-session":!!Vt}),"data-memori-name":null==e?void 0:e.name,"data-memori-id":null==e?void 0:e.engineMemoriID,"data-memori-secondary-id":null==e?void 0:e.memoriID,"data-memori-session-id":Vt,"data-memori-integration":null==o?void 0:o.integrationID,"data-memori-engine-state":JSON.stringify({...qt,sessionID:Vt}),style:{height:w},children:[(0,s.jsx)(nr,{Header:ZU,headerProps:Jn,Avatar:qF,avatarProps:Qn,Chat:QS,chatProps:Zn,StartPanel:rx,startPanelProps:Yn,integrationStyle:$n,integrationBackground:Xn,ChangeMode:KF,changeModeProps:er,poweredBy:tr,sessionId:Vt,hasUserActivatedSpeak:Ze,showInstruct:u,loading:Ve}),(0,s.jsx)("audio",{id:"memori-audio",style:{display:"none"},src:"https://aisuru.com/intro.mp3"}),pe&&(0,s.jsx)(dv,{withModal:!0,pwdOrTokens:At,openModal:!!At,setPwdOrTokens:Et,showTokens:"SECRET"===e.privacyType,onFinish:async t=>{var n,r,i,o;t.password&&wt(t.password),t.password&&(rH=t.password),t.tokens&&Ct(t.tokens),Yt(!Vt,t.password,t.tokens,Ee?e.giverTag:null==P?void 0:P.tag,Ee?e.giverPIN:null==P?void 0:P.pin,{PATHNAME:null===(n=window.location.pathname)||void 0===n?void 0:n.toUpperCase(),ROUTE:(null===(o=null===(i=null===(r=window.location.pathname)||void 0===r?void 0:r.split("/"))||void 0===i?void 0:i.pop())||void 0===o?void 0:o.toUpperCase())||"",...E||{}},T,Ut).then((e=>{Et(null),Gn(e||void 0)})).catch((()=>{Et(null),Be(!0)}))},minimumNumberOfRecoveryTokens:null!==(ue=null==e?void 0:e.minimumNumberOfRecoveryTokens)&&void 0!==ue?ue:1}),pe&&(0,s.jsx)(Sj,{visible:Ht,minAge:Ft,onClose:t=>{var n,r,i,o;t?(jt(t),Aj("birthDate",t),Yt(!Vt,rH||xt||(null==e?void 0:e.secretToken),_t,Ee?e.giverTag:null==P?void 0:P.tag,Ee?e.giverPIN:null==P?void 0:P.pin,{PATHNAME:null===(n=window.location.pathname)||void 0===n?void 0:n.toUpperCase(),ROUTE:(null===(o=null===(i=null===(r=window.location.pathname)||void 0===r?void 0:r.split("/"))||void 0===i?void 0:i.pop())||void 0===o?void 0:o.toUpperCase())||"",...E||{}},T,t).then((e=>{Gt(!1),Et(null),Gn(e||void 0)})).catch((()=>{Gt(!1),Be(!0)}))):(Gt(!1),Le(!1))}}),rt&&(0,s.jsx)(Mj,{layout:Ye,open:!!rt,onClose:()=>it(!1),microphoneMode:dt?"CONTINUOUS":"HOLD_TO_TALK",continuousSpeechTimeout:pt,setMicrophoneMode:e=>ht("CONTINUOUS"===e),setContinuousSpeechTimeout:ft,controlsPosition:vt,setControlsPosition:yt,hideEmissions:bt,setHideEmissions:St,additionalSettings:B}),tt&&(0,s.jsx)(Hm,{memori:e,open:!!tt,venue:Tt,setVenue:e=>{Mt(e),It(e),e?Aj("position",JSON.stringify(e)):Ej("position")},onClose:e=>{e&&It(e),nt(!1)}}),ot&&Vt&&(0,s.jsx)(kj,{apiURL:A,memori:e,sessionID:Vt,visible:ot,closeDrawer:()=>st(!1)}),at&&!!Vn&&(0,s.jsx)(Oj,{apiUrl:A,baseUrl:C,tenant:R,experts:Vn,open:at,onClose:()=>lt(!1)}),ke&&(null==R?void 0:R.id)&&(0,s.jsx)(zj,{tenant:R,apiUrl:A,open:!!ke,user:Re,loginToken:Me,onClose:()=>Oe(!1),onLogin:(e,t)=>{Pe(e),Ie(t),iH=t,Oe(!1),Aj("loginToken",t)},onLogout:()=>{Me&&me.backend.userLogout(Me).then((()=>{Oe(!1),Pe(void 0),Ie(void 0),iH=void 0,Ej("loginToken")}))}})]})};const lH={id:"aisuru.com",theme:"aisuru",config:{name:"Memori",showNewUser:!1,requirePosition:!1}},cH=async(e,t)=>{const n=t?new URL(`${t.startsWith("http")?"":t.includes("localhost")?"http://":"https://"}${t}`).origin:"https://aisuru.com";try{const t=await fetch(`${n}/api/tenant/${e}`),{tenant:r}=await t.json();return r||{...lH,tenantID:e}}catch(t){return{...lH,tenantID:e}}};function uH(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dH(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,PF(r.key),r)}}function hH(e,t,n){return t&&dH(e.prototype,t),n&&dH(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function pH(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fH(e,t){return fH=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},fH(e,t)}function mH(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fH(e,t)}function gH(e,t){if(t&&("object"===IF(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return pH(e)}function vH(e){return vH=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vH(e)}function yH(e){if(Array.isArray(e))return e}function bH(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function SH(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xH(e,t){if(e){if("string"==typeof e)return SH(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?SH(e,t):void 0}}function wH(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _H(e){return yH(e)||bH(e)||xH(e)||wH()}function CH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function AH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CH(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var EH={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},TH=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};uH(this,e),this.init(t,n)}return hH(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||EH,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,r){return r&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,AH(AH({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}(),MH=new TH,IH=function(){function e(){uH(this,e),this.observers={}}return hH(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){var i=[].concat(this.observers[e]);i.forEach((function(e){e.apply(void 0,n)}))}if(this.observers["*"]){var o=[].concat(this.observers["*"]);o.forEach((function(t){t.apply(t,[e].concat(n))}))}}}]),e}();function RH(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function PH(e){return null==e?"":""+e}function kH(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e])}))}function OH(e,t,n){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var s=r(o.shift());!e[s]&&n&&(e[s]=new n),e=Object.prototype.hasOwnProperty.call(e,s)?e[s]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function NH(e,t,n){var r=OH(e,t,Object);r.obj[r.k]=n}function LH(e,t){var n=OH(e,t),r=n.obj,i=n.k;if(r)return r[i]}function DH(e,t,n){var r=LH(e,n);return void 0!==r?r:LH(t,n)}function BH(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):BH(e[r],t[r],n):e[r]=t[r]);return e}function zH(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var FH={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function UH(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return FH[e]})):e}var jH="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,HH=[" ",",","?","!",";"];function GH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function VH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?GH(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function WH(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=vH(e);if(t){var i=vH(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gH(this,n)}}function qH(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;o<r.length;++o){if(!i)return;if("string"==typeof i[r[o]]&&o+1<r.length)return;if(void 0===i[r[o]]){for(var s=2,a=r.slice(o,o+s).join(n),l=i[a];void 0===l&&r.length>o+s;)s++,l=i[a=r.slice(o,o+s).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(a)){if("string"==typeof l)return l;if(a&&"string"==typeof l[a])return l[a]}var c=r.slice(o+s).join(n);return c?qH(l,c,n):void 0}i=i[r[o]]}return i}}var KH=function(e){mH(n,e);var t=WH(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return uH(this,n),r=t.call(this),jH&&IH.call(pH(r)),r.data=e||{},r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),void 0===r.options.ignoreJSONStructure&&(r.options.ignoreJSONStructure=!0),r}return hH(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,s=[e,t];n&&"string"!=typeof n&&(s=s.concat(n)),n&&"string"==typeof n&&(s=s.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(s=e.split("."));var a=LH(this.data,s);return a||!o||"string"!=typeof n?a:qH(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var s=[e,t];n&&(s=s.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(s=e.split("."))[1]),this.addNamespaces(t),NH(this.data,s,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},s=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(s=e.split("."))[1]),this.addNamespaces(t);var a=LH(this.data,s)||{};r?BH(a,n,i):a=VH(VH({},a),n),NH(this.data,s,a),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?VH(VH({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(IH),JH={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))})),t}};function QH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function YH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?QH(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ZH(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=vH(e);if(t){var i=vH(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gH(this,n)}}var XH={},$H=function(e){mH(n,e);var t=ZH(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return uH(this,n),r=t.call(this),jH&&IH.call(pH(r)),kH(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,pH(r)),r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=MH.create("translator"),r}return hH(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,s=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=HH.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===r.length)return!0;var i=new RegExp("(".concat(r.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),o=!i.test(e);if(!o){var s=e.indexOf(n);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o}(e,n,r));if(o&&!s){var a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:i};var l=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(l[0])>-1)&&(i=l.shift()),e=l.join(r)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,r){var i=this;if("object"!==IF(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,s=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],t),l=a.key,c=a.namespaces,u=c[c.length-1],d=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(h){var p=t.nsSeparator||this.options.nsSeparator;return o?(f.res="".concat(u).concat(p).concat(l),f):"".concat(u).concat(p).concat(l)}return o?(f.res=l,f):l}var f=this.resolve(e,t),m=f&&f.res,g=f&&f.usedKey||l,v=f&&f.exactUsedKey||l,y=Object.prototype.toString.apply(m),b=["[object Number]","[object Function]","[object RegExp]"],S=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,x=!this.i18nFormat||this.i18nFormat.handleAsObject,w="string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m;if(x&&m&&w&&b.indexOf(y)<0&&("string"!=typeof S||"[object Array]"!==y)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var _=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,YH(YH({},t),{},{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return o?(f.res=_,f):_}if(s){var C="[object Array]"===y,A=C?[]:{},E=C?v:g;for(var T in m)if(Object.prototype.hasOwnProperty.call(m,T)){var M="".concat(E).concat(s).concat(T);A[T]=this.translate(M,YH(YH({},t),{joinArrays:!1,ns:c})),A[T]===M&&(A[T]=m[T])}m=A}}else if(x&&"string"==typeof S&&"[object Array]"===y)(m=m.join(S))&&(m=this.extendTranslation(m,e,t,r));else{var I=!1,R=!1,P=void 0!==t.count&&"string"!=typeof t.count,k=n.hasDefaultValue(t),O=P?this.pluralResolver.getSuffix(d,t.count,t):"",N=t["defaultValue".concat(O)]||t.defaultValue;!this.isValidLookup(m)&&k&&(I=!0,m=N),this.isValidLookup(m)||(R=!0,m=l);var L=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,D=L&&R?void 0:m,B=k&&N!==m&&this.options.updateMissing;if(R||I||B){if(this.logger.log(B?"updateKey":"missingKey",d,u,l,B?N:m),s){var z=this.resolve(l,YH(YH({},t),{},{keySeparator:!1}));z&&z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var F=[],U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&U&&U[0])for(var j=0;j<U.length;j++)F.push(U[j]);else"all"===this.options.saveMissingTo?F=this.languageUtils.toResolveHierarchy(t.lng||this.language):F.push(t.lng||this.language);var H=function(e,n,r){var o=k&&r!==m?r:D;i.options.missingKeyHandler?i.options.missingKeyHandler(e,u,n,o,B,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,u,n,o,B,t),i.emit("missingKey",e,u,n,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?F.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(n){H([e],l+n,t["defaultValue".concat(n)]||N)}))})):H(F,l,N))}m=this.extendTranslation(m,e,t,f,r),R&&m===l&&this.options.appendNamespaceToMissingKey&&(m="".concat(u,":").concat(l)),(R||I)&&this.options.parseMissingKeyHandler&&(m="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(u,":").concat(l):l,I?m:void 0):this.options.parseMissingKeyHandler(m))}return o?(f.res=m,f):m}},{key:"extendTranslation",value:function(e,t,n,r,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,YH(YH({},this.options.interpolation.defaultVariables),n),r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(YH(YH({},n),{interpolation:YH(YH({},this.options.interpolation),n.interpolation)}));var s,a="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){var l=e.match(this.interpolator.nestingRegexp);s=l&&l.length}var c=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(c=YH(YH({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,n.lng||this.language,n),a){var u=e.match(this.interpolator.nestingRegexp);s<(u&&u.length)&&(n.nest=!1)}!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return i&&i[0]===r[0]&&!n.context?(o.logger.warn("It seems you are nesting recursively key: ".concat(r[0]," in key: ").concat(t[0])),null):o.translate.apply(o,r.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var d=n.postProcess||this.options.postProcess,h="string"==typeof d?[d]:d;return null!=e&&h&&h.length&&!1!==n.applyPostProcessor&&(e=JH.handle(h,e,t,this.options&&this.options.postProcessPassResolved?YH({i18nResolved:r},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,r,i,o,s=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!s.isValidLookup(t)){var l=s.extractFromKey(e,a),c=l.key;n=c;var u=l.namespaces;s.options.fallbackNS&&(u=u.concat(s.options.fallbackNS));var d=void 0!==a.count&&"string"!=typeof a.count,h=d&&!a.ordinal&&0===a.count&&s.pluralResolver.shouldUseIntlApi(),p=void 0!==a.context&&("string"==typeof a.context||"number"==typeof a.context)&&""!==a.context,f=a.lngs?a.lngs:s.languageUtils.toResolveHierarchy(a.lng||s.language,a.fallbackLng);u.forEach((function(e){s.isValidLookup(t)||(o=e,!XH["".concat(f[0],"-").concat(e)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(o)&&(XH["".concat(f[0],"-").concat(e)]=!0,s.logger.warn('key "'.concat(n,'" for languages "').concat(f.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),f.forEach((function(n){if(!s.isValidLookup(t)){i=n;var o,l=[c];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(l,c,n,e,a);else{var u;d&&(u=s.pluralResolver.getSuffix(n,a.count,a));var f="".concat(s.options.pluralSeparator,"zero");if(d&&(l.push(c+u),h&&l.push(c+f)),p){var m="".concat(c).concat(s.options.contextSeparator).concat(a.context);l.push(m),d&&(l.push(m+u),h&&l.push(m+f))}}for(;o=l.pop();)s.isValidLookup(t)||(r=o,t=s.getResource(n,e,o,a))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}]),n}(IH);function eG(e){return e.charAt(0).toUpperCase()+e.slice(1)}var tG=function(){function e(t){uH(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=MH.create("languageUtils")}return hH(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=eG(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=eG(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=eG(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),r.forEach((function(e){i.indexOf(e)<0&&o(n.formatLanguageCode(e))})),i}}]),e}(),nG=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],rG={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},iG=["v1","v2","v3"],oG={zero:0,one:1,two:2,few:3,many:4,other:5};function sG(){var e={};return nG.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:rG[t.fc]}}))})),e}var aG=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};uH(this,e),this.languageUtils=t,this.options=n,this.logger=MH.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=sG()}return hH(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((function(e,t){return oG[e]-oG[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):r.numbers.map((function(r){return t.getSuffix(e,r,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var o=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!iG.includes(this.options.compatibilityJSON)}}]),e}();function lG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function cG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lG(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lG(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var uG=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};uH(this,e),this.logger=MH.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return hH(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:UH,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?zH(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?zH(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?zH(t.nestingPrefix):t.nestingPrefixEscaped||zH("$t("),this.nestingSuffix=t.nestingSuffix?zH(t.nestingSuffix):t.nestingSuffixEscaped||zH(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,s,a=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(e.indexOf(a.formatSeparator)<0){var i=DH(t,l,e);return a.alwaysFormat?a.format(i,void 0,n,cG(cG(cG({},r),t),{},{interpolationkey:e})):i}var o=e.split(a.formatSeparator),s=o.shift().trim(),c=o.join(a.formatSeparator).trim();return a.format(DH(t,l,s),c,n,cG(cG(cG({},r),t),{},{interpolationkey:s}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,h=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return a.escapeValue?c(a.escape(e)):c(e)}}].forEach((function(t){for(s=0;i=t.regex.exec(e);){var n=i[1].trim();if(void 0===(o=u(n)))if("function"==typeof d){var l=d(e,i,r);o="string"==typeof l?l:""}else if(r&&r.hasOwnProperty(n))o="";else{if(h){o=i[0];continue}a.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}else"string"==typeof o||a.useRawValueToEscape||(o=PH(o));var c=t.safeValue(o);if(e=e.replace(i[0],c),h?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++s>=a.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=cG({},o);function a(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),i="{".concat(r[1]);e=r[0];var o=(i=this.interpolate(i,s)).match(/'/g),a=i.match(/"/g);(o&&o.length%2==0&&!a||a.length%2!=0)&&(i=i.replace(/'/g,'"'));try{s=JSON.parse(i),t&&(s=cG(cG({},t),s))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(i)}return delete s.defaultValue,e}for(s.applyPostProcessor=!1,delete s.defaultValue;n=this.nestingRegexp.exec(e);){var l=[],c=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var u=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=u.shift(),l=u,c=!0}if((r=t(a.call(this,n[1].trim(),s),s))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=PH(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),c&&(r=l.reduce((function(e,t){return i.format(e,t,o.lng,cG(cG({},o),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function dG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function hG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dG(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dG(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pG(e){var t={};return function(n,r,i){var o=r+JSON.stringify(i),s=t[o];return s||(s=e(r,i),t[o]=s),s(n)}}var fG=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};uH(this,e),this.logger=MH.create("formatter"),this.options=t,this.formats={number:pG((function(e,t){var n=new Intl.NumberFormat(e,t);return function(e){return n.format(e)}})),currency:pG((function(e,t){var n=new Intl.NumberFormat(e,hG(hG({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:pG((function(e,t){var n=new Intl.DateTimeFormat(e,hG({},t));return function(e){return n.format(e)}})),relativetime:pG((function(e,t){var n=new Intl.RelativeTimeFormat(e,hG({},t));return function(e){return n.format(e,t.range||"day")}})),list:pG((function(e,t){var n=new Intl.ListFormat(e,hG({},t));return function(e){return n.format(e)}}))},this.init(t)}return hH(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=t.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=pG(t)}},{key:"format",value:function(e,t,n,r){var i=this,o=t.split(this.formatSeparator).reduce((function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);"currency"===t&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=_H(e.split(":")),r=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[r.trim()]||(n[r.trim()]=i),"false"===i&&(n[r.trim()]=!1),"true"===i&&(n[r.trim()]=!0),isNaN(i)||(n[r.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:n}}(t),s=o.formatName,a=o.formatOptions;if(i.formats[s]){var l=e;try{var c=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},u=c.locale||c.lng||r.locale||r.lng||n;l=i.formats[s](e,u,hG(hG(hG({},a),r),c))}catch(e){i.logger.warn(e)}return l}return i.logger.warn("there was no format function for ".concat(s)),e}),e);return o}}]),e}();function mG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function gG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mG(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mG(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vG(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=vH(e);if(t){var i=vH(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gH(this,n)}}var yG=function(e){mH(n,e);var t=vG(n);function n(e,r,i){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return uH(this,n),o=t.call(this),jH&&IH.call(pH(o)),o.backend=e,o.store=r,o.services=i,o.languageUtils=i.languageUtils,o.options=s,o.logger=MH.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=s.maxParallelReads||10,o.readingCalls=0,o.maxRetries=s.maxRetries>=0?s.maxRetries:5,o.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,s.backend,s),o}return hH(n,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},s={},a={},l={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var a="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[a]=2:i.state[a]<0||(1===i.state[a]?void 0===s[a]&&(s[a]=!0):(i.state[a]=1,r=!1,void 0===s[a]&&(s[a]=!0),void 0===o[a]&&(o[a]=!0),void 0===l[t]&&(l[t]=!0)))})),r||(a[e]=!0)})),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var s={};this.queue.forEach((function(n){var r,a,l,c,u,d;r=n.loaded,a=o,c=OH(r,[i],Object),u=c.obj,d=c.k,u[d]=u[d]||[],l&&(u[d]=u[d].concat(a)),l||u[d].push(a),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){s[e]||(s[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===s[e][t]&&(s[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",s),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;return e.length?this.readingCalls>=this.maxParallelReads?void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:i,wait:o,callback:s}):(this.readingCalls++,this.backend[n](e,t,(function(a,l){if(r.readingCalls--,r.waitingReads.length>0){var c=r.waitingReads.shift();r.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}a&&l&&i<r.maxRetries?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,s)}),o):s(a,l)}))):s(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(function(r,s){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&s&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),s),t.loaded(e,r,s)}))}},{key:"saveMissing",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,r,null,gG(gG({},o),{},{isUpdate:i})),e&&e[0]&&this.store.addResource(e[0],t,n,r))}}]),n}(IH);function bG(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===IF(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===IF(e[2])||"object"===IF(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function SG(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function xG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xG(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xG(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _G(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=vH(e);if(t){var i=vH(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gH(this,n)}}function CG(){}function AG(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var EG=function(e){mH(n,e);var t=_G(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(uH(this,n),e=t.call(this),jH&&IH.call(pH(e)),e.options=SG(r),e.services={},e.logger=MH,e.modules={external:[]},AG(pH(e)),i&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,i),gH(e,pH(e));setTimeout((function(){e.init(r,i)}),0)}return e}return hH(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var r=bG();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=wG(wG(wG({},r),this.options),SG(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=wG(wG({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var o;this.modules.logger?MH.init(i(this.modules.logger),this.options):MH.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=fG);var s=new tG(this.options);this.store=new KH(this.options.resources,this.options);var a=this.services;a.logger=MH,a.resourceStore=this.store,a.languageUtils=s,a.pluralResolver=new aG(s,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(a.formatter=i(o),a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new uG(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new yG(i(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.languageDetector&&(a.languageDetector=i(this.modules.languageDetector),a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=i(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new $H(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=CG),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var c=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];c.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}));var u=["addResource","addResources","addResourceBundle","removeResourceBundle"];u.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var d=RH(),h=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),d.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),d}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:CG,r=n,i="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return r();var o=[],s=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){o.indexOf(e)<0&&o.push(e)}))};if(i)s(i);else{var a=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);a.forEach((function(e){return s(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return s(e)})),this.services.backendConnector.load(o,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),r(e)}))}else r(null)}},{key:"reloadResources",value:function(e,t,n){var r=RH();return e||(e=this.languages),t||(t=this.options.ns),n||(n=CG),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&JH.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=RH();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(o){e||o||!n.services.languageDetector||(o=[]);var s="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);s&&(n.language||i(s),n.translator.language||n.translator.changeLanguage(s),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(s)),n.loadResources(s,(function(e){!function(e,o){o?(i(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,s)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,i=function e(t,i){var o;if("object"!==IF(i)){for(var s=arguments.length,a=new Array(s>2?s-2:0),l=2;l<s;l++)a[l-2]=arguments[l];o=r.options.overloadTranslationOptionHandler([t,i].concat(a))}else o=wG({},i);o.lng=o.lng||e.lng,o.lngs=o.lngs||e.lngs,o.ns=o.ns||e.ns,o.keyPrefix=o.keyPrefix||n||e.keyPrefix;var c=r.options.keySeparator||".",u=o.keyPrefix?"".concat(o.keyPrefix).concat(c).concat(t):t;return r.t(u,o)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=n,i}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var s=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var a=n.precheck(this,s);if(void 0!==a)return a}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!s(r,e)||i&&!s(o,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=RH();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=RH();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter((function(e){return r.indexOf(e)<0}));return i.length?(this.options.preload=r.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:CG,i=wG(wG(wG({},this.options),t),{isClone:!0}),o=new n(i);void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t));var s=["store","services","language"];return s.forEach((function(t){o[t]=e[t]})),o.services=wG({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new $H(o.services,o.options),o.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit.apply(o,[e].concat(n))})),o.init(i,r),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(IH);kF(EG,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new EG(e,t)}));var TG=EG.createInstance();TG.createInstance=EG.createInstance;var MG,IG=TG.createInstance;TG.init,TG.loadResources,TG.reloadResources,TG.use,TG.changeLanguage,TG.getFixedT,TG.t,TG.exists,TG.setDefaultNamespace,TG.hasLoadedNamespace,TG.loadNamespaces,TG.loadLanguages;MG=JSON.parse('{"yes":"Si","no":"No","confirm":"Conferma","apply":"Applica","cancel":"Annulla","show":"Mostra","hide":"Nascondi","send":"Invia","close":"Chiudi","edit":"Modifica","delete":"Elimina","loading":"Caricamento","expand":"Espandi","collapse":"Riduci","fullscreenEnter":"Passa a schermo intero","fullscreenExit":"Esci da schermo intero","center":"Centro","bottom":"In basso","hidden":"Nascosto","day":"Giorno","month":"Mese","year":"Anno","createdAt":"Data creazione","selected":"Selezionati","page":"pagina","actions":"Azioni","next":"Successivo","previous":"Precedente","copy":"Copia","copyToClipboard":"Copia negli appunti","showOriginalText":"Mostra originale","showTranslatedText":"Mostra traduzione","exactPosition":"Posizione esatta","uncertain":"Incertezza","question":"Domanda","nothingFound":"Nessun risultato","venue":"Luogo","searchVenue":"Cerca luogo...","memoriBlockedTitle":"Bloccato","memoriBlockedUntil":"Memori bloccato fino al {{date}}","memoriBlockedAnon":"Attualmente \\"{{name}}\\" non può rispondere, torna qui il {{date}}","memoriBlockedReasonExceedChats":"perchè ha superato la soglia mensile di chat ammesse.","memoriBlockedGiverHelper":"Puoi sempre gestirlo in qualità di amministratore, ma altri utenti non potranno interrogarlo.","generatedByAI":"Risposta generata da IA, può talvolta generare informazioni non corrette","whyThisAnswer":"Perché questa risposta?","whyThisAnswerHelper":"Questa risposta è stata generata automaticamente da un\'intelligenza artificiale sulla base di questi contenuti verificati.","completionsEnabled":"IA evoluta, può rispondere con risposte generate automaticamente che talvolta potrebbero contenere informazioni non corrette","completionProviderDown":"Questo Twin è integrato con una IA generativa di {{provider}}, ma al momento non è disponibile. Riprova più tardi.","completionProviderFallbackName":"un provider esterno","completionProviderCheckStatusPage":"Vedi pagina di stato","boardOfExperts":"Gruppo di esperti","birthDate":"Data di nascita","birthDateHelper":"Ti chiediamo la data di nascita esclusivamente per abilitare o disabilitare le funzionalità che hanno restrizioni in base all\'età","underage":"Devi avere almeno {{age}} anni per registrarti.","underageTwinSession":"Devi avere almeno {{age}} anni per interagire con questo Twin.","ageVerification":"Verifica dell\'età","ageVerificationText":"Per interagire con questo Twin, devi aver almeno {{minAge}} anni.","nsfw":"NSFW: Questo Twin contiene contenuti per adulti","deepThought":"Pensiero profondo","deepThoughtHelper":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme.","deepThoughtDisclaimerTitle":"Pensiero profondo abilitato","deepThoughtDisclaimer":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme.","deepThoughtPreDisclaimerUnlogged":"Accedi per abilitare Pensiero Profondo.","deepThoughtPreDisclaimerNotAllowed":"Pensiero Profondo è disabilitato poiché non hai acconsentito al suo utilizzo, puoi cambiare la tua scelta in qualsiasi momento nelle impostazioni del tuo account.","knownFacts":{"title":"Fatti noti","description":"Dettagli delle informazioni condivise tra te e {{memoriName}}","type":"Tipo","typeShortTerm":"Breve termine","typeLongTerm":"Lungo termine","typeHelper":"Tipi:\\n- Breve termine: questo fatto noto è sempre utilizzato durante le conversazioni\\n- Lungo termine: questo fatto noto è utilizzato durante le conversazioni solo se rilevante per la domanda corrente","text":"Testo","deleteSuccess":"Fatto noto eliminato","deleteConfirmTitle":"Elimina il fatto noto","deleteConfirmMessage":"Confermi di voler eliminare questo fatto noto?","deleteSelectedConfirmTitle":"Elimina i fatti noti selezionati","deleteSelectedConfirmMessage":"Confermi di voler eliminare i fatti noti selezionati?"},"auth":{"title":"Autenticazione","useRecoveryTokens":"Utilizza i token di recupero","tokens":"Token","addToken":"Aggiungi token","usePassword":"Utilizza la password","atLeast":"Almeno"},"widget":{"instruct":"Istruisci","test":"Prova","sound":"Audio","position":"Preferenze posizione","settings":"Impostazioni","share":"Condividi","sendOnKeypress":"Premi Invio per inviare","sendOnClick":"Clicca sul bottone di invio","boardOfExperts":"Gruppo di esperti","showExpertsInTheBoard":"Mostra gli esperti di questo gruppo","expertsInTheBoard":"Esperti di questo gruppo","goToIntegrationsToCustomizeAvatar":"Per personalizzare l\'avatar, vai a Condividimi e configura la pagina pubblica"},"write_and_speak":{"micButtonPopover":"Premi il pulsante per parlare","micButtonPopoverListening":"Premi il pulsante per smettere di parlare","pageInstructExplanation":"Per insegnarmi nuove cose clicca sul pulsante ISTRUISCIMI per cominciare","pageTryMeExplanation":"Per parlare con me clicca sul pulsante INIZIAMO per cominciare","instructButton":"ISTRUISCIMI","tryMeButton":"INIZIAMO","chatHistory":"Cronologia chat","exportChatHistory":"Esporta la cronologia chat","exportChatHistoryMessage":"Vuoi esportare la cronologia chat?","chatBotButtonText":"CLICCA QUI PER APRIRE LA CHAT","conversationStartedLabel":"Conversazione avvenuta il","settingsHeaderLabel":"Configura qui il memori se vuoi impostare una conversazione continua. Setta i secondi di silenzio prima dell\'invio.","continuousSpeechLabel":"Conversazione continua","holdToSpeak":"Tieni premuto per parlare","releaseToEndListening":"Rilascia per smettere di parlare","pressAndHoldToSpeak":"Premi e tieni premuto per parlare","microphoneMode":"Modalità microfono","hideEmissionsLabel":"Nascondi testo emesso dal Twin","secondsLabel":"Secondi","controlsPosition":"Posizione dei controlli","tryMeHeaderLabel":"PROVA","unknownPosition":"Posizione sconosciuta","fieldPlace":"Indica la posizione (es \'Milano\')","showMapLinkFor":"Visualizza sulla mappa la posizione","useMyPosition":"Usa la mia posizione","myPosition":"Posizione corrente","updatingPosition":"Aggiorno la posizione...","placeNotFound":"Luogo sconosciuto!","requirePositionHelp":"Per parlare con {{name}} devi decidere se fornire o meno la tua posizione. Questo perchè diverse risposte che potrà fornirti potrebbero dipendere da dove ti trovi.","dontWantToProvidePosition":"Non voglio fornire la mia posizione","attachmentsLabel":"Arricchisci il tuo messaggio","iWantToTalkToIn":"Voglio parlare con {{name}} in"},"media":{"title":"Titolo","editAttributes":"Modifica attributi media","uploadMimeTypeNotAllowed":"Il tipo di file non è permesso","uploadSizeLimitMessage":"Il file caricato è troppo grande (max {{size}}MB)","uploadWrongResolutionMessage":"La risoluzione deve essere {{width}}x{{height}} pixel","memoriNameAlreadyUsed":"Hai già un Twin con questo nome","uploadHelperImages":"Caricare un file con estensione png, jpg, jpeg o gif e con dimensione massima di {{size}}MB","uploadHelper":"Caricare un file di dimensione massima di {{size}}MB","uploadError":"Errore nel caricamento","square":"quadrato","scaleRatio":"Proporzioni","addMediaLabel":"Aggiungi media","insertThisMediaMsg":"Inserisci questi media","mediaUploadMessage":"Clicca per caricare un nuovo media","addLinkLabel":"Aggiungi un link","linkKey":"URL","linkValue":"Titolo link","insertThisLink":"Inserisci un link a {{url}} con titolo {{title}}"},"gamification":{"level":"Livello","points":"punti","memoriReachedLevel":"è diventato più evoluto ed ha raggiunto il livello","levelGoToStatistics":"{{memori}} è al livello {{level}} con {{points}} punti. Clicca per andare alle statistiche.","congratulationsNewLevel":"Congratulazioni, hai raggiunto un nuovo livello!","congratulationsNewLevelDescription":"Il tuo Memori è diventato più evoluto con {{points}} punti, guarda le","statistics":"statistiche"},"login":{"login":"Accedi","logout":"Esci","user":"Utente","loggedDrawerTitle":"Ciao, {{name}}!","loginDrawerTitle":"Accedi","signupDrawerTitle":"Registrati","newUserSignUp":"Sei un nuovo utente?","signUp":"Registrati!","alreadyHaveAnAccount":"Hai già un account?","backToLogin":"Torna al login","registrationDisabled":"La registrazione è disabilitata.","contactAdmin":"Contatta l\'amministratore per richiedere l\'accesso","userNameOrEmail":"Nome utente o email","email":"Email","emailFormatError":"Per favore, inserisci una mail valida","username":"Nome utente","usernameContainsReservedWord":"Il nome utente contiene una parola riservata, per favore cambia il nome utente","usernameFormatError":"Il nome utente deve essere lungo almeno 3 caratteri e può contenere solo lettere, numeri e _","otpCode":"Codice di verifica","resendVerificationCode":"Invia di nuovo","resentVerificationCode":"Codice di verifica inviato! Controlla la tua mail.","password":"Password","newPassword":"Nuova password","confirmPassword":"Conferma la password","currentPassword":"Password attuale","passwordMatchingError":"Le password non coincidono.","passwordFormatError":"La password deve essere lunga almeno 8 caratteri e contenere almeno un numero, una lettera maiuscola, una minuscola e un simbolo","pwdWeak":"Debole","pwdAcceptable":"Accettabile","pwdStrong":"Forte","mustChangePassword":"Devi cambiare la password","passwordChange":"Cambio password","emailChange":"Cambio email","avatarChange":"Cambio avatar","underage":"Devi avere almeno {{age}} anni per registrarti.","optional":"opzionale","birthDate":"Data di nascita","birthDateHelper":"Ti chiediamo la data di nascita esclusivamente per abilitare o disabilitare le funzionalità che hanno restrizioni in base all\'età","missingData":"Informazioni mancanti","missingDataHelper":"Sappiamo che questo è un po\' fastidioso, ma abbiamo bisogno di alcune informazioni in più per completare la tua registrazione.","goToAccountToChangeYourPreferences":"Puoi cambiare la tua scelta in qualsiasi momento dalla tua pagina Account.","deepThoughtExplaination":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme. Consenti all\'autore del twin di contattarti per offerte commerciali riguardanti prodotti su cui hai espresso interesse.","tnCAndPPAcceptedHelper":"Dall\'ultimo accesso, i T&C e l\'Informativa sulla privacy sono stati modificati. Si prega di accettarle, altrimenti non sarà possibile apportare modifiche ai propri gemelli. Puoi sempre cancellare il tuo account nella pagina del tuo profilo utente.","privacyLabel":"Ho letto e accettato l\'","privacyAndCookiePolicy":"informativa sui cookie e sulla privacy","and":"e","termsOfService":"i termini del servizio","pAndCUAccepted":"Accetto le condizioni di utilizzo relative a Pensiero Profondo","editAccount":"Modifica account","save":"Salva"},"success":"Operazione andata a buon fine","Error":"Errore","internal server error":"Ops, scusa... qualcosa è andato storto nel server","error":"Errore","error.loading":"Errore durante il caricamento dei contenuti.","error.notFound":"Ops, non abbiamo trovato ciò che cercavi.","error.generic":"Ops, qualcosa è andato storto.","error.serverNotResponding":"Stiamo facendo manutenzione o rilasciando aggiornamenti. Riprova più tardi.","error.unprocessableEntity":"Errore durante il salvataggio dei dati. Ricontrolla i dati inseriti.","error.goBackTo":"Prova a tornare alla","error.reloadPage":"Ricarica la pagina","error.tryAgain":"Riprova","error.unauthorized":"Non sei autorizzato a visualizzare questo contenuto.","errors":{"TENANT_NOT_FOUND":"Tenant non trovato","TENANT_REGISTRATION_DISABLED":"La registrazione su questa piattaforma è disabilitata","TENANT_MISSING_NAME":"Tenant: nome mancante","TENANT_MAX_USERS_REACHED":"Numero massimo di utenti raggiunto","TENANT_MAX_ADMINS_REACHED":"Numero massimo di utenti amministratori raggiunto","TENANT_ALREADY_EXISTS":"Tenant già esistente","TENANT_MISSING_DESCRIPTION":"Tenant: descrizione mancante","TENANT_CANT_SET_COMPLETION_PROVIDER":"Tenant: non abilitato a gestire il provider di completamento","USER_NOT_CONFIRMED":"Utente ancora non confermato","USER_NOT_FOUND":"Utente non trovato","USER_OR_PASSWORD_INVALID":"Utente o password non validi","USER_MUST_CHANGE_PASSWORD":"Devi cambiare la password","USER_MUST_ENTER_VERIFICATION_CODE":"Devi inserire il codice di verifica","USER_MISSING_TENANT":"Utente: tenant mancante","USER_MISSING_NAME":"Utente: nome mancante","USER_MISSING_PASSWORD":"Utente: password mancante","USER_MISSING_EMAIL":"Utente: email mancante","USER_MISSING_VERIFICATION_CODE":"Utente: codice di verifica mancante","USER_NAME_ALREADY_USED":"Nome utente già in uso","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"La password non rispetta le regole di sicurezza","USER_EMAIL_ALREADY_USED":"Email già in uso","USER_EMAIL_INVALID":"Email non valida","USER_VERIFICATION_CODE_INVALID":"Codice di verifica non valido","USER_MISSING_NAME_OR_EMAIL":"Nome utente o email mancante","USER_NAME_INVALID":"Nome utente non valido","USER_HAS_ONE_OR_MORE_MEMORI":"L\'utente ha uno o più memori","USER_MISSING_NEW_PASSWORD":"Utente: nuova password mancante","USER_NOTHING_TO_DO":"Niente da fare","USER_CANT_CREATE_MEMORI":"Utente non abilitato a creare Memori","USER_MAX_MEMORI_REACHED":"Massimo numero di Memori raggiunto","USER_TOO_MANY_ATTEMPTS":"Troppi tentativi","USER_MUST_ACCEPT_TNC_AND_PP":"Devi accettare i termini e le condizioni","USER_BIRTH_DATE_CANT_BE_CHANGED":"Data di nascita non può essere cambiata","USER_CANT_SET_COMPLETION_PROVIDER":"Utente: non abilitato a gestire il provider di completamento","USER_CANT_ENABLE_DEEP_THOUGHT":"Utente: non abilitato a gestire Pensiero Profondo","USER_CANT_ENABLE_DCM_INTEGRATION":"Utente: non abilitato a gestire l\'integrazione con DCM","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"Utente: non abilitato a gestire la concatenazione o il gruppo di esperti","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"Il gruppo di esperti richiede l\'abilitazione delle completions","MEMORI_NOT_FOUND":"Memori non trovato","MEMORI_NOT_ACCESSIBLE":"Memori non accessibile","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Solo il proprietario può cambiare il tag e il pin","SESSION_NOT_FOUND":"Sessione non trovata","SESSION_IS_NOT_ADMINISTRATIVE":"Sessione non amministrativa","SESSION_EXPIRED":"Sessione scaduta","MEMORI_MISSING_CONFIGURATION":"Memori: configurazione mancante","MEMORI_CONFIGURATION_NOT_FOUND":"Memori: configurazione non trovata","MEMORI_INVALID_PRIVACY_TYPE":"Memori: tipo di privacy non valido","MEMORI_MISSING_PASSWORD":"Memori: password mancante","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Memori: numero totale di token di recupero non valido","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Memori: numero minimo di token di recupero non valido","MEMORI_INVALID_VOICE_TYPE":"Memori: tipo di voce non valido","MEMORI_MISSING_NAME":"Memori: nome mancante","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Memori: password o token di recupero mancanti","MEMORI_INVALID_ID":"Memori: ID non valido","MEMORI_NAME_ALREADY_USED":"Nome memori già in uso","MEMORI_INVALID_PIN":"Memori: PIN non valido","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Memori: cambio TAG e PIN richiedono operazioni separate","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Memori: password non richiesta su Memori pubblico","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Pensiero Profondo richiede l\'abilitazione delle completions","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Trasferimento: utente di destinazione mancante","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Trasferimento: ID utente di destinazione non valido","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Trasferimento: dati utente di destinazione non validi","MEMORI_TRANSFER_NOTHING_TO_DO":"Trasferimento: alcuna operazione da fare","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Memori: la configurazione non può essere modificata","MEMORI_MISSING_NEW_PASSWORD":"Memori: nuova password mancante","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Formato non valido data a partire da","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Formato non valido data fino a","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"Memori: funzionalità richiede un abbonamento","INTEGRATION_NOT_FOUND":"Integrazione non trovata","INTEGRATION_INVALID_TYPE":"Tipo integrazione non valido","INTEGRATION_ALREADY_EXISTS":"Integrazione già esistente","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Memori non pubblici non possono essere integrati","INTEGRATION_MISSING_INVOCATION_TEXT":"Integrazione: testo di invocazione mancante","INTEGRATION_MISSING_DEVICE_EMAILS":"Integrazione: email del dispositivo mancante","INTEGRATION_MEMORI_IS_EMPTY":"Memori vuoti non possono essere integrati","INTEGRATION_MISSING_PRIVACY_POLICY":"Integrazione: privacy policy mancante","INTEGRATION_MISSING_CATEGORY":"Categoria integrazione mancante","INTEGRATION_MISSING_DESCRIPTION":"Descrizione integrazione mancante","INTEGRATION_INVALID_INVOCATION_TEXT":"Testo di invocazione non valido","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home non più disponibile","UPLOAD_REQUIRES_MULTIPART_ENCODING":"L\'upload richiede l\'encoding multipart","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: manca il content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: dimensione massima superata","UPLOAD_FILE_IS_EMPTY":"Upload: file vuoto","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: tipo di file o firma non validi","UPLOAD_MISSING_FILE_NAME":"Upload: nome file mancante","UPLOAD_INVALID_MEMORY_ID":"Upload: ID contenuto non valido","UPLOAD_MISSING_FILE_CONTENT":"Upload: contenuto file mancante","ASSET_NOT_FOUND":"Asset non trovato","ASSET_NOT_ACCESSIBLE":"Asset non accessibile","ASSET_MISSING_SESSION_ID":"Asset: ID sessione mancante","ASSET_INVALID_FILE_NAME":"Asset: nome file non valido","INVITATION_NOT_FOUND":"Invito non trovato","INVITATION_NOT_ACCESSIBLE":"Invito non accessibile","INVITATION_ALREADY_ACCEPTED":"Invito già accettato","INVITATION_ALREADY_REJECTED":"Invito già rifiutato","INVITATION_MISSING_DESTINATION_EMAIL":"Invito: email di destinazione mancante","INVITATION_DESTINATION_EMAIL_INVALID":"Invito: email di destinazione non valida","INVITATION_MISSING_TAG":"Invito: tag mancante","INVITATION_MISSING_PIN":"Invito: PIN mancante","INVITATION_INVALID_PIN":"Invito: PIN non valido","INVITATION_INVALID_TYPE":"Invito: tipo non valido","INVITATION_MISSING_DESTINATION_NAME":"Invito: nome destinatario mancante","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invito: tag e pin non possono essere cambiati","INVITATION_CANT_BE_CHANGED":"Invito: non può essere modificato","ACTIONLOG_INVALID_USER_ID":"ID utente non valido","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","ACTIONLOG_INVALID_MEMORI_ID":"ID Memori non valido","CONSUMPTIONLOG_INVALID_TYPE":"Tipo di log non valido","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","CONSUMPTIONLOG_INVALID_USER_ID":"ID utente non valido","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Memori ID non valido","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notifiche: Periodo di estrazione chatlog non valido","PROCESS_INVALID_TYPE":"Tipo di processo non valido","PROCESS_ALREADY_RUNNING":"Processo già in esecuzione","PROCESS_NOT_FOUND":"Processo non trovato","IMPORTCSV_MISSING_ROWS":"Importazione CSV: righe mancanti","IMPORTCSV_MISSING_CSV":"Importazione CSV: CSV mancante","IMPORTCSV_MISSING_SEPARATOR":"Importazione CSV: separatore mancante","IMPORTCSV_INVALID_SEPARATOR":"Importazione CSV: separatore non valido","IMPORTCSV_MISSING_HEADERS":"Importazione CSV: intestazioni mancanti","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Importazione CSV: separatore varianti titolo mancante","IMPORTCSV_INVALID_RECEIVER_ID":"Importazione CSV: ID receiver non valido","IMPORTCSV_INVALID_MEDIA_LINK":"Importazione CSV: link media non valido","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"Importazione CSV: encoding caratteri non rilevabile","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"Importazione CSV: impossibile importare in Memori segreti","IMPORTTXT_MISSING_ROWS":"Importazione TXT: righe mancanti","IMPORTTXT_INVALID_GRANULARITY":"Importazione TXT: granularità non valida","IMPORTTXT_INVALID_RECEIVER_ID":"Importazione TXT: ID receiver non valido","IMPORTTXT_INVALID_MEDIA_LINK":"Importazione TXT: link media non valido","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"Importazione TXT: encoding caratteri non rilevabile","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"Importazione TXT: impossibile importare in Memori segreti","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Importazione TXT: limite importazione superato","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Importazione TXT: importazione su GPT-4 richiede API key","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Importazione TXT: importazione richiede un piano a pagamento","EXPORTCSV_MISSING_CSV_SPECS":"Esportazione CSV: specifiche CSV mancanti","EXPORTCSV_MISSING_SEPARATOR":"Esportazione CSV: separatore mancante","EXPORTCSV_INVALID_SEPARATOR":"Esportazione CSV: separatore non valido","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Esportazione CSV: separatore varianti titolo mancante","EXPORTCSV_MISSING_NEW_LINE_CHAR":"Esportazione CSV: carattere di nuova riga mancante","EXPORTCSV_INVALID_NEW_LINE_CHAR":"Esportazione CSV: carattere di nuova riga non valido","EXPORTCSV_MISSING_PASSWORD":"Esportazione CSV: password mancante","EXPORTJSONL_MISSING_JSONL_SPECS":"Esportazione JSONL: specifiche JSONL mancanti","EXPORTJSONL_MISSING_PLATFORM":"Esportazione JSONL: piattaforma mancante","EXPORTJSONL_INVALID_PLATFORM":"Esportazione JSONL: piattaforma non valida","EXPORTJSONL_MISSING_PASSWORD":"Esportazione JSONL: password mancante","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"Esportazione JSONL: esportazione richiede un piano a pagamento","ANALYSIS_MISSING_QUERY":"Analisi: query mancante","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analisi: impossibile analizzare Memori segreti","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analisi: corrispondenza query utente richiede Pensiero Profondo","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Assegnazione badge: credenziali errate o mancanti","BADGE_ASSIGNMENT_MISSING_REF_ID":"Assegnazione badge: ID ref mancante","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Assegnazione badge: esito non trovato","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Assegnazione badge: URL di asserzione mancante","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Assegnazione badge: URL badge mancante","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Assegnazione badge: URL issuer mancante","BADGE_ASSIGNMENT_INVALID_URL":"Assegnazione badge: URL non valido","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Assegnazione badge: destinatario mancante","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Assegnazione badge: tipo destinatario sconosciuto","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Assegnazione badge: identità destinatario mancante","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Assegnazione badge: tipo hash destinatario mancante","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Assegnazione badge: tipo hash destinatario sconosciuto","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Assegnazione badge: identità destinatario errata","BADGE_NOT_FOUND":"Badge non trovato","OUTCOME_NO_DCM_CONFIGURED":"Esito: nessun DCM configurato","OUTCOME_USER_BADGES_DISABLED":"Esito: badge utente disabilitati"}}');const RG=IG({resources:{en:{translation:t(JSON.parse('{"yes":"Yes","no":"No","confirm":"Confirm","apply":"Apply","cancel":"Cancel","show":"Show","hide":"Hide","send":"Send","close":"Close","edit":"Edit","delete":"Delete","loading":"Loading","expand":"Expand","collapse":"Collapse","fullscreenEnter":"Enter fullscreen","fullscreenExit":"Exit fullscreen","center":"Center","bottom":"Bottom","hidden":"Hidden","day":"Day","month":"Month","year":"Year","createdAt":"Creation date","selected":"Selected","page":"page","actions":"Actions","next":"Next","previous":"Previous","copy":"Copy","copyToClipboard":"Copy to clipboard","showOriginalText":"Show original","showTranslatedText":"Show translation","exactPosition":"Exact position","uncertain":"Uncertain","question":"Question","nothingFound":"Nothing found","venue":"Venue","searchVenue":"Search venue...","memoriBlockedTitle":"Blocked","memoriBlockedUntil":"Memori blocked until {{date}}","memoriBlockedAnon":"Currently \\"{{name}}\\" can\'t answer, come back here on {{date}}","memoriBlockedReasonExceedChats":"because it has exceeded the monthly threshold of allowed chats.","memoriBlockedGiverHelper":"You can still manage it as administrator, but other users will not be able to interact with it.","generatedByAI":"Answer generated by AI, may occasionally generate incorrect informations","whyThisAnswer":"Why this answer?","whyThisAnswerHelper":"This answer was generated automatically by an artificial intelligence based on these verified contents.","completionsEnabled":"Advanced AI, can respond with automatically generated answers that may sometimes contain incorrect information","completionProviderDown":"This Twin is integrated with a generative AI from {{provider}}, but it is currently unavailable. Try again later.","completionProviderFallbackName":"an external provider","completionProviderCheckStatusPage":"Check status page","boardOfExperts":"Board of experts","birthDate":"Birth date","birthDateHelper":"We ask for your birth date only to enable or disable functionalities that have age restrictions","underage":"You must be at least {{age}} years old to sign up.","underageTwinSession":"You must be at least {{age}} years old to interact with this Twin.","ageVerification":"Age verification","ageVerificationText":"To interact with this Twin, you must be at least {{minAge}} years old.","nsfw":"NSFW: This Twin contains adult contents","deepThought":"Deep Thought","deepThoughtHelper":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together. Allow the twin\'s author to contact you for commercial offers regarding products you have shown interest in.","deepThoughtDisclaimerTitle":"Deep Thought enabled","deepThoughtDisclaimer":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together.","deepThoughtPreDisclaimerUnlogged":"Log in to enable Deep Thought.","deepThoughtPreDisclaimerNotAllowed":"Deep Thought is disabled since you didn\'t consent its usage, you can change this any time in your account settings.","knownFacts":{"title":"Known facts","description":"Details of the information shared between you and {{memoriName}}","type":"Type","typeShortTerm":"Short term","typeLongTerm":"Long term","typeHelper":"Types:\\n- Short Term: this Known Fact is always used during conversations\\n- Long Term: this Known Fact is used during conversations only if relevant to the current question","text":"Text","deleteSuccess":"Known fact deleted","deleteConfirmTitle":"Delete known fact","deleteConfirmMessage":"Are you sure you want to delete this known fact?","deleteSelectedConfirmTitle":"Delete selected known facts","deleteSelectedConfirmMessage":"Are you sure you want to delete the selected known facts?"},"auth":{"title":"Authentication","useRecoveryTokens":"Use recovery tokens","tokens":"Tokens","addToken":"Add token","usePassword":"Use password","atLeast":"At least"},"widget":{"instruct":"Instruct","test":"Test","sound":"Sound","position":"Position preferences","settings":"Settings","share":"Share","sendOnKeypress":"Hit Enter to send","sendOnClick":"Click on Submit","boardOfExperts":"Board of experts","showExpertsInTheBoard":"Show experts in this board","expertsInTheBoard":"Experts in this board","goToIntegrationsToCustomizeAvatar":"To customize the avatar, go to Share and customize the public page"},"write_and_speak":{"micButtonPopover":"Click the button to speak","micButtonPopoverListening":"Click the button to stop speak","pageInstructExplanation":"To teach me new things click on the INSTRUCT ME button to get started","pageTryMeExplanation":"To talk to me click on the START button to get started","instructButton":"INSTRUCT ME","tryMeButton":"START","chatHistory":"Chat history","exportChatHistory":"Export chat history","exportChatHistoryMessage":"Do you want to export chat history?","chatBotButtonText":"CLICK HERE TO OPEN CHATBOT","conversationStartedLabel":"Conversation started on","settingsHeaderLabel":"Setup here if you want to set the memori as continuous speech, and change the silence seconds if you want to customize them.","continuousSpeechLabel":"Continuous speech","holdToSpeak":"Hold to speak","releaseToEndListening":"Release to end listening","pressAndHoldToSpeak":"Press and hold to speak","microphoneMode":"Microphone mode","hideEmissionsLabel":"Hide text emitted by the Twin","secondsLabel":"Set seconds","controlsPosition":"Controls position","tryMeHeaderLabel":"TRY","unknownPosition":"Unknown position","fieldPlace":"Write the place (eg \'Milano\')","showMapLinkFor":"Show the position on the map","useMyPosition":"Use my position","myPosition":"Your position","updatingPosition":"Updating position...","placeNotFound":"Place not found!","requirePosition":"Insert your position before start","requirePositionHelp":"To talk to {{name}} you have to decide whether to provide your position or not. This is because different answers that it can provide you may depend on where you are.","dontWantToProvidePosition":"I don\'t want to provide my position","attachmentsLabel":"Enrich your message","iWantToTalkToIn":"I want to talk to {{name}} in"},"media":{"title":"Title","editAttributes":"Edit media attributes","uploadMimeTypeNotAllowed":"The file type is not allowed","uploadSizeLimitMessage":"The uploaded size is too big (max {{size}}MB)","uploadWrongResolutionMessage":"The resolution must be {{width}}x{{height}} pixel","memoriNameAlreadyUsed":"You already have a Twin with this name","uploadHelperImages":"Upload a file with extension png, jpg, jpeg or gif, and having at maximum a size of {{size}}MB","uploadHelper":"Upload a file having at maximum a size of {{size}}MB","uploadError":"Upload failed","square":"square","scaleRatio":"Scale ratio","addMediaLabel":"Add a media","insertThisMediaMsg":"Insert these media","mediaUploadMessage":"Click to load a new media","addLinkLabel":"Add a link","linkKey":"URL","linkValue":"Link title","insertThisLink":"Insert a link to {{url}} with title {{title}}"},"gamification":{"level":"Level","points":"points","memoriReachedLevel":"became more evolved and reached level","levelGoToStatistics":"{{memori}} is at level {{level}} with {{points}} points. Click to go to statistics.","congratulationsNewLevel":"Congratulations, you have reached a new level!","congratulationsNewLevelDescription":"Your Memori became more evolved with {{points}} points, look at the","statistics":"statistics"},"login":{"login":"Login","logout":"Logout","user":"User","loggedDrawerTitle":"Hi, {{name}}!","loginDrawerTitle":"Login","signupDrawerTitle":"Sign up","newUserSignUp":"New user?","signUp":"Sign up!","alreadyHaveAnAccount":"Already have an account?","backToLogin":"Back to login","registrationDisabled":"Registration is disabled","contactAdmin":"Contact the administrator to request access","userNameOrEmail":"Username or email","email":"Email","emailFormatError":"Please, insert a valid email","username":"Username","usernameContainsReservedWord":"Username contains a reserved word, please choose another one","usernameFormatError":"Username must be at least 3 characters long and contain only letters, numbers and _","otpCode":"Verification code","resendVerificationCode":"Resend code","resentVerificationCode":"Confirmation code sent! Please check your email.","password":"Password","newPassword":"New password","confirmPassword":"Confirm Password","currentPassword":"Current password","passwordMatchingError":"Passwords do not match.","passwordFormatError":"Password must be at least 8 characters long and contain at least a number, an upper case letter, a lower case letter and a symbol","pwdWeak":"Weak","pwdAcceptable":"Acceptable","pwdStrong":"Strong","mustChangePassword":"You must change your password","passwordChange":"Change password","emailChange":"Change email","avatarChange":"Change avatar","underage":"You must be at least {{age}} years old to sign up.","optional":"Optional","birthDate":"Birth date","birthDateHelper":"We ask for your birth date only to enable or disable functionalities that have age restrictions","missingData":"Missing informations","missingDataHelper":"We know that this is a bit annoying, but we need some more informations to complete your registration.","goToAccountToChangeYourPreferences":"You can change your choice at any time from your Account page.","deepThoughtExplaination":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together. Allow the twin\'s author to contact you for commercial offers regarding products you have shown interest in.","tnCAndPPAcceptedHelper":"Since your last login, T&C and Privacy Policy have changed. Please accept them, otherwise you won\'t be able to make changes to your Twins. You can always delete your account in your user profile page.","privacyLabel":"I have read and accepted the","privacyAndCookiePolicy":"Privacy e Cookie Policy","and":"and","termsOfService":"Terms of Service","pAndCUAccepted":"I accept the terms of service about Deep Thought","editAccount":"Edit account","save":"Save"},"success":"Success","Error":"Error","internal server error":"Oupsie, sorry... Something went wrong on the server","error":"Error","error.loading":"Error while loading content.","error.generic":"Oupsie, sorry... something went wrong.","error.serverNotResponding":"We are doing maintenance or releasing updates. Please try again later.","error.notFound":"Oupsie, we didn\'t find the page you were looking for.","error.goBackTo":"You can try to go back to the","error.reloadPage":"Reload the page","error.tryAgain":"Try again","error.unauthorized":"You are unauthorized to view this content.","error.unprocessableEntity":"Error while processing the request. Check the data you entered.","errors":{"TENANT_NOT_FOUND":"Tenant not found","TENANT_REGISTRATION_DISABLED":"Registration on this platform is disabled","TENANT_MISSING_NAME":"Tenant: name missing","TENANT_MAX_USERS_REACHED":"Maximum number of users reached","TENANT_MAX_ADMINS_REACHED":"Maximum number of admin users reached","TENANT_ALREADY_EXISTS":"Tenant already exists","TENANT_MISSING_DESCRIPTION":"Tenant: description missing","TENANT_CANT_SET_COMPLETION_PROVIDER":"Tenant: can\'t set completion provider","USER_NOT_CONFIRMED":"User still not confirmed","USER_NOT_FOUND":"User not found","USER_OR_PASSWORD_INVALID":"Invalid user or password","USER_MUST_CHANGE_PASSWORD":"You must change your password","USER_MUST_ENTER_VERIFICATION_CODE":"You must enter the verification code","USER_MISSING_TENANT":"User: missing tenant","USER_MISSING_NAME":"User: name is missing","USER_MISSING_PASSWORD":"User: password missing","USER_MISSING_EMAIL":"User: Missing email","USER_MISSING_VERIFICATION_CODE":"User: Missing verification code","USER_NAME_ALREADY_USED":"User name already in use","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"The password does not meet the security rules","USER_EMAIL_ALREADY_USED":"Email already in use","USER_EMAIL_INVALID":"Invalid email","USER_VERIFICATION_CODE_INVALID":"Invalid verification code","USER_MISSING_NAME_OR_EMAIL":"Missing username or email","USER_NAME_INVALID":"Invalid user name","USER_HAS_ONE_OR_MORE_MEMORI":"The user has one or more memories","USER_MISSING_NEW_PASSWORD":"User: new password missing","USER_NOTHING_TO_DO":"Nothing to do","USER_CANT_CREATE_MEMORI":"User not allowed to create Memori","USER_MAX_MEMORI_REACHED":"Maximum number of Memori reached","USER_TOO_MANY_ATTEMPTS":"Too many attempts","USER_MUST_ACCEPT_TNC_AND_PP":"You must accept the terms and conditions","USER_BIRTH_DATE_CANT_BE_CHANGED":"Date of birth cannot be changed","USER_CANT_SET_COMPLETION_PROVIDER":"User: not allowed to manage completion provider","USER_CANT_ENABLE_DEEP_THOUGHT":"User: not enabled to manage Deep Thought","USER_CANT_ENABLE_DCM_INTEGRATION":"User: not enabled to manage DCM integration","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"User: not allowed to manage chaining or expert group","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"The expert group requires completions to be enabled","MEMORI_NOT_FOUND":"Memori not found","MEMORI_NOT_ACCESSIBLE":"Memori not accessible","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Only owner can change tag or pin","SESSION_NOT_FOUND":"Session not found","SESSION_IS_NOT_ADMINISTRATIVE":"Non-administrative session","SESSION_EXPIRED":"Session expired","MEMORI_MISSING_CONFIGURATION":"Memori: missing configuration","MEMORI_CONFIGURATION_NOT_FOUND":"Memories: configuration not found","MEMORI_INVALID_PRIVACY_TYPE":"Memories: invalid privacy type","MEMORI_MISSING_PASSWORD":"Memori: missing password","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Memories: total number of invalid recovery tokens","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Memories: minimum number of invalid recovery tokens","MEMORI_INVALID_VOICE_TYPE":"Memories: invalid voice type","MEMORI_MISSING_NAME":"Memories: missing name","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Memories: missing password or recovery token","MEMORI_INVALID_ID":"Memories: invalid ID","MEMORI_NAME_ALREADY_USED":"Memory name already in use","MEMORI_INVALID_PIN":"Memories: Invalid PIN","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Memories: TAG and PIN change require separate operations","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Memories: no password required when public","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Deep Thought requires completions to be enabled","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Transfer: missing destination user","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Transfer: invalid destination user ID","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Transfer: invalid destination user data","MEMORI_TRANSFER_NOTHING_TO_DO":"Transfer: nothing to do","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Memories: configuration cannot be changed","MEMORI_MISSING_NEW_PASSWORD":"Memories: new password missing","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"Feature requires subscription","INTEGRATION_NOT_FOUND":"Integration not found","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Invalid date from format","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Invalid date to format","INTEGRATION_INVALID_TYPE":"Invalid integration type","INTEGRATION_ALREADY_EXISTS":"Integration already exists","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Non-public memories cannot be integrated","INTEGRATION_MISSING_INVOCATION_TEXT":"Integration: missing invocation text","INTEGRATION_MISSING_DEVICE_EMAILS":"Integration: missing device email","INTEGRATION_MEMORI_IS_EMPTY":"Empty memories cannot be integrated","INTEGRATION_MISSING_PRIVACY_POLICY":"Integration: privacy policy missing","INTEGRATION_MISSING_CATEGORY":"Integration category missing","INTEGRATION_MISSING_DESCRIPTION":"Missing integration description","INTEGRATION_INVALID_INVOCATION_TEXT":"Invalid invocation text","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home no more available","UPLOAD_REQUIRES_MULTIPART_ENCODING":"Upload requires multipart encoding","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: missing content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: maximum size exceeded","UPLOAD_FILE_IS_EMPTY":"Upload: empty file","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: invalid file type or signature","UPLOAD_MISSING_FILE_NAME":"Upload: missing file name","UPLOAD_INVALID_MEMORY_ID":"Upload: Invalid content ID","UPLOAD_MISSING_FILE_CONTENT":"Upload: Missing file content","ASSET_NOT_FOUND":"Asset not found","ASSET_NOT_ACCESSIBLE":"Asset not accessible","ASSET_MISSING_SESSION_ID":"Asset: missing session ID","ASSET_INVALID_FILE_NAME":"Asset: invalid file name","INVITATION_NOT_FOUND":"Invitation not found","INVITATION_NOT_ACCESSIBLE":"Invitation not accessible","INVITATION_ALREADY_ACCEPTED":"Invitation already accepted","INVITATION_ALREADY_REJECTED":"Invitation already rejected","INVITATION_MISSING_DESTINATION_EMAIL":"Invitation: missing destination email","INVITATION_DESTINATION_EMAIL_INVALID":"Invitation: destination email invalid","INVITATION_MISSING_TAG":"Invitation: missing tag","INVITATION_MISSING_PIN":"Invitation: PIN missing","INVITATION_INVALID_PIN":"Invitation: invalid PIN","INVITATION_INVALID_TYPE":"Invitation: invalid type","INVITATION_MISSING_DESTINATION_NAME":"Invitation: destination name missing","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invitation: tag and pin can\'t be changed","INVITATION_CANT_BE_CHANGED":"Intation: can\'t be changed","ACTIONLOG_INVALID_USER_ID":"Invalid user ID","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","ACTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID","CONSUMPTIONLOG_INVALID_TYPE":"Invalid log type","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","CONSUMPTIONLOG_INVALID_USER_ID":"Invalid user ID","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notifications: Invalid chat log extraction period","PROCESS_INVALID_TYPE":"Invalid process type","PROCESS_ALREADY_RUNNING":"Process already running","PROCESS_NOT_FOUND":"Process not found","IMPORTCSV_MISSING_ROWS":"CSV import: missing rows","IMPORTCSV_MISSING_CSV":"CSV Import: Missing CSV","IMPORTCSV_MISSING_SEPARATOR":"CSV import: missing separator","IMPORTCSV_INVALID_SEPARATOR":"CSV import: invalid separator","IMPORTCSV_MISSING_HEADERS":"CSV import: missing headers","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV import: missing title variant separator","IMPORTCSV_INVALID_RECEIVER_ID":"CSV import: invalid receiver ID","IMPORTCSV_INVALID_MEDIA_LINK":"CSV import: invalid media link","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"CSV import: undetectable character encoding","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"CSV Import: Cannot import to Secret Memories","IMPORTTXT_MISSING_ROWS":"Importing TXT: missing rows","IMPORTTXT_INVALID_GRANULARITY":"Import TXT: invalid granularity","IMPORTTXT_INVALID_RECEIVER_ID":"Import TXT: invalid receiver ID","IMPORTTXT_INVALID_MEDIA_LINK":"Import TXT: invalid media link","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"TXT import: undetectable character encoding","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"TXT Import: Cannot import to Secret Memories","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Import TXT: import limit exceeded","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Import TXT: import on GPT-4 requires API key","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Import TXT: Import requires a paying plan","EXPORTCSV_MISSING_CSV_SPECS":"CSV export: missing CSV specifications","EXPORTCSV_MISSING_SEPARATOR":"CSV export: missing separator","EXPORTCSV_INVALID_SEPARATOR":"CSV export: invalid separator","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV export: missing title variant separator","EXPORTCSV_MISSING_NEW_LINE_CHAR":"CSV export: missing newline character","EXPORTCSV_INVALID_NEW_LINE_CHAR":"CSV export: invalid newline character","EXPORTCSV_MISSING_PASSWORD":"CSV export: missing password","EXPORTJSONL_MISSING_JSONL_SPECS":"JSONL export: missing JSONL specifications","EXPORTJSONL_MISSING_PLATFORM":"JSONL export: missing platform","EXPORTJSONL_INVALID_PLATFORM":"JSONL export: invalid platform","EXPORTJSONL_MISSING_PASSWORD":"JSONL export: missing password","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"JSONL Export: Export requires a paid plan","ANALYSIS_MISSING_QUERY":"Analysis: missing query","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analysis: Unable to analyze Secret Memories","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analysis: matching user query requires Deep Thinking","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Badge assignment: incorrect or missing credentials","BADGE_ASSIGNMENT_MISSING_REF_ID":"Badge assignment: ref ID missing","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Badge assignment: result not found","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Badge assignment: Missing assertion URL","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Badge Assignment: Missing Badge URL","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Badge assignment: missing issuer URL","BADGE_ASSIGNMENT_INVALID_URL":"Badge assignment: Invalid URL","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Badge assignment: missing recipient","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Badge assignment: unknown recipient type","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Badge assignment: missing recipient identity","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Badge assignment: missing recipient hash type","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Badge assignment: recipient hash type unknown","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Badge assignment: incorrect recipient identity","BADGE_NOT_FOUND":"Badge not found","OUTCOME_NO_DCM_CONFIGURED":"Result: no DCM configured","OUTCOME_USER_BADGES_DISABLED":"Result: user badges disabled"}}'))},it:{translation:t(MG)}},lng:"en",fallbackLng:"it",supportedLngs:["en","it"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1}});RG.init();var PG=RG;c=o("85Hg2");function kG(e){var t=e.i18n,n=e.defaultNS,r=e.children,i=(0,c.useMemo)((function(){return{i18n:t,defaultNS:n}}),[t,n]);return(0,c.createElement)(ae.Provider,{value:i},r)}const OG=({ownerUserName:e,ownerUserID:t,memoriName:n,memoriID:r,integrationID:i,tenantID:o,secretToken:a,sessionID:l,layout:u="DEFAULT",customLayout:d,showShare:h=!0,showSettings:p=!0,showInstruct:f=!1,showTypingText:m=!1,showClear:g=!1,showOnlyLastMessages:v=!1,showInputs:y=!0,showDates:b=!1,showContextPerLine:S=!1,showLogin:x,height:w="100%",baseURL:_,apiURL:C="https://backend.memori.ai",tag:A,pin:E,context:T,initialQuestion:M,uiLang:I,spokenLang:R,multilingual:P,authToken:k,AZURE_COGNITIVE_SERVICES_TTS_KEY:O,defaultSpeakerActive:N=!0,onStateChange:L,additionalInfo:D,customMediaRenderer:B,additionalSettings:z,userAvatar:F})=>{var U,j,H;const[G,V]=(0,c.useState)(),[W,q]=(0,c.useState)(),[K,J]=(0,c.useState)(O),{t:Q}=xe();if(!(r&&t||n&&e))throw new Error("Identifier pair required: please provide either memoriID and ownerUserID or memoriName and ownerUserName");const Z=Y(C),X=(0,c.useCallback)((async()=>{const e=_||(o.startsWith("https://")?o:`https://${o}`),t=await fetch(`${e}/api/speechkey`),n=await t.json();n.AZURE_COGNITIVE_SERVICES_TTS_KEY&&J(n.AZURE_COGNITIVE_SERVICES_TTS_KEY)}),[]);(0,c.useEffect)((()=>{O||X()}),[O]);const $=(0,c.useCallback)((async()=>{if(r&&t){const{memori:e,...n}=await Z.backend.getMemoriByUserAndId(o,t,r);0===n.resultCode&&e?V(e):console.error("[MEMORI]",n,e)}else if(n&&e){const{memori:t,...r}=await Z.backend.getMemori(o,e,n);0===r.resultCode&&t?V(t):console.error("[MEMORI]",r,t)}}),[r,t,n,e,o]);(0,c.useEffect)((()=>{$()}),[$,o]);const ee=(0,c.useCallback)((async()=>{const e=await cH(o,_);e&&q(e)}),[o,C]);(0,c.useEffect)((()=>{ee()}),[ee]),(0,c.useEffect)((()=>{if(I)PG.changeLanguage(I.toLowerCase());else{const{lng:e,fallbackLng:t}=(()=>{const e=navigator.language;if(e){let t=e.split("-")[0];if(["en","it"].includes(t))return{lng:t,fallbackLng:"en"===t?"it":"en"}}return{lng:"en",fallbackLng:"it"}})();PG.changeLanguage(e).catch((()=>{PG.changeLanguage(t)}))}}),[I]);const te=G?(0,s.jsx)(aH,{layout:u,customLayout:d,height:w,baseUrl:_||(o.startsWith("https://")?o:`https://${o}`),apiUrl:C,memori:{...G,secretToken:a},memoriLang:null!=R?R:null===(j=null===(U=G.culture)||void 0===U?void 0:U.split("-"))||void 0===j?void 0:j[0],multilingual:P,tenant:W,secret:a,sessionID:l,showShare:h,showSettings:p,showInstruct:f,showTypingText:m,showClear:g,showOnlyLastMessages:v,showInputs:y,showDates:b,showContextPerLine:S,showLogin:null!=x?x:null==G?void 0:G.enableDeepThought,integration:null===(H=null==G?void 0:G.integrations)||void 0===H?void 0:H.find((e=>i?e.integrationID===i:!!e.publish&&"LANDING_EXPERIENCE"===e.type)),initialContextVars:T,initialQuestion:M,authToken:k,AZURE_COGNITIVE_SERVICES_TTS_KEY:K||O,defaultSpeakerActive:N,onStateChange:L,additionalInfo:D,customMediaRenderer:B,additionalSettings:z,userAvatar:F,...A&&E?{personification:{tag:A,pin:E}}:{}}):(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,s.jsxs)("p",{style:{textAlign:"center",margin:"2rem auto",textTransform:"capitalize"},children:[Q("loading")||"Loading","..."]})});return(0,s.jsxs)(kG,{i18n:PG,children:[(0,s.jsx)(Ju.Toaster,{position:"top-center",reverseOrder:!0}),te]})};OG.propTypes={memoriName:t(l).string,memoriID:t(l).string,ownerUserName:t(l).string,ownerUserID:t(l).string,integrationID:t(l).string,tenantID:t(l).string.isRequired,secretToken:t(l).string,sessionID:t(l).string,layout:t(l).oneOf(["DEFAULT","FULLPAGE","TOTEM","WEBSITE_ASSISTANT","CHAT"]),customLayout:t(l).any,showShare:t(l).bool,showInstruct:t(l).bool,showInputs:t(l).bool,showDates:t(l).bool,showContextPerLine:t(l).bool,showSettings:t(l).bool,showClear:t(l).bool,showOnlyLastMessages:t(l).bool,showTypingText:t(l).bool,showLogin:t(l).bool,height:t(l).oneOfType([t(l).string,t(l).number]),baseURL:t(l).string,apiURL:t(l).string,tag:t(l).string,pin:t(l).string,context:t(l).objectOf(t(l).any),initialQuestion:t(l).string,uiLang:t(l).oneOf(["en","it","EN","IT"]),spokenLang:t(l).string,multilingual:t(l).bool,authToken:t(l).string,AZURE_COGNITIVE_SERVICES_TTS_KEY:t(l).string,defaultSpeakerActive:t(l).bool,onStateChange:t(l).func,additionalInfo:t(l).objectOf(t(l).any),customMediaRenderer:t(l).func,additionalSettings:t(l).any,userAvatar:t(l).oneOfType([t(l).string,t(l).any])};var NG=OG;class LG extends HTMLElement{connectedCallback(){const e=document.createElement("div"),n=document.createElement("div");n.setAttribute("id","memori-root"),e.appendChild(n),this.appendChild(e);const r=Object.keys(NG.propTypes).reduce(((e,t)=>(this.hasAttribute(t)&&(e[t]=this.getAttribute(t),"true"!==e[t]&&"false"!==e[t]||(e[t]="true"===e[t])),e)),{}),i=this.getAttribute("tenantId"),o=this.getAttribute("context")?.split(",")?.reduce(((e,t)=>{const[n,r]=t.split(":").map((e=>e.trim()));return{...e,[n]:r}}),{}),l=(e=>{try{return JSON.parse(e)}catch(e){return null}})(this.getAttribute("additionalInfo")||"{}")||{};i?t(a).render((0,s.jsx)(NG,{...r,context:o,tenantID:i,additionalInfo:l}),n):console.error("No tenantId attribute found")}}customElements.define("memori-client",LG)})();
250
+ */function HU(e,t=0){const n=[];return e.forEach((function(e,r){let i=null;e.forEach((function(o,s){if(!o&&null!==i)return n.push(`M${i+t} ${r+t}h${s-i}v1H${i+t}z`),void(i=null);if(s!==e.length-1)o&&null===i&&(i=s);else{if(!o)return;null===i?n.push(`M${s+t},${r+t} h1v1H${s+t}z`):n.push(`M${i+t},${r+t} h${s+1-i}v1H${i+t}z`)}}))})),n.join("")}function GU(e,t){return e.slice().map(((e,n)=>n<t.y||n>=t.y+t.h?e:e.map(((e,n)=>(n<t.x||n>=t.x+t.w)&&e))))}function VU(e,t,n,r){if(null==r)return null;const i=n?4:0,o=e.length+2*i,s=Math.floor(.1*t),a=o/t,l=(r.width||s)*a,c=(r.height||s)*a,u=null==r.x?e.length/2-l/2:r.x*a,d=null==r.y?e.length/2-c/2:r.y*a;let h=null;if(r.excavate){let e=Math.floor(u),t=Math.floor(d);h={x:e,y:t,w:Math.ceil(l+u-e),h:Math.ceil(c+d-t)}}return{x:u,y:d,h:c,w:l,excavation:h}}var WU=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}();function qU(e){const n=e,{value:r,size:i=BU,level:o=zU,bgColor:s=FU,fgColor:a=UU,includeMargin:l=jU,style:u,imageSettings:d}=n,h=NU(n,["value","size","level","bgColor","fgColor","includeMargin","style","imageSettings"]),p=null==d?void 0:d.src,f=(0,c.useRef)(null),m=(0,c.useRef)(null),[g,v]=(0,c.useState)(!1);(0,c.useEffect)((()=>{if(null!=f.current){const e=f.current,t=e.getContext("2d");if(!t)return;let n=LU.QrCode.encodeText(r,DU[o]).getModules();const c=l?4:0,u=n.length+2*c,h=VU(n,i,l,d),p=m.current,g=null!=h&&null!==p&&p.complete&&0!==p.naturalHeight&&0!==p.naturalWidth;g&&null!=h.excavation&&(n=GU(n,h.excavation));const v=window.devicePixelRatio||1;e.height=e.width=i*v;const y=i/u*v;t.scale(y,y),t.fillStyle=s,t.fillRect(0,0,u,u),t.fillStyle=a,WU?t.fill(new Path2D(HU(n,c))):n.forEach((function(e,n){e.forEach((function(e,r){e&&t.fillRect(r+c,n+c,1,1)}))})),g&&t.drawImage(p,h.x+c,h.y+c,h.w,h.h)}})),(0,c.useEffect)((()=>{v(!1)}),[p]);const y=OU({height:i,width:i},u);let b=null;return null!=p&&(b=t(c).createElement("img",{src:p,key:p,style:{display:"none"},onLoad:()=>{v(!0)},ref:m})),t(c).createElement(t(c).Fragment,null,t(c).createElement("canvas",OU({style:y,height:i,width:i,ref:f},h)),b)}var KU=({tenant:e,url:n,title:r="",className:i,baseUrl:o,primary:a=!0,showQrCode:l=!0,align:u="right"})=>{const{t:d}=xe(),[h,p]=(0,c.useState)(n),f=(0,c.useMemo)((()=>(null==e?void 0:e.theme)?`${null!=o?o:"https://aisuru.com"}/images/${e.theme}/square_logo.png`:`${null!=o?o:"https://aisuru.com"}/images/memori_logo.png`),[e,o]);(0,c.useEffect)((()=>{n||p(window.location.href)}),[n]);const m=[{id:"facebook",title:"Facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${h}`,icon:bU},{id:"twitter",title:"Twitter",url:`https://twitter.com/intent/tweet?url=${h}`,icon:SU},{id:"linkedin",title:"LinkedIn",url:`https://www.linkedin.com/shareArticle?mini=true&title=${r}&url=${h}`,icon:xU},{id:"whatsapp",title:"Whatsapp",url:`https://api.whatsapp.com/send?phone=&text=${h}`,icon:wU},{id:"telegram",title:"Telegram",url:`https://t.me/share/url?text=${r}&url=${h}`,icon:TU},{id:"email",title:"Email",url:`mailto:?subject=${(null==r?void 0:r.length)>0?r:n}&body=${h}`,icon:_U}];return(0,s.jsxs)(Pv,{as:"div",className:t(ws)("memori-share-button",{"memori-share-button--align-left":"left"===u}),children:[(0,s.jsx)(Pv.Button,{className:t(ws)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button",i,{"memori-button--primary":a}),title:d("widget.share")||void 0,children:(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)(CU,{})})}),(0,s.jsxs)(Pv.Items,{className:"memori-share-button--overlay",as:"ul",children:[(0,s.jsx)(Pv.Item,{as:"li",className:"memori-share-button--li",children:(0,s.jsx)(xf,{className:"memori-share-button--link",ghost:!0,icon:(0,s.jsx)(oS,{}),onClick:()=>{h&&navigator.clipboard.writeText(h)},children:d("copyToClipboard")||void 0})},"copy"),m.map((e=>{var n;return(0,s.jsx)(Pv.Item,{as:"li",className:"memori-share-button--li",children:(0,s.jsxs)("a",{className:t(ws)("memori-button","memori-button--with-icon","memori-button--ghost","memori-button--padded","memori-share-button--link"),href:null!==(n=e.url)&&void 0!==n?n:"",target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)(e.icon,{})}),e.title]})},e.id)})),l&&(0,s.jsxs)(Pv.Item,{as:"li",className:"memori-share-button--li-qr-code",children:[(0,s.jsx)(qU,{id:"qr-canvas",value:null!=h?h:"",size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H",includeMargin:!1,imageSettings:{src:f,x:void 0,y:void 0,height:32,width:32,excavate:!0}}),(0,s.jsx)("div",{children:(0,s.jsx)(xf,{onClick:()=>{const e=document.getElementById("qr-canvas");if(!e)return;const t=document.createElement("a");t.href=e.toDataURL(),t.download=`memori-${r}-share.png`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},icon:(0,s.jsx)(AU,{}),title:"Download QR",children:"Download"})})]},"qrcode")]})]})};var JU=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M290 236.4l43.9-43.9a8.01 8.01 0 0 0-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0 0 13.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 0 0 0 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 0 0-11.3 0l-42.4 42.3a8.03 8.03 0 0 0 0 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 0 0 4.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 0 0-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 0 0-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z"})});var QU=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",focusable:"false",role:"img",className:e,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2","aria-label":t,children:[(0,s.jsx)("path",{d:"M23 4L23 10 17 10"}),(0,s.jsx)("path",{d:"M1 20L1 14 7 14"}),(0,s.jsx)("path",{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"})]});var YU=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6c-.3 1.5-.4 3-.4 4.4 0 14.4 11.6 26 26 26h723c1.5 0 3-.1 4.4-.4 14.2-2.4 23.7-15.9 21.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"})});var ZU=({className:e,memori:n,tenant:r,history:i,position:o,setShowPositionDrawer:a,setShowSettingsDrawer:l,setShowKnownFactsDrawer:u,setShowExpertsDrawer:d,speakerMuted:h,setSpeakerMuted:p,hasUserActivatedSpeak:f=!1,showShare:m=!0,showSettings:g=!0,showSpeaker:v=!0,showReload:y=!1,showClear:b=!1,showLogin:S=!0,setShowLoginDrawer:x,clearHistory:w,loginToken:_,user:C,sessionID:A})=>{const{t:E}=xe(),[T,M]=(0,c.useState)(!1),[I,R]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{document.fullscreenEnabled&&M(!0)}),[]),(0,s.jsxs)("div",{className:t(ws)("memori-header",e),children:[n.needsPosition&&o&&(0,s.jsxs)("div",{className:"memori-header--position",children:[0!==o.latitude&&0!==o.longitude&&(0,s.jsx)("span",{className:"memori-header--position-placeName",children:o.placeName}),(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--position",title:E("widget.position")||"Position",icon:(0,s.jsx)(nx,{}),onClick:()=>a(!0)})]}),y&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--reload",title:E("reload")||"Reload",icon:(0,s.jsx)(QU,{}),onClick:()=>{window.location.reload()}}),b&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--clear",title:E("clearHistory")||"Clear chat",icon:(0,s.jsx)(YU,{}),onClick:w}),T&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--fullscreen",title:I?E("fullscreenExit")||"Exit fullscreen":E("fullscreenEnter")||"Enter fullscreen",icon:I?(0,s.jsx)(US,{}):(0,s.jsx)(JU,{}),onClick:()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen(),R(!1)):(document.documentElement.requestFullscreen(),R(!0))}}),n.enableDeepThought&&!!_&&(null==C?void 0:C.pAndCUAccepted)&&(0,s.jsx)(xf,{primary:!!A&&!!f,shape:"circle",icon:(0,s.jsx)(ex,{}),className:"memori-header--button memori-header--button--knownfacts",disabled:!f||!A,onClick:()=>u(!0),title:E("knownFacts.title")||"Known facts"}),n.enableBoardOfExperts&&(0,s.jsx)(xf,{primary:!0,shape:"circle",icon:(0,s.jsx)($S,{}),className:"memori-header--button memori-header--button--experts",disabled:!f||!A,onClick:()=>d(!0),title:E("widget.showExpertsInTheBoard")||"Experts in this board"}),v&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--speaker",icon:h?(0,s.jsx)(JF,{}):(0,s.jsx)(YF,{}),onClick:()=>p(!h),title:E("widget.sound")||"Sound"}),(0,s.jsx)(vU,{history:i,memori:n,className:"memori-header--button memori-header--button--export",disabled:!f||0===i.length}),g&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button-settings",icon:(0,s.jsx)(yU,{}),onClick:()=>l(!0),title:E("widget.settings")||"Settings"}),m&&(0,s.jsx)(KU,{className:"memori-header--button memori-header--button-share",title:n.name,tenant:r,showQrCode:!0,align:"left"}),S&&(0,s.jsx)(xf,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button-login",icon:(0,s.jsx)(pv,{}),onClick:()=>x(!0),title:_?E("login.user")||"User":E("login.login")||"Login"})]})};var XU=({tenant:e,userLang:t="en",integrationID:n,memoriHash:r})=>{const i="memorytwin"===(null==e?void 0:e.theme)?"memorytwin":"twincreator"===(null==e?void 0:e.theme)?"twincreator":"aisuru";return(0,s.jsxs)("div",{className:"memori--powered-by",children:[(0,s.jsx)("img",{src:`https://aisuru.com/images/${i}/logo.png`,alt:""}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"sr-only",children:"Powered by"}),(0,s.jsx)("a",{href:`https://memori.ai/${"it"===(null==t?void 0:t.toLowerCase())?"it":"en"}${n?`?integrationID=${n}`:""}${r?`${n?"&":"?"}memori=${r}`:""}`,target:"_blank",rel:"noopener noreferrer",children:"Memori.AI"})]})]})},$U=(c=o("85Hg2"),c=o("85Hg2"),(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))($U||{})),ej=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(ej||{}),tj=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(tj||{}),nj=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.SetOrientation=3]="SetOrientation",e[e.GoToOption=4]="GoToOption",e[e.Search=5]="Search",e[e.ClearSearch=6]="ClearSearch",e[e.RegisterOption=7]="RegisterOption",e[e.UnregisterOption=8]="UnregisterOption",e))(nj||{});function rj(e,t=(e=>e)){let n=null!==e.activeOptionIndex?e.options[e.activeOptionIndex]:null,r=Cp(t(e.options.slice()),(e=>e.dataRef.current.domRef.current)),i=n?r.indexOf(n):null;return-1===i&&(i=null),{options:r,activeOptionIndex:i}}let ij={1:e=>e.disabled||1===e.listboxState?e:{...e,activeOptionIndex:null,listboxState:1},0(e){if(e.disabled||0===e.listboxState)return e;let t=e.activeOptionIndex,{value:n,mode:r,compare:i}=e.propsRef.current,o=e.options.findIndex((e=>{let t=e.dataRef.current.value;return lh(r,{1:()=>n.some((e=>i(e,t))),0:()=>i(n,t)})}));return-1!==o&&(t=o),{...e,listboxState:0,activeOptionIndex:t}},2:(e,t)=>e.disabled===t.disabled?e:{...e,disabled:t.disabled},3:(e,t)=>e.orientation===t.orientation?e:{...e,orientation:t.orientation},4(e,t){var n;if(e.disabled||1===e.listboxState)return e;let r=rj(e),i=dm(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeOptionIndex:i,activationTrigger:null!=(n=t.trigger)?n:1}},5:(e,t)=>{if(e.disabled||1===e.listboxState)return e;let n=""!==e.searchQuery?0:1,r=e.searchQuery+t.value.toLowerCase(),i=(null!==e.activeOptionIndex?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find((e=>{var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(r))})),o=i?e.options.indexOf(i):-1;return-1===o||o===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:o,activationTrigger:1}},6:e=>e.disabled||1===e.listboxState||""===e.searchQuery?e:{...e,searchQuery:""},7:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},r=rj(e,(e=>[...e,n]));if(null===e.activeOptionIndex){let{value:i,mode:o,compare:s}=e.propsRef.current,a=t.dataRef.current.value;lh(o,{1:()=>i.some((e=>s(e,a))),0:()=>s(i,a)})&&(r.activeOptionIndex=r.options.indexOf(n))}return{...e,...r}},8:(e,t)=>{let n=rj(e,(e=>{let n=e.findIndex((e=>e.id===t.id));return-1!==n&&e.splice(n,1),e}));return{...e,...n,activationTrigger:1}}},oj=(0,c.createContext)(null);function sj(e){let t=(0,c.useContext)(oj);if(null===t){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,sj),t}return t}function aj(e,t){return lh(t.type,ij,e,t)}oj.displayName="ListboxContext";let lj=c.Fragment,cj=mh((function(e,n){let{value:r,defaultValue:i,name:o,onChange:s,by:a=((e,t)=>e===t),disabled:l=!1,horizontal:u=!1,multiple:d=!1,...h}=e;const p=u?"horizontal":"vertical";let f=Ph(n),[m,g]=gm(r,s,i),v=(0,c.useReducer)(aj,{listboxState:1,propsRef:{current:{value:m,onChange:g,mode:d?1:0,compare:Mh("string"==typeof a?(e,t)=>{let n=a;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:a)}},labelRef:(0,c.createRef)(),buttonRef:(0,c.createRef)(),optionsRef:(0,c.createRef)(),disabled:l,orientation:p,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1}),[{listboxState:y,propsRef:b,optionsRef:S,buttonRef:x},w]=v;b.current.value=m,b.current.mode=d?1:0,_h((()=>{b.current.onChange=e=>lh(b.current.mode,{0:()=>g(e),1(){let t=b.current.value.slice(),{compare:n}=b.current,r=t.findIndex((t=>n(t,e)));return-1===r?t.push(e):t.splice(r,1),g(t)}})}),[g,b]),_h((()=>w({type:2,disabled:l})),[l]),_h((()=>w({type:3,orientation:p})),[p]),rf([x,S],((e,t)=>{var n;w({type:1}),Sp(t,bp.Loose)||(e.preventDefault(),null==(n=x.current)||n.focus())}),0===y);let _=(0,c.useMemo)((()=>({open:0===y,disabled:l,value:m})),[y,l,m]),C={ref:f};return t(c).createElement(oj.Provider,{value:v},t(c).createElement(xh,{value:lh(y,{0:bh.Open,1:bh.Closed})},null!=o&&null!=m&&hm({[o]:m}).map((([e,n])=>t(c).createElement(dp,{features:up.Hidden,...gh({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:e,value:n})}))),hh({ourProps:C,theirProps:h,slot:_,defaultTag:lj,name:"Listbox"})))})),uj=mh((function(e,t){var n;let[r,i]=sj("Listbox.Button"),o=Ph(r.buttonRef,t),s=`headlessui-listbox-button-${cp()}`,a=Uh(),l=Mh((e=>{switch(e.key){case ip.Space:case ip.Enter:case ip.ArrowDown:e.preventDefault(),i({type:0}),a.nextFrame((()=>{r.propsRef.current.value||i({type:4,focus:um.First})}));break;case ip.ArrowUp:e.preventDefault(),i({type:0}),a.nextFrame((()=>{r.propsRef.current.value||i({type:4,focus:um.Last})}))}})),u=Mh((e=>{if(e.key===ip.Space)e.preventDefault()})),d=Mh((e=>{if(op(e.currentTarget))return e.preventDefault();0===r.listboxState?(i({type:1}),a.nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),i({type:0}))})),h=sm((()=>{if(r.labelRef.current)return[r.labelRef.current.id,s].join(" ")}),[r.labelRef.current,s]),p=(0,c.useMemo)((()=>({open:0===r.listboxState,disabled:r.disabled,value:r.propsRef.current.value})),[r]),f=e;return hh({ourProps:{ref:o,id:s,type:lm(e,r.buttonRef),"aria-haspopup":!0,"aria-controls":null==(n=r.optionsRef.current)?void 0:n.id,"aria-expanded":r.disabled?void 0:0===r.listboxState,"aria-labelledby":h,disabled:r.disabled,onKeyDown:l,onKeyUp:u,onClick:d},theirProps:f,slot:p,defaultTag:"button",name:"Listbox.Button"})})),dj=mh((function(e,t){let[n]=sj("Listbox.Label"),r=`headlessui-listbox-label-${cp()}`;return hh({ourProps:{ref:Ph(n.labelRef,t),id:r,onClick:Mh((()=>{var e;return null==(e=n.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))},theirProps:e,slot:(0,c.useMemo)((()=>({open:0===n.listboxState,disabled:n.disabled})),[n]),defaultTag:"label",name:"Listbox.Label"})})),hj=uh.RenderStrategy|uh.Static,pj=mh((function(e,t){var n;let[r,i]=sj("Listbox.Options"),o=Ph(r.optionsRef,t),s=`headlessui-listbox-options-${cp()}`,a=Uh(),l=Uh(),u=Sh(),d=null!==u?u===bh.Open:0===r.listboxState;(0,c.useEffect)((()=>{var e;let t=r.optionsRef.current;!t||0===r.listboxState&&t!==(null==(e=hp(t))?void 0:e.activeElement)&&t.focus({preventScroll:!0})}),[r.listboxState,r.optionsRef]);let h=Mh((e=>{switch(l.dispose(),e.key){case ip.Space:if(""!==r.searchQuery)return e.preventDefault(),e.stopPropagation(),i({type:5,value:e.key});case ip.Enter:if(e.preventDefault(),e.stopPropagation(),null!==r.activeOptionIndex){let{dataRef:e}=r.options[r.activeOptionIndex];r.propsRef.current.onChange(e.current.value)}0===r.propsRef.current.mode&&(i({type:1}),Nh().nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})})));break;case lh(r.orientation,{vertical:ip.ArrowDown,horizontal:ip.ArrowRight}):return e.preventDefault(),e.stopPropagation(),i({type:4,focus:um.Next});case lh(r.orientation,{vertical:ip.ArrowUp,horizontal:ip.ArrowLeft}):return e.preventDefault(),e.stopPropagation(),i({type:4,focus:um.Previous});case ip.Home:case ip.PageUp:return e.preventDefault(),e.stopPropagation(),i({type:4,focus:um.First});case ip.End:case ip.PageDown:return e.preventDefault(),e.stopPropagation(),i({type:4,focus:um.Last});case ip.Escape:return e.preventDefault(),e.stopPropagation(),i({type:1}),a.nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case ip.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(i({type:5,value:e.key}),l.setTimeout((()=>i({type:6})),350))}})),p=sm((()=>{var e,t,n;return null!=(n=null==(e=r.labelRef.current)?void 0:e.id)?n:null==(t=r.buttonRef.current)?void 0:t.id}),[r.labelRef.current,r.buttonRef.current]),f=(0,c.useMemo)((()=>({open:0===r.listboxState})),[r]),m=e;return hh({ourProps:{"aria-activedescendant":null===r.activeOptionIndex||null==(n=r.options[r.activeOptionIndex])?void 0:n.id,"aria-multiselectable":1===r.propsRef.current.mode||void 0,"aria-labelledby":p,"aria-orientation":r.orientation,id:s,onKeyDown:h,role:"listbox",tabIndex:0,ref:o},theirProps:m,slot:f,defaultTag:"ul",features:hj,visible:d,name:"Listbox.Options"})})),fj=mh((function(e,t){let{disabled:n=!1,value:r,...i}=e,[o,s]=sj("Listbox.Option"),a=`headlessui-listbox-option-${cp()}`,l=null!==o.activeOptionIndex&&o.options[o.activeOptionIndex].id===a,{value:u,compare:d}=o.propsRef.current,h=lh(o.propsRef.current.mode,{1:()=>u.some((e=>d(e,r))),0:()=>d(u,r)}),p=(0,c.useRef)(null),f=Ph(t,p);_h((()=>{if(0!==o.listboxState||!l||0===o.activationTrigger)return;let e=Nh();return e.requestAnimationFrame((()=>{var e,t;null==(t=null==(e=p.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})),e.dispose}),[p,l,o.listboxState,o.activationTrigger,o.activeOptionIndex]);let m=(0,c.useRef)({disabled:n,value:r,domRef:p});_h((()=>{m.current.disabled=n}),[m,n]),_h((()=>{m.current.value=r}),[m,r]),_h((()=>{var e,t;m.current.textValue=null==(t=null==(e=p.current)?void 0:e.textContent)?void 0:t.toLowerCase()}),[m,p]);let g=Mh((()=>o.propsRef.current.onChange(r)));_h((()=>(s({type:7,id:a,dataRef:m}),()=>s({type:8,id:a}))),[m,a]);let v=Mh((e=>{if(n)return e.preventDefault();g(),0===o.propsRef.current.mode&&(s({type:1}),Nh().nextFrame((()=>{var e;return null==(e=o.buttonRef.current)?void 0:e.focus({preventScroll:!0})})))})),y=Mh((()=>{if(n)return s({type:4,focus:um.Nothing});s({type:4,focus:um.Specific,id:a})})),b=Mh((()=>{n||l||s({type:4,focus:um.Specific,id:a,trigger:0})})),S=Mh((()=>{n||!l||s({type:4,focus:um.Nothing})})),x=(0,c.useMemo)((()=>({active:l,selected:h,disabled:n})),[l,h,n]);return hh({ourProps:{id:a,ref:f,role:"option",tabIndex:!0===n?void 0:-1,"aria-disabled":!0===n||void 0,"aria-selected":h,disabled:void 0,onClick:v,onFocus:y,onPointerMove:b,onMouseMove:b,onPointerLeave:S,onMouseLeave:S},theirProps:i,slot:x,defaultTag:"li",name:"Listbox.Option"})})),mj=Object.assign(cj,{Button:uj,Label:dj,Options:pj,Option:fj});var gj=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false",role:"img",className:e,fill:"currentColor","aria-label":t,children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z",clipRule:"evenodd"})});const vj={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},yj=(0,c.memo)((({defaultDate:e,onChange:t,disabled:n=!1})=>{const{t:r,i18n:i}=xe(),[o,a]=(0,c.useState)(e?"string"==typeof e?_s.DateTime.fromISO(e):_s.DateTime.fromJSDate(e):_s.DateTime.now());return(0,c.useEffect)((()=>{t(o)}),[o,t]),(0,s.jsxs)("div",{className:"memori--date-selector",children:[(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(mj,{value:o,onChange:e=>{a(e)},disabled:n,name:"day",children:[(0,s.jsxs)(mj.Label,{className:"memori--date-selector__select-label",children:[r("day"),":"]}),(0,s.jsxs)(mj.Button,{"aria-label":r("day"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:o.day}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(gj,{})})]}),(0,s.jsx)(np,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(mj.Options,{className:"memori--date-selector__select-options",children:[...Array(31).keys()].map((e=>(0,s.jsx)(mj.Option,{value:o.set({day:e+1}),className:"memori--date-selector__select-option",children:e+1},e)))})})]})}),(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(mj,{value:o,onChange:e=>{a(e)},disabled:n,name:"month",children:[(0,s.jsxs)(mj.Label,{className:"memori--date-selector__select-label",children:[r("month"),":"]}),(0,s.jsxs)(mj.Button,{"aria-label":r("month"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:vj["it"===i.language?"it":"en"][o.month-1]}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(gj,{})})]}),(0,s.jsx)(np,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(mj.Options,{className:"memori--date-selector__select-options",children:vj["it"===i.language?"it":"en"].map((e=>(0,s.jsx)(mj.Option,{className:"memori--date-selector__select-option",value:o.set({month:vj["it"===i.language?"it":"en"].findIndex((t=>t===e))+1}),children:e},e)))})})]})}),(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(mj,{value:o,onChange:e=>{a(e)},disabled:n,name:"year",children:[(0,s.jsxs)(mj.Label,{className:"memori--date-selector__select-label",children:[r("year"),":"]}),(0,s.jsxs)(mj.Button,{"aria-label":r("year"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:o.year}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(gj,{})})]}),(0,s.jsx)(np,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(mj.Options,{className:"memori--date-selector__select-options",children:[...Array(_s.DateTime.now().year-1899).keys()].sort(((e,t)=>t-e)).map((e=>(0,s.jsx)(mj.Option,{value:o.set({year:e+1900}),className:"memori--date-selector__select-option",children:e+1900},e)))})})]})})]})}));yj.displayName="DateSelector";var bj=yj;c=o("85Hg2");var Sj=({visible:e=!1,onClose:n,minAge:r})=>{const{t:i}=xe(),[o,a]=(0,c.useState)(),[l,u]=(0,c.useState)(),[d,h]=(0,c.useState)(!1),p=(0,c.useCallback)((()=>{if(h(!0),!o)return t(Ju).error(i("requiredField")),u(i("requiredField")||"Required field"),void h(!1);if(_s.DateTime.now().diff(o,"years").years<r)return t(Ju).error(i("underageTwinSession",{age:r})),u(i("underageTwinSession",{age:r})||`You must be at least ${r} years old to interact with this Twin`),void h(!1);n(o.toJSDate().toISOString())}),[o,r,n,i]);return(0,s.jsxs)(Gm,{open:e,title:i("ageVerification"),className:"age-verification-modal",closable:!0,onClose:()=>n(),children:[(0,s.jsx)("p",{children:i("ageVerificationText",{minAge:r})}),(0,s.jsxs)("form",{className:"age-verification-form",onSubmit:e=>{e.preventDefault(),p()},children:[(0,s.jsx)("div",{className:"form-item",children:(0,s.jsxs)("fieldset",{name:"birthDate",children:[(0,s.jsx)("legend",{className:"sr-only",children:i("birthDate")}),(0,s.jsx)(bj,{defaultDate:new Date(Date.now()),onChange:e=>{a(e)}}),(0,s.jsx)("p",{className:"form-item-help",children:i("birthDateHelper")}),l&&(0,s.jsx)("p",{className:"form-item-error",children:l})]})}),(0,s.jsx)("div",{className:"form-item form-submit",children:(0,s.jsx)(xf,{primary:!0,htmlType:"submit",className:"age-verification-submit",loading:d,disabled:!o,children:i("confirm")})})]})]})};c=o("85Hg2");var xj=({label:e,className:n,disabled:r=!1,indeterminate:i=!1,checked:o,children:a,onChange:l,name:u,...d})=>{const h=(0,c.useRef)(null);return(0,c.useEffect)((()=>{h.current&&(h.current.indeterminate=i)}),[h,i]),(0,s.jsxs)("label",{className:t(ws)("memori-checkbox",n,{"memori-checkbox--disabled":r,"memori-checkbox--indeterminate":i}),children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{ref:h,type:"checkbox",...d,name:u,disabled:r,checked:o||i,className:"memori-checkbox--input",onChange:l}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),!!(null==e?void 0:e.length)&&(0,s.jsx)("span",{className:"memori-checkbox--text",children:e})]})};c=o("85Hg2");var wj=({className:e,value:n,name:r,displayValue:i,options:o,onChange:a,disabled:l=!1,label:u,placeholder:d})=>(0,s.jsx)("div",{className:t(ws)("memori-select",e),children:(0,s.jsxs)(mj,{value:n,onChange:e=>{a(e)},disabled:l,name:r,children:[u&&(0,s.jsxs)(mj.Label,{className:"memori-select--label",children:[u,":"]}),(0,s.jsxs)(mj.Button,{"aria-label":u,className:"memori-select--button",children:[(0,s.jsx)("span",{className:t(ws)("memori-select--value",{"memori-select--value-placeholder":!n}),children:n?i||n:d}),(0,s.jsx)("span",{className:"memori-select--icon",children:(0,s.jsx)(gj,{})})]}),(0,s.jsx)(np,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(mj.Options,{className:"memori-select--options",children:o.map((e=>(0,s.jsx)(mj.Option,{value:e.value,className:"memori-select--option",children:e.label},e.value)))})})]})});const _j={muteSpeaker:"@memori:muteSpeaker",microphoneMode:"@memori:microphoneMode",continuousSpeechTimeout:"@memori:continuousSpeechTimeout",sendOnEnter:"@memori:sendOnEnter",birthDate:"@memori:birthDate",controlsPosition:"@memori:controlsPosition",hideEmissions:"@memori:hideEmissions",loginToken:"@memori:loginToken",location:"@memori:location"},Cj=(e,t)=>{var n;try{const r=window.localStorage.getItem(null!==(n=_j[e])&&void 0!==n?n:e);if(!r)return t;try{return JSON.parse(r)}catch(e){return r}}catch(e){return console.error("error",e),t}},Aj=(e,t)=>{var n;try{window.localStorage.setItem(null!==(n=_j[e])&&void 0!==n?n:e,t.toString())}catch(e){console.error("error",e)}},Ej=e=>{var t;try{window.localStorage.removeItem(null!==(t=_j[e])&&void 0!==t?t:e)}catch(e){console.error("error",e)}},Tj=[2,3,5,10,15,20,30,60];var Mj=({open:e,layout:t="DEFAULT",onClose:n,microphoneMode:r="HOLD_TO_TALK",continuousSpeechTimeout:i,setMicrophoneMode:o,setContinuousSpeechTimeout:a,controlsPosition:l,setControlsPosition:c,hideEmissions:u,setHideEmissions:d,additionalSettings:h})=>{const{t:p}=xe();return(0,s.jsxs)(_f,{className:"memori-settings-drawer",open:e,onClose:n,title:p("widget.settings")||"Settings",description:p("write_and_speak.settingsHeaderLabel"),children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"#microphoneMode",children:[p("write_and_speak.microphoneMode")||"Microphone mode",":"]}),(0,s.jsxs)(BS,{id:"microphoneMode",name:"microphoneMode",value:r,defaultValue:r,className:"memori-settings-drawer--microphoneMode-radio",onChange:e=>{let t="CONTINUOUS"===e?"CONTINUOUS":"HOLD_TO_TALK";o(t),Aj("microphoneMode",t)},children:[(0,s.jsx)(BS.Option,{value:"HOLD_TO_TALK",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked:e})=>(0,s.jsx)(xf,{primary:e,outlined:!e,children:p("write_and_speak.holdToSpeak")||"Hold to speak"})}),(0,s.jsx)(BS.Option,{value:"CONTINUOUS",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked:e})=>(0,s.jsx)(xf,{primary:e,outlined:!e,children:p("write_and_speak.continuousSpeechLabel")||"Continuous speech"})})]})]}),"CONTINUOUS"===r&&(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(wj,{label:p("write_and_speak.secondsLabel")||"Seconds",placeholder:p("write_and_speak.secondsLabel")||"Seconds",options:Tj.map((e=>({value:e,label:e}))),value:i,onChange:e=>{a(e),Aj("continuousSpeechTimeout",e)}})}),"TOTEM"===t&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"#controlsPosition",children:[p("write_and_speak.controlsPosition")||"Controls",":"]}),(0,s.jsxs)(BS,{id:"controlsPosition",name:"controlsPosition",value:l,defaultValue:l,className:"memori-settings-drawer--controlsposition-radio",onChange:e=>{c(e),Aj("controlsPosition",e)},children:[(0,s.jsx)(BS.Option,{value:"center",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(xf,{primary:e,outlined:!e,children:p("center")||"Center"})}),(0,s.jsx)(BS.Option,{value:"bottom",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(xf,{primary:e,outlined:!e,children:p("bottom")||"Bottom"})})]})]}),(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(xj,{label:p("write_and_speak.hideEmissionsLabel")||"Hide emissions",name:"hideControls",checked:u,onChange:e=>{d(e.target.checked),Aj("hideEmissions",e.target.checked)}})})]}),h&&(0,s.jsx)("div",{className:"memori-settings-drawer--field controls",children:h})]})};c=o("85Hg2");var Ij=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"})});var Rj=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M15 18L9 12 15 6"})});var Pj=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M9 18L15 12 9 6"})});var kj=({apiURL:e,sessionID:n,memori:r,visible:i=!0,initialKnownFacts:o=[],closeDrawer:a})=>{var l;const{t:u}=xe(),d=Y(e),{getKnownFactsPaginated:h,deleteKnownFact:p}=d.knownFacts,[f,m]=(0,c.useState)(o),[g,v]=(0,c.useState)(25),[y,b]=(0,c.useState)(0),[S,x]=(0,c.useState)(null!==(l=null==o?void 0:o.length)&&void 0!==l?l:0),[w,_]=(0,c.useState)(!1),C=async(e,r,i)=>{if(n||e){_(!0);try{const{knownFacts:o,count:s,...a}=await h(null!=e?e:n,null!=r?r:y,null!=i?i:g);m(null!=o?o:[]),x(null!=s?s:0),0!==a.resultCode&&(console.error(a),t(Ju).error(u(Hv(a.resultCode))))}catch(e){console.error("KNOWN_FACTS/FETCH",e),m(null!=o?o:[])}_(!1)}};(0,c.useEffect)((()=>{C()}),[]);const[A,E]=(0,c.useState)(!1),[T,M]=(0,c.useState)(),[I,R]=(0,c.useState)([]);return(0,s.jsxs)(_f,{open:i,width:"80%",className:"memori-known-facts-drawer",onClose:()=>a(),title:u("knownFacts.title"),children:[(0,s.jsx)("p",{children:u("knownFacts.description",{memoriName:r.name})}),(0,s.jsxs)(Sf,{spinning:w,children:[(0,s.jsxs)("div",{className:"memori-known-facts-actions",children:[(0,s.jsxs)(xf,{primary:!0,danger:!0,onClick:()=>{E(!0)},className:"memori-known-facts-delete-selected",disabled:0===(null==I?void 0:I.length),icon:(0,s.jsx)(Ij,{}),loading:w,children:[u("selected")," (",null==I?void 0:I.length,")"]}),(0,s.jsx)(Gm,{className:"memori-known-facts-modal",open:A,closable:!0,title:I.length>1?u("knownFacts.deleteSelectedConfirmTitle"):u("knownFacts.deleteConfirmTitle"),description:I.length>1?u("knownFacts.deleteSelectedConfirmMessage",{number:I.length}):u("knownFacts.deleteConfirmMessage"),onClose:()=>{E(!1)},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(xf,{ghost:!0,onClick:()=>{E(!1)},children:u("cancel")}),(0,s.jsx)(xf,{primary:!0,danger:!0,onClick:async()=>{try{const e=I.map((e=>p(n,e)));Promise.all(e).then((e=>{if(e.every((e=>0===e.resultCode)))t(Ju).success(u("knownFacts.deleteSuccess")),R([]),C(),E(!1);else{let n=e.find((e=>0!==e.resultCode));console.error(n),void 0!==(null==n?void 0:n.resultCode)&&t(Ju).error(u(Hv(null==n?void 0:n.resultCode)))}}))}catch(e){let n=e;t(Ju).error(u("Error")+n.message)}},children:u("confirm")})]})})]}),S>25&&(0,s.jsxs)("nav",{className:"memori--table--pagination",children:[S>g&&(0,s.jsxs)("div",{className:"memori--table--pagination--pages",children:[(0,s.jsx)(xf,{shape:"circle",disabled:0===y||y<g,padded:!1,title:u("previous")||"Previous",icon:(0,s.jsx)(Rj,{}),onClick:()=>{let e=(y/g-1)*g;b(e),C(void 0,e,g)}}),(0,s.jsxs)("span",{className:"memori--table--pagination--pages--current",children:[Math.ceil(y/g)+1," /"," ",Math.ceil(S/g)]}),(0,s.jsx)(xf,{shape:"circle",padded:!1,title:u("next")||"Next",icon:(0,s.jsx)(Pj,{}),disabled:(y/g+1)*g>=S,onClick:()=>{let e=(y/g+1)*g;b(e),C(void 0,e,g)}})]}),(0,s.jsx)(wj,{options:[{label:`25 / ${u("page")||"page"}`,value:25},{label:`50 / ${u("page")||"page"}`,value:50},{label:`100 / ${u("page")||"page"}`,value:100}],value:g,displayValue:`${g} / ${u("page")||"page"}`,onChange:e=>{v(e),b(0),C(void 0,0,e)}})]}),(0,s.jsxs)("table",{className:"memori--table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"memori--table--column-centered",children:(0,s.jsx)(xj,{checked:!!(null==f?void 0:f.length)&&(null==I?void 0:I.length)===f.length,indeterminate:!!(null==f?void 0:f.length)&&!!(null==I?void 0:I.length)&&(null==I?void 0:I.length)!==(null==f?void 0:f.length),onChange:e=>{e.target.checked?R(f.map((e=>e.knownFactID))):R([])}})}),(0,s.jsx)("th",{children:u("knownFacts.text")}),(0,s.jsx)("th",{className:"mobile-hidden",children:u("createdAt")}),(0,s.jsx)("th",{className:"memori--table--column-right",children:u("actions")})]})}),(0,s.jsx)("tbody",{children:f.map((e=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"memori--table--column-centered",children:(0,s.jsx)(xj,{checked:null==I?void 0:I.includes(e.knownFactID),onChange:t=>{t.target.checked?R((t=>[...new Set([...t,e.knownFactID])])):R((t=>t.filter((t=>t!==e.knownFactID))))}})}),(0,s.jsx)("td",{children:e.text}),(0,s.jsx)("td",{className:"mobile-hidden",children:(0,s.jsx)("span",{className:"memori--table--date",children:e.creationTimestamp?new Intl.DateTimeFormat("it",{dateStyle:"short",timeStyle:"short"}).format(new Date(e.creationTimestamp)):"-"})}),(0,s.jsx)("td",{className:"memori--table--column-right",children:(0,s.jsxs)("div",{className:"memori--table--action-column",children:[(0,s.jsx)(xf,{danger:!0,ghost:!0,shape:"circle",icon:(0,s.jsx)(Ij,{}),disabled:(null==I?void 0:I.length)>0,title:u("delete")||"Delete",onClick:()=>M(e.knownFactID)}),(0,s.jsx)(Gm,{className:"memori-known-facts-modal",open:T===e.knownFactID,closable:!0,title:u("knownFacts.deleteConfirmTitle"),description:u("knownFacts.deleteConfirmMessage"),onClose:()=>{M(void 0)},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(xf,{ghost:!0,onClick:()=>{M(void 0)},children:u("cancel")}),(0,s.jsx)(xf,{primary:!0,danger:!0,onClick:async()=>{try{const r=await p(n,e.knownFactID);0===r.resultCode?(t(Ju).success(u("knownFacts.deleteSuccess")),R([]),C(),M(void 0)):(console.error(r),t(Ju).error(u(Hv(r.resultCode),{ns:"common"})))}catch(e){let n=e;t(Ju).error(u("Error")+n.message)}},children:u("confirm")})]})})]})})]},e.knownFactID)))})]})]})]})};var Oj=({open:e=!1,baseUrl:t,apiUrl:n,tenant:r,experts:i,onClose:o})=>{const{t:a}=xe();return(0,s.jsx)(_f,{open:e,onClose:o,className:"memori--experts-drawer",title:(0,s.jsx)("h2",{className:"memori--experts-drawer--title",children:a("widget.expertsInTheBoard")}),children:(0,s.jsx)("ul",{className:"memori--experts-drawer--list",children:i.map((e=>(0,s.jsxs)("li",{className:"memori--experts-drawer--item",children:[(0,s.jsx)("figure",{className:"memori--experts-drawer--avatar",children:(0,s.jsx)("img",{src:`${n}/api/v1/memoriai/memori/avatar/${e.expertMemoriID}`,alt:e.name,onError:e=>{e.currentTarget.src=hv({tenantID:null==r?void 0:r.id,type:"avatar",baseURL:t}),e.currentTarget.onerror=null}})}),(0,s.jsxs)("div",{className:"memori--experts-drawer--content",children:[(0,s.jsx)("h3",{className:"memori--experts-drawer--name",children:e.name}),(0,s.jsx)("p",{className:"memori--experts-drawer--description",children:e.description})]})]},e.expertID)))})})};c=o("85Hg2"),c=o("85Hg2");const Nj=["memori","private","public","api","404","500","it","en","account","auth","logout","privacy_and_cookie","unauthorized","users","virtual_spaces"];var Lj=({tenant:e,apiUrl:n,onLogin:r,goToLogin:i,__TEST__waitingForOtp:o=!1})=>{const{t:a,i18n:l}=xe(),u="it"===l.language?"it":"en",d=Y(n),{userSignUp:h,userConfirmSignUp:p,resendVerificationCode:f}=d.backend,[m,g]=(0,c.useState)(),[v,y]=(0,c.useState)(),[b,S]=(0,c.useState)(),[x,w]=(0,c.useState)(),_=!b||b&&$f.test(b),C=_&&b&&b.length>=24,A=!b||0===b.length,E=!_||A?0:b.length<8?15:b.length>=32?100:(b.length-8)*(50/24)+50,[T,M]=(0,c.useState)(!1),[I,R]=(0,c.useState)(!1),[P,k]=(0,c.useState)(o),[O,N]=(0,c.useState)(null),[L,D]=(0,c.useState)();(0,c.useEffect)((()=>{D(window.location.href)}),[]);return P?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async n=>{var i,o,s;n.preventDefault();const l=n.currentTarget,c=null!==(i=l.tenant.value)&&void 0!==i?i:e.id,u=null!==(o=l.userName.value)&&void 0!==o?o:v,d=null!==(s=l.password.value)&&void 0!==s?s:b,h=l.verificationCode.value;M(!0),N(null);try{const{user:e,token:n,...i}=await p({tenant:c,userName:u,password:d,verificationCode:h});0!==i.resultCode?(console.error(i),t(Ju).error(a(Hv(i.resultCode)))):e&&n&&(t(Ju).success(a("success")),r(e,n))}catch(e){let n=e;console.error("[validate otp]",n),(null==n?void 0:n.message)&&t(Ju).error(n.message)}finally{M(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"userName",value:v}),(0,s.jsx)("input",{type:"hidden",name:"password",value:b}),(0,s.jsx)("input",{type:"hidden",name:"tenant",value:e.id}),(0,s.jsxs)("label",{htmlFor:"#verificationCode",children:[a("login.otpCode"),(0,s.jsx)("input",{id:"verificationCode",name:"verificationCode",type:"text",required:!0,autoComplete:"one-time-code",placeholder:a("login.otpCode")||"OTP"})]}),(0,s.jsx)("p",{children:(0,s.jsx)(xf,{outlined:!0,onClick:async n=>{if(n.preventDefault(),v){R(!0);try{const n=await f({tenant:null==e?void 0:e.id,userName:v});0===n.resultCode?t(Ju).success(a("resentVerificationCode")):(console.error(n),t(Ju).error(a(Hv(n.resultCode))))}catch(e){let n=e;console.error("[resend otp]",n),(null==n?void 0:n.message)&&t(Ju).error(n.message)}finally{R(!1)}}},loading:I,children:a("login.resendVerificationCode")})}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:T,children:a("confirm")})]}),O&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:O})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async n=>{var r,i,o,s,l,c,u;n.preventDefault();const d=n.currentTarget,p=null!==(r=d.tenant.value)&&void 0!==r?r:e.id,f=(null!==(i=d.eMail.value)&&void 0!==i?i:m).toLowerCase(),g=null!==(o=d.userName.value)&&void 0!==o?o:v,y=d.password.value,b=new Date(null===(s=d.birthDate)||void 0===s?void 0:s.value).toISOString(),S=null===(l=d.tnCAndPPAccepted)||void 0===l?void 0:l.checked,x=null===(c=d.pAndCUAccepted)||void 0===c?void 0:c.checked,w=null===(u=d.referral)||void 0===u?void 0:u.value;if(!(f&&g&&y&&b&&S))return void N(a("missingData"));M(!0),N(null);if(((new Date).getTime()-new Date(b).getTime())/1e3/60/60/24/365<14)return t(Ju).error(a("login.underage",{age:14})),void N(a("login.underage",{age:14}));try{const{user:e,...n}=await h({tenant:p,eMail:f,userName:g,password:y,birthDate:b,tnCAndPPAccepted:S,tnCAndPPAcceptanceDate:(new Date).toISOString(),pAndCUAccepted:x,pAndCUAcceptanceDate:(new Date).toISOString(),referral:w});0!==n.resultCode?(console.error(n),t(Ju).error(a(Hv(n.resultCode)))):e&&(t(Ju).success(a("success")),k(!0))}catch(e){let n=e;console.error("[signup]",n),(null==n?void 0:n.message)&&t(Ju).error(n.message)}finally{M(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"tenant",value:e.id}),(0,s.jsx)("input",{type:"hidden",name:"referral",value:L}),(0,s.jsxs)("label",{htmlFor:"#eMail",children:[a("login.email"),(0,s.jsx)("input",{type:"email",name:"eMail",id:"eMail",required:!0,autoComplete:"email",placeholder:a("login.email")||"Email",onChange:e=>g(e.target.value),"aria-invalid":!!(null==m?void 0:m.length)&&!em.test(m)})]}),!!(null==m?void 0:m.length)&&!em.test(m)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.emailFormatError")}),(0,s.jsxs)("label",{htmlFor:"userName",children:[a("login.username"),(0,s.jsx)("input",{type:"text",name:"userName",id:"userName",required:!0,autoComplete:"username",placeholder:a("login.username")||"Username",onFocus:()=>{if(!(null==v?void 0:v.length)&&(null==m?void 0:m.length)){let e=(e=>e.split("@")[0].replace(/[^a-zA-Z0-9]/g,""))(m);const t=document.getElementById("userName");t&&(t.value=e,y(e))}},onChange:e=>y(e.target.value),"aria-invalid":!!(null==v?void 0:v.length)&&(Nj.includes(v.toLowerCase())||!tm.test(v))})]}),!!(null==v?void 0:v.length)&&Nj.includes(v.toLowerCase())&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.usernameContainsReservedWord")}),!!(null==v?void 0:v.length)&&!tm.test(v)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.usernameFormatError")}),(0,s.jsxs)("label",{htmlFor:"#birthDate",children:[a("login.birthDate"),(0,s.jsx)("input",{id:"birthDate",name:"birthDate",type:"date",required:!0,autoComplete:"bday"})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:a("login.birthDateHelper")})}),(0,s.jsxs)("label",{htmlFor:"#password",children:[a("login.password"),(0,s.jsx)("input",{id:"password",name:"password",type:"password",required:!0,autoComplete:"new-password",placeholder:a("login.password")||"Password",onChange:e=>S(e.target.value),"aria-invalid":!_})]}),!_&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[a("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:a("login.confirmPassword")||"Password",onChange:e=>w(e.target.value),"aria-invalid":!!(null==b?void 0:b.length)&&!!(null==x?void 0:x.length)&&b!==x})]}),!!(null==b?void 0:b.length)&&!!(null==x?void 0:x.length)&&b!==x&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:E,id:"password-strength-meter"}),(0,s.jsx)("small",{children:a("login.pwd"+(C?"Strong":_?"Acceptable":"Weak"))}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",required:!0,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[a("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${u}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:a("login.privacyAndCookiePolicy")})," ",a("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${u}/tos`,target:"_blank",rel:"noopener noreferrer",children:a("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[a("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",a("login.optional"),")"]})})]})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:a("login.deepThoughtExplaination")})}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:T,children:a("login.signUp")}),(0,s.jsxs)("p",{className:"memori--login-drawer--signup",children:[a("login.alreadyHaveAnAccount")," ",(0,s.jsx)(xf,{outlined:!0,onClick:i,children:a("login.backToLogin")})]})]}),O&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:O})]})};c=o("85Hg2");const Dj=["image/jpeg","image/png","image/jpg","image/gif"];var Bj=({user:e,loginToken:n,apiUrl:r,onUserUpdate:i})=>{const{t:o,i18n:a}=xe(),l="it"===a.language?"it":"en",u=Y(r),{updateUser:d,uploadAsset:h}=u.backend,[p,f]=(0,c.useState)(),[m,g]=(0,c.useState)(),[v,y]=(0,c.useState)(),b=!m||m&&$f.test(m),S=b&&m&&m.length>=24,x=!m||0===m.length,w=!b||x?0:m.length<8?15:m.length>=32?100:(m.length-8)*(50/24)+50,[_,C]=(0,c.useState)(!1),[A,E]=(0,c.useState)(null),T=async(e,r)=>{try{const{user:s,...a}=await d(n,e,r);0!==a.resultCode?(console.error(a),t(Ju).error(o(Hv(a.resultCode)))):s&&(t(Ju).success(o("success")),i(s))}catch(e){let n=e;console.error("[signup]",n),(null==n?void 0:n.message)&&t(Ju).error(n.message)}finally{C(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{className:"memori--login-drawer--edit-account-title",children:o("login.editAccount")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form memori--login-drawer--account-form",onSubmit:async r=>{var i,s,a,l,c;if(r.preventDefault(),!e.userID)return;const u=e.userID,d=r.currentTarget,f=null!==(i=d.eMail.value)&&void 0!==i?i:p,g=null!==(s=d.newPassword.value)&&void 0!==s?s:m,v=d.password.value,y=d.confirmPassword.value,b=null===(a=d.pAndCUAccepted)||void 0===a?void 0:a.checked,S=null===(c=null===(l=d.avatar)||void 0===l?void 0:l.files)||void 0===c?void 0:c[0];if(C(!0),E(null),(null==g?void 0:g.length)&&g!==y)return E(o("login.passwordMatchingError")),void C(!1);let x={...(null==f?void 0:f.length)&&f!==e.eMail?{eMail:f}:{},...g?{password:v,newPassword:g}:{},...void 0!==b&&b!==e.pAndCUAccepted?{pAndCUAccepted:b,pAndCUAcceptanceDate:(new Date).toISOString()}:{}};if(0===Object.values(x).length&&!S)return console.debug("No changes to submit"),void C(!1);if(S){const e=new FileReader;e.onload=async e=>{var r,i;try{const{asset:s,...a}=await h(null!==(r=S.name)&&void 0!==r?r:"avatar",null===(i=e.target)||void 0===i?void 0:i.result,n);0!==a.resultCode?(console.error(a),t(Ju).error(o(Hv(a.resultCode)))):s&&(x.avatarURL=s.assetURL,await T(u,x))}catch(e){let n=e;console.error("[avatar upload]",n),(null==n?void 0:n.message)&&t(Ju).error(n.message)}},e.readAsDataURL(S)}else await T(u,x)},children:[(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.emailChange")}),(0,s.jsxs)("label",{htmlFor:"#eMail",children:[o("login.email"),(0,s.jsx)("input",{type:"email",name:"eMail",id:"eMail",autoComplete:"email",placeholder:e.eMail,onChange:e=>f(e.target.value),"aria-invalid":!!(null==p?void 0:p.length)&&!em.test(p)})]}),!!(null==p?void 0:p.length)&&!em.test(p)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.emailFormatError")})]}),(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.passwordChange")}),(0,s.jsxs)("label",{htmlFor:"#password",children:[o("login.currentPassword"),(0,s.jsx)("input",{id:"password",name:"password",type:"password",autoComplete:"password",placeholder:o("login.currentPassword")||"Password"})]}),(0,s.jsxs)("label",{htmlFor:"#newPassword",children:[o("login.newPassword"),(0,s.jsx)("input",{id:"newPassword",name:"newPassword",type:"password",autoComplete:"new-password",placeholder:o("login.password")||"Password",onChange:e=>g(e.target.value),"aria-invalid":!b})]}),!b&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[o("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",autoComplete:"new-password",placeholder:o("login.confirmPassword")||"Password",onChange:e=>y(e.target.value),"aria-invalid":!!(null==m?void 0:m.length)&&!!(null==v?void 0:v.length)&&m!==v})]}),!!(null==m?void 0:m.length)&&!!(null==v?void 0:v.length)&&m!==v&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:w,id:"password-strength-meter"}),(0,s.jsx)("small",{children:o("login.pwd"+(S?"Strong":b?"Acceptable":"Weak"))})]}),(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.avatarChange")}),(0,s.jsxs)("label",{htmlFor:"#avatar",children:["Avatar",(0,s.jsx)("input",{type:"file",name:"avatar",id:"avatar",accept:Dj.join(", "),placeholder:e.avatarURL})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox memori-checkbox--disabled",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",disabled:!0,defaultChecked:e.tnCAndPPAccepted,checked:e.tnCAndPPAccepted,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[o("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${l}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:o("login.privacyAndCookiePolicy")})," ",o("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${l}/tos`,target:"_blank",rel:"noopener noreferrer",children:o("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",className:"memori-checkbox--input",defaultChecked:e.pAndCUAccepted}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsx)(mv,{align:"left",content:o("login.deepThoughtExplaination"),children:(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[o("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",o("login.optional"),")"]})})]})})]}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:_,children:o("login.save")})]}),A&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:A})]})};var zj=({open:e=!1,onClose:n,onLogin:r,onLogout:i,user:o,loginToken:a,tenant:l,apiUrl:u,__TEST__signup:d=!1,__TEST__needMissingData:h=!1,__TEST__waitingForOtp:p=!1,__TEST__changePwd:f=!1})=>{var m,g;const{t:v,i18n:y}=xe(),b="it"===y.language?"it":"en",S=Y(u),{userLogin:x,updateUser:w}=S.backend,_=(null==o?void 0:o.userID)&&a,[C,A]=(0,c.useState)(!1),[E,T]=(0,c.useState)(null),[M,I]=(0,c.useState)(d),[R,P]=(0,c.useState)(f?{flowID:"flowID",tenant:l.id,eMail:"email",userName:"username",password:"password"}:void 0),[k,O]=(0,c.useState)(h?{token:"token",birthDate:!0,tnCAndPPAccepted:!0}:{}),[N,L]=(0,c.useState)(),[D,B]=(0,c.useState)(),z=!N||N&&$f.test(N),F=z&&N&&N.length>=24,U=!N||0===N.length,j=!z||U?0:N.length<8?15:N.length>=32?100:(N.length-8)*(50/24)+50;return(0,s.jsx)(_f,{open:e,onClose:n,className:t(ws)("memori--login-drawer",{"memori--login-drawer--logged":_,"memori--login-drawer--signup":M}),title:(0,s.jsx)("span",{className:"memori--login-drawer--title",children:_?v("login.loggedDrawerTitle",{name:o.userName}):v(M?"login.signupDrawerTitle":"login.loginDrawerTitle")}),children:_?(0,s.jsxs)("div",{className:"memori--login-drawer--logged",children:[o.avatarURL&&(0,s.jsx)("figure",{className:"memori--login-drawer--avatar",children:(0,s.jsx)("img",{src:o.avatarURL,alt:o.userName})}),(0,s.jsx)(xf,{primary:!0,onClick:()=>{i()},children:v("login.logout")}),(0,s.jsx)(Bj,{user:o,loginToken:a,apiUrl:u,onUserUpdate:e=>r(e,a)})]}):(null===(m=null==k?void 0:k.token)||void 0===m?void 0:m.length)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{children:v("login.missingData")}),(0,s.jsx)("p",{children:v("login.missingDataHelper")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async e=>{var n,i,s;e.preventDefault();const a=e.currentTarget,l=null===(n=a.birthDate)||void 0===n?void 0:n.value,c=null===(i=a.tnCAndPPAccepted)||void 0===i?void 0:i.checked,u=null===(s=a.pAndCUAccepted)||void 0===s?void 0:s.checked;if(!(null==o?void 0:o.userID)||!(null==k?void 0:k.token))return;if(!l||!c)return void T(v("missingData"));let d={userID:o.userID,birthDate:(null==o?void 0:o.birthDate)||!k.birthDate?void 0:l,tnCAndPPAccepted:c||(null==o?void 0:o.tnCAndPPAccepted),tnCAndPPAcceptanceDate:c?(new Date).toISOString():void 0,pAndCUAccepted:u||(null==o?void 0:o.pAndCUAccepted),pAndCUAcceptanceDate:u?(new Date).toISOString():void 0};const{user:h,...p}=await w(k.token,o.userID,d);0!==p.resultCode?(console.error(p),t(Ju).error(v(Hv(p.resultCode))),T(p.resultMessage)):(t(Ju).success(v("success")),r(h||d,k.token))},children:[k.birthDate&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("label",{htmlFor:"#birthDate",children:[v("login.birthDate"),(0,s.jsx)("input",{id:"birthDate",name:"birthDate",type:"date",required:!0,autoComplete:"bday"})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.birthDateHelper")})})]}),(null==k?void 0:k.tnCAndPPAccepted)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[v("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${b}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:v("login.privacyAndCookiePolicy")})," ",v("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${b}/tos`,target:"_blank",rel:"noopener noreferrer",children:v("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",defaultChecked:null==o?void 0:o.pAndCUAccepted,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[v("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",v("login.optional"),")"]})})]})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.goToAccountToChangeYourPreferences")})}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.deepThoughtExplaination")})})]}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:C,children:v("login.save")})]})]}):(null==R?void 0:R.flowID)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:v("login.mustChangePassword")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async e=>{var n,i,o,s,a;e.preventDefault();const c=e.currentTarget,u=null!==(n=c.tenant.value)&&void 0!==n?n:l.id,d=null!==(i=c.flowID.value)&&void 0!==i?i:null==R?void 0:R.flowID,h=null!==(o=c.eMail.value)&&void 0!==o?o:null==R?void 0:R.eMail,p=null!==(s=c.userName.value)&&void 0!==s?s:null==R?void 0:R.userName,f=null!==(a=c.password.value)&&void 0!==a?a:null==R?void 0:R.password,m=c.newPassword.value;if(!(null==m?void 0:m.length)||!z)return void T(v("login.passwordFormatError"));A(!0);const g={tenant:u,flowID:d,eMail:h,userName:p,password:f,newPassword:m};try{const{user:e,token:n,...i}=await x(g);0!==i.resultCode?(console.error(i),t(Ju).error(v(Hv(i.resultCode))),T(i.resultMessage)):e&&n&&(t(Ju).success(v("success")),r(e||g,n))}catch(e){let n=e;console.error("[LOGIN/CHANGE PWD]",n),n.message&&(t(Ju).error(n.message),T(n.message))}finally{A(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"tenant",value:null!==(g=R.tenant)&&void 0!==g?g:null==l?void 0:l.id}),(0,s.jsx)("input",{type:"hidden",name:"flowID",value:R.flowID}),(0,s.jsx)("input",{type:"hidden",name:"eMail",value:R.eMail}),(0,s.jsx)("input",{type:"hidden",name:"userName",value:R.userName}),(0,s.jsx)("input",{type:"hidden",name:"password",value:R.password}),(0,s.jsxs)("label",{htmlFor:"#newPassword",children:[v("login.password"),(0,s.jsx)("input",{id:"newPassword",name:"newPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:v("login.password")||"Password",onChange:e=>L(e.target.value),"aria-invalid":!z})]}),!z&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:v("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[v("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:v("login.confirmPassword")||"Password",onChange:e=>B(e.target.value),"aria-invalid":!!(null==N?void 0:N.length)&&!!(null==D?void 0:D.length)&&N!==D})]}),!!(null==N?void 0:N.length)&&!!(null==D?void 0:D.length)&&N!==D&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:v("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:j,id:"password-strength-meter"}),(0,s.jsx)("small",{children:v("login.pwd"+(F?"Strong":z?"Acceptable":"Weak"))}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:C,children:v("confirm")})]})]}):M?(0,s.jsx)(Lj,{tenant:l,apiUrl:u,onLogin:r,goToLogin:()=>I(!1),__TEST__waitingForOtp:p}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:e=>{e.preventDefault();const n=e.currentTarget,i=n.userNameOrEmail.value,o=n.password.value,s=em.test(i),a=s?{tenant:null==l?void 0:l.id,eMail:i,password:o}:{tenant:null==l?void 0:l.id,userName:i,password:o};A(!0),T(null),x(a).then((e=>{var n,a,c,u,d;-14===e.resultCode?P({tenant:l.id,eMail:s?i:void 0,userName:s?void 0:i,password:o,flowID:e.flowID||(null===(n=e.user)||void 0===n?void 0:n.flowID)}):0!==e.resultCode?(console.error(e),t(Ju).error(v(Hv(e.resultCode))),T(e.resultMessage)):e.user&&e.token&&((null===(a=e.user)||void 0===a?void 0:a.tnCAndPPAccepted)&&(null===(c=e.user)||void 0===c?void 0:c.birthDate)?r(e.user,e.token):O({token:e.token,birthDate:!(null===(u=e.user)||void 0===u?void 0:u.birthDate),tnCAndPPAccepted:!(null===(d=e.user)||void 0===d?void 0:d.tnCAndPPAccepted)}))})).catch((e=>{console.error("[LOGIN]",e),e.message&&(t(Ju).error(e.message),T(e.message))})).finally((()=>{A(!1)}))},children:[(0,s.jsxs)("label",{htmlFor:"#userNameOrEmail",children:[v("login.userNameOrEmail"),(0,s.jsx)("input",{id:"userNameOrEmail",name:"userNameOrEmail",required:!0,autoComplete:"email",placeholder:"Username/email"})]}),(0,s.jsxs)("label",{htmlFor:"#password",children:["Password",(0,s.jsx)("input",{id:"password",name:"password",type:"password",required:!0,autoComplete:"password",placeholder:"Password"})]}),(0,s.jsx)(xf,{htmlType:"submit",primary:!0,loading:C,children:v("login.login")}),(null==l?void 0:l.disableRegistration)?l.adminEmail?(0,s.jsxs)("div",{className:"memori--login-drawer--signup",children:[(0,s.jsx)("p",{children:v("login.registrationDisabled")}),(0,s.jsxs)("p",{children:[v("login.contactAdmin"),":"," ",(0,s.jsx)("a",{href:`mailto:${l.adminEmail}`,children:l.adminEmail})]})]}):null:(0,s.jsxs)("p",{className:"memori--login-drawer--signup",children:[v("login.newUserSignUp")," ",(0,s.jsx)(xf,{outlined:!0,onClick:()=>I(!0),children:v("login.signUp")})]})]}),E&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:E})]})})};var Fj=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,ChangeMode:d,changeModeProps:h,sessionId:p,hasUserActivatedSpeak:f,showInstruct:m=!1,loading:g=!1,poweredBy:v})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(Sf,{spinning:g,children:[m&&d&&h&&(0,s.jsx)(d,{...h}),e&&t&&(0,s.jsx)(e,{...t}),(0,s.jsxs)("div",{className:"memori--grid",children:[(0,s.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[n&&r&&(0,s.jsx)(n,{...r}),(0,s.jsx)("div",{id:"extension"})]}),(0,s.jsx)("div",{className:"memori--grid-column memori--grid-column-right",children:p&&f&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null}),v]})]})]});var Uj=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,ChangeMode:d,changeModeProps:h,sessionId:p,hasUserActivatedSpeak:f,showInstruct:m=!1,loading:g=!1,poweredBy:v})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(Sf,{spinning:g,className:"memori-totem-layout",children:[v,m&&d&&h&&(0,s.jsx)(d,{...h}),(0,s.jsx)("div",{className:"memori-totem-layout--header",children:e&&t&&(0,s.jsx)(e,{...t})}),(0,s.jsx)("div",{className:"memori-totem-layout--avatar",children:n&&r&&(0,s.jsx)(n,{...r})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-totem-layout--controls",children:p&&f&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null})]})]});var jj=({Header:e,headerProps:t,Chat:n,chatProps:r,StartPanel:i,startPanelProps:o,integrationStyle:a,integrationBackground:l,ChangeMode:c,changeModeProps:u,sessionId:d,hasUserActivatedSpeak:h,showInstruct:p=!1,loading:f=!1,poweredBy:m})=>(0,s.jsxs)(s.Fragment,{children:[a,l,(0,s.jsxs)(Sf,{spinning:f,className:"memori-chat-layout",children:[m,p&&c&&u&&(0,s.jsx)(c,{...u}),(0,s.jsx)("div",{className:"memori-chat-layout--header",children:e&&t&&(0,s.jsx)(e,{...t})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-chat-layout--controls",children:d&&h&&n&&r?(0,s.jsx)(n,{...r}):o?(0,s.jsx)(i,{...o}):null})]})]});c=o("85Hg2"),c=o("85Hg2");var Hj=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:u,ChangeMode:d,changeModeProps:h,sessionId:p,hasUserActivatedSpeak:f,showInstruct:m=!1,loading:g=!1,poweredBy:v})=>{var y,b;const{t:S}=xe(),[x,w]=(0,c.useState)(!0),[_,C]=(0,c.useState)(),A=(0,c.useMemo)((()=>null==o?void 0:o.stopAudio),[null==o?void 0:o.stopAudio]),E=e=>{w(e),C(e?void 0:(new Date).toISOString());try{null==A||A()}catch(e){console.log(e)}};return(0,s.jsx)("div",{className:"memori-website_assistant--"+(x?"collapsed":"expanded"),children:x?(0,s.jsx)("div",{className:"memori-website_assistant--trigger",children:(0,s.jsx)(xf,{className:"memori-website_assistant--trigger-button",ghost:!0,shape:"circle",onClick:()=>E(!1),title:S("expand")||"Expand",children:(0,s.jsx)(HF,{avatar:null==r?void 0:r.memori.avatarURL})})}):(0,s.jsxs)(s.Fragment,{children:[u,(0,s.jsxs)(Sf,{spinning:g,className:"memori-website_assistant-layout",children:[v,(0,s.jsx)("div",{className:"memori-website_assistant--close-button-wrapper",children:(0,s.jsx)(xf,{className:"memori-website_assistant--close-button",primary:!0,shape:"circle",onClick:()=>E(!0),icon:(0,s.jsx)(wf,{}),title:S("close")||"Close"})}),m&&d&&h&&(0,s.jsx)(d,{...h}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--header",children:e&&t&&(0,s.jsx)(e,{...t,showSettings:!1,showReload:!1})}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--avatar",children:n&&r&&(0,c.createElement)(n,{...r,integrationConfig:r.integrationConfig?{...r.integrationConfig,avatarURL:(null===(y=r.integrationConfig)||void 0===y?void 0:y.avatarURL)?`${null===(b=r.integrationConfig)||void 0===b?void 0:b.avatarURL.split("#")[0]}#${_}`:void 0}:{},key:_})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--controls",children:p&&f&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null})]})]})})};const{deleteSession:Gj,getStatistics:Vj,initSession:Wj}=Y(),qj=new Map([[0,"🆕"],[10,"🐹"],[20,"🐇"],[30,"🐰"],[40,"💡"],[50,"🏆"],[60,"🏅"],[70,"🥉"],[80,"🥈"],[90,"🥇"],[100,"🔥"],[110,"🎓"],[120,"🤖"],[130,"👾"],[150,"🌍"],[180,"💜"],[200,"💙"],[250,"🧡"],[300,"💚"],[350,"💛"],[400,"💖"],[450,"💝"],[500,"🖤"],[550,"❤️"],[600,"🧠"]]),Kj=e=>{const t=Array.from(qj.keys()).filter((t=>t<=e));if(t.length>0){const e=t[t.length-1];return qj.get(e)}return""},Jj=e=>{if("🆕"===e)return{points:10,badge:"🐹"};let t,n,r=!1;for(const[i,o]of qj){if(r){t=i,n=o;break}o===e&&(r=!0)}return n&&t?{points:t,badge:n}:void 0},Qj=e=>{let t=0;for(const[n,r]of qj)if(r===e){t=n;break}return t},Yj=e=>{const t=Math.round(e),n=Kj(t);return{points:t,badge:n,pointsForCurrentBadge:Qj(n),nextBadge:Jj(n)}},Zj=(e,t=!0,n=!1,r,i=!1,o=!1)=>{const s=new CustomEvent("MemoriTextEntered",{detail:{text:e,waitForPrevious:t,hidden:n,typingText:r,useLoaderTextAsMsg:i,hasBatchQueued:o}});document.dispatchEvent(s);window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak"))}),300)};let Xj,$j,eH,tH,nH,rH;window.getMemoriState=e=>{var t,n,r,i,o;let s=e?document.querySelector(`.memori-widget[data-memori-integration="${e}"]`)||(null===(n=null===(t=document.querySelector("memori-client"))||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector(".memori-widget[data-memori-integration]")):document.querySelector(".memori-widget")||(null===(i=null===(r=document.querySelector("memori-client"))||void 0===r?void 0:r.shadowRoot)||void 0===i?void 0:i.querySelector(".memori-widget"));if(!s)return null;let a=null===(o=s.dataset)||void 0===o?void 0:o.memoriEngineState;return a?JSON.parse(a):null},window.typeMessage=Zj,window.typeMessageHidden=(e,t=!0,n,r=!1,i=!1)=>Zj(e,t,!0,n,r,i),window.typeBatchMessages=e=>{function t(){var e,t,n,r;null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e||e.setAttribute("disabled","");const i="opacity: 0.5; touch-action: none; pointer-events: none;";null===(t=document.querySelector("textarea.memori-chat-textarea--input"))||void 0===t||t.setAttribute("style",i),null===(n=document.querySelector("button.memori-chat-inputs--send"))||void 0===n||n.setAttribute("style",i),null===(r=document.querySelector("button.memori-chat-inputs--mic"))||void 0===r||r.setAttribute("style",i)}function n(){var e,t,n,r;null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e||e.removeAttribute("disabled"),null===(t=document.querySelector("textarea.memori-chat-textarea--input"))||void 0===t||t.removeAttribute("style"),null===(n=document.querySelector("button.memori-chat-inputs--send"))||void 0===n||n.removeAttribute("style"),null===(r=document.querySelector("button.memori-chat-inputs--mic"))||void 0===r||r.removeAttribute("style")}function r(){var e;return!!(null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e?void 0:e.hasAttribute("disabled"))}const i=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent),o=function*(){yield*e}();t();const s=()=>{const e=o.next(),a=e.value;if(a){r()||t();let o=a.waitForPrevious;i&&(o=!1),Zj(a.message,o,a.hidden,a.typingText,a.useLoaderTextAsMsg,!e.done),i&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak")),n()}),3e3)}else r()&&n();if(e.done)return document.removeEventListener("MemoriEndSpeak",s),void(r()&&n())};document.addEventListener("MemoriEndSpeak",s),s()};let iH,oH=!1,sH=!1;var aH=({memori:e,memoriConfigs:n,memoriLang:r,multilingual:i,integration:o,layout:a="DEFAULT",customLayout:l,showInstruct:u=!1,showShare:d,preview:h=!1,embed:p=!1,showInputs:f=!0,showDates:m=!1,showContextPerLine:g=!1,showSettings:v=!0,showTypingText:y=!1,showClear:b=!1,showLogin:S=!1,showOnlyLastMessages:x,height:w="100vh",secret:_,baseUrl:C="https://aisuru.com",apiUrl:A="https://backend.memori.ai",initialContextVars:E,initialQuestion:T,ogImage:M,sessionID:I,tenant:R,personification:P,authToken:k,AZURE_COGNITIVE_SERVICES_TTS_KEY:O,defaultSpeakerActive:N=!0,onStateChange:L,additionalInfo:D,additionalSettings:B,customMediaRenderer:z,userAvatar:F})=>{var U,j,H,G,V,W,q,K,J,Q,Z,X,$,ee,te,ne,re,ie,oe,se,ae,le,ce,ue;const{t:de,i18n:he}=xe(),[pe,fe]=(0,c.useState)(!1);(0,c.useEffect)((()=>{fe(!0)}),[]);const me=Y(A),{initSession:ge,postTextEnteredEvent:ve,postPlaceChangedEvent:ye,postDateChangedEvent:be,postTimeoutEvent:Se,postTagChangedEvent:we,getSession:_e,getContentQualityIndexes:Ce,getExpertReferences:Ae}=me,[Ee,Te]=(0,c.useState)(!1),[Me,Ie]=(0,c.useState)(null!==(U=null==D?void 0:D.loginToken)&&void 0!==U?U:k),[Re,Pe]=(0,c.useState)({avatarURL:"string"==typeof F?F:void 0});(0,c.useEffect)((()=>{Me&&!(null==Re?void 0:Re.userID)&&S&&me.backend.getCurrentUser(Me).then((({user:e,resultCode:t})=>{e&&0===t?(Pe(e),Aj("loginToken",Me)):Ej("loginToken")}))}),[Me,null==Re?void 0:Re.userID]);const[ke,Oe]=(0,c.useState)(!1),[Ne,Le]=(0,c.useState)(!1),[De,Be]=(0,c.useState)(!1),ze=(null===(G=null===(H=null===(j=e.culture)||void 0===j?void 0:j.split("-"))||void 0===H?void 0:H[0])||void 0===G?void 0:G.toUpperCase())||(null===(K=null===(q=null===(W=null===(V=null==n?void 0:n.find((t=>t.memoriConfigID===e.memoriConfigurationID)))||void 0===V?void 0:V.culture)||void 0===W?void 0:W.split("-"))||void 0===q?void 0:q[0])||void 0===K?void 0:K.toUpperCase()),Fe=(null==o?void 0:o.customData)?JSON.parse(o.customData):null,Ue=void 0!==i?i:!!(null==Fe?void 0:Fe.multilanguage),je=null==Fe?void 0:Fe.forcedTimeout,[He,Ge]=(0,c.useState)(null!==(X=null!==(Z=null!==(Q=null!==(J=null!=r?r:null==Fe?void 0:Fe.lang)&&void 0!==J?J:ze)&&void 0!==Q?Q:null==Fe?void 0:Fe.uiLang)&&void 0!==Z?Z:he.language)&&void 0!==X?X:"IT"),[Ve,We]=(0,c.useState)(!1),[qe,Ke]=(0,c.useState)(!1),[Je,Qe]=(0,c.useState)(),Ye=a||(null==Fe?void 0:Fe.layout)||"DEFAULT",[Ze,Xe]=(0,c.useState)(!1),[$e,et]=(0,c.useState)(!1),[tt,nt]=(0,c.useState)(!1),[rt,it]=(0,c.useState)(!1),[ot,st]=(0,c.useState)(!1),[at,lt]=(0,c.useState)(!1),[ct,ut]=(0,c.useState)(!N),[dt,ht]=(0,c.useState)(!1),[pt,ft]=(0,c.useState)(2),[mt,gt]=(0,c.useState)(!1),[vt,yt]=(0,c.useState)("center"),[bt,St]=(0,c.useState)(!1);(0,c.useEffect)((()=>{gt(!!eH),sH=!!eH}),[eH]),(0,c.useEffect)((()=>{let e="bottom",t=Cj("microphoneMode","HOLD_TO_TALK");window.innerWidth<=768?(e="bottom",t="HOLD_TO_TALK"):e=window.matchMedia("(orientation: portrait)").matches||window.innerHeight>window.innerWidth?"center":"bottom",ut(Cj("muteSpeaker",!N)),oH=Cj("muteSpeaker",!N),ht("CONTINUOUS"===t),ft(Cj("continuousSpeechTimeout",2)),yt(Cj("controlsPosition",e)),St(Cj("hideEmissions",!1)),(null==D?void 0:D.loginToken)||k||(Ie(Cj("loginToken",void 0)),iH=Cj("loginToken",void 0))}),[]);const[xt,wt]=(0,c.useState)(_),[_t,Ct]=(0,c.useState)(),[At,Et]=(0,c.useState)(null),[Tt,Mt]=(0,c.useState)(),It=async(e,t)=>{var n;const r=null!=t?t:Vt;if(e&&r){const{currentState:t,...i}=await ye({sessionId:r,placeName:e.placeName,latitude:e.latitude,longitude:e.longitude,uncertaintyKm:null!==(n=e.uncertainty)&&void 0!==n?n:0});t&&0===i.resultCode&&Kt((e=>{var n;return{...e,...t,hints:(null===(n=t.hints)||void 0===n?void 0:n.length)?t.hints:null==e?void 0:e.hints}}))}};(0,c.useEffect)((()=>{const e=Cj("position",void 0);e&&Mt(e)}),[]);const[Rt,Pt]=(0,c.useState)(""),[kt,Ot]=(0,c.useState)(!1),[Nt,Lt]=(0,c.useState)([]),Dt=e=>{Lt((t=>{var n,r;return[...t,{...e,media:null!==(r=null===(n=e.media)||void 0===n?void 0:n.filter((e=>{var t;return!("text/javascript"===e.mimeType&&(null===(t=e.properties)||void 0===t?void 0:t.executable))})))&&void 0!==r?r:[]}]}))},Bt=async(n,r,i,o=!0,s,a=!1,l,c=!1,u=!1)=>{var d,h,p,f;const m=i||Vt||(null===(d=window.getMemoriState())||void 0===d?void 0:d.sessionID);if(!m||!(null==n?void 0:n.length))return;a||Dt({text:n,translatedText:s,fromUser:!0,media:null!=r?r:[],initial:Vt?!!i&&i!==Vt:!!i}),Ke(!0),Qe(l);let g=n,v=!1;if(o&&!Ee&&Ue&&He.toUpperCase()!==ze.toUpperCase()){g=(await dS(n,ze,He,C)).text}const{currentState:y,...b}=await ve({sessionId:m,text:g});if(0===b.resultCode&&y){const n=c&&l?l:null!==(h=y.emission)&&void 0!==h?h:null==qt?void 0:qt.emission;if("X4"===y.state&&e.giverTag){const{currentState:r,...i}=await we(m,e.giverTag);0===i.resultCode?(Jt(r),n&&(Dt({text:n,emitter:r.emitter,media:r.media,fromUser:!1,questionAnswered:g,contextVars:r.contextVars,date:r.currentDate,placeName:r.currentPlaceName,placeLatitude:r.currentLatitude,placeLongitude:r.currentLongitude,placeUncertaintyKm:r.currentUncertaintyKm,tag:r.currentTag,memoryTags:r.memoryTags}),hn(n))):(console.error(b,i),t(Ju).error(de(Hv(i.resultCode))),v=!0)}else if("X2d"===y.state&&e.giverTag){const{currentState:r,...i}=await ve({sessionId:m,text:Math.random().toString().substring(2,8)});if(0===i.resultCode){const{currentState:r,...i}=await we(m,e.giverTag);0===i.resultCode?(Jt(r),n&&(Dt({text:n,emitter:r.emitter,media:r.media,fromUser:!1,questionAnswered:g,contextVars:r.contextVars,date:r.currentDate,placeName:r.currentPlaceName,placeLatitude:r.currentLatitude,placeLongitude:r.currentLongitude,placeUncertaintyKm:r.currentUncertaintyKm,tag:r.currentTag,memoryTags:r.memoryTags}),hn(n))):(console.error(b,i),t(Ju).error(de(Hv(i.resultCode))),v=!0)}else console.error(b,i),t(Ju).error(de(Hv(i.resultCode))),v=!0}else He.toLowerCase()!==ze.toLowerCase()&&n&&!Ee&&Ue?zt(y,He,g).then((e=>{e.emission&&hn(e.emission)})):(Jt({...y,emission:n}),n&&(Dt({text:n,emitter:y.emitter,media:y.media,fromUser:!1,questionAnswered:g,generatedByAI:!!y.completion,contextVars:y.contextVars,date:y.currentDate,placeName:y.currentPlaceName,placeLatitude:y.currentLatitude,placeLongitude:y.currentLongitude,placeUncertaintyKm:y.currentUncertaintyKm,tag:y.currentTag,memoryTags:y.memoryTags}),hn(n)))}else 404===b.resultCode&&(Lt((e=>[...e.slice(0,e.length-1)])),Yt(!1,xt||e.secretToken,_t,Ee&&e.giverTag?e.giverTag:void 0,Ee&&e.giverPIN?e.giverPIN:void 0,{PATHNAME:window.location.pathname,ROUTE:(null===(f=null===(p=window.location.pathname)||void 0===p?void 0:p.split("/"))||void 0===f?void 0:f.pop())||"",...E||{}},T).then((e=>{console.info("session timeout"),(null==e?void 0:e.sessionID)&&setTimeout((()=>{Bt(n,r,null==e?void 0:e.sessionID)}),500)})));u||(Qe(void 0),Ke(!1))},zt=async(e,t,n)=>{var r,i,o;const s=null!==(r=e.emission)&&void 0!==r?r:null==qt?void 0:qt.emission;let a={...e},l=null;if(s&&!Ee&&ze.toUpperCase()!==t.toUpperCase()&&Ue){const r=await dS(s,t,ze,C);if(e.hints&&e.hints.length>0){const n=await Promise.all((null!==(i=e.hints)&&void 0!==i?i:[]).map((async e=>{var n;const r=await dS(e,t,ze,C);return{text:null!==(n=null==r?void 0:r.text)&&void 0!==n?n:e,originalText:e}})));a={...e,emission:r.text,translatedHints:n}}else a={...e,emission:r.text,hints:null!==(o=e.hints)&&void 0!==o?o:"G1"===e.state?null==qt?void 0:qt.hints:[]};r.text.length>0&&(l={text:r.text,emitter:e.emitter,media:e.media,fromUser:!1,questionAnswered:n,generatedByAI:!!e.completion,contextVars:e.contextVars,date:e.currentDate,placeName:e.currentPlaceName,placeLatitude:e.currentLatitude,placeLongitude:e.currentLongitude,placeUncertaintyKm:e.currentUncertaintyKm,tag:e.currentTag,memoryTags:e.memoryTags})}else a={...e,emission:s},s&&(l={text:s,emitter:e.emitter,media:e.media,fromUser:!1,questionAnswered:n,contextVars:e.contextVars,date:e.currentDate,placeName:e.currentPlaceName,placeLatitude:e.currentLatitude,placeLongitude:e.currentLongitude,placeUncertaintyKm:e.currentUncertaintyKm,tag:e.currentTag,memoryTags:e.memoryTags});return Jt(a),l&&Dt(l),a},Ft=void 0!==e.ageRestriction?e.ageRestriction:e.nsfw?18:e.enableCompletions?14:0,[Ut,jt]=(0,c.useState)(),[Ht,Gt]=(0,c.useState)(!1),[Vt,Wt]=(0,c.useState)(I),[qt,Kt]=(0,c.useState)(),Jt=e=>{var t;Kt(e),L&&L(e);const n=null===(t=null==e?void 0:e.media)||void 0===t?void 0:t.filter((e=>{var t;return"text/javascript"===e.mimeType&&!!(null===(t=e.properties)||void 0===t?void 0:t.executable)}));null==n||n.forEach((e=>{try{setTimeout((()=>{var t;console.log("snippet",e),new Function(null!==(t=e.content)&&void 0!==t?t:"")(),setTimeout((()=>{var e,t,n;null===(e=document.querySelector(".memori-chat--content"))||void 0===e||e.scrollTo(0,null!==(n=null===(t=document.querySelector(".memori-chat--content"))||void 0===t?void 0:t.scrollHeight)&&void 0!==n?n:0)}),400)}),1e3)}catch(e){console.error(e)}}))},Qt=async n=>{var r,i,o,s,a;let l=Cj("birthDate",void 0);if(Ut||l||!Ft)if("PUBLIC"===e.privacyType||e.secretToken||xt||_t){We(!0);try{if(!e.giverTag&&(null===(r=e.receivedInvitations)||void 0===r?void 0:r.length)){let t=e.receivedInvitations.find((e=>"GIVER"===e.type&&"ACCEPTED"===e.state));t&&(e.giverTag=t.tag,e.giverPIN=t.pin)}let l;try{l=window.location.href}catch(e){console.error(e)}const c=await ge({...n,tag:null!==(i=n.tag)&&void 0!==i?i:null==P?void 0:P.tag,pin:null!==(o=n.pin)&&void 0!==o?o:null==P?void 0:P.pin,additionalInfo:{...D||{},loginToken:null!==(a=null!==(s=null!=iH?iH:Me)&&void 0!==s?s:null==D?void 0:D.loginToken)&&void 0!==a?a:k,language:ln(He),referral:l}});if((null==c?void 0:c.sessionID)&&(null==c?void 0:c.currentState)&&0===c.resultCode)return Wt(c.sessionID),Tt&&It(Tt,c.sessionID),We(!1),{dialogState:c.currentState,sessionID:c.sessionID};(null==c?void 0:c.resultMessage.startsWith("This Memori is aged restricted"))?(console.error(c),t(Ju).error(de("underageTwinSession",{age:Ft})),Be(!0)):403===(null==c?void 0:c.resultCode)?(wt(void 0),Et("password")):(console.error(c),t(Ju).error(de(Hv(null==c?void 0:c.resultCode))),Be(!0))}catch(e){console.error(e),new Error("Error fetching session")}}else Et("password");else Gt(!0)},Yt=async(n=!1,r,i,o,s,a,l,c)=>{var u,d,h,p,f;We(!0);try{let m,g=Cj("birthDate",void 0);if(!c&&!g&&Ft)return void Gt(!0);if(!("PUBLIC"===e.privacyType||r||e.secretToken||xt||i||_t))return void Et("password");try{m=window.location.href}catch(e){console.error(e)}const{sessionID:v,currentState:y,...b}=await ge({memoriID:null!==(u=e.engineMemoriID)&&void 0!==u?u:"",password:r||xt||e.secretToken,recoveryTokens:i||_t,tag:o,pin:s,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:(null===(h=null===(d=window.location.pathname)||void 0===d?void 0:d.split("/"))||void 0===h?void 0:h.pop())||"",...a||{}},initialQuestion:l,birthDate:c||g||void 0,additionalInfo:{...D||{},loginToken:null!==(f=null!==(p=null!=iH?iH:Me)&&void 0!==p?p:null==D?void 0:D.loginToken)&&void 0!==f?f:k,language:ln(He),referral:m}});if(v&&y&&0===b.resultCode)return Wt(v),n&&(Jt(y),y.emission&&(Nt.length<=1?Lt([{text:y.emission,emitter:y.emitter,media:y.media,fromUser:!1,initial:!0,contextVars:y.contextVars,date:y.currentDate,placeName:y.currentPlaceName,placeLatitude:y.currentLatitude,placeLongitude:y.currentLongitude,placeUncertaintyKm:y.currentUncertaintyKm,tag:y.currentTag,memoryTags:y.memoryTags}]):Dt({text:y.emission,emitter:y.emitter,media:y.media,fromUser:!1,initial:!0,contextVars:y.contextVars,date:y.currentDate,placeName:y.currentPlaceName,placeLatitude:y.currentLatitude,placeLongitude:y.currentLongitude,placeUncertaintyKm:y.currentUncertaintyKm,tag:y.currentTag,memoryTags:y.memoryTags}))),Tt&&It(Tt,v),e.needsDateTime&&Xt({sessionID:v,state:y}),We(!1),{dialogState:y,sessionID:v};(null==b?void 0:b.resultMessage.startsWith("This Memori is aged restricted"))?(console.error(b),t(Ju).error(de("underageTwinSession",{age:Ft})),Be(!0)):403===(null==b?void 0:b.resultCode)?(wt(void 0),Et("password")):(console.error(b),t(Ju).error(de(Hv(b.resultCode))),Be(!0))}catch(e){console.error(e)}return We(!1),null},Zt=async(t,n,r,i)=>{var o,s,a,l,c;if(!t||!n)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState:t,resultCode:u}=await we(n,null!=r?r:Wv);if(0===u){let d=0;if(r!==Wv&&i&&("X1a"===t.state||"X1b"===t.state)){const{resultCode:e}=await ve({sessionId:n,text:null!=i?i:""});d=e}if(0===d){const{currentState:e,...t}=await _e(n);if(0===t.resultCode&&e)return{currentState:e,sessionId:n,...t}}else if([400,401,403,404,500].includes(u)){console.warn("[APPCONTEXT/CHANGETAG]",u);let t,n=Cj("birthDate",void 0);try{t=window.location.href}catch(e){console.error(e)}Qt({memoriID:null!==(o=e.engineMemoriID)&&void 0!==o?o:"",password:_||xt||e.secretToken,tag:e.giverTag,pin:e.giverPIN,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:(null===(a=null===(s=window.location.pathname)||void 0===s?void 0:s.split("/"))||void 0===a?void 0:a.pop())||"",...E||{}},initialQuestion:T,birthDate:Ut||n||void 0,additionalInfo:{...D||{},loginToken:null!==(c=null!==(l=null!=iH?iH:Me)&&void 0!==l?l:null==D?void 0:D.loginToken)&&void 0!==c?c:k,language:ln(He),referral:t}})}else if(t)return{currentState:t,sessionId:n,resultCode:u}}}catch(e){let t=e;return console.error("[APPCONTEXT/CHANGETAG]",t),Promise.reject(t)}return null};(0,c.useEffect)((()=>()=>{qt&&(null==qt?void 0:qt.currentTag)===e.giverTag||(async()=>{Vt&&e.giverTag&&e.giverPIN&&(Lt([]),await Zt(e.engineMemoriID,Vt,e.giverTag,e.giverPIN))})()}),[]);const Xt=(0,c.useCallback)((async({sessionID:t,date:n,state:r})=>{var i;const o=null!=t?t:Vt,s=null!=r?r:qt;if(!o||!e.needsDateTime||(null===(i=null==s?void 0:s.hints)||void 0===i?void 0:i.length))return;const a=(n?_s.DateTime.fromISO(n):_s.DateTime.now()).toUTC().toFormat("yyyy/MM/dd HH:mm:ss ZZ").split(":").slice(0,-1).join(":"),{currentState:l,...c}=await be(o,a);0===c.resultCode&&l&&Kt((e=>{var t;return{...e,...l,hints:(null===(t=l.hints)||void 0===t?void 0:t.length)?l.hints:null==e?void 0:e.hints}}))}),[qt,e.needsDateTime,Vt]);(0,c.useEffect)((()=>{if(Vt&&e.needsDateTime){Xt({sessionID:Vt,state:qt});let e=setInterval((()=>{Xt({sessionID:Vt})}),6e4);return()=>{clearInterval(e)}}}),[e.needsDateTime,Vt]);const[$t,en]=(0,c.useState)(),tn=(0,c.useRef)(),nn=()=>{$t&&(clearTimeout($t),en(void 0)),(null==tn?void 0:tn.current)&&(clearTimeout(tn.current),tn.current=void 0)},rn=()=>{nn(),mt||Rt.length||qe||kt||sn()},on=async()=>{var e;if(!Ze||mt||Rt.length||qe||kt)rn();else if(Vt&&Ze&&(null==qt?void 0:qt.acceptsTimeout)){const{currentState:t,...n}=await Se(Vt);if(0===n.resultCode&&t){const n=t.emission;if(!Ee&&Ue&&He!==(null==he?void 0:he.language)&&n&&n.length>0)zt({...t,emission:n},He).then((e=>{e.emission&&hn(e.emission)}));else{if(!(n&&n.length>0))return void rn();Dt({text:n,emitter:t.emitter,media:t.media,fromUser:!1,generatedByAI:!!t.completion,contextVars:t.contextVars,date:t.currentDate,placeName:t.currentPlaceName,placeLatitude:t.currentLatitude,placeLongitude:t.currentLongitude,placeUncertaintyKm:t.currentUncertaintyKm,tag:t.currentTag,memoryTags:t.memoryTags}),hn(n),Jt({...t,hints:null!==(e=t.hints)&&void 0!==e?e:"G1"===t.state?null==qt?void 0:qt.hints:[]})}}}},sn=()=>{let e=null==qt?void 0:qt.timeout;if(!e){let t=40,n=25;if(e=Math.floor(Math.random()*(t-n))+n,null==qt?void 0:qt.emission){e+=qt.emission.length/26.5}}if(je&&(e=je,null==qt?void 0:qt.emission)){e+=qt.emission.length/26.5}let t=setTimeout(on,1e3*e);en(t),tn.current=t};(0,c.useEffect)((()=>{(Rt.length||mt||qe)&&nn(),Vt&&!Rt.length&&rn()}),[null==qt?void 0:qt.acceptsTimeout,null==qt?void 0:qt.timeout,null==qt?void 0:qt.state,mt,Vt,Nt,Rt,qe,Ze]),(0,c.useEffect)((()=>()=>{Xe(!1),Le(!1),nn(),tn.current=void 0}),[]);const an=(0,c.useCallback)((t=>{var n,r,i,o;let s="",a=(null!==(o=null!==(i=null!=t?t:null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])&&void 0!==i?i:he.language)&&void 0!==o?o:"IT").toUpperCase(),l=e.voiceType;if(e.enableBoardOfExperts&&(null==qt?void 0:qt.emitter)){null==Vn||Vn.find((e=>e.name===(null==qt?void 0:qt.emitter)))}switch(a){case"IT":s=""+("MALE"===l?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":s=""+("MALE"===l?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":s=""+("MALE"===l?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":s=""+("MALE"===l?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":s=""+("MALE"===l?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":s=""+("MALE"===l?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":s=""+("MALE"===l?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":s=""+("MALE"===l?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;case"PL":s=""+("MALE"===l?"pl-PL-MarekNeural":"pl-PL-AgnieszkaNeural");break;case"FI":s=""+("MALE"===l?"fi-FI-HarriNeural":"fi-FI-SelmaNeural");break;case"EL":s=""+("MALE"===l?"el-GR-NestorasNeural":"el-GR-AthinaNeural");break;default:s=""+("MALE"===l?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return s}),[e.voiceType,e.enableBoardOfExperts,null==qt?void 0:qt.emitter,he.language,e.culture]),ln=t=>{var n,r;let i="";switch((t||(null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])||he.language||"IT").toUpperCase()){case"IT":default:i="it-IT";break;case"DE":i="de-DE";break;case"EN":i="en-GB";break;case"ES":i="es-ES";break;case"FR":i="fr-FR";break;case"PT":i="pt-PT";break;case"UK":i="uk-UK";break;case"RU":i="ru-RU";break;case"PL":i="pl-PL";break;case"FI":i="fi-FI";break;case"EL":i="el-GR"}return i},[cn,un]=(0,c.useState)();(0,c.useEffect)((()=>{(async()=>{try{const e=await fetch(`${C||"https://aisuru.com"}/api/lexiconmap`);return await e.json()}catch(e){console.error(e)}})().then((e=>{un(e)}))}),[]);const dn=()=>{const e=new CustomEvent("MemoriEndSpeak");document.dispatchEvent(e)},hn=e=>{if(!O||h)return void dn();if(wn(),h)return;if(ct||oH)return sH=!1,Ke(!1),dn(),void(dt&&bn());tH&&tH.pause();let t=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome"),n=/iPad|iPhone|iPod/.test(navigator.userAgent);if("interrupted"===nH.state)return void nH.resume().then((()=>hn(e)));if("closed"===nH.state){nH=new Qo;let e=nH.createBuffer(1,1e4,22050),t=nH.createBufferSource();t.buffer=e,t.connect(nH.destination)}else if("suspended"===nH.state){pn(),nH=new Qo;let e=nH.createBuffer(1,1e4,22050),t=nH.createBufferSource();t.buffer=e,t.connect(nH.destination)}if(!eH){n||(tH=new bs.SpeakerAudioDestination);let e=bs.AudioConfig.fromSpeakerOutput(tH);eH=new bs.SpeechSynthesizer($j,e)}const r=nH.createBufferSource();r.addEventListener("ended",(()=>{gt(!1),sH=!1})),tH.onAudioEnd=()=>{gt(!1),sH=!1,r.disconnect(),dn(),Tn()},eH.speakSsmlAsync(`<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" xml:lang="${ln(He)}"><voice name="${an(He)}"><s>${((e,t)=>{var n;if(!cn)return e;const r={...null!==(n=cn.common)&&void 0!==n?n:{},...(null==R?void 0:R.id)&&cn[R.id]?cn[R.id]:{}},i=Object.keys(r).map((e=>{var n;return{word:e,phoneme:null!==(n=r[e][t.toLowerCase()])&&void 0!==n?n:r[e].default,caseSensitive:r[e].caseSensitive}}));return i.reduce(((e,{word:t,phoneme:n,caseSensitive:r})=>e.replace(new RegExp(`\\b${t}\\b`,r?"g":"gi"),`<phoneme alphabet="ipa" ph="${n}">${t}</phoneme>`)),e)})((e=>{const t=document.createElement("textarea");return t.textContent=e,t.innerHTML})(im(e)),He.toLowerCase())}</s></voice></speak>`,(i=>{if(i){gt(!0),sH=!0;try{nH.decodeAudioData(i.audioData,(function(e){r.buffer=e,r.connect(nH.destination),(Nt.length<1||t&&n)&&r.start(0)})),nH.onstatechange=()=>{"suspended"===nH.state||"closed"===nH.state?(r.disconnect(),gt(!1),sH=!1):"interrupted"===nH.state&&nH.resume()},nH.resume(),eH&&(eH.close(),eH=null)}catch(t){console.error("speak error: ",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),gt(!1),sH=!1,eH&&(eH.close(),eH=null),dn()}}else nH.resume(),gt(!1),sH=!1,dn()}),(t=>{console.error("speak:",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),gt(!1),sH=!1,dn()})),Ke(!1)},pn=()=>{gt(!1),sH=!1;try{eH&&(eH.close(),eH=null),"closed"!==nH.state&&nH.close(),tH&&(tH.pause(),tH.close())}catch(e){console.error("stopAudio error: ",e)}};(0,c.useEffect)((()=>{let e=document.querySelector("#chat-fieldset textarea");e&&e.focus()}),[null==qt?void 0:qt.emission]);const[fn,mn]=(0,c.useState)(""),gn=()=>mn(""),[vn,yn]=(0,c.useState)(null),bn=()=>{let e=setTimeout((async()=>{_n();const e=rm(fn);e.length>0&&kt?(Bt(e),gn(),Pt("")):kt&&rn()}),1e3*pt);yn(e)},Sn=()=>{vn&&(clearTimeout(vn),yn(null))};(0,c.useEffect)((()=>{Sn(),dt&&bn(),rn()}),[fn]);const xn=()=>{if(O){_n(),mn(""),gn();try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(e){et(!0),$j||($j=bs.SpeechConfig.fromSubscription(O,"eastus"),$j.speechRecognitionLanguage=ln(He),$j.speechSynthesisLanguage=ln(He),$j.speechSynthesisVoiceName=an(He));const t=bs.AudioConfig.fromDefaultMicrophoneInput();Xj=new bs.SpeechRecognizer($j,t),Ot(!0),Xj.recognized=(e,t)=>{if(t.result.text)if(t.result.reason===bs.ResultReason.RecognizedSpeech){let e=t.result.text;if(mn(e||""),(null==e?void 0:e.length)>0){const t=rm(e);t.length>0&&Pt((e=>`${e} ${t}`))}}else t.result.reason===bs.ResultReason.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},Xj.canceled=(e,t)=>{t.reason===bs.CancellationReason.Error&&(console.debug(`"CANCELED: ErrorCode=${t.errorCode}`),console.debug(`"CANCELED: ErrorDetails=${t.errorDetails}`),console.debug("CANCELED: Did you set the speech resource key and region values?")),wn()},Xj.sessionStopped=(e,t)=>{wn()},gn(),Xj.startContinuousRecognitionAsync()})).catch(console.error)}catch(e){console.error(e)}}},wn=()=>{Xj&&(Xj.stopContinuousRecognitionAsync(),Xj.close(),Xj=null),Ot(!1)},_n=()=>{et(!1),wn(),Sn()},Cn=()=>{try{_n(),nn(),Le(!1),tn.current=void 0,pn()}catch(e){console.log("Error: resetUIEffects",e)}};(0,c.useEffect)((()=>()=>{Cn()}),[]),(0,c.useEffect)((()=>(document.addEventListener("MemoriResetUIEffects",Cn),()=>{document.removeEventListener("MemoriResetUIEffects",Cn)})),[]),(0,c.useEffect)((()=>{"Z0"===(null==qt?void 0:qt.state)&&_n()}),[null==qt?void 0:qt.state]);const[An,En]=(0,c.useState)(!1),Tn=(0,c.useCallback)((e=>{mt&&eH&&(eH.close(),eH=null),!dt||!$e&&An||(En(!0),xn())}),[dt,$e]);(0,c.useEffect)((()=>{Nt.length>1&&!mt&&dt&&($e||!An)?xn():mt&&kt&&wn()}),[mt]),(0,c.useEffect)((()=>{kt&&(_n(),gn(),Pt(""),xn())}),[ze]);const[Mn,In]=(0,c.useState)("keypress");(0,c.useEffect)((()=>{const e=Cj("sendOnEnter","keypress");window.innerWidth<=768?In("click"):In(e)}),[]),(0,c.useEffect)((()=>{Aj("sendOnEnter",Mn)}),[Mn]);const[Rn,Pn]=(0,c.useState)(),kn=null==Fe?void 0:Fe.globalBackground,On=kn?`url(${kn})`:null,Nn=o?{"--memori-chat-bubble-bg":"#fff",...Fe&&!u?{"--memori-text-color":null!==($=Fe.textColor)&&void 0!==$?$:"#000"}:{},...(null==Fe?void 0:Fe.buttonBgColor)?{"--memori-button-bg":Fe.buttonBgColor,"--memori-primary":Fe.buttonBgColor}:{},...(null==Fe?void 0:Fe.buttonTextColor)?{"--memori-button-text":Fe.buttonTextColor}:{},...(null==Fe?void 0:Fe.blurBackground)?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...(null==Fe?void 0:Fe.innerBgColor)?{"--memori-inner-bg":`rgba(${"dark"===Fe.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(ee=Fe.innerBgAlpha)&&void 0!==ee?ee:.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===Fe.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(te=null==Fe?void 0:Fe.innerBgAlpha)&&void 0!==te?te:.4})`}:{"--memori-inner-content-pad":"0px"}}:{},Ln=`\n ${h?"#preview,":"WEBSITE_ASSISTANT"===Ye?"":":root,"} .memori-widget, .memori-drawer, .memori-modal {\n ${Object.entries(Nn).map((([e,t])=>`${e}: ${t};`)).join("\n")}\n }\n `,Dn=void 0===(null==Fe?void 0:Fe.showAIicon)||(null==Fe?void 0:Fe.showAIicon),Bn=void 0===(null==Fe?void 0:Fe.showWhyThisAnswer)||(null==Fe?void 0:Fe.showWhyThisAnswer),[zn,Fn]=(0,c.useState)(!1);(0,c.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===Ye||"FULLPAGE"!==Ye)&&Fn(!0)}),[]);const[Un,jn]=(0,c.useState)();(0,c.useEffect)((()=>{e.engineMemoriID&&(async e=>{let t,n;try{const{contentQualityIndex:r,answerQualityIndex:i,unansweredQuestions:o,...s}=await Ce(e);0===s.resultCode&&(t=r,n=o)}catch(e){let t=e;console.error("[APPCONTEXT/QUERYGAMIFICATIONPOINTS]",t)}return{points:null!=t?t:0,unansweredQuestions:null!=n?n:0}})(e.engineMemoriID).then((e=>{jn(Yj(e.points))})).catch(console.error)}),[e.engineMemoriID]),(0,c.useEffect)((()=>{if(null==Fe?void 0:Fe.seoTitle){let e=document.createElement("meta");e.setAttribute("property","og:title"),e.setAttribute("content",Fe.seoTitle),document.head.append(e)}if(null==Fe?void 0:Fe.seoDescription){let e=document.createElement("meta");e.setAttribute("property","og:description"),e.setAttribute("content",Fe.seoDescription),document.head.append(e)}if(null==Fe?void 0:Fe.seoUrl){let e=document.createElement("meta");e.setAttribute("property","og:url"),e.setAttribute("content",Fe.seoUrl),document.head.append(e)}let t=M||e.avatarURL;if((null==Fe?void 0:Fe.seoImageShowAvatar)&&t){let e=document.createElement("meta");e.setAttribute("property","og:image"),e.setAttribute("content",t),document.head.append(e)}}),[Fe,e.avatarURL,M]);const Hn=(0,c.useCallback)((e=>{const{text:t,waitForPrevious:n,hidden:r,typingText:i,useLoaderTextAsMsg:o,hasBatchQueued:s}=e.detail;t&&(n&&!oH&&(sH||qe)?setTimeout((()=>{Hn(e)}),1e3):(wn(),pn(),Bt(t,void 0,void 0,void 0,void 0,r,i,o,s)))}),[Vt,mt,qe,He]);(0,c.useEffect)((()=>(document.addEventListener("MemoriTextEntered",Hn),()=>{document.removeEventListener("MemoriTextEntered",Hn)})),[Vt,He]);const Gn=(0,c.useCallback)((async t=>{var n,r,i,o,s,a,l,c,u,d,h,p,f,m,g,v,y,b;const S=(null==t?void 0:t.sessionID)||Vt,x=(null==t?void 0:t.dialogState)||qt;Le(!0);let w=document.getElementById("memori-audio"),C=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome");w&&C&&(w.muted=!1,w.play().catch((e=>{console.error("error playing intro audio",e)})));let A=Cj("birthDate",void 0),M=Ut||A||void 0;if(S||!Ft||M){if(!S&&"PUBLIC"!==e.privacyType&&!e.secretToken&&!xt&&!_t||!S&&De)return Et("password"),void Le(!1);if(!S){Le(!1),Be(!1);const t=await Qt({memoriID:e.engineMemoriID,password:_||xt||e.secretToken,tag:null==P?void 0:P.tag,pin:null==P?void 0:P.pin,initialContextVars:{PATHNAME:null===(n=window.location.pathname)||void 0===n?void 0:n.toUpperCase(),ROUTE:(null===(o=null===(i=null===(r=window.location.pathname)||void 0===r?void 0:r.split("/"))||void 0===i?void 0:i.pop())||void 0===o?void 0:o.toUpperCase())||"",...E||{}},initialQuestion:T,birthDate:M,additionalInfo:{...D||{},loginToken:null!==(a=null!==(s=null!=iH?iH:Me)&&void 0!==s?s:null==D?void 0:D.loginToken)&&void 0!==a?a:k,language:ln(He)}});return void((null==t?void 0:t.dialogState)?(Lt([]),zt(t.dialogState,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}))):await Gn(t||void 0))}if(I){const{currentState:t,...n}=await _e(S);if(0!==n.resultCode||!t)return console.debug("session expired, opening new session"),Be(!0),Wt(void 0),Le(!1),void await Gn();if(Lt([]),Tt&&It(Tt,S),e.needsDateTime&&Xt({sessionID:S,state:t}),Ee&&e.giverTag&&(null==qt?void 0:qt.currentTag)!==e.giverTag)try{console.debug("change tag #0"),await Zt(e.engineMemoriID,S,"-");const t=await Zt(e.engineMemoriID,S,e.giverTag,e.giverPIN);if(!t||0!==t.resultCode)throw console.error("session #1",t),new Error("No session");zt(t.currentState,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}))}catch(t){console.error("session #2",t),Yt(!0,null==e?void 0:e.secretToken,void 0,null==e?void 0:e.giverTag,null==e?void 0:e.giverPIN,{PATHNAME:null===(l=window.location.pathname)||void 0===l?void 0:l.toUpperCase(),ROUTE:(null===(d=null===(u=null===(c=window.location.pathname)||void 0===c?void 0:c.split("/"))||void 0===u?void 0:u.pop())||void 0===d?void 0:d.toUpperCase())||"",...E||{}},T,M).then((()=>{Xe(!0)}))}else if(!Ee&&P&&(null==qt?void 0:qt.currentTag)!==P.tag)try{console.debug("change tag #3"),await Zt(e.engineMemoriID,S,"-");const t=await Zt(e.engineMemoriID,S,P.tag,P.pin);if(!t||0!==t.resultCode)throw console.error("session #4",t),new Error("No session");zt(t.currentState,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}))}catch(t){console.error("session #5",t),Yt(!0,null==e?void 0:e.secretToken,void 0,P.tag,P.pin,{PATHNAME:null===(h=window.location.pathname)||void 0===h?void 0:h.toUpperCase(),ROUTE:(null===(m=null===(f=null===(p=window.location.pathname)||void 0===p?void 0:p.split("/"))||void 0===f?void 0:f.pop())||void 0===m?void 0:m.toUpperCase())||"",...E||{}},T,M).then((()=>{Xe(!0)}))}else if(Ee||P||(null==qt?void 0:qt.currentTag)===Wv)zt(t,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}));else try{console.debug("change tag #6"),await Zt(e.engineMemoriID,S,"-");const t=await Zt(e.engineMemoriID,S,Wv);if(!t||0!==t.resultCode)throw console.error("session #7",t),new Error("No session");zt(t.currentState,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}))}catch(t){console.error("session #8",t),Yt(!0,null==e?void 0:e.secretToken,void 0,void 0,void 0,{PATHNAME:null===(g=window.location.pathname)||void 0===g?void 0:g.toUpperCase(),ROUTE:(null===(b=null===(y=null===(v=window.location.pathname)||void 0===v?void 0:v.split("/"))||void 0===y?void 0:y.pop())||void 0===b?void 0:b.toUpperCase())||"",...E||{}},T,M).then((()=>{Xe(!0)}))}Tt&&It(Tt,S),e.needsDateTime&&Xt({sessionID:S,state:t})}else Lt([]),zt(x,He).then((e=>{e.emission&&hn(e.emission)})).finally((()=>{Xe(!0)}))}else Gt(!0),Le(!1)}),[xt,e,_t,Ut,Vt,He,Tt]);(0,c.useEffect)((()=>{const t=document.querySelector(`memori-client[memoriname="${e.name}"]`)||document.querySelector(`memori-client[memoriid="${e.memoriID}"]`)||document.querySelector("memori-client");if(!t)return;const n=new MutationObserver(((e,t)=>{var n,r,i;for(const t of e)"attributes"===t.type&&"authtoken"===(null===(n=t.attributeName)||void 0===n?void 0:n.toLowerCase())&&("MEMORI-CLIENT"===t.target.nodeName?(Ie(t.target.getAttribute("authtoken")||void 0),iH=t.target.getAttribute("authtoken")||void 0):(Ie((null===(i=null===(r=t.target)||void 0===r?void 0:r.parentElement)||void 0===i?void 0:i.getAttribute("authtoken"))||void 0),iH=t.target.getAttribute("authtoken")||void 0))}));return n.observe(t,{attributes:!0,childList:!1,subtree:!1}),()=>{n.disconnect()}}),[]);const[Vn,Wn]=(0,c.useState)(),qn=(0,c.useCallback)((async()=>{if(Vt&&(null==e?void 0:e.enableBoardOfExperts))try{const{experts:e,count:t,...n}=await Ae(Vt);0===n.resultCode?Wn(e):console.warn("Error fetching experts",n)}catch(e){console.warn(e)}}),[Vt,null==e?void 0:e.enableBoardOfExperts]);(0,c.useEffect)((()=>{qn()}),[Vt,qn]);const Kn=void 0===x?"TOTEM"!==a&&"WEBSITE_ASSISTANT"!==a:!x,Jn={memori:e,tenant:R,history:Nt,showShare:null===(ne=null!=d?d:null==Fe?void 0:Fe.showShare)||void 0===ne||ne,position:Tt,setShowPositionDrawer:nt,setShowSettingsDrawer:it,setShowKnownFactsDrawer:st,setShowExpertsDrawer:lt,showSpeaker:!!O,speakerMuted:ct||oH,setSpeakerMuted:e=>{if(oH=!!e,ut(e),Aj("muteSpeaker",!!e),e)pn();else{nH=new Qo;let e=nH.createBuffer(1,1e4,22050),t=nH.createBufferSource();t.buffer=e,t.connect(nH.destination)}},showSettings:v,hasUserActivatedSpeak:Ze,showReload:"TOTEM"===Ye,showClear:b,clearHistory:()=>Lt((e=>e.slice(-1))),showLogin:S,setShowLoginDrawer:Oe,loginToken:Me,user:Re,sessionID:Vt},Qn={memori:e,integration:o,integrationConfig:Fe,tenant:R,instruct:Ee,avatar3dVisible:zn,setAvatar3dVisible:Fn,hasUserActivatedSpeak:Ze,isPlayingAudio:mt&&!ct,loading:!!qe,baseUrl:C,apiUrl:A},Yn={memori:e,tenant:R,gamificationLevel:Un,language:ze,userLang:He,setUserLang:Ge,baseUrl:C,apiUrl:A,position:Tt,openPositionDrawer:()=>nt(!0),integrationConfig:Fe,instruct:Ee,sessionId:Vt,clickedStart:Ne,onClickStart:Gn,initializeTTS:()=>{if(!O)return;$j=bs.SpeechConfig.fromSubscription(O,"eastus"),$j.speechSynthesisLanguage=ln(He),$j.speechSynthesisVoiceName=an(He),$j.speechRecognitionLanguage=ln(He),Zf()&&($j.speechSynthesisOutputFormat=bs.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3),nH=new Qo;let e=nH.createBuffer(1,1e4,22050),t=nH.createBufferSource();t.buffer=e,t.connect(nH.destination),tH=new bs.SpeakerAudioDestination;let n=bs.AudioConfig.fromSpeakerOutput(tH);eH=new bs.SpeechSynthesizer($j,n)},isUserLoggedIn:!!Me&&!!(null==Re?void 0:Re.userID),showLogin:S,setShowLoginDrawer:Oe,user:Re},Zn={memori:e,sessionID:Vt||"",tenant:R,translateTo:Ue&&He.toUpperCase()!==(null===(ae=null!==(se=null!==(oe=null===(ie=null===(re=e.culture)||void 0===re?void 0:re.split("-"))||void 0===ie?void 0:ie[0])&&void 0!==oe?oe:he.language)&&void 0!==se?se:"IT")||void 0===ae?void 0:ae.toUpperCase())?He:void 0,baseUrl:C,apiUrl:A,layout:a,memoriTyping:qe,typingText:Je,showTypingText:y,history:Kn?Nt:Nt.slice(-2),authToken:null!==(ce=null!==(le=null!=Me?Me:iH)&&void 0!==le?le:null==D?void 0:D.loginToken)&&void 0!==ce?ce:k,dialogState:qt,setDialogState:Jt,pushMessage:Dt,simulateUserPrompt:(e,t)=>{wn(),pn(),Bt(e,void 0,void 0,!1,t)},showDates:m,showContextPerLine:g,showAIicon:Dn,showWhyThisAnswer:Bn,client:me,selectReceiverTag:async n=>{var r;if(Vt)try{const{currentState:i,...o}=await we(Vt,n);if(0===o.resultCode)if(Dt({text:n,fromUser:!0}),"X4"===i.state&&e.giverTag){const{currentState:n,...r}=await me.postTagChangedEvent(Vt,e.giverTag);0===r.resultCode?(Jt(n),n.emission&&Dt({text:n.emission,emitter:n.emitter,media:n.media,fromUser:!1,contextVars:n.contextVars,date:n.currentDate,placeName:n.currentPlaceName,placeLatitude:n.currentLatitude,placeLongitude:n.currentLongitude,placeUncertaintyKm:n.currentUncertaintyKm,tag:n.currentTag,memoryTags:n.memoryTags})):(console.error(r),t(Ju).error(de(Hv(r.resultCode))))}else Jt(i),i.emission&&Dt({text:i.emission,emitter:i.emitter,media:i.media,fromUser:!1,contextVars:i.contextVars,date:i.currentDate,placeName:i.currentPlaceName,placeLatitude:i.currentLatitude,placeLongitude:i.currentLongitude,placeUncertaintyKm:i.currentUncertaintyKm,tag:i.currentTag,memoryTags:i.memoryTags});else console.error(o,n,null===(r=null==qt?void 0:qt.knownTags)||void 0===r?void 0:r[n]),t(Ju).error(de(Hv(o.resultCode)))}catch(e){let n=e;console.error(n),t(Ju).error(n.message)}},preview:h,sendOnEnter:Mn,setSendOnEnter:In,microphoneMode:dt?"CONTINUOUS":"HOLD_TO_TALK",attachmentsMenuOpen:Rn,setAttachmentsMenuOpen:Pn,instruct:Ee,showInputs:f,showMicrophone:!!O,userMessage:Rt,onChangeUserMessage:e=>{if(!e||"\n"===e||""===e.trim())return Pt(""),void rn();Pt(e),nn()},sendMessage:e=>{pn(),wn(),Bt(e),Pt(""),gn()},stopListening:_n,startListening:xn,stopAudio:pn,resetTranscript:gn,listening:kt,isPlayingAudio:mt,customMediaRenderer:z,user:Re,userAvatar:F,experts:Vn},Xn=o&&On?(0,s.jsx)("div",{className:"memori--global-background",children:(0,s.jsx)("div",{className:"memori--global-background-image",style:{backgroundImage:On}})}):(0,s.jsx)("div",{className:"memori--global-background no-background-image"}),$n=o?(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:Ln}}):null,er={canInstruct:!!e.giverTag,instruct:!!Ee,onChangeMode:e=>{Te("instruct"===e),Xe(!1),Le(!1)}},tr=(0,s.jsx)(XU,{tenant:R,userLang:He,integrationID:null==o?void 0:o.integrationID,memoriHash:`${e.ownerTenantName}-${e.ownerUserName}-${e.name}`}),nr=l||("TOTEM"===Ye?Uj:"CHAT"===Ye?jj:"FULLPAGE"===Ye?Fj:"WEBSITE_ASSISTANT"===Ye?Hj:Fj);return(0,s.jsxs)("div",{className:t(ws)("memori","memori-widget",`memori-layout-${a.toLowerCase()}`,`memori-controls-${vt.toLowerCase()}`,`memori--avatar-${(null==Fe?void 0:Fe.avatar)||"default"}`,{"memori--preview":h,"memori--embed":p,"memori--with-integration":o,"memori--with-speechkey":!!O,"memori--active":Ze,"memori--hide-emissions":bt,"memori--has-active-session":!!Vt}),"data-memori-name":null==e?void 0:e.name,"data-memori-id":null==e?void 0:e.engineMemoriID,"data-memori-secondary-id":null==e?void 0:e.memoriID,"data-memori-session-id":Vt,"data-memori-integration":null==o?void 0:o.integrationID,"data-memori-engine-state":JSON.stringify({...qt,sessionID:Vt}),style:{height:w},children:[(0,s.jsx)(nr,{Header:ZU,headerProps:Jn,Avatar:qF,avatarProps:Qn,Chat:QS,chatProps:Zn,StartPanel:rx,startPanelProps:Yn,integrationStyle:$n,integrationBackground:Xn,ChangeMode:KF,changeModeProps:er,poweredBy:tr,sessionId:Vt,hasUserActivatedSpeak:Ze,showInstruct:u,loading:Ve}),(0,s.jsx)("audio",{id:"memori-audio",style:{display:"none"},src:"https://aisuru.com/intro.mp3"}),pe&&(0,s.jsx)(dv,{withModal:!0,pwdOrTokens:At,openModal:!!At,setPwdOrTokens:Et,showTokens:"SECRET"===e.privacyType,onFinish:async t=>{var n,r,i,o;t.password&&wt(t.password),t.password&&(rH=t.password),t.tokens&&Ct(t.tokens),Yt(!Vt,t.password,t.tokens,Ee?e.giverTag:null==P?void 0:P.tag,Ee?e.giverPIN:null==P?void 0:P.pin,{PATHNAME:null===(n=window.location.pathname)||void 0===n?void 0:n.toUpperCase(),ROUTE:(null===(o=null===(i=null===(r=window.location.pathname)||void 0===r?void 0:r.split("/"))||void 0===i?void 0:i.pop())||void 0===o?void 0:o.toUpperCase())||"",...E||{}},T,Ut).then((e=>{Et(null),Gn(e||void 0)})).catch((()=>{Et(null),Be(!0)}))},minimumNumberOfRecoveryTokens:null!==(ue=null==e?void 0:e.minimumNumberOfRecoveryTokens)&&void 0!==ue?ue:1}),pe&&(0,s.jsx)(Sj,{visible:Ht,minAge:Ft,onClose:t=>{var n,r,i,o;t?(jt(t),Aj("birthDate",t),Yt(!Vt,rH||xt||(null==e?void 0:e.secretToken),_t,Ee?e.giverTag:null==P?void 0:P.tag,Ee?e.giverPIN:null==P?void 0:P.pin,{PATHNAME:null===(n=window.location.pathname)||void 0===n?void 0:n.toUpperCase(),ROUTE:(null===(o=null===(i=null===(r=window.location.pathname)||void 0===r?void 0:r.split("/"))||void 0===i?void 0:i.pop())||void 0===o?void 0:o.toUpperCase())||"",...E||{}},T,t).then((e=>{Gt(!1),Et(null),Gn(e||void 0)})).catch((()=>{Gt(!1),Be(!0)}))):(Gt(!1),Le(!1))}}),rt&&(0,s.jsx)(Mj,{layout:Ye,open:!!rt,onClose:()=>it(!1),microphoneMode:dt?"CONTINUOUS":"HOLD_TO_TALK",continuousSpeechTimeout:pt,setMicrophoneMode:e=>ht("CONTINUOUS"===e),setContinuousSpeechTimeout:ft,controlsPosition:vt,setControlsPosition:yt,hideEmissions:bt,setHideEmissions:St,additionalSettings:B}),tt&&(0,s.jsx)(Hm,{memori:e,open:!!tt,venue:Tt,setVenue:e=>{Mt(e),It(e),e?Aj("position",JSON.stringify(e)):Ej("position")},onClose:e=>{e&&It(e),nt(!1)}}),ot&&Vt&&(0,s.jsx)(kj,{apiURL:A,memori:e,sessionID:Vt,visible:ot,closeDrawer:()=>st(!1)}),at&&!!Vn&&(0,s.jsx)(Oj,{apiUrl:A,baseUrl:C,tenant:R,experts:Vn,open:at,onClose:()=>lt(!1)}),ke&&(null==R?void 0:R.id)&&(0,s.jsx)(zj,{tenant:R,apiUrl:A,open:!!ke,user:Re,loginToken:Me,onClose:()=>Oe(!1),onLogin:(e,t)=>{Pe(e),Ie(t),iH=t,Oe(!1),Aj("loginToken",t)},onLogout:()=>{Me&&me.backend.userLogout(Me).then((()=>{Oe(!1),Pe(void 0),Ie(void 0),iH=void 0,Ej("loginToken")}))}})]})};const lH={id:"aisuru.com",theme:"aisuru",config:{name:"Memori",showNewUser:!1,requirePosition:!1}},cH=async(e,t)=>{const n=t?new URL(`${t.startsWith("http")?"":t.includes("localhost")?"http://":"https://"}${t}`).origin:"https://aisuru.com";try{const t=await fetch(`${n}/api/tenant/${e}`),{tenant:r}=await t.json();return r||{...lH,tenantID:e}}catch(t){return{...lH,tenantID:e}}};function uH(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dH(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,PF(r.key),r)}}function hH(e,t,n){return t&&dH(e.prototype,t),n&&dH(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function pH(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fH(e,t){return fH=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},fH(e,t)}function mH(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fH(e,t)}function gH(e,t){if(t&&("object"===IF(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return pH(e)}function vH(e){return vH=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vH(e)}function yH(e){if(Array.isArray(e))return e}function bH(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function SH(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xH(e,t){if(e){if("string"==typeof e)return SH(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?SH(e,t):void 0}}function wH(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _H(e){return yH(e)||bH(e)||xH(e)||wH()}function CH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function AH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CH(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var EH={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},TH=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};uH(this,e),this.init(t,n)}return hH(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||EH,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,r){return r&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,AH(AH({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}(),MH=new TH,IH=function(){function e(){uH(this,e),this.observers={}}return hH(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){var i=[].concat(this.observers[e]);i.forEach((function(e){e.apply(void 0,n)}))}if(this.observers["*"]){var o=[].concat(this.observers["*"]);o.forEach((function(t){t.apply(t,[e].concat(n))}))}}}]),e}();function RH(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function PH(e){return null==e?"":""+e}function kH(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e])}))}function OH(e,t,n){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var s=r(o.shift());!e[s]&&n&&(e[s]=new n),e=Object.prototype.hasOwnProperty.call(e,s)?e[s]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function NH(e,t,n){var r=OH(e,t,Object);r.obj[r.k]=n}function LH(e,t){var n=OH(e,t),r=n.obj,i=n.k;if(r)return r[i]}function DH(e,t,n){var r=LH(e,n);return void 0!==r?r:LH(t,n)}function BH(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):BH(e[r],t[r],n):e[r]=t[r]);return e}function zH(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var FH={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function UH(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return FH[e]})):e}var jH="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,HH=[" ",",","?","!",";"];function GH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function VH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?GH(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function WH(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=vH(e);if(t){var i=vH(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gH(this,n)}}function qH(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;o<r.length;++o){if(!i)return;if("string"==typeof i[r[o]]&&o+1<r.length)return;if(void 0===i[r[o]]){for(var s=2,a=r.slice(o,o+s).join(n),l=i[a];void 0===l&&r.length>o+s;)s++,l=i[a=r.slice(o,o+s).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(a)){if("string"==typeof l)return l;if(a&&"string"==typeof l[a])return l[a]}var c=r.slice(o+s).join(n);return c?qH(l,c,n):void 0}i=i[r[o]]}return i}}var KH=function(e){mH(n,e);var t=WH(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return uH(this,n),r=t.call(this),jH&&IH.call(pH(r)),r.data=e||{},r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),void 0===r.options.ignoreJSONStructure&&(r.options.ignoreJSONStructure=!0),r}return hH(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,s=[e,t];n&&"string"!=typeof n&&(s=s.concat(n)),n&&"string"==typeof n&&(s=s.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(s=e.split("."));var a=LH(this.data,s);return a||!o||"string"!=typeof n?a:qH(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var s=[e,t];n&&(s=s.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(s=e.split("."))[1]),this.addNamespaces(t),NH(this.data,s,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},s=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(s=e.split("."))[1]),this.addNamespaces(t);var a=LH(this.data,s)||{};r?BH(a,n,i):a=VH(VH({},a),n),NH(this.data,s,a),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?VH(VH({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(IH),JH={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))})),t}};function QH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function YH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?QH(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QH(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ZH(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=vH(e);if(t){var i=vH(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gH(this,n)}}var XH={},$H=function(e){mH(n,e);var t=ZH(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return uH(this,n),r=t.call(this),jH&&IH.call(pH(r)),kH(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,pH(r)),r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=MH.create("translator"),r}return hH(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,s=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=HH.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===r.length)return!0;var i=new RegExp("(".concat(r.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),o=!i.test(e);if(!o){var s=e.indexOf(n);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o}(e,n,r));if(o&&!s){var a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:i};var l=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(l[0])>-1)&&(i=l.shift()),e=l.join(r)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,r){var i=this;if("object"!==IF(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,s=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],t),l=a.key,c=a.namespaces,u=c[c.length-1],d=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(h){var p=t.nsSeparator||this.options.nsSeparator;return o?(f.res="".concat(u).concat(p).concat(l),f):"".concat(u).concat(p).concat(l)}return o?(f.res=l,f):l}var f=this.resolve(e,t),m=f&&f.res,g=f&&f.usedKey||l,v=f&&f.exactUsedKey||l,y=Object.prototype.toString.apply(m),b=["[object Number]","[object Function]","[object RegExp]"],S=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,x=!this.i18nFormat||this.i18nFormat.handleAsObject,w="string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m;if(x&&m&&w&&b.indexOf(y)<0&&("string"!=typeof S||"[object Array]"!==y)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var _=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,YH(YH({},t),{},{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return o?(f.res=_,f):_}if(s){var C="[object Array]"===y,A=C?[]:{},E=C?v:g;for(var T in m)if(Object.prototype.hasOwnProperty.call(m,T)){var M="".concat(E).concat(s).concat(T);A[T]=this.translate(M,YH(YH({},t),{joinArrays:!1,ns:c})),A[T]===M&&(A[T]=m[T])}m=A}}else if(x&&"string"==typeof S&&"[object Array]"===y)(m=m.join(S))&&(m=this.extendTranslation(m,e,t,r));else{var I=!1,R=!1,P=void 0!==t.count&&"string"!=typeof t.count,k=n.hasDefaultValue(t),O=P?this.pluralResolver.getSuffix(d,t.count,t):"",N=t["defaultValue".concat(O)]||t.defaultValue;!this.isValidLookup(m)&&k&&(I=!0,m=N),this.isValidLookup(m)||(R=!0,m=l);var L=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,D=L&&R?void 0:m,B=k&&N!==m&&this.options.updateMissing;if(R||I||B){if(this.logger.log(B?"updateKey":"missingKey",d,u,l,B?N:m),s){var z=this.resolve(l,YH(YH({},t),{},{keySeparator:!1}));z&&z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var F=[],U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&U&&U[0])for(var j=0;j<U.length;j++)F.push(U[j]);else"all"===this.options.saveMissingTo?F=this.languageUtils.toResolveHierarchy(t.lng||this.language):F.push(t.lng||this.language);var H=function(e,n,r){var o=k&&r!==m?r:D;i.options.missingKeyHandler?i.options.missingKeyHandler(e,u,n,o,B,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,u,n,o,B,t),i.emit("missingKey",e,u,n,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?F.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(n){H([e],l+n,t["defaultValue".concat(n)]||N)}))})):H(F,l,N))}m=this.extendTranslation(m,e,t,f,r),R&&m===l&&this.options.appendNamespaceToMissingKey&&(m="".concat(u,":").concat(l)),(R||I)&&this.options.parseMissingKeyHandler&&(m="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(u,":").concat(l):l,I?m:void 0):this.options.parseMissingKeyHandler(m))}return o?(f.res=m,f):m}},{key:"extendTranslation",value:function(e,t,n,r,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,YH(YH({},this.options.interpolation.defaultVariables),n),r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(YH(YH({},n),{interpolation:YH(YH({},this.options.interpolation),n.interpolation)}));var s,a="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){var l=e.match(this.interpolator.nestingRegexp);s=l&&l.length}var c=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(c=YH(YH({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,n.lng||this.language,n),a){var u=e.match(this.interpolator.nestingRegexp);s<(u&&u.length)&&(n.nest=!1)}!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return i&&i[0]===r[0]&&!n.context?(o.logger.warn("It seems you are nesting recursively key: ".concat(r[0]," in key: ").concat(t[0])),null):o.translate.apply(o,r.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var d=n.postProcess||this.options.postProcess,h="string"==typeof d?[d]:d;return null!=e&&h&&h.length&&!1!==n.applyPostProcessor&&(e=JH.handle(h,e,t,this.options&&this.options.postProcessPassResolved?YH({i18nResolved:r},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,r,i,o,s=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!s.isValidLookup(t)){var l=s.extractFromKey(e,a),c=l.key;n=c;var u=l.namespaces;s.options.fallbackNS&&(u=u.concat(s.options.fallbackNS));var d=void 0!==a.count&&"string"!=typeof a.count,h=d&&!a.ordinal&&0===a.count&&s.pluralResolver.shouldUseIntlApi(),p=void 0!==a.context&&("string"==typeof a.context||"number"==typeof a.context)&&""!==a.context,f=a.lngs?a.lngs:s.languageUtils.toResolveHierarchy(a.lng||s.language,a.fallbackLng);u.forEach((function(e){s.isValidLookup(t)||(o=e,!XH["".concat(f[0],"-").concat(e)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(o)&&(XH["".concat(f[0],"-").concat(e)]=!0,s.logger.warn('key "'.concat(n,'" for languages "').concat(f.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),f.forEach((function(n){if(!s.isValidLookup(t)){i=n;var o,l=[c];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(l,c,n,e,a);else{var u;d&&(u=s.pluralResolver.getSuffix(n,a.count,a));var f="".concat(s.options.pluralSeparator,"zero");if(d&&(l.push(c+u),h&&l.push(c+f)),p){var m="".concat(c).concat(s.options.contextSeparator).concat(a.context);l.push(m),d&&(l.push(m+u),h&&l.push(m+f))}}for(;o=l.pop();)s.isValidLookup(t)||(r=o,t=s.getResource(n,e,o,a))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}]),n}(IH);function eG(e){return e.charAt(0).toUpperCase()+e.slice(1)}var tG=function(){function e(t){uH(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=MH.create("languageUtils")}return hH(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=eG(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=eG(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=eG(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),r.forEach((function(e){i.indexOf(e)<0&&o(n.formatLanguageCode(e))})),i}}]),e}(),nG=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],rG={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},iG=["v1","v2","v3"],oG={zero:0,one:1,two:2,few:3,many:4,other:5};function sG(){var e={};return nG.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:rG[t.fc]}}))})),e}var aG=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};uH(this,e),this.languageUtils=t,this.options=n,this.logger=MH.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=sG()}return hH(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((function(e,t){return oG[e]-oG[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):r.numbers.map((function(r){return t.getSuffix(e,r,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var o=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!iG.includes(this.options.compatibilityJSON)}}]),e}();function lG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function cG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lG(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lG(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var uG=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};uH(this,e),this.logger=MH.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return hH(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:UH,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?zH(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?zH(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?zH(t.nestingPrefix):t.nestingPrefixEscaped||zH("$t("),this.nestingSuffix=t.nestingSuffix?zH(t.nestingSuffix):t.nestingSuffixEscaped||zH(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,s,a=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(e.indexOf(a.formatSeparator)<0){var i=DH(t,l,e);return a.alwaysFormat?a.format(i,void 0,n,cG(cG(cG({},r),t),{},{interpolationkey:e})):i}var o=e.split(a.formatSeparator),s=o.shift().trim(),c=o.join(a.formatSeparator).trim();return a.format(DH(t,l,s),c,n,cG(cG(cG({},r),t),{},{interpolationkey:s}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,h=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return a.escapeValue?c(a.escape(e)):c(e)}}].forEach((function(t){for(s=0;i=t.regex.exec(e);){var n=i[1].trim();if(void 0===(o=u(n)))if("function"==typeof d){var l=d(e,i,r);o="string"==typeof l?l:""}else if(r&&r.hasOwnProperty(n))o="";else{if(h){o=i[0];continue}a.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}else"string"==typeof o||a.useRawValueToEscape||(o=PH(o));var c=t.safeValue(o);if(e=e.replace(i[0],c),h?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++s>=a.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=cG({},o);function a(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),i="{".concat(r[1]);e=r[0];var o=(i=this.interpolate(i,s)).match(/'/g),a=i.match(/"/g);(o&&o.length%2==0&&!a||a.length%2!=0)&&(i=i.replace(/'/g,'"'));try{s=JSON.parse(i),t&&(s=cG(cG({},t),s))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(i)}return delete s.defaultValue,e}for(s.applyPostProcessor=!1,delete s.defaultValue;n=this.nestingRegexp.exec(e);){var l=[],c=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var u=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=u.shift(),l=u,c=!0}if((r=t(a.call(this,n[1].trim(),s),s))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=PH(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),c&&(r=l.reduce((function(e,t){return i.format(e,t,o.lng,cG(cG({},o),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function dG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function hG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dG(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dG(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pG(e){var t={};return function(n,r,i){var o=r+JSON.stringify(i),s=t[o];return s||(s=e(r,i),t[o]=s),s(n)}}var fG=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};uH(this,e),this.logger=MH.create("formatter"),this.options=t,this.formats={number:pG((function(e,t){var n=new Intl.NumberFormat(e,t);return function(e){return n.format(e)}})),currency:pG((function(e,t){var n=new Intl.NumberFormat(e,hG(hG({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:pG((function(e,t){var n=new Intl.DateTimeFormat(e,hG({},t));return function(e){return n.format(e)}})),relativetime:pG((function(e,t){var n=new Intl.RelativeTimeFormat(e,hG({},t));return function(e){return n.format(e,t.range||"day")}})),list:pG((function(e,t){var n=new Intl.ListFormat(e,hG({},t));return function(e){return n.format(e)}}))},this.init(t)}return hH(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=t.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=pG(t)}},{key:"format",value:function(e,t,n,r){var i=this,o=t.split(this.formatSeparator).reduce((function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);"currency"===t&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=_H(e.split(":")),r=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[r.trim()]||(n[r.trim()]=i),"false"===i&&(n[r.trim()]=!1),"true"===i&&(n[r.trim()]=!0),isNaN(i)||(n[r.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:n}}(t),s=o.formatName,a=o.formatOptions;if(i.formats[s]){var l=e;try{var c=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},u=c.locale||c.lng||r.locale||r.lng||n;l=i.formats[s](e,u,hG(hG(hG({},a),r),c))}catch(e){i.logger.warn(e)}return l}return i.logger.warn("there was no format function for ".concat(s)),e}),e);return o}}]),e}();function mG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function gG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mG(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mG(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function vG(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=vH(e);if(t){var i=vH(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gH(this,n)}}var yG=function(e){mH(n,e);var t=vG(n);function n(e,r,i){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return uH(this,n),o=t.call(this),jH&&IH.call(pH(o)),o.backend=e,o.store=r,o.services=i,o.languageUtils=i.languageUtils,o.options=s,o.logger=MH.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=s.maxParallelReads||10,o.readingCalls=0,o.maxRetries=s.maxRetries>=0?s.maxRetries:5,o.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,s.backend,s),o}return hH(n,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},s={},a={},l={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var a="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[a]=2:i.state[a]<0||(1===i.state[a]?void 0===s[a]&&(s[a]=!0):(i.state[a]=1,r=!1,void 0===s[a]&&(s[a]=!0),void 0===o[a]&&(o[a]=!0),void 0===l[t]&&(l[t]=!0)))})),r||(a[e]=!0)})),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var s={};this.queue.forEach((function(n){var r,a,l,c,u,d;r=n.loaded,a=o,c=OH(r,[i],Object),u=c.obj,d=c.k,u[d]=u[d]||[],l&&(u[d]=u[d].concat(a)),l||u[d].push(a),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){s[e]||(s[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===s[e][t]&&(s[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",s),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;return e.length?this.readingCalls>=this.maxParallelReads?void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:i,wait:o,callback:s}):(this.readingCalls++,this.backend[n](e,t,(function(a,l){if(r.readingCalls--,r.waitingReads.length>0){var c=r.waitingReads.shift();r.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}a&&l&&i<r.maxRetries?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,s)}),o):s(a,l)}))):s(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(function(r,s){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&s&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),s),t.loaded(e,r,s)}))}},{key:"saveMissing",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,r,null,gG(gG({},o),{},{isUpdate:i})),e&&e[0]&&this.store.addResource(e[0],t,n,r))}}]),n}(IH);function bG(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===IF(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===IF(e[2])||"object"===IF(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function SG(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function xG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xG(Object(n),!0).forEach((function(t){kF(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xG(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _G(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=vH(e);if(t){var i=vH(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gH(this,n)}}function CG(){}function AG(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var EG=function(e){mH(n,e);var t=_G(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(uH(this,n),e=t.call(this),jH&&IH.call(pH(e)),e.options=SG(r),e.services={},e.logger=MH,e.modules={external:[]},AG(pH(e)),i&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,i),gH(e,pH(e));setTimeout((function(){e.init(r,i)}),0)}return e}return hH(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var r=bG();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=wG(wG(wG({},r),this.options),SG(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=wG(wG({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var o;this.modules.logger?MH.init(i(this.modules.logger),this.options):MH.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=fG);var s=new tG(this.options);this.store=new KH(this.options.resources,this.options);var a=this.services;a.logger=MH,a.resourceStore=this.store,a.languageUtils=s,a.pluralResolver=new aG(s,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(a.formatter=i(o),a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new uG(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new yG(i(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.languageDetector&&(a.languageDetector=i(this.modules.languageDetector),a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=i(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new $H(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=CG),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var c=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];c.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}));var u=["addResource","addResources","addResourceBundle","removeResourceBundle"];u.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var d=RH(),h=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),d.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),d}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:CG,r=n,i="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return r();var o=[],s=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){o.indexOf(e)<0&&o.push(e)}))};if(i)s(i);else{var a=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);a.forEach((function(e){return s(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return s(e)})),this.services.backendConnector.load(o,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),r(e)}))}else r(null)}},{key:"reloadResources",value:function(e,t,n){var r=RH();return e||(e=this.languages),t||(t=this.options.ns),n||(n=CG),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&JH.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=RH();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(o){e||o||!n.services.languageDetector||(o=[]);var s="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);s&&(n.language||i(s),n.translator.language||n.translator.changeLanguage(s),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(s)),n.loadResources(s,(function(e){!function(e,o){o?(i(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,s)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,i=function e(t,i){var o;if("object"!==IF(i)){for(var s=arguments.length,a=new Array(s>2?s-2:0),l=2;l<s;l++)a[l-2]=arguments[l];o=r.options.overloadTranslationOptionHandler([t,i].concat(a))}else o=wG({},i);o.lng=o.lng||e.lng,o.lngs=o.lngs||e.lngs,o.ns=o.ns||e.ns,o.keyPrefix=o.keyPrefix||n||e.keyPrefix;var c=r.options.keySeparator||".",u=o.keyPrefix?"".concat(o.keyPrefix).concat(c).concat(t):t;return r.t(u,o)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=n,i}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var s=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var a=n.precheck(this,s);if(void 0!==a)return a}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!s(r,e)||i&&!s(o,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=RH();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=RH();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter((function(e){return r.indexOf(e)<0}));return i.length?(this.options.preload=r.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:CG,i=wG(wG(wG({},this.options),t),{isClone:!0}),o=new n(i);void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t));var s=["store","services","language"];return s.forEach((function(t){o[t]=e[t]})),o.services=wG({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new $H(o.services,o.options),o.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit.apply(o,[e].concat(n))})),o.init(i,r),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(IH);kF(EG,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new EG(e,t)}));var TG=EG.createInstance();TG.createInstance=EG.createInstance;var MG,IG=TG.createInstance;TG.init,TG.loadResources,TG.reloadResources,TG.use,TG.changeLanguage,TG.getFixedT,TG.t,TG.exists,TG.setDefaultNamespace,TG.hasLoadedNamespace,TG.loadNamespaces,TG.loadLanguages;MG=JSON.parse('{"yes":"Si","no":"No","confirm":"Conferma","apply":"Applica","cancel":"Annulla","show":"Mostra","hide":"Nascondi","send":"Invia","close":"Chiudi","edit":"Modifica","delete":"Elimina","loading":"Caricamento","expand":"Espandi","collapse":"Riduci","fullscreenEnter":"Passa a schermo intero","fullscreenExit":"Esci da schermo intero","center":"Centro","bottom":"In basso","hidden":"Nascosto","day":"Giorno","month":"Mese","year":"Anno","createdAt":"Data creazione","selected":"Selezionati","page":"pagina","actions":"Azioni","next":"Successivo","previous":"Precedente","copy":"Copia","copyToClipboard":"Copia negli appunti","showOriginalText":"Mostra originale","showTranslatedText":"Mostra traduzione","exactPosition":"Posizione esatta","uncertain":"Incertezza","question":"Domanda","nothingFound":"Nessun risultato","venue":"Luogo","searchVenue":"Cerca luogo...","memoriBlockedTitle":"Bloccato","memoriBlockedUntil":"Memori bloccato fino al {{date}}","memoriBlockedAnon":"Attualmente \\"{{name}}\\" non può rispondere, torna qui il {{date}}","memoriBlockedReasonExceedChats":"perchè ha superato la soglia mensile di chat ammesse.","memoriBlockedGiverHelper":"Puoi sempre gestirlo in qualità di amministratore, ma altri utenti non potranno interrogarlo.","generatedByAI":"Risposta generata da IA, può talvolta generare informazioni non corrette","whyThisAnswer":"Perché questa risposta?","whyThisAnswerHelper":"Questa risposta è stata generata automaticamente da un\'intelligenza artificiale sulla base di questi contenuti verificati.","completionsEnabled":"IA evoluta, può rispondere con risposte generate automaticamente che talvolta potrebbero contenere informazioni non corrette","completionProviderDown":"Questo Twin è integrato con una IA generativa di {{provider}}, ma al momento non è disponibile. Riprova più tardi.","completionProviderFallbackName":"un provider esterno","completionProviderCheckStatusPage":"Vedi pagina di stato","boardOfExperts":"Gruppo di esperti","birthDate":"Data di nascita","birthDateHelper":"Ti chiediamo la data di nascita esclusivamente per abilitare o disabilitare le funzionalità che hanno restrizioni in base all\'età","underage":"Devi avere almeno {{age}} anni per registrarti.","underageTwinSession":"Devi avere almeno {{age}} anni per interagire con questo Twin.","ageVerification":"Verifica dell\'età","ageVerificationText":"Per interagire con questo Twin, devi aver almeno {{minAge}} anni.","nsfw":"NSFW: Questo Twin contiene contenuti per adulti","deepThought":"Pensiero profondo","deepThoughtHelper":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme.","deepThoughtDisclaimerTitle":"Pensiero profondo abilitato","deepThoughtDisclaimer":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme.","deepThoughtPreDisclaimerUnlogged":"Accedi per abilitare Pensiero Profondo.","deepThoughtPreDisclaimerNotAllowed":"Pensiero Profondo è disabilitato poiché non hai acconsentito al suo utilizzo, puoi cambiare la tua scelta in qualsiasi momento nelle impostazioni del tuo account.","knownFacts":{"title":"Fatti noti","description":"Dettagli delle informazioni condivise tra te e {{memoriName}}","type":"Tipo","typeShortTerm":"Breve termine","typeLongTerm":"Lungo termine","typeHelper":"Tipi:\\n- Breve termine: questo fatto noto è sempre utilizzato durante le conversazioni\\n- Lungo termine: questo fatto noto è utilizzato durante le conversazioni solo se rilevante per la domanda corrente","text":"Testo","deleteSuccess":"Fatto noto eliminato","deleteConfirmTitle":"Elimina il fatto noto","deleteConfirmMessage":"Confermi di voler eliminare questo fatto noto?","deleteSelectedConfirmTitle":"Elimina i fatti noti selezionati","deleteSelectedConfirmMessage":"Confermi di voler eliminare i fatti noti selezionati?"},"auth":{"title":"Autenticazione","useRecoveryTokens":"Utilizza i token di recupero","tokens":"Token","addToken":"Aggiungi token","usePassword":"Utilizza la password","atLeast":"Almeno"},"widget":{"instruct":"Istruisci","test":"Prova","sound":"Audio","position":"Preferenze posizione","settings":"Impostazioni","share":"Condividi","sendOnKeypress":"Premi Invio per inviare","sendOnClick":"Clicca sul bottone di invio","boardOfExperts":"Gruppo di esperti","showExpertsInTheBoard":"Mostra gli esperti di questo gruppo","expertsInTheBoard":"Esperti di questo gruppo","goToIntegrationsToCustomizeAvatar":"Per personalizzare l\'avatar, vai a Condividimi e configura la pagina pubblica"},"write_and_speak":{"micButtonPopover":"Premi il pulsante per parlare","micButtonPopoverListening":"Premi il pulsante per smettere di parlare","pageInstructExplanation":"Per insegnarmi nuove cose clicca sul pulsante ISTRUISCIMI per cominciare","pageTryMeExplanation":"Per parlare con me clicca sul pulsante INIZIAMO per cominciare","instructButton":"ISTRUISCIMI","tryMeButton":"INIZIAMO","chatHistory":"Cronologia chat","exportChatHistory":"Esporta la cronologia chat","exportChatHistoryMessage":"Vuoi esportare la cronologia chat?","chatBotButtonText":"CLICCA QUI PER APRIRE LA CHAT","conversationStartedLabel":"Conversazione avvenuta il","settingsHeaderLabel":"Configura qui il memori se vuoi impostare una conversazione continua. Setta i secondi di silenzio prima dell\'invio.","continuousSpeechLabel":"Conversazione continua","holdToSpeak":"Tieni premuto per parlare","releaseToEndListening":"Rilascia per smettere di parlare","pressAndHoldToSpeak":"Premi e tieni premuto per parlare","microphoneMode":"Modalità microfono","hideEmissionsLabel":"Nascondi testo emesso dal Twin","secondsLabel":"Secondi","controlsPosition":"Posizione dei controlli","tryMeHeaderLabel":"PROVA","unknownPosition":"Posizione sconosciuta","fieldPlace":"Indica la posizione (es \'Milano\')","showMapLinkFor":"Visualizza sulla mappa la posizione","useMyPosition":"Usa la mia posizione","myPosition":"Posizione corrente","updatingPosition":"Aggiorno la posizione...","placeNotFound":"Luogo sconosciuto!","requirePositionHelp":"Per parlare con {{name}} devi decidere se fornire o meno la tua posizione. Questo perchè diverse risposte che potrà fornirti potrebbero dipendere da dove ti trovi.","dontWantToProvidePosition":"Non voglio fornire la mia posizione","attachmentsLabel":"Arricchisci il tuo messaggio","iWantToTalkToIn":"Voglio parlare con {{name}} in"},"media":{"title":"Titolo","editAttributes":"Modifica attributi media","uploadMimeTypeNotAllowed":"Il tipo di file non è permesso","uploadSizeLimitMessage":"Il file caricato è troppo grande (max {{size}}MB)","uploadWrongResolutionMessage":"La risoluzione deve essere {{width}}x{{height}} pixel","memoriNameAlreadyUsed":"Hai già un Twin con questo nome","uploadHelperImages":"Caricare un file con estensione png, jpg, jpeg o gif e con dimensione massima di {{size}}MB","uploadHelper":"Caricare un file di dimensione massima di {{size}}MB","uploadError":"Errore nel caricamento","square":"quadrato","scaleRatio":"Proporzioni","addMediaLabel":"Aggiungi media","insertThisMediaMsg":"Inserisci questi media","mediaUploadMessage":"Clicca per caricare un nuovo media","addLinkLabel":"Aggiungi un link","linkKey":"URL","linkValue":"Titolo link","insertThisLink":"Inserisci un link a {{url}} con titolo {{title}}"},"gamification":{"level":"Livello","points":"punti","memoriReachedLevel":"è diventato più evoluto ed ha raggiunto il livello","levelGoToStatistics":"{{memori}} è al livello {{level}} con {{points}} punti. Clicca per andare alle statistiche.","congratulationsNewLevel":"Congratulazioni, hai raggiunto un nuovo livello!","congratulationsNewLevelDescription":"Il tuo Memori è diventato più evoluto con {{points}} punti, guarda le","statistics":"statistiche"},"login":{"login":"Accedi","logout":"Esci","user":"Utente","loggedDrawerTitle":"Ciao, {{name}}!","loginDrawerTitle":"Accedi","signupDrawerTitle":"Registrati","newUserSignUp":"Sei un nuovo utente?","signUp":"Registrati!","alreadyHaveAnAccount":"Hai già un account?","backToLogin":"Torna al login","registrationDisabled":"La registrazione è disabilitata.","contactAdmin":"Contatta l\'amministratore per richiedere l\'accesso","userNameOrEmail":"Nome utente o email","email":"Email","emailFormatError":"Per favore, inserisci una mail valida","username":"Nome utente","usernameContainsReservedWord":"Il nome utente contiene una parola riservata, per favore cambia il nome utente","usernameFormatError":"Il nome utente deve essere lungo almeno 3 caratteri e può contenere solo lettere, numeri e _","otpCode":"Codice di verifica","resendVerificationCode":"Invia di nuovo","resentVerificationCode":"Codice di verifica inviato! Controlla la tua mail.","password":"Password","newPassword":"Nuova password","confirmPassword":"Conferma la password","currentPassword":"Password attuale","passwordMatchingError":"Le password non coincidono.","passwordFormatError":"La password deve essere lunga almeno 8 caratteri e contenere almeno un numero, una lettera maiuscola, una minuscola e un simbolo","pwdWeak":"Debole","pwdAcceptable":"Accettabile","pwdStrong":"Forte","mustChangePassword":"Devi cambiare la password","passwordChange":"Cambio password","emailChange":"Cambio email","avatarChange":"Cambio avatar","underage":"Devi avere almeno {{age}} anni per registrarti.","optional":"opzionale","birthDate":"Data di nascita","birthDateHelper":"Ti chiediamo la data di nascita esclusivamente per abilitare o disabilitare le funzionalità che hanno restrizioni in base all\'età","missingData":"Informazioni mancanti","missingDataHelper":"Sappiamo che questo è un po\' fastidioso, ma abbiamo bisogno di alcune informazioni in più per completare la tua registrazione.","goToAccountToChangeYourPreferences":"Puoi cambiare la tua scelta in qualsiasi momento dalla tua pagina Account.","deepThoughtExplaination":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme. Consenti all\'autore del twin di contattarti per offerte commerciali riguardanti prodotti su cui hai espresso interesse.","tnCAndPPAcceptedHelper":"Dall\'ultimo accesso, i T&C e l\'Informativa sulla privacy sono stati modificati. Si prega di accettarle, altrimenti non sarà possibile apportare modifiche ai propri gemelli. Puoi sempre cancellare il tuo account nella pagina del tuo profilo utente.","privacyLabel":"Ho letto e accettato l\'","privacyAndCookiePolicy":"informativa sui cookie e sulla privacy","and":"e","termsOfService":"i termini del servizio","pAndCUAccepted":"Accetto le condizioni di utilizzo relative a Pensiero Profondo","editAccount":"Modifica account","save":"Salva"},"success":"Operazione andata a buon fine","Error":"Errore","internal server error":"Ops, scusa... qualcosa è andato storto nel server","error":"Errore","error.loading":"Errore durante il caricamento dei contenuti.","error.notFound":"Ops, non abbiamo trovato ciò che cercavi.","error.generic":"Ops, qualcosa è andato storto.","error.serverNotResponding":"Stiamo facendo manutenzione o rilasciando aggiornamenti. Riprova più tardi.","error.unprocessableEntity":"Errore durante il salvataggio dei dati. Ricontrolla i dati inseriti.","error.goBackTo":"Prova a tornare alla","error.reloadPage":"Ricarica la pagina","error.tryAgain":"Riprova","error.unauthorized":"Non sei autorizzato a visualizzare questo contenuto.","errors":{"TENANT_NOT_FOUND":"Tenant non trovato","TENANT_REGISTRATION_DISABLED":"La registrazione su questa piattaforma è disabilitata","TENANT_MISSING_NAME":"Tenant: nome mancante","TENANT_MAX_USERS_REACHED":"Numero massimo di utenti raggiunto","TENANT_MAX_ADMINS_REACHED":"Numero massimo di utenti amministratori raggiunto","TENANT_ALREADY_EXISTS":"Tenant già esistente","TENANT_MISSING_DESCRIPTION":"Tenant: descrizione mancante","TENANT_CANT_SET_COMPLETION_PROVIDER":"Tenant: non abilitato a gestire il provider di completamento","USER_NOT_CONFIRMED":"Utente ancora non confermato","USER_NOT_FOUND":"Utente non trovato","USER_OR_PASSWORD_INVALID":"Utente o password non validi","USER_MUST_CHANGE_PASSWORD":"Devi cambiare la password","USER_MUST_ENTER_VERIFICATION_CODE":"Devi inserire il codice di verifica","USER_MISSING_TENANT":"Utente: tenant mancante","USER_MISSING_NAME":"Utente: nome mancante","USER_MISSING_PASSWORD":"Utente: password mancante","USER_MISSING_EMAIL":"Utente: email mancante","USER_MISSING_VERIFICATION_CODE":"Utente: codice di verifica mancante","USER_NAME_ALREADY_USED":"Nome utente già in uso","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"La password non rispetta le regole di sicurezza","USER_EMAIL_ALREADY_USED":"Email già in uso","USER_EMAIL_INVALID":"Email non valida","USER_VERIFICATION_CODE_INVALID":"Codice di verifica non valido","USER_MISSING_NAME_OR_EMAIL":"Nome utente o email mancante","USER_NAME_INVALID":"Nome utente non valido","USER_HAS_ONE_OR_MORE_MEMORI":"L\'utente ha uno o più memori","USER_MISSING_NEW_PASSWORD":"Utente: nuova password mancante","USER_NOTHING_TO_DO":"Niente da fare","USER_CANT_CREATE_MEMORI":"Utente non abilitato a creare Memori","USER_MAX_MEMORI_REACHED":"Massimo numero di Memori raggiunto","USER_TOO_MANY_ATTEMPTS":"Troppi tentativi","USER_MUST_ACCEPT_TNC_AND_PP":"Devi accettare i termini e le condizioni","USER_BIRTH_DATE_CANT_BE_CHANGED":"Data di nascita non può essere cambiata","USER_CANT_SET_COMPLETION_PROVIDER":"Utente: non abilitato a gestire il provider di completamento","USER_CANT_ENABLE_DEEP_THOUGHT":"Utente: non abilitato a gestire Pensiero Profondo","USER_CANT_ENABLE_DCM_INTEGRATION":"Utente: non abilitato a gestire l\'integrazione con DCM","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"Utente: non abilitato a gestire la concatenazione o il gruppo di esperti","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"Il gruppo di esperti richiede l\'abilitazione delle completions","MEMORI_NOT_FOUND":"Memori non trovato","MEMORI_NOT_ACCESSIBLE":"Memori non accessibile","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Solo il proprietario può cambiare il tag e il pin","SESSION_NOT_FOUND":"Sessione non trovata","SESSION_IS_NOT_ADMINISTRATIVE":"Sessione non amministrativa","SESSION_EXPIRED":"Sessione scaduta","MEMORI_MISSING_CONFIGURATION":"Memori: configurazione mancante","MEMORI_CONFIGURATION_NOT_FOUND":"Memori: configurazione non trovata","MEMORI_INVALID_PRIVACY_TYPE":"Memori: tipo di privacy non valido","MEMORI_MISSING_PASSWORD":"Memori: password mancante","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Memori: numero totale di token di recupero non valido","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Memori: numero minimo di token di recupero non valido","MEMORI_INVALID_VOICE_TYPE":"Memori: tipo di voce non valido","MEMORI_MISSING_NAME":"Memori: nome mancante","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Memori: password o token di recupero mancanti","MEMORI_INVALID_ID":"Memori: ID non valido","MEMORI_NAME_ALREADY_USED":"Nome memori già in uso","MEMORI_INVALID_PIN":"Memori: PIN non valido","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Memori: cambio TAG e PIN richiedono operazioni separate","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Memori: password non richiesta su Memori pubblico","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Pensiero Profondo richiede l\'abilitazione delle completions","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Trasferimento: utente di destinazione mancante","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Trasferimento: ID utente di destinazione non valido","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Trasferimento: dati utente di destinazione non validi","MEMORI_TRANSFER_NOTHING_TO_DO":"Trasferimento: alcuna operazione da fare","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Memori: la configurazione non può essere modificata","MEMORI_MISSING_NEW_PASSWORD":"Memori: nuova password mancante","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Formato non valido data a partire da","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Formato non valido data fino a","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"Memori: funzionalità richiede un abbonamento","INTEGRATION_NOT_FOUND":"Integrazione non trovata","INTEGRATION_INVALID_TYPE":"Tipo integrazione non valido","INTEGRATION_ALREADY_EXISTS":"Integrazione già esistente","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Memori non pubblici non possono essere integrati","INTEGRATION_MISSING_INVOCATION_TEXT":"Integrazione: testo di invocazione mancante","INTEGRATION_MISSING_DEVICE_EMAILS":"Integrazione: email del dispositivo mancante","INTEGRATION_MEMORI_IS_EMPTY":"Memori vuoti non possono essere integrati","INTEGRATION_MISSING_PRIVACY_POLICY":"Integrazione: privacy policy mancante","INTEGRATION_MISSING_CATEGORY":"Categoria integrazione mancante","INTEGRATION_MISSING_DESCRIPTION":"Descrizione integrazione mancante","INTEGRATION_INVALID_INVOCATION_TEXT":"Testo di invocazione non valido","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home non più disponibile","UPLOAD_REQUIRES_MULTIPART_ENCODING":"L\'upload richiede l\'encoding multipart","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: manca il content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: dimensione massima superata","UPLOAD_FILE_IS_EMPTY":"Upload: file vuoto","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: tipo di file o firma non validi","UPLOAD_MISSING_FILE_NAME":"Upload: nome file mancante","UPLOAD_INVALID_MEMORY_ID":"Upload: ID contenuto non valido","UPLOAD_MISSING_FILE_CONTENT":"Upload: contenuto file mancante","ASSET_NOT_FOUND":"Asset non trovato","ASSET_NOT_ACCESSIBLE":"Asset non accessibile","ASSET_MISSING_SESSION_ID":"Asset: ID sessione mancante","ASSET_INVALID_FILE_NAME":"Asset: nome file non valido","INVITATION_NOT_FOUND":"Invito non trovato","INVITATION_NOT_ACCESSIBLE":"Invito non accessibile","INVITATION_ALREADY_ACCEPTED":"Invito già accettato","INVITATION_ALREADY_REJECTED":"Invito già rifiutato","INVITATION_MISSING_DESTINATION_EMAIL":"Invito: email di destinazione mancante","INVITATION_DESTINATION_EMAIL_INVALID":"Invito: email di destinazione non valida","INVITATION_MISSING_TAG":"Invito: tag mancante","INVITATION_MISSING_PIN":"Invito: PIN mancante","INVITATION_INVALID_PIN":"Invito: PIN non valido","INVITATION_INVALID_TYPE":"Invito: tipo non valido","INVITATION_MISSING_DESTINATION_NAME":"Invito: nome destinatario mancante","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invito: tag e pin non possono essere cambiati","INVITATION_CANT_BE_CHANGED":"Invito: non può essere modificato","ACTIONLOG_INVALID_USER_ID":"ID utente non valido","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","ACTIONLOG_INVALID_MEMORI_ID":"ID Memori non valido","CONSUMPTIONLOG_INVALID_TYPE":"Tipo di log non valido","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","CONSUMPTIONLOG_INVALID_USER_ID":"ID utente non valido","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Memori ID non valido","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notifiche: Periodo di estrazione chatlog non valido","PROCESS_INVALID_TYPE":"Tipo di processo non valido","PROCESS_ALREADY_RUNNING":"Processo già in esecuzione","PROCESS_NOT_FOUND":"Processo non trovato","IMPORTCSV_MISSING_ROWS":"Importazione CSV: righe mancanti","IMPORTCSV_MISSING_CSV":"Importazione CSV: CSV mancante","IMPORTCSV_MISSING_SEPARATOR":"Importazione CSV: separatore mancante","IMPORTCSV_INVALID_SEPARATOR":"Importazione CSV: separatore non valido","IMPORTCSV_MISSING_HEADERS":"Importazione CSV: intestazioni mancanti","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Importazione CSV: separatore varianti titolo mancante","IMPORTCSV_INVALID_RECEIVER_ID":"Importazione CSV: ID receiver non valido","IMPORTCSV_INVALID_MEDIA_LINK":"Importazione CSV: link media non valido","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"Importazione CSV: encoding caratteri non rilevabile","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"Importazione CSV: impossibile importare in Memori segreti","IMPORTTXT_MISSING_ROWS":"Importazione TXT: righe mancanti","IMPORTTXT_INVALID_GRANULARITY":"Importazione TXT: granularità non valida","IMPORTTXT_INVALID_RECEIVER_ID":"Importazione TXT: ID receiver non valido","IMPORTTXT_INVALID_MEDIA_LINK":"Importazione TXT: link media non valido","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"Importazione TXT: encoding caratteri non rilevabile","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"Importazione TXT: impossibile importare in Memori segreti","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Importazione TXT: limite importazione superato","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Importazione TXT: importazione su GPT-4 richiede API key","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Importazione TXT: importazione richiede un piano a pagamento","EXPORTCSV_MISSING_CSV_SPECS":"Esportazione CSV: specifiche CSV mancanti","EXPORTCSV_MISSING_SEPARATOR":"Esportazione CSV: separatore mancante","EXPORTCSV_INVALID_SEPARATOR":"Esportazione CSV: separatore non valido","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Esportazione CSV: separatore varianti titolo mancante","EXPORTCSV_MISSING_NEW_LINE_CHAR":"Esportazione CSV: carattere di nuova riga mancante","EXPORTCSV_INVALID_NEW_LINE_CHAR":"Esportazione CSV: carattere di nuova riga non valido","EXPORTCSV_MISSING_PASSWORD":"Esportazione CSV: password mancante","EXPORTJSONL_MISSING_JSONL_SPECS":"Esportazione JSONL: specifiche JSONL mancanti","EXPORTJSONL_MISSING_PLATFORM":"Esportazione JSONL: piattaforma mancante","EXPORTJSONL_INVALID_PLATFORM":"Esportazione JSONL: piattaforma non valida","EXPORTJSONL_MISSING_PASSWORD":"Esportazione JSONL: password mancante","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"Esportazione JSONL: esportazione richiede un piano a pagamento","ANALYSIS_MISSING_QUERY":"Analisi: query mancante","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analisi: impossibile analizzare Memori segreti","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analisi: corrispondenza query utente richiede Pensiero Profondo","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Assegnazione badge: credenziali errate o mancanti","BADGE_ASSIGNMENT_MISSING_REF_ID":"Assegnazione badge: ID ref mancante","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Assegnazione badge: esito non trovato","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Assegnazione badge: URL di asserzione mancante","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Assegnazione badge: URL badge mancante","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Assegnazione badge: URL issuer mancante","BADGE_ASSIGNMENT_INVALID_URL":"Assegnazione badge: URL non valido","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Assegnazione badge: destinatario mancante","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Assegnazione badge: tipo destinatario sconosciuto","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Assegnazione badge: identità destinatario mancante","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Assegnazione badge: tipo hash destinatario mancante","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Assegnazione badge: tipo hash destinatario sconosciuto","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Assegnazione badge: identità destinatario errata","BADGE_NOT_FOUND":"Badge non trovato","OUTCOME_NO_DCM_CONFIGURED":"Esito: nessun DCM configurato","OUTCOME_USER_BADGES_DISABLED":"Esito: badge utente disabilitati"}}');const RG=IG({resources:{en:{translation:t(JSON.parse('{"yes":"Yes","no":"No","confirm":"Confirm","apply":"Apply","cancel":"Cancel","show":"Show","hide":"Hide","send":"Send","close":"Close","edit":"Edit","delete":"Delete","loading":"Loading","expand":"Expand","collapse":"Collapse","fullscreenEnter":"Enter fullscreen","fullscreenExit":"Exit fullscreen","center":"Center","bottom":"Bottom","hidden":"Hidden","day":"Day","month":"Month","year":"Year","createdAt":"Creation date","selected":"Selected","page":"page","actions":"Actions","next":"Next","previous":"Previous","copy":"Copy","copyToClipboard":"Copy to clipboard","showOriginalText":"Show original","showTranslatedText":"Show translation","exactPosition":"Exact position","uncertain":"Uncertain","question":"Question","nothingFound":"Nothing found","venue":"Venue","searchVenue":"Search venue...","memoriBlockedTitle":"Blocked","memoriBlockedUntil":"Memori blocked until {{date}}","memoriBlockedAnon":"Currently \\"{{name}}\\" can\'t answer, come back here on {{date}}","memoriBlockedReasonExceedChats":"because it has exceeded the monthly threshold of allowed chats.","memoriBlockedGiverHelper":"You can still manage it as administrator, but other users will not be able to interact with it.","generatedByAI":"Answer generated by AI, may occasionally generate incorrect informations","whyThisAnswer":"Why this answer?","whyThisAnswerHelper":"This answer was generated automatically by an artificial intelligence based on these verified contents.","completionsEnabled":"Advanced AI, can respond with automatically generated answers that may sometimes contain incorrect information","completionProviderDown":"This Twin is integrated with a generative AI from {{provider}}, but it is currently unavailable. Try again later.","completionProviderFallbackName":"an external provider","completionProviderCheckStatusPage":"Check status page","boardOfExperts":"Board of experts","birthDate":"Birth date","birthDateHelper":"We ask for your birth date only to enable or disable functionalities that have age restrictions","underage":"You must be at least {{age}} years old to sign up.","underageTwinSession":"You must be at least {{age}} years old to interact with this Twin.","ageVerification":"Age verification","ageVerificationText":"To interact with this Twin, you must be at least {{minAge}} years old.","nsfw":"NSFW: This Twin contains adult contents","deepThought":"Deep Thought","deepThoughtHelper":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together. Allow the twin\'s author to contact you for commercial offers regarding products you have shown interest in.","deepThoughtDisclaimerTitle":"Deep Thought enabled","deepThoughtDisclaimer":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together.","deepThoughtPreDisclaimerUnlogged":"Log in to enable Deep Thought.","deepThoughtPreDisclaimerNotAllowed":"Deep Thought is disabled since you didn\'t consent its usage, you can change this any time in your account settings.","knownFacts":{"title":"Known facts","description":"Details of the information shared between you and {{memoriName}}","type":"Type","typeShortTerm":"Short term","typeLongTerm":"Long term","typeHelper":"Types:\\n- Short Term: this Known Fact is always used during conversations\\n- Long Term: this Known Fact is used during conversations only if relevant to the current question","text":"Text","deleteSuccess":"Known fact deleted","deleteConfirmTitle":"Delete known fact","deleteConfirmMessage":"Are you sure you want to delete this known fact?","deleteSelectedConfirmTitle":"Delete selected known facts","deleteSelectedConfirmMessage":"Are you sure you want to delete the selected known facts?"},"auth":{"title":"Authentication","useRecoveryTokens":"Use recovery tokens","tokens":"Tokens","addToken":"Add token","usePassword":"Use password","atLeast":"At least"},"widget":{"instruct":"Instruct","test":"Test","sound":"Sound","position":"Position preferences","settings":"Settings","share":"Share","sendOnKeypress":"Hit Enter to send","sendOnClick":"Click on Submit","boardOfExperts":"Board of experts","showExpertsInTheBoard":"Show experts in this board","expertsInTheBoard":"Experts in this board","goToIntegrationsToCustomizeAvatar":"To customize the avatar, go to Share and customize the public page"},"write_and_speak":{"micButtonPopover":"Click the button to speak","micButtonPopoverListening":"Click the button to stop speak","pageInstructExplanation":"To teach me new things click on the INSTRUCT ME button to get started","pageTryMeExplanation":"To talk to me click on the START button to get started","instructButton":"INSTRUCT ME","tryMeButton":"START","chatHistory":"Chat history","exportChatHistory":"Export chat history","exportChatHistoryMessage":"Do you want to export chat history?","chatBotButtonText":"CLICK HERE TO OPEN CHATBOT","conversationStartedLabel":"Conversation started on","settingsHeaderLabel":"Setup here if you want to set the memori as continuous speech, and change the silence seconds if you want to customize them.","continuousSpeechLabel":"Continuous speech","holdToSpeak":"Hold to speak","releaseToEndListening":"Release to end listening","pressAndHoldToSpeak":"Press and hold to speak","microphoneMode":"Microphone mode","hideEmissionsLabel":"Hide text emitted by the Twin","secondsLabel":"Set seconds","controlsPosition":"Controls position","tryMeHeaderLabel":"TRY","unknownPosition":"Unknown position","fieldPlace":"Write the place (eg \'Milano\')","showMapLinkFor":"Show the position on the map","useMyPosition":"Use my position","myPosition":"Your position","updatingPosition":"Updating position...","placeNotFound":"Place not found!","requirePosition":"Insert your position before start","requirePositionHelp":"To talk to {{name}} you have to decide whether to provide your position or not. This is because different answers that it can provide you may depend on where you are.","dontWantToProvidePosition":"I don\'t want to provide my position","attachmentsLabel":"Enrich your message","iWantToTalkToIn":"I want to talk to {{name}} in"},"media":{"title":"Title","editAttributes":"Edit media attributes","uploadMimeTypeNotAllowed":"The file type is not allowed","uploadSizeLimitMessage":"The uploaded size is too big (max {{size}}MB)","uploadWrongResolutionMessage":"The resolution must be {{width}}x{{height}} pixel","memoriNameAlreadyUsed":"You already have a Twin with this name","uploadHelperImages":"Upload a file with extension png, jpg, jpeg or gif, and having at maximum a size of {{size}}MB","uploadHelper":"Upload a file having at maximum a size of {{size}}MB","uploadError":"Upload failed","square":"square","scaleRatio":"Scale ratio","addMediaLabel":"Add a media","insertThisMediaMsg":"Insert these media","mediaUploadMessage":"Click to load a new media","addLinkLabel":"Add a link","linkKey":"URL","linkValue":"Link title","insertThisLink":"Insert a link to {{url}} with title {{title}}"},"gamification":{"level":"Level","points":"points","memoriReachedLevel":"became more evolved and reached level","levelGoToStatistics":"{{memori}} is at level {{level}} with {{points}} points. Click to go to statistics.","congratulationsNewLevel":"Congratulations, you have reached a new level!","congratulationsNewLevelDescription":"Your Memori became more evolved with {{points}} points, look at the","statistics":"statistics"},"login":{"login":"Login","logout":"Logout","user":"User","loggedDrawerTitle":"Hi, {{name}}!","loginDrawerTitle":"Login","signupDrawerTitle":"Sign up","newUserSignUp":"New user?","signUp":"Sign up!","alreadyHaveAnAccount":"Already have an account?","backToLogin":"Back to login","registrationDisabled":"Registration is disabled","contactAdmin":"Contact the administrator to request access","userNameOrEmail":"Username or email","email":"Email","emailFormatError":"Please, insert a valid email","username":"Username","usernameContainsReservedWord":"Username contains a reserved word, please choose another one","usernameFormatError":"Username must be at least 3 characters long and contain only letters, numbers and _","otpCode":"Verification code","resendVerificationCode":"Resend code","resentVerificationCode":"Confirmation code sent! Please check your email.","password":"Password","newPassword":"New password","confirmPassword":"Confirm Password","currentPassword":"Current password","passwordMatchingError":"Passwords do not match.","passwordFormatError":"Password must be at least 8 characters long and contain at least a number, an upper case letter, a lower case letter and a symbol","pwdWeak":"Weak","pwdAcceptable":"Acceptable","pwdStrong":"Strong","mustChangePassword":"You must change your password","passwordChange":"Change password","emailChange":"Change email","avatarChange":"Change avatar","underage":"You must be at least {{age}} years old to sign up.","optional":"Optional","birthDate":"Birth date","birthDateHelper":"We ask for your birth date only to enable or disable functionalities that have age restrictions","missingData":"Missing informations","missingDataHelper":"We know that this is a bit annoying, but we need some more informations to complete your registration.","goToAccountToChangeYourPreferences":"You can change your choice at any time from your Account page.","deepThoughtExplaination":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together. Allow the twin\'s author to contact you for commercial offers regarding products you have shown interest in.","tnCAndPPAcceptedHelper":"Since your last login, T&C and Privacy Policy have changed. Please accept them, otherwise you won\'t be able to make changes to your Twins. You can always delete your account in your user profile page.","privacyLabel":"I have read and accepted the","privacyAndCookiePolicy":"Privacy e Cookie Policy","and":"and","termsOfService":"Terms of Service","pAndCUAccepted":"I accept the terms of service about Deep Thought","editAccount":"Edit account","save":"Save"},"success":"Success","Error":"Error","internal server error":"Oupsie, sorry... Something went wrong on the server","error":"Error","error.loading":"Error while loading content.","error.generic":"Oupsie, sorry... something went wrong.","error.serverNotResponding":"We are doing maintenance or releasing updates. Please try again later.","error.notFound":"Oupsie, we didn\'t find the page you were looking for.","error.goBackTo":"You can try to go back to the","error.reloadPage":"Reload the page","error.tryAgain":"Try again","error.unauthorized":"You are unauthorized to view this content.","error.unprocessableEntity":"Error while processing the request. Check the data you entered.","errors":{"TENANT_NOT_FOUND":"Tenant not found","TENANT_REGISTRATION_DISABLED":"Registration on this platform is disabled","TENANT_MISSING_NAME":"Tenant: name missing","TENANT_MAX_USERS_REACHED":"Maximum number of users reached","TENANT_MAX_ADMINS_REACHED":"Maximum number of admin users reached","TENANT_ALREADY_EXISTS":"Tenant already exists","TENANT_MISSING_DESCRIPTION":"Tenant: description missing","TENANT_CANT_SET_COMPLETION_PROVIDER":"Tenant: can\'t set completion provider","USER_NOT_CONFIRMED":"User still not confirmed","USER_NOT_FOUND":"User not found","USER_OR_PASSWORD_INVALID":"Invalid user or password","USER_MUST_CHANGE_PASSWORD":"You must change your password","USER_MUST_ENTER_VERIFICATION_CODE":"You must enter the verification code","USER_MISSING_TENANT":"User: missing tenant","USER_MISSING_NAME":"User: name is missing","USER_MISSING_PASSWORD":"User: password missing","USER_MISSING_EMAIL":"User: Missing email","USER_MISSING_VERIFICATION_CODE":"User: Missing verification code","USER_NAME_ALREADY_USED":"User name already in use","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"The password does not meet the security rules","USER_EMAIL_ALREADY_USED":"Email already in use","USER_EMAIL_INVALID":"Invalid email","USER_VERIFICATION_CODE_INVALID":"Invalid verification code","USER_MISSING_NAME_OR_EMAIL":"Missing username or email","USER_NAME_INVALID":"Invalid user name","USER_HAS_ONE_OR_MORE_MEMORI":"The user has one or more memories","USER_MISSING_NEW_PASSWORD":"User: new password missing","USER_NOTHING_TO_DO":"Nothing to do","USER_CANT_CREATE_MEMORI":"User not allowed to create Memori","USER_MAX_MEMORI_REACHED":"Maximum number of Memori reached","USER_TOO_MANY_ATTEMPTS":"Too many attempts","USER_MUST_ACCEPT_TNC_AND_PP":"You must accept the terms and conditions","USER_BIRTH_DATE_CANT_BE_CHANGED":"Date of birth cannot be changed","USER_CANT_SET_COMPLETION_PROVIDER":"User: not allowed to manage completion provider","USER_CANT_ENABLE_DEEP_THOUGHT":"User: not enabled to manage Deep Thought","USER_CANT_ENABLE_DCM_INTEGRATION":"User: not enabled to manage DCM integration","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"User: not allowed to manage chaining or expert group","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"The expert group requires completions to be enabled","MEMORI_NOT_FOUND":"Memori not found","MEMORI_NOT_ACCESSIBLE":"Memori not accessible","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Only owner can change tag or pin","SESSION_NOT_FOUND":"Session not found","SESSION_IS_NOT_ADMINISTRATIVE":"Non-administrative session","SESSION_EXPIRED":"Session expired","MEMORI_MISSING_CONFIGURATION":"Memori: missing configuration","MEMORI_CONFIGURATION_NOT_FOUND":"Memories: configuration not found","MEMORI_INVALID_PRIVACY_TYPE":"Memories: invalid privacy type","MEMORI_MISSING_PASSWORD":"Memori: missing password","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Memories: total number of invalid recovery tokens","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Memories: minimum number of invalid recovery tokens","MEMORI_INVALID_VOICE_TYPE":"Memories: invalid voice type","MEMORI_MISSING_NAME":"Memories: missing name","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Memories: missing password or recovery token","MEMORI_INVALID_ID":"Memories: invalid ID","MEMORI_NAME_ALREADY_USED":"Memory name already in use","MEMORI_INVALID_PIN":"Memories: Invalid PIN","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Memories: TAG and PIN change require separate operations","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Memories: no password required when public","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Deep Thought requires completions to be enabled","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Transfer: missing destination user","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Transfer: invalid destination user ID","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Transfer: invalid destination user data","MEMORI_TRANSFER_NOTHING_TO_DO":"Transfer: nothing to do","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Memories: configuration cannot be changed","MEMORI_MISSING_NEW_PASSWORD":"Memories: new password missing","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"Feature requires subscription","INTEGRATION_NOT_FOUND":"Integration not found","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Invalid date from format","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Invalid date to format","INTEGRATION_INVALID_TYPE":"Invalid integration type","INTEGRATION_ALREADY_EXISTS":"Integration already exists","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Non-public memories cannot be integrated","INTEGRATION_MISSING_INVOCATION_TEXT":"Integration: missing invocation text","INTEGRATION_MISSING_DEVICE_EMAILS":"Integration: missing device email","INTEGRATION_MEMORI_IS_EMPTY":"Empty memories cannot be integrated","INTEGRATION_MISSING_PRIVACY_POLICY":"Integration: privacy policy missing","INTEGRATION_MISSING_CATEGORY":"Integration category missing","INTEGRATION_MISSING_DESCRIPTION":"Missing integration description","INTEGRATION_INVALID_INVOCATION_TEXT":"Invalid invocation text","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home no more available","UPLOAD_REQUIRES_MULTIPART_ENCODING":"Upload requires multipart encoding","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: missing content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: maximum size exceeded","UPLOAD_FILE_IS_EMPTY":"Upload: empty file","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: invalid file type or signature","UPLOAD_MISSING_FILE_NAME":"Upload: missing file name","UPLOAD_INVALID_MEMORY_ID":"Upload: Invalid content ID","UPLOAD_MISSING_FILE_CONTENT":"Upload: Missing file content","ASSET_NOT_FOUND":"Asset not found","ASSET_NOT_ACCESSIBLE":"Asset not accessible","ASSET_MISSING_SESSION_ID":"Asset: missing session ID","ASSET_INVALID_FILE_NAME":"Asset: invalid file name","INVITATION_NOT_FOUND":"Invitation not found","INVITATION_NOT_ACCESSIBLE":"Invitation not accessible","INVITATION_ALREADY_ACCEPTED":"Invitation already accepted","INVITATION_ALREADY_REJECTED":"Invitation already rejected","INVITATION_MISSING_DESTINATION_EMAIL":"Invitation: missing destination email","INVITATION_DESTINATION_EMAIL_INVALID":"Invitation: destination email invalid","INVITATION_MISSING_TAG":"Invitation: missing tag","INVITATION_MISSING_PIN":"Invitation: PIN missing","INVITATION_INVALID_PIN":"Invitation: invalid PIN","INVITATION_INVALID_TYPE":"Invitation: invalid type","INVITATION_MISSING_DESTINATION_NAME":"Invitation: destination name missing","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invitation: tag and pin can\'t be changed","INVITATION_CANT_BE_CHANGED":"Intation: can\'t be changed","ACTIONLOG_INVALID_USER_ID":"Invalid user ID","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","ACTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID","CONSUMPTIONLOG_INVALID_TYPE":"Invalid log type","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","CONSUMPTIONLOG_INVALID_USER_ID":"Invalid user ID","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notifications: Invalid chat log extraction period","PROCESS_INVALID_TYPE":"Invalid process type","PROCESS_ALREADY_RUNNING":"Process already running","PROCESS_NOT_FOUND":"Process not found","IMPORTCSV_MISSING_ROWS":"CSV import: missing rows","IMPORTCSV_MISSING_CSV":"CSV Import: Missing CSV","IMPORTCSV_MISSING_SEPARATOR":"CSV import: missing separator","IMPORTCSV_INVALID_SEPARATOR":"CSV import: invalid separator","IMPORTCSV_MISSING_HEADERS":"CSV import: missing headers","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV import: missing title variant separator","IMPORTCSV_INVALID_RECEIVER_ID":"CSV import: invalid receiver ID","IMPORTCSV_INVALID_MEDIA_LINK":"CSV import: invalid media link","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"CSV import: undetectable character encoding","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"CSV Import: Cannot import to Secret Memories","IMPORTTXT_MISSING_ROWS":"Importing TXT: missing rows","IMPORTTXT_INVALID_GRANULARITY":"Import TXT: invalid granularity","IMPORTTXT_INVALID_RECEIVER_ID":"Import TXT: invalid receiver ID","IMPORTTXT_INVALID_MEDIA_LINK":"Import TXT: invalid media link","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"TXT import: undetectable character encoding","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"TXT Import: Cannot import to Secret Memories","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Import TXT: import limit exceeded","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Import TXT: import on GPT-4 requires API key","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Import TXT: Import requires a paying plan","EXPORTCSV_MISSING_CSV_SPECS":"CSV export: missing CSV specifications","EXPORTCSV_MISSING_SEPARATOR":"CSV export: missing separator","EXPORTCSV_INVALID_SEPARATOR":"CSV export: invalid separator","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV export: missing title variant separator","EXPORTCSV_MISSING_NEW_LINE_CHAR":"CSV export: missing newline character","EXPORTCSV_INVALID_NEW_LINE_CHAR":"CSV export: invalid newline character","EXPORTCSV_MISSING_PASSWORD":"CSV export: missing password","EXPORTJSONL_MISSING_JSONL_SPECS":"JSONL export: missing JSONL specifications","EXPORTJSONL_MISSING_PLATFORM":"JSONL export: missing platform","EXPORTJSONL_INVALID_PLATFORM":"JSONL export: invalid platform","EXPORTJSONL_MISSING_PASSWORD":"JSONL export: missing password","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"JSONL Export: Export requires a paid plan","ANALYSIS_MISSING_QUERY":"Analysis: missing query","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analysis: Unable to analyze Secret Memories","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analysis: matching user query requires Deep Thinking","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Badge assignment: incorrect or missing credentials","BADGE_ASSIGNMENT_MISSING_REF_ID":"Badge assignment: ref ID missing","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Badge assignment: result not found","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Badge assignment: Missing assertion URL","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Badge Assignment: Missing Badge URL","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Badge assignment: missing issuer URL","BADGE_ASSIGNMENT_INVALID_URL":"Badge assignment: Invalid URL","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Badge assignment: missing recipient","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Badge assignment: unknown recipient type","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Badge assignment: missing recipient identity","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Badge assignment: missing recipient hash type","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Badge assignment: recipient hash type unknown","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Badge assignment: incorrect recipient identity","BADGE_NOT_FOUND":"Badge not found","OUTCOME_NO_DCM_CONFIGURED":"Result: no DCM configured","OUTCOME_USER_BADGES_DISABLED":"Result: user badges disabled"}}'))},it:{translation:t(MG)}},lng:"en",fallbackLng:"it",supportedLngs:["en","it"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1}});RG.init();var PG=RG;c=o("85Hg2");function kG(e){var t=e.i18n,n=e.defaultNS,r=e.children,i=(0,c.useMemo)((function(){return{i18n:t,defaultNS:n}}),[t,n]);return(0,c.createElement)(ae.Provider,{value:i},r)}const OG=({ownerUserName:e,ownerUserID:t,memoriName:n,memoriID:r,integrationID:i,tenantID:o,secretToken:a,sessionID:l,layout:u="DEFAULT",customLayout:d,showShare:h=!0,showSettings:p=!0,showInstruct:f=!1,showTypingText:m=!1,showClear:g=!1,showOnlyLastMessages:v=!1,showInputs:y=!0,showDates:b=!1,showContextPerLine:S=!1,showLogin:x,height:w="100%",baseURL:_,apiURL:C="https://backend.memori.ai",tag:A,pin:E,context:T,initialQuestion:M,uiLang:I,spokenLang:R,multilingual:P,authToken:k,AZURE_COGNITIVE_SERVICES_TTS_KEY:O,defaultSpeakerActive:N=!0,onStateChange:L,additionalInfo:D,customMediaRenderer:B,additionalSettings:z,userAvatar:F})=>{var U,j,H;const[G,V]=(0,c.useState)(),[W,q]=(0,c.useState)(),[K,J]=(0,c.useState)(O),{t:Q}=xe();if(!(r&&t||n&&e))throw new Error("Identifier pair required: please provide either memoriID and ownerUserID or memoriName and ownerUserName");const Z=Y(C),X=(0,c.useCallback)((async()=>{const e=_||(o.startsWith("https://")?o:`https://${o}`),t=await fetch(`${e}/api/speechkey`),n=await t.json();n.AZURE_COGNITIVE_SERVICES_TTS_KEY&&J(n.AZURE_COGNITIVE_SERVICES_TTS_KEY)}),[]);(0,c.useEffect)((()=>{O||X()}),[O]);const $=(0,c.useCallback)((async()=>{if(r&&t){const{memori:e,...n}=await Z.backend.getMemoriByUserAndId(o,t,r);0===n.resultCode&&e?V(e):console.error("[MEMORI]",n,e)}else if(n&&e){const{memori:t,...r}=await Z.backend.getMemori(o,e,n);0===r.resultCode&&t?V(t):console.error("[MEMORI]",r,t)}}),[r,t,n,e,o]);(0,c.useEffect)((()=>{$()}),[$,o]);const ee=(0,c.useCallback)((async()=>{const e=await cH(o,_);e&&q(e)}),[o,C]);(0,c.useEffect)((()=>{ee()}),[ee]),(0,c.useEffect)((()=>{if(I)PG.changeLanguage(I.toLowerCase());else{const{lng:e,fallbackLng:t}=(()=>{const e=navigator.language;if(e){let t=e.split("-")[0];if(["en","it"].includes(t))return{lng:t,fallbackLng:"en"===t?"it":"en"}}return{lng:"en",fallbackLng:"it"}})();PG.changeLanguage(e).catch((()=>{PG.changeLanguage(t)}))}}),[I]);const te=G?(0,s.jsx)(aH,{layout:u,customLayout:d,height:w,baseUrl:_||(o.startsWith("https://")?o:`https://${o}`),apiUrl:C,memori:{...G,secretToken:a},memoriLang:null!=R?R:null===(j=null===(U=G.culture)||void 0===U?void 0:U.split("-"))||void 0===j?void 0:j[0],multilingual:P,tenant:W,secret:a,sessionID:l,showShare:h,showSettings:p,showInstruct:f,showTypingText:m,showClear:g,showOnlyLastMessages:v,showInputs:y,showDates:b,showContextPerLine:S,showLogin:null!=x?x:null==G?void 0:G.enableDeepThought,integration:null===(H=null==G?void 0:G.integrations)||void 0===H?void 0:H.find((e=>i?e.integrationID===i:!!e.publish&&"LANDING_EXPERIENCE"===e.type)),initialContextVars:T,initialQuestion:M,authToken:k,AZURE_COGNITIVE_SERVICES_TTS_KEY:K||O,defaultSpeakerActive:N,onStateChange:L,additionalInfo:D,customMediaRenderer:B,additionalSettings:z,userAvatar:F,...A&&E?{personification:{tag:A,pin:E}}:{}}):(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,s.jsxs)("p",{style:{textAlign:"center",margin:"2rem auto",textTransform:"capitalize"},children:[Q("loading")||"Loading","..."]})});return(0,s.jsxs)(kG,{i18n:PG,children:[(0,s.jsx)(Ju.Toaster,{position:"top-center",reverseOrder:!0}),te]})};OG.propTypes={memoriName:t(l).string,memoriID:t(l).string,ownerUserName:t(l).string,ownerUserID:t(l).string,integrationID:t(l).string,tenantID:t(l).string.isRequired,secretToken:t(l).string,sessionID:t(l).string,layout:t(l).oneOf(["DEFAULT","FULLPAGE","TOTEM","WEBSITE_ASSISTANT","CHAT"]),customLayout:t(l).any,showShare:t(l).bool,showInstruct:t(l).bool,showInputs:t(l).bool,showDates:t(l).bool,showContextPerLine:t(l).bool,showSettings:t(l).bool,showClear:t(l).bool,showOnlyLastMessages:t(l).bool,showTypingText:t(l).bool,showLogin:t(l).bool,height:t(l).oneOfType([t(l).string,t(l).number]),baseURL:t(l).string,apiURL:t(l).string,tag:t(l).string,pin:t(l).string,context:t(l).objectOf(t(l).any),initialQuestion:t(l).string,uiLang:t(l).oneOf(["en","it","EN","IT"]),spokenLang:t(l).string,multilingual:t(l).bool,authToken:t(l).string,AZURE_COGNITIVE_SERVICES_TTS_KEY:t(l).string,defaultSpeakerActive:t(l).bool,onStateChange:t(l).func,additionalInfo:t(l).objectOf(t(l).any),customMediaRenderer:t(l).func,additionalSettings:t(l).any,userAvatar:t(l).oneOfType([t(l).string,t(l).any])};var NG=OG;class LG extends HTMLElement{connectedCallback(){const e=document.createElement("div"),n=document.createElement("div");n.setAttribute("id","memori-root"),e.appendChild(n),this.appendChild(e);const r=Object.keys(NG.propTypes).reduce(((e,t)=>(this.hasAttribute(t)&&(e[t]=this.getAttribute(t),"true"!==e[t]&&"false"!==e[t]||(e[t]="true"===e[t])),e)),{}),i=this.getAttribute("tenantId"),o=this.getAttribute("context")?.split(",")?.reduce(((e,t)=>{const[n,r]=t.split(":").map((e=>e.trim()));return{...e,[n]:r}}),{}),l=(e=>{try{return JSON.parse(e)}catch(e){return null}})(this.getAttribute("additionalInfo")||"{}")||{};i?t(a).render((0,s.jsx)(NG,{...r,context:o,tenantID:i,additionalInfo:l}),n):console.error("No tenantId attribute found")}}customElements.define("memori-client",LG)})();