@memori.ai/memori-webcomponent 2.6.0 → 2.6.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.
@@ -94,7 +94,7 @@ var r,i,o,a,s,l,c,u,d,f,h,p,m,g,v,y,b,w,x,S,M,_,A,E,C,k,T,I;e(t.exports,"AsyncMo
94
94
  //! momentjs.com
95
95
  e.exports=function(){"use strict";var t,n;function r(){return t.apply(null,arguments)}function i(e){t=e}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function a(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function l(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(s(e,t))return!1;return!0}function c(e){return void 0===e}function u(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,r=[],i=e.length;for(n=0;n<i;++n)r.push(t(e[n],n));return r}function h(e,t){for(var n in t)s(t,n)&&(e[n]=t[n]);return s(t,"toString")&&(e.toString=t.toString),s(t,"valueOf")&&(e.valueOf=t.valueOf),e}function p(e,t,n,r){return Yn(e,t,n,r,!0).utc()}function m(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}}function g(e){return null==e._pf&&(e._pf=m()),e._pf}function v(e){if(null==e._isValid){var t=g(e),r=n.call(t.parsedDateParts,(function(e){return null!=e})),i=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&r);if(e._strict&&(i=i&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return i;e._isValid=i}return e._isValid}function y(e){var t=p(NaN);return null!=e?h(g(t),e):g(t).userInvalidated=!0,t}n=Array.prototype.some?Array.prototype.some:function(e){var t,n=Object(this),r=n.length>>>0;for(t=0;t<r;t++)if(t in n&&e.call(this,n[t],t,n))return!0;return!1};var b=r.momentProperties=[],w=!1;function x(e,t){var n,r,i,o=b.length;if(c(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),c(t._i)||(e._i=t._i),c(t._f)||(e._f=t._f),c(t._l)||(e._l=t._l),c(t._strict)||(e._strict=t._strict),c(t._tzm)||(e._tzm=t._tzm),c(t._isUTC)||(e._isUTC=t._isUTC),c(t._offset)||(e._offset=t._offset),c(t._pf)||(e._pf=g(t)),c(t._locale)||(e._locale=t._locale),o>0)for(n=0;n<o;n++)c(i=t[r=b[n]])||(e[r]=i);return e}function S(e){x(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===w&&(w=!0,r.updateOffset(this),w=!1)}function M(e){return e instanceof S||null!=e&&null!=e._isAMomentObject}function _(e){!1===r.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function A(e,t){var n=!0;return h((function(){if(null!=r.deprecationHandler&&r.deprecationHandler(null,e),n){var i,o,a,l=[],c=arguments.length;for(o=0;o<c;o++){if(i="","object"==typeof arguments[o]){for(a in i+="\n["+o+"] ",arguments[0])s(arguments[0],a)&&(i+=a+": "+arguments[0][a]+", ");i=i.slice(0,-2)}else i=arguments[o];l.push(i)}_(e+"\nArguments: "+Array.prototype.slice.call(l).join("")+"\n"+(new Error).stack),n=!1}return t.apply(this,arguments)}),t)}var E,C={};function k(e,t){null!=r.deprecationHandler&&r.deprecationHandler(e,t),C[e]||(_(t),C[e]=!0)}function T(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function I(e){var t,n;for(n in e)s(e,n)&&(T(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function O(e,t){var n,r=h({},e);for(n in t)s(t,n)&&(a(e[n])&&a(t[n])?(r[n]={},h(r[n],e[n]),h(r[n],t[n])):null!=t[n]?r[n]=t[n]:delete r[n]);for(n in e)s(e,n)&&!s(t,n)&&a(e[n])&&(r[n]=h({},r[n]));return r}function R(e){null!=e&&this.set(e)}r.suppressDeprecationWarnings=!1,r.deprecationHandler=null,E=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)s(e,t)&&n.push(t);return n};var P={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function N(e,t,n){var r=this._calendar[e]||this._calendar.sameElse;return T(r)?r.call(t,n):r}function L(e,t,n){var r=""+Math.abs(e),i=t-r.length;return(e>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}var D=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,B=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,j={},F={};function U(e,t,n,r){var i=r;"string"==typeof r&&(i=function(){return this[r]()}),e&&(F[e]=i),t&&(F[t[0]]=function(){return L(i.apply(this,arguments),t[1],t[2])}),n&&(F[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function z(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function H(e){var t,n,r=e.match(D);for(t=0,n=r.length;t<n;t++)F[r[t]]?r[t]=F[r[t]]:r[t]=z(r[t]);return function(t){var i,o="";for(i=0;i<n;i++)o+=T(r[i])?r[i].call(t,e):r[i];return o}}function V(e,t){return e.isValid()?(t=W(t,e.localeData()),j[t]=j[t]||H(t),j[t](e)):e.localeData().invalidDate()}function W(e,t){var n=5;function r(e){return t.longDateFormat(e)||e}for(B.lastIndex=0;n>=0&&B.test(e);)e=e.replace(B,r),B.lastIndex=0,n-=1;return e}var G={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function q(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(D).map((function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e})).join(""),this._longDateFormat[e])}var K="Invalid date";function Y(){return this._invalidDate}var J="%d",Q=/\d{1,2}/;function X(e){return this._ordinal.replace("%d",e)}var Z={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function $(e,t,n,r){var i=this._relativeTime[n];return T(i)?i(e,t,n,r):i.replace(/%d/i,e)}function ee(e,t){var n=this._relativeTime[e>0?"future":"past"];return T(n)?n(t):n.replace(/%s/i,t)}var te={};function ne(e,t){var n=e.toLowerCase();te[n]=te[n+"s"]=te[t]=e}function re(e){return"string"==typeof e?te[e]||te[e.toLowerCase()]:void 0}function ie(e){var t,n,r={};for(n in e)s(e,n)&&(t=re(n))&&(r[t]=e[n]);return r}var oe={};function ae(e,t){oe[e]=t}function se(e){var t,n=[];for(t in e)s(e,t)&&n.push({unit:t,priority:oe[t]});return n.sort((function(e,t){return e.priority-t.priority})),n}function le(e){return e%4==0&&e%100!=0||e%400==0}function ce(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function ue(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=ce(t)),n}function de(e,t){return function(n){return null!=n?(he(this,e,n),r.updateOffset(this,t),this):fe(this,e)}}function fe(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function he(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&le(e.year())&&1===e.month()&&29===e.date()?(n=ue(n),e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),$e(n,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function pe(e){return T(this[e=re(e)])?this[e]():this}function me(e,t){if("object"==typeof e){var n,r=se(e=ie(e)),i=r.length;for(n=0;n<i;n++)this[r[n].unit](e[r[n].unit])}else if(T(this[e=re(e)]))return this[e](t);return this}var ge,ve=/\d/,ye=/\d\d/,be=/\d{3}/,we=/\d{4}/,xe=/[+-]?\d{6}/,Se=/\d\d?/,Me=/\d\d\d\d?/,_e=/\d\d\d\d\d\d?/,Ae=/\d{1,3}/,Ee=/\d{1,4}/,Ce=/[+-]?\d{1,6}/,ke=/\d+/,Te=/[+-]?\d+/,Ie=/Z|[+-]\d\d:?\d\d/gi,Oe=/Z|[+-]\d\d(?::?\d\d)?/gi,Re=/[+-]?\d+(\.\d{1,3})?/,Pe=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function Ne(e,t,n){ge[e]=T(t)?t:function(e,r){return e&&n?n:t}}function Le(e,t){return s(ge,e)?ge[e](t._strict,t._locale):new RegExp(De(e))}function De(e){return Be(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,n,r,i){return t||n||r||i})))}function Be(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}ge={};var je={};function Fe(e,t){var n,r,i=t;for("string"==typeof e&&(e=[e]),u(t)&&(i=function(e,n){n[t]=ue(e)}),r=e.length,n=0;n<r;n++)je[e[n]]=i}function Ue(e,t){Fe(e,(function(e,n,r,i){r._w=r._w||{},t(e,r._w,r,i)}))}function ze(e,t,n){null!=t&&s(je,e)&&je[e](t,n._a,n,e)}var He,Ve=0,We=1,Ge=2,qe=3,Ke=4,Ye=5,Je=6,Qe=7,Xe=8;function Ze(e,t){return(e%t+t)%t}function $e(e,t){if(isNaN(e)||isNaN(t))return NaN;var n=Ze(t,12);return e+=(t-n)/12,1===n?le(e)?29:28:31-n%7%2}He=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},U("M",["MM",2],"Mo",(function(){return this.month()+1})),U("MMM",0,0,(function(e){return this.localeData().monthsShort(this,e)})),U("MMMM",0,0,(function(e){return this.localeData().months(this,e)})),ne("month","M"),ae("month",8),Ne("M",Se),Ne("MM",Se,ye),Ne("MMM",(function(e,t){return t.monthsShortRegex(e)})),Ne("MMMM",(function(e,t){return t.monthsRegex(e)})),Fe(["M","MM"],(function(e,t){t[We]=ue(e)-1})),Fe(["MMM","MMMM"],(function(e,t,n,r){var i=n._locale.monthsParse(e,r,n._strict);null!=i?t[We]=i:g(n).invalidMonth=e}));var et="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),tt="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),nt=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,rt=Pe,it=Pe;function ot(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||nt).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone}function at(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[nt.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function st(e,t,n){var r,i,o,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],r=0;r<12;++r)o=p([2e3,r]),this._shortMonthsParse[r]=this.monthsShort(o,"").toLocaleLowerCase(),this._longMonthsParse[r]=this.months(o,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=He.call(this._shortMonthsParse,a))?i:null:-1!==(i=He.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=He.call(this._shortMonthsParse,a))||-1!==(i=He.call(this._longMonthsParse,a))?i:null:-1!==(i=He.call(this._longMonthsParse,a))||-1!==(i=He.call(this._shortMonthsParse,a))?i:null}function lt(e,t,n){var r,i,o;if(this._monthsParseExact)return st.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=p([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[r].test(e))return r;if(n&&"MMM"===t&&this._shortMonthsParse[r].test(e))return r;if(!n&&this._monthsParse[r].test(e))return r}}function ct(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=ue(t);else if(!u(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),$e(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function ut(e){return null!=e?(ct(this,e),r.updateOffset(this,!0),this):fe(this,"Month")}function dt(){return $e(this.year(),this.month())}function ft(e){return this._monthsParseExact?(s(this,"_monthsRegex")||pt.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(s(this,"_monthsShortRegex")||(this._monthsShortRegex=rt),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)}function ht(e){return this._monthsParseExact?(s(this,"_monthsRegex")||pt.call(this),e?this._monthsStrictRegex:this._monthsRegex):(s(this,"_monthsRegex")||(this._monthsRegex=it),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)}function pt(){function e(e,t){return t.length-e.length}var t,n,r=[],i=[],o=[];for(t=0;t<12;t++)n=p([2e3,t]),r.push(this.monthsShort(n,"")),i.push(this.months(n,"")),o.push(this.months(n,"")),o.push(this.monthsShort(n,""));for(r.sort(e),i.sort(e),o.sort(e),t=0;t<12;t++)r[t]=Be(r[t]),i[t]=Be(i[t]);for(t=0;t<24;t++)o[t]=Be(o[t]);this._monthsRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+r.join("|")+")","i")}function mt(e){return le(e)?366:365}U("Y",0,0,(function(){var e=this.year();return e<=9999?L(e,4):"+"+e})),U(0,["YY",2],0,(function(){return this.year()%100})),U(0,["YYYY",4],0,"year"),U(0,["YYYYY",5],0,"year"),U(0,["YYYYYY",6,!0],0,"year"),ne("year","y"),ae("year",1),Ne("Y",Te),Ne("YY",Se,ye),Ne("YYYY",Ee,we),Ne("YYYYY",Ce,xe),Ne("YYYYYY",Ce,xe),Fe(["YYYYY","YYYYYY"],Ve),Fe("YYYY",(function(e,t){t[Ve]=2===e.length?r.parseTwoDigitYear(e):ue(e)})),Fe("YY",(function(e,t){t[Ve]=r.parseTwoDigitYear(e)})),Fe("Y",(function(e,t){t[Ve]=parseInt(e,10)})),r.parseTwoDigitYear=function(e){return ue(e)+(ue(e)>68?1900:2e3)};var gt=de("FullYear",!0);function vt(){return le(this.year())}function yt(e,t,n,r,i,o,a){var s;return e<100&&e>=0?(s=new Date(e+400,t,n,r,i,o,a),isFinite(s.getFullYear())&&s.setFullYear(e)):s=new Date(e,t,n,r,i,o,a),s}function bt(e){var t,n;return e<100&&e>=0?((n=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function wt(e,t,n){var r=7+t-n;return-(7+bt(e,0,r).getUTCDay()-t)%7+r-1}function xt(e,t,n,r,i){var o,a,s=1+7*(t-1)+(7+n-r)%7+wt(e,r,i);return s<=0?a=mt(o=e-1)+s:s>mt(e)?(o=e+1,a=s-mt(e)):(o=e,a=s),{year:o,dayOfYear:a}}function St(e,t,n){var r,i,o=wt(e.year(),t,n),a=Math.floor((e.dayOfYear()-o-1)/7)+1;return a<1?r=a+Mt(i=e.year()-1,t,n):a>Mt(e.year(),t,n)?(r=a-Mt(e.year(),t,n),i=e.year()+1):(i=e.year(),r=a),{week:r,year:i}}function Mt(e,t,n){var r=wt(e,t,n),i=wt(e+1,t,n);return(mt(e)-r+i)/7}function _t(e){return St(e,this._week.dow,this._week.doy).week}U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),ne("week","w"),ne("isoWeek","W"),ae("week",5),ae("isoWeek",5),Ne("w",Se),Ne("ww",Se,ye),Ne("W",Se),Ne("WW",Se,ye),Ue(["w","ww","W","WW"],(function(e,t,n,r){t[r.substr(0,1)]=ue(e)}));var At={dow:0,doy:6};function Et(){return this._week.dow}function Ct(){return this._week.doy}function kt(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function Tt(e){var t=St(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function It(e,t){return"string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}function Ot(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Rt(e,t){return e.slice(t,7).concat(e.slice(0,t))}U("d",0,"do","day"),U("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),U("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),U("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),ne("day","d"),ne("weekday","e"),ne("isoWeekday","E"),ae("day",11),ae("weekday",11),ae("isoWeekday",11),Ne("d",Se),Ne("e",Se),Ne("E",Se),Ne("dd",(function(e,t){return t.weekdaysMinRegex(e)})),Ne("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),Ne("dddd",(function(e,t){return t.weekdaysRegex(e)})),Ue(["dd","ddd","dddd"],(function(e,t,n,r){var i=n._locale.weekdaysParse(e,r,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e})),Ue(["d","e","E"],(function(e,t,n,r){t[r]=ue(e)}));var Pt="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Nt="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Lt="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Dt=Pe,Bt=Pe,jt=Pe;function Ft(e,t){var n=o(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?Rt(n,this._week.dow):e?n[e.day()]:n}function Ut(e){return!0===e?Rt(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function zt(e){return!0===e?Rt(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function Ht(e,t,n){var r,i,o,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)o=p([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(o,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=He.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=He.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=He.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=He.call(this._weekdaysParse,a))||-1!==(i=He.call(this._shortWeekdaysParse,a))||-1!==(i=He.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=He.call(this._shortWeekdaysParse,a))||-1!==(i=He.call(this._weekdaysParse,a))||-1!==(i=He.call(this._minWeekdaysParse,a))?i:null:-1!==(i=He.call(this._minWeekdaysParse,a))||-1!==(i=He.call(this._weekdaysParse,a))||-1!==(i=He.call(this._shortWeekdaysParse,a))?i:null}function Vt(e,t,n){var r,i,o;if(this._weekdaysParseExact)return Ht.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=p([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[r].test(e))return r;if(n&&"ddd"===t&&this._shortWeekdaysParse[r].test(e))return r;if(n&&"dd"===t&&this._minWeekdaysParse[r].test(e))return r;if(!n&&this._weekdaysParse[r].test(e))return r}}function Wt(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=It(e,this.localeData()),this.add(e-t,"d")):t}function Gt(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function qt(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=Ot(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7}function Kt(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Qt.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(s(this,"_weekdaysRegex")||(this._weekdaysRegex=Dt),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function Yt(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Qt.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(s(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Bt),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Jt(e){return this._weekdaysParseExact?(s(this,"_weekdaysRegex")||Qt.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(s(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=jt),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Qt(){function e(e,t){return t.length-e.length}var t,n,r,i,o,a=[],s=[],l=[],c=[];for(t=0;t<7;t++)n=p([2e3,1]).day(t),r=Be(this.weekdaysMin(n,"")),i=Be(this.weekdaysShort(n,"")),o=Be(this.weekdays(n,"")),a.push(r),s.push(i),l.push(o),c.push(r),c.push(i),c.push(o);a.sort(e),s.sort(e),l.sort(e),c.sort(e),this._weekdaysRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Xt(){return this.hours()%12||12}function Zt(){return this.hours()||24}function $t(e,t){U(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}))}function en(e,t){return t._meridiemParse}function tn(e){return"p"===(e+"").toLowerCase().charAt(0)}U("H",["HH",2],0,"hour"),U("h",["hh",2],0,Xt),U("k",["kk",2],0,Zt),U("hmm",0,0,(function(){return""+Xt.apply(this)+L(this.minutes(),2)})),U("hmmss",0,0,(function(){return""+Xt.apply(this)+L(this.minutes(),2)+L(this.seconds(),2)})),U("Hmm",0,0,(function(){return""+this.hours()+L(this.minutes(),2)})),U("Hmmss",0,0,(function(){return""+this.hours()+L(this.minutes(),2)+L(this.seconds(),2)})),$t("a",!0),$t("A",!1),ne("hour","h"),ae("hour",13),Ne("a",en),Ne("A",en),Ne("H",Se),Ne("h",Se),Ne("k",Se),Ne("HH",Se,ye),Ne("hh",Se,ye),Ne("kk",Se,ye),Ne("hmm",Me),Ne("hmmss",_e),Ne("Hmm",Me),Ne("Hmmss",_e),Fe(["H","HH"],qe),Fe(["k","kk"],(function(e,t,n){var r=ue(e);t[qe]=24===r?0:r})),Fe(["a","A"],(function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e})),Fe(["h","hh"],(function(e,t,n){t[qe]=ue(e),g(n).bigHour=!0})),Fe("hmm",(function(e,t,n){var r=e.length-2;t[qe]=ue(e.substr(0,r)),t[Ke]=ue(e.substr(r)),g(n).bigHour=!0})),Fe("hmmss",(function(e,t,n){var r=e.length-4,i=e.length-2;t[qe]=ue(e.substr(0,r)),t[Ke]=ue(e.substr(r,2)),t[Ye]=ue(e.substr(i)),g(n).bigHour=!0})),Fe("Hmm",(function(e,t,n){var r=e.length-2;t[qe]=ue(e.substr(0,r)),t[Ke]=ue(e.substr(r))})),Fe("Hmmss",(function(e,t,n){var r=e.length-4,i=e.length-2;t[qe]=ue(e.substr(0,r)),t[Ke]=ue(e.substr(r,2)),t[Ye]=ue(e.substr(i))}));var nn=/[ap]\.?m?\.?/i,rn=de("Hours",!0);function on(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"}var an,sn={calendar:P,longDateFormat:G,invalidDate:K,ordinal:J,dayOfMonthOrdinalParse:Q,relativeTime:Z,months:et,monthsShort:tt,week:At,weekdays:Pt,weekdaysMin:Lt,weekdaysShort:Nt,meridiemParse:nn},ln={},cn={};function un(e,t){var n,r=Math.min(e.length,t.length);for(n=0;n<r;n+=1)if(e[n]!==t[n])return n;return r}function dn(e){return e?e.toLowerCase().replace("_","-"):e}function fn(e){for(var t,n,r,i,o=0;o<e.length;){for(t=(i=dn(e[o]).split("-")).length,n=(n=dn(e[o+1]))?n.split("-"):null;t>0;){if(r=pn(i.slice(0,t).join("-")))return r;if(n&&n.length>=t&&un(i,n)>=t-1)break;t--}o++}return an}function hn(e){return null!=e.match("^[^/\\\\]*$")}function pn(t){var n=null;if(void 0===ln[t]&&e&&e.exports&&hn(t))try{n=an._abbr,(void 0)("./locale/"+t),mn(n)}catch(e){ln[t]=null}return ln[t]}function mn(e,t){var n;return e&&((n=c(t)?yn(e):gn(e,t))?an=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),an._abbr}function gn(e,t){if(null!==t){var n,r=sn;if(t.abbr=e,null!=ln[e])k("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),r=ln[e]._config;else if(null!=t.parentLocale)if(null!=ln[t.parentLocale])r=ln[t.parentLocale]._config;else{if(null==(n=pn(t.parentLocale)))return cn[t.parentLocale]||(cn[t.parentLocale]=[]),cn[t.parentLocale].push({name:e,config:t}),null;r=n._config}return ln[e]=new R(O(r,t)),cn[e]&&cn[e].forEach((function(e){gn(e.name,e.config)})),mn(e),ln[e]}return delete ln[e],null}function vn(e,t){if(null!=t){var n,r,i=sn;null!=ln[e]&&null!=ln[e].parentLocale?ln[e].set(O(ln[e]._config,t)):(null!=(r=pn(e))&&(i=r._config),t=O(i,t),null==r&&(t.abbr=e),(n=new R(t)).parentLocale=ln[e],ln[e]=n),mn(e)}else null!=ln[e]&&(null!=ln[e].parentLocale?(ln[e]=ln[e].parentLocale,e===mn()&&mn(e)):null!=ln[e]&&delete ln[e]);return ln[e]}function yn(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return an;if(!o(e)){if(t=pn(e))return t;e=[e]}return fn(e)}function bn(){return E(ln)}function wn(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[We]<0||n[We]>11?We:n[Ge]<1||n[Ge]>$e(n[Ve],n[We])?Ge:n[qe]<0||n[qe]>24||24===n[qe]&&(0!==n[Ke]||0!==n[Ye]||0!==n[Je])?qe:n[Ke]<0||n[Ke]>59?Ke:n[Ye]<0||n[Ye]>59?Ye:n[Je]<0||n[Je]>999?Je:-1,g(e)._overflowDayOfYear&&(t<Ve||t>Ge)&&(t=Ge),g(e)._overflowWeeks&&-1===t&&(t=Qe),g(e)._overflowWeekday&&-1===t&&(t=Xe),g(e).overflow=t),e}var xn=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Sn=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Mn=/Z|[+-]\d\d(?::?\d\d)?/,_n=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],An=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],En=/^\/?Date\((-?\d+)/i,Cn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,kn={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Tn(e){var t,n,r,i,o,a,s=e._i,l=xn.exec(s)||Sn.exec(s),c=_n.length,u=An.length;if(l){for(g(e).iso=!0,t=0,n=c;t<n;t++)if(_n[t][1].exec(l[1])){i=_n[t][0],r=!1!==_n[t][2];break}if(null==i)return void(e._isValid=!1);if(l[3]){for(t=0,n=u;t<n;t++)if(An[t][1].exec(l[3])){o=(l[2]||" ")+An[t][0];break}if(null==o)return void(e._isValid=!1)}if(!r&&null!=o)return void(e._isValid=!1);if(l[4]){if(!Mn.exec(l[4]))return void(e._isValid=!1);a="Z"}e._f=i+(o||"")+(a||""),zn(e)}else e._isValid=!1}function In(e,t,n,r,i,o){var a=[On(e),tt.indexOf(t),parseInt(n,10),parseInt(r,10),parseInt(i,10)];return o&&a.push(parseInt(o,10)),a}function On(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}function Rn(e){return e.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Pn(e,t,n){return!e||Nt.indexOf(e)===new Date(t[0],t[1],t[2]).getDay()||(g(n).weekdayMismatch=!0,n._isValid=!1,!1)}function Nn(e,t,n){if(e)return kn[e];if(t)return 0;var r=parseInt(n,10),i=r%100;return(r-i)/100*60+i}function Ln(e){var t,n=Cn.exec(Rn(e._i));if(n){if(t=In(n[4],n[3],n[2],n[5],n[6],n[7]),!Pn(n[1],t,e))return;e._a=t,e._tzm=Nn(n[8],n[9],n[10]),e._d=bt.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),g(e).rfc2822=!0}else e._isValid=!1}function Dn(e){var t=En.exec(e._i);null===t?(Tn(e),!1===e._isValid&&(delete e._isValid,Ln(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:r.createFromInputFallback(e)))):e._d=new Date(+t[1])}function Bn(e,t,n){return null!=e?e:null!=t?t:n}function jn(e){var t=new Date(r.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function Fn(e){var t,n,r,i,o,a=[];if(!e._d){for(r=jn(e),e._w&&null==e._a[Ge]&&null==e._a[We]&&Un(e),null!=e._dayOfYear&&(o=Bn(e._a[Ve],r[Ve]),(e._dayOfYear>mt(o)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=bt(o,0,e._dayOfYear),e._a[We]=n.getUTCMonth(),e._a[Ge]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=r[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[qe]&&0===e._a[Ke]&&0===e._a[Ye]&&0===e._a[Je]&&(e._nextDay=!0,e._a[qe]=0),e._d=(e._useUTC?bt:yt).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[qe]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}function Un(e){var t,n,r,i,o,a,s,l,c;null!=(t=e._w).GG||null!=t.W||null!=t.E?(o=1,a=4,n=Bn(t.GG,e._a[Ve],St(Jn(),1,4).year),r=Bn(t.W,1),((i=Bn(t.E,1))<1||i>7)&&(l=!0)):(o=e._locale._week.dow,a=e._locale._week.doy,c=St(Jn(),o,a),n=Bn(t.gg,e._a[Ve],c.year),r=Bn(t.w,c.week),null!=t.d?((i=t.d)<0||i>6)&&(l=!0):null!=t.e?(i=t.e+o,(t.e<0||t.e>6)&&(l=!0)):i=o),r<1||r>Mt(n,o,a)?g(e)._overflowWeeks=!0:null!=l?g(e)._overflowWeekday=!0:(s=xt(n,r,i,o,a),e._a[Ve]=s.year,e._dayOfYear=s.dayOfYear)}function zn(e){if(e._f!==r.ISO_8601)if(e._f!==r.RFC_2822){e._a=[],g(e).empty=!0;var t,n,i,o,a,s,l,c=""+e._i,u=c.length,d=0;for(l=(i=W(e._f,e._locale).match(D)||[]).length,t=0;t<l;t++)o=i[t],(n=(c.match(Le(o,e))||[])[0])&&((a=c.substr(0,c.indexOf(n))).length>0&&g(e).unusedInput.push(a),c=c.slice(c.indexOf(n)+n.length),d+=n.length),F[o]?(n?g(e).empty=!1:g(e).unusedTokens.push(o),ze(o,n,e)):e._strict&&!n&&g(e).unusedTokens.push(o);g(e).charsLeftOver=u-d,c.length>0&&g(e).unusedInput.push(c),e._a[qe]<=12&&!0===g(e).bigHour&&e._a[qe]>0&&(g(e).bigHour=void 0),g(e).parsedDateParts=e._a.slice(0),g(e).meridiem=e._meridiem,e._a[qe]=Hn(e._locale,e._a[qe],e._meridiem),null!==(s=g(e).era)&&(e._a[Ve]=e._locale.erasConvertYear(s,e._a[Ve])),Fn(e),wn(e)}else Ln(e);else Tn(e)}function Hn(e,t,n){var r;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((r=e.isPM(n))&&t<12&&(t+=12),r||12!==t||(t=0),t):t}function Vn(e){var t,n,r,i,o,a,s=!1,l=e._f.length;if(0===l)return g(e).invalidFormat=!0,void(e._d=new Date(NaN));for(i=0;i<l;i++)o=0,a=!1,t=x({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],zn(t),v(t)&&(a=!0),o+=g(t).charsLeftOver,o+=10*g(t).unusedTokens.length,g(t).score=o,s?o<r&&(r=o,n=t):(null==r||o<r||a)&&(r=o,n=t,a&&(s=!0));h(e,n||t)}function Wn(e){if(!e._d){var t=ie(e._i),n=void 0===t.day?t.date:t.day;e._a=f([t.year,t.month,n,t.hour,t.minute,t.second,t.millisecond],(function(e){return e&&parseInt(e,10)})),Fn(e)}}function Gn(e){var t=new S(wn(qn(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function qn(e){var t=e._i,n=e._f;return e._locale=e._locale||yn(e._l),null===t||void 0===n&&""===t?y({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),M(t)?new S(wn(t)):(d(t)?e._d=t:o(n)?Vn(e):n?zn(e):Kn(e),v(e)||(e._d=null),e))}function Kn(e){var t=e._i;c(t)?e._d=new Date(r.now()):d(t)?e._d=new Date(t.valueOf()):"string"==typeof t?Dn(e):o(t)?(e._a=f(t.slice(0),(function(e){return parseInt(e,10)})),Fn(e)):a(t)?Wn(e):u(t)?e._d=new Date(t):r.createFromInputFallback(e)}function Yn(e,t,n,r,i){var s={};return!0!==t&&!1!==t||(r=t,t=void 0),!0!==n&&!1!==n||(r=n,n=void 0),(a(e)&&l(e)||o(e)&&0===e.length)&&(e=void 0),s._isAMomentObject=!0,s._useUTC=s._isUTC=i,s._l=n,s._i=e,s._f=t,s._strict=r,Gn(s)}function Jn(e,t,n,r){return Yn(e,t,n,r,!1)}r.createFromInputFallback=A("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",(function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))})),r.ISO_8601=function(){},r.RFC_2822=function(){};var Qn=A("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Jn.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:y()})),Xn=A("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Jn.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:y()}));function Zn(e,t){var n,r;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return Jn();for(n=t[0],r=1;r<t.length;++r)t[r].isValid()&&!t[r][e](n)||(n=t[r]);return n}function $n(){return Zn("isBefore",[].slice.call(arguments,0))}function er(){return Zn("isAfter",[].slice.call(arguments,0))}var tr=function(){return Date.now?Date.now():+new Date},nr=["year","quarter","month","week","day","hour","minute","second","millisecond"];function rr(e){var t,n,r=!1,i=nr.length;for(t in e)if(s(e,t)&&(-1===He.call(nr,t)||null!=e[t]&&isNaN(e[t])))return!1;for(n=0;n<i;++n)if(e[nr[n]]){if(r)return!1;parseFloat(e[nr[n]])!==ue(e[nr[n]])&&(r=!0)}return!0}function ir(){return this._isValid}function or(){return kr(NaN)}function ar(e){var t=ie(e),n=t.year||0,r=t.quarter||0,i=t.month||0,o=t.week||t.isoWeek||0,a=t.day||0,s=t.hour||0,l=t.minute||0,c=t.second||0,u=t.millisecond||0;this._isValid=rr(t),this._milliseconds=+u+1e3*c+6e4*l+36e5*s,this._days=+a+7*o,this._months=+i+3*r+12*n,this._data={},this._locale=yn(),this._bubble()}function sr(e){return e instanceof ar}function lr(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function cr(e,t,n){var r,i=Math.min(e.length,t.length),o=Math.abs(e.length-t.length),a=0;for(r=0;r<i;r++)(n&&e[r]!==t[r]||!n&&ue(e[r])!==ue(t[r]))&&a++;return a+o}function ur(e,t){U(e,0,0,(function(){var e=this.utcOffset(),n="+";return e<0&&(e=-e,n="-"),n+L(~~(e/60),2)+t+L(~~e%60,2)}))}ur("Z",":"),ur("ZZ",""),Ne("Z",Oe),Ne("ZZ",Oe),Fe(["Z","ZZ"],(function(e,t,n){n._useUTC=!0,n._tzm=fr(Oe,e)}));var dr=/([\+\-]|\d\d)/gi;function fr(e,t){var n,r,i=(t||"").match(e);return null===i?null:0===(r=60*(n=((i[i.length-1]||[])+"").match(dr)||["-",0,0])[1]+ue(n[2]))?0:"+"===n[0]?r:-r}function hr(e,t){var n,i;return t._isUTC?(n=t.clone(),i=(M(e)||d(e)?e.valueOf():Jn(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),r.updateOffset(n,!1),n):Jn(e).local()}function pr(e){return-Math.round(e._d.getTimezoneOffset())}function mr(e,t,n){var i,o=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=fr(Oe,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(i=pr(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),o!==e&&(!t||this._changeInProgress?Pr(this,kr(e-o,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,r.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?o:pr(this)}function gr(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function vr(e){return this.utcOffset(0,e)}function yr(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(pr(this),"m")),this}function br(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=fr(Ie,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this}function wr(e){return!!this.isValid()&&(e=e?Jn(e).utcOffset():0,(this.utcOffset()-e)%60==0)}function xr(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Sr(){if(!c(this._isDSTShifted))return this._isDSTShifted;var e,t={};return x(t,this),(t=qn(t))._a?(e=t._isUTC?p(t._a):Jn(t._a),this._isDSTShifted=this.isValid()&&cr(t._a,e.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Mr(){return!!this.isValid()&&!this._isUTC}function _r(){return!!this.isValid()&&this._isUTC}function Ar(){return!!this.isValid()&&this._isUTC&&0===this._offset}r.updateOffset=function(){};var Er=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Cr=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function kr(e,t){var n,r,i,o=e,a=null;return sr(e)?o={ms:e._milliseconds,d:e._days,M:e._months}:u(e)||!isNaN(+e)?(o={},t?o[t]=+e:o.milliseconds=+e):(a=Er.exec(e))?(n="-"===a[1]?-1:1,o={y:0,d:ue(a[Ge])*n,h:ue(a[qe])*n,m:ue(a[Ke])*n,s:ue(a[Ye])*n,ms:ue(lr(1e3*a[Je]))*n}):(a=Cr.exec(e))?(n="-"===a[1]?-1:1,o={y:Tr(a[2],n),M:Tr(a[3],n),w:Tr(a[4],n),d:Tr(a[5],n),h:Tr(a[6],n),m:Tr(a[7],n),s:Tr(a[8],n)}):null==o?o={}:"object"==typeof o&&("from"in o||"to"in o)&&(i=Or(Jn(o.from),Jn(o.to)),(o={}).ms=i.milliseconds,o.M=i.months),r=new ar(o),sr(e)&&s(e,"_locale")&&(r._locale=e._locale),sr(e)&&s(e,"_isValid")&&(r._isValid=e._isValid),r}function Tr(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Ir(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function Or(e,t){var n;return e.isValid()&&t.isValid()?(t=hr(t,e),e.isBefore(t)?n=Ir(e,t):((n=Ir(t,e)).milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function Rr(e,t){return function(n,r){var i;return null===r||isNaN(+r)||(k(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=n,n=r,r=i),Pr(this,kr(n,r),e),this}}function Pr(e,t,n,i){var o=t._milliseconds,a=lr(t._days),s=lr(t._months);e.isValid()&&(i=null==i||i,s&&ct(e,fe(e,"Month")+s*n),a&&he(e,"Date",fe(e,"Date")+a*n),o&&e._d.setTime(e._d.valueOf()+o*n),i&&r.updateOffset(e,a||s))}kr.fn=ar.prototype,kr.invalid=or;var Nr=Rr(1,"add"),Lr=Rr(-1,"subtract");function Dr(e){return"string"==typeof e||e instanceof String}function Br(e){return M(e)||d(e)||Dr(e)||u(e)||Fr(e)||jr(e)||null==e}function jr(e){var t,n,r=a(e)&&!l(e),i=!1,o=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],c=o.length;for(t=0;t<c;t+=1)n=o[t],i=i||s(e,n);return r&&i}function Fr(e){var t=o(e),n=!1;return t&&(n=0===e.filter((function(t){return!u(t)&&Dr(e)})).length),t&&n}function Ur(e){var t,n,r=a(e)&&!l(e),i=!1,o=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"];for(t=0;t<o.length;t+=1)n=o[t],i=i||s(e,n);return r&&i}function zr(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function Hr(e,t){1===arguments.length&&(arguments[0]?Br(arguments[0])?(e=arguments[0],t=void 0):Ur(arguments[0])&&(t=arguments[0],e=void 0):(e=void 0,t=void 0));var n=e||Jn(),i=hr(n,this).startOf("day"),o=r.calendarFormat(this,i)||"sameElse",a=t&&(T(t[o])?t[o].call(this,n):t[o]);return this.format(a||this.localeData().calendar(o,this,Jn(n)))}function Vr(){return new S(this)}function Wr(e,t){var n=M(e)?e:Jn(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=re(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())}function Gr(e,t){var n=M(e)?e:Jn(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=re(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())}function qr(e,t,n,r){var i=M(e)?e:Jn(e),o=M(t)?t:Jn(t);return!!(this.isValid()&&i.isValid()&&o.isValid())&&("("===(r=r||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===r[1]?this.isBefore(o,n):!this.isAfter(o,n))}function Kr(e,t){var n,r=M(e)?e:Jn(e);return!(!this.isValid()||!r.isValid())&&("millisecond"===(t=re(t)||"millisecond")?this.valueOf()===r.valueOf():(n=r.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))}function Yr(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function Jr(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function Qr(e,t,n){var r,i,o;if(!this.isValid())return NaN;if(!(r=hr(e,this)).isValid())return NaN;switch(i=6e4*(r.utcOffset()-this.utcOffset()),t=re(t)){case"year":o=Xr(this,r)/12;break;case"month":o=Xr(this,r);break;case"quarter":o=Xr(this,r)/3;break;case"second":o=(this-r)/1e3;break;case"minute":o=(this-r)/6e4;break;case"hour":o=(this-r)/36e5;break;case"day":o=(this-r-i)/864e5;break;case"week":o=(this-r-i)/6048e5;break;default:o=this-r}return n?o:ce(o)}function Xr(e,t){if(e.date()<t.date())return-Xr(t,e);var n=12*(t.year()-e.year())+(t.month()-e.month()),r=e.clone().add(n,"months");return-(n+(t-r<0?(t-r)/(r-e.clone().add(n-1,"months")):(t-r)/(e.clone().add(n+1,"months")-r)))||0}function Zr(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function $r(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?V(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):T(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+6e4*this.utcOffset()).toISOString().replace("Z",V(n,"Z")):V(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function ei(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,n,r,i="moment",o="";return this.isLocal()||(i=0===this.utcOffset()?"moment.utc":"moment.parseZone",o="Z"),e="["+i+'("]',t=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n="-MM-DD[T]HH:mm:ss.SSS",r=o+'[")]',this.format(e+t+n+r)}function ti(e){e||(e=this.isUtc()?r.defaultFormatUtc:r.defaultFormat);var t=V(this,e);return this.localeData().postformat(t)}function ni(e,t){return this.isValid()&&(M(e)&&e.isValid()||Jn(e).isValid())?kr({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function ri(e){return this.from(Jn(),e)}function ii(e,t){return this.isValid()&&(M(e)&&e.isValid()||Jn(e).isValid())?kr({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function oi(e){return this.to(Jn(),e)}function ai(e){var t;return void 0===e?this._locale._abbr:(null!=(t=yn(e))&&(this._locale=t),this)}r.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",r.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var si=A("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(e){return void 0===e?this.localeData():this.locale(e)}));function li(){return this._locale}var ci=1e3,ui=60*ci,di=60*ui,fi=3506328*di;function hi(e,t){return(e%t+t)%t}function pi(e,t,n){return e<100&&e>=0?new Date(e+400,t,n)-fi:new Date(e,t,n).valueOf()}function mi(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-fi:Date.UTC(e,t,n)}function gi(e){var t,n;if(void 0===(e=re(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?mi:pi,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=hi(t+(this._isUTC?0:this.utcOffset()*ui),di);break;case"minute":t=this._d.valueOf(),t-=hi(t,ui);break;case"second":t=this._d.valueOf(),t-=hi(t,ci)}return this._d.setTime(t),r.updateOffset(this,!0),this}function vi(e){var t,n;if(void 0===(e=re(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?mi:pi,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=di-hi(t+(this._isUTC?0:this.utcOffset()*ui),di)-1;break;case"minute":t=this._d.valueOf(),t+=ui-hi(t,ui)-1;break;case"second":t=this._d.valueOf(),t+=ci-hi(t,ci)-1}return this._d.setTime(t),r.updateOffset(this,!0),this}function yi(){return this._d.valueOf()-6e4*(this._offset||0)}function bi(){return Math.floor(this.valueOf()/1e3)}function wi(){return new Date(this.valueOf())}function xi(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Si(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Mi(){return this.isValid()?this.toISOString():null}function _i(){return v(this)}function Ai(){return h({},g(this))}function Ei(){return g(this).overflow}function Ci(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function ki(e,t){var n,i,o,a=this._eras||yn("en")._eras;for(n=0,i=a.length;n<i;++n)switch("string"==typeof a[n].since&&(o=r(a[n].since).startOf("day"),a[n].since=o.valueOf()),typeof a[n].until){case"undefined":a[n].until=1/0;break;case"string":o=r(a[n].until).startOf("day").valueOf(),a[n].until=o.valueOf()}return a}function Ti(e,t,n){var r,i,o,a,s,l=this.eras();for(e=e.toUpperCase(),r=0,i=l.length;r<i;++r)if(o=l[r].name.toUpperCase(),a=l[r].abbr.toUpperCase(),s=l[r].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(a===e)return l[r];break;case"NNNN":if(o===e)return l[r];break;case"NNNNN":if(s===e)return l[r]}else if([o,a,s].indexOf(e)>=0)return l[r]}function Ii(e,t){var n=e.since<=e.until?1:-1;return void 0===t?r(e.since).year():r(e.since).year()+(t-e.offset)*n}function Oi(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e){if(n=this.clone().startOf("day").valueOf(),r[e].since<=n&&n<=r[e].until)return r[e].name;if(r[e].until<=n&&n<=r[e].since)return r[e].name}return""}function Ri(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e){if(n=this.clone().startOf("day").valueOf(),r[e].since<=n&&n<=r[e].until)return r[e].narrow;if(r[e].until<=n&&n<=r[e].since)return r[e].narrow}return""}function Pi(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;e<t;++e){if(n=this.clone().startOf("day").valueOf(),r[e].since<=n&&n<=r[e].until)return r[e].abbr;if(r[e].until<=n&&n<=r[e].since)return r[e].abbr}return""}function Ni(){var e,t,n,i,o=this.localeData().eras();for(e=0,t=o.length;e<t;++e)if(n=o[e].since<=o[e].until?1:-1,i=this.clone().startOf("day").valueOf(),o[e].since<=i&&i<=o[e].until||o[e].until<=i&&i<=o[e].since)return(this.year()-r(o[e].since).year())*n+o[e].offset;return this.year()}function Li(e){return s(this,"_erasNameRegex")||Hi.call(this),e?this._erasNameRegex:this._erasRegex}function Di(e){return s(this,"_erasAbbrRegex")||Hi.call(this),e?this._erasAbbrRegex:this._erasRegex}function Bi(e){return s(this,"_erasNarrowRegex")||Hi.call(this),e?this._erasNarrowRegex:this._erasRegex}function ji(e,t){return t.erasAbbrRegex(e)}function Fi(e,t){return t.erasNameRegex(e)}function Ui(e,t){return t.erasNarrowRegex(e)}function zi(e,t){return t._eraYearOrdinalRegex||ke}function Hi(){var e,t,n=[],r=[],i=[],o=[],a=this.eras();for(e=0,t=a.length;e<t;++e)r.push(Be(a[e].name)),n.push(Be(a[e].abbr)),i.push(Be(a[e].narrow)),o.push(Be(a[e].name)),o.push(Be(a[e].abbr)),o.push(Be(a[e].narrow));this._erasRegex=new RegExp("^("+o.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+r.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+n.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+i.join("|")+")","i")}function Vi(e,t){U(0,[e,e.length],0,t)}function Wi(e){return Qi.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Gi(e){return Qi.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function qi(){return Mt(this.year(),1,4)}function Ki(){return Mt(this.isoWeekYear(),1,4)}function Yi(){var e=this.localeData()._week;return Mt(this.year(),e.dow,e.doy)}function Ji(){var e=this.localeData()._week;return Mt(this.weekYear(),e.dow,e.doy)}function Qi(e,t,n,r,i){var o;return null==e?St(this,r,i).year:(t>(o=Mt(e,r,i))&&(t=o),Xi.call(this,e,t,n,r,i))}function Xi(e,t,n,r,i){var o=xt(e,t,n,r,i),a=bt(o.year,0,o.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}function Zi(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}U("N",0,0,"eraAbbr"),U("NN",0,0,"eraAbbr"),U("NNN",0,0,"eraAbbr"),U("NNNN",0,0,"eraName"),U("NNNNN",0,0,"eraNarrow"),U("y",["y",1],"yo","eraYear"),U("y",["yy",2],0,"eraYear"),U("y",["yyy",3],0,"eraYear"),U("y",["yyyy",4],0,"eraYear"),Ne("N",ji),Ne("NN",ji),Ne("NNN",ji),Ne("NNNN",Fi),Ne("NNNNN",Ui),Fe(["N","NN","NNN","NNNN","NNNNN"],(function(e,t,n,r){var i=n._locale.erasParse(e,r,n._strict);i?g(n).era=i:g(n).invalidEra=e})),Ne("y",ke),Ne("yy",ke),Ne("yyy",ke),Ne("yyyy",ke),Ne("yo",zi),Fe(["y","yy","yyy","yyyy"],Ve),Fe(["yo"],(function(e,t,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[Ve]=n._locale.eraYearOrdinalParse(e,i):t[Ve]=parseInt(e,10)})),U(0,["gg",2],0,(function(){return this.weekYear()%100})),U(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Vi("gggg","weekYear"),Vi("ggggg","weekYear"),Vi("GGGG","isoWeekYear"),Vi("GGGGG","isoWeekYear"),ne("weekYear","gg"),ne("isoWeekYear","GG"),ae("weekYear",1),ae("isoWeekYear",1),Ne("G",Te),Ne("g",Te),Ne("GG",Se,ye),Ne("gg",Se,ye),Ne("GGGG",Ee,we),Ne("gggg",Ee,we),Ne("GGGGG",Ce,xe),Ne("ggggg",Ce,xe),Ue(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,n,r){t[r.substr(0,2)]=ue(e)})),Ue(["gg","GG"],(function(e,t,n,i){t[i]=r.parseTwoDigitYear(e)})),U("Q",0,"Qo","quarter"),ne("quarter","Q"),ae("quarter",7),Ne("Q",ve),Fe("Q",(function(e,t){t[We]=3*(ue(e)-1)})),U("D",["DD",2],"Do","date"),ne("date","D"),ae("date",9),Ne("D",Se),Ne("DD",Se,ye),Ne("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),Fe(["D","DD"],Ge),Fe("Do",(function(e,t){t[Ge]=ue(e.match(Se)[0])}));var $i=de("Date",!0);function eo(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}U("DDD",["DDDD",3],"DDDo","dayOfYear"),ne("dayOfYear","DDD"),ae("dayOfYear",4),Ne("DDD",Ae),Ne("DDDD",be),Fe(["DDD","DDDD"],(function(e,t,n){n._dayOfYear=ue(e)})),U("m",["mm",2],0,"minute"),ne("minute","m"),ae("minute",14),Ne("m",Se),Ne("mm",Se,ye),Fe(["m","mm"],Ke);var to=de("Minutes",!1);U("s",["ss",2],0,"second"),ne("second","s"),ae("second",15),Ne("s",Se),Ne("ss",Se,ye),Fe(["s","ss"],Ye);var no,ro,io=de("Seconds",!1);for(U("S",0,0,(function(){return~~(this.millisecond()/100)})),U(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),U(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),U(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),U(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),U(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),U(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),ne("millisecond","ms"),ae("millisecond",16),Ne("S",Ae,ve),Ne("SS",Ae,ye),Ne("SSS",Ae,be),no="SSSS";no.length<=9;no+="S")Ne(no,ke);function oo(e,t){t[Je]=ue(1e3*("0."+e))}for(no="S";no.length<=9;no+="S")Fe(no,oo);function ao(){return this._isUTC?"UTC":""}function so(){return this._isUTC?"Coordinated Universal Time":""}ro=de("Milliseconds",!1),U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");var lo=S.prototype;function co(e){return Jn(1e3*e)}function uo(){return Jn.apply(null,arguments).parseZone()}function fo(e){return e}lo.add=Nr,lo.calendar=Hr,lo.clone=Vr,lo.diff=Qr,lo.endOf=vi,lo.format=ti,lo.from=ni,lo.fromNow=ri,lo.to=ii,lo.toNow=oi,lo.get=pe,lo.invalidAt=Ei,lo.isAfter=Wr,lo.isBefore=Gr,lo.isBetween=qr,lo.isSame=Kr,lo.isSameOrAfter=Yr,lo.isSameOrBefore=Jr,lo.isValid=_i,lo.lang=si,lo.locale=ai,lo.localeData=li,lo.max=Xn,lo.min=Qn,lo.parsingFlags=Ai,lo.set=me,lo.startOf=gi,lo.subtract=Lr,lo.toArray=xi,lo.toObject=Si,lo.toDate=wi,lo.toISOString=$r,lo.inspect=ei,"undefined"!=typeof Symbol&&null!=Symbol.for&&(lo[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),lo.toJSON=Mi,lo.toString=Zr,lo.unix=bi,lo.valueOf=yi,lo.creationData=Ci,lo.eraName=Oi,lo.eraNarrow=Ri,lo.eraAbbr=Pi,lo.eraYear=Ni,lo.year=gt,lo.isLeapYear=vt,lo.weekYear=Wi,lo.isoWeekYear=Gi,lo.quarter=lo.quarters=Zi,lo.month=ut,lo.daysInMonth=dt,lo.week=lo.weeks=kt,lo.isoWeek=lo.isoWeeks=Tt,lo.weeksInYear=Yi,lo.weeksInWeekYear=Ji,lo.isoWeeksInYear=qi,lo.isoWeeksInISOWeekYear=Ki,lo.date=$i,lo.day=lo.days=Wt,lo.weekday=Gt,lo.isoWeekday=qt,lo.dayOfYear=eo,lo.hour=lo.hours=rn,lo.minute=lo.minutes=to,lo.second=lo.seconds=io,lo.millisecond=lo.milliseconds=ro,lo.utcOffset=mr,lo.utc=vr,lo.local=yr,lo.parseZone=br,lo.hasAlignedHourOffset=wr,lo.isDST=xr,lo.isLocal=Mr,lo.isUtcOffset=_r,lo.isUtc=Ar,lo.isUTC=Ar,lo.zoneAbbr=ao,lo.zoneName=so,lo.dates=A("dates accessor is deprecated. Use date instead.",$i),lo.months=A("months accessor is deprecated. Use month instead",ut),lo.years=A("years accessor is deprecated. Use year instead",gt),lo.zone=A("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",gr),lo.isDSTShifted=A("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Sr);var ho=R.prototype;function po(e,t,n,r){var i=yn(),o=p().set(r,t);return i[n](o,e)}function mo(e,t,n){if(u(e)&&(t=e,e=void 0),e=e||"",null!=t)return po(e,t,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=po(e,r,n,"month");return i}function go(e,t,n,r){"boolean"==typeof e?(u(t)&&(n=t,t=void 0),t=t||""):(n=t=e,e=!1,u(t)&&(n=t,t=void 0),t=t||"");var i,o=yn(),a=e?o._week.dow:0,s=[];if(null!=n)return po(t,(n+a)%7,r,"day");for(i=0;i<7;i++)s[i]=po(t,(i+a)%7,r,"day");return s}function vo(e,t){return mo(e,t,"months")}function yo(e,t){return mo(e,t,"monthsShort")}function bo(e,t,n){return go(e,t,n,"weekdays")}function wo(e,t,n){return go(e,t,n,"weekdaysShort")}function xo(e,t,n){return go(e,t,n,"weekdaysMin")}ho.calendar=N,ho.longDateFormat=q,ho.invalidDate=Y,ho.ordinal=X,ho.preparse=fo,ho.postformat=fo,ho.relativeTime=$,ho.pastFuture=ee,ho.set=I,ho.eras=ki,ho.erasParse=Ti,ho.erasConvertYear=Ii,ho.erasAbbrRegex=Di,ho.erasNameRegex=Li,ho.erasNarrowRegex=Bi,ho.months=ot,ho.monthsShort=at,ho.monthsParse=lt,ho.monthsRegex=ht,ho.monthsShortRegex=ft,ho.week=_t,ho.firstDayOfYear=Ct,ho.firstDayOfWeek=Et,ho.weekdays=Ft,ho.weekdaysMin=zt,ho.weekdaysShort=Ut,ho.weekdaysParse=Vt,ho.weekdaysRegex=Kt,ho.weekdaysShortRegex=Yt,ho.weekdaysMinRegex=Jt,ho.isPM=tn,ho.meridiem=on,mn("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===ue(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),r.lang=A("moment.lang is deprecated. Use moment.locale instead.",mn),r.langData=A("moment.langData is deprecated. Use moment.localeData instead.",yn);var So=Math.abs;function Mo(){var e=this._data;return this._milliseconds=So(this._milliseconds),this._days=So(this._days),this._months=So(this._months),e.milliseconds=So(e.milliseconds),e.seconds=So(e.seconds),e.minutes=So(e.minutes),e.hours=So(e.hours),e.months=So(e.months),e.years=So(e.years),this}function _o(e,t,n,r){var i=kr(t,n);return e._milliseconds+=r*i._milliseconds,e._days+=r*i._days,e._months+=r*i._months,e._bubble()}function Ao(e,t){return _o(this,e,t,1)}function Eo(e,t){return _o(this,e,t,-1)}function Co(e){return e<0?Math.floor(e):Math.ceil(e)}function ko(){var e,t,n,r,i,o=this._milliseconds,a=this._days,s=this._months,l=this._data;return o>=0&&a>=0&&s>=0||o<=0&&a<=0&&s<=0||(o+=864e5*Co(Io(s)+a),a=0,s=0),l.milliseconds=o%1e3,e=ce(o/1e3),l.seconds=e%60,t=ce(e/60),l.minutes=t%60,n=ce(t/60),l.hours=n%24,a+=ce(n/24),s+=i=ce(To(a)),a-=Co(Io(i)),r=ce(s/12),s%=12,l.days=a,l.months=s,l.years=r,this}function To(e){return 4800*e/146097}function Io(e){return 146097*e/4800}function Oo(e){if(!this.isValid())return NaN;var t,n,r=this._milliseconds;if("month"===(e=re(e))||"quarter"===e||"year"===e)switch(t=this._days+r/864e5,n=this._months+To(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Io(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return 24*t+r/36e5;case"minute":return 1440*t+r/6e4;case"second":return 86400*t+r/1e3;case"millisecond":return Math.floor(864e5*t)+r;default:throw new Error("Unknown unit "+e)}}function Ro(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*ue(this._months/12):NaN}function Po(e){return function(){return this.as(e)}}var No=Po("ms"),Lo=Po("s"),Do=Po("m"),Bo=Po("h"),jo=Po("d"),Fo=Po("w"),Uo=Po("M"),zo=Po("Q"),Ho=Po("y");function Vo(){return kr(this)}function Wo(e){return e=re(e),this.isValid()?this[e+"s"]():NaN}function Go(e){return function(){return this.isValid()?this._data[e]:NaN}}var qo=Go("milliseconds"),Ko=Go("seconds"),Yo=Go("minutes"),Jo=Go("hours"),Qo=Go("days"),Xo=Go("months"),Zo=Go("years");function $o(){return ce(this.days()/7)}var ea=Math.round,ta={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function na(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}function ra(e,t,n,r){var i=kr(e).abs(),o=ea(i.as("s")),a=ea(i.as("m")),s=ea(i.as("h")),l=ea(i.as("d")),c=ea(i.as("M")),u=ea(i.as("w")),d=ea(i.as("y")),f=o<=n.ss&&["s",o]||o<n.s&&["ss",o]||a<=1&&["m"]||a<n.m&&["mm",a]||s<=1&&["h"]||s<n.h&&["hh",s]||l<=1&&["d"]||l<n.d&&["dd",l];return null!=n.w&&(f=f||u<=1&&["w"]||u<n.w&&["ww",u]),(f=f||c<=1&&["M"]||c<n.M&&["MM",c]||d<=1&&["y"]||["yy",d])[2]=t,f[3]=+e>0,f[4]=r,na.apply(null,f)}function ia(e){return void 0===e?ea:"function"==typeof e&&(ea=e,!0)}function oa(e,t){return void 0!==ta[e]&&(void 0===t?ta[e]:(ta[e]=t,"s"===e&&(ta.ss=t-1),!0))}function aa(e,t){if(!this.isValid())return this.localeData().invalidDate();var n,r,i=!1,o=ta;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(i=e),"object"==typeof t&&(o=Object.assign({},ta,t),null!=t.s&&null==t.ss&&(o.ss=t.s-1)),r=ra(this,!i,o,n=this.localeData()),i&&(r=n.pastFuture(+this,r)),n.postformat(r)}var sa=Math.abs;function la(e){return(e>0)-(e<0)||+e}function ca(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,r,i,o,a,s,l=sa(this._milliseconds)/1e3,c=sa(this._days),u=sa(this._months),d=this.asSeconds();return d?(e=ce(l/60),t=ce(e/60),l%=60,e%=60,n=ce(u/12),u%=12,r=l?l.toFixed(3).replace(/\.?0+$/,""):"",i=d<0?"-":"",o=la(this._months)!==la(d)?"-":"",a=la(this._days)!==la(d)?"-":"",s=la(this._milliseconds)!==la(d)?"-":"",i+"P"+(n?o+n+"Y":"")+(u?o+u+"M":"")+(c?a+c+"D":"")+(t||e||l?"T":"")+(t?s+t+"H":"")+(e?s+e+"M":"")+(l?s+r+"S":"")):"P0D"}var ua=ar.prototype;return ua.isValid=ir,ua.abs=Mo,ua.add=Ao,ua.subtract=Eo,ua.as=Oo,ua.asMilliseconds=No,ua.asSeconds=Lo,ua.asMinutes=Do,ua.asHours=Bo,ua.asDays=jo,ua.asWeeks=Fo,ua.asMonths=Uo,ua.asQuarters=zo,ua.asYears=Ho,ua.valueOf=Ro,ua._bubble=ko,ua.clone=Vo,ua.get=Wo,ua.milliseconds=qo,ua.seconds=Ko,ua.minutes=Yo,ua.hours=Jo,ua.days=Qo,ua.weeks=$o,ua.months=Xo,ua.years=Zo,ua.humanize=aa,ua.toISOString=ca,ua.toString=ca,ua.toJSON=ca,ua.locale=ai,ua.localeData=li,ua.toIsoString=A("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",ca),ua.lang=si,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Ne("x",Te),Ne("X",Re),Fe("X",(function(e,t,n){n._d=new Date(1e3*parseFloat(e))})),Fe("x",(function(e,t,n){n._d=new Date(ue(e))})),
96
96
  //! moment.js
97
- r.version="2.29.4",i(Jn),r.fn=lo,r.min=$n,r.max=er,r.now=tr,r.utc=p,r.unix=co,r.months=vo,r.isDate=d,r.locale=mn,r.invalid=y,r.duration=kr,r.isMoment=M,r.weekdays=bo,r.parseZone=uo,r.localeData=yn,r.isDuration=sr,r.monthsShort=yo,r.weekdaysMin=xo,r.defineLocale=gn,r.updateLocale=vn,r.locales=bn,r.weekdaysShort=wo,r.normalizeUnits=re,r.relativeTimeRounding=ia,r.relativeTimeThreshold=oa,r.calendarFormat=zr,r.prototype=lo,r.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},r}()})),a("juxiN").register(JSON.parse('{"adfgW":"index.js","cmazm":"abap.bc6c1a94.js","jPTA1":"abnf.a3fdbafa.js","jdWNC":"actionscript.59d9b9ea.js","2CBqg":"ada.7ae8a3a8.js","3wHhO":"agda.c22a72e2.js","kFVdl":"al.43edf93f.js","3V4RR":"antlr4.fab93bd9.js","ksX9L":"apacheconf.1ea6f6bc.js","3N81M":"apex.5f5d0b00.js","lBh32":"apl.f0e0255a.js","1cOI2":"applescript.f8873ad2.js","hwV5I":"aql.0596cd74.js","cxQUy":"arduino.8a10351d.js","h8XDs":"arff.b6eba224.js","1glOK":"asciidoc.3591554e.js","5YI5Q":"asm6502.eb3baf93.js","5aM2c":"asmatmel.93b67168.js","aKcNk":"aspnet.a154be94.js","bYGuI":"csharp.60bc2788.js","4ffJ6":"autohotkey.dc99c6b5.js","6o8gr":"autoit.7bd54007.js","d0QlI":"avisynth.506bbdad.js","1vpfH":"avro-idl.ab78e3d7.js","d78C2":"basic.09310972.js","1V5ou":"batch.5c48c918.js","h9qnw":"bbcode.4e0cb2f2.js","eluAn":"bicep.e394696d.js","jD2Yh":"birb.54766d79.js","3ligT":"bison.2c2552ab.js","cSnAi":"bnf.ec556d42.js","gmloY":"brainfuck.4e81eb1d.js","77rtQ":"brightscript.3c7cc723.js","hfFki":"bro.8db28f8a.js","8SYqo":"bsl.260fabfb.js","i4HkI":"cfscript.92c90b90.js","1rBYK":"chaiscript.76481f4b.js","gQYEz":"cil.622792d1.js","bq2uf":"clike.36346267.js","h7tza":"clojure.9da4900e.js","aK2oY":"cmake.234b57e3.js","3V5TZ":"cobol.2e8bd2ea.js","72v5N":"coffeescript.261b318a.js","lNJYg":"concurnas.9d189a8c.js","cHo4f":"coq.917e2a53.js","7GKmU":"crystal.d23925f3.js","a5f4n":"cshtml.92086949.js","2nOzn":"csp.9b5dd573.js","iZH8k":"css-extras.7f3088a6.js","3V9km":"css.fb6f00e3.js","7TCh4":"csv.06af3522.js","8MqYl":"cypher.6af6e534.js","6Oo3A":"d.303192e5.js","6ks0D":"dart.6fb62874.js","huqsT":"dataweave.e97ef31d.js","YtcLG":"dax.013d5e9a.js","1s9Hz":"dhall.d5ee83ba.js","b677V":"diff.9ef56ea8.js","ak2pO":"django.13b0bb49.js","8LDFZ":"dns-zone-file.189b08c5.js","1awLf":"docker.1da9769e.js","9dPYr":"dot.8dca92f3.js","e2ZjS":"ebnf.58c0fa63.js","9h8KW":"editorconfig.9c7b63a5.js","4SWgd":"eiffel.090bab86.js","6HmuU":"ejs.0ee535c3.js","2KAkF":"elixir.dc192ee6.js","jPV3v":"elm.c88782bd.js","agNrQ":"erb.55ec7cf0.js","9BmS2":"erlang.956455fa.js","fqf1c":"etlua.79f6dba5.js","cgMSr":"lua.88c0a077.js","92McF":"excel-formula.d0dd1424.js","juFxG":"factor.e311ca38.js","1dWPh":"false.a93fe44c.js","2k0b2":"firestore-security-rules.4ea155d7.js","dvL1Q":"flow.96e0f48a.js","5oumN":"fortran.0811bc79.js","fP8jO":"fsharp.0119d0fd.js","7L6sP":"ftl.c5671dbe.js","2ujce":"gap.b0574953.js","hzgIA":"gcode.29260c31.js","5MUDD":"gdscript.545f127b.js","ghckm":"gedcom.d53f8a81.js","ian9z":"gherkin.0c5a099f.js","dsuH3":"git.2d89a25c.js","dvV8S":"glsl.0bf837a6.js","6BDWE":"gml.04204c1b.js","btSYt":"gn.cbb4c3be.js","j94Lr":"go-module.2bebc9b8.js","207xG":"go.cc49e5b2.js","iQ4Nh":"graphql.3d658adb.js","9E9pJ":"groovy.3e5836cd.js","hLXUt":"haml.9a056759.js","5ob5h":"handlebars.8c13dfe6.js","1nDhS":"haskell.3c80aa72.js","kQehe":"haxe.40a1dc98.js","1sziu":"hcl.84488f47.js","28Tam":"hlsl.323b0c17.js","awNOU":"hoon.df16cb45.js","eeLMI":"hpkp.9c950797.js","gjEKw":"hsts.0440ab7b.js","3bCJ7":"http.96d5f1c1.js","id4YZ":"ichigojam.c0bd16f5.js","5TKHe":"icon.439feb9f.js","eijPh":"icu-message-format.e96f6551.js","lv8gR":"idris.d3811412.js","bW8K3":"iecst.3fdbbc52.js","b8EBv":"ignore.00726ce9.js","jOS96":"inform7.65978ef5.js","dn3Yf":"ini.1cbb0515.js","iUSU6":"io.e628fd7e.js","6wbwo":"j.b959d174.js","5qA0j":"java.0ffd8069.js","hdx4d":"javadoc.b99752ae.js","jRMSs":"javadoclike.8cc3d825.js","l2DRD":"javascript.fe729813.js","cpOeo":"javastacktrace.cc22fb4b.js","fSVrK":"jexl.2cce5cc0.js","03mi8":"jolie.d8f352cd.js","j6YjP":"jq.65b95777.js","6JQIv":"js-extras.7d041902.js","5nVrm":"js-templates.a3463d0b.js","9gPZY":"jsdoc.0c5cc4d3.js","8q0xA":"json5.b9de5531.js","fIx8j":"jsonp.eefdc553.js","a3ur7":"jsstacktrace.8d3a2b71.js","bKtxi":"julia.679e1c74.js","9vqI0":"keepalived.e694c167.js","lDUCl":"keyman.d1406200.js","gcEXq":"kotlin.fd040b34.js","cxxOt":"kumir.b2072cfc.js","b8NIc":"kusto.98546fcc.js","iXz7U":"latex.ecc17a0d.js","9nRbn":"latte.18295a4f.js","lWxq2":"less.a8a986ab.js","7dEcL":"lilypond.0423d709.js","ck7Ll":"scheme.4039466f.js","hI3m3":"liquid.533f073c.js","7qpQZ":"lisp.b075bd53.js","8Cm1D":"livescript.2b19fb05.js","9sT8D":"llvm.6b74465d.js","gQkTU":"log.b74346d6.js","86y52":"lolcode.0fbc730a.js","6bXdx":"magma.bbb66246.js","hDIxO":"makefile.bf1a7653.js","4wRUQ":"markdown.4a5510a8.js","66rgq":"markup.973a8c4c.js","iAx9A":"matlab.caaa1e9f.js","5SXMq":"maxscript.58a0bf4d.js","gnQ55":"mel.c5da9d2e.js","8G54S":"mermaid.ced53190.js","gfXsu":"mizar.4e6d6035.js","7nZsb":"mongodb.5c4e0cf9.js","hUs37":"monkey.9be800f3.js","fKqwA":"moonscript.fc782589.js","luHXo":"n1ql.7f05115f.js","j0sqX":"n4js.318f41b7.js","avS2d":"nand2tetris-hdl.be3bb656.js","8fNUI":"naniscript.ec3afc9a.js","6PKtR":"nasm.1ee2623a.js","2LUGi":"neon.1d5a4ec8.js","esMLb":"nevod.6908715c.js","jQ8dR":"nginx.404fbeb4.js","1kuW2":"nim.36bf497b.js","7YxPR":"nix.3af3b6b2.js","b1EPY":"nsis.94e1fb71.js","j169M":"objectivec.49a6b342.js","1b4qw":"ocaml.c5fca1eb.js","c0JxA":"opencl.4194613a.js","54ivl":"openqasm.4b589cb3.js","kYO5l":"oz.498e9cbd.js","811Qi":"parigp.ed6a3789.js","gXO52":"parser.3329b2ab.js","4SQCy":"pascal.82aebbcf.js","9KuwN":"pascaligo.4bbd3a85.js","eM7TR":"pcaxis.e636466e.js","6w6GH":"peoplecode.32e124c6.js","eQPpI":"perl.7d72d7fd.js","b83gb":"php-extras.9606406b.js","l8BPM":"phpdoc.617f8af6.js","2cVRv":"plsql.482f8da9.js","gOyA3":"powerquery.486ee359.js","1BYb4":"powershell.856a4dd0.js","lIwm5":"processing.2c7d4403.js","cHCln":"prolog.812b5c86.js","d460J":"promql.8e6b9da4.js","lAnQP":"properties.40afd4d0.js","dG8OA":"protobuf.84963e3e.js","eRbDh":"psl.9c32166c.js","27W0o":"pug.54462c11.js","75Y4h":"puppet.2646aef5.js","kgGGG":"pure.a10bd6b4.js","hFuIq":"purebasic.629b75cd.js","db2yj":"purescript.216751ba.js","8ZppB":"q.b46a94a4.js","iFM89":"qml.bd71f711.js","7FNJV":"qore.d7e006f8.js","6AsUF":"qsharp.7bab07d1.js","7Xrsp":"r.3036c5c0.js","dh9BI":"racket.b867dd29.js","8pRTf":"reason.405183ad.js","kUbHD":"regex.aa4684b4.js","bNx4l":"rego.61da6b5d.js","jbksA":"renpy.ff0ce389.js","gP26j":"rest.91bee177.js","6FCYh":"rip.33f479a4.js","lEjxk":"roboconf.0ba2e9bf.js","c8BOJ":"robotframework.72ccad61.js","elAoE":"rust.9a35cb62.js","eDL1o":"sas.b3b3be64.js","gIQMB":"sass.165275f3.js","i7Y8T":"scala.a51a6234.js","OzRer":"shell-session.c47a7880.js","hZA2W":"smali.46e3f703.js","gT51y":"smalltalk.fb31e155.js","2OoIP":"smarty.abd6973e.js","33hrk":"sml.6d8c2545.js","3uuqi":"solidity.80562c5b.js","kHJvD":"solution-file.30e00f5f.js","6iiDq":"soy.46a7ec1f.js","2TkEp":"sparql.dbb56be0.js","eirDq":"turtle.b8836781.js","jmDes":"splunk-spl.149146f6.js","81dr7":"sqf.ea070acb.js","i4XqC":"squirrel.1efaf6f3.js","1zw3p":"stan.6efb4565.js","kfIG2":"stylus.d4d41ca4.js","dksml":"swift.ea86fdd0.js","4w3mZ":"systemd.df819c28.js","6b6p1":"t4-cs.b3eaa646.js","budu0":"t4-templating.db399052.js","7RUUk":"t4-vb.082c208c.js","2cwdT":"vbnet.ac572fcc.js","fBA7X":"tap.82e5520b.js","gqbYu":"yaml.3d0bf472.js","lCVk7":"tcl.fffb53bb.js","aKXaK":"textile.20ae1d45.js","ks7hU":"toml.69754057.js","kCJbl":"tremor.262b95d4.js","iZ71n":"tt2.f07906cb.js","5mLLA":"twig.a95c4964.js","i9AIa":"typoscript.3dbd38d9.js","iHNMy":"unrealscript.e5c3fc1d.js","bKWLJ":"uorazor.cf3ed6dc.js","2XcAn":"uri.59c4e10c.js","enDcg":"v.fe8e0874.js","db4Ta":"vala.386e6270.js","cmaSk":"velocity.9a0ffb21.js","29RKO":"verilog.4308f028.js","4aBVG":"vhdl.ca8ee4c0.js","6Jrfy":"vim.897929a5.js","kNyzl":"visual-basic.bc36aaac.js","4LJ5s":"warpscript.6d00b50f.js","6Ocza":"wasm.029f651e.js","hvPGO":"web-idl.97fc763d.js","lS90V":"wiki.1179d7f8.js","9LY8Y":"wolfram.7017e6a0.js","bFBdJ":"wren.d4121438.js","iskNq":"xeora.cce693be.js","ek7X7":"xml-doc.025d4193.js","hwA94":"xojo.843f212e.js","f8rnQ":"xquery.50701bd4.js","3Q9qv":"yang.2c70775f.js","a0Oht":"zig.e33efe11.js","dnGOp":"core.ade097c7.js"}'));var s;s=a("9Hk4c");var l,c=a("2BCLI"),u=a("85Hg2");l=a("bG9xl")();const d=e=>e?new URL(e.startsWith("http")?e:`https://${e}`).origin:"https://backend.memori.ai";var f=a("dCyaf");const h=(e,t)=>r(f)(`${t.apiUrl}${e}`,{...t,body:(null==t?void 0:t.body)?JSON.stringify(t.body):void 0,mode:"cors",credentials:"include",headers:{"Content-Type":"application/json",...null==t?void 0:t.headers}}).then((e=>(null==t?void 0:t.text)?e.text():e.json()));var p=e=>({getTenantPublicMemoriList:t=>h(`/TenantPublicMemori/${encodeURI(t)}`,{apiUrl:e}),getTenantMetaverseMemoriList:t=>h(`/TenantMetaverseMemori/${encodeURI(t)}`,{apiUrl:e}),getPublicMemoriList:t=>h(`/PublicMemori/${t}`,{apiUrl:e}),getAllMemori:t=>h(`/AllMemori/${t}`,{apiUrl:e}),getUserByIDMemoriList:(t,n,r)=>h(`/UserMemoriByID/${t}/${n}${r?`/${r}`:""}`,{apiUrl:e}),getUserMemoriList:(t,n,r)=>h(`/UserMemori/${t}/${n}${r?`/${r}`:""}`,{apiUrl:e}),getMemoriList:t=>h(`/Memori/${t}`,{apiUrl:e}),getSharedMemoriList:t=>h(`/SharedMemori/${t}`,{apiUrl:e}),getTenantCategories:t=>h(`/TenantMemoriCategories/${encodeURI(t)}`,{apiUrl:e}),getMemoriConfigs:t=>h(`/MemoriConfigs/${t}`,{apiUrl:e}),createMemori:(t,n)=>h(`/Memori/${t}`,{apiUrl:e,body:n,method:"POST"}),updateMemori:(t,n)=>h(`/Memori/${t}/${n.memoriID}`,{apiUrl:e,body:n,method:"PATCH"}),deleteMemori:(t,n)=>h(`/Memori/${t}`,{apiUrl:e,body:n,method:"DELETE"}),getMemoriById:(t,n)=>h(`/Memori/${t}/${n}`,{apiUrl:e}),getMemoriByUserAndId:(t,n,r,i)=>h(`/MemoriById/${t}/${n}/${r}${i?`/${i}`:""}`,{apiUrl:e}),getMemori:(t,n,r,i)=>h(`/Memori/${encodeURI(t)}/${encodeURI(n)}/${encodeURI(r)}/${null!=i?i:""}`,{apiUrl:e}),getMemoriSessions:(t,n,r,i)=>h(`/MemoriSessions/${t}/${n}${r?`/${r}`:""}${r&&i?`/${i}`:""}`,{apiUrl:e}),transferMemori:(t,n)=>h(`/TransferMemori/${t}`,{apiUrl:e,body:n,method:"POST"}),memoriContentUpdated:(t,n)=>h(`/MemoriContentUpdated/${t}/${n}`,{apiUrl:e,method:"POST"})}),m=e=>({userSignUp:t=>h("/User",{apiUrl:e,body:t,method:"POST"}),userConfirmSignUp:t=>h("/UserConfirm",{apiUrl:e,body:t,method:"POST"}),userLogin:t=>h("/Login",{apiUrl:e,body:t,method:"POST"}),userLogout:t=>h(`/Logout/${t}`,{apiUrl:e,method:"POST"}),getUser:(t,n)=>h(`/User/${t}/${n}`,{apiUrl:e}),getUsersList:t=>h(`/Users/${t}`,{apiUrl:e}),deleteUser:(t,n)=>h(`/User/${t}/${n}`,{apiUrl:e,method:"DELETE"}),updateUser:(t,n,r)=>h(`/User/${t}/${n}`,{apiUrl:e,method:"PATCH",body:r}),resetPassword:t=>h("/ResetPassword",{apiUrl:e,body:t,method:"POST"}),resetConfirm:t=>h("/ResetConfirm",{apiUrl:e,body:t,method:"POST"}),recoverUsername:t=>h("/RecoverUsername",{apiUrl:e,body:t,method:"POST"}),getTenantConfig:t=>h(`/Tenant/${t}`,{apiUrl:e}),resendVerificationCode:t=>h("/ResendVerificationCode",{apiUrl:e,body:t,method:"POST"}),createUser:(t,n)=>h(`/User/${t}`,{apiUrl:e,body:n,method:"POST"})}),g=e=>({getMemoriIntegrationsList:(t,n)=>h(`/Integrations/${t}/${n}`,{apiUrl:e}),getAllIntegrationsList:t=>h(`/AllIntegrations/${t}`,{apiUrl:e}),getIntegration:(t,n)=>h(`/Integration/${t}/${n}`,{apiUrl:e}),deleteIntegration:(t,n)=>h(`/Integration/${t}/${n}`,{apiUrl:e,method:"DELETE"}),createIntegration:(t,n)=>h(`/Integration/${t}`,{apiUrl:e,method:"POST",body:n}),updateIntegration:(t,n,r)=>h(`/Integration/${t}/${n}`,{apiUrl:e,method:"PATCH",body:r})}),v=e=>({getUploadAssetURL:(t,n,r)=>`${e}/Asset/${t}/${n}${r?`/${r}`:""}`,uploadAsset:async(t,n,r,i,o)=>{const a=new FormData,s=await fetch(n),l=await s.blob();a.append(t,l,t);const c=await fetch(`${e}/Asset/${r}/${i}${o?`/${o}`:""}`,{method:"POST",body:a});return await c.json()},getAsset:(t,n)=>h(`/Asset/${t}/${n}`,{apiUrl:e,method:"GET"}),updateAsset:(t,n,r)=>h(`/Asset/${t}/${n.split("/").reverse()[0]}`,{apiUrl:e,method:"PATCH",body:r}),deleteAsset:(t,n)=>h(`/Asset/${t}/${n.split("/").reverse()[0]}`,{apiUrl:e,method:"DELETE"})}),y=e=>({getSentInvitations:t=>h(`/SentInvitations/${t}`,{apiUrl:e}),getMemoriInvitations:(t,n)=>h(`/MemoriInvitations/${t}/${n}`,{apiUrl:e}),getReceivedInvitations:t=>h(`/ReceivedInvitations/${t}`,{apiUrl:e}),getAllInvitations:t=>h(`/AllInvitations/${t}`,{apiUrl:e}),getInvitation:(t,n)=>h(`/Invitation/${t}/${n}`,{apiUrl:e}),updateInvitation:(t,n)=>h(`/Invitation/${t}/${n.invitationID}`,{apiUrl:e,method:"PATCH",body:n}),deleteInvitation:(t,n)=>h(`/Invitation/${t}/${n}`,{apiUrl:e,method:"DELETE"}),acceptInvitation:(t,n)=>h(`/AcceptInvitation/${t}/${n}`,{apiUrl:e,method:"POST"}),rejectInvitation:(t,n)=>h(`/RejectInvitation/${t}/${n}`,{apiUrl:e,method:"POST"}),sendInvitation:(t,n)=>h(`/SendInvitation/${t}`,{apiUrl:e,method:"POST",body:n})}),b=e=>({getTenantConsumptionLogs:(t,n,r,i,o)=>h(`/TenantConsumptionLogs/${t}/${n}/${r}${i?`/${i}`:""}${i&&o?`/${o}`:""}`,{apiUrl:e}),getUserConsumptionLogs:(t,n,r,i,o)=>h(`/UserConsumptionLogs/${t}/${n}/${r}${i?`/${i}`:""}${i&&o?`/${o}`:""}`,{apiUrl:e}),getMemoriConsumptionLogs:(t,n,r,i,o)=>h(`/MemoriConsumptionLogs/${t}/${n}/${r}${i?`/${i}`:""}${i&&o?`/${o}`:""}`,{apiUrl:e})}),w=e=>({getTenantNotifications:t=>h(`/TenantNotifications/${t}`,{apiUrl:e}),getUserNotifications:t=>h(`/UserNotifications/${t}`,{apiUrl:e})});var x=e=>({asset:v(e),memori:p(e),user:m(e),integration:g(e),invitation:y(e),consumptionLogs:b(e),notifications:w(e),...v(e),...p(e),...m(e),...g(e),...y(e),...b(e),...w(e)}),S=e=>({getCorrelationPairs:async(t,n,r)=>h(`/CorrelationPairs/${t}${n?`/${n}${r?`/${r}`:""}`:""}`,{method:"GET",apiUrl:e}),postCorrelationPair:async(t,n)=>h(`/CorrelationPair/${t}`,{method:"POST",apiUrl:e,body:n}),deleteCorrelationPair:async(t,n)=>h(`/CorrelationPair/${t}/${n}`,{method:"DELETE",apiUrl:e})}),M=e=>({postTextEnteredEvent:async({sessionId:t,text:n})=>h(`/TextEnteredEvent/${t}`,{method:"POST",apiUrl:e,body:{text:n}}),postPlaceChangedEvent:async({sessionId:t,placeName:n,latitude:r,longitude:i,uncertaintyKm:o})=>h(`/PlaceChangedEvent/${t}`,{method:"POST",apiUrl:e,body:{placeName:n,latitude:r,longitude:i,uncertaintyKm:o}}),postDateChangedEvent:async t=>h(`/DateChangedEvent/${t}`,{method:"POST",apiUrl:e}),postTagChangedEvent:async(t,n)=>h(`/TagChangedEvent/${t}`,{method:"POST",apiUrl:e,body:{tag:n}}),postTimeoutEvent:async t=>h(`/TimeoutEvent/${t}`,{method:"POST",apiUrl:e}),postMediumSelectedEvent:async(t,n)=>h(`/MediumSelectedEvent/${t}`,{method:"POST",apiUrl:e,body:{medium:n}}),postDateSelectedEvent:async t=>h(`/DateSelectedEvent/${t}`,{method:"GET",apiUrl:e}),postPlaceSelectedEvent:async t=>h(`/PlaceSelectedEvent/${t}`,{method:"GET",apiUrl:e}),postTagSelectedEvent:async t=>h(`/TagSelectedEvent/${t}`,{method:"GET",apiUrl:e})}),_=e=>({importCSV:async(t,n,r)=>h(`/ImportExport/ImportCSV/${t}`,{method:"POST",apiUrl:e,body:{rows:n,...r}}),importProcesses:async t=>h(`/ImportExport/ImportProcesses/${t}`,{method:"GET",apiUrl:e}),importStatus:async t=>h(`/ImportExport/ImportStatus/${t}`,{method:"GET",apiUrl:e}),stopImport:async t=>h(`/ImportExport/StopImport/${t}`,{method:"POST",apiUrl:e}),importTXT:async(t,n,r)=>h(`/ImportExport/ImportTXT/${t}`,{method:"POST",apiUrl:e,body:{rows:n,...r}}),exportCSV:async(t,n)=>h(`/ImportExport/ExportCSV/${t}`,{method:"POST",apiUrl:e,body:n,text:!0})}),A=e=>({getIntents:async t=>h(`/Intents/${t}`,{method:"GET",apiUrl:e}),getIntent:async(t,n)=>h(`/Intent/${t}/${n}`,{method:"GET",apiUrl:e}),patchIntent:async(t,n)=>h(`/Intent/${t}/${n.intentID}`,{method:"PATCH",apiUrl:e,body:n}),deleteIntent:async(t,n)=>h(`/Intent/${t}/${n}`,{method:"DELETE",apiUrl:e}),createIntent:async(t,n)=>h(`/Intent/${t}`,{method:"POST",apiUrl:e,body:n}),getIntentSlots:async t=>h(`/IntentSlots/${t}`,{method:"GET",apiUrl:e}),getIntentSlot:async(t,n)=>h(`/IntentSlot/${t}/${n}`,{method:"GET",apiUrl:e}),patchIntentSlot:async(t,n)=>h(`/IntentSlot/${t}/${n.intentSlotID}`,{method:"PATCH",apiUrl:e,body:n}),deleteIntentSlot:async(t,n)=>h(`/IntentSlot/${t}/${n}`,{method:"DELETE",apiUrl:e}),createIntentSlot:async(t,n)=>h(`/IntentSlot/${t}`,{method:"POST",apiUrl:e,body:n})}),E=e=>({getLocalizationKeys:async t=>h(`/LocalizationKeys/${t}`,{method:"GET",apiUrl:e}),getLocalizationKey:async(t,n)=>h(`/LocalizationKey/${t}/${n}`,{method:"GET",apiUrl:e}),deleteLocalizationKey:async(t,n)=>h(`/LocalizationKey/${t}/${n}`,{method:"DELETE",apiUrl:e}),postLocalizationKey:async(t,n)=>h(`/LocalizationKey/${t}`,{method:"POST",apiUrl:e,body:n}),patchLocalizationKey:async(t,n)=>h(`/LocalizationKey/${t}`,{method:"PATCH",apiUrl:e,body:n})}),C=e=>({getMedia:async(t,n)=>h(`/Media/${t}/${n}`,{method:"GET",apiUrl:e}),deleteMedia:async(t,n)=>h(`/Media/${t}/${n}`,{method:"DELETE",apiUrl:e}),getMedium:async(t,n,r)=>h(`/Medium/${t}/${n}/${r}`,{method:"GET",apiUrl:e}),patchMedium:async(t,n,r)=>h(`/Medium/${t}/${n}/${r}`,{method:"GET",apiUrl:e}),deleteMedium:(t,n,r)=>h(`/Medium/${t}/${n}/${r}`,{method:"GET",apiUrl:e}),postMedium:async(t,n)=>h(`/Medium/${t}/${n}`,{method:"GET",apiUrl:e})}),k=e=>({getMemories:async(t,n)=>h(`/Memories/${t}${n?`/${n}`:""}`,{method:"GET",apiUrl:e}),getMemoriesPaginated:async(t,n,r,i)=>h(`/Memories/${t}/${n}/${r}${i?`/${i}`:""}`,{method:"GET",apiUrl:e}),getMemory:async(t,n)=>h(`/Memory/${t}/${n}`,{method:"GET",apiUrl:e}),patchMemory:async(t,n)=>h(`/Memory/${t}/${n.memoryID}`,{method:"PATCH",apiUrl:e,body:n}),deleteMemory:async(t,n)=>h(`/Memory/${t}/${n}`,{method:"DELETE",apiUrl:e}),postMemory:async(t,n)=>h(`/Memory/${t}`,{method:"POST",apiUrl:e,body:n}),getMemoryAccess:async(t,n)=>h(`/MemoryAccess/${t}/${n}`,{method:"GET",apiUrl:e})}),T=e=>({getWordVector:async(t,n)=>h(`/WordVector/${t}/${n}`,{method:"GET",apiUrl:e}),getSimilarWords:async(t,n)=>h(`/SimilarWords/${t}/${n}`,{method:"GET",apiUrl:e}),guessLanguage:async(t,n)=>h(`/GuessLanguage/${t}`,{method:"POST",apiUrl:e,body:{text:n}}),computeSimilarity:async(t,n,r,i,o)=>h(`/ComputeSimilarity/${t}`,{method:"POST",apiUrl:e,body:{referenceText:n,referenceTextType:r,comparisonText:i,comparisonTextType:o}}),checkWords:async(t,n)=>h(`/CheckWords/${t}`,{method:"POST",apiUrl:e,body:{text:n}})}),I=e=>({getPeople:async t=>h(`/People/${t}`,{method:"GET",apiUrl:e}),getPerson:async(t,n)=>h(`/Person/${t}/${n}`,{method:"GET",apiUrl:e}),patchPerson:async(t,n)=>h(`/Person/${t}/${n.personID}`,{method:"PATCH",body:n,apiUrl:e}),deletePerson:async(t,n)=>h(`/Person/${t}/${n}`,{method:"DELETE",apiUrl:e}),postPerson:async(t,n)=>h(`/Person/${t}`,{method:"POST",body:n,apiUrl:e})}),O=e=>({getPromptedQuestions:async t=>h(`/PromptedQuestions/${t}`,{method:"GET",apiUrl:e}),getPromptedQuestion:async(t,n)=>h(`/PromptedQuestion/${t}/${n}`,{method:"GET",apiUrl:e}),patchPromptedQuestion:async(t,n)=>h(`/PromptedQuestion/${t}/${n}`,{method:"GET",apiUrl:e}),deletePromptedQuestion:async(t,n)=>h(`/PromptedQuestion/${t}/${n}`,{method:"GET",apiUrl:e}),postPromptedQuestion:async t=>h(`/PromptedQuestion/${t}`,{method:"GET",apiUrl:e})}),R=e=>({searchMemory:async(t,n)=>h(`/Search/${t}`,{method:"POST",body:n,apiUrl:e}),postRandom:async t=>h(`/Random/${t}`,{method:"POST",apiUrl:e}),postHints:async t=>h(`/Hints/${t}`,{method:"GET",apiUrl:e})}),P=e=>({initSession:async t=>h("/Session",{method:"POST",body:t,apiUrl:e}),getSession:async t=>h(`/Session/${t}`,{method:"GET",apiUrl:e}),deleteSession:async t=>h(`/Session/${t}`,{method:"DELETE",apiUrl:e})}),N=e=>({getStatistics:async t=>h(`/Statistics/${t}`,{method:"GET",apiUrl:e}),getContentQualityIndexes:async t=>h(`/ContentQualityIndexes/${t}`,{method:"GET",apiUrl:e}),getTextQualityIndexes:async t=>h(`/TextQualityIndexes/${t}`,{method:"GET",apiUrl:e}),getEventLogs:async(t,n,r)=>h(`/EventLogs/${t}/${n}/${r}`,{method:"GET",apiUrl:e}),getMemoryEventLogs:async(t,n,r,i)=>h(`/EventLogs/${t}/${n}/${r}/${i}`,{method:"GET",apiUrl:e}),getIntentEventLogs:async(t,n,r,i)=>h(`/EventLogs/${t}/${n}/${r}/${i}`,{method:"GET",apiUrl:e})}),L=e=>({getUnansweredQuestions:async t=>h(`/UnansweredQuestions/${t}`,{method:"GET",apiUrl:e}),getUnansweredQuestionsPaginated:async(t,n,r)=>h(`/UnansweredQuestions/${t}/${n}/${r}`,{method:"GET",apiUrl:e}),postUnansweredQuestion:async(t,n)=>h(`/UnansweredQuestion/${t}`,{method:"POST",apiUrl:e,body:n}),deleteUnansweredQuestion:async(t,n)=>h(`/UnansweredQuestion/${t}/${n}`,{method:"DELETE",apiUrl:e})}),D=e=>({getContextVars:async t=>h(`/ContextVars/${t}`,{method:"GET",apiUrl:e}),getContextVarNames:async t=>h(`/ContextVarNames/${t}`,{method:"GET",apiUrl:e}),getContextVarValues:async(t,n)=>h(`/ContextVarValues/${t}/${n}`,{method:"GET",apiUrl:e})}),B=e=>({getCustomWords:async t=>h(`/CustomWords/${t}`,{method:"GET",apiUrl:e}),getCustomWord:async(t,n)=>h(`/CustomWord/${t}/${n}`,{method:"GET",apiUrl:e}),deleteCustomWord:async(t,n)=>h(`/CustomWord/${t}/${n}`,{method:"DELETE",apiUrl:e}),postCustomWord:async(t,n)=>h(`/CustomWord/${t}`,{method:"POST",apiUrl:e,body:n}),patchCustomWord:async(t,n)=>h(`/CustomWord/${t}/${n.customWordID}`,{method:"PATCH",apiUrl:e,body:n})}),j=e=>({getChatLogs:async(t,n,r)=>h(`/ChatLogs/${t}${n?`/${n}`:""}${n&&r?`/${r}`:""}`,{method:"GET",apiUrl:e}),getSessionChatLogs:async(t,n)=>h(`/SessionChatLogs/${t}/${n}`,{method:"GET",apiUrl:e}),deleteChatLogs:async(t,n,r)=>h(`/ChatLogs/${t}${n?`/${n}`:""}${n&&r?`/${r}`:""}`,{method:"DELETE",apiUrl:e}),deleteChatLog:async(t,n)=>h(`/ChatLog/${t}/${n}`,{method:"DELETE",apiUrl:e})}),F=e=>({correlationPairs:S(e),...S(e),dialog:M(e),...M(e),importExport:_(e),..._(e),intents:A(e),...A(e),localizationKeys:E(e),...E(e),media:C(e),...C(e),memories:k(e),...k(e),nlp:T(e),...T(e),people:I(e),...I(e),promptedQuestions:O(e),...O(e),search:R(e),...R(e),session:P(e),...P(e),stats:N(e),...N(e),unansweredQuestions:L(e),...L(e),contextVars:D(e),...D(e),customDictionary:B(e),...B(e),chatLogs:j(e),...j(e)}),U={};e(U,"allowedMediaTypes",(()=>z)),e(U,"anonTag",(()=>H));const z=["image/jpeg","image/png","image/jpg","image/gif","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/pdf","video/mp4","video/avi","audio/mpeg3","audio/wav","audio/mpeg","video/mpeg","model/gltf-binary"],H="👤";var V=e=>({getResourceUrl:({type:t,resourceURI:n,sessionID:r,baseURL:i="https://app.twincreator.com"})=>{let o="cover"===t?`${i}/images/memoriCover.png`:`${i}/images/memoriAvatar.png`;return n&&0!==n.length?n.includes("memoriai/memory")?`${n}?memori-ai-session-id=${r}`:n.startsWith("https://")||n.startsWith("http://")?`${n}${r?`/${r}`:""}`:n.startsWith("cloud://")?`${e.replace(/v2/,"v1")}/CloudAsset/${n.replace("cloud://","")}`:n.startsWith("guid://")?`${e.replace(/v2/,"v1")}/GuidAsset/${n.replace("guid://","")}`:o:o}});var W=e=>{const t=d(e);return{backend:x(`${t}/api/v2`),...F(`${t}/memori/v2`),constants:U,asset:V(`${t}/api/v2`)}},G=(u=a("85Hg2"),{}),q={};(q=function(e){if(Array.isArray(e))return e}).__esModule=!0,q.default=q;var K={};(K=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}).__esModule=!0,K.default=K;var Y={},J={};(J=function(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}).__esModule=!0,J.default=J,Y=function(e,t){if(e){if("string"==typeof e)return J(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)?J(e,t):void 0}},Y.__esModule=!0,Y.default=Y;var Q={};(Q=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}).__esModule=!0,Q.default=Q,(G=function(e,t){return q(e)||K(e,t)||Y(e,t)||Q()}).__esModule=!0,G.default=G;var X={},Z={},$={};function ee(e){return $=ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$.__esModule=!0,$.default=$,ee(e)}($=ee).__esModule=!0,$.default=$;var te=$.default,ne={},re=$.default;(ne=function(e,t){if("object"!==re(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==re(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}).__esModule=!0,ne.default=ne,(Z=function(e){var t=ne(e,"string");return"symbol"===te(t)?t:String(t)}).__esModule=!0,Z.default=Z,(X=function(e,t,n){return(t=Z(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}).__esModule=!0,X.default=X;u=a("85Hg2");var ie={};(ie=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}).__esModule=!0,ie.default=ie;var oe={};function ae(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,Z(r.key),r)}}(oe=function(e,t,n){return t&&ae(e.prototype,t),n&&ae(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}).__esModule=!0,oe.default=oe;u=a("85Hg2");var se=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,le={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},ce=function(e){return le[e]};function ue(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 de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach((function(t){r(X)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var fe,he={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:function(e){return e.replace(se,ce)}},pe=(0,u.createContext)();function me(){return he}var ge=function(){function e(){r(ie)(this,e),this.usedNamespaces={}}return r(oe)(e,[{key:"addUsedNamespaces",value:function(e){var t=this;e.forEach((function(e){t.usedNamespaces[e]||(t.usedNamespaces[e]=!0)}))}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),e}();function ve(){return fe}var ye={type:"3rdParty",init:function(e){!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};he=de(de({},he),e)}(e.options.react),function(e){fe=e}(e)}};function be(){if(console&&console.warn){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];"string"==typeof n[0]&&(n[0]="react-i18next:: ".concat(n[0])),(e=console).warn.apply(e,n)}}var we={};function xe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];"string"==typeof t[0]&&we[t[0]]||("string"==typeof t[0]&&(we[t[0]]=new Date),be.apply(void 0,t))}function Se(e,t,n){e.loadNamespaces(t,(function(){if(e.isInitialized)n();else{e.on("initialized",(function t(){setTimeout((function(){e.off("initialized",t)}),0),n()}))}}))}function Me(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.languages[0],i=!!t.options&&t.options.fallbackLng,o=t.languages[t.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};return!(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e))&&(!!t.hasResourceBundle(r,e)||(!(t.services.backendConnector.backend&&(!t.options.resources||t.options.partialBundledLanguages))||!(!a(r,e)||i&&!a(o,e))))}function _e(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t.languages||!t.languages.length)return xe("i18n.languages were undefined or empty",t.languages),!0;var r=void 0!==t.options.ignoreJSONStructure;return r?t.hasLoadedNamespace(e,{precheck:function(t,r){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}):Me(e,t,n)}function Ae(e){return e.displayName||e.name||("string"==typeof e&&e.length>0?e:"Unknown")}function Ee(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 Ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ee(Object(n),!0).forEach((function(t){r(X)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ke=function(e,t){var n=(0,u.useRef)();return(0,u.useEffect)((function(){n.current=t?n.current:e}),[e,t]),n.current};function Te(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.i18n,i=(0,u.useContext)(pe)||{},o=i.i18n,a=i.defaultNS,s=n||o||ve();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new ge),!s){xe("You will need to pass in an i18next instance by using initReactI18next");var l=function(e){return Array.isArray(e)?e[e.length-1]:e},c=[l,{},!1];return c.t=l,c.i18n={},c.ready=!1,c}s.options.react&&void 0!==s.options.react.wait&&xe("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var d=Ce(Ce(Ce({},me()),s.options.react),t),f=d.useSuspense,h=d.keyPrefix,p=e||a||s.options&&s.options.defaultNS;p="string"==typeof p?[p]:p||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(p);var m=(s.isInitialized||s.initializedStoreOnce)&&p.every((function(e){return _e(e,s,d)}));function g(){return s.getFixedT(null,"fallback"===d.nsMode?p:p[0],h)}var v=(0,u.useState)(g),y=r(G)(v,2),b=y[0],w=y[1],x=p.join(),S=ke(x),M=(0,u.useRef)(!0);(0,u.useEffect)((function(){var e=d.bindI18n,t=d.bindI18nStore;function n(){M.current&&w(g)}return M.current=!0,m||f||Se(s,p,(function(){M.current&&w(g)})),m&&S&&S!==x&&M.current&&w(g),e&&s&&s.on(e,n),t&&s&&s.store.on(t,n),function(){M.current=!1,e&&s&&e.split(" ").forEach((function(e){return s.off(e,n)})),t&&s&&t.split(" ").forEach((function(e){return s.store.off(e,n)}))}}),[s,x]);var _=(0,u.useRef)(!0);(0,u.useEffect)((function(){M.current&&!_.current&&w(g),_.current=!1}),[s,h]);var A=[b,s,m];if(A.t=b,A.i18n=s,A.ready=m,m)return A;if(!m&&!f)return A;throw new Promise((function(e){Se(s,p,(function(){e()}))}))}var Ie={};!function(e,t,n,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(t),a=i(n),s=i(r),l=function(e,t,n){return{endTime:t,insertTime:n,type:"exponentialRampToValue",value:e}},c=function(e,t,n){return{endTime:t,insertTime:n,type:"linearRampToValue",value:e}},u=function(e,t){return{startTime:t,type:"setValue",value:e}},d=function(e,t,n){return{duration:n,startTime:t,type:"setValueCurve",values:e}},f=function(e,t,n){var r=n.startTime,i=n.target,o=n.timeConstant;return i+(t-i)*Math.exp((r-e)/o)},h=function(e){return"exponentialRampToValue"===e.type},p=function(e){return"linearRampToValue"===e.type},m=function(e){return h(e)||p(e)},g=function(e){return"setValue"===e.type},v=function(e){return"setValueCurve"===e.type},y=function e(t,n,r,i){var o=t[n];return void 0===o?i:m(o)||g(o)?o.value:v(o)?o.values[o.values.length-1]:f(r,e(t,n-1,o.startTime,i),o)},b=function(e,t,n,r,i){return void 0===n?[r.insertTime,i]:m(n)?[n.endTime,n.value]:g(n)?[n.startTime,n.value]:v(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,y(e,t-1,n.startTime,i)]},w=function(e){return"cancelAndHold"===e.type},x=function(e){return"cancelScheduledValues"===e.type},S=function(e){return w(e)||x(e)?e.cancelTime:h(e)||p(e)?e.endTime:e.startTime},M=function(e,t,n,r){var i=r.endTime,o=r.value;return n===o?o:0<n&&0<o||n<0&&o<0?n*Math.pow(o/n,(e-t)/(i-t)):0},_=function(e,t,n,r){return n+(e-t)/(r.endTime-t)*(r.value-n)},A=function(e,t){var n=Math.floor(t),r=Math.ceil(t);return n===r?e[n]:(1-(t-n))*e[n]+(1-(r-t))*e[r]},E=function(e,t){var n=t.duration,r=t.startTime,i=t.values,o=(e-r)/n*(i.length-1);return A(i,o)},C=function(e){return"setTarget"===e.type},k=function(e){function t(e){a.default(this,t),this._automationEvents=[],this._currenTime=0,this._defaultValue=e}return s.default(t,[{key:e,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:"add",value:function(e){var t=S(e);if(w(e)||x(e)){var n=this._automationEvents.findIndex((function(n){return x(e)&&v(n)?n.startTime+n.duration>=t:S(n)>=t})),r=this._automationEvents[n];if(-1!==n&&(this._automationEvents=this._automationEvents.slice(0,n)),w(e)){var i=this._automationEvents[this._automationEvents.length-1];if(void 0!==r&&m(r)){if(C(i))throw new Error("The internal list is malformed.");var o=v(i)?i.startTime+i.duration:S(i),a=v(i)?i.values[i.values.length-1]:i.value,s=h(r)?M(t,o,a,r):_(t,o,a,r),f=h(r)?l(s,t,this._currenTime):c(s,t,this._currenTime);this._automationEvents.push(f)}void 0!==i&&C(i)&&this._automationEvents.push(u(this.getValue(t),t)),void 0!==i&&v(i)&&i.startTime+i.duration>t&&(this._automationEvents[this._automationEvents.length-1]=d(new Float32Array([6,7]),i.startTime,t-i.startTime))}}else{var g=this._automationEvents.findIndex((function(e){return S(e)>t})),y=-1===g?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[g-1];if(void 0!==y&&v(y)&&S(y)+y.duration>t)return!1;var b=h(e)?l(e.value,e.endTime,this._currenTime):p(e)?c(e.value,t,this._currenTime):e;if(-1===g)this._automationEvents.push(b);else{if(v(e)&&t+e.duration>S(this._automationEvents[g]))return!1;this._automationEvents.splice(g,0,b)}}return!0}},{key:"flush",value:function(e){var t=this._automationEvents.findIndex((function(t){return S(t)>e}));if(t>1){var n=this._automationEvents.slice(t-1),r=n[0];C(r)&&n.unshift(u(y(this._automationEvents,t-2,r.startTime,this._defaultValue),r.startTime)),this._automationEvents=n}}},{key:"getValue",value:function(e){if(0===this._automationEvents.length)return this._defaultValue;var t=this._automationEvents.findIndex((function(t){return S(t)>e})),n=this._automationEvents[t],r=(-1===t?this._automationEvents.length:t)-1,i=this._automationEvents[r];if(void 0!==i&&C(i)&&(void 0===n||!m(n)||n.insertTime>e))return f(e,y(this._automationEvents,r-1,i.startTime,this._defaultValue),i);if(void 0!==i&&g(i)&&(void 0===n||!m(n)))return i.value;if(void 0!==i&&v(i)&&(void 0===n||!m(n)||i.startTime+i.duration>e))return e<i.startTime+i.duration?E(e,i):i.values[i.values.length-1];if(void 0!==i&&m(i)&&(void 0===n||!m(n)))return i.value;if(void 0!==n&&h(n)){var a=b(this._automationEvents,r,i,n,this._defaultValue),s=o.default(a,2),l=s[0],c=s[1];return M(e,l,c,n)}if(void 0!==n&&p(n)){var u=b(this._automationEvents,r,i,n,this._defaultValue),d=o.default(u,2),w=d[0],x=d[1];return _(e,w,x,n)}return this._defaultValue}}]),t}(Symbol.iterator),T=function(e){return{cancelTime:e,type:"cancelAndHold"}},I=function(e){return{cancelTime:e,type:"cancelScheduledValues"}},O=function(e,t){return{endTime:t,type:"exponentialRampToValue",value:e}},R=function(e,t){return{endTime:t,type:"linearRampToValue",value:e}},P=function(e,t,n){return{startTime:t,target:e,timeConstant:n,type:"setTarget"}};e.AutomationEventList=k,e.createCancelAndHoldAutomationEvent=T,e.createCancelScheduledValuesAutomationEvent=I,e.createExponentialRampToValueAutomationEvent=O,e.createLinearRampToValueAutomationEvent=R,e.createSetTargetAutomationEvent=P,e.createSetValueAutomationEvent=u,e.createSetValueCurveAutomationEvent=d,Object.defineProperty(e,"__esModule",{value:!0})}(Ie,a("kagof"),a("4qTFT"),a("9uC66"));const Oe=new WeakSet,Re=new WeakMap,Pe=new WeakMap,Ne=new WeakMap,Le=new WeakMap,De=new WeakMap,Be=new WeakMap,je=new WeakMap,Fe=new WeakMap,Ue=new WeakMap,ze={construct:()=>ze},He=e=>{try{new new Proxy(e,ze)}catch{return!1}return!0},Ve=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,We=(e,t)=>{const n=[];let r=e.replace(/^[\s]+/,""),i=r.match(Ve);for(;null!==i;){const e=i[1].slice(1,-1),o=i[0].replace(/([\s]+)?;?$/,"").replace(e,new URL(e,t).toString());n.push(o),r=r.slice(i[0].length).replace(/^[\s]+/,""),i=r.match(Ve)}return[n.join(";"),r]},Ge=e=>{if(void 0!==e&&!Array.isArray(e))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},qe=e=>{if(!He(e))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===e.prototype||"object"!=typeof e.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},Ke=(e,t)=>{const n=e.get(t);if(void 0===n)throw new Error("A value with the given key could not be found.");return n},Ye=(e,t)=>{const n=Array.from(e).filter(t);if(n.length>1)throw Error("More than one element was found.");if(0===n.length)throw Error("No element was found.");const[r]=n;return e.delete(r),r},Je=(e,t,n,r)=>{const i=Ke(e,t),o=Ye(i,(e=>e[0]===n&&e[1]===r));return 0===i.size&&e.delete(t),o},Qe=e=>Ke(Be,e),Xe=e=>{if(Oe.has(e))throw new Error("The AudioNode is already stored.");Oe.add(e),Qe(e).forEach((e=>e(!0)))},Ze=e=>"port"in e,$e=e=>{if(!Oe.has(e))throw new Error("The AudioNode is not stored.");Oe.delete(e),Qe(e).forEach((e=>e(!1)))},et=(e,t)=>{!Ze(e)&&t.every((e=>0===e.size))&&$e(e)},tt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},nt=(e,t)=>e.context===t,rt=e=>{try{e.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},it=()=>new DOMException("","IndexSizeError"),ot=e=>{var t;e.getChannelData=(t=e.getChannelData,n=>{try{return t.call(e,n)}catch(e){if(12===e.code)throw it();throw e}})},at={numberOfChannels:1},st=-34028234663852886e22,lt=34028234663852886e22,ct=e=>Oe.has(e),ut={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},dt=e=>"playbackRate"in e,ft=e=>"frequency"in e&&"gain"in e,ht=e=>"offset"in e,pt=e=>!("frequency"in e)&&"gain"in e,mt=e=>"detune"in e&&"frequency"in e,gt=e=>"pan"in e,vt=e=>Ke(Re,e),yt=e=>Ke(Ne,e),bt=(e,t)=>{const{activeInputs:n}=vt(e);n.forEach((n=>n.forEach((([n])=>{t.includes(e)||bt(n,[...t,e])}))));const r=dt(e)?[e.playbackRate]:Ze(e)?Array.from(e.parameters.values()):ft(e)?[e.Q,e.detune,e.frequency,e.gain]:ht(e)?[e.offset]:pt(e)?[e.gain]:mt(e)?[e.detune,e.frequency]:gt(e)?[e.pan]:[];for(const e of r){const n=yt(e);void 0!==n&&n.activeInputs.forEach((([e])=>bt(e,t)))}ct(e)&&$e(e)},wt=e=>{bt(e.destination,[])},xt=e=>void 0===e||"number"==typeof e||"string"==typeof e&&("balanced"===e||"interactive"===e||"playback"===e),St=e=>"context"in e,Mt=e=>St(e[0]),_t=(e,t,n,r)=>{for(const t of e)if(n(t)){if(r)return!1;throw Error("The set contains at least one similar element.")}return e.add(t),!0},At=(e,t,[n,r],i)=>{_t(e,[t,n,r],(e=>e[0]===t&&e[1]===n),i)},Et=(e,[t,n,r],i)=>{const o=e.get(t);void 0===o?e.set(t,new Set([[n,r]])):_t(o,[n,r],(e=>e[0]===n),i)},Ct=e=>"inputs"in e,kt=(e,t,n,r)=>{if(Ct(t)){const i=t.inputs[r];return e.connect(i,n,0),[i,n,0]}return e.connect(t,n,r),[t,n,r]},Tt=(e,t,n)=>{for(const r of e)if(r[0]===t&&r[1]===n)return e.delete(r),r;return null},It=(e,t,n)=>Ye(e,(e=>e[0]===t&&e[1]===n)),Ot=(e,t)=>{if(!Qe(e).delete(t))throw new Error("Missing the expected event listener.")},Rt=(e,t,n)=>{const r=Ke(e,t),i=Ye(r,(e=>e[0]===n));return 0===r.size&&e.delete(t),i},Pt=(e,t,n,r)=>{Ct(t)?e.disconnect(t.inputs[r],n,0):e.disconnect(t,n,r)},Nt=e=>Ke(Pe,e),Lt=e=>Ke(Le,e),Dt=e=>je.has(e),Bt=e=>!Oe.has(e),jt=(e,t)=>new Promise((n=>{if(null!==t)n(!0);else{const t=e.createScriptProcessor(256,1,1),r=e.createGain(),i=e.createBuffer(1,2,44100),o=i.getChannelData(0);o[0]=1,o[1]=1;const a=e.createBufferSource();a.buffer=i,a.loop=!0,a.connect(t).connect(e.destination),a.connect(r),a.disconnect(r),t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0);Array.prototype.some.call(i,(e=>1===e))?n(!0):n(!1),a.stop(),t.onaudioprocess=null,a.disconnect(t),t.disconnect(e.destination)},a.start()}})),Ft=(e,t)=>{const n=new Map;for(const t of e)for(const e of t){const t=n.get(e);n.set(e,void 0===t?1:t+1)}n.forEach(((e,n)=>t(n,e)))},Ut=e=>"context"in e,zt=e=>{const t=new Map;var n,r;e.connect=(n=e.connect.bind(e),(e,r=0,i=0)=>{const o=Ut(e)?n(e,r,i):n(e,r),a=t.get(e);return void 0===a?t.set(e,[{input:i,output:r}]):a.every((e=>e.input!==i||e.output!==r))&&a.push({input:i,output:r}),o}),e.disconnect=(r=e.disconnect,(n,i,o)=>{if(r.apply(e),void 0===n)t.clear();else if("number"==typeof n)for(const[e,r]of t){const i=r.filter((e=>e.output!==n));0===i.length?t.delete(e):t.set(e,i)}else if(t.has(n))if(void 0===i)t.delete(n);else{const e=t.get(n);if(void 0!==e){const r=e.filter((e=>e.output!==i&&(e.input!==o||void 0===o)));0===r.length?t.delete(n):t.set(n,r)}}for(const[n,r]of t)r.forEach((t=>{Ut(n)?e.connect(n,t.output,t.input):e.connect(n,t.output)}))})},Ht=(e,t,n,r)=>{const{activeInputs:i,passiveInputs:o}=yt(t),{outputs:a}=vt(e),s=Qe(e),l=a=>{const s=Nt(e),l=Lt(t);if(a){const t=Rt(o,e,n);At(i,e,t,!1),r||Dt(e)||s.connect(l,n)}else{const t=It(i,e,n);Et(o,t,!1),r||Dt(e)||s.disconnect(l,n)}};return!!_t(a,[t,n],(e=>e[0]===t&&e[1]===n),!0)&&(s.add(l),ct(e)?At(i,e,[n,l],!0):Et(o,[e,n,l],!0),!0)},Vt=(e,t,n,r,i)=>{const[o,a]=((e,t,n,r)=>{const{activeInputs:i,passiveInputs:o}=vt(t),a=Tt(i[r],e,n);if(null===a)return[Je(o,e,n,r)[2],!1];return[a[2],!0]})(e,n,r,i);if(null!==o&&(Ot(e,o),!a||t||Dt(e)||Pt(Nt(e),Nt(n),r,i)),ct(n)){const{activeInputs:e}=vt(n);et(n,e)}},Wt=(e,t,n,r)=>{const[i,o]=((e,t,n)=>{const{activeInputs:r,passiveInputs:i}=yt(t),o=Tt(r,e,n);if(null===o)return[Rt(i,e,n)[1],!1];return[o[2],!0]})(e,n,r);null!==i&&(Ot(e,i),!o||t||Dt(e)||Nt(e).disconnect(Lt(n),r))};class Gt{constructor(e){this._map=new Map(e)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(e,t=null){return this._map.forEach(((n,r)=>e.call(t,n,r,this)))}get(e){return this._map.get(e)}has(e){return this._map.has(e)}keys(){return this._map.keys()}values(){return this._map.values()}}const qt={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function Kt(e,t,n,r,i){if("function"==typeof e.copyFromChannel)0===t[n].byteLength&&(t[n]=new Float32Array(128)),e.copyFromChannel(t[n],r,i);else{const o=e.getChannelData(r);if(0===t[n].byteLength)t[n]=o.slice(i,i+128);else{const e=new Float32Array(o.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);t[n].set(e)}}}const Yt=(e,t,n,r,i)=>{"function"==typeof e.copyToChannel?0!==t[n].byteLength&&e.copyToChannel(t[n],r,i):0!==t[n].byteLength&&e.getChannelData(r).set(t[n],i)},Jt=(e,t)=>{const n=[];for(let r=0;r<e;r+=1){const e=[],i="number"==typeof t?t:t[r];for(let t=0;t<i;t+=1)e.push(new Float32Array(128));n.push(e)}return n},Qt=(e,t)=>{const n=Ke(Ue,e),r=Nt(t);return Ke(n,r)},Xt=async(e,t,n,r,i,o,a)=>{const s=null===t?128*Math.ceil(e.context.length/128):t.length,l=r.channelCount*r.numberOfInputs,c=i.reduce(((e,t)=>e+t),0),u=0===c?null:n.createBuffer(c,s,n.sampleRate);if(void 0===o)throw new Error("Missing the processor constructor.");const d=vt(e),f=await Qt(n,e),h=Jt(r.numberOfInputs,r.channelCount),p=Jt(r.numberOfOutputs,i),m=Array.from(e.parameters.keys()).reduce(((e,t)=>({...e,[t]:new Float32Array(128)})),{});for(let c=0;c<s;c+=128){if(r.numberOfInputs>0&&null!==t)for(let e=0;e<r.numberOfInputs;e+=1)for(let n=0;n<r.channelCount;n+=1)Kt(t,h[e],n,n,c);void 0!==o.parameterDescriptors&&null!==t&&o.parameterDescriptors.forEach((({name:e},n)=>{Kt(t,m,e,l+n,c)}));for(let e=0;e<r.numberOfInputs;e+=1)for(let t=0;t<i[e];t+=1)0===p[e][t].byteLength&&(p[e][t]=new Float32Array(128));try{const e=h.map(((e,t)=>0===d.activeInputs[t].size?[]:e)),t=a(c/n.sampleRate,n.sampleRate,(()=>f.process(e,p,m)));if(null!==u)for(let e=0,t=0;e<r.numberOfOutputs;e+=1){for(let n=0;n<i[e];n+=1)Yt(u,p[e],n,t+n,c);t+=i[e]}if(!t)break}catch(t){e.dispatchEvent(new ErrorEvent("processorerror",{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}));break}}return u},Zt={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},$t={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},en={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},tn={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},nn={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},rn=e=>{const{port1:t,port2:n}=new MessageChannel;return new Promise((r=>{const i=()=>{n.onmessage=null,t.close(),n.close(),r()};n.onmessage=()=>i();try{t.postMessage(e,[e])}finally{i()}}))},on={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},an=e=>"delayTime"in e,sn=(e,t,n)=>{const r=t[n];if(void 0===r)throw e();return r},ln={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},cn={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},un=()=>new DOMException("","InvalidStateError"),dn=()=>new DOMException("","InvalidAccessError"),fn=e=>{var t;e.getFrequencyResponse=(t=e.getFrequencyResponse,(n,r,i)=>{if(n.length!==r.length||r.length!==i.length)throw dn();return t.call(e,n,r,i)})},hn={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},pn=(e,t,n,r,i,o,a,s,l,c,u)=>{const d=c.length;let f=s;for(let s=0;s<d;s+=1){let d=n[0]*c[s];for(let t=1;t<i;t+=1){const r=f-t&l-1;d+=n[t]*o[r],d-=e[t]*a[r]}for(let e=i;e<r;e+=1)d+=n[e]*o[f-e&l-1];for(let n=i;n<t;n+=1)d-=e[n]*a[f-n&l-1];o[f]=c[s],a[f]=d,f=f+1&l-1,u[s]=d}return f},mn={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},gn=e=>{const t=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=e.decodeAudioData(t.buffer,(()=>{}));return void 0!==n&&(n.catch((()=>{})),!0)}catch{}return!1},vn={numberOfChannels:1},yn=(e,t,n)=>{const r=t[n];void 0!==r&&r!==e[n]&&(e[n]=r)},bn=(e,t)=>{yn(e,t,"channelCount"),yn(e,t,"channelCountMode"),yn(e,t,"channelInterpretation")},wn=e=>"function"==typeof e.getFloatTimeDomainData,xn=(e,t,n)=>{const r=t[n];void 0!==r&&r!==e[n].value&&(e[n].value=r)},Sn=e=>{e.start=(t=>{let n=!1;return(r=0,i=0,o)=>{if(n)throw un();t.call(e,r,i,o),n=!0}})(e.start)},Mn=e=>{var t;e.start=(t=e.start,(n=0,r=0,i)=>{if("number"==typeof i&&i<0||r<0||n<0)throw new RangeError("The parameters can't be negative.");t.call(e,n,r,i)})},_n=e=>{var t;e.stop=(t=e.stop,(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");t.call(e,n)})},An=e=>{const{port1:t}=new MessageChannel;try{t.postMessage(e)}finally{t.close()}},En=(e,t)=>null===e?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(e*t))))),Cn=e=>new Promise(((t,n)=>{const{port1:r,port2:i}=new MessageChannel;r.onmessage=({data:e})=>{r.close(),i.close(),t(e)},r.onmessageerror=({data:e})=>{r.close(),i.close(),n(e)},i.postMessage(e)})),kn=async(e,t)=>new e(await Cn(t)),Tn=(e,t,n,r)=>{let i=Ue.get(e);void 0===i&&(i=new WeakMap,Ue.set(e,i));const o=kn(n,r);return i.set(t,o),o},In=(e,t)=>{const n=e.createBiquadFilter();return bn(n,t),xn(n,t,"Q"),xn(n,t,"detune"),xn(n,t,"frequency"),xn(n,t,"gain"),yn(n,t,"type"),n},On=e=>{const t=e.numberOfOutputs;Object.defineProperty(e,"channelCount",{get:()=>t,set:e=>{if(e!==t)throw un()}}),Object.defineProperty(e,"channelCountMode",{get:()=>"explicit",set:e=>{if("explicit"!==e)throw un()}}),Object.defineProperty(e,"channelInterpretation",{get:()=>"discrete",set:e=>{if("discrete"!==e)throw un()}})},Rn=(e,t)=>{const n=e.createChannelSplitter(t.numberOfOutputs);return bn(n,t),On(n),n},Pn=(e,t)=>(e.connect=t.connect.bind(t),e.disconnect=t.disconnect.bind(t),e),Nn=(e,t)=>{const n=e.createDelay(t.maxDelayTime);return bn(n,t),xn(n,t,"delayTime"),n},Ln=(e,t)=>{const n=e.createGain();return bn(n,t),xn(n,t,"gain"),n};function Dn(e,t){const n=t[0]*t[0]+t[1]*t[1];return[(e[0]*t[0]+e[1]*t[1])/n,(e[1]*t[0]-e[0]*t[1])/n]}function Bn(e,t){let n=[0,0];for(let o=e.length-1;o>=0;o-=1)i=t,n=[(r=n)[0]*i[0]-r[1]*i[1],r[0]*i[1]+r[1]*i[0]],n[0]+=e[o];var r,i;return n}const jn=(e,t,n,r)=>e.createScriptProcessor(t,n,r),Fn=()=>new DOMException("","NotSupportedError"),Un={numberOfChannels:1},zn={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},Hn={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},Vn={disableNormalization:!1},Wn={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},Gn=()=>new DOMException("","UnknownError"),qn={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},Kn=(e,t,n)=>void 0===e.copyFromChannel?e.getChannelData(n)[0]:(e.copyFromChannel(t,n),t[0]),Yn=e=>{if(null===e)return!1;const t=e.length;return t%2!=0?0!==e[Math.floor(t/2)]:e[t/2-1]+e[t/2]!==0},Jn=(e,t,n,r)=>{let i=e;for(;!i.hasOwnProperty(t);)i=Object.getPrototypeOf(i);const{get:o,set:a}=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,{get:n(o),set:r(a)})},Qn=(e,t,n)=>{try{e.setValueAtTime(t,n)}catch(r){if(9!==r.code)throw r;Qn(e,t,n+1e-7)}},Xn=e=>{const t=e.createOscillator();try{t.start(-1)}catch(e){return e instanceof RangeError}return!1},Zn=e=>{const t=e.createBuffer(1,1,44100),n=e.createBufferSource();n.buffer=t,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},$n=e=>{const t=e.createOscillator();try{t.stop(-1)}catch(e){return e instanceof RangeError}return!1},er=(e,t)=>{const n=t.createGain();e.connect(n);const r=(i=e.disconnect,()=>{i.call(e,n),e.removeEventListener("ended",r)});var i;e.addEventListener("ended",r),Pn(e,n),e.stop=(t=>{let r=!1;return(i=0)=>{if(r)try{t.call(e,i)}catch{n.gain.setValueAtTime(0,i)}else t.call(e,i),r=!0}})(e.stop)},tr=(e,t)=>n=>{const r={value:e};return Object.defineProperties(n,{currentTarget:r,target:r}),"function"==typeof t?t.call(e,n):t.handleEvent.call(e,n)},nr=(rr=_t,(e,t,[n,r,i],o)=>{rr(e[r],[t,n,i],(e=>e[0]===t&&e[1]===n),o)});var rr;const ir=(e=>(t,n,[r,i,o],a)=>{const s=t.get(r);void 0===s?t.set(r,new Set([[i,n,o]])):e(s,[i,n,o],(e=>e[0]===i&&e[1]===n),a)})(_t),or=(ar=Ye,(e,t,n,r)=>ar(e[r],(e=>e[0]===t&&e[1]===n)));var ar;const sr=new WeakMap,lr=(cr=sr,e=>{var t;return null!==(t=cr.get(e))&&void 0!==t?t:0});var cr;const ur=(dr=new Map,fr=new WeakMap,(e,t)=>{const n=fr.get(e);if(void 0!==n)return n;const r=dr.get(e);if(void 0!==r)return r;try{const n=t();return n instanceof Promise?(dr.set(e,n),n.catch((()=>!1)).then((t=>(dr.delete(e),fr.set(e,t),t)))):(fr.set(e,n),n)}catch{return fr.set(e,!1),!1}});var dr,fr;const hr="undefined"==typeof window?null:window,pr=(mr=ur,gr=it,(e,t)=>{const n=e.createAnalyser();if(bn(n,t),!(t.maxDecibels>t.minDecibels))throw gr();return yn(n,t,"fftSize"),yn(n,t,"maxDecibels"),yn(n,t,"minDecibels"),yn(n,t,"smoothingTimeConstant"),mr(wn,(()=>wn(n)))||(e=>{e.getFloatTimeDomainData=t=>{const n=new Uint8Array(t.length);e.getByteTimeDomainData(n);const r=Math.max(n.length,e.fftSize);for(let e=0;e<r;e+=1)t[e]=.0078125*(n[e]-128);return t}})(n),n});var mr,gr;const vr=(yr=vt,e=>{const t=yr(e);if(null===t.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return t.renderer});var yr;const br=((e,t,n)=>async(r,i,o)=>{const a=e(r);await Promise.all(a.activeInputs.map(((e,a)=>Array.from(e).map((async([e,s])=>{const l=t(e),c=await l.render(e,i),u=r.context.destination;n(e)||r===u&&n(r)||c.connect(o,s,a)})))).reduce(((e,t)=>[...e,...t]),[]))})(vt,vr,Dt),wr=(xr=pr,Sr=Nt,Mr=br,()=>{const e=new WeakMap;return{render(t,n){const r=e.get(n);return void 0!==r?Promise.resolve(r):(async(t,n)=>{let r=Sr(t);if(!nt(r,n)){const e={channelCount:r.channelCount,channelCountMode:r.channelCountMode,channelInterpretation:r.channelInterpretation,fftSize:r.fftSize,maxDecibels:r.maxDecibels,minDecibels:r.minDecibels,smoothingTimeConstant:r.smoothingTimeConstant};r=xr(n,e)}return e.set(n,r),await Mr(t,n,r),r})(t,n)}}});var xr,Sr,Mr;const _r=(Ar=De,e=>{const t=Ar.get(e);if(void 0===t)throw un();return t});var Ar;const Er=(e=>null===e?null:e.hasOwnProperty("OfflineAudioContext")?e.OfflineAudioContext:e.hasOwnProperty("webkitOfflineAudioContext")?e.webkitOfflineAudioContext:null)(hr),Cr=(kr=Er,e=>null!==kr&&e instanceof kr);var kr;const Tr=new WeakMap,Ir=(Or=tr,class{constructor(e){this._nativeEventTarget=e,this._listeners=new WeakMap}addEventListener(e,t,n){if(null!==t){let r=this._listeners.get(t);void 0===r&&(r=Or(this,t),"function"==typeof t&&this._listeners.set(t,r)),this._nativeEventTarget.addEventListener(e,r,n)}}dispatchEvent(e){return this._nativeEventTarget.dispatchEvent(e)}removeEventListener(e,t,n){const r=null===t?void 0:this._listeners.get(t);this._nativeEventTarget.removeEventListener(e,void 0===r?null:r,n)}});var Or;const Rr=(e=>null===e?null:e.hasOwnProperty("AudioContext")?e.AudioContext:e.hasOwnProperty("webkitAudioContext")?e.webkitAudioContext:null)(hr),Pr=(Nr=Rr,e=>null!==Nr&&e instanceof Nr);var Nr;const Lr=(e=>t=>null!==e&&"function"==typeof e.AudioNode&&t instanceof e.AudioNode)(hr),Dr=(e=>t=>null!==e&&"function"==typeof e.AudioParam&&t instanceof e.AudioParam)(hr),Br=(e=>null===e?null:e.hasOwnProperty("AudioWorkletNode")?e.AudioWorkletNode:null)(hr),jr=((e,t,n,r,i,o,a,s,l,c,u,d,f,h,p,m)=>class extends c{constructor(t,r,i,o){super(i),this._context=t,this._nativeAudioNode=i;const a=u(t);d(a)&&!0!==n(jt,(()=>jt(a,m)))&&zt(i),Pe.set(this,i),Be.set(this,new Set),"closed"!==t.state&&r&&Xe(this),e(this,o,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(e){this._nativeAudioNode.channelCount=e}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(e){this._nativeAudioNode.channelCountMode=e}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(e){this._nativeAudioNode.channelInterpretation=e}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(e,n=0,s=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();const c=u(this._context),d=p(c);if(f(e)||h(e))throw o();if(St(e)){const i=Nt(e);try{const t=kt(this._nativeAudioNode,i,n,s),r=Bt(this);(d||r)&&this._nativeAudioNode.disconnect(...t),"closed"!==this.context.state&&!r&&Bt(e)&&Xe(e)}catch(e){if(12===e.code)throw o();throw e}if(t(this,e,n,s,d)){const t=l([this],e);Ft(t,r(d))}return e}const m=Lt(e);if("playbackRate"===m.name&&1024===m.maxValue)throw a();try{this._nativeAudioNode.connect(m,n),(d||Bt(this))&&this._nativeAudioNode.disconnect(m,n)}catch(e){if(12===e.code)throw o();throw e}if(Ht(this,e,n,d)){const t=l([this],e);Ft(t,r(d))}}disconnect(e,t,n){let r;const a=u(this._context),c=p(a);if(void 0===e)r=((e,t)=>{const n=vt(e),r=[];for(const i of n.outputs)Mt(i)?Vt(e,t,...i):Wt(e,t,...i),r.push(i[0]);return n.outputs.clear(),r})(this,c);else if("number"==typeof e){if(e<0||e>=this.numberOfOutputs)throw i();r=((e,t,n)=>{const r=vt(e),i=[];for(const o of r.outputs)o[1]===n&&(Mt(o)?Vt(e,t,...o):Wt(e,t,...o),i.push(o[0]),r.outputs.delete(o));return i})(this,c,e)}else{if(void 0!==t&&(t<0||t>=this.numberOfOutputs))throw i();if(St(e)&&void 0!==n&&(n<0||n>=e.numberOfInputs))throw i();if(r=((e,t,n,r,i)=>{const o=vt(e);return Array.from(o.outputs).filter((e=>!(e[0]!==n||void 0!==r&&e[1]!==r||void 0!==i&&e[2]!==i))).map((n=>(Mt(n)?Vt(e,t,...n):Wt(e,t,...n),o.outputs.delete(n),n[0])))})(this,c,e,t,n),0===r.length)throw o()}for(const e of r){const t=l([this],e);Ft(t,s)}}})((Fr=Re,(e,t,n)=>{const r=[];for(let e=0;e<n.numberOfInputs;e+=1)r.push(new Set);Fr.set(e,{activeInputs:r,outputs:new Set,passiveInputs:new WeakMap,renderer:t})}),((e,t,n,r,i,o,a,s,l,c,u,d,f)=>{const h=new WeakMap;return(p,m,g,v,y)=>{const{activeInputs:b,passiveInputs:w}=o(m),{outputs:x}=o(p),S=s(p),M=o=>{const s=l(m),c=l(p);if(o){const t=Je(w,p,g,v);e(b,p,t,!1),y||d(p)||n(c,s,g,v),f(m)&&Xe(m)}else{const e=r(b,p,g,v);t(w,v,e,!1),y||d(p)||i(c,s,g,v);const n=a(m);if(0===n)u(m)&&et(m,b);else{const e=h.get(m);void 0!==e&&clearTimeout(e),h.set(m,setTimeout((()=>{u(m)&&et(m,b)}),1e3*n))}}};return!!c(x,[m,g,v],(e=>e[0]===m&&e[1]===g&&e[2]===v),!0)&&(S.add(M),u(p)?e(b,p,[g,v,M],!0):t(w,v,[p,g,M],!0),!0)}})(nr,ir,kt,or,Pt,vt,lr,Qe,Nt,_t,ct,Dt,Bt),ur,((e,t,n,r,i,o)=>a=>(s,l)=>{const c=e.get(s);if(void 0===c){if(!a&&o(s)){const e=r(s),{outputs:o}=n(s);for(const n of o)if(Mt(n)){const i=r(n[0]);t(e,i,n[1],n[2])}else{const t=i(n[0]);e.disconnect(t,n[1])}}e.set(s,l)}else e.set(s,c+l)})(je,Pt,vt,Nt,Lt,ct),it,dn,Fn,((e,t,n,r,i,o,a,s)=>(l,c)=>{const u=t.get(l);if(void 0===u)throw new Error("Missing the expected cycle count.");const d=o(l.context),f=s(d);if(u===c){if(t.delete(l),!f&&a(l)){const t=r(l),{outputs:o}=n(l);for(const n of o)if(Mt(n)){const i=r(n[0]);e(t,i,n[1],n[2])}else{const e=i(n[0]);t.connect(e,n[1])}}}else t.set(l,u-c)})(kt,je,vt,Nt,Lt,_r,ct,Cr),((e,t,n)=>function r(i,o){const a=St(o)?o:n(e,o);if(an(a))return[];if(i[0]===a)return[i];if(i.includes(a))return[];const{outputs:s}=t(a);return Array.from(s).map((e=>r([...i,a],e[0]))).reduce(((e,t)=>e.concat(t)),[])})(Tr,vt,Ke),Ir,_r,Pr,Lr,Dr,Cr,Br);var Fr;const Ur=((e,t,n,r,i,o)=>class extends e{constructor(e,n){const a=i(e),s={...tt,...n},l=r(a,s);super(e,!1,l,o(a)?t():null),this._nativeAnalyserNode=l}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(e){this._nativeAnalyserNode.fftSize=e}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(e){const t=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=e,!(e>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=t,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(e){const t=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=e,!(this._nativeAnalyserNode.maxDecibels>e))throw this._nativeAnalyserNode.minDecibels=t,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(e){this._nativeAnalyserNode.smoothingTimeConstant=e}getByteFrequencyData(e){this._nativeAnalyserNode.getByteFrequencyData(e)}getByteTimeDomainData(e){this._nativeAnalyserNode.getByteTimeDomainData(e)}getFloatFrequencyData(e){this._nativeAnalyserNode.getFloatFrequencyData(e)}getFloatTimeDomainData(e){this._nativeAnalyserNode.getFloatTimeDomainData(e)}})(jr,wr,it,pr,_r,Cr),zr=new WeakSet,Hr=(e=>null===e?null:e.hasOwnProperty("AudioBuffer")?e.AudioBuffer:null)(hr),Vr=(Wr=new Uint32Array(1),e=>(Wr[0]=e,Wr[0]));var Wr;const Gr=((e,t)=>n=>{n.copyFromChannel=(r,i,o=0)=>{const a=e(o),s=e(i);if(s>=n.numberOfChannels)throw t();const l=n.length,c=n.getChannelData(s),u=r.length;for(let e=a<0?-a:0;e+a<l&&e<u;e+=1)r[e]=c[e+a]},n.copyToChannel=(r,i,o=0)=>{const a=e(o),s=e(i);if(s>=n.numberOfChannels)throw t();const l=n.length,c=n.getChannelData(s),u=r.length;for(let e=a<0?-a:0;e+a<l&&e<u;e+=1)c[e+a]=r[e]}})(Vr,it),qr=(Kr=Vr,e=>{var t,n;e.copyFromChannel=(t=e.copyFromChannel,(n,r,i=0)=>{const o=Kr(i),a=Kr(r);if(o<e.length)return t.call(e,n,a,o)}),e.copyToChannel=(n=e.copyToChannel,(t,r,i=0)=>{const o=Kr(i),a=Kr(r);if(o<e.length)return n.call(e,t,a,o)})});var Kr;const Yr=((e,t,n,r,i,o,a,s)=>{let l=null;return class c{constructor(c){if(null===i)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:u,numberOfChannels:d,sampleRate:f}={...at,...c};null===l&&(l=new i(1,1,44100));const h=null!==r&&t(o,o)?new r({length:u,numberOfChannels:d,sampleRate:f}):l.createBuffer(d,u,f);if(0===h.numberOfChannels)throw n();return"function"!=typeof h.copyFromChannel?(a(h),ot(h)):t(rt,(()=>rt(h)))||s(h),e.add(h),h}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===c.prototype||e.has(t)}}})(zr,ur,Fn,Hr,Er,(Jr=Hr,()=>{if(null===Jr)return!1;try{new Jr({length:1,sampleRate:44100})}catch{return!1}return!0}),Gr,qr);var Jr;const Qr=(Xr=Ln,(e,t)=>{const n=Xr(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});t.connect(n).connect(e.destination);const r=()=>{t.removeEventListener("ended",r),t.disconnect(n),n.disconnect()};t.addEventListener("ended",r)});var Xr;const Zr=($r=vr,ei=yt,ti=Dt,async(e,t,n)=>{const r=ei(e);await Promise.all(Array.from(r.activeInputs).map((async([e,r])=>{const i=$r(e),o=await i.render(e,t);ti(e)||o.connect(n,r)})))});var $r,ei,ti;const ni=(ri=Zr,(e,t,n)=>ri(t,e,n));var ri;const ii=((e,t,n,r,i,o,a,s,l,c,u)=>(d,f)=>{const h=d.createBufferSource();return bn(h,f),xn(h,f,"playbackRate"),yn(h,f,"buffer"),yn(h,f,"loop"),yn(h,f,"loopEnd"),yn(h,f,"loopStart"),t(n,(()=>n(d)))||Sn(h),t(r,(()=>r(d)))||l(h),t(i,(()=>i(d)))||c(h,d),t(o,(()=>o(d)))||Mn(h),t(a,(()=>a(d)))||u(h,d),t(s,(()=>s(d)))||_n(h),e(d,h),h})(Qr,ur,(e=>{const t=e.createBufferSource();t.start();try{t.start()}catch{return!0}return!1}),(e=>{const t=e.createBufferSource(),n=e.createBuffer(1,1,44100);t.buffer=n;try{t.start(0,1)}catch{return!1}return!0}),(e=>{const t=e.createBufferSource();t.start();try{t.stop()}catch{return!1}return!0}),Xn,Zn,$n,(e=>{var t;e.start=(t=e.start,(n=0,r=0,i)=>{const o=e.buffer,a=null===o?r:Math.min(o.duration,r);null!==o&&a>o.duration-.5/e.context.sampleRate?t.call(e,n,0,0):t.call(e,n,a,i)})}),(oi=Jn,(e,t)=>{const n=t.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=n),oi(e,"buffer",(t=>()=>{const r=t.call(e);return r===n?null:r}),(t=>r=>t.call(e,null===r?n:r)))}),er);var oi;const ai=((e,t)=>(n,r,i)=>(e(r).replay(i),t(r,n,i)))((e=>t=>{const n=e(t);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer})(yt),Zr),si=((e,t,n,r,i)=>()=>{const o=new WeakMap;let a=null,s=null;return{set start(e){a=e},set stop(e){s=e},render(l,c){const u=o.get(c);return void 0!==u?Promise.resolve(u):(async(l,c)=>{let u=n(l);const d=nt(u,c);if(!d){const e={buffer:u.buffer,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,loop:u.loop,loopEnd:u.loopEnd,loopStart:u.loopStart,playbackRate:u.playbackRate.value};u=t(c,e),null!==a&&u.start(...a),null!==s&&u.stop(s)}return o.set(c,u),d?await e(c,l.playbackRate,u.playbackRate):await r(c,l.playbackRate,u.playbackRate),await i(l,c,u),u})(l,c)}}})(ni,ii,Nt,ai,br),li=((e,t,n,r,i,o,a,s,l,c,u,d,f)=>(h,p,m,g=null,v=null)=>{const y=new(0,Ie.AutomationEventList)(m.defaultValue),b=p?r(y):null,w={get defaultValue(){return m.defaultValue},get maxValue(){return null===g?m.maxValue:g},get minValue(){return null===v?m.minValue:v},get value(){return m.value},set value(e){m.value=e,w.setValueAtTime(e,h.context.currentTime)},cancelAndHoldAtTime(e){if("function"==typeof m.cancelAndHoldAtTime)null===b&&y.flush(h.context.currentTime),y.add(i(e)),m.cancelAndHoldAtTime(e);else{const t=Array.from(y).pop();null===b&&y.flush(h.context.currentTime),y.add(i(e));const n=Array.from(y).pop();m.cancelScheduledValues(e),t!==n&&void 0!==n&&("exponentialRampToValue"===n.type?m.exponentialRampToValueAtTime(n.value,n.endTime):"linearRampToValue"===n.type?m.linearRampToValueAtTime(n.value,n.endTime):"setValue"===n.type?m.setValueAtTime(n.value,n.startTime):"setValueCurve"===n.type&&m.setValueCurveAtTime(n.values,n.startTime,n.duration))}return w},cancelScheduledValues:e=>(null===b&&y.flush(h.context.currentTime),y.add(o(e)),m.cancelScheduledValues(e),w),exponentialRampToValueAtTime(e,t){if(0===e)throw new RangeError;if(!Number.isFinite(t)||t<0)throw new RangeError;return null===b&&y.flush(h.context.currentTime),y.add(a(e,t)),m.exponentialRampToValueAtTime(e,t),w},linearRampToValueAtTime:(e,t)=>(null===b&&y.flush(h.context.currentTime),y.add(s(e,t)),m.linearRampToValueAtTime(e,t),w),setTargetAtTime:(e,t,n)=>(null===b&&y.flush(h.context.currentTime),y.add(l(e,t,n)),m.setTargetAtTime(e,t,n),w),setValueAtTime:(e,t)=>(null===b&&y.flush(h.context.currentTime),y.add(c(e,t)),m.setValueAtTime(e,t),w),setValueCurveAtTime(e,t,n){const r=e instanceof Float32Array?e:new Float32Array(e);if(null!==d&&"webkitAudioContext"===d.name){const e=t+n,i=h.context.sampleRate,o=Math.ceil(t*i),a=Math.floor(e*i),s=a-o,l=new Float32Array(s);for(let e=0;e<s;e+=1){const a=(r.length-1)/n*((o+e)/i-t),s=Math.floor(a),c=Math.ceil(a);l[e]=s===c?r[s]:(1-(a-s))*r[s]+(1-(c-a))*r[c]}null===b&&y.flush(h.context.currentTime),y.add(u(l,t,n)),m.setValueCurveAtTime(l,t,n);const c=a/i;c<e&&f(w,l[l.length-1],c),f(w,r[r.length-1],e)}else null===b&&y.flush(h.context.currentTime),y.add(u(r,t,n)),m.setValueCurveAtTime(r,t,n);return w}};return n.set(w,m),t.set(w,h),e(w,b),w})((ci=Ne,(e,t)=>{ci.set(e,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:t})}),Tr,Le,(e=>({replay(t){for(const n of e)if("exponentialRampToValue"===n.type){const{endTime:e,value:r}=n;t.exponentialRampToValueAtTime(r,e)}else if("linearRampToValue"===n.type){const{endTime:e,value:r}=n;t.linearRampToValueAtTime(r,e)}else if("setTarget"===n.type){const{startTime:e,target:r,timeConstant:i}=n;t.setTargetAtTime(r,e,i)}else if("setValue"===n.type){const{startTime:e,value:r}=n;t.setValueAtTime(r,e)}else{if("setValueCurve"!==n.type)throw new Error("Can't apply an unknown automation.");{const{duration:e,startTime:r,values:i}=n;t.setValueCurveAtTime(i,r,e)}}}})),Ie.createCancelAndHoldAutomationEvent,Ie.createCancelScheduledValuesAutomationEvent,Ie.createExponentialRampToValueAutomationEvent,Ie.createLinearRampToValueAutomationEvent,Ie.createSetTargetAutomationEvent,Ie.createSetValueAutomationEvent,Ie.createSetValueCurveAutomationEvent,Rr,Qn);var ci;const ui=((e,t,n,r,i,o,a,s)=>class extends e{constructor(e,r){const s=o(e),l={...ut,...r},c=i(s,l),u=a(s),d=u?t():null;super(e,!1,c,d),this._audioBufferSourceNodeRenderer=d,this._isBufferNullified=!1,this._isBufferSet=null!==l.buffer,this._nativeAudioBufferSourceNode=c,this._onended=null,this._playbackRate=n(this,u,c.playbackRate,lt,st)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(e){if(this._nativeAudioBufferSourceNode.buffer=e,null!==e){if(this._isBufferSet)throw r();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(e){this._nativeAudioBufferSourceNode.loop=e}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(e){this._nativeAudioBufferSourceNode.loopEnd=e}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(e){this._nativeAudioBufferSourceNode.loopStart=e}get onended(){return this._onended}set onended(e){const t="function"==typeof e?s(this,e):null;this._nativeAudioBufferSourceNode.onended=t;const n=this._nativeAudioBufferSourceNode.onended;this._onended=null!==n&&n===t?e:n}get playbackRate(){return this._playbackRate}start(e=0,t=0,n){if(this._nativeAudioBufferSourceNode.start(e,t,n),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===n?[e,t]:[e,t,n]),"closed"!==this.context.state){Xe(this);const e=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",e),ct(this)&&$e(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",e)}}stop(e=0){this._nativeAudioBufferSourceNode.stop(e),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=e)}})(jr,si,li,un,ii,_r,Cr,tr),di=((e,t,n,r,i,o,a,s)=>class extends e{constructor(e,n){const r=o(e),l=a(r),c=i(r,n,l);super(e,!1,c,l?t(s):null),this._isNodeOfNativeOfflineAudioContext=l,this._nativeAudioDestinationNode=c}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(e>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=e}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=e}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}})(jr,(e=>{const t=new WeakMap;return{render(n,r){const i=t.get(r);return void 0!==i?Promise.resolve(i):(async(n,r)=>{const i=r.destination;return t.set(r,i),await e(n,r,i),i})(n,r)}}}),it,un,((e,t)=>(n,r,i)=>{const o=n.destination;if(o.channelCount!==r)try{o.channelCount=r}catch{}i&&"explicit"!==o.channelCountMode&&(o.channelCountMode="explicit"),0===o.maxChannelCount&&Object.defineProperty(o,"maxChannelCount",{value:r});const a=e(n,{channelCount:r,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,gain:1});return t(a,"channelCount",(e=>()=>e.call(a)),(e=>t=>{e.call(a,t);try{o.channelCount=t}catch(e){if(t>o.maxChannelCount)throw e}})),t(a,"channelCountMode",(e=>()=>e.call(a)),(e=>t=>{e.call(a,t),o.channelCountMode=t})),t(a,"channelInterpretation",(e=>()=>e.call(a)),(e=>t=>{e.call(a,t),o.channelInterpretation=t})),Object.defineProperty(a,"maxChannelCount",{get:()=>o.maxChannelCount}),a.connect(o),a})(Ln,Jn),_r,Cr,br),fi=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=nt(l,s);if(!c){const e={Q:l.Q.value,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,detune:l.detune.value,frequency:l.frequency.value,gain:l.gain.value,type:l.type};l=t(s,e)}return o.set(s,l),c?(await e(s,a.Q,l.Q),await e(s,a.detune,l.detune),await e(s,a.frequency,l.frequency),await e(s,a.gain,l.gain)):(await r(s,a.Q,l.Q),await r(s,a.detune,l.detune),await r(s,a.frequency,l.frequency),await r(s,a.gain,l.gain)),await i(a,s,l),l})(a,s)}}})(ni,In,Nt,ai,br),hi=(e=>(t,n)=>e.set(t,n))(sr),pi=(mi=jr,gi=li,vi=fi,yi=dn,bi=In,wi=_r,xi=Cr,Si=hi,class extends mi{constructor(e,t){const n=wi(e),r={...Zt,...t},i=bi(n,r),o=xi(n);super(e,!1,i,o?vi():null),this._Q=gi(this,o,i.Q,lt,st),this._detune=gi(this,o,i.detune,1200*Math.log2(lt),-1200*Math.log2(lt)),this._frequency=gi(this,o,i.frequency,e.sampleRate/2,0),this._gain=gi(this,o,i.gain,40*Math.log10(lt),st),this._nativeBiquadFilterNode=i,Si(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(e){this._nativeBiquadFilterNode.type=e}getFrequencyResponse(e,t,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(e,t,n)}catch(e){if(11===e.code)throw yi();throw e}if(e.length!==t.length||t.length!==n.length)throw yi()}});var mi,gi,vi,yi,bi,wi,xi,Si;const Mi=((e,t)=>(n,r,i)=>{const o=new Set;var a,s;return n.connect=(a=n.connect,(i,s=0,l=0)=>{const c=0===o.size;if(t(i))return a.call(n,i,s,l),e(o,[i,s,l],(e=>e[0]===i&&e[1]===s&&e[2]===l),!0),c&&r(),i;a.call(n,i,s),e(o,[i,s],(e=>e[0]===i&&e[1]===s),!0),c&&r()}),n.disconnect=(s=n.disconnect,(e,r,a)=>{const l=o.size>0;if(void 0===e)s.apply(n),o.clear();else if("number"==typeof e){s.call(n,e);for(const t of o)t[1]===e&&o.delete(t)}else{t(e)?s.call(n,e,r,a):s.call(n,e,r);for(const t of o)t[0]!==e||void 0!==r&&t[1]!==r||void 0!==a&&t[2]!==a||o.delete(t)}const c=0===o.size;l&&c&&i()}),n})(_t,Lr),_i=(Ai=un,Ei=Mi,(e,t)=>{t.channelCount=1,t.channelCountMode="explicit",Object.defineProperty(t,"channelCount",{get:()=>1,set:()=>{throw Ai()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:()=>{throw Ai()}});const n=e.createBufferSource();Ei(t,(()=>{const e=t.numberOfInputs;for(let r=0;r<e;r+=1)n.connect(t,0,r)}),(()=>n.disconnect(t)))});var Ai,Ei;const Ci=((e,t)=>(n,r)=>{const i=n.createChannelMerger(r.numberOfInputs);return null!==e&&"webkitAudioContext"===e.name&&t(n,i),bn(i,r),i})(Rr,_i),ki=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!nt(a,o)){const t={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfInputs:a.numberOfInputs};a=e(o,t)}return r.set(o,a),await n(i,o,a),a})(i,o)}}})(Ci,Nt,br),Ti=((e,t,n,r,i)=>class extends e{constructor(e,o){const a=r(e),s={...$t,...o};super(e,!1,n(a,s),i(a)?t():null)}})(jr,ki,Ci,_r,Cr),Ii=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!nt(a,o)){const t={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfOutputs:a.numberOfOutputs};a=e(o,t)}return r.set(o,a),await n(i,o,a),a})(i,o)}}})(Rn,Nt,br),Oi=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=r(e),l=o({...en,...a});super(e,!1,n(s,l),i(s)?t():null)}})(jr,Ii,Rn,_r,Cr,(e=>({...e,channelCount:e.numberOfOutputs}))),Ri=((e,t,n,r)=>(i,{offset:o,...a})=>{const s=i.createBuffer(1,2,44100),l=t(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),c=n(i,{...a,gain:o}),u=s.getChannelData(0);u[0]=1,u[1]=1,l.buffer=s,l.loop=!0;const d={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(e){c.channelCount=e},get channelCountMode(){return c.channelCountMode},set channelCountMode(e){c.channelCountMode=e},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(e){c.channelInterpretation=e},get context(){return c.context},get inputs(){return[]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get offset(){return c.gain},get onended(){return l.onended},set onended(e){l.onended=e},addEventListener:(...e)=>l.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>l.dispatchEvent(e[0]),removeEventListener:(...e)=>l.removeEventListener(e[0],e[1],e[2]),start(e=0){l.start.call(l,e)},stop(e=0){l.stop.call(l,e)}};return e(i,l),r(Pn(d,c),(()=>l.connect(c)),(()=>l.disconnect(c)))})(Qr,ii,Ln,Mi),Pi=((e,t,n,r,i)=>(o,a)=>{if(void 0===o.createConstantSource)return n(o,a);const s=o.createConstantSource();return bn(s,a),xn(s,a,"offset"),t(r,(()=>r(o)))||Mn(s),t(i,(()=>i(o)))||_n(s),e(o,s),s})(Qr,ur,Ri,Xn,$n),Ni=((e,t,n,r,i)=>()=>{const o=new WeakMap;let a=null,s=null;return{set start(e){a=e},set stop(e){s=e},render(l,c){const u=o.get(c);return void 0!==u?Promise.resolve(u):(async(l,c)=>{let u=n(l);const d=nt(u,c);if(!d){const e={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,offset:u.offset.value};u=t(c,e),null!==a&&u.start(a),null!==s&&u.stop(s)}return o.set(c,u),d?await e(c,l.offset,u.offset):await r(c,l.offset,u.offset),await i(l,c,u),u})(l,c)}}})(ni,Pi,Nt,ai,br),Li=((e,t,n,r,i,o,a)=>class extends e{constructor(e,a){const s=i(e),l={...tn,...a},c=r(s,l),u=o(s),d=u?n():null;super(e,!1,c,d),this._constantSourceNodeRenderer=d,this._nativeConstantSourceNode=c,this._offset=t(this,u,c.offset,lt,st),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(e){const t="function"==typeof e?a(this,e):null;this._nativeConstantSourceNode.onended=t;const n=this._nativeConstantSourceNode.onended;this._onended=null!==n&&n===t?e:n}start(e=0){if(this._nativeConstantSourceNode.start(e),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=e),"closed"!==this.context.state){Xe(this);const e=()=>{this._nativeConstantSourceNode.removeEventListener("ended",e),ct(this)&&$e(this)};this._nativeConstantSourceNode.addEventListener("ended",e)}}stop(e=0){this._nativeConstantSourceNode.stop(e),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=e)}})(jr,li,Ni,Pi,_r,Cr,tr),Di=((e,t)=>(n,r)=>{const i=n.createConvolver();if(bn(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),yn(i,r,"buffer"),r.channelCount>2)throw e();if(t(i,"channelCount",(e=>()=>e.call(i)),(t=>n=>{if(n>2)throw e();return t.call(i,n)})),"max"===r.channelCountMode)throw e();return t(i,"channelCountMode",(e=>()=>e.call(i)),(t=>n=>{if("max"===n)throw e();return t.call(i,n)})),i})(Fn,Jn),Bi=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!nt(a,o)){const t={buffer:a.buffer,channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,disableNormalization:!a.normalize};a=e(o,t)}return r.set(o,a),Ct(a)?await n(i,o,a.inputs[0]):await n(i,o,a),a})(i,o)}}})(Di,Nt,br),ji=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=r(e),l={...nn,...a},c=n(s,l);super(e,!1,c,i(s)?t():null),this._isBufferNullified=!1,this._nativeConvolverNode=c,null!==l.buffer&&o(this,l.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(e){if(this._nativeConvolverNode.buffer=e,null===e&&null!==this._nativeConvolverNode.buffer){const e=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=e.createBuffer(1,1,e.sampleRate),this._isBufferNullified=!0,o(this,0)}else this._isBufferNullified=!1,o(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(e){this._nativeConvolverNode.normalize=e}})(jr,Bi,Di,_r,Cr,hi),Fi=((e,t,n,r,i)=>o=>{const a=new WeakMap;return{render(s,l){const c=a.get(l);return void 0!==c?Promise.resolve(c):(async(s,l)=>{let c=n(s);const u=nt(c,l);if(!u){const e={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,delayTime:c.delayTime.value,maxDelayTime:o};c=t(l,e)}return a.set(l,c),u?await e(l,s.delayTime,c.delayTime):await r(l,s.delayTime,c.delayTime),await i(s,l,c),c})(s,l)}}})(ni,Nn,Nt,ai,br),Ui=((e,t,n,r,i,o,a)=>class extends e{constructor(e,s){const l=i(e),c={...on,...s},u=r(l,c),d=o(l);super(e,!1,u,d?n(c.maxDelayTime):null),this._delayTime=t(this,d,u.delayTime),a(this,c.maxDelayTime)}get delayTime(){return this._delayTime}})(jr,li,Fi,Nn,_r,Cr,hi),zi=(Hi=Fn,(e,t)=>{const n=e.createDynamicsCompressor();if(bn(n,t),t.channelCount>2)throw Hi();if("max"===t.channelCountMode)throw Hi();return xn(n,t,"attack"),xn(n,t,"knee"),xn(n,t,"ratio"),xn(n,t,"release"),xn(n,t,"threshold"),n});var Hi;const Vi=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=nt(l,s);if(!c){const e={attack:l.attack.value,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,knee:l.knee.value,ratio:l.ratio.value,release:l.release.value,threshold:l.threshold.value};l=t(s,e)}return o.set(s,l),c?(await e(s,a.attack,l.attack),await e(s,a.knee,l.knee),await e(s,a.ratio,l.ratio),await e(s,a.release,l.release),await e(s,a.threshold,l.threshold)):(await r(s,a.attack,l.attack),await r(s,a.knee,l.knee),await r(s,a.ratio,l.ratio),await r(s,a.release,l.release),await r(s,a.threshold,l.threshold)),await i(a,s,l),l})(a,s)}}})(ni,zi,Nt,ai,br),Wi=((e,t,n,r,i,o,a,s)=>class extends e{constructor(e,i){const l=o(e),c={...ln,...i},u=r(l,c),d=a(l);super(e,!1,u,d?n():null),this._attack=t(this,d,u.attack),this._knee=t(this,d,u.knee),this._nativeDynamicsCompressorNode=u,this._ratio=t(this,d,u.ratio),this._release=t(this,d,u.release),this._threshold=t(this,d,u.threshold),s(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(e){const t=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=e,e>2)throw this._nativeDynamicsCompressorNode.channelCount=t,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(e){const t=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=e,"max"===e)throw this._nativeDynamicsCompressorNode.channelCountMode=t,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return"number"==typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}})(jr,li,Vi,zi,Fn,_r,Cr,hi),Gi=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=nt(l,s);if(!c){const e={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,gain:l.gain.value};l=t(s,e)}return o.set(s,l),c?await e(s,a.gain,l.gain):await r(s,a.gain,l.gain),await i(a,s,l),l})(a,s)}}})(ni,Ln,Nt,ai,br),qi=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=i(e),l={...cn,...a},c=r(s,l),u=o(s);super(e,!1,c,u?n():null),this._gain=t(this,u,c.gain,lt,st)}get gain(){return this._gain}})(jr,li,Gi,Ln,_r,Cr),Ki=((e,t,n,r)=>(i,o,{channelCount:a,channelCountMode:s,channelInterpretation:l,feedback:c,feedforward:u})=>{const d=En(o,i.sampleRate),f=c instanceof Float64Array?c:new Float64Array(c),h=u instanceof Float64Array?u:new Float64Array(u),p=f.length,m=h.length,g=Math.min(p,m);if(0===p||p>20)throw r();if(0===f[0])throw t();if(0===m||m>20)throw r();if(0===h[0])throw t();if(1!==f[0]){for(let e=0;e<m;e+=1)h[e]/=f[0];for(let e=1;e<p;e+=1)f[e]/=f[0]}const v=n(i,d,a,a);v.channelCount=a,v.channelCountMode=s,v.channelInterpretation=l;const y=[],b=[],w=[];for(let e=0;e<a;e+=1){y.push(0);const e=new Float32Array(32),t=new Float32Array(32);e.fill(0),t.fill(0),b.push(e),w.push(t)}v.onaudioprocess=e=>{const t=e.inputBuffer,n=e.outputBuffer,r=t.numberOfChannels;for(let e=0;e<r;e+=1){const r=t.getChannelData(e),i=n.getChannelData(e);y[e]=pn(f,p,h,m,g,b[e],w[e],y[e],32,r,i)}};const x=i.sampleRate/2;return Pn({get bufferSize(){return d},get channelCount(){return v.channelCount},set channelCount(e){v.channelCount=e},get channelCountMode(){return v.channelCountMode},set channelCountMode(e){v.channelCountMode=e},get channelInterpretation(){return v.channelInterpretation},set channelInterpretation(e){v.channelInterpretation=e},get context(){return v.context},get inputs(){return[v]},get numberOfInputs(){return v.numberOfInputs},get numberOfOutputs(){return v.numberOfOutputs},addEventListener:(...e)=>v.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>v.dispatchEvent(e[0]),getFrequencyResponse(t,n,r){if(t.length!==n.length||n.length!==r.length)throw e();const i=t.length;for(let e=0;e<i;e+=1){const i=-Math.PI*(t[e]/x),o=[Math.cos(i),Math.sin(i)],a=Dn(Bn(h,o),Bn(f,o));n[e]=Math.sqrt(a[0]*a[0]+a[1]*a[1]),r[e]=Math.atan2(a[1],a[0])}},removeEventListener:(...e)=>v.removeEventListener(e[0],e[1],e[2])},v)})(dn,un,jn,Fn),Yi=((e,t,n,r)=>i=>e(gn,(()=>gn(i)))?Promise.resolve(e(r,r)).then((e=>{if(!e){const e=n(i,512,0,1);i.oncomplete=()=>{e.onaudioprocess=null,e.disconnect()},e.onaudioprocess=()=>i.currentTime,e.connect(i.destination)}return i.startRendering()})):new Promise((e=>{const n=t(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});i.oncomplete=t=>{n.disconnect(),e(t.renderedBuffer)},n.connect(i.destination),i.startRendering()})))(ur,Ln,jn,((e,t)=>()=>{if(null===t)return Promise.resolve(!1);const n=new t(1,1,44100),r=e(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise((e=>{n.oncomplete=()=>{r.disconnect(),e(0!==n.currentTime)},n.startRendering()}))})(Ln,Er)),Ji=((e,t,n,r,i)=>(o,a)=>{const s=new WeakMap;let l=null;const c=async(c,u)=>{let d=null,f=t(c);const h=nt(f,u);if(void 0===u.createIIRFilter?d=e(u,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):h||(f=u.createIIRFilter(a,o)),s.set(u,null===d?f:d),null!==d){if(null===l){if(null===n)throw new Error("Missing the native OfflineAudioContext constructor.");const e=new n(c.context.destination.channelCount,c.context.length,u.sampleRate);l=(async()=>{await r(c,e,e.destination);return((e,t,n,r)=>{const i=n instanceof Float64Array?n:new Float64Array(n),o=r instanceof Float64Array?r:new Float64Array(r),a=i.length,s=o.length,l=Math.min(a,s);if(1!==i[0]){for(let e=0;e<a;e+=1)o[e]/=i[0];for(let e=1;e<s;e+=1)i[e]/=i[0]}const c=new Float32Array(32),u=new Float32Array(32),d=t.createBuffer(e.numberOfChannels,e.length,e.sampleRate),f=e.numberOfChannels;for(let t=0;t<f;t+=1){const n=e.getChannelData(t),r=d.getChannelData(t);c.fill(0),u.fill(0),pn(i,a,o,s,l,c,u,0,32,n,r)}return d})(await i(e),u,o,a)})()}const e=await l;return d.buffer=e,d.start(0),d}return await r(c,u,f),f};return{render(e,t){const n=s.get(t);return void 0!==n?Promise.resolve(n):c(e,t)}}})(ii,Nt,Er,br,Yi),Qi=(Xi=Ki,(e,t,n)=>{if(void 0===e.createIIRFilter)return Xi(e,t,n);const r=e.createIIRFilter(n.feedforward,n.feedback);return bn(r,n),r});var Xi;const Zi=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=r(e),l=i(s),c={...hn,...a},u=t(s,l?null:e.baseLatency,c);super(e,!1,u,l?n(c.feedback,c.feedforward):null),fn(u),this._nativeIIRFilterNode=u,o(this,1)}getFrequencyResponse(e,t,n){return this._nativeIIRFilterNode.getFrequencyResponse(e,t,n)}})(jr,Qi,Ji,_r,Cr,hi),$i=((e,t,n,r,i,o,a,s)=>(l,c)=>{const u=c.listener,{forwardX:d,forwardY:f,forwardZ:h,positionX:p,positionY:m,positionZ:g,upX:v,upY:y,upZ:b}=void 0===u.forwardX?(()=>{const d=new Float32Array(1),f=t(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),h=a(c);let p=!1,m=[0,0,-1,0,1,0],g=[0,0,0];const v=()=>{if(p)return;p=!0;const e=r(c,256,9,0);e.onaudioprocess=({inputBuffer:e})=>{const t=[o(e,d,0),o(e,d,1),o(e,d,2),o(e,d,3),o(e,d,4),o(e,d,5)];t.some(((e,t)=>e!==m[t]))&&(u.setOrientation(...t),m=t);const n=[o(e,d,6),o(e,d,7),o(e,d,8)];n.some(((e,t)=>e!==g[t]))&&(u.setPosition(...n),g=n)},f.connect(e)},y=e=>t=>{t!==m[e]&&(m[e]=t,u.setOrientation(...m))},b=e=>t=>{t!==g[e]&&(g[e]=t,u.setPosition(...g))},w=(t,r,o)=>{const a=n(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:r});a.connect(f,0,t),a.start(),Object.defineProperty(a.offset,"defaultValue",{get:()=>r});const u=e({context:l},h,a.offset,lt,st);var d,p,m,g,y,b,w;return s(u,"value",(e=>()=>e.call(u)),(e=>t=>{try{e.call(u,t)}catch(e){if(9!==e.code)throw e}v(),h&&o(t)})),u.cancelAndHoldAtTime=(d=u.cancelAndHoldAtTime,h?()=>{throw i()}:(...e)=>{const t=d.apply(u,e);return v(),t}),u.cancelScheduledValues=(p=u.cancelScheduledValues,h?()=>{throw i()}:(...e)=>{const t=p.apply(u,e);return v(),t}),u.exponentialRampToValueAtTime=(m=u.exponentialRampToValueAtTime,h?()=>{throw i()}:(...e)=>{const t=m.apply(u,e);return v(),t}),u.linearRampToValueAtTime=(g=u.linearRampToValueAtTime,h?()=>{throw i()}:(...e)=>{const t=g.apply(u,e);return v(),t}),u.setTargetAtTime=(y=u.setTargetAtTime,h?()=>{throw i()}:(...e)=>{const t=y.apply(u,e);return v(),t}),u.setValueAtTime=(b=u.setValueAtTime,h?()=>{throw i()}:(...e)=>{const t=b.apply(u,e);return v(),t}),u.setValueCurveAtTime=(w=u.setValueCurveAtTime,h?()=>{throw i()}:(...e)=>{const t=w.apply(u,e);return v(),t}),u};return{forwardX:w(0,0,y(0)),forwardY:w(1,0,y(1)),forwardZ:w(2,-1,y(2)),positionX:w(6,0,b(0)),positionY:w(7,0,b(1)),positionZ:w(8,0,b(2)),upX:w(3,0,y(3)),upY:w(4,1,y(4)),upZ:w(5,0,y(5))}})():u;return{get forwardX(){return d},get forwardY(){return f},get forwardZ(){return h},get positionX(){return p},get positionY(){return m},get positionZ(){return g},get upX(){return v},get upY(){return y},get upZ(){return b}}})(li,Ci,Pi,jn,Fn,Kn,Cr,Jn),eo=new WeakMap,to=((e,t,n,r,i,o)=>class extends n{constructor(n,o){super(n),this._nativeContext=n,De.set(this,n),r(n)&&i.set(n,new Set),this._destination=new e(this,o),this._listener=t(this,n),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(e){const t="function"==typeof e?o(this,e):null;this._nativeContext.onstatechange=t;const n=this._nativeContext.onstatechange;this._onstatechange=null!==n&&n===t?e:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}})(di,$i,Ir,Cr,eo,tr),no=((e,t,n,r,i,o)=>(a,s)=>{const l=a.createOscillator();return bn(l,s),xn(l,s,"detune"),xn(l,s,"frequency"),void 0!==s.periodicWave?l.setPeriodicWave(s.periodicWave):yn(l,s,"type"),t(n,(()=>n(a)))||Mn(l),t(r,(()=>r(a)))||o(l,a),t(i,(()=>i(a)))||_n(l),e(a,l),l})(Qr,ur,Xn,Zn,$n,er),ro=((e,t,n,r,i)=>()=>{const o=new WeakMap;let a=null,s=null,l=null;return{set periodicWave(e){a=e},set start(e){s=e},set stop(e){l=e},render(c,u){const d=o.get(u);return void 0!==d?Promise.resolve(d):(async(c,u)=>{let d=n(c);const f=nt(d,u);if(!f){const e={channelCount:d.channelCount,channelCountMode:d.channelCountMode,channelInterpretation:d.channelInterpretation,detune:d.detune.value,frequency:d.frequency.value,periodicWave:null===a?void 0:a,type:d.type};d=t(u,e),null!==s&&d.start(s),null!==l&&d.stop(l)}return o.set(u,d),f?(await e(u,c.detune,d.detune),await e(u,c.frequency,d.frequency)):(await r(u,c.detune,d.detune),await r(u,c.frequency,d.frequency)),await i(c,u,d),d})(c,u)}}})(ni,no,Nt,ai,br),io=((e,t,n,r,i,o,a)=>class extends e{constructor(e,a){const s=i(e),l={...zn,...a},c=n(s,l),u=o(s),d=u?r():null,f=e.sampleRate/2;super(e,!1,c,d),this._detune=t(this,u,c.detune,153600,-153600),this._frequency=t(this,u,c.frequency,f,-f),this._nativeOscillatorNode=c,this._onended=null,this._oscillatorNodeRenderer=d,null!==this._oscillatorNodeRenderer&&void 0!==l.periodicWave&&(this._oscillatorNodeRenderer.periodicWave=l.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(e){const t="function"==typeof e?a(this,e):null;this._nativeOscillatorNode.onended=t;const n=this._nativeOscillatorNode.onended;this._onended=null!==n&&n===t?e:n}get type(){return this._nativeOscillatorNode.type}set type(e){this._nativeOscillatorNode.type=e,null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(e){this._nativeOscillatorNode.setPeriodicWave(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=e)}start(e=0){if(this._nativeOscillatorNode.start(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=e),"closed"!==this.context.state){Xe(this);const e=()=>{this._nativeOscillatorNode.removeEventListener("ended",e),ct(this)&&$e(this)};this._nativeOscillatorNode.addEventListener("ended",e)}}stop(e=0){this._nativeOscillatorNode.stop(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=e)}})(jr,li,no,ro,_r,Cr,tr),oo=(ao=ii,(e,t)=>{const n=ao(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),r=e.createBuffer(1,2,44100);return n.buffer=r,n.loop=!0,n.connect(t),n.start(),()=>{n.stop(),n.disconnect(t)}});var ao;const so=((e,t,n,r,i)=>(o,{curve:a,oversample:s,...l})=>{const c=o.createWaveShaper(),u=o.createWaveShaper();bn(c,l),bn(u,l);const d=n(o,{...l,gain:1}),f=n(o,{...l,gain:-1}),h=n(o,{...l,gain:1}),p=n(o,{...l,gain:-1});let m=null,g=!1,v=null;const y={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(e){d.channelCount=e,f.channelCount=e,c.channelCount=e,h.channelCount=e,u.channelCount=e,p.channelCount=e},get channelCountMode(){return c.channelCountMode},set channelCountMode(e){d.channelCountMode=e,f.channelCountMode=e,c.channelCountMode=e,h.channelCountMode=e,u.channelCountMode=e,p.channelCountMode=e},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(e){d.channelInterpretation=e,f.channelInterpretation=e,c.channelInterpretation=e,h.channelInterpretation=e,u.channelInterpretation=e,p.channelInterpretation=e},get context(){return c.context},get curve(){return v},set curve(n){if(null!==n&&n.length<2)throw t();if(null===n)c.curve=n,u.curve=n;else{const e=n.length,t=new Float32Array(e+2-e%2),r=new Float32Array(e+2-e%2);t[0]=n[0],r[0]=-n[e-1];const i=Math.ceil((e+1)/2),o=(e+1)/2-1;for(let a=1;a<i;a+=1){const s=a/i*o,l=Math.floor(s),c=Math.ceil(s);t[a]=l===c?n[l]:(1-(s-l))*n[l]+(1-(c-s))*n[c],r[a]=l===c?-n[e-1-l]:-(1-(s-l))*n[e-1-l]-(1-(c-s))*n[e-1-c]}t[i]=e%2==1?n[i-1]:(n[i-2]+n[i-1])/2,c.curve=t,u.curve=r}v=n,g&&(r(v)&&null===m?m=e(o,d):null!==m&&(m(),m=null))},get inputs(){return[d]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get oversample(){return c.oversample},set oversample(e){c.oversample=e,u.oversample=e},addEventListener:(...e)=>d.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>d.dispatchEvent(e[0]),removeEventListener:(...e)=>d.removeEventListener(e[0],e[1],e[2])};null!==a&&(y.curve=a instanceof Float32Array?a:new Float32Array(a)),s!==y.oversample&&(y.oversample=s);return i(Pn(y,h),(()=>{d.connect(c).connect(h),d.connect(f).connect(u).connect(p).connect(h),g=!0,r(v)&&(m=e(o,d))}),(()=>{d.disconnect(c),c.disconnect(h),d.disconnect(f),f.disconnect(u),u.disconnect(p),p.disconnect(h),g=!1,null!==m&&(m(),m=null)}))})(oo,un,Ln,Yn,Mi),lo=((e,t,n,r,i,o,a)=>(s,l)=>{const c=s.createWaveShaper();if(null!==o&&"webkitAudioContext"===o.name&&void 0===s.createGain().gain.automationRate)return n(s,l);bn(c,l);const u=null===l.curve||l.curve instanceof Float32Array?l.curve:new Float32Array(l.curve);if(null!==u&&u.length<2)throw t();yn(c,{curve:u},"curve"),yn(c,l,"oversample");let d=null,f=!1;a(c,"curve",(e=>()=>e.call(c)),(t=>n=>(t.call(c,n),f&&(r(n)&&null===d?d=e(s,c):r(n)||null===d||(d(),d=null)),n)));return i(c,(()=>{f=!0,r(c.curve)&&(d=e(s,c))}),(()=>{f=!1,null!==d&&(d(),d=null)}))})(oo,un,so,Yn,Mi,Rr,Jn),co=((e,t,n,r,i,o,a,s,l,c)=>(u,{coneInnerAngle:d,coneOuterAngle:f,coneOuterGain:h,distanceModel:p,maxDistance:m,orientationX:g,orientationY:v,orientationZ:y,panningModel:b,positionX:w,positionY:x,positionZ:S,refDistance:M,rolloffFactor:_,...A})=>{const E=u.createPanner();if(A.channelCount>2)throw a();if("max"===A.channelCountMode)throw a();bn(E,A);const C={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},k=n(u,{...C,channelInterpretation:"speakers",numberOfInputs:6}),T=r(u,{...A,gain:1}),I=r(u,{...C,gain:1}),O=r(u,{...C,gain:0}),R=r(u,{...C,gain:0}),P=r(u,{...C,gain:0}),N=r(u,{...C,gain:0}),L=r(u,{...C,gain:0}),D=i(u,256,6,1),B=o(u,{...C,curve:new Float32Array([1,1]),oversample:"none"});let j=[g,v,y],F=[w,x,S];const U=new Float32Array(1);D.onaudioprocess=({inputBuffer:e})=>{const t=[l(e,U,0),l(e,U,1),l(e,U,2)];t.some(((e,t)=>e!==j[t]))&&(E.setOrientation(...t),j=t);const n=[l(e,U,3),l(e,U,4),l(e,U,5)];n.some(((e,t)=>e!==F[t]))&&(E.setPosition(...n),F=n)},Object.defineProperty(O.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(P.gain,"defaultValue",{get:()=>0}),Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(L.gain,"defaultValue",{get:()=>0});const z={get bufferSize(){},get channelCount(){return E.channelCount},set channelCount(e){if(e>2)throw a();T.channelCount=e,E.channelCount=e},get channelCountMode(){return E.channelCountMode},set channelCountMode(e){if("max"===e)throw a();T.channelCountMode=e,E.channelCountMode=e},get channelInterpretation(){return E.channelInterpretation},set channelInterpretation(e){T.channelInterpretation=e,E.channelInterpretation=e},get coneInnerAngle(){return E.coneInnerAngle},set coneInnerAngle(e){E.coneInnerAngle=e},get coneOuterAngle(){return E.coneOuterAngle},set coneOuterAngle(e){E.coneOuterAngle=e},get coneOuterGain(){return E.coneOuterGain},set coneOuterGain(e){if(e<0||e>1)throw t();E.coneOuterGain=e},get context(){return E.context},get distanceModel(){return E.distanceModel},set distanceModel(e){E.distanceModel=e},get inputs(){return[T]},get maxDistance(){return E.maxDistance},set maxDistance(e){if(e<0)throw new RangeError;E.maxDistance=e},get numberOfInputs(){return E.numberOfInputs},get numberOfOutputs(){return E.numberOfOutputs},get orientationX(){return I.gain},get orientationY(){return O.gain},get orientationZ(){return R.gain},get panningModel(){return E.panningModel},set panningModel(e){E.panningModel=e},get positionX(){return P.gain},get positionY(){return N.gain},get positionZ(){return L.gain},get refDistance(){return E.refDistance},set refDistance(e){if(e<0)throw new RangeError;E.refDistance=e},get rolloffFactor(){return E.rolloffFactor},set rolloffFactor(e){if(e<0)throw new RangeError;E.rolloffFactor=e},addEventListener:(...e)=>T.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>T.dispatchEvent(e[0]),removeEventListener:(...e)=>T.removeEventListener(e[0],e[1],e[2])};d!==z.coneInnerAngle&&(z.coneInnerAngle=d),f!==z.coneOuterAngle&&(z.coneOuterAngle=f),h!==z.coneOuterGain&&(z.coneOuterGain=h),p!==z.distanceModel&&(z.distanceModel=p),m!==z.maxDistance&&(z.maxDistance=m),g!==z.orientationX.value&&(z.orientationX.value=g),v!==z.orientationY.value&&(z.orientationY.value=v),y!==z.orientationZ.value&&(z.orientationZ.value=y),b!==z.panningModel&&(z.panningModel=b),w!==z.positionX.value&&(z.positionX.value=w),x!==z.positionY.value&&(z.positionY.value=x),S!==z.positionZ.value&&(z.positionZ.value=S),M!==z.refDistance&&(z.refDistance=M),_!==z.rolloffFactor&&(z.rolloffFactor=_),1===j[0]&&0===j[1]&&0===j[2]||E.setOrientation(...j),0===F[0]&&0===F[1]&&0===F[2]||E.setPosition(...F);return c(Pn(z,E),(()=>{T.connect(E),e(T,B,0,0),B.connect(I).connect(k,0,0),B.connect(O).connect(k,0,1),B.connect(R).connect(k,0,2),B.connect(P).connect(k,0,3),B.connect(N).connect(k,0,4),B.connect(L).connect(k,0,5),k.connect(D).connect(u.destination)}),(()=>{T.disconnect(E),s(T,B,0,0),B.disconnect(I),I.disconnect(k),B.disconnect(O),O.disconnect(k),B.disconnect(R),R.disconnect(k),B.disconnect(P),P.disconnect(k),B.disconnect(N),N.disconnect(k),B.disconnect(L),L.disconnect(k),k.disconnect(D),D.disconnect(u.destination)}))})(kt,un,Ci,Ln,jn,lo,Fn,Pt,Kn,Mi),uo=(fo=co,(e,t)=>{const n=e.createPanner();return void 0===n.orientationX?fo(e,t):(bn(n,t),xn(n,t,"orientationX"),xn(n,t,"orientationY"),xn(n,t,"orientationZ"),xn(n,t,"positionX"),xn(n,t,"positionY"),xn(n,t,"positionZ"),yn(n,t,"coneInnerAngle"),yn(n,t,"coneOuterAngle"),yn(n,t,"coneOuterGain"),yn(n,t,"distanceModel"),yn(n,t,"maxDistance"),yn(n,t,"panningModel"),yn(n,t,"refDistance"),yn(n,t,"rolloffFactor"),n)});var fo;const ho=((e,t,n,r,i,o,a,s,l,c)=>()=>{const u=new WeakMap;let d=null;return{render(f,h){const p=u.get(h);return void 0!==p?Promise.resolve(p):(async(f,h)=>{let p=null,m=o(f);const g={channelCount:m.channelCount,channelCountMode:m.channelCountMode,channelInterpretation:m.channelInterpretation},v={...g,coneInnerAngle:m.coneInnerAngle,coneOuterAngle:m.coneOuterAngle,coneOuterGain:m.coneOuterGain,distanceModel:m.distanceModel,maxDistance:m.maxDistance,panningModel:m.panningModel,refDistance:m.refDistance,rolloffFactor:m.rolloffFactor},y=nt(m,h);if("bufferSize"in m)p=r(h,{...g,gain:1});else if(!y){const e={...v,orientationX:m.orientationX.value,orientationY:m.orientationY.value,orientationZ:m.orientationZ.value,positionX:m.positionX.value,positionY:m.positionY.value,positionZ:m.positionZ.value};m=i(h,e)}if(u.set(h,null===p?m:p),null!==p){if(null===d){if(null===a)throw new Error("Missing the native OfflineAudioContext constructor.");const e=new a(6,f.context.length,h.sampleRate),r=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});r.connect(e.destination),d=(async()=>{const t=await Promise.all([f.orientationX,f.orientationY,f.orientationZ,f.positionX,f.positionY,f.positionZ].map((async(t,r)=>{const i=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===r?1:0});return await s(e,t,i.offset),i})));for(let e=0;e<6;e+=1)t[e].connect(r,0,e),t[e].start(0);return c(e)})()}const e=await d,o=r(h,{...g,gain:1});await l(f,h,o);const u=[];for(let t=0;t<e.numberOfChannels;t+=1)u.push(e.getChannelData(t));let m=[u[0][0],u[1][0],u[2][0]],y=[u[3][0],u[4][0],u[5][0]],b=r(h,{...g,gain:1}),w=i(h,{...v,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:y[0],positionY:y[1],positionZ:y[2]});o.connect(b).connect(w.inputs[0]),w.connect(p);for(let t=128;t<e.length;t+=128){const e=[u[0][t],u[1][t],u[2][t]],n=[u[3][t],u[4][t],u[5][t]];if(e.some(((e,t)=>e!==m[t]))||n.some(((e,t)=>e!==y[t]))){m=e,y=n;const a=t/h.sampleRate;b.gain.setValueAtTime(0,a),b=r(h,{...g,gain:0}),w=i(h,{...v,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:y[0],positionY:y[1],positionZ:y[2]}),b.gain.setValueAtTime(1,a),o.connect(b).connect(w.inputs[0]),w.connect(p)}}return p}return y?(await e(h,f.orientationX,m.orientationX),await e(h,f.orientationY,m.orientationY),await e(h,f.orientationZ,m.orientationZ),await e(h,f.positionX,m.positionX),await e(h,f.positionY,m.positionY),await e(h,f.positionZ,m.positionZ)):(await s(h,f.orientationX,m.orientationX),await s(h,f.orientationY,m.orientationY),await s(h,f.orientationZ,m.orientationZ),await s(h,f.positionX,m.positionX),await s(h,f.positionY,m.positionY),await s(h,f.positionZ,m.positionZ)),Ct(m)?await l(f,h,m.inputs[0]):await l(f,h,m),m})(f,h)}}})(ni,Ci,Pi,Ln,uo,Nt,Er,ai,br,Yi),po=((e,t,n,r,i,o,a)=>class extends e{constructor(e,s){const l=i(e),c={...Hn,...s},u=n(l,c),d=o(l);super(e,!1,u,d?r():null),this._nativePannerNode=u,this._orientationX=t(this,d,u.orientationX,lt,st),this._orientationY=t(this,d,u.orientationY,lt,st),this._orientationZ=t(this,d,u.orientationZ,lt,st),this._positionX=t(this,d,u.positionX,lt,st),this._positionY=t(this,d,u.positionY,lt,st),this._positionZ=t(this,d,u.positionZ,lt,st),a(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(e){this._nativePannerNode.coneInnerAngle=e}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(e){this._nativePannerNode.coneOuterAngle=e}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(e){this._nativePannerNode.coneOuterGain=e}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(e){this._nativePannerNode.distanceModel=e}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(e){this._nativePannerNode.maxDistance=e}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(e){this._nativePannerNode.panningModel=e}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(e){this._nativePannerNode.refDistance=e}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(e){this._nativePannerNode.rolloffFactor=e}})(jr,li,uo,ho,_r,Cr,hi),mo=(e=>(t,{disableNormalization:n,imag:r,real:i})=>{const o=r instanceof Float32Array?r:new Float32Array(r),a=i instanceof Float32Array?i:new Float32Array(i),s=t.createPeriodicWave(a,o,{disableNormalization:n});if(Array.from(r).length<2)throw e();return s})(it),go=((e,t,n,r)=>class i{constructor(i,o){const a=t(i),s=r({...Vn,...o}),l=e(a,s);return n.add(l),l}static[Symbol.hasInstance](e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===i.prototype||n.has(e)}})(mo,_r,new WeakSet,(e=>{const{imag:t,real:n}=e;return void 0===t?void 0===n?{...e,imag:[0,0],real:[0,0]}:{...e,imag:Array.from(n,(()=>0)),real:n}:void 0===n?{...e,imag:t,real:Array.from(t,(()=>0))}:{...e,imag:t,real:n}})),vo=((e,t,n,r,i,o)=>{const a=16385,s=new Float32Array([1,1]),l=Math.PI/2,c={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},u={...c,oversample:"none"},d=(e,o,d,f,h)=>{if(1===o)return((e,t,i,o)=>{const d=new Float32Array(a),f=new Float32Array(a);for(let e=0;e<a;e+=1){const t=e/16384*l;d[e]=Math.cos(t),f[e]=Math.sin(t)}const h=n(e,{...c,gain:0}),p=r(e,{...u,curve:d}),m=r(e,{...u,curve:s}),g=n(e,{...c,gain:0}),v=r(e,{...u,curve:f});return{connectGraph(){t.connect(h),t.connect(void 0===m.inputs?m:m.inputs[0]),t.connect(g),m.connect(i),i.connect(void 0===p.inputs?p:p.inputs[0]),i.connect(void 0===v.inputs?v:v.inputs[0]),p.connect(h.gain),v.connect(g.gain),h.connect(o,0,0),g.connect(o,0,1)},disconnectGraph(){t.disconnect(h),t.disconnect(void 0===m.inputs?m:m.inputs[0]),t.disconnect(g),m.disconnect(i),i.disconnect(void 0===p.inputs?p:p.inputs[0]),i.disconnect(void 0===v.inputs?v:v.inputs[0]),p.disconnect(h.gain),v.disconnect(g.gain),h.disconnect(o,0,0),g.disconnect(o,0,1)}}})(e,d,f,h);if(2===o)return((e,i,o,d)=>{const f=new Float32Array(a),h=new Float32Array(a),p=new Float32Array(a),m=new Float32Array(a),g=Math.floor(8192.5);for(let e=0;e<a;e+=1)if(e>g){const t=(e-g)/(16384-g)*l;f[e]=Math.cos(t),h[e]=Math.sin(t),p[e]=0,m[e]=1}else{const t=e/(16384-g)*l;f[e]=1,h[e]=0,p[e]=Math.cos(t),m[e]=Math.sin(t)}const v=t(e,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),y=n(e,{...c,gain:0}),b=r(e,{...u,curve:f}),w=n(e,{...c,gain:0}),x=r(e,{...u,curve:h}),S=r(e,{...u,curve:s}),M=n(e,{...c,gain:0}),_=r(e,{...u,curve:p}),A=n(e,{...c,gain:0}),E=r(e,{...u,curve:m});return{connectGraph(){i.connect(v),i.connect(void 0===S.inputs?S:S.inputs[0]),v.connect(y,0),v.connect(w,0),v.connect(M,1),v.connect(A,1),S.connect(o),o.connect(void 0===b.inputs?b:b.inputs[0]),o.connect(void 0===x.inputs?x:x.inputs[0]),o.connect(void 0===_.inputs?_:_.inputs[0]),o.connect(void 0===E.inputs?E:E.inputs[0]),b.connect(y.gain),x.connect(w.gain),_.connect(M.gain),E.connect(A.gain),y.connect(d,0,0),M.connect(d,0,0),w.connect(d,0,1),A.connect(d,0,1)},disconnectGraph(){i.disconnect(v),i.disconnect(void 0===S.inputs?S:S.inputs[0]),v.disconnect(y,0),v.disconnect(w,0),v.disconnect(M,1),v.disconnect(A,1),S.disconnect(o),o.disconnect(void 0===b.inputs?b:b.inputs[0]),o.disconnect(void 0===x.inputs?x:x.inputs[0]),o.disconnect(void 0===_.inputs?_:_.inputs[0]),o.disconnect(void 0===E.inputs?E:E.inputs[0]),b.disconnect(y.gain),x.disconnect(w.gain),_.disconnect(M.gain),E.disconnect(A.gain),y.disconnect(d,0,0),M.disconnect(d,0,0),w.disconnect(d,0,1),A.disconnect(d,0,1)}}})(e,d,f,h);throw i()};return(t,{channelCount:r,channelCountMode:a,pan:s,...l})=>{if("max"===a)throw i();const c=e(t,{...l,channelCount:1,channelCountMode:a,numberOfInputs:2}),u=n(t,{...l,channelCount:r,channelCountMode:a,gain:1}),f=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:s});let{connectGraph:h,disconnectGraph:p}=d(t,r,u,f,c);Object.defineProperty(f.gain,"defaultValue",{get:()=>0}),Object.defineProperty(f.gain,"maxValue",{get:()=>1}),Object.defineProperty(f.gain,"minValue",{get:()=>-1});const m={get bufferSize(){},get channelCount(){return u.channelCount},set channelCount(e){u.channelCount!==e&&(g&&p(),({connectGraph:h,disconnectGraph:p}=d(t,e,u,f,c)),g&&h()),u.channelCount=e},get channelCountMode(){return u.channelCountMode},set channelCountMode(e){if("clamped-max"===e||"max"===e)throw i();u.channelCountMode=e},get channelInterpretation(){return u.channelInterpretation},set channelInterpretation(e){u.channelInterpretation=e},get context(){return u.context},get inputs(){return[u]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return u.numberOfOutputs},get pan(){return f.gain},addEventListener:(...e)=>u.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>u.dispatchEvent(e[0]),removeEventListener:(...e)=>u.removeEventListener(e[0],e[1],e[2])};let g=!1;return o(Pn(m,c),(()=>{h(),g=!0}),(()=>{p(),g=!1}))}})(Ci,Rn,Ln,lo,Fn,Mi),yo=((e,t)=>(n,r)=>{const i=r.channelCountMode;if("clamped-max"===i)throw t();if(void 0===n.createStereoPanner)return e(n,r);const o=n.createStereoPanner();return bn(o,r),xn(o,r,"pan"),Object.defineProperty(o,"channelCountMode",{get:()=>i,set:e=>{if(e!==i)throw t()}}),o})(vo,Fn),bo=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=nt(l,s);if(!c){const e={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,pan:l.pan.value};l=t(s,e)}return o.set(s,l),c?await e(s,a.pan,l.pan):await r(s,a.pan,l.pan),Ct(l)?await i(a,s,l.inputs[0]):await i(a,s,l),l})(a,s)}}})(ni,yo,Nt,ai,br),wo=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=i(e),l={...Wn,...a},c=n(s,l),u=o(s);super(e,!1,c,u?r():null),this._pan=t(this,u,c.pan)}get pan(){return this._pan}})(jr,li,yo,bo,_r,Cr),xo=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!nt(a,o)){const t={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,curve:a.curve,oversample:a.oversample};a=e(o,t)}return r.set(o,a),Ct(a)?await n(i,o,a.inputs[0]):await n(i,o,a),a})(i,o)}}})(lo,Nt,br),So=((e,t,n,r,i,o,a)=>class extends e{constructor(e,t){const s=i(e),l={...qn,...t},c=n(s,l);super(e,!0,c,o(s)?r():null),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,a(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(e){if(null===e)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(e.length<2)throw t();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=e}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(e){this._nativeWaveShaperNode.oversample=e}})(jr,un,lo,xo,_r,Cr,hi),Mo=(e=>null!==e&&e.isSecureContext)(hr),_o=(e=>(t,n,r)=>{Object.defineProperties(e,{currentFrame:{configurable:!0,get:()=>Math.round(t*n)},currentTime:{configurable:!0,get:()=>t}});try{return r()}finally{null!==e&&(delete e.currentFrame,delete e.currentTime)}})(hr),Ao=new WeakMap,Eo=((e,t)=>n=>{let r=e.get(n);if(void 0!==r)return r;if(null===t)throw new Error("Missing the native OfflineAudioContext constructor.");return r=new t(1,1,44100),e.set(n,r),r})(Ao,Er),Co=Mo?((e,t,n,r,i,o,a,s,l,c,u,d,f)=>{let h=0;return(p,m,g={credentials:"omit"})=>{const v=u.get(p);if(void 0!==v&&v.has(m))return Promise.resolve();const y=c.get(p);if(void 0!==y){const e=y.get(m);if(void 0!==e)return e}const b=o(p),w=void 0===b.audioWorklet?i(m).then((([e,t])=>{const[r,i]=We(e,t);return n(`${r};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}\n})})(window,'_AWGS')`)})).then((()=>{const e=f._AWGS.pop();if(void 0===e)throw new SyntaxError;r(b.currentTime,b.sampleRate,(()=>e(class{},void 0,((e,n)=>{if(""===e.trim())throw t();const r=Fe.get(b);if(void 0!==r){if(r.has(e))throw t();qe(n),Ge(n.parameterDescriptors),r.set(e,n)}else qe(n),Ge(n.parameterDescriptors),Fe.set(b,new Map([[e,n]]))}),b.sampleRate,void 0,void 0)))})):Promise.all([i(m),Promise.resolve(e(d,d))]).then((([[e,t],n])=>{const r=h+1;h=r;const[i,o]=We(e,t),c=new Blob([`${i};((AudioWorkletProcessor,registerProcessor)=>{${o}\n})(${n?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${n?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${r}',class extends AudioWorkletProcessor{process(){return !1}})`],{type:"application/javascript; charset=utf-8"}),u=URL.createObjectURL(c);return b.audioWorklet.addModule(u,g).then((()=>{if(s(b))return b;const e=a(b);return e.audioWorklet.addModule(u,g).then((()=>e))})).then((e=>{if(null===l)throw new SyntaxError;try{new l(e,`__sac${r}`)}catch{throw new SyntaxError}})).finally((()=>URL.revokeObjectURL(u)))}));return void 0===y?c.set(p,new Map([[m,w]])):y.set(m,w),w.then((()=>{const e=u.get(p);void 0===e?u.set(p,new Set([m])):e.add(m)})).finally((()=>{const e=c.get(p);void 0!==e&&e.delete(m)})),w}})(ur,Fn,(e=>t=>new Promise(((n,r)=>{if(null===e)return void r(new SyntaxError);const i=e.document.head;if(null===i)r(new SyntaxError);else{const o=e.document.createElement("script"),a=new Blob([t],{type:"application/javascript"}),s=URL.createObjectURL(a),l=e.onerror,c=()=>{e.onerror=l,URL.revokeObjectURL(s)};e.onerror=(t,n,i,o,a)=>n===s||n===e.location.href&&1===i&&1===o?(c(),r(a),!1):null!==l?l(t,n,i,o,a):void 0,o.onerror=()=>{c(),r(new SyntaxError)},o.onload=()=>{c(),n()},o.src=s,o.type="module",i.appendChild(o)}})))(hr),_o,(ko=()=>new DOMException("","AbortError"),async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw ko()}),_r,Eo,Cr,Br,new WeakMap,new WeakMap,((e,t)=>async()=>{if(null===e)return!0;if(null===t)return!1;const n=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),r=new t(1,128,44100),i=URL.createObjectURL(n);let o=!1,a=!1;try{await r.audioWorklet.addModule(i);const t=new e(r,"a",{numberOfOutputs:0}),n=r.createOscillator();t.port.onmessage=()=>o=!0,t.onprocessorerror=()=>a=!0,n.connect(t),n.start(0),await r.startRendering()}catch{}finally{URL.revokeObjectURL(i)}return o&&!a})(Br,Er),hr):void 0;var ko;const To=((e,t)=>n=>e(n)||t(n))(Pr,Cr),Io=((e,t,n,r,i,o,a,s,l,c,u)=>(d,f)=>{const h=a(d)?d:o(d);if(i.has(f)){const e=n();return Promise.reject(e)}try{i.add(f)}catch{}return t(l,(()=>l(h)))?h.decodeAudioData(f).then((n=>(rn(f).catch((()=>{})),t(s,(()=>s(n)))||u(n),e.add(n),n))):new Promise(((t,n)=>{const i=async()=>{try{await rn(f)}catch{}},o=e=>{n(e),i()};try{h.decodeAudioData(f,(n=>{"function"!=typeof n.copyFromChannel&&(c(n),ot(n)),e.add(n),i().then((()=>t(n)))}),(e=>{o(null===e?r():e)}))}catch(e){o(e)}}))})(zr,ur,(()=>new DOMException("","DataCloneError")),(()=>new DOMException("","EncodingError")),new WeakSet,_r,To,rt,gn,Gr,qr),Oo=(Ro=Co,Po=Ur,No=Yr,Lo=ui,Do=pi,Bo=Ti,jo=Oi,Fo=Li,Uo=ji,zo=Io,Ho=Ui,Vo=Wi,Wo=qi,Go=Zi,qo=to,Ko=io,Yo=po,Jo=go,Qo=wo,Xo=So,class extends qo{constructor(e,t){super(e,t),this._nativeContext=e,this._audioWorklet=void 0===Ro?void 0:{addModule:(e,t)=>Ro(this,e,t)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new Po(this)}createBiquadFilter(){return new Do(this)}createBuffer(e,t,n){return new No({length:t,numberOfChannels:e,sampleRate:n})}createBufferSource(){return new Lo(this)}createChannelMerger(e=6){return new Bo(this,{numberOfInputs:e})}createChannelSplitter(e=6){return new jo(this,{numberOfOutputs:e})}createConstantSource(){return new Fo(this)}createConvolver(){return new Uo(this)}createDelay(e=1){return new Ho(this,{maxDelayTime:e})}createDynamicsCompressor(){return new Vo(this)}createGain(){return new Wo(this)}createIIRFilter(e,t){return new Go(this,{feedback:t,feedforward:e})}createOscillator(){return new Ko(this)}createPanner(){return new Yo(this)}createPeriodicWave(e,t,n={disableNormalization:!1}){return new Jo(this,{...n,imag:t,real:e})}createStereoPanner(){return new Qo(this)}createWaveShaper(){return new Xo(this)}decodeAudioData(e,t,n){return zo(this._nativeContext,e).then((e=>("function"==typeof t&&t(e),e)),(e=>{throw"function"==typeof n&&n(e),e}))}});var Ro,Po,No,Lo,Do,Bo,jo,Fo,Uo,zo,Ho,Vo,Wo,Go,qo,Ko,Yo,Jo,Qo,Xo;const Zo=((e,t,n,r)=>class extends e{constructor(e,i){const o=n(e),a=t(o,i);if(r(o))throw TypeError();super(e,!0,a,null),this._nativeMediaElementAudioSourceNode=a}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}})(jr,((e,t)=>e.createMediaElementSource(t.mediaElement)),_r,Cr),$o=((e,t,n,r)=>class extends e{constructor(e,i){const o=n(e);if(r(o))throw new TypeError;const a={...mn,...i},s=t(o,a);super(e,!1,s,null),this._nativeMediaStreamAudioDestinationNode=s}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(jr,((e,t)=>{const n=e.createMediaStreamDestination();return bn(n,t),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n}),_r,Cr),ea=((e,t,n,r)=>class extends e{constructor(e,i){const o=n(e),a=t(o,i);if(r(o))throw new TypeError;super(e,!0,a,null),this._nativeMediaStreamAudioSourceNode=a}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}})(jr,((e,{mediaStream:t})=>{const n=t.getAudioTracks();n.sort(((e,t)=>e.id<t.id?-1:e.id>t.id?1:0));const r=n.slice(0,1),i=e.createMediaStreamSource(new MediaStream(r));return Object.defineProperty(i,"mediaStream",{value:t}),i}),_r,Cr),ta=((e,t)=>(n,{mediaStreamTrack:r})=>{if("function"==typeof n.createMediaStreamTrackSource)return n.createMediaStreamTrackSource(r);const i=new MediaStream([r]),o=n.createMediaStreamSource(i);if("audio"!==r.kind)throw e();if(t(n))throw new TypeError;return o})(un,Cr),na=((e,t,n)=>class extends e{constructor(e,r){const i=n(e);super(e,!0,t(i,r),null)}})(jr,ta,_r),ra=((e,t,n,r,i,o,a,s,l)=>class extends e{constructor(e={}){if(null===l)throw new Error("Missing the native AudioContext constructor.");let t;try{t=new l(e)}catch(e){if(12===e.code&&"sampleRate is not in range"===e.message)throw n();throw e}if(null===t)throw r();if(!xt(e.latencyHint))throw new TypeError(`The provided value '${e.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(void 0!==e.sampleRate&&t.sampleRate!==e.sampleRate)throw n();super(t,2);const{latencyHint:i}=e,{sampleRate:o}=t;if(this._baseLatency="number"==typeof t.baseLatency?t.baseLatency:"balanced"===i?512/o:"interactive"===i||void 0===i?256/o:"playback"===i?1024/o:128*Math.max(2,Math.min(128,Math.round(i*o/128)))/o,this._nativeAudioContext=t,"webkitAudioContext"===l.name?(this._nativeGainNode=t.createGain(),this._nativeOscillatorNode=t.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(t.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,"running"===t.state){this._state="suspended";const e=()=>{"suspended"===this._state&&(this._state=null),t.removeEventListener("statechange",e)};t.addEventListener("statechange",e)}}get baseLatency(){return this._baseLatency}get state(){return null!==this._state?this._state:this._nativeAudioContext.state}close(){return"closed"===this.state?this._nativeAudioContext.close().then((()=>{throw t()})):("suspended"===this._state&&(this._state=null),this._nativeAudioContext.close().then((()=>{null!==this._nativeGainNode&&null!==this._nativeOscillatorNode&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),wt(this)})))}createMediaElementSource(e){return new i(this,{mediaElement:e})}createMediaStreamDestination(){return new o(this)}createMediaStreamSource(e){return new a(this,{mediaStream:e})}createMediaStreamTrackSource(e){return new s(this,{mediaStreamTrack:e})}resume(){return"suspended"===this._state?new Promise(((e,t)=>{const n=()=>{this._nativeAudioContext.removeEventListener("statechange",n),"running"===this._nativeAudioContext.state?e():this.resume().then(e,t)};this._nativeAudioContext.addEventListener("statechange",n)})):this._nativeAudioContext.resume().catch((e=>{if(void 0===e||15===e.code)throw t();throw e}))}suspend(){return this._nativeAudioContext.suspend().catch((e=>{if(void 0===e)throw t();throw e}))}})(Oo,un,Fn,Gn,Zo,$o,ea,na,Rr),ia=(oa=eo,e=>{const t=oa.get(e);if(void 0===t)throw new Error("The context has no set of AudioWorkletNodes.");return t});var oa;const aa=(sa=ia,(e,t)=>{sa(e).add(t)});var sa;const la=(e=>(t,n,r=0,i=0)=>{const o=t[r];if(void 0===o)throw e();return Ut(n)?o.connect(n,0,i):o.connect(n,0)})(it),ca=(e=>(t,n)=>{e(t).delete(n)})(ia),ua=(e=>(t,n,r,i=0)=>void 0===n?t.forEach((e=>e.disconnect())):"number"==typeof n?sn(e,t,n).disconnect():Ut(n)?void 0===r?t.forEach((e=>e.disconnect(n))):void 0===i?sn(e,t,r).disconnect(n,0):sn(e,t,r).disconnect(n,0,i):void 0===r?t.forEach((e=>e.disconnect(n))):sn(e,t,r).disconnect(n,0))(it),da=new WeakMap,fa=(ha=da,pa=Ke,e=>pa(ha,e));var ha,pa;const ma=((e,t,n,r,i,o,a,s,l,c,u,d,f)=>(h,p,m,g)=>{if(0===g.numberOfInputs&&0===g.numberOfOutputs)throw l();const v=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(v.some((e=>e<1)))throw l();if(v.length!==g.numberOfOutputs)throw t();if("explicit"!==g.channelCountMode)throw l();const y=g.channelCount*g.numberOfInputs,b=v.reduce(((e,t)=>e+t),0),w=void 0===m.parameterDescriptors?0:m.parameterDescriptors.length;if(y+w>6||b>6)throw l();const x=new MessageChannel,S=[],M=[];for(let e=0;e<g.numberOfInputs;e+=1)S.push(a(h,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),M.push(i(h,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const _=[];if(void 0!==m.parameterDescriptors)for(const{defaultValue:e,maxValue:t,minValue:n,name:r}of m.parameterDescriptors){const i=o(h,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:void 0!==g.parameterData[r]?g.parameterData[r]:void 0===e?0:e});Object.defineProperties(i.offset,{defaultValue:{get:()=>void 0===e?0:e},maxValue:{get:()=>void 0===t?lt:t},minValue:{get:()=>void 0===n?st:n}}),_.push(i)}const A=r(h,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,y+w)}),E=En(p,h.sampleRate),C=s(h,E,y+w,Math.max(1,b)),k=i(h,{channelCount:Math.max(1,b),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,b)}),T=[];for(let e=0;e<g.numberOfOutputs;e+=1)T.push(r(h,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:v[e]}));for(let e=0;e<g.numberOfInputs;e+=1){S[e].connect(M[e]);for(let t=0;t<g.channelCount;t+=1)M[e].connect(A,t,e*g.channelCount+t)}const I=new Gt(void 0===m.parameterDescriptors?[]:m.parameterDescriptors.map((({name:e},t)=>{const n=_[t];return n.connect(A,0,y+t),n.start(0),[e,n.offset]})));A.connect(C);let O=g.channelInterpretation,R=null;const P=0===g.numberOfOutputs?[C]:T,N={get bufferSize(){return E},get channelCount(){return g.channelCount},set channelCount(e){throw n()},get channelCountMode(){return g.channelCountMode},set channelCountMode(e){throw n()},get channelInterpretation(){return O},set channelInterpretation(e){for(const t of S)t.channelInterpretation=e;O=e},get context(){return C.context},get inputs(){return S},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},get onprocessorerror(){return R},set onprocessorerror(e){"function"==typeof R&&N.removeEventListener("processorerror",R),R="function"==typeof e?e:null,"function"==typeof R&&N.addEventListener("processorerror",R)},get parameters(){return I},get port(){return x.port2},addEventListener:(...e)=>C.addEventListener(e[0],e[1],e[2]),connect:e.bind(null,P),disconnect:c.bind(null,P),dispatchEvent:(...e)=>C.dispatchEvent(e[0]),removeEventListener:(...e)=>C.removeEventListener(e[0],e[1],e[2])},L=new Map;var D,B;x.port1.addEventListener=(D=x.port1.addEventListener,(...e)=>{if("message"===e[0]){const t="function"==typeof e[1]?e[1]:"object"==typeof e[1]&&null!==e[1]&&"function"==typeof e[1].handleEvent?e[1].handleEvent:null;if(null!==t){const n=L.get(e[1]);void 0!==n?e[1]=n:(e[1]=e=>{u(h.currentTime,h.sampleRate,(()=>t(e)))},L.set(t,e[1]))}}return D.call(x.port1,e[0],e[1],e[2])}),x.port1.removeEventListener=(B=x.port1.removeEventListener,(...e)=>{if("message"===e[0]){const t=L.get(e[1]);void 0!==t&&(L.delete(e[1]),e[1]=t)}return B.call(x.port1,e[0],e[1],e[2])});let j=null;Object.defineProperty(x.port1,"onmessage",{get:()=>j,set:e=>{"function"==typeof j&&x.port1.removeEventListener("message",j),j="function"==typeof e?e:null,"function"==typeof j&&(x.port1.addEventListener("message",j),x.port1.start())}}),m.prototype.port=x.port1;let F=null;Tn(h,N,m,g).then((e=>F=e));const U=Jt(g.numberOfInputs,g.channelCount),z=Jt(g.numberOfOutputs,v),H=void 0===m.parameterDescriptors?[]:m.parameterDescriptors.reduce(((e,{name:t})=>({...e,[t]:new Float32Array(128)})),{});let V=!0;const W=()=>{g.numberOfOutputs>0&&C.disconnect(k);for(let e=0,t=0;e<g.numberOfOutputs;e+=1){const n=T[e];for(let r=0;r<v[e];r+=1)k.disconnect(n,t+r,r);t+=v[e]}},G=new Map;C.onaudioprocess=({inputBuffer:e,outputBuffer:t})=>{if(null!==F){const n=d(N);for(let r=0;r<E;r+=128){for(let t=0;t<g.numberOfInputs;t+=1)for(let n=0;n<g.channelCount;n+=1)Kt(e,U[t],n,n,r);void 0!==m.parameterDescriptors&&m.parameterDescriptors.forEach((({name:t},n)=>{Kt(e,H,t,y+n,r)}));for(let e=0;e<g.numberOfInputs;e+=1)for(let t=0;t<v[e];t+=1)0===z[e][t].byteLength&&(z[e][t]=new Float32Array(128));try{const e=U.map(((e,t)=>{if(n[t].size>0)return G.set(t,E/128),e;const r=G.get(t);return void 0===r?[]:(e.every((e=>e.every((e=>0===e))))&&(1===r?G.delete(t):G.set(t,r-1)),e)})),i=u(h.currentTime+r/h.sampleRate,h.sampleRate,(()=>F.process(e,z,H)));V=i;for(let e=0,n=0;e<g.numberOfOutputs;e+=1){for(let i=0;i<v[e];i+=1)Yt(t,z[e],i,n+i,r);n+=v[e]}}catch(e){V=!1,N.dispatchEvent(new ErrorEvent("processorerror",{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}))}if(!V){for(let e=0;e<g.numberOfInputs;e+=1){S[e].disconnect(M[e]);for(let t=0;t<g.channelCount;t+=1)M[r].disconnect(A,t,e*g.channelCount+t)}if(void 0!==m.parameterDescriptors){const e=m.parameterDescriptors.length;for(let t=0;t<e;t+=1){const e=_[t];e.disconnect(A,0,y+t),e.stop()}}A.disconnect(C),C.onaudioprocess=null,q?W():J();break}}}};let q=!1;const K=a(h,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),Y=()=>C.connect(K).connect(h.destination),J=()=>{C.disconnect(K),K.disconnect()};return Y(),f(N,(()=>{if(V){J(),g.numberOfOutputs>0&&C.connect(k);for(let e=0,t=0;e<g.numberOfOutputs;e+=1){const n=T[e];for(let r=0;r<v[e];r+=1)k.connect(n,t+r,r);t+=v[e]}}q=!0}),(()=>{V&&(Y(),W()),q=!1}))})(la,it,un,Ci,Rn,Pi,Ln,jn,Fn,ua,_o,fa,Mi),ga=((e,t,n,r,i)=>(o,a,s,l,c,u)=>{if(null!==s)try{const t=new s(o,l,u),r=new Map;let a=null;if(Object.defineProperties(t,{channelCount:{get:()=>u.channelCount,set:()=>{throw e()}},channelCountMode:{get:()=>"explicit",set:()=>{throw e()}},onprocessorerror:{get:()=>a,set:e=>{"function"==typeof a&&t.removeEventListener("processorerror",a),a="function"==typeof e?e:null,"function"==typeof a&&t.addEventListener("processorerror",a)}}}),t.addEventListener=(f=t.addEventListener,(...e)=>{if("processorerror"===e[0]){const t="function"==typeof e[1]?e[1]:"object"==typeof e[1]&&null!==e[1]&&"function"==typeof e[1].handleEvent?e[1].handleEvent:null;if(null!==t){const n=r.get(e[1]);void 0!==n?e[1]=n:(e[1]=n=>{"error"===n.type?(Object.defineProperties(n,{type:{value:"processorerror"}}),t(n)):t(new ErrorEvent(e[0],{...n}))},r.set(t,e[1]))}}return f.call(t,"error",e[1],e[2]),f.call(t,...e)}),t.removeEventListener=(d=t.removeEventListener,(...e)=>{if("processorerror"===e[0]){const t=r.get(e[1]);void 0!==t&&(r.delete(e[1]),e[1]=t)}return d.call(t,"error",e[1],e[2]),d.call(t,e[0],e[1],e[2])}),0!==u.numberOfOutputs){const e=n(o,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});t.connect(e).connect(o.destination);return i(t,(()=>e.disconnect()),(()=>e.connect(o.destination)))}return t}catch(e){if(11===e.code)throw r();throw e}var d,f;if(void 0===c)throw r();return An(u),t(o,a,c,u)})(un,ma,Ln,Fn,Mi),va=((e,t,n,r,i,o,a,s,l,c,u,d,f,h,p,m)=>(g,v,y)=>{const b=new WeakMap;let w=null;return{render(x,S){s(S,x);const M=b.get(S);return void 0!==M?Promise.resolve(M):(async(s,x)=>{let S=u(s),M=null;const _=nt(S,x),A=Array.isArray(v.outputChannelCount)?v.outputChannelCount:Array.from(v.outputChannelCount);if(null===d){const e=A.reduce(((e,t)=>e+t),0),n=i(x,{channelCount:Math.max(1,e),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,e)}),o=[];for(let e=0;e<s.numberOfOutputs;e+=1)o.push(r(x,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:A[e]}));const c=a(x,{channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation,gain:1});c.connect=t.bind(null,o),c.disconnect=l.bind(null,o),M=[n,o,c]}else _||(S=new d(x,g));if(b.set(x,null===M?S:M[2]),null!==M){if(null===w){if(void 0===y)throw new Error("Missing the processor constructor.");if(null===f)throw new Error("Missing the native OfflineAudioContext constructor.");const e=s.channelCount*s.numberOfInputs,t=void 0===y.parameterDescriptors?0:y.parameterDescriptors.length,n=e+t,l=async()=>{const l=new f(n,128*Math.ceil(s.context.length/128),x.sampleRate),c=[],u=[];for(let e=0;e<v.numberOfInputs;e+=1)c.push(a(l,{channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation,gain:1})),u.push(i(l,{channelCount:v.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:v.channelCount}));const d=await Promise.all(Array.from(s.parameters.values()).map((async e=>{const t=o(l,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:e.value});return await h(l,e,t.offset),t}))),g=r(l,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,e+t)});for(let e=0;e<v.numberOfInputs;e+=1){c[e].connect(u[e]);for(let t=0;t<v.channelCount;t+=1)u[e].connect(g,t,e*v.channelCount+t)}for(const[t,n]of d.entries())n.connect(g,0,e+t),n.start(0);return g.connect(l.destination),await Promise.all(c.map((e=>p(s,l,e)))),m(l)};w=Xt(s,0===n?null:await l(),x,v,A,y,c)}const e=await w,t=n(x,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[l,u,d]=M;null!==e&&(t.buffer=e,t.start(0)),t.connect(l);for(let e=0,t=0;e<s.numberOfOutputs;e+=1){const n=u[e];for(let r=0;r<A[e];r+=1)l.connect(n,t+r,r);t+=A[e]}return d}if(_)for(const[t,n]of s.parameters.entries())await e(x,n,S.parameters.get(t));else for(const[e,t]of s.parameters.entries())await h(x,t,S.parameters.get(e));return await p(s,x,S),S})(x,S)}}})(ni,la,ii,Ci,Rn,Pi,Ln,ca,ua,_o,Nt,Br,Er,ai,br,Yi),ya=(ba=Ao,e=>ba.get(e));var ba;const wa=(e=>(t,n)=>{e.set(t,n)})(da),xa=(Mo&&((e,t,n,r,i,o,a,s,l,c,u,d,f,h)=>{})(aa,jr,li,va,ga,vt,ya,_r,Cr,Br,(e=>({...e,outputChannelCount:void 0!==e.outputChannelCount?e.outputChannelCount:1===e.numberOfInputs&&1===e.numberOfOutputs?[e.channelCount]:Array.from({length:e.numberOfOutputs},(()=>1))})),wa,(e=>{const{port1:t,port2:n}=new MessageChannel;try{t.postMessage(e)}finally{t.close(),n.close()}}),tr),((e,t,n,r,i)=>{})(un,Fn,Gn,to,Rr),((e,t)=>(n,r,i)=>{if(null===t)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new t(n,r,i)}catch(t){if("SyntaxError"===t.name)throw e();throw t}})(Fn,Er)),Sa=((e,t,n,r,i,o,a,s)=>(l,c)=>n(l).render(l,c).then((()=>Promise.all(Array.from(r(c)).map((e=>n(e).render(e,c)))))).then((()=>i(c))).then((n=>("function"!=typeof n.copyFromChannel?(a(n),ot(n)):t(o,(()=>o(n)))||s(n),e.add(n),n))))(zr,ur,vr,ia,Yi,rt,Gr,qr);Ma=Pe,_a=Lr;var Ma,_a;Aa=Le,Ea=Dr;var Aa,Ea;var Ca,ka=new Uint8Array(16);function Ta(){if(!Ca&&!(Ca="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ca(ka)}var Ia=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var Oa=function(e){return"string"==typeof e&&Ia.test(e)},Ra=[],Pa=0;Pa<256;++Pa)Ra.push((Pa+256).toString(16).substr(1));var Na=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Ra[e[t+0]]+Ra[e[t+1]]+Ra[e[t+2]]+Ra[e[t+3]]+"-"+Ra[e[t+4]]+Ra[e[t+5]]+"-"+Ra[e[t+6]]+Ra[e[t+7]]+"-"+Ra[e[t+8]]+Ra[e[t+9]]+"-"+Ra[e[t+10]]+Ra[e[t+11]]+Ra[e[t+12]]+Ra[e[t+13]]+Ra[e[t+14]]+Ra[e[t+15]]).toLowerCase();if(!Oa(n))throw TypeError("Stringified UUID is invalid");return n};var La=function(e,t,n){var r=(e=e||{}).random||(e.rng||Ta)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return Na(r)};const Da=()=>La(),Ba=()=>Da().replace(new RegExp("-","g"),"").toUpperCase();var ja,Fa,Ua,za,Ha,Va,Wa,Ga;(Fa=ja||(ja={}))[Fa.Debug=0]="Debug",Fa[Fa.Info=1]="Info",Fa[Fa.Warning=2]="Warning",Fa[Fa.Error=3]="Error";class qa{constructor(e,t){this.privName=e,this.privEventId=Ba(),this.privEventTime=(new Date).toISOString(),this.privEventType=t,this.privMetadata={}}get name(){return this.privName}get eventId(){return this.privEventId}get eventTime(){return this.privEventTime}get eventType(){return this.privEventType}get metadata(){return this.privMetadata}}class Ka extends qa{constructor(e,t,n=ja.Info){super(e,n),this.privAudioSourceId=t}get audioSourceId(){return this.privAudioSourceId}}class Ya extends Ka{constructor(e){super("AudioSourceInitializingEvent",e)}}class Ja extends Ka{constructor(e){super("AudioSourceReadyEvent",e)}}class Qa extends Ka{constructor(e){super("AudioSourceOffEvent",e)}}class Xa extends Ka{constructor(e,t){super("AudioSourceErrorEvent",e,ja.Error),this.privError=t}get error(){return this.privError}}class Za extends Ka{constructor(e,t,n){super(e,t),this.privAudioNodeId=n}get audioNodeId(){return this.privAudioNodeId}}class $a extends Za{constructor(e,t){super("AudioStreamNodeAttachingEvent",e,t)}}class es extends Za{constructor(e,t){super("AudioStreamNodeAttachedEvent",e,t)}}class ts extends Za{constructor(e,t){super("AudioStreamNodeDetachedEvent",e,t)}}class ns extends Za{constructor(e,t,n){super("AudioStreamNodeErrorEvent",e,t),this.privError=n}get error(){return this.privError}}class rs extends qa{constructor(e,t,n=ja.Info){super(e,n),this.privJsonResult=t}get jsonString(){return this.privJsonResult}}class is extends qa{constructor(e,t,n=ja.Info){super(e,n),this.privConnectionId=t}get connectionId(){return this.privConnectionId}}class os extends is{constructor(e,t,n){super("ConnectionStartEvent",e),this.privUri=t,this.privHeaders=n}get uri(){return this.privUri}get headers(){return this.privHeaders}}class as extends is{constructor(e,t){super("ConnectionEstablishedEvent",e)}}class ss extends is{constructor(e,t,n){super("ConnectionClosedEvent",e,ja.Debug),this.privReason=n,this.privStatusCode=t}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class ls extends is{constructor(e,t,n){super("ConnectionErrorEvent",e,ja.Debug),this.privMessage=t,this.privType=n}get message(){return this.privMessage}get type(){return this.privType}}class cs extends is{constructor(e,t,n){super("ConnectionEstablishErrorEvent",e,ja.Error),this.privStatusCode=t,this.privReason=n}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class us extends is{constructor(e,t,n){super("ConnectionMessageReceivedEvent",e),this.privNetworkReceivedTime=t,this.privMessage=n}get networkReceivedTime(){return this.privNetworkReceivedTime}get message(){return this.privMessage}}class ds extends is{constructor(e,t,n){super("ConnectionMessageSentEvent",e),this.privNetworkSentTime=t,this.privMessage=n}get networkSentTime(){return this.privNetworkSentTime}get message(){return this.privMessage}}class fs extends Error{constructor(e){super(e),this.name="ArgumentNull",this.message=e}}class hs extends Error{constructor(e){super(e),this.name="InvalidOperation",this.message=e}}class ps extends Error{constructor(e,t){super(t),this.name=e+"ObjectDisposed",this.message=t}}(za=Ua||(Ua={}))[za.Text=0]="Text",za[za.Binary=1]="Binary";class ms{constructor(e,t,n,r){if(this.privBody=null,e===Ua.Text&&t&&"string"!=typeof t)throw new hs("Payload must be a string");if(e===Ua.Binary&&t&&!(t instanceof ArrayBuffer))throw new hs("Payload must be ArrayBuffer");switch(this.privMessageType=e,this.privBody=t,this.privHeaders=n||{},this.privId=r||Ba(),this.messageType){case Ua.Binary:this.privSize=null!==this.binaryBody?this.binaryBody.byteLength:0;break;case Ua.Text:this.privSize=this.textBody.length}}get messageType(){return this.privMessageType}get headers(){return this.privHeaders}get body(){return this.privBody}get textBody(){if(this.privMessageType===Ua.Binary)throw new hs("Not supported for binary message");return this.privBody}get binaryBody(){if(this.privMessageType===Ua.Text)throw new hs("Not supported for text message");return this.privBody}get id(){return this.privId}}class gs{constructor(e,t){this.privStatusCode=e,this.privReason=t}get statusCode(){return this.privStatusCode}get reason(){return this.privReason}}class vs{constructor(e){this.privEventListeners={},this.privIsDisposed=!1,this.onEvent=e=>{if(this.isDisposed())throw new ps("EventSource");if(this.metadata)for(const t in this.metadata)t&&e.metadata&&(e.metadata[t]||(e.metadata[t]=this.metadata[t]));for(const t in this.privEventListeners)t&&this.privEventListeners[t]&&this.privEventListeners[t](e)},this.attach=e=>{const t=Ba();return this.privEventListeners[t]=e,{detach:()=>(delete this.privEventListeners[t],Promise.resolve())}},this.attachListener=e=>this.attach(e.onEvent),this.isDisposed=()=>this.privIsDisposed,this.dispose=()=>{this.privEventListeners=null,this.privIsDisposed=!0},this.privMetadata=e}get metadata(){return this.privMetadata}}class ys{static get instance(){return ys.privInstance}}ys.privInstance=new vs,ys.setEventSource=e=>{if(!e)throw new fs("eventSource");ys.privInstance=e},(Va=Ha||(Ha={}))[Va.None=0]="None",Va[Va.Connected=1]="Connected",Va[Va.Connecting=2]="Connecting",Va[Va.Disconnected=3]="Disconnected",(Ga=Wa||(Wa={}))[Ga.None=0]="None",Ga[Ga.Resolved=1]="Resolved",Ga[Ga.Rejected=2]="Rejected";class bs{constructor(){this.resolve=e=>(this.privResolve(e),this),this.reject=e=>(this.privReject(e),this),this.privPromise=new Promise(((e,t)=>{this.privResolve=e,this.privReject=t}))}get promise(){return this.privPromise}}function ws(e,t,n){e.then((e=>{try{t&&t(e)}catch(e){if(n)try{if(e instanceof Error){const t=e;n(t.name+": "+t.message)}else n(e)}catch(e){}}}),(e=>{if(n)try{if(e instanceof Error){const t=e;n(t.name+": "+t.message)}else n(e)}catch(e){}}))}var xs={};e(xs,"Queue",(()=>Es),(e=>Es=e));class Ss{constructor(e){if(this.privSubscriptionIdCounter=0,this.privAddSubscriptions={},this.privRemoveSubscriptions={},this.privDisposedSubscriptions={},this.privDisposeReason=null,this.get=e=>(this.throwIfDisposed(),this.privList[e]),this.first=()=>this.get(0),this.last=()=>this.get(this.length()-1),this.add=e=>{this.throwIfDisposed(),this.insertAt(this.privList.length,e)},this.insertAt=(e,t)=>{this.throwIfDisposed(),0===e?this.privList.unshift(t):e===this.privList.length?this.privList.push(t):this.privList.splice(e,0,t),this.triggerSubscriptions(this.privAddSubscriptions)},this.removeFirst=()=>(this.throwIfDisposed(),this.removeAt(0)),this.removeLast=()=>(this.throwIfDisposed(),this.removeAt(this.length()-1)),this.removeAt=e=>(this.throwIfDisposed(),this.remove(e,1)[0]),this.remove=(e,t)=>{this.throwIfDisposed();const n=this.privList.splice(e,t);return this.triggerSubscriptions(this.privRemoveSubscriptions),n},this.clear=()=>{this.throwIfDisposed(),this.remove(0,this.length())},this.length=()=>(this.throwIfDisposed(),this.privList.length),this.onAdded=e=>{this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privAddSubscriptions[t]=e,{detach:()=>(delete this.privAddSubscriptions[t],Promise.resolve())}},this.onRemoved=e=>{this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privRemoveSubscriptions[t]=e,{detach:()=>(delete this.privRemoveSubscriptions[t],Promise.resolve())}},this.onDisposed=e=>{this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privDisposedSubscriptions[t]=e,{detach:()=>(delete this.privDisposedSubscriptions[t],Promise.resolve())}},this.join=e=>(this.throwIfDisposed(),this.privList.join(e)),this.toArray=()=>{const e=Array();return this.privList.forEach((t=>{e.push(t)})),e},this.any=e=>(this.throwIfDisposed(),e?this.where(e).length()>0:this.length()>0),this.all=e=>(this.throwIfDisposed(),this.where(e).length()===this.length()),this.forEach=e=>{this.throwIfDisposed();for(let t=0;t<this.length();t++)e(this.privList[t],t)},this.select=e=>{this.throwIfDisposed();const t=[];for(let n=0;n<this.privList.length;n++)t.push(e(this.privList[n],n));return new Ss(t)},this.where=e=>{this.throwIfDisposed();const t=new Ss;for(let n=0;n<this.privList.length;n++)e(this.privList[n],n)&&t.add(this.privList[n]);return t},this.orderBy=e=>{this.throwIfDisposed();const t=this.toArray().sort(e);return new Ss(t)},this.orderByDesc=e=>(this.throwIfDisposed(),this.orderBy(((t,n)=>e(n,t)))),this.clone=()=>(this.throwIfDisposed(),new Ss(this.toArray())),this.concat=e=>(this.throwIfDisposed(),new Ss(this.privList.concat(e.toArray()))),this.concatArray=e=>(this.throwIfDisposed(),new Ss(this.privList.concat(e))),this.isDisposed=()=>null==this.privList,this.dispose=e=>{this.isDisposed()||(this.privDisposeReason=e,this.privList=null,this.privAddSubscriptions=null,this.privRemoveSubscriptions=null,this.triggerSubscriptions(this.privDisposedSubscriptions))},this.throwIfDisposed=()=>{if(this.isDisposed())throw new ps("List",this.privDisposeReason)},this.triggerSubscriptions=e=>{if(e)for(const t in e)t&&e[t]()},this.privList=[],e)for(const t of e)this.privList.push(t)}}var Ms,_s,As=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};(_s=Ms||(Ms={}))[_s.Dequeue=0]="Dequeue",_s[_s.Peek=1]="Peek";class Es{constructor(e){this.privPromiseStore=new Ss,this.privIsDrainInProgress=!1,this.privIsDisposing=!1,this.privDisposeReason=null,this.enqueue=e=>{this.throwIfDispose(),this.enqueueFromPromise(new Promise(((t,n)=>{t(e)})))},this.enqueueFromPromise=e=>{this.throwIfDispose(),e.then((e=>{this.privList.add(e)}),(e=>{}))},this.dequeue=()=>{this.throwIfDispose();const e=new bs;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:Ms.Dequeue}),this.drain()),e.promise},this.peek=()=>{this.throwIfDispose();const e=new bs;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:Ms.Peek}),this.drain()),e.promise},this.length=()=>(this.throwIfDispose(),this.privList.length()),this.isDisposed=()=>null==this.privSubscribers,this.drain=()=>{if(!this.privIsDrainInProgress&&!this.privIsDisposing){this.privIsDrainInProgress=!0;const e=this.privSubscribers,t=this.privList;if(e&&t){for(;t.length()>0&&e.length()>0&&!this.privIsDisposing;){const n=e.removeFirst();if(n.type===Ms.Peek)n.deferral.resolve(t.first());else{const e=t.removeFirst();n.deferral.resolve(e)}}this.privSubscribers===e&&(this.privSubscribers=e),this.privList===t&&(this.privList=t)}this.privIsDrainInProgress=!1}},this.throwIfDispose=()=>{if(this.isDisposed()){if(this.privDisposeReason)throw new hs(this.privDisposeReason);throw new ps("Queue")}if(this.privIsDisposing)throw new hs("Queue disposing")},this.privList=e||new Ss,this.privDetachables=[],this.privSubscribers=new Ss,this.privDetachables.push(this.privList.onAdded(this.drain))}drainAndDispose(e,t){return As(this,void 0,void 0,(function*(){if(!this.isDisposed()&&!this.privIsDisposing){this.privDisposeReason=t,this.privIsDisposing=!0;const n=this.privSubscribers;if(n){for(;n.length()>0;){n.removeFirst().deferral.resolve(void 0)}this.privSubscribers===n&&(this.privSubscribers=n)}for(const e of this.privDetachables)yield e.detach();if(this.privPromiseStore.length()>0&&e){const t=[];return this.privPromiseStore.toArray().forEach((e=>{t.push(e)})),Promise.all(t).finally((()=>{this.privSubscribers=null,this.privList.forEach(((t,n)=>{e(t)})),this.privList=null})).then()}this.privSubscribers=null,this.privList=null}}))}dispose(e){return As(this,void 0,void 0,(function*(){yield this.drainAndDispose(null,e)}))}}class Cs{constructor(e,t,n){if(this.privPayload=null,!t)throw new fs("payload");if(e===Ua.Binary&&"ArrayBuffer"!==t.__proto__.constructor.name)throw new hs("Payload must be ArrayBuffer");if(e===Ua.Text&&"string"!=typeof t)throw new hs("Payload must be a string");this.privMessageType=e,this.privPayload=t,this.privId=n||Ba()}get messageType(){return this.privMessageType}get payload(){return this.privPayload}get textContent(){if(this.privMessageType===Ua.Binary)throw new hs("Not supported for binary message");return this.privPayload}get binaryContent(){if(this.privMessageType===Ua.Text)throw new hs("Not supported for text message");return this.privPayload}get id(){return this.privId}}class ks{constructor(e,t){this.encode=e=>{const t=this.downSampleAudioFrame(e,this.privActualSampleRate,this.privDesiredSampleRate);if(!t)return null;const n=2*t.length,r=new ArrayBuffer(n),i=new DataView(r);return this.floatTo16BitPCM(i,0,t),r},this.setString=(e,t,n)=>{for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))},this.floatTo16BitPCM=(e,t,n)=>{for(let r=0;r<n.length;r++,t+=2){const i=Math.max(-1,Math.min(1,n[r]));e.setInt16(t,i<0?32768*i:32767*i,!0)}},this.downSampleAudioFrame=(e,t,n)=>{if(!e)return null;if(n===t||n>t)return e;const r=t/n,i=Math.round(e.length/r),o=new Float32Array(i);let a=0,s=0;for(;s<i;){const t=Math.round((s+1)*r);let n=0,i=0;for(;a<t&&a<e.length;)n+=e[a++],i++;o[s++]=n/i}return o},this.privActualSampleRate=e,this.privDesiredSampleRate=t}}var Ts={};e(Ts,"Stream",(()=>Ps),(e=>Ps=e));var Is,Os,Rs=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Ps{constructor(e){this.privIsWriteEnded=!1,this.privIsReadEnded=!1,this.read=()=>{if(this.privIsReadEnded)throw new hs("Stream read has already finished");return this.privReaderQueue.dequeue().then((e=>Rs(this,void 0,void 0,(function*(){return(void 0===e||e.isEnd)&&(yield this.privReaderQueue.dispose("End of stream reached")),e}))))},this.readEnded=()=>{this.privIsReadEnded||(this.privIsReadEnded=!0,this.privReaderQueue=new(0,xs.Queue))},this.throwIfClosed=()=>{if(this.privIsWriteEnded)throw new hs("Stream closed")},this.privId=e||Ba(),this.privReaderQueue=new(0,xs.Queue)}get isClosed(){return this.privIsWriteEnded}get isReadEnded(){return this.privIsReadEnded}get id(){return this.privId}close(){this.privIsWriteEnded||(this.writeStreamChunk({buffer:null,isEnd:!0,timeReceived:Date.now()}),this.privIsWriteEnded=!0)}writeStreamChunk(e){if(this.throwIfClosed(),!this.privReaderQueue.isDisposed())try{this.privReaderQueue.enqueue(e)}catch(e){}}}(Os=Is||(Is={}))[Os.Success=0]="Success",Os[Os.Error=1]="Error";class Ns extends Ts.Stream{constructor(e,t){super(t),this.privTargetChunkSize=e,this.privNextBufferReadyBytes=0}writeStreamChunk(e){if(e.isEnd||0===this.privNextBufferReadyBytes&&e.buffer.byteLength===this.privTargetChunkSize)return void super.writeStreamChunk(e);let t=0;for(;t<e.buffer.byteLength;){void 0===this.privNextBufferToWrite&&(this.privNextBufferToWrite=new ArrayBuffer(this.privTargetChunkSize),this.privNextBufferStartTime=e.timeReceived);const n=Math.min(e.buffer.byteLength-t,this.privTargetChunkSize-this.privNextBufferReadyBytes),r=new Uint8Array(this.privNextBufferToWrite),i=new Uint8Array(e.buffer.slice(t,n+t));r.set(i,this.privNextBufferReadyBytes),this.privNextBufferReadyBytes+=n,t+=n,this.privNextBufferReadyBytes===this.privTargetChunkSize&&(super.writeStreamChunk({buffer:this.privNextBufferToWrite,isEnd:!1,timeReceived:this.privNextBufferStartTime}),this.privNextBufferReadyBytes=0,this.privNextBufferToWrite=void 0)}}close(){0===this.privNextBufferReadyBytes||this.isClosed||super.writeStreamChunk({buffer:this.privNextBufferToWrite.slice(0,this.privNextBufferReadyBytes),isEnd:!1,timeReceived:this.privNextBufferStartTime}),super.close()}}class Ls{}Ls.workerTimers=null,Ls.clearTimeout=e=>Ls.timers().clearTimeout(e),Ls.setTimeout=(e,t)=>Ls.timers().setTimeout(e,t),Ls.load=e=>{const t=new Map([[0,()=>{}]]),n=new Map,r=new Worker(e);r.addEventListener("message",(({data:e})=>{if(Ls.isCallNotification(e)){const{params:{timerId:r}}=e,i=t.get(r);if("number"==typeof i){const e=n.get(i);if(void 0===e||e!==r)throw new Error("The timer is in an undefined state.")}else{if(void 0===i)throw new Error("The timer is in an undefined state.");i(),t.delete(r)}}else{if(!Ls.isClearResponse(e)){const{error:{message:t}}=e;throw new Error(t)}{const{id:r}=e,i=n.get(r);if(void 0===i)throw new Error("The timer is in an undefined state.");n.delete(r),t.delete(i)}}}));return{clearTimeout:e=>{const i=Math.random();n.set(i,e),t.set(e,i),r.postMessage({id:i,method:"clear",params:{timerId:e}})},setTimeout:(e,n)=>{const i=Math.random();return t.set(i,e),r.postMessage({id:null,method:"set",params:{delay:n,now:performance.now(),timerId:i}}),i}}},Ls.loadWorkerTimers=()=>()=>{if(null!==Ls.workerTimers)return Ls.workerTimers;const e=new Blob(['!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return u})),n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return d}));const r=new Map,o=new Map,i=e=>{const t=r.get(e);if(void 0===t)throw new Error(\'There is no interval scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(t),r.delete(e)},u=e=>{const t=o.get(e);if(void 0===t)throw new Error(\'There is no timeout scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(t),o.delete(e)},f=(e,t)=>{let n,r;if("performance"in self){const o=performance.now();n=o,r=e-Math.max(0,o-t)}else n=Date.now(),r=e;return{expected:n+r,remainingDelay:r}},c=(e,t,n,r)=>{const o="performance"in self?performance.now():Date.now();o>n?postMessage({id:null,method:"call",params:{timerId:t}}):e.set(t,setTimeout(c,n-o,e,t,n))},a=(e,t,n)=>{const{expected:o,remainingDelay:i}=f(e,n);r.set(t,setTimeout(c,i,r,t,o))},d=(e,t,n)=>{const{expected:r,remainingDelay:i}=f(e,n);o.set(t,setTimeout(c,i,o,t,r))}},function(e,t,n){"use strict";n.r(t);var r=n(2);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(3);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(4);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o);var f=n(5);for(var o in f)"default"!==o&&function(e){n.d(t,e,(function(){return f[e]}))}(o);var c=n(6);for(var o in c)"default"!==o&&function(e){n.d(t,e,(function(){return c[e]}))}(o);var a=n(7);for(var o in a)"default"!==o&&function(e){n.d(t,e,(function(){return a[e]}))}(o);var d=n(8);for(var o in d)"default"!==o&&function(e){n.d(t,e,(function(){return d[e]}))}(o);var s=n(9);for(var o in s)"default"!==o&&function(e){n.d(t,e,(function(){return s[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(11);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(12);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(13);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(1);for(var i in o)"default"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);var u=n(10);for(var i in u)"default"!==i&&function(e){n.d(t,e,(function(){return u[e]}))}(i);addEventListener("message",({data:e})=>{try{if("clear"===e.method){const{id:t,params:{timerId:n}}=e;Object(r.b)(n),postMessage({error:null,id:t})}else{if("set"!==e.method)throw new Error(\'The given method "\'.concat(e.method,\'" is not supported\'));{const{params:{delay:t,now:n,timerId:o}}=e;Object(r.d)(t,o,n)}}}catch(t){postMessage({error:{message:t.message},id:e.id,result:null})}})}]);'],{type:"application/javascript; charset=utf-8"}),t=URL.createObjectURL(e);return Ls.workerTimers=Ls.load(t),Ls.workerTimers.setTimeout((()=>URL.revokeObjectURL(t)),0),Ls.workerTimers},Ls.timers=Ls.loadWorkerTimers(),Ls.isCallNotification=e=>void 0!==e.method&&"call"===e.method,Ls.isClearResponse=e=>null===e.error&&"number"==typeof e.id;class Ds extends qa{constructor(e,t,n){super(e,t),this.privSignature=n}}class Bs extends Ds{constructor(e){super("OCSPMemoryCacheHitEvent",ja.Debug,e)}}class js extends Ds{constructor(e){super("OCSPCacheMissEvent",ja.Debug,e)}}class Fs extends Ds{constructor(e){super("OCSPDiskCacheHitEvent",ja.Debug,e)}}class Us extends Ds{constructor(e){super("OCSPCacheUpdateNeededEvent",ja.Debug,e)}}class zs extends Ds{constructor(e){super("OCSPMemoryCacheStoreEvent",ja.Debug,e)}}class Hs extends Ds{constructor(e){super("OCSPDiskCacheStoreEvent",ja.Debug,e)}}class Vs extends Ds{constructor(e){super("OCSPCacheUpdateCompleteEvent",ja.Debug,e)}}class Ws extends Ds{constructor(){super("OCSPStapleReceivedEvent",ja.Debug,"")}}class Gs extends Ds{constructor(e,t){super("OCSPCacheEntryExpiredEvent",ja.Debug,e),this.privExpireTime=t}}class qs extends Ds{constructor(e,t,n){super("OCSPCacheEntryNeedsRefreshEvent",ja.Debug,e),this.privExpireTime=n,this.privStartTime=t}}class Ks extends Ds{constructor(e,t,n){super("OCSPCacheHitEvent",ja.Debug,e),this.privExpireTime=n,this.privExpireTimeString=new Date(n).toLocaleDateString(),this.privStartTime=t,this.privStartTimeString=new Date(t).toLocaleTimeString()}}class Ys extends Ds{constructor(e,t){super("OCSPVerificationFailedEvent",ja.Debug,e),this.privError=t}}class Js extends Ds{constructor(e,t){super("OCSPCacheFetchErrorEvent",ja.Debug,e),this.privError=t}}class Qs extends Ds{constructor(e){super("OCSPResponseRetrievedEvent",ja.Debug,e)}}class Xs extends Ds{constructor(e,t){super("OCSPCacheUpdateErrorEvent",ja.Debug,e),this.privError=t}}class Zs extends qa{constructor(e){super("BackgroundEvent",ja.Error),this.privError=e}get error(){return this.privError}}var $s={};e($s,"MicAudioSource",(()=>vu),(e=>vu=e));class el{}el.AuthKey="Ocp-Apim-Subscription-Key",el.ConnectionId="X-ConnectionId",el.ContentType="Content-Type",el.CustomCommandsAppId="X-CommandsAppId",el.Path="Path",el.RequestId="X-RequestId",el.RequestStreamId="X-StreamId",el.RequestTimestamp="X-Timestamp";class tl{constructor(e,t){this.privHeaderName=e,this.privToken=t}get headerName(){return this.privHeaderName}get token(){return this.privToken}}class nl{constructor(e){if(this.fetch=e=>Promise.resolve(this.privAuthInfo),this.fetchOnExpiry=e=>Promise.resolve(this.privAuthInfo),!e)throw new fs("subscriptionKey");this.privAuthInfo=new tl(el.AuthKey,e)}}const rl="Authorization";class il{constructor(e,t){if(this.fetch=e=>this.privFetchCallback(e).then((e=>new tl(rl,il.privTokenPrefix+e))),this.fetchOnExpiry=e=>this.privFetchOnExpiryCallback(e).then((e=>new tl(rl,il.privTokenPrefix+e))),!e)throw new fs("fetchCallback");if(!t)throw new fs("fetchOnExpiryCallback");this.privFetchCallback=e,this.privFetchOnExpiryCallback=t}}il.privTokenPrefix="bearer ";var ol,al,sl,ll,cl,ul,dl={};e(dl,"ServiceRecognizerBase",(()=>_l),(e=>_l=e)),(al=ol||(ol={}))[al.Error=0]="Error",al[al.EndOfStream=1]="EndOfStream",(ll=sl||(sl={}))[ll.NoError=0]="NoError",ll[ll.AuthenticationFailure=1]="AuthenticationFailure",ll[ll.BadRequestParameters=2]="BadRequestParameters",ll[ll.TooManyRequests=3]="TooManyRequests",ll[ll.ConnectionFailure=4]="ConnectionFailure",ll[ll.ServiceTimeout=5]="ServiceTimeout",ll[ll.ServiceError=6]="ServiceError",ll[ll.RuntimeError=7]="RuntimeError",ll[ll.Forbidden=8]="Forbidden",(ul=cl||(cl={}))[ul.SpeechServiceConnection_Key=0]="SpeechServiceConnection_Key",ul[ul.SpeechServiceConnection_Endpoint=1]="SpeechServiceConnection_Endpoint",ul[ul.SpeechServiceConnection_Region=2]="SpeechServiceConnection_Region",ul[ul.SpeechServiceAuthorization_Token=3]="SpeechServiceAuthorization_Token",ul[ul.SpeechServiceAuthorization_Type=4]="SpeechServiceAuthorization_Type",ul[ul.SpeechServiceConnection_EndpointId=5]="SpeechServiceConnection_EndpointId",ul[ul.SpeechServiceConnection_TranslationToLanguages=6]="SpeechServiceConnection_TranslationToLanguages",ul[ul.SpeechServiceConnection_TranslationVoice=7]="SpeechServiceConnection_TranslationVoice",ul[ul.SpeechServiceConnection_TranslationFeatures=8]="SpeechServiceConnection_TranslationFeatures",ul[ul.SpeechServiceConnection_IntentRegion=9]="SpeechServiceConnection_IntentRegion",ul[ul.SpeechServiceConnection_ProxyHostName=10]="SpeechServiceConnection_ProxyHostName",ul[ul.SpeechServiceConnection_ProxyPort=11]="SpeechServiceConnection_ProxyPort",ul[ul.SpeechServiceConnection_ProxyUserName=12]="SpeechServiceConnection_ProxyUserName",ul[ul.SpeechServiceConnection_ProxyPassword=13]="SpeechServiceConnection_ProxyPassword",ul[ul.SpeechServiceConnection_RecoMode=14]="SpeechServiceConnection_RecoMode",ul[ul.SpeechServiceConnection_RecoLanguage=15]="SpeechServiceConnection_RecoLanguage",ul[ul.Speech_SessionId=16]="Speech_SessionId",ul[ul.SpeechServiceConnection_SynthLanguage=17]="SpeechServiceConnection_SynthLanguage",ul[ul.SpeechServiceConnection_SynthVoice=18]="SpeechServiceConnection_SynthVoice",ul[ul.SpeechServiceConnection_SynthOutputFormat=19]="SpeechServiceConnection_SynthOutputFormat",ul[ul.SpeechServiceConnection_AutoDetectSourceLanguages=20]="SpeechServiceConnection_AutoDetectSourceLanguages",ul[ul.SpeechServiceResponse_RequestDetailedResultTrueFalse=21]="SpeechServiceResponse_RequestDetailedResultTrueFalse",ul[ul.SpeechServiceResponse_RequestProfanityFilterTrueFalse=22]="SpeechServiceResponse_RequestProfanityFilterTrueFalse",ul[ul.SpeechServiceResponse_JsonResult=23]="SpeechServiceResponse_JsonResult",ul[ul.SpeechServiceResponse_JsonErrorDetails=24]="SpeechServiceResponse_JsonErrorDetails",ul[ul.CancellationDetails_Reason=25]="CancellationDetails_Reason",ul[ul.CancellationDetails_ReasonText=26]="CancellationDetails_ReasonText",ul[ul.CancellationDetails_ReasonDetailedText=27]="CancellationDetails_ReasonDetailedText",ul[ul.LanguageUnderstandingServiceResponse_JsonResult=28]="LanguageUnderstandingServiceResponse_JsonResult",ul[ul.SpeechServiceConnection_Url=29]="SpeechServiceConnection_Url",ul[ul.SpeechServiceConnection_InitialSilenceTimeoutMs=30]="SpeechServiceConnection_InitialSilenceTimeoutMs",ul[ul.SpeechServiceConnection_EndSilenceTimeoutMs=31]="SpeechServiceConnection_EndSilenceTimeoutMs",ul[ul.SpeechServiceConnection_EnableAudioLogging=32]="SpeechServiceConnection_EnableAudioLogging",ul[ul.SpeechServiceResponse_ProfanityOption=33]="SpeechServiceResponse_ProfanityOption",ul[ul.SpeechServiceResponse_PostProcessingOption=34]="SpeechServiceResponse_PostProcessingOption",ul[ul.SpeechServiceResponse_RequestWordLevelTimestamps=35]="SpeechServiceResponse_RequestWordLevelTimestamps",ul[ul.SpeechServiceResponse_StablePartialResultThreshold=36]="SpeechServiceResponse_StablePartialResultThreshold",ul[ul.SpeechServiceResponse_OutputFormatOption=37]="SpeechServiceResponse_OutputFormatOption",ul[ul.SpeechServiceResponse_TranslationRequestStablePartialResult=38]="SpeechServiceResponse_TranslationRequestStablePartialResult",ul[ul.Conversation_ApplicationId=39]="Conversation_ApplicationId",ul[ul.Conversation_DialogType=40]="Conversation_DialogType",ul[ul.Conversation_Initial_Silence_Timeout=41]="Conversation_Initial_Silence_Timeout",ul[ul.Conversation_From_Id=42]="Conversation_From_Id",ul[ul.Conversation_Conversation_Id=43]="Conversation_Conversation_Id",ul[ul.Conversation_Custom_Voice_Deployment_Ids=44]="Conversation_Custom_Voice_Deployment_Ids",ul[ul.Conversation_Speech_Activity_Template=45]="Conversation_Speech_Activity_Template",ul[ul.Conversation_Request_Bot_Status_Messages=46]="Conversation_Request_Bot_Status_Messages",ul[ul.Conversation_Agent_Connection_Id=47]="Conversation_Agent_Connection_Id",ul[ul.SpeechServiceConnection_Host=48]="SpeechServiceConnection_Host",ul[ul.ConversationTranslator_Host=49]="ConversationTranslator_Host",ul[ul.ConversationTranslator_Name=50]="ConversationTranslator_Name",ul[ul.ConversationTranslator_CorrelationId=51]="ConversationTranslator_CorrelationId",ul[ul.ConversationTranslator_Token=52]="ConversationTranslator_Token",ul[ul.PronunciationAssessment_ReferenceText=53]="PronunciationAssessment_ReferenceText",ul[ul.PronunciationAssessment_GradingSystem=54]="PronunciationAssessment_GradingSystem",ul[ul.PronunciationAssessment_Granularity=55]="PronunciationAssessment_Granularity",ul[ul.PronunciationAssessment_EnableMiscue=56]="PronunciationAssessment_EnableMiscue",ul[ul.PronunciationAssessment_Json=57]="PronunciationAssessment_Json",ul[ul.PronunciationAssessment_Params=58]="PronunciationAssessment_Params",ul[ul.SpeakerRecognition_Api_Version=59]="SpeakerRecognition_Api_Version";class fl{constructor(e){this.privSessionId=e}get sessionId(){return this.privSessionId}}class hl extends fl{constructor(e,t){super(t),this.privOffset=e}get offset(){return this.privOffset}}class pl extends ms{constructor(e,t,n,r,i,o,a,s){if(!t)throw new fs("path");if(!n)throw new fs("requestId");const l={};if(l[el.Path]=t,l[el.RequestId]=n,l[el.RequestTimestamp]=(new Date).toISOString(),r&&(l[el.ContentType]=r),o&&(l[el.RequestStreamId]=o),a)for(const e in a)e&&(l[e]=a[e]);s?super(e,i,l,s):super(e,i,l),this.privPath=t,this.privRequestId=n,this.privContentType=r,this.privStreamId=o,this.privAdditionalHeaders=a}get path(){return this.privPath}get requestId(){return this.privRequestId}get contentType(){return this.privContentType}get streamId(){return this.privStreamId}get additionalHeaders(){return this.privAdditionalHeaders}}pl.fromConnectionMessage=e=>{let t=null,n=null,r=null,i=null,o=null;const a={};if(e.headers)for(const s in e.headers)s&&(s.toLowerCase()===el.Path.toLowerCase()?t=e.headers[s]:s.toLowerCase()===el.RequestId.toLowerCase()?n=e.headers[s]:s.toLowerCase()===el.RequestTimestamp.toLowerCase()?i=e.headers[s]:s.toLowerCase()===el.ContentType.toLowerCase()?r=e.headers[s]:s.toLowerCase()===el.RequestStreamId.toLowerCase()?o=e.headers[s]:a[s]=e.headers[s]);return new pl(e.messageType,t,n,r,e.body,o,a,e.id)};var ml,gl,vl,yl,bl,wl,xl,Sl,Ml=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class _l{constructor(e,t,n,r,i){if(this.privSetTimeout=setTimeout,this.privIsLiveAudio=!1,this.recognizeOverride=void 0,this.disconnectOverride=void 0,this.receiveMessageOverride=void 0,this.sendSpeechContext=e=>{const t=this.speechContext.toJSON();if(this.privRequestSession.onSpeechContext(),t)return e.send(new pl(Ua.Text,"speech.context",this.privRequestSession.requestId,"application/json",t))},this.sendPrePayloadJSONOverride=void 0,this.postConnectImplOverride=void 0,this.configConnectionOverride=void 0,this.sendSpeechServiceConfig=(e,t,n)=>{if(!0!==_l.telemetryDataEnabled){const e={context:{system:JSON.parse(n).context.system}};n=JSON.stringify(e)}if("true"===this.privRecognizerConfig.parameters.getProperty("TranscriptionService_SingleChannel","false").toLowerCase()){const e=JSON.parse(n);e.context.DisableReferenceChannel="True",e.context.MicSpec="1_0_0",n=JSON.stringify(e)}if(n)return e.send(new pl(Ua.Text,"speech.config",t.requestId,"application/json",n))},!e)throw new fs("authentication");if(!t)throw new fs("connectionFactory");if(!n)throw new fs("audioSource");if(!r)throw new fs("recognizerConfig");this.privMustReportEndOfStream=!1,this.privAuthentication=e,this.privConnectionFactory=t,this.privAudioSource=n,this.privRecognizerConfig=r,this.privIsDisposed=!1,this.privRecognizer=i,this.privRequestSession=new(0,ac.RequestSession)(this.privAudioSource.id()),this.privConnectionEvents=new vs,this.privServiceEvents=new vs,this.privDynamicGrammar=new Mc,this.privSpeechContext=new Sc(this.privDynamicGrammar),this.privAgentConfig=new zc,"undefined"!=typeof Blob&&"undefined"!=typeof Worker&&(this.privSetTimeout=Ls.setTimeout),this.connectionEvents.attach((e=>Ml(this,void 0,void 0,(function*(){if("ConnectionClosedEvent"===e.name){const t=e;(1003===t.statusCode||1007===t.statusCode||1002===t.statusCode||4e3===t.statusCode||this.privRequestSession.numConnectionAttempts>this.privRecognizerConfig.maxRetryCount)&&(yield this.cancelRecognitionLocal(ol.Error,1007===t.statusCode?sl.BadRequestParameters:sl.ConnectionFailure,t.reason+" websocket error code: "+t.statusCode))}}))))}get audioSource(){return this.privAudioSource}get speechContext(){return this.privSpeechContext}get dynamicGrammar(){return this.privDynamicGrammar}get agentConfig(){return this.privAgentConfig}set conversationTranslatorToken(e){this.privRecognizerConfig.parameters.setProperty(cl.ConversationTranslator_Token,e)}set authentication(e){this.privAuthentication=this.authentication}isDisposed(){return this.privIsDisposed}dispose(e){return Ml(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,this.privConnectionConfigurationPromise)try{const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}catch(e){return}}))}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}get recognitionMode(){return this.privRecognizerConfig.recognitionMode}recognize(e,t,n){return Ml(this,void 0,void 0,(function*(){if(void 0!==this.recognizeOverride)return this.recognizeOverride(e,t,n);this.privConnectionConfigurationPromise=null,this.privRecognizerConfig.recognitionMode=e,this.privSuccessCallback=t,this.privErrorCallback=n,this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events);const r=this.connectImpl();let i;try{const e=yield this.audioSource.attach(this.privRequestSession.audioNodeId),t=yield this.audioSource.format,n=yield this.audioSource.deviceInfo;this.privIsLiveAudio=n.type&&n.type===xl.Microphones,i=new nd(e,t.avgBytesPerSec),yield this.privRequestSession.onAudioSourceAttachCompleted(i,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:n}}catch(e){throw yield this.privRequestSession.onStopRecognizing(),e}try{yield r}catch(e){return void(yield this.cancelRecognitionLocal(ol.Error,sl.ConnectionFailure,e))}const o=new fl(this.privRequestSession.sessionId);this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,o);this.receiveMessage();this.sendAudio(i).catch((e=>Ml(this,void 0,void 0,(function*(){yield this.cancelRecognitionLocal(ol.Error,sl.RuntimeError,e)}))))}))}stopRecognizing(){return Ml(this,void 0,void 0,(function*(){if(this.privRequestSession.isRecognizing)try{yield this.audioSource.turnOff(),yield this.sendFinalAudio(),yield this.privRequestSession.onStopRecognizing(),yield this.privRequestSession.turnCompletionPromise}finally{yield this.privRequestSession.dispose()}}))}connect(){return Ml(this,void 0,void 0,(function*(){return yield this.connectImpl(),Promise.resolve()}))}connectAsync(e,t){this.connectImpl().then((n=>{try{e&&e()}catch(e){t&&t(e)}}),(e=>{try{t&&t(e)}catch(e){}}))}disconnect(){return Ml(this,void 0,void 0,(function*(){yield this.cancelRecognitionLocal(ol.Error,sl.NoError,"Disconnecting"),void 0!==this.disconnectOverride&&(yield this.disconnectOverride());try{yield(yield this.privConnectionPromise).dispose()}catch(e){}this.privConnectionPromise=null}))}sendMessage(e){}sendNetworkMessage(e,t){return Ml(this,void 0,void 0,(function*(){const n="string"==typeof t?Ua.Text:Ua.Binary,r="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new pl(n,e,this.privRequestSession.requestId,r,t))}))}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}sendTelemetryData(){return Ml(this,void 0,void 0,(function*(){const e=this.privRequestSession.getTelemetry();if(!0!==_l.telemetryDataEnabled||this.privIsDisposed||null===e)return;if(_l.telemetryData)try{_l.telemetryData(e)}catch(e){}const t=yield this.fetchConnection();yield t.send(new pl(Ua.Text,"telemetry",this.privRequestSession.requestId,"application/json",e))}))}cancelRecognitionLocal(e,t,n){return Ml(this,void 0,void 0,(function*(){this.privRequestSession.isRecognizing&&(yield this.privRequestSession.onStopRecognizing(),this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,e,t,n))}))}receiveMessage(){return Ml(this,void 0,void 0,(function*(){try{if(this.privIsDisposed)return;let e=yield this.fetchConnection();const t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(!t)return this.privRequestSession.isRecognizing?this.receiveMessage():void 0;this.privServiceHasSentMessage=!0;const n=pl.fromConnectionMessage(t);if(n.requestId.toLowerCase()===this.privRequestSession.requestId.toLowerCase())switch(n.path.toLowerCase()){case"turn.start":this.privMustReportEndOfStream=!0,this.privRequestSession.onServiceTurnStartResponse();break;case"speech.startdetected":const t=Yl.fromJSON(n.textBody),r=new hl(t.Offset,this.privRequestSession.sessionId);this.privRecognizer.speechStartDetected&&this.privRecognizer.speechStartDetected(this.privRecognizer,r);break;case"speech.enddetected":let i;i=n.textBody.length>0?n.textBody:"{ Offset: 0 }";const o=Yl.fromJSON(i);this.privRecognizerConfig.isContinuousRecognition&&this.privRequestSession.onServiceRecognized(o.Offset+this.privRequestSession.currentTurnAudioOffset);const a=new hl(o.Offset+this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId);this.privRecognizer.speechEndDetected&&this.privRecognizer.speechEndDetected(this.privRecognizer,a);break;case"turn.end":yield this.sendTelemetryData(),this.privRequestSession.isSpeechEnded&&this.privMustReportEndOfStream&&(this.privMustReportEndOfStream=!1,yield this.cancelRecognitionLocal(ol.EndOfStream,sl.NoError,void 0));const s=new fl(this.privRequestSession.sessionId);if(yield this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition),!this.privRecognizerConfig.isContinuousRecognition||this.privRequestSession.isSpeechEnded||!this.privRequestSession.isRecognizing)return void(this.privRecognizer.sessionStopped&&this.privRecognizer.sessionStopped(this.privRecognizer,s));e=yield this.fetchConnection(),yield this.sendPrePayloadJSON(e);break;default:(yield this.processTypeSpecificMessages(n))||this.privServiceEvents&&this.serviceEvents.onEvent(new rs(n.path.toLowerCase(),n.textBody))}return this.receiveMessage()}catch(e){return null}}))}sendPrePayloadJSON(e){return Ml(this,void 0,void 0,(function*(){if(void 0!==this.sendPrePayloadJSONOverride)return this.sendPrePayloadJSONOverride(e);yield this.sendSpeechContext(e),yield this.sendWaveHeader(e)}))}sendWaveHeader(e){return Ml(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;return e.send(new pl(Ua.Binary,"audio",this.privRequestSession.requestId,"audio/x-wav",t.header))}))}connectImpl(){return this.privConnectionPromise?this.privConnectionPromise.then((e=>e.state()===Ha.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=null,this.privServiceHasSentMessage=!1,this.connectImpl()):this.privConnectionPromise),(e=>(this.privConnectionId=null,this.privConnectionPromise=null,this.privServiceHasSentMessage=!1,this.connectImpl()))):(this.privConnectionPromise=this.retryableConnect(),this.privConnectionPromise.catch((()=>{})),void 0!==this.postConnectImplOverride?this.postConnectImplOverride(this.privConnectionPromise):this.privConnectionPromise)}fetchConnection(){return Ml(this,void 0,void 0,(function*(){return this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===Ha.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=null,this.privServiceHasSentMessage=!1,this.fetchConnection()):this.privConnectionConfigurationPromise),(e=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=null,this.privServiceHasSentMessage=!1,this.fetchConnection()))):(this.privConnectionConfigurationPromise=this.configureConnection(),yield this.privConnectionConfigurationPromise)}))}sendAudio(e){return Ml(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;let n=Date.now();const r=this.privRecognizerConfig.parameters.getProperty("SPEECH-TransmitLengthBeforThrottleMs","5000"),i=t.avgBytesPerSec/1e3*parseInt(r,10),o=this.privRequestSession.recogNumber,a=()=>Ml(this,void 0,void 0,(function*(){if(!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===o){const r=yield this.fetchConnection(),s=yield e.read();if(this.privRequestSession.isSpeechEnded)return;let l,c;if(!s||s.isEnd?(l=null,c=0):(l=s.buffer,this.privRequestSession.onAudioSent(l.byteLength),c=i>=this.privRequestSession.bytesSent?0:Math.max(0,n-Date.now())),0!==c&&(yield this.delay(c)),null!==l&&(n=Date.now()+1e3*l.byteLength/(2*t.avgBytesPerSec)),!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===o){if(r.send(new pl(Ua.Binary,"audio",this.privRequestSession.requestId,null,l)).catch((()=>{this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition).catch((()=>{}))})),!(null==s?void 0:s.isEnd))return a();this.privIsLiveAudio||this.privRequestSession.onSpeechEnded()}}}));return a()}))}retryableConnect(){return Ml(this,void 0,void 0,(function*(){let e=!1;this.privAuthFetchEventId=Ba();const t=this.privRequestSession.sessionId;this.privConnectionId=void 0!==t?t:Ba(),this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId,this.privConnectionId);let n=0,r="";for(;this.privRequestSession.numConnectionAttempts<=this.privRecognizerConfig.maxRetryCount;){const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId),i=yield t;yield this.privRequestSession.onAuthCompleted(!1);const o=this.privConnectionFactory.create(this.privRecognizerConfig,i,this.privConnectionId);this.privRequestSession.listenForServiceTelemetry(o.events),o.events.attach((e=>{this.connectionEvents.onEvent(e)}));const a=yield o.open();if(200===a.statusCode)return yield this.privRequestSession.onConnectionEstablishCompleted(a.statusCode),Promise.resolve(o);1006===a.statusCode&&(e=!0),n=a.statusCode,r=a.reason,this.privRequestSession.onRetryConnection()}return yield this.privRequestSession.onConnectionEstablishCompleted(n,r),Promise.reject(`Unable to contact server. StatusCode: ${n}, ${this.privRecognizerConfig.parameters.getProperty(cl.SpeechServiceConnection_Endpoint)} Reason: ${r}`)}))}delay(e){return new Promise(((t,n)=>{this.privSetTimeout(t,e)}))}writeBufferToConsole(e){let t="Buffer Size: ";if(null===e)t+="null";else{const n=new Uint8Array(e);t+=e.byteLength+"\r\n";for(let r=0;r<e.byteLength;r++)t+=n[r].toString(16).padStart(2,"0")+" "}console.info(t)}sendFinalAudio(){return Ml(this,void 0,void 0,(function*(){const e=yield this.fetchConnection();yield e.send(new pl(Ua.Binary,"audio",this.privRequestSession.requestId,null,null))}))}configureConnection(){return Ml(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privRequestSession,this.privRecognizerConfig.SpeechServiceConfig.serialize()),yield this.sendPrePayloadJSON(e),e)}))}}_l.telemetryDataEnabled=!0,(gl=ml||(ml={}))[gl.Interactive=0]="Interactive",gl[gl.Conversation=1]="Conversation",gl[gl.Dictation=2]="Dictation",(yl=vl||(vl={}))[yl.Simple=0]="Simple",yl[yl.Detailed=1]="Detailed";class Al{constructor(e,t){this.privRecognitionMode=ml.Interactive,this.privSpeechServiceConfig=e||new El(new Cl(null)),this.privParameters=t,this.privMaxRetryCount=parseInt(t.getProperty("SPEECH-Error-MaxRetryCount","4"),10)}get parameters(){return this.privParameters}get recognitionMode(){return this.privRecognitionMode}set recognitionMode(e){this.privRecognitionMode=e,this.privRecognitionActivityTimeout=e===ml.Interactive?8e3:25e3,this.privSpeechServiceConfig.Recognition=ml[e]}get SpeechServiceConfig(){return this.privSpeechServiceConfig}get recognitionActivityTimeout(){return this.privRecognitionActivityTimeout}get isContinuousRecognition(){return this.privRecognitionMode!==ml.Interactive}get autoDetectSourceLanguages(){return this.parameters.getProperty(cl.SpeechServiceConnection_AutoDetectSourceLanguages,void 0)}get maxRetryCount(){return this.privMaxRetryCount}}class El{constructor(e){this.serialize=()=>JSON.stringify(this,((e,t)=>{if(t&&"object"==typeof t){const e={};for(const n in t)Object.hasOwnProperty.call(t,n)&&(e[n&&n.charAt(0).toLowerCase()+n.substring(1)]=t[n]);return e}return t})),this.context=e}get Context(){return this.context}get Recognition(){return this.recognition}set Recognition(e){this.recognition=e.toLowerCase()}}class Cl{constructor(e){this.system=new kl,this.os=e}}class kl{constructor(){this.name="SpeechSDK",this.version="1.20.0",this.build="JavaScript",this.lang="JavaScript"}}class Tl{constructor(e,t,n){this.platform=e,this.name=t,this.version=n}}(wl=bl||(bl={})).Bluetooth="Bluetooth",wl.Wired="Wired",wl.WiFi="WiFi",wl.Cellular="Cellular",wl.InBuilt="InBuilt",wl.Unknown="Unknown",(Sl=xl||(xl={})).Phone="Phone",Sl.Speaker="Speaker",Sl.Car="Car",Sl.Headset="Headset",Sl.Thermostat="Thermostat",Sl.Microphones="Microphones",Sl.Deskphone="Deskphone",Sl.RemoteControl="RemoteControl",Sl.Unknown="Unknown",Sl.File="File",Sl.Stream="Stream";class Il{constructor(){this.toConnectionMessage=e=>{const t=new bs;try{if(e.messageType===Ua.Text){const n=e.textContent;let r={},i=null;if(n){const e=n.split("\r\n\r\n");e&&e.length>0&&(r=this.parseHeaders(e[0]),e.length>1&&(i=e[1]))}t.resolve(new ms(e.messageType,i,r,e.id))}else if(e.messageType===Ua.Binary){const n=e.binaryContent;let r={},i=null;if(!n||n.byteLength<2)throw new Error("Invalid binary message format. Header length missing.");const o=new DataView(n),a=o.getInt16(0);if(n.byteLength<a+2)throw new Error("Invalid binary message format. Header content missing.");let s="";for(let e=0;e<a;e++)s+=String.fromCharCode(o.getInt8(e+2));r=this.parseHeaders(s),n.byteLength>a+2&&(i=n.slice(2+a)),t.resolve(new ms(e.messageType,i,r,e.id))}}catch(e){t.reject(`Error formatting the message. Error: ${e}`)}return t.promise},this.fromConnectionMessage=e=>{const t=new bs;try{if(e.messageType===Ua.Text){const n=`${this.makeHeaders(e)}\r\n${e.textBody?e.textBody:""}`;t.resolve(new Cs(Ua.Text,n,e.id))}else if(e.messageType===Ua.Binary){const n=this.makeHeaders(e),r=e.binaryBody,i=this.stringToArrayBuffer(n),o=new Int8Array(i),a=o.byteLength,s=new Int8Array(2+a+(r?r.byteLength:0));if(s[0]=a>>8&255,s[1]=255&a,s.set(o,2),r){const e=new Int8Array(r);s.set(e,2+a)}const l=s.buffer;t.resolve(new Cs(Ua.Binary,l,e.id))}}catch(e){t.reject(`Error formatting the message. ${e}`)}return t.promise},this.makeHeaders=e=>{let t="";if(e.headers)for(const n in e.headers)n&&(t+=`${n}: ${e.headers[n]}\r\n`);return t},this.parseHeaders=e=>{const t={};if(e){const n=e.match(/[^\r\n]+/g);if(t)for(const e of n)if(e){const n=e.indexOf(":"),r=n>0?e.substr(0,n).trim().toLowerCase():e,i=n>0&&e.length>n+1?e.substr(n+1).trim():"";t[r]=i}}return t},this.stringToArrayBuffer=e=>{const t=new ArrayBuffer(e.length),n=new DataView(t);for(let t=0;t<e.length;t++)n.setUint8(t,e.charCodeAt(t));return t}}}var Ol,Rl,Pl,Nl,Ll,Dl,Bl,jl;(Rl=Ol||(Ol={}))[Rl.Simple=0]="Simple",Rl[Rl.Detailed=1]="Detailed";class Fl{}Fl.BotId="botid",Fl.CustomSpeechDeploymentId="cid",Fl.CustomVoiceDeploymentId="deploymentId",Fl.EnableAudioLogging="storeAudio",Fl.EnableLanguageId="lidEnabled",Fl.EnableWordLevelTimestamps="wordLevelTimestamps",Fl.EndSilenceTimeoutMs="endSilenceTimeoutMs",Fl.Format="format",Fl.InitialSilenceTimeoutMs="initialSilenceTimeoutMs",Fl.Language="language",Fl.Profanity="profanity",Fl.RequestBotStatusMessages="enableBotMessageStatus",Fl.StableIntermediateThreshold="stableIntermediateThreshold",Fl.StableTranslation="stableTranslation",Fl.TestHooks="testhooks";class Ul{static getHostSuffix(e){if(e){if(e.toLowerCase().startsWith("china"))return".azure.cn";if(e.toLowerCase().startsWith("usgov"))return".azure.us"}return".microsoft.com"}setCommonUrlParams(e,t,n){this.setUrlParameter(cl.SpeechServiceConnection_EnableAudioLogging,Fl.EnableAudioLogging,e,t,n),this.setUrlParameter(cl.SpeechServiceResponse_RequestWordLevelTimestamps,Fl.EnableWordLevelTimestamps,e,t,n),this.setUrlParameter(cl.SpeechServiceResponse_ProfanityOption,Fl.Profanity,e,t,n),this.setUrlParameter(cl.SpeechServiceConnection_InitialSilenceTimeoutMs,Fl.InitialSilenceTimeoutMs,e,t,n),this.setUrlParameter(cl.SpeechServiceConnection_EndSilenceTimeoutMs,Fl.EndSilenceTimeoutMs,e,t,n),this.setUrlParameter(cl.SpeechServiceResponse_StablePartialResultThreshold,Fl.StableIntermediateThreshold,e,t,n);const r=JSON.parse(e.parameters.getProperty(pu,"{}"));Object.keys(r).forEach(((e,n,i)=>{t[e]=r[e]}))}setUrlParameter(e,t,n,r,i){const o=n.parameters.getProperty(e,void 0);!o||i&&-1!==i.search(t)||(r[t]=o.toLocaleLowerCase())}}class zl extends Ul{constructor(){super(...arguments),this.interactiveRelativeUri="/speech/recognition/interactive/cognitiveservices/v1",this.conversationRelativeUri="/speech/recognition/conversation/cognitiveservices/v1",this.dictationRelativeUri="/speech/recognition/dictation/cognitiveservices/v1",this.create=(e,t,n)=>{let r=e.parameters.getProperty(cl.SpeechServiceConnection_Endpoint,void 0);const i=e.parameters.getProperty(cl.SpeechServiceConnection_Region,void 0),o=Ul.getHostSuffix(i),a=e.parameters.getProperty(cl.SpeechServiceConnection_Host,"wss://"+i+".stt.speech"+o),s={},l=e.parameters.getProperty(cl.SpeechServiceConnection_EndpointId,void 0),c=e.parameters.getProperty(cl.SpeechServiceConnection_RecoLanguage,void 0);if(l?r&&-1!==r.search(Fl.CustomSpeechDeploymentId)||(s[Fl.CustomSpeechDeploymentId]=l):c&&(r&&-1!==r.search(Fl.Language)||(s[Fl.Language]=c)),r&&-1!==r.search(Fl.Format)||(s[Fl.Format]=e.parameters.getProperty(fu,Ol[Ol.Simple]).toLowerCase()),void 0!==e.autoDetectSourceLanguages&&(s[Fl.EnableLanguageId]="true"),this.setCommonUrlParams(e,s,r),!r)switch(e.recognitionMode){case ml.Conversation:r="true"===e.parameters.getProperty(mu,"false")?a+this.dictationRelativeUri:a+this.conversationRelativeUri;break;case ml.Dictation:r=a+this.dictationRelativeUri;break;default:r=a+this.interactiveRelativeUri}const u={};void 0!==t.token&&""!==t.token&&(u[t.headerName]=t.token),u[el.ConnectionId]=n,e.parameters.setProperty(cl.SpeechServiceConnection_Url,r);const d="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false");return new(0,Su.WebsocketConnection)(r,s,u,new Il,id.fromRecognizerConfig(e),d,n)}}}class Hl{constructor(){this.synthesisUri="/cognitiveservices/websocket/v1",this.create=(e,t,n)=>{let r=e.parameters.getProperty(cl.SpeechServiceConnection_Endpoint,void 0);const i=e.parameters.getProperty(cl.SpeechServiceConnection_Region,void 0),o=Ul.getHostSuffix(i),a=e.parameters.getProperty(cl.SpeechServiceConnection_EndpointId,void 0),s=void 0===a?"tts":"voice",l=e.parameters.getProperty(cl.SpeechServiceConnection_Host,"wss://"+i+"."+s+".speech"+o);r||(r=l+this.synthesisUri);const c={};void 0!==t.token&&""!==t.token&&(c[t.headerName]=t.token),c[el.ConnectionId]=n,void 0!==a&&(c[Fl.CustomVoiceDeploymentId]=a),e.parameters.setProperty(cl.SpeechServiceConnection_Url,r);const u="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false");return new(0,Su.WebsocketConnection)(r,{},c,new Il,id.fromParameters(e.parameters),u,n)}}}(Nl=Pl||(Pl={}))[Nl.NoMatch=0]="NoMatch",Nl[Nl.Canceled=1]="Canceled",Nl[Nl.RecognizingSpeech=2]="RecognizingSpeech",Nl[Nl.RecognizedSpeech=3]="RecognizedSpeech",Nl[Nl.RecognizedKeyword=4]="RecognizedKeyword",Nl[Nl.RecognizingIntent=5]="RecognizingIntent",Nl[Nl.RecognizedIntent=6]="RecognizedIntent",Nl[Nl.TranslatingSpeech=7]="TranslatingSpeech",Nl[Nl.TranslatedSpeech=8]="TranslatedSpeech",Nl[Nl.SynthesizingAudio=9]="SynthesizingAudio",Nl[Nl.SynthesizingAudioCompleted=10]="SynthesizingAudioCompleted",Nl[Nl.SynthesizingAudioStarted=11]="SynthesizingAudioStarted",Nl[Nl.EnrollingVoiceProfile=12]="EnrollingVoiceProfile",Nl[Nl.EnrolledVoiceProfile=13]="EnrolledVoiceProfile",Nl[Nl.RecognizedSpeakers=14]="RecognizedSpeakers",Nl[Nl.RecognizedSpeaker=15]="RecognizedSpeaker",Nl[Nl.ResetVoiceProfile=16]="ResetVoiceProfile",Nl[Nl.DeletedVoiceProfile=17]="DeletedVoiceProfile",Nl[Nl.VoicesListRetrieved=18]="VoicesListRetrieved";class Vl{static implTranslateRecognitionResult(e){let t=Pl.Canceled;switch(e){case Bl.Success:t=Pl.RecognizedSpeech;break;case Bl.NoMatch:case Bl.InitialSilenceTimeout:case Bl.BabbleTimeout:case Bl.EndOfDictation:t=Pl.NoMatch;break;case Bl.Error:case Bl.BadRequest:case Bl.Forbidden:default:t=Pl.Canceled}return t}static implTranslateCancelResult(e){let t=ol.EndOfStream;switch(e){case Bl.Success:case Bl.EndOfDictation:case Bl.NoMatch:t=ol.EndOfStream;break;case Bl.InitialSilenceTimeout:case Bl.BabbleTimeout:case Bl.Error:case Bl.BadRequest:case Bl.Forbidden:default:t=ol.Error}return t}static implTranslateCancelErrorCode(e){let t=sl.NoError;switch(e){case Bl.Error:t=sl.ServiceError;break;case Bl.TooManyRequests:t=sl.TooManyRequests;break;case Bl.BadRequest:t=sl.BadRequestParameters;break;case Bl.Forbidden:t=sl.Forbidden;break;default:t=sl.NoError}return t}static implTranslateErrorDetails(e){let t="The speech service encountered an internal error and could not continue.";switch(e){case sl.Forbidden:t="The recognizer is using a free subscription that ran out of quota.";break;case sl.BadRequestParameters:t="Invalid parameter or unsupported audio format in the request.";break;case sl.TooManyRequests:t="The number of parallel requests exceeded the number of allowed concurrent transcriptions."}return t}}(Dl=Ll||(Ll={}))[Dl.Success=0]="Success",Dl[Dl.SynthesisEnd=1]="SynthesisEnd",Dl[Dl.Error=2]="Error",(jl=Bl||(Bl={}))[jl.Success=0]="Success",jl[jl.NoMatch=1]="NoMatch",jl[jl.InitialSilenceTimeout=2]="InitialSilenceTimeout",jl[jl.BabbleTimeout=3]="BabbleTimeout",jl[jl.Error=4]="Error",jl[jl.EndOfDictation=5]="EndOfDictation",jl[jl.TooManyRequests=6]="TooManyRequests",jl[jl.BadRequest=7]="BadRequest",jl[jl.Forbidden=8]="Forbidden";class Wl{static throwIfNullOrUndefined(e,t){if(null==e)throw new Error("throwIfNullOrUndefined:"+t)}static throwIfNull(e,t){if(null===e)throw new Error("throwIfNull:"+t)}static throwIfNullOrWhitespace(e,t){if(Wl.throwIfNullOrUndefined(e,t),(""+e).trim().length<1)throw new Error("throwIfNullOrWhitespace:"+t)}static throwIfDisposed(e){if(e)throw new Error("the object is already disposed")}static throwIfArrayEmptyOrWhitespace(e,t){if(Wl.throwIfNullOrUndefined(e,t),0===e.length)throw new Error("throwIfArrayEmptyOrWhitespace:"+t);for(const n of e)Wl.throwIfNullOrWhitespace(n,t)}static throwIfFileDoesNotExist(e,t){Wl.throwIfNullOrWhitespace(e,t)}static throwIfNotUndefined(e,t){if(void 0!==e)throw new Error("throwIfNotUndefined:"+t)}}class Gl{constructor(){this.privKeys=[],this.privValues=[]}getProperty(e,t){let n;n="string"==typeof e?e:cl[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===n)return this.privValues[e];return t}setProperty(e,t){let n;n="string"==typeof e?e:cl[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===n)return void(this.privValues[e]=t);this.privKeys.push(n),this.privValues.push(t)}clone(){const e=new Gl;for(let t=0;t<this.privKeys.length;t++)e.privKeys.push(this.privKeys[t]),e.privValues.push(this.privValues[t]);return e}mergeTo(e){this.privKeys.forEach((t=>{if(void 0===e.getProperty(t,void 0)){const n=this.getProperty(t);e.setProperty(t,n)}}))}get keys(){return this.privKeys}}class ql{constructor(e,t,n,r,i,o,a,s,l,c){this.privResultId=e,this.privReason=t,this.privText=n,this.privDuration=r,this.privOffset=i,this.privLanguage=o,this.privLanguageDetectionConfidence=a,this.privErrorDetails=s,this.privJson=l,this.privProperties=c}get resultId(){return this.privResultId}get reason(){return this.privReason}get text(){return this.privText}get duration(){return this.privDuration}get offset(){return this.privOffset}get language(){return this.privLanguage}get languageDetectionConfidence(){return this.privLanguageDetectionConfidence}get errorDetails(){return this.privErrorDetails}get json(){return this.privJson}get properties(){return this.privProperties}}class Kl extends ql{constructor(e,t,n,r,i,o,a,s,l,c,u){super(e,t,n,r,i,o,a,l,c,u),this.privSpeakerId=s}get speakerId(){return this.privSpeakerId}}class Yl{constructor(e){this.privSpeechStartDetected=JSON.parse(e)}static fromJSON(e){return new Yl(e)}get Offset(){return this.privSpeechStartDetected.Offset}}class Jl{constructor(e){this.privSpeechHypothesis=JSON.parse(e)}static fromJSON(e){return new Jl(e)}get Text(){return this.privSpeechHypothesis.Text}get Offset(){return this.privSpeechHypothesis.Offset}get Duration(){return this.privSpeechHypothesis.Duration}get Language(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSpeechHypothesis.SpeakerId}}var Ql={};e(Ql,"SpeechServiceRecognizer",(()=>tc),(e=>tc=e));class Xl extends hl{constructor(e,t,n){super(t,n),this.privResult=e}get result(){return this.privResult}}class Zl extends hl{constructor(e,t,n,r,i){super(r,i),this.privReason=e,this.privErrorDetails=t,this.privErrorCode=n}get reason(){return this.privReason}get errorCode(){return this.privErrorCode}get errorDetails(){return this.privErrorDetails}}class $l extends Zl{}var ec=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class tc extends dl.ServiceRecognizerBase{constructor(e,t,n,r,i){if(super(e,t,n,r,i),this.privSpeechRecognizer=i,void 0!==r.autoDetectSourceLanguages){const e=r.autoDetectSourceLanguages.split(",");this.privSpeechContext.setSection("languageId",{languages:e,onSuccess:{action:"Recognize"},onUnknown:{action:"None"}}),this.privSpeechContext.setSection("phraseOutput",{interimResults:{resultType:"Auto"},phraseResults:{resultType:"Always"}})}}processTypeSpecificMessages(e){return ec(this,void 0,void 0,(function*(){let t;const n=new Gl;n.setProperty(cl.SpeechServiceResponse_JsonResult,e.textBody);let r=!1;switch(e.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":const i=Jl.fromJSON(e.textBody),o=i.Offset+this.privRequestSession.currentTurnAudioOffset;t=new Kl(this.privRequestSession.requestId,Pl.RecognizingSpeech,i.Text,i.Duration,o,i.Language,i.LanguageDetectionConfidence,void 0,void 0,e.textBody,n),this.privRequestSession.onHypothesis(o);const a=new Xl(t,i.Duration,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognizing)try{this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer,a)}catch(e){}r=!0;break;case"speech.phrase":const s=rc.fromJSON(e.textBody),l=Vl.implTranslateRecognitionResult(s.RecognitionStatus);if(this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset+s.Offset+s.Duration),Pl.Canceled===l){const e=Vl.implTranslateCancelResult(s.RecognitionStatus),t=Vl.implTranslateCancelErrorCode(s.RecognitionStatus);yield this.cancelRecognitionLocal(e,t,Vl.implTranslateErrorDetails(t))}else{if(!this.privRequestSession.isSpeechEnded||l!==Pl.NoMatch||s.RecognitionStatus===Bl.InitialSilenceTimeout){if(this.privRecognizerConfig.parameters.getProperty(fu)===Ol[Ol.Simple])t=new Kl(this.privRequestSession.requestId,l,s.DisplayText,s.Duration,s.Offset+this.privRequestSession.currentTurnAudioOffset,s.Language,s.LanguageDetectionConfidence,void 0,void 0,e.textBody,n);else{const r=nc.fromJSON(e.textBody),i=r.Offset+this.privRequestSession.currentTurnAudioOffset,o=r.getJsonWithCorrectedOffsets(i);t=new Kl(this.privRequestSession.requestId,l,r.RecognitionStatus===Bl.Success?r.NBest[0].Display:void 0,r.Duration,i,r.Language,r.LanguageDetectionConfidence,void 0,void 0,o,n)}const r=new Xl(t,t.offset,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognized)try{this.privSpeechRecognizer.recognized(this.privSpeechRecognizer,r)}catch(e){}}if(this.privSuccessCallback){try{this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}r=!0}return r}))}cancelRecognition(e,t,n,r,i){const o=new Gl;if(o.setProperty(hu,sl[r]),this.privSpeechRecognizer.canceled){const t=new $l(n,i,r,void 0,e);try{this.privSpeechRecognizer.canceled(this.privSpeechRecognizer,t)}catch(e){}}if(this.privSuccessCallback){const e=new Kl(t,Pl.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,i,void 0,o);try{this.privSuccessCallback(e),this.privSuccessCallback=void 0}catch(e){}}}}class nc{constructor(e){this.privDetailedSpeechPhrase=JSON.parse(e),this.privDetailedSpeechPhrase.RecognitionStatus=Bl[this.privDetailedSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new nc(e)}getJsonWithCorrectedOffsets(e){if(this.privDetailedSpeechPhrase.NBest){let t;for(const e of this.privDetailedSpeechPhrase.NBest)if(e.Words&&e.Words[0]){t=e.Words[0].Offset;break}if(t&&t<e){const n=e-t;for(const e of this.privDetailedSpeechPhrase.NBest)if(e.Words)for(const t of e.Words)t.Offset+=n}}return JSON.stringify(this.privDetailedSpeechPhrase)}get RecognitionStatus(){return this.privDetailedSpeechPhrase.RecognitionStatus}get NBest(){return this.privDetailedSpeechPhrase.NBest}get Duration(){return this.privDetailedSpeechPhrase.Duration}get Offset(){return this.privDetailedSpeechPhrase.Offset}get Language(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence}get Text(){return this.privDetailedSpeechPhrase.NBest&&this.privDetailedSpeechPhrase.NBest[0]?this.privDetailedSpeechPhrase.NBest[0].Display:this.privDetailedSpeechPhrase.DisplayText}get SpeakerId(){return this.privDetailedSpeechPhrase.SpeakerId}}class rc{constructor(e){this.privSimpleSpeechPhrase=JSON.parse(e),this.privSimpleSpeechPhrase.RecognitionStatus=Bl[this.privSimpleSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new rc(e)}get RecognitionStatus(){return this.privSimpleSpeechPhrase.RecognitionStatus}get DisplayText(){return this.privSimpleSpeechPhrase.DisplayText}get Offset(){return this.privSimpleSpeechPhrase.Offset}get Duration(){return this.privSimpleSpeechPhrase.Duration}get Language(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSimpleSpeechPhrase.SpeakerId}}var ic,oc,ac={};e(ac,"RequestSession",(()=>xc),(e=>xc=e));class sc extends qa{constructor(e,t,n,r=ja.Info){super(e,r),this.privRequestId=t,this.privSessionId=n}get requestId(){return this.privRequestId}get sessionId(){return this.privSessionId}}class lc extends sc{constructor(e,t,n,r){super("RecognitionTriggeredEvent",e,t),this.privAudioSourceId=n,this.privAudioNodeId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class cc extends sc{constructor(e,t,n,r){super("ListeningStartedEvent",e,t),this.privAudioSourceId=n,this.privAudioNodeId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class uc extends sc{constructor(e,t,n){super("ConnectingToServiceEvent",e,n),this.privAuthFetchEventid=t}get authFetchEventid(){return this.privAuthFetchEventid}}class dc extends sc{constructor(e,t,n,r,i){super("RecognitionStartedEvent",e,i),this.privAudioSourceId=t,this.privAudioNodeId=n,this.privAuthFetchEventId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}get authFetchEventId(){return this.privAuthFetchEventId}}(oc=ic||(ic={}))[oc.Success=0]="Success",oc[oc.AudioSourceError=1]="AudioSourceError",oc[oc.AudioSourceTimeout=2]="AudioSourceTimeout",oc[oc.AuthTokenFetchError=3]="AuthTokenFetchError",oc[oc.AuthTokenFetchTimeout=4]="AuthTokenFetchTimeout",oc[oc.UnAuthorized=5]="UnAuthorized",oc[oc.ConnectTimeout=6]="ConnectTimeout",oc[oc.ConnectError=7]="ConnectError",oc[oc.ClientRecognitionActivityTimeout=8]="ClientRecognitionActivityTimeout",oc[oc.UnknownError=9]="UnknownError";class fc{constructor(e,t,n){this.privIsDisposed=!1,this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.onEvent=e=>{if(!this.privIsDisposed&&(e instanceof lc&&e.requestId===this.privRequestId&&(this.privListeningTriggerMetric={End:e.eventTime,Name:"ListeningTrigger",Start:e.eventTime}),e instanceof $a&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof es&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof Xa&&e.audioSourceId===this.privAudioSourceId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof ns&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof ts&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Name:"Microphone",Start:this.privMicStartTime})),e instanceof uc&&e.requestId===this.privRequestId&&(this.privConnectionId=e.sessionId),e instanceof os&&e.connectionId===this.privConnectionId&&(this.privConnectionStartTime=e.eventTime),e instanceof as&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof cs&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Error:this.getConnectionError(e.statusCode),Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof us&&e.connectionId===this.privConnectionId&&e.message&&e.message.headers&&e.message.headers.path)){this.privReceivedMessages[e.message.headers.path]||(this.privReceivedMessages[e.message.headers.path]=new Array);const t=50;this.privReceivedMessages[e.message.headers.path].length<t&&this.privReceivedMessages[e.message.headers.path].push(e.networkReceivedTime)}},this.getTelemetry=()=>{const e=new Array;this.privListeningTriggerMetric&&e.push(this.privListeningTriggerMetric),this.privMicMetric&&e.push(this.privMicMetric),this.privConnectionEstablishMetric&&e.push(this.privConnectionEstablishMetric),this.privPhraseLatencies.length>0&&e.push({PhraseLatencyMs:this.privPhraseLatencies}),this.privHypothesisLatencies.length>0&&e.push({FirstHypothesisLatencyMs:this.privHypothesisLatencies});const t={Metrics:e,ReceivedMessages:this.privReceivedMessages},n=JSON.stringify(t);return this.privReceivedMessages={},this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privPhraseLatencies=[],this.privHypothesisLatencies=[],n},this.dispose=()=>{this.privIsDisposed=!0},this.getConnectionError=e=>{switch(e){case 400:case 1002:case 1003:case 1005:case 1007:case 1008:case 1009:return"BadRequest";case 401:return"Unauthorized";case 403:return"Forbidden";case 503:case 1001:return"ServerUnavailable";case 500:case 1011:return"ServerError";case 408:case 504:return"Timeout";default:return"statuscode:"+e.toString()}},this.privRequestId=e,this.privAudioSourceId=t,this.privAudioNodeId=n,this.privReceivedMessages={},this.privPhraseLatencies=[],this.privHypothesisLatencies=[]}phraseReceived(e){e>0&&this.privPhraseLatencies.push(Date.now()-e)}hypothesisReceived(e){e>0&&this.privHypothesisLatencies.push(Date.now()-e)}get hasTelemetry(){return 0!==Object.keys(this.privReceivedMessages).length||null!==this.privListeningTriggerMetric||null!==this.privMicMetric||null!==this.privConnectionEstablishMetric||0!==this.privPhraseLatencies.length||0!==this.privHypothesisLatencies.length}}var hc,pc,mc,gc,vc,yc,bc,wc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class xc{constructor(e){this.privIsDisposed=!1,this.privDetachables=new Array,this.privIsAudioNodeDetached=!1,this.privIsRecognizing=!1,this.privIsSpeechEnded=!1,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privHypothesisReceived=!1,this.privBytesSent=0,this.privRecogNumber=0,this.privInTurn=!1,this.privConnectionAttempts=0,this.onPreConnectionStart=(e,t)=>{this.privAuthFetchEventId=e,this.privSessionId=t,this.onEvent(new uc(this.privRequestId,this.privAuthFetchEventId,this.privSessionId))},this.onSpeechContext=()=>{this.privRequestId=Ba()},this.onServiceTurnStartResponse=()=>{this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch((()=>{}))),this.privInTurn=!0,this.privTurnDeferral=new bs},this.getTelemetry=()=>this.privServiceTelemetryListener.hasTelemetry?this.privServiceTelemetryListener.getTelemetry():null,this.onEvent=e=>{this.privServiceTelemetryListener&&this.privServiceTelemetryListener.onEvent(e),ys.instance.onEvent(e)},this.privAudioSourceId=e,this.privRequestId=Ba(),this.privAudioNodeId=Ba(),this.privTurnDeferral=new bs,this.privTurnDeferral.resolve()}get sessionId(){return this.privSessionId}get requestId(){return this.privRequestId}get audioNodeId(){return this.privAudioNodeId}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSpeechEnded(){return this.privIsSpeechEnded}get isRecognizing(){return this.privIsRecognizing}get currentTurnAudioOffset(){return this.privTurnStartAudioOffset}get recogNumber(){return this.privRecogNumber}get numConnectionAttempts(){return this.privConnectionAttempts}get bytesSent(){return this.privBytesSent}listenForServiceTelemetry(e){this.privServiceTelemetryListener&&this.privDetachables.push(e.attachListener(this.privServiceTelemetryListener))}startNewRecognition(){this.privIsSpeechEnded=!1,this.privIsRecognizing=!0,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privRecogNumber++,this.privServiceTelemetryListener=new fc(this.privRequestId,this.privAudioSourceId,this.privAudioNodeId),this.onEvent(new lc(this.requestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}onAudioSourceAttachCompleted(e,t,n){return wc(this,void 0,void 0,(function*(){this.privAudioNode=e,this.privIsAudioNodeDetached=!1,t?yield this.onComplete():this.onEvent(new cc(this.privRequestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}))}onAuthCompleted(e,t){return wc(this,void 0,void 0,(function*(){e&&(yield this.onComplete())}))}onConnectionEstablishCompleted(e,t){return wc(this,void 0,void 0,(function*(){if(200===e)return this.onEvent(new dc(this.requestId,this.privAudioSourceId,this.privAudioNodeId,this.privAuthFetchEventId,this.privSessionId)),this.privAudioNode&&this.privAudioNode.replay(),this.privTurnStartAudioOffset=this.privLastRecoOffset,void(this.privBytesSent=0);403===e&&(yield this.onComplete())}))}onServiceTurnEndResponse(e){return wc(this,void 0,void 0,(function*(){this.privTurnDeferral.resolve(),!e||this.isSpeechEnded?(yield this.onComplete(),this.privInTurn=!1):(this.privTurnStartAudioOffset=this.privLastRecoOffset,this.privAudioNode.replay())}))}onHypothesis(e){this.privHypothesisReceived||(this.privHypothesisReceived=!0,this.privServiceTelemetryListener.hypothesisReceived(this.privAudioNode.findTimeAtOffset(e)))}onPhraseRecognized(e){this.privServiceTelemetryListener.phraseReceived(this.privAudioNode.findTimeAtOffset(e)),this.onServiceRecognized(e)}onServiceRecognized(e){this.privLastRecoOffset=e,this.privHypothesisReceived=!1,this.privAudioNode.shrinkBuffers(e),this.privConnectionAttempts=0}onAudioSent(e){this.privBytesSent+=e}onRetryConnection(){this.privConnectionAttempts++}dispose(e){var t;return wc(this,void 0,void 0,(function*(){if(!this.privIsDisposed){this.privIsDisposed=!0;for(const e of this.privDetachables)yield e.detach();null===(t=this.privServiceTelemetryListener)||void 0===t||t.dispose(),this.privIsRecognizing=!1}}))}onStopRecognizing(){return wc(this,void 0,void 0,(function*(){yield this.onComplete()}))}onSpeechEnded(){this.privIsSpeechEnded=!0}onComplete(){return wc(this,void 0,void 0,(function*(){this.privIsRecognizing&&(this.privIsRecognizing=!1,yield this.detachAudioNode())}))}detachAudioNode(){return wc(this,void 0,void 0,(function*(){this.privIsAudioNodeDetached||(this.privIsAudioNodeDetached=!0,this.privAudioNode&&(yield this.privAudioNode.detach()))}))}}class Sc{constructor(e){this.privContext={},this.privDynamicGrammar=e}setSection(e,t){this.privContext[e]=t}setPronunciationAssessmentParams(e){void 0===this.privContext.phraseDetection&&(this.privContext.phraseDetection={enrichment:{pronunciationAssessment:{}}}),this.privContext.phraseDetection.enrichment.pronunciationAssessment=JSON.parse(e),void 0===this.privContext.phraseOutput&&(this.privContext.phraseOutput={detailed:{options:[]},format:{}}),this.privContext.phraseOutput.format="Detailed",this.privContext.phraseOutput.detailed.options.push("PronunciationAssessment"),-1===this.privContext.phraseOutput.detailed.options.indexOf("WordTimings")&&this.privContext.phraseOutput.detailed.options.push("WordTimings"),-1===this.privContext.phraseOutput.detailed.options.indexOf("SNR")&&this.privContext.phraseOutput.detailed.options.push("SNR")}toJSON(){const e=this.privDynamicGrammar.generateGrammarObject();this.setSection("dgi",e);return JSON.stringify(this.privContext)}}class Mc{addPhrase(e){this.privPhrases||(this.privPhrases=[]),e instanceof Array?this.privPhrases=this.privPhrases.concat(e):this.privPhrases.push(e)}clearPhrases(){this.privPhrases=void 0}addReferenceGrammar(e){this.privGrammars||(this.privGrammars=[]),e instanceof Array?this.privGrammars=this.privGrammars.concat(e):this.privGrammars.push(e)}clearGrammars(){this.privGrammars=void 0}generateGrammarObject(){if(void 0===this.privGrammars&&void 0===this.privPhrases)return;const e={};if(e.ReferenceGrammars=this.privGrammars,void 0!==this.privPhrases&&0!==this.privPhrases.length){const t=[];this.privPhrases.forEach(((e,n,r)=>{t.push({Text:e})})),e.Groups=[{Type:"Generic",Items:t}]}return e}}(pc=hc||(hc={}))[pc.Raw8Khz8BitMonoMULaw=0]="Raw8Khz8BitMonoMULaw",pc[pc.Riff16Khz16KbpsMonoSiren=1]="Riff16Khz16KbpsMonoSiren",pc[pc.Audio16Khz16KbpsMonoSiren=2]="Audio16Khz16KbpsMonoSiren",pc[pc.Audio16Khz32KBitRateMonoMp3=3]="Audio16Khz32KBitRateMonoMp3",pc[pc.Audio16Khz128KBitRateMonoMp3=4]="Audio16Khz128KBitRateMonoMp3",pc[pc.Audio16Khz64KBitRateMonoMp3=5]="Audio16Khz64KBitRateMonoMp3",pc[pc.Audio24Khz48KBitRateMonoMp3=6]="Audio24Khz48KBitRateMonoMp3",pc[pc.Audio24Khz96KBitRateMonoMp3=7]="Audio24Khz96KBitRateMonoMp3",pc[pc.Audio24Khz160KBitRateMonoMp3=8]="Audio24Khz160KBitRateMonoMp3",pc[pc.Raw16Khz16BitMonoTrueSilk=9]="Raw16Khz16BitMonoTrueSilk",pc[pc.Riff16Khz16BitMonoPcm=10]="Riff16Khz16BitMonoPcm",pc[pc.Riff8Khz16BitMonoPcm=11]="Riff8Khz16BitMonoPcm",pc[pc.Riff24Khz16BitMonoPcm=12]="Riff24Khz16BitMonoPcm",pc[pc.Riff8Khz8BitMonoMULaw=13]="Riff8Khz8BitMonoMULaw",pc[pc.Raw16Khz16BitMonoPcm=14]="Raw16Khz16BitMonoPcm",pc[pc.Raw24Khz16BitMonoPcm=15]="Raw24Khz16BitMonoPcm",pc[pc.Raw8Khz16BitMonoPcm=16]="Raw8Khz16BitMonoPcm",pc[pc.Ogg16Khz16BitMonoOpus=17]="Ogg16Khz16BitMonoOpus",pc[pc.Ogg24Khz16BitMonoOpus=18]="Ogg24Khz16BitMonoOpus",pc[pc.Raw48Khz16BitMonoPcm=19]="Raw48Khz16BitMonoPcm",pc[pc.Riff48Khz16BitMonoPcm=20]="Riff48Khz16BitMonoPcm",pc[pc.Audio48Khz96KBitRateMonoMp3=21]="Audio48Khz96KBitRateMonoMp3",pc[pc.Audio48Khz192KBitRateMonoMp3=22]="Audio48Khz192KBitRateMonoMp3",pc[pc.Ogg48Khz16BitMonoOpus=23]="Ogg48Khz16BitMonoOpus",pc[pc.Webm16Khz16BitMonoOpus=24]="Webm16Khz16BitMonoOpus",pc[pc.Webm24Khz16BitMonoOpus=25]="Webm24Khz16BitMonoOpus",pc[pc.Raw24Khz16BitMonoTrueSilk=26]="Raw24Khz16BitMonoTrueSilk",pc[pc.Raw8Khz8BitMonoALaw=27]="Raw8Khz8BitMonoALaw",pc[pc.Riff8Khz8BitMonoALaw=28]="Riff8Khz8BitMonoALaw",pc[pc.Webm24Khz16Bit24KbpsMonoOpus=29]="Webm24Khz16Bit24KbpsMonoOpus",pc[pc.Audio16Khz16Bit32KbpsMonoOpus=30]="Audio16Khz16Bit32KbpsMonoOpus",pc[pc.Audio24Khz16Bit48KbpsMonoOpus=31]="Audio24Khz16Bit48KbpsMonoOpus",pc[pc.Audio24Khz16Bit24KbpsMonoOpus=32]="Audio24Khz16Bit24KbpsMonoOpus",(gc=mc||(mc={}))[gc.PCM=1]="PCM",gc[gc.MuLaw=2]="MuLaw",gc[gc.Siren=3]="Siren",gc[gc.MP3=4]="MP3",gc[gc.SILKSkype=5]="SILKSkype",gc[gc.OGG_OPUS=6]="OGG_OPUS",gc[gc.WEBM_OPUS=7]="WEBM_OPUS",gc[gc.ALaw=8]="ALaw",gc[gc.FLAC=9]="FLAC",gc[gc.OPUS=10]="OPUS";class _c{static getDefaultInputFormat(){return Ac.getDefaultInputFormat()}static getWaveFormat(e,t,n,r){return new Ac(e,t,n,r)}static getWaveFormatPCM(e,t,n){return new Ac(e,t,n)}}class Ac extends _c{constructor(e=16e3,t=16,n=1,r=mc.PCM){super(),this.setString=(e,t,n)=>{for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))};let i=!0;switch(r){case mc.PCM:this.formatTag=1;break;case mc.ALaw:this.formatTag=6;break;case mc.MuLaw:this.formatTag=7;break;default:i=!1}if(this.bitsPerSample=t,this.samplesPerSec=e,this.channels=n,this.avgBytesPerSec=this.samplesPerSec*this.channels*(this.bitsPerSample/8),this.blockAlign=this.channels*Math.max(this.bitsPerSample,8),i){this.privHeader=new ArrayBuffer(44);const e=new DataView(this.privHeader);this.setString(e,0,"RIFF"),e.setUint32(4,0,!0),this.setString(e,8,"WAVEfmt "),e.setUint32(16,16,!0),e.setUint16(20,this.formatTag,!0),e.setUint16(22,this.channels,!0),e.setUint32(24,this.samplesPerSec,!0),e.setUint32(28,this.avgBytesPerSec,!0),e.setUint16(32,this.channels*(this.bitsPerSample/8),!0),e.setUint16(34,this.bitsPerSample,!0),this.setString(e,36,"data"),e.setUint32(40,0,!0)}}static getDefaultInputFormat(){return new Ac}static getAudioContext(e){const t=window.AudioContext||window.webkitAudioContext||!1;if(t)return void 0!==e&&navigator.mediaDevices.getSupportedConstraints().sampleRate?new t({sampleRate:e}):new t;throw new Error("Browser does not support Web Audio API (AudioContext is not available).")}close(){}get header(){return this.privHeader}}class Ec extends Ac{constructor(e,t,n,r,i,o,a,s,l){super(n,o,t,e),this.formatTag=e,this.avgBytesPerSec=r,this.blockAlign=i,this.priAudioFormatString=a,this.priRequestAudioFormatString=s,this.priHasHeader=l}static fromSpeechSynthesisOutputFormat(e){return void 0===e?Ec.getDefaultOutputFormat():Ec.fromSpeechSynthesisOutputFormatString(Ec.SpeechSynthesisOutputFormatToString[e])}static fromSpeechSynthesisOutputFormatString(e){switch(e){case"raw-8khz-8bit-mono-mulaw":return new Ec(mc.MuLaw,1,8e3,8e3,1,8,e,e,!1);case"riff-16khz-16kbps-mono-siren":return new Ec(mc.Siren,1,16e3,2e3,40,0,e,"audio-16khz-16kbps-mono-siren",!0);case"audio-16khz-16kbps-mono-siren":return new Ec(mc.Siren,1,16e3,2e3,40,0,e,e,!1);case"audio-16khz-32kbitrate-mono-mp3":return new Ec(mc.MP3,1,16e3,4096,2,16,e,e,!1);case"audio-16khz-128kbitrate-mono-mp3":return new Ec(mc.MP3,1,16e3,16384,2,16,e,e,!1);case"audio-16khz-64kbitrate-mono-mp3":return new Ec(mc.MP3,1,16e3,8192,2,16,e,e,!1);case"audio-24khz-48kbitrate-mono-mp3":return new Ec(mc.MP3,1,24e3,6144,2,16,e,e,!1);case"audio-24khz-96kbitrate-mono-mp3":return new Ec(mc.MP3,1,24e3,12288,2,16,e,e,!1);case"audio-24khz-160kbitrate-mono-mp3":return new Ec(mc.MP3,1,24e3,20480,2,16,e,e,!1);case"raw-16khz-16bit-mono-truesilk":return new Ec(mc.SILKSkype,1,16e3,32e3,2,16,e,e,!1);case"riff-8khz-16bit-mono-pcm":return new Ec(mc.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!0);case"riff-24khz-16bit-mono-pcm":return new Ec(mc.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!0);case"riff-8khz-8bit-mono-mulaw":return new Ec(mc.MuLaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-mulaw",!0);case"raw-16khz-16bit-mono-pcm":return new Ec(mc.PCM,1,16e3,32e3,2,16,e,"raw-16khz-16bit-mono-pcm",!1);case"raw-24khz-16bit-mono-pcm":return new Ec(mc.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!1);case"raw-8khz-16bit-mono-pcm":return new Ec(mc.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!1);case"ogg-16khz-16bit-mono-opus":return new Ec(mc.OGG_OPUS,1,16e3,8192,2,16,e,e,!1);case"ogg-24khz-16bit-mono-opus":return new Ec(mc.OGG_OPUS,1,24e3,8192,2,16,e,e,!1);case"raw-48khz-16bit-mono-pcm":return new Ec(mc.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!1);case"riff-48khz-16bit-mono-pcm":return new Ec(mc.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!0);case"audio-48khz-96kbitrate-mono-mp3":return new Ec(mc.MP3,1,48e3,12288,2,16,e,e,!1);case"audio-48khz-192kbitrate-mono-mp3":return new Ec(mc.MP3,1,48e3,24576,2,16,e,e,!1);case"ogg-48khz-16bit-mono-opus":return new Ec(mc.OGG_OPUS,1,48e3,12e3,2,16,e,e,!1);case"webm-16khz-16bit-mono-opus":return new Ec(mc.WEBM_OPUS,1,16e3,4e3,2,16,e,e,!1);case"webm-24khz-16bit-mono-opus":return new Ec(mc.WEBM_OPUS,1,24e3,6e3,2,16,e,e,!1);case"webm-24khz-16bit-24kbps-mono-opus":return new Ec(mc.WEBM_OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-16khz-16bit-32kbps-mono-opus":return new Ec(mc.OPUS,1,16e3,4e3,2,16,e,e,!1);case"audio-24khz-16bit-48kbps-mono-opus":return new Ec(mc.OPUS,1,24e3,6e3,2,16,e,e,!1);case"audio-24khz-16bit-24kbps-mono-opus":return new Ec(mc.OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-24khz-16bit-mono-flac":return new Ec(mc.FLAC,1,24e3,24e3,2,16,e,e,!1);case"audio-48khz-16bit-mono-flac":return new Ec(mc.FLAC,1,48e3,3e4,2,16,e,e,!1);case"raw-24khz-16bit-mono-truesilk":return new Ec(mc.SILKSkype,1,24e3,48e3,2,16,e,e,!1);case"raw-8khz-8bit-mono-alaw":return new Ec(mc.ALaw,1,8e3,8e3,1,8,e,e,!1);case"riff-8khz-8bit-mono-alaw":return new Ec(mc.ALaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-alaw",!0);default:return new Ec(mc.PCM,1,16e3,32e3,2,16,"riff-16khz-16bit-mono-pcm","raw-16khz-16bit-mono-pcm",!0)}}static getDefaultOutputFormat(){return Ec.fromSpeechSynthesisOutputFormatString("undefined"!=typeof window?"audio-24khz-48kbitrate-mono-mp3":"riff-16khz-16bit-mono-pcm")}get hasHeader(){return this.priHasHeader}get header(){if(this.hasHeader)return this.privHeader}updateHeader(e){if(this.priHasHeader){new DataView(this.privHeader).setUint32(40,e,!0)}}get requestAudioFormatString(){return this.priRequestAudioFormatString}}Ec.SpeechSynthesisOutputFormatToString={[hc.Raw8Khz8BitMonoMULaw]:"raw-8khz-8bit-mono-mulaw",[hc.Riff16Khz16KbpsMonoSiren]:"riff-16khz-16kbps-mono-siren",[hc.Audio16Khz16KbpsMonoSiren]:"audio-16khz-16kbps-mono-siren",[hc.Audio16Khz32KBitRateMonoMp3]:"audio-16khz-32kbitrate-mono-mp3",[hc.Audio16Khz128KBitRateMonoMp3]:"audio-16khz-128kbitrate-mono-mp3",[hc.Audio16Khz64KBitRateMonoMp3]:"audio-16khz-64kbitrate-mono-mp3",[hc.Audio24Khz48KBitRateMonoMp3]:"audio-24khz-48kbitrate-mono-mp3",[hc.Audio24Khz96KBitRateMonoMp3]:"audio-24khz-96kbitrate-mono-mp3",[hc.Audio24Khz160KBitRateMonoMp3]:"audio-24khz-160kbitrate-mono-mp3",[hc.Raw16Khz16BitMonoTrueSilk]:"raw-16khz-16bit-mono-truesilk",[hc.Riff16Khz16BitMonoPcm]:"riff-16khz-16bit-mono-pcm",[hc.Riff8Khz16BitMonoPcm]:"riff-8khz-16bit-mono-pcm",[hc.Riff24Khz16BitMonoPcm]:"riff-24khz-16bit-mono-pcm",[hc.Riff8Khz8BitMonoMULaw]:"riff-8khz-8bit-mono-mulaw",[hc.Raw16Khz16BitMonoPcm]:"raw-16khz-16bit-mono-pcm",[hc.Raw24Khz16BitMonoPcm]:"raw-24khz-16bit-mono-pcm",[hc.Raw8Khz16BitMonoPcm]:"raw-8khz-16bit-mono-pcm",[hc.Ogg16Khz16BitMonoOpus]:"ogg-16khz-16bit-mono-opus",[hc.Ogg24Khz16BitMonoOpus]:"ogg-24khz-16bit-mono-opus",[hc.Raw48Khz16BitMonoPcm]:"raw-48khz-16bit-mono-pcm",[hc.Riff48Khz16BitMonoPcm]:"riff-48khz-16bit-mono-pcm",[hc.Audio48Khz96KBitRateMonoMp3]:"audio-48khz-96kbitrate-mono-mp3",[hc.Audio48Khz192KBitRateMonoMp3]:"audio-48khz-192kbitrate-mono-mp3",[hc.Ogg48Khz16BitMonoOpus]:"ogg-48khz-16bit-mono-opus",[hc.Webm16Khz16BitMonoOpus]:"webm-16khz-16bit-mono-opus",[hc.Webm24Khz16BitMonoOpus]:"webm-24khz-16bit-mono-opus",[hc.Webm24Khz16Bit24KbpsMonoOpus]:"webm-24khz-16bit-24kbps-mono-opus",[hc.Raw24Khz16BitMonoTrueSilk]:"raw-24khz-16bit-mono-truesilk",[hc.Raw8Khz8BitMonoALaw]:"raw-8khz-8bit-mono-alaw",[hc.Riff8Khz8BitMonoALaw]:"riff-8khz-8bit-mono-alaw",[hc.Audio16Khz16Bit32KbpsMonoOpus]:"audio-16khz-16bit-32kbps-mono-opus",[hc.Audio24Khz16Bit48KbpsMonoOpus]:"audio-24khz-16bit-48kbps-mono-opus",[hc.Audio24Khz16Bit24KbpsMonoOpus]:"audio-24khz-16bit-24kbps-mono-opus"},(yc=vc||(vc={}))[yc.Masked=0]="Masked",yc[yc.Removed=1]="Removed",yc[yc.Raw=2]="Raw";class Cc{constructor(){}static fromSubscription(e,t){Wl.throwIfNullOrWhitespace(e,"subscriptionKey"),Wl.throwIfNullOrWhitespace(t,"region");const n=new kc;return n.setProperty(cl.SpeechServiceConnection_Region,t),n.setProperty(cl.SpeechServiceConnection_IntentRegion,t),n.setProperty(cl.SpeechServiceConnection_Key,e),n}static fromEndpoint(e,t){Wl.throwIfNull(e,"endpoint");const n=new kc;return n.setProperty(cl.SpeechServiceConnection_Endpoint,e.href),void 0!==t&&n.setProperty(cl.SpeechServiceConnection_Key,t),n}static fromHost(e,t){Wl.throwIfNull(e,"hostName");const n=new kc;return n.setProperty(cl.SpeechServiceConnection_Host,e.protocol+"//"+e.hostname+(""===e.port?"":":"+e.port)),void 0!==t&&n.setProperty(cl.SpeechServiceConnection_Key,t),n}static fromAuthorizationToken(e,t){Wl.throwIfNull(e,"authorizationToken"),Wl.throwIfNullOrWhitespace(t,"region");const n=new kc;return n.setProperty(cl.SpeechServiceConnection_Region,t),n.setProperty(cl.SpeechServiceConnection_IntentRegion,t),n.authorizationToken=e,n}close(){}}class kc extends Cc{constructor(){super(),this.privProperties=new Gl,this.speechRecognitionLanguage="en-US",this.outputFormat=Ol.Simple}get properties(){return this.privProperties}get endPoint(){return new URL(this.privProperties.getProperty(cl.SpeechServiceConnection_Endpoint))}get subscriptionKey(){return this.privProperties.getProperty(cl.SpeechServiceConnection_Key)}get region(){return this.privProperties.getProperty(cl.SpeechServiceConnection_Region)}get authorizationToken(){return this.privProperties.getProperty(cl.SpeechServiceAuthorization_Token)}set authorizationToken(e){this.privProperties.setProperty(cl.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return this.privProperties.getProperty(cl.SpeechServiceConnection_RecoLanguage)}set speechRecognitionLanguage(e){this.privProperties.setProperty(cl.SpeechServiceConnection_RecoLanguage,e)}get autoDetectSourceLanguages(){return this.privProperties.getProperty(cl.SpeechServiceConnection_AutoDetectSourceLanguages)}set autoDetectSourceLanguages(e){this.privProperties.setProperty(cl.SpeechServiceConnection_AutoDetectSourceLanguages,e)}get outputFormat(){return Ol[this.privProperties.getProperty(fu,void 0)]}set outputFormat(e){this.privProperties.setProperty(fu,Ol[e])}get endpointId(){return this.privProperties.getProperty(cl.SpeechServiceConnection_EndpointId)}set endpointId(e){this.privProperties.setProperty(cl.SpeechServiceConnection_EndpointId,e)}setProperty(e,t){Wl.throwIfNull(t,"value"),this.privProperties.setProperty(e,t)}getProperty(e,t){return this.privProperties.getProperty(e,t)}setProxy(e,t,n,r){this.setProperty(cl[cl.SpeechServiceConnection_ProxyHostName],e),this.setProperty(cl[cl.SpeechServiceConnection_ProxyPort],t),this.setProperty(cl[cl.SpeechServiceConnection_ProxyUserName],n),this.setProperty(cl[cl.SpeechServiceConnection_ProxyPassword],r)}setServiceProperty(e,t,n){const r=JSON.parse(this.privProperties.getProperty(pu,"{}"));r[e]=t,this.privProperties.setProperty(pu,JSON.stringify(r))}setProfanity(e){this.privProperties.setProperty(cl.SpeechServiceResponse_ProfanityOption,vc[e])}enableAudioLogging(){this.privProperties.setProperty(cl.SpeechServiceConnection_EnableAudioLogging,"true")}requestWordLevelTimestamps(){this.privProperties.setProperty(cl.SpeechServiceResponse_RequestWordLevelTimestamps,"true")}enableDictation(){this.privProperties.setProperty(mu,"true")}clone(){const e=new kc;return e.privProperties=this.privProperties.clone(),e}get speechSynthesisLanguage(){return this.privProperties.getProperty(cl.SpeechServiceConnection_SynthLanguage)}set speechSynthesisLanguage(e){this.privProperties.setProperty(cl.SpeechServiceConnection_SynthLanguage,e)}get speechSynthesisVoiceName(){return this.privProperties.getProperty(cl.SpeechServiceConnection_SynthVoice)}set speechSynthesisVoiceName(e){this.privProperties.setProperty(cl.SpeechServiceConnection_SynthVoice,e)}get speechSynthesisOutputFormat(){return hc[this.privProperties.getProperty(cl.SpeechServiceConnection_SynthOutputFormat,void 0)]}set speechSynthesisOutputFormat(e){this.privProperties.setProperty(cl.SpeechServiceConnection_SynthOutputFormat,hc[e])}}class Tc{constructor(){}set applicationId(e){}}Tc.DialogTypes=((bc=class{}).BotFramework="bot_framework",bc.CustomCommands="custom_commands",bc);var Ic={};e(Ic,"AudioOutputStream",(()=>Nc),(e=>Nc=e)),e(Ic,"PullAudioOutputStream",(()=>Lc),(e=>Lc=e)),e(Ic,"PullAudioOutputStreamImpl",(()=>Dc),(e=>Dc=e)),e(Ic,"PushAudioOutputStream",(()=>Bc),(e=>Bc=e)),e(Ic,"PushAudioOutputStreamImpl",(()=>jc),(e=>jc=e));var Oc,Rc,Pc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Nc{constructor(){}static createPullStream(){return Lc.create()}}class Lc extends Nc{static create(){return new Dc}}class Dc extends Lc{constructor(){super(),this.privId=Ba(),this.privStream=new(0,Ts.Stream)}set format(e){null==e&&(this.privFormat=Ec.getDefaultOutputFormat()),this.privFormat=e}get format(){return this.privFormat}get isClosed(){return this.privStream.isClosed}id(){return this.privId}read(e){return Pc(this,void 0,void 0,(function*(){const t=new Int8Array(e);let n=0;if(void 0!==this.privLastChunkView){if(this.privLastChunkView.length>e.byteLength)return t.set(this.privLastChunkView.slice(0,e.byteLength)),this.privLastChunkView=this.privLastChunkView.slice(e.byteLength),Promise.resolve(e.byteLength);t.set(this.privLastChunkView),n=this.privLastChunkView.length,this.privLastChunkView=void 0}for(;n<e.byteLength&&!this.privStream.isReadEnded;){const r=yield this.privStream.read();if(void 0===r||r.isEnd)yield this.privStream.readEnded();else{let i;r.buffer.byteLength>e.byteLength-n?(i=r.buffer.slice(0,e.byteLength-n),this.privLastChunkView=new Int8Array(r.buffer.slice(e.byteLength-n))):i=r.buffer,t.set(new Int8Array(i),n),n+=i.byteLength}}return n}))}write(e){Wl.throwIfNullOrUndefined(this.privStream,"must set format before writing"),this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}}class Bc extends Nc{constructor(){super()}static create(e){return new jc(e)}}class jc extends Bc{constructor(e){super(),this.privId=Ba(),this.privCallback=e}set format(e){}write(e){this.privCallback.write&&this.privCallback.write(e)}close(){this.privCallback.close&&this.privCallback.close()}id(){return this.privId}}(Rc=Oc||(Oc={}))[Rc.None=0]="None",Rc[Rc.TextToSpeechAudio=1]="TextToSpeechAudio";var Fc,Uc;class zc{toJsonString(){return JSON.stringify(this.iPrivConfig)}get(){return this.iPrivConfig}set(e){this.iPrivConfig=e}}(Uc=Fc||(Fc={})).WordBoundary="WordBoundary",Uc.Bookmark="Bookmark",Uc.Viseme="Viseme";class Hc{constructor(e){this.privSynthesisAudioMetadata=JSON.parse(e)}static fromJSON(e){return new Hc(e)}get Metadata(){return this.privSynthesisAudioMetadata.Metadata}}var Vc={};e(Vc,"SynthesisTurn",(()=>lu),(e=>lu=e));var Wc={};e(Wc,"SynthesisAdapterBase",(()=>Zc),(e=>Zc=e));class Gc{constructor(e){this.privResult=e}get result(){return this.privResult}}class qc{constructor(e,t,n,r){this.privResultId=e,this.privReason=t,this.privErrorDetails=n,this.privProperties=r}get resultId(){return this.privResultId}get reason(){return this.privReason}get errorDetails(){return this.privErrorDetails}get properties(){return this.privProperties}}class Kc extends qc{constructor(e,t,n,r,i){super(e,t,r,i),this.privAudioData=n}get audioData(){return this.privAudioData}}class Yc{constructor(e,t,n,r){this.privAudioOffset=e,this.privText=t,this.privWordLength=n,this.privTextOffset=r}get audioOffset(){return this.privAudioOffset}get text(){return this.privText}get wordLength(){return this.privWordLength}get textOffset(){return this.privTextOffset}}class Jc{constructor(e,t){this.privAudioOffset=e,this.privText=t}get audioOffset(){return this.privAudioOffset}get text(){return this.privText}}class Qc{constructor(e,t,n){this.privAudioOffset=e,this.privVisemeId=t,this.privAnimation=n}get audioOffset(){return this.privAudioOffset}get visemeId(){return this.privVisemeId}get animation(){return this.privAnimation}}var Xc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Zc{constructor(e,t,n,r,i){if(this.speakOverride=void 0,this.receiveMessageOverride=void 0,this.connectImplOverride=void 0,this.configConnectionOverride=void 0,this.sendSynthesisContext=e=>{const t=this.synthesisContext.toJSON();if(t)return e.send(new pl(Ua.Text,"synthesis.context",this.privSynthesisTurn.requestId,"application/json",t))},this.sendSpeechServiceConfig=(e,t)=>{if(t)return e.send(new pl(Ua.Text,"speech.config",this.privSynthesisTurn.requestId,"application/json",t))},this.sendSsmlMessage=(e,t,n)=>e.send(new pl(Ua.Text,"ssml",n,"application/ssml+xml",t)),!e)throw new fs("authentication");if(!t)throw new fs("connectionFactory");if(!n)throw new fs("synthesizerConfig");this.privAuthentication=e,this.privConnectionFactory=t,this.privSynthesizerConfig=n,this.privIsDisposed=!1,this.privSpeechSynthesizer=r,this.privSessionAudioDestination=i,this.privSynthesisTurn=new(0,Vc.SynthesisTurn),this.privConnectionEvents=new vs,this.privServiceEvents=new vs,this.privSynthesisContext=new du(this.privSpeechSynthesizer),this.privAgentConfig=new zc,this.connectionEvents.attach((e=>{if("ConnectionClosedEvent"===e.name){const t=e;1e3!==t.statusCode&&this.cancelSynthesisLocal(ol.Error,1007===t.statusCode?sl.BadRequestParameters:sl.ConnectionFailure,t.reason+" websocket error code: "+t.statusCode)}}))}get synthesisContext(){return this.privSynthesisContext}get agentConfig(){return this.privAgentConfig}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}set audioOutputFormat(e){this.privAudioOutputFormat=e,this.privSynthesisTurn.audioOutputFormat=e,void 0!==this.privSessionAudioDestination&&(this.privSessionAudioDestination.format=e),void 0!==this.synthesisContext&&(this.synthesisContext.audioOutputFormat=e)}static addHeader(e,t){if(!t.hasHeader)return e;t.updateHeader(e.byteLength);const n=new Uint8Array(e.byteLength+t.header.byteLength);return n.set(new Uint8Array(t.header),0),n.set(new Uint8Array(e),t.header.byteLength),n.buffer}isDisposed(){return this.privIsDisposed}dispose(e){return Xc(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.close(),this.privConnectionConfigurationPromise){const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}}))}connect(){return Xc(this,void 0,void 0,(function*(){yield this.connectImpl()}))}sendNetworkMessage(e,t){return Xc(this,void 0,void 0,(function*(){const n="string"==typeof t?Ua.Text:Ua.Binary,r="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new pl(n,e,this.privSynthesisTurn.requestId,r,t))}))}Speak(e,t,n,r,i,o){return Xc(this,void 0,void 0,(function*(){let a;if(a=t?e:this.privSpeechSynthesizer.buildSsml(e),void 0!==this.speakOverride)return this.speakOverride(a,n,r,i);this.privSuccessCallback=r,this.privErrorCallback=i,this.privSynthesisTurn.startNewSynthesis(n,e,t,o);try{yield this.connectImpl();const e=yield this.fetchConnection();yield this.sendSynthesisContext(e),yield this.sendSsmlMessage(e,a,n);const t=new Gc(new Kc(n,Pl.SynthesizingAudioStarted));this.privSpeechSynthesizer.synthesisStarted&&this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer,t);this.receiveMessage()}catch(e){return this.cancelSynthesisLocal(ol.Error,sl.ConnectionFailure,e),Promise.reject(e)}}))}cancelSynthesis(e,t,n,r){const i=new Gl;i.setProperty(hu,sl[n]);const o=new Kc(e,Pl.Canceled,void 0,r,i);if(this.privSpeechSynthesizer.SynthesisCanceled){const e=new Gc(o);try{this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer,e)}catch(e){}}if(this.privSuccessCallback)try{this.privSuccessCallback(o)}catch(e){}}cancelSynthesisLocal(e,t,n){this.privSynthesisTurn.isSynthesizing&&(this.privSynthesisTurn.onStopSynthesizing(),this.cancelSynthesis(this.privSynthesisTurn.requestId,e,t,n))}processTypeSpecificMessages(e,t,n){return!0}receiveMessage(){return Xc(this,void 0,void 0,(function*(){try{const e=yield this.fetchConnection(),t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(this.privIsDisposed)return;if(!t)return this.privSynthesisTurn.isSynthesizing?this.receiveMessage():void 0;this.privServiceHasSentMessage=!0;const n=pl.fromConnectionMessage(t);if(n.requestId.toLowerCase()===this.privSynthesisTurn.requestId.toLowerCase())switch(n.path.toLowerCase()){case"turn.start":this.privSynthesisTurn.onServiceTurnStartResponse();break;case"response":this.privSynthesisTurn.onServiceResponseMessage(n.textBody);break;case"audio":if(this.privSynthesisTurn.streamId.toLowerCase()===n.streamId.toLowerCase()&&n.binaryBody){if(this.privSynthesisTurn.onAudioChunkReceived(n.binaryBody),this.privSpeechSynthesizer.synthesizing)try{const e=Zc.addHeader(n.binaryBody,this.privSynthesisTurn.audioOutputFormat),t=new Gc(new Kc(this.privSynthesisTurn.requestId,Pl.SynthesizingAudio,e));this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer,t)}catch(e){}void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.write(n.binaryBody)}break;case"audio.metadata":const e=Hc.fromJSON(n.textBody).Metadata;for(const t of e)switch(t.Type){case Fc.WordBoundary:this.privSynthesisTurn.onWordBoundaryEvent(t.Data.text.Text);const e=new Yc(t.Data.Offset,t.Data.text.Text,t.Data.text.Length,this.privSynthesisTurn.currentTextOffset);if(this.privSpeechSynthesizer.wordBoundary)try{this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer,e)}catch(e){}break;case Fc.Bookmark:const n=new Jc(t.Data.Offset,t.Data.Bookmark);if(this.privSpeechSynthesizer.bookmarkReached)try{this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer,n)}catch(e){}break;case Fc.Viseme:if(this.privSynthesisTurn.onVisemeMetadataReceived(t),t.Data.IsLastAnimation){const e=new Qc(t.Data.Offset,t.Data.VisemeId,this.privSynthesisTurn.getAndClearVisemeAnimation());if(this.privSpeechSynthesizer.visemeReceived)try{this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer,e)}catch(e){}}}break;case"turn.end":let t;this.privSynthesisTurn.onServiceTurnEndResponse();try{const e=yield this.privSynthesisTurn.getAllReceivedAudioWithHeader();t=new Kc(this.privSynthesisTurn.requestId,Pl.SynthesizingAudioCompleted,e),this.privSuccessCallback&&this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}if(this.privSpeechSynthesizer.synthesisCompleted)try{this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer,new Gc(t))}catch(e){}break;default:this.processTypeSpecificMessages(n)||this.privServiceEvents&&this.serviceEvents.onEvent(new rs(n.path.toLowerCase(),n.textBody))}return this.receiveMessage()}catch(e){}}))}connectImpl(e=!1){if(this.privConnectionPromise)return this.privConnectionPromise.then((e=>e.state()===Ha.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=null,this.privServiceHasSentMessage=!1,this.connectImpl()):this.privConnectionPromise),(e=>(this.privConnectionId=null,this.privConnectionPromise=null,this.privServiceHasSentMessage=!1,this.connectImpl())));this.privAuthFetchEventId=Ba(),this.privConnectionId=Ba(),this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId,this.privConnectionId);const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId);return this.privConnectionPromise=t.then((t=>Xc(this,void 0,void 0,(function*(){yield this.privSynthesisTurn.onAuthCompleted(!1);const n=this.privConnectionFactory.create(this.privSynthesizerConfig,t,this.privConnectionId);n.events.attach((e=>{this.connectionEvents.onEvent(e)}));const r=yield n.open();return 200===r.statusCode?(yield this.privSynthesisTurn.onConnectionEstablishCompleted(r.statusCode),Promise.resolve(n)):403!==r.statusCode||e?(yield this.privSynthesisTurn.onConnectionEstablishCompleted(r.statusCode,r.reason),Promise.reject(`Unable to contact server. StatusCode: ${r.statusCode}, ${this.privSynthesizerConfig.parameters.getProperty(cl.SpeechServiceConnection_Endpoint)} Reason: ${r.reason}`)):this.connectImpl(!0)}))),(e=>Xc(this,void 0,void 0,(function*(){throw yield this.privSynthesisTurn.onAuthCompleted(!0,e),new Error(e)})))),this.privConnectionPromise.catch((()=>{})),this.privConnectionPromise}fetchConnection(){return Xc(this,void 0,void 0,(function*(){return this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===Ha.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=null,this.privServiceHasSentMessage=!1,this.fetchConnection()):this.privConnectionConfigurationPromise),(e=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=null,this.privServiceHasSentMessage=!1,this.fetchConnection()))):(this.privConnectionConfigurationPromise=this.configureConnection(),yield this.privConnectionConfigurationPromise)}))}configureConnection(){return Xc(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privSynthesizerConfig.SpeechServiceConfig.serialize()),e)}))}}Zc.telemetryDataEnabled=!0;class $c extends qa{constructor(e,t,n=ja.Info){super(e,n),this.privRequestId=t}get requestId(){return this.privRequestId}}class eu extends $c{constructor(e,t,n){super("SynthesisTriggeredEvent",e),this.privSessionAudioDestinationId=t,this.privTurnAudioDestinationId=n}get audioSessionDestinationId(){return this.privSessionAudioDestinationId}get audioTurnDestinationId(){return this.privTurnAudioDestinationId}}class tu extends $c{constructor(e,t){super("ConnectingToSynthesisServiceEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}class nu extends $c{constructor(e,t){super("SynthesisStartedEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}var ru,iu,ou,au,su=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class lu{constructor(){this.privIsDisposed=!1,this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!1,this.privBytesReceived=0,this.privInTurn=!1,this.privTextOffset=0,this.privNextSearchTextIndex=0,this.onPreConnectionStart=(e,t)=>{this.privAuthFetchEventId=e,this.onEvent(new tu(this.privRequestId,this.privAuthFetchEventId))},this.onAuthCompleted=(e,t)=>{e&&this.onComplete()},this.onConnectionEstablishCompleted=(e,t)=>{if(200===e)return this.onEvent(new nu(this.requestId,this.privAuthFetchEventId)),void(this.privBytesReceived=0);403===e&&this.onComplete()},this.onServiceResponseMessage=e=>{const t=JSON.parse(e);this.streamId=t.audio.streamId},this.onServiceTurnEndResponse=()=>{this.privInTurn=!1,this.privTurnDeferral.resolve(),this.onComplete()},this.onServiceTurnStartResponse=()=>{this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch((()=>{}))),this.privInTurn=!0,this.privTurnDeferral=new bs},this.dispose=e=>{this.privIsDisposed||(this.privIsDisposed=!0)},this.onEvent=e=>{ys.instance.onEvent(e)},this.onComplete=()=>{this.privIsSynthesizing&&(this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!0,this.privAudioOutputStream.close(),this.privInTurn=!1,void 0!==this.privTurnAudioDestination&&(this.privTurnAudioDestination.close(),this.privTurnAudioDestination=void 0))},this.privRequestId=Ba(),this.privTurnDeferral=new bs,this.privTurnDeferral.resolve()}get requestId(){return this.privRequestId}get streamId(){return this.privStreamId}set streamId(e){this.privStreamId=e}get audioOutputFormat(){return this.privAudioOutputFormat}set audioOutputFormat(e){this.privAudioOutputFormat=e}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSynthesisEnded(){return this.privIsSynthesisEnded}get isSynthesizing(){return this.privIsSynthesizing}get currentTextOffset(){return this.privTextOffset}get bytesReceived(){return this.privBytesReceived}getAllReceivedAudio(){return su(this,void 0,void 0,(function*(){return this.privReceivedAudio?Promise.resolve(this.privReceivedAudio):this.privIsSynthesisEnded?(yield this.readAllAudioFromStream(),Promise.resolve(this.privReceivedAudio)):null}))}getAllReceivedAudioWithHeader(){return su(this,void 0,void 0,(function*(){if(this.privReceivedAudioWithHeader)return this.privReceivedAudioWithHeader;if(!this.privIsSynthesisEnded)return null;if(this.audioOutputFormat.hasHeader){const e=yield this.getAllReceivedAudio();return this.privReceivedAudioWithHeader=Wc.SynthesisAdapterBase.addHeader(e,this.audioOutputFormat),this.privReceivedAudioWithHeader}return this.getAllReceivedAudio()}))}startNewSynthesis(e,t,n,r){this.privIsSynthesisEnded=!1,this.privIsSynthesizing=!0,this.privRequestId=e,this.privRawText=t,this.privIsSSML=n,this.privAudioOutputStream=new(0,Ic.PullAudioOutputStreamImpl),this.privAudioOutputStream.format=this.privAudioOutputFormat,this.privReceivedAudio=null,this.privReceivedAudioWithHeader=null,this.privBytesReceived=0,this.privTextOffset=0,this.privNextSearchTextIndex=0,this.privPartialVisemeAnimation="",void 0!==r&&(this.privTurnAudioDestination=r,this.privTurnAudioDestination.format=this.privAudioOutputFormat),this.onEvent(new eu(this.requestId,void 0,void 0===r?void 0:r.id()))}onAudioChunkReceived(e){this.isSynthesizing&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength,void 0!==this.privTurnAudioDestination&&this.privTurnAudioDestination.write(e))}onWordBoundaryEvent(e){this.updateTextOffset(e)}onVisemeMetadataReceived(e){void 0!==e.Data.AnimationChunk&&(this.privPartialVisemeAnimation+=e.Data.AnimationChunk)}onStopSynthesizing(){this.onComplete()}getAndClearVisemeAnimation(){const e=this.privPartialVisemeAnimation;return this.privPartialVisemeAnimation="",e}updateTextOffset(e){this.privTextOffset>=0&&(this.privTextOffset=this.privRawText.indexOf(e,this.privNextSearchTextIndex),this.privTextOffset>=0&&(this.privNextSearchTextIndex=this.privTextOffset+e.length),this.privIsSSML&&this.privRawText.indexOf("<",this.privTextOffset+1)>this.privRawText.indexOf(">",this.privTextOffset+1)&&this.updateTextOffset(e))}readAllAudioFromStream(){return su(this,void 0,void 0,(function*(){if(this.privIsSynthesisEnded){this.privReceivedAudio=new ArrayBuffer(this.bytesReceived);try{yield this.privAudioOutputStream.read(this.privReceivedAudio)}catch(e){this.privReceivedAudio=new ArrayBuffer(0)}}}))}}class cu{constructor(e){let t=e.parameters.getProperty(cl.SpeechServiceConnection_Endpoint,void 0);if(!t){const n=e.parameters.getProperty(cl.SpeechServiceConnection_Region,"westus"),r=Ul.getHostSuffix(n);t=e.parameters.getProperty(cl.SpeechServiceConnection_Host,`https://${n}.tts.speech${r}`)}this.privUri=`${t}/cognitiveservices/voices/list`;const n=pd.requestOptions;n.headers[pd.configParams.subscriptionKey]=e.parameters.getProperty(cl.SpeechServiceConnection_Key,void 0),this.privRestAdapter=new(0,od.RestMessageAdapter)(n)}getVoicesList(e){return this.privRestAdapter.setHeaders(el.ConnectionId,e),this.privRestAdapter.request(od.RestRequestType.Get,this.privUri)}}(iu=ru||(ru={}))[iu.Standard=0]="Standard",iu[iu.Custom=1]="Custom";class uu{constructor(e,t){this.privSynthesisServiceType=ru.Standard,this.privSpeechServiceConfig=e||new El(new Cl(null)),this.privParameters=t}get parameters(){return this.privParameters}get synthesisServiceType(){return this.privSynthesisServiceType}set synthesisServiceType(e){this.privSynthesisServiceType=e}get SpeechServiceConfig(){return this.privSpeechServiceConfig}}class du{constructor(e){this.privContext={},this.privSpeechSynthesizer=e}setSection(e,t){this.privContext[e]=t}set audioOutputFormat(e){this.privAudioOutputFormat=e}toJSON(){const e=this.buildSynthesisContext();return this.setSection("synthesis",e),JSON.stringify(this.privContext)}buildSynthesisContext(){return{audio:{metadataOptions:{bookmarkEnabled:!!this.privSpeechSynthesizer.bookmarkReached,sentenceBoundaryEnabled:!1,visemeEnabled:!!this.privSpeechSynthesizer.visemeReceived,wordBoundaryEnabled:!!this.privSpeechSynthesizer.wordBoundary},outputFormat:this.privAudioOutputFormat.requestAudioFormatString},language:{autoDetection:this.privSpeechSynthesizer.autoDetectSourceLanguage}}}}(au=ou||(ou={}))[au.TextIndependentIdentification=0]="TextIndependentIdentification",au[au.TextDependentVerification=1]="TextDependentVerification",au[au.TextIndependentVerification=2]="TextIndependentVerification";const fu="OutputFormat",hu="CancellationErrorCode",pu="ServiceProperties",mu="ForceDictation";var gu=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class vu{constructor(e,t,n,r){this.privRecorder=e,this.deviceId=t,this.privStreams={},this.turnOn=()=>{if(this.privInitializeDeferral)return this.privInitializeDeferral.promise;this.privInitializeDeferral=new bs;try{this.createAudioContext()}catch(e){if(e instanceof Error){const t=e;this.privInitializeDeferral.reject(t.name+": "+t.message)}else this.privInitializeDeferral.reject(e);return this.privInitializeDeferral.promise}const e=window.navigator;let t=e.getUserMedia||e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia;if(e.mediaDevices&&(t=(t,n,r)=>{e.mediaDevices.getUserMedia(t).then(n).catch(r)}),t){const e=()=>{this.onEvent(new Ya(this.privId)),this.privMediaStream&&this.privMediaStream.active?(this.onEvent(new Ja(this.privId)),this.privInitializeDeferral.resolve()):t({audio:!this.deviceId||{deviceId:this.deviceId},video:!1},(e=>{this.privMediaStream=e,this.onEvent(new Ja(this.privId)),this.privInitializeDeferral.resolve()}),(e=>{const t=`Error occurred during microphone initialization: ${e}`;this.privInitializeDeferral.reject(t),this.onEvent(new Xa(this.privId,t))}))};"suspended"===this.privContext.state?this.privContext.resume().then(e).catch((e=>{this.privInitializeDeferral.reject(`Failed to initialize audio context: ${e}`)})):e()}else{const e="Browser does not support getUserMedia.";this.privInitializeDeferral.reject(e),this.onEvent(new Xa(e,""))}return this.privInitializeDeferral.promise},this.id=()=>this.privId,this.attach=e=>(this.onEvent(new $a(this.privId,e)),this.listen(e).then((t=>(this.onEvent(new es(this.privId,e)),{detach:()=>gu(this,void 0,void 0,(function*(){return t.readEnded(),delete this.privStreams[e],this.onEvent(new ts(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()})))),this.detach=e=>{e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new ts(this.privId,e)))},this.listen=e=>gu(this,void 0,void 0,(function*(){yield this.turnOn();const t=new Ns(this.privOutputChunkSize,e);this.privStreams[e]=t;try{this.privRecorder.record(this.privContext,this.privMediaStream,t)}catch(t){throw this.onEvent(new ns(this.privId,e,t)),t}return t})),this.onEvent=e=>{this.privEvents.onEvent(e),ys.instance.onEvent(e)},this.createAudioContext=()=>{this.privContext||(this.privContext=Ac.getAudioContext(vu.AUDIOFORMAT.samplesPerSec))},this.privOutputChunkSize=vu.AUDIOFORMAT.avgBytesPerSec/10,this.privId=n||Ba(),this.privEvents=new vs,this.privMediaStream=r||null,this.privIsClosing=!1}get format(){return Promise.resolve(vu.AUDIOFORMAT)}get blob(){return Promise.reject("Not implemented for Mic input")}turnOff(){return gu(this,void 0,void 0,(function*(){for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&t.close()}this.onEvent(new Qa(this.privId)),this.privInitializeDeferral&&(yield this.privInitializeDeferral,this.privInitializeDeferral=null),yield this.destroyAudioContext()}))}get events(){return this.privEvents}get deviceInfo(){return this.getMicrophoneLabel().then((e=>({bitspersample:vu.AUDIOFORMAT.bitsPerSample,channelcount:vu.AUDIOFORMAT.channels,connectivity:bl.Unknown,manufacturer:"Speech SDK",model:e,samplerate:vu.AUDIOFORMAT.samplesPerSec,type:xl.Microphones})))}setProperty(e,t){if("MICROPHONE-WorkletSourceUrl"!==e)throw new Error("Property '"+e+"' is not supported on Microphone.");this.privRecorder.setWorkletUrl(t)}getMicrophoneLabel(){const e="microphone";if(void 0!==this.privMicrophoneLabel)return Promise.resolve(this.privMicrophoneLabel);if(void 0===this.privMediaStream||!this.privMediaStream.active)return Promise.resolve(e);this.privMicrophoneLabel=e;const t=this.privMediaStream.getTracks()[0].getSettings().deviceId;if(void 0===t)return Promise.resolve(this.privMicrophoneLabel);const n=new bs;return navigator.mediaDevices.enumerateDevices().then((e=>{for(const n of e)if(n.deviceId===t){this.privMicrophoneLabel=n.label;break}n.resolve(this.privMicrophoneLabel)}),(()=>n.resolve(this.privMicrophoneLabel))),n.promise}destroyAudioContext(){return gu(this,void 0,void 0,(function*(){if(!this.privContext)return;this.privRecorder.releaseMediaResources(this.privContext);let e=!1;"close"in this.privContext&&(e=!0),e?this.privIsClosing||(this.privIsClosing=!0,yield this.privContext.close(),this.privContext=null,this.privIsClosing=!1):null!==this.privContext&&"running"===this.privContext.state&&(yield this.privContext.suspend())}))}}vu.AUDIOFORMAT=_c.getDefaultInputFormat();var yu={};e(yu,"FileAudioSource",(()=>wu),(e=>wu=e));var bu=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class wu{constructor(e,t,n){this.privStreams={},this.privHeaderEnd=44,this.turnOn=()=>{if(this.privFilename.lastIndexOf(".wav")!==this.privFilename.length-4){const e=this.privFilename+" is not supported. Only WAVE files are allowed at the moment.";return this.onEvent(new Xa(e,"")),Promise.reject(e)}this.onEvent(new Ya(this.privId)),this.onEvent(new Ja(this.privId))},this.id=()=>this.privId,this.attach=e=>bu(this,void 0,void 0,(function*(){this.onEvent(new $a(this.privId,e));const t=yield this.upload(e);return this.onEvent(new es(this.privId,e)),Promise.resolve({detach:()=>bu(this,void 0,void 0,(function*(){t.readEnded(),delete this.privStreams[e],this.onEvent(new ts(this.privId,e)),yield this.turnOff()})),id:()=>e,read:()=>t.read()})})),this.detach=e=>{e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new ts(this.privId,e)))},this.turnOff=()=>{for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&!t.isClosed&&t.close()}return this.onEvent(new Qa(this.privId)),Promise.resolve()},this.onEvent=e=>{this.privEvents.onEvent(e),ys.instance.onEvent(e)},this.privId=n||Ba(),this.privEvents=new vs,this.privSource=e,"undefined"!=typeof window&&"undefined"!=typeof Blob&&this.privSource instanceof Blob?this.privFilename=e.name:this.privFilename=t||"unknown.wav",this.privAudioFormatPromise=this.readHeader()}get format(){return this.privAudioFormatPromise}get blob(){return Promise.resolve(this.privSource)}get events(){return this.privEvents}get deviceInfo(){return this.privAudioFormatPromise.then((e=>Promise.resolve({bitspersample:e.bitsPerSample,channelcount:e.channels,connectivity:bl.Unknown,manufacturer:"Speech SDK",model:"File",samplerate:e.samplesPerSec,type:xl.File})))}readHeader(){const e=this.privSource.slice(0,512),t=new bs,n=e=>{const n=new DataView(e),r=e=>String.fromCharCode(n.getUint8(e),n.getUint8(e+1),n.getUint8(e+2),n.getUint8(e+3));if("RIFF"!==r(0))return void t.reject("Invalid WAV header in file, RIFF was not found");if("WAVE"!==r(8)||"fmt "!==r(12))return void t.reject("Invalid WAV header in file, WAVEfmt was not found");const i=n.getInt32(16,!0),o=n.getUint16(22,!0),a=n.getUint32(24,!0),s=n.getUint16(34,!0);let l=36+Math.max(i-16,0);for(;"data"!==r(l);l+=2)if(l>504)return void t.reject("Invalid WAV header in file, data block was not found");this.privHeaderEnd=l+8,t.resolve(_c.getWaveFormatPCM(a,s,o))};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&e instanceof Blob){const t=new FileReader;t.onload=e=>{const t=e.target.result;n(t)},t.readAsArrayBuffer(e)}else{const t=e;n(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength))}return t.promise}upload(e){return bu(this,void 0,void 0,(function*(){const t=t=>{const n=`Error occurred while processing '${this.privFilename}'. ${t}`;throw this.onEvent(new ns(this.privId,e,n)),new Error(n)};try{yield this.turnOn();const n=yield this.privAudioFormatPromise,r=new Ns(n.avgBytesPerSec/10,e);this.privStreams[e]=r;const i=this.privSource.slice(this.privHeaderEnd),o=e=>{r.isClosed||(r.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()}),r.close())};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&i instanceof Blob){const e=new FileReader;e.onerror=e=>{t(e.toString())},e.onload=e=>{const t=e.target.result;o(t)},e.readAsArrayBuffer(i)}else{const e=i;o(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}return r}catch(e){t(e)}}))}}class xu{constructor(e){this.record=(e,t,n)=>{const r=new ks(e.sampleRate,16e3);let i=!0;const o=e.createMediaStreamSource(t);if(!this.privSpeechProcessorScript){const e=new Blob(["class SP extends AudioWorkletProcessor {\n constructor(options) {\n super(options);\n }\n process(inputs, outputs) {\n const input = inputs[0];\n const output = [];\n for (let channel = 0; channel < input.length; channel += 1) {\n output[channel] = input[channel];\n }\n this.port.postMessage(output[0]);\n return true;\n }\n }\n registerProcessor('speech-processor', SP);"],{type:"application/javascript; charset=utf-8"});this.privSpeechProcessorScript=URL.createObjectURL(e)}const a=()=>{const a=(()=>{let t=0;try{return e.createScriptProcessor(t,1,1)}catch(n){t=2048;let r=e.sampleRate;for(;t<16384&&r>=32e3;)t<<=1,r>>=1;return e.createScriptProcessor(t,1,1)}})();a.onaudioprocess=e=>{const t=e.inputBuffer.getChannelData(0);if(n&&!n.isClosed){const e=r.encode(t);e&&(n.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()}),i=!1)}},o.connect(a),a.connect(e.destination),this.privMediaResources={scriptProcessorNode:a,source:o,stream:t}};if(this.privSpeechProcessorScript&&e.audioWorklet)e.audioWorklet.addModule(this.privSpeechProcessorScript).then((()=>{const a=new AudioWorkletNode(e,"speech-processor");a.port.onmessage=e=>{const t=e.data;if(n&&!n.isClosed){const e=r.encode(t);e&&(n.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()}),i=!1)}},o.connect(a),a.connect(e.destination),this.privMediaResources={scriptProcessorNode:a,source:o,stream:t}})).catch((()=>{a()}));else try{a()}catch(e){throw new Error(`Unable to start audio worklet node for PCMRecorder: ${e}`)}},this.releaseMediaResources=e=>{this.privMediaResources&&(this.privMediaResources.scriptProcessorNode&&(this.privMediaResources.scriptProcessorNode.disconnect(e.destination),this.privMediaResources.scriptProcessorNode=null),this.privMediaResources.source&&(this.privMediaResources.source.disconnect(),this.privStopInputOnRelease&&this.privMediaResources.stream.getTracks().forEach((e=>e.stop())),this.privMediaResources.source=null))},this.privStopInputOnRelease=e}setWorkletUrl(e){this.privSpeechProcessorScript=e}}var Su={};e(Su,"WebsocketConnection",(()=>td),(e=>td=e));var Mu={};e(Mu,"WebsocketMessageAdapter",(()=>$u),(e=>$u=e));var _u=a("1DJXa"),Au={};e(Au,"CertCheckAgent",(()=>Xu),(e=>Xu=e));var Eu,Cu;_u=a("1DJXa");Cu=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e};var ku,Tu,Iu={};e(Iu,"stringify",(()=>ku),(e=>ku=e)),e(Iu,"parse",(()=>Tu),(e=>Tu=e));var Ou=Object.prototype.hasOwnProperty;function Ru(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Pu(e){try{return encodeURIComponent(e)}catch(e){return null}}ku=function(e,t){t=t||"";var n,r,i=[];for(r in"string"!=typeof t&&(t="?"),e)if(Ou.call(e,r)){if((n=e[r])||null!=n&&!isNaN(n)||(n=""),r=Pu(r),n=Pu(n),null===r||null===n)continue;i.push(r+"="+n)}return i.length?t+i.join("&"):""},Tu=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var i=Ru(t[1]),o=Ru(t[2]);null===i||null===o||i in r||(r[i]=o)}return r};var Nu=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Lu=/[\n\r\t]/g,Du=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Bu=/:\d+$/,ju=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Fu=/^[a-zA-Z]:/;function Uu(e){return(e||"").toString().replace(Nu,"")}var zu=[["#","hash"],["?","query"],function(e,t){return Wu(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Hu={hash:1,query:1};function Vu(e){var n,r=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},i={},o=typeof(e=e||r);if("blob:"===e.protocol)i=new qu(unescape(e.pathname),{});else if("string"===o)for(n in i=new qu(e,{}),Hu)delete i[n];else if("object"===o){for(n in e)n in Hu||(i[n]=e[n]);void 0===i.slashes&&(i.slashes=Du.test(e.href))}return i}function Wu(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function Gu(e,t){e=(e=Uu(e)).replace(Lu,""),t=t||{};var n,r=ju.exec(e),i=r[1]?r[1].toLowerCase():"",o=!!r[2],a=!!r[3],s=0;return o?a?(n=r[2]+r[3]+r[4],s=r[2].length+r[3].length):(n=r[2]+r[4],s=r[2].length):a?(n=r[3]+r[4],s=r[3].length):n=r[4],"file:"===i?s>=2&&(n=n.slice(2)):Wu(i)?n=r[4]:i?o&&(n=n.slice(2)):s>=2&&Wu(t.protocol)&&(n=r[4]),{protocol:i,slashes:o||Wu(i),slashesCount:s,rest:n}}function qu(e,t,n){if(e=(e=Uu(e)).replace(Lu,""),!(this instanceof qu))return new qu(e,t,n);var r,i,o,a,s,l,c=zu.slice(),u=typeof t,d=this,f=0;for("object"!==u&&"string"!==u&&(n=t,t=null),n&&"function"!=typeof n&&(n=Iu.parse),r=!(i=Gu(e||"",t=Vu(t))).protocol&&!i.slashes,d.slashes=i.slashes||r&&t.slashes,d.protocol=i.protocol||t.protocol||"",e=i.rest,("file:"===i.protocol&&(2!==i.slashesCount||Fu.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!Wu(d.protocol)))&&(c[3]=[/(.*)/,"pathname"]);f<c.length;f++)"function"!=typeof(a=c[f])?(o=a[0],l=a[1],o!=o?d[l]=e:"string"==typeof o?~(s="@"===o?e.lastIndexOf(o):e.indexOf(o))&&("number"==typeof a[2]?(d[l]=e.slice(0,s),e=e.slice(s+a[2])):(d[l]=e.slice(s),e=e.slice(0,s))):(s=o.exec(e))&&(d[l]=s[1],e=e.slice(0,s.index)),d[l]=d[l]||r&&a[3]&&t[l]||"",a[4]&&(d[l]=d[l].toLowerCase())):e=a(e,d);n&&(d.query=n(d.query)),r&&t.slashes&&"/"!==d.pathname.charAt(0)&&(""!==d.pathname||""!==t.pathname)&&(d.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=n.length,i=n[r-1],o=!1,a=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),a++):a&&(0===r&&(o=!0),n.splice(r,1),a--);return o&&n.unshift(""),"."!==i&&".."!==i||n.push(""),n.join("/")}(d.pathname,t.pathname)),"/"!==d.pathname.charAt(0)&&Wu(d.protocol)&&(d.pathname="/"+d.pathname),Cu(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(~(s=d.auth.indexOf(":"))?(d.username=d.auth.slice(0,s),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(s+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin="file:"!==d.protocol&&Wu(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}qu.prototype={set:function(e,t,n){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||Iu.parse)(t)),r[e]=t;break;case"port":r[e]=t,Cu(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,Bu.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!n;break;case"pathname":case"hash":if(t){var i="pathname"===e?"/":"#";r[e]=t.charAt(0)!==i?i+t:t}else r[e]=t;break;case"username":case"password":r[e]=encodeURIComponent(t);break;case"auth":var o=t.indexOf(":");~o?(r.username=t.slice(0,o),r.username=encodeURIComponent(decodeURIComponent(r.username)),r.password=t.slice(o+1),r.password=encodeURIComponent(decodeURIComponent(r.password))):r.username=encodeURIComponent(decodeURIComponent(t))}for(var a=0;a<zu.length;a++){var s=zu[a];s[4]&&(r[s[1]]=r[s[1]].toLowerCase())}return r.auth=r.password?r.username+":"+r.password:r.username,r.origin="file:"!==r.protocol&&Wu(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=Iu.stringify);var t,n=this,r=n.host,i=n.protocol;i&&":"!==i.charAt(i.length-1)&&(i+=":");var o=i+(n.protocol&&n.slashes||Wu(n.protocol)?"//":"");return n.username?(o+=n.username,n.password&&(o+=":"+n.password),o+="@"):n.password?(o+=":"+n.password,o+="@"):"file:"!==n.protocol&&Wu(n.protocol)&&!r&&"/"!==n.pathname&&(o+="@"),(":"===r[r.length-1]||Bu.test(n.hostname)&&!n.port)&&(r+=":"),o+=r+n.pathname,(t="object"==typeof n.query?e(n.query):n.query)&&(o+="?"!==t.charAt(0)?"?"+t:t),n.hash&&(o+=n.hash),o}},qu.extractProtocol=Gu,qu.location=Vu,qu.trimLeft=Uu,qu.qs=Iu,Eu=qu;var Ku=a("5U18c"),Yu=(_u=a("1DJXa"),_u=a("1DJXa"),_u=a("1DJXa"),_u=a("1DJXa"),a("bqBrJ").Buffer),Ju=a("ePtPP"),Qu=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Xu{constructor(e){e&&(this.privProxyInfo=e),Xu.privDiskCache||(Xu.privDiskCache=new(r(_u))("microsoft-cognitiveservices-speech-sdk-cache",{supportBuffer:!0,location:void 0}))}static forceReinitDiskCache(){Xu.privDiskCache=void 0,Xu.privMemCache={}}GetAgent(e){const t=new(r(_u).Agent)(this.CreateConnection);if(void 0!==this.privProxyInfo&&void 0!==this.privProxyInfo.HostName&&this.privProxyInfo.Port>0){t["privProxyInfo"]=this.privProxyInfo}return t}static GetProxyAgent(e){const t={host:e.HostName,port:e.Port};e.UserName?t.headers={"Proxy-Authentication":"Basic "+new Yu(e.UserName+":"+(void 0===e.Password)?"":e.Password).toString("base64")}:t.headers={},t.headers.requestOCSP="true";return new(r(_u))(t)}static OCSPCheck(e,t){return Qu(this,void 0,void 0,(function*(){let n,r,i=!1;const o=yield e;o.cork();const a=o;return new Promise(((e,s)=>{o.on("OCSPResponse",(e=>{e&&(this.onEvent(new Ws),r=e)})),o.on("error",(e=>{i||(i=!0,o.destroy(),s(e))})),a.on("secure",(()=>Qu(this,void 0,void 0,(function*(){const l=a.getPeerCertificate(!0);try{const a=yield this.GetIssuer(l);n=Ku.request.generate(l.raw,a.raw);const s=n.id.toString("hex");if(!r){const e=yield Xu.GetResponseFromCache(s,n,t);r=e}yield this.VerifyOCSPResponse(r,n,t),o.uncork(),i=!0,e(o)}catch(e){o.destroy(),i=!0,s(e)}}))))}))}))}static GetIssuer(e){return e.issuerCertificate?Promise.resolve(e.issuerCertificate):new Promise(((t,n)=>{new Ku.Agent({}).fetchIssuer(e,null,((e,r)=>{e?n(e):t(r)}))}))}static GetResponseFromCache(e,t,n){return Qu(this,void 0,void 0,(function*(){let r=Xu.privMemCache[e];if(r&&this.onEvent(new Bs(e)),!r)try{const t=yield Xu.privDiskCache.get(e);t.isCached&&(Xu.onEvent(new Fs(e)),Xu.StoreMemoryCacheEntry(e,t.value),r=t.value)}catch(e){r=null}if(!r)return r;try{const i=Ku.utils.parseResponse(r).value.tbsResponseData;if(i.responses.length<1)return void this.onEvent(new Js(e,"Not enough data in cached response"));const o=i.responses[0].thisUpdate,a=i.responses[0].nextUpdate;if(a<Date.now()+this.testTimeOffset-6e4)this.onEvent(new Gs(e,a)),r=null;else{const r=Math.min(864e5,(a-o)/2);a-(Date.now()+this.testTimeOffset)<r?(this.onEvent(new qs(e,o,a)),this.UpdateCache(t,n).catch((t=>{this.onEvent(new Xs(e,t.toString()))}))):this.onEvent(new Ks(e,o,a))}}catch(t){this.onEvent(new Js(e,t)),r=null}return r||this.onEvent(new js(e)),r}))}static VerifyOCSPResponse(e,t,n){return Qu(this,void 0,void 0,(function*(){let r=e;t.certID.toString("hex");return r||(r=yield Xu.GetOCSPResponse(t,n)),new Promise(((i,o)=>{Ku.verify({request:t,response:r},((a,s)=>{a?(Xu.onEvent(new Ys(t.id.toString("hex"),a)),e?this.VerifyOCSPResponse(null,t,n).then((()=>{i()}),(e=>{o(e)})):o(a)):(e||Xu.StoreCacheEntry(t.id.toString("hex"),r),i())}))}))}))}static UpdateCache(e,t){return Qu(this,void 0,void 0,(function*(){const n=e.id.toString("hex");this.onEvent(new Us(n));const r=yield this.GetOCSPResponse(e,t);this.StoreCacheEntry(n,r),this.onEvent(new Vs(e.id.toString("hex")))}))}static StoreCacheEntry(e,t){this.StoreMemoryCacheEntry(e,t),this.StoreDiskCacheEntry(e,t)}static StoreMemoryCacheEntry(e,t){this.privMemCache[e]=t,this.onEvent(new zs(e))}static StoreDiskCacheEntry(e,t){this.privDiskCache.set(e,t).then((()=>{this.onEvent(new Hs(e))}))}static GetOCSPResponse(e,t){let n={};if(t){const e=Xu.GetProxyAgent(t);n.agent=e}return new Promise(((t,i)=>{Ku.utils.getAuthorityInfo(e.cert,"1.3.6.1.5.5.7.48.1",((o,a)=>{if(o)return void i(o);const s=r(Eu)(a);s.path=s.pathname,n=Object.assign(Object.assign({},n),s),Ku.utils.getResponse(n,e.data,((n,r)=>{n?i(n):(this.onEvent(new Qs(e.certID.toString("hex"))),t(r))}))}))}))}CreateConnection(e,t){const n=void 0!==Ju&&t.secureEndpoint;let r;if(t=Object.assign(Object.assign({},t),{requestOCSP:!Xu.forceDisableOCSPStapling,servername:t.host}),this.privProxyInfo){const n=Xu.GetProxyAgent(this.privProxyInfo);r=new Promise(((r,i)=>{n.callback(e,t,((e,t)=>{e?i(e):r(t)}))}))}else r=(t.secureEndpoint,Promise.resolve(_u.connect(t)));return n?Xu.OCSPCheck(r,this.privProxyInfo):r}}Xu.testTimeOffset=0,Xu.forceDisableOCSPStapling=!1,Xu.privMemCache={},Xu.onEvent=e=>{ys.instance.onEvent(e)};var Zu=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class $u{constructor(e,t,n,i,o,a){if(this.open=()=>{if(this.privConnectionState===Ha.Disconnected)return Promise.reject(`Cannot open a connection that is in ${this.privConnectionState} state`);if(this.privConnectionEstablishDeferral)return this.privConnectionEstablishDeferral.promise;this.privConnectionEstablishDeferral=new bs,this.privCertificateValidatedDeferral=new bs,this.privConnectionState=Ha.Connecting;try{if("undefined"==typeof WebSocket||$u.forceNpmWebSocket){const e={headers:this.privHeaders,perMessageDeflate:this.privEnableCompression};this.privCertificateValidatedDeferral.resolve();const t=new(0,Au.CertCheckAgent)(this.proxyInfo);e.agent=t.GetAgent();let n=new URL(this.privUri).protocol;"wss:"===(null==n?void 0:n.toLocaleLowerCase())?n="https:":"ws:"===(null==n?void 0:n.toLocaleLowerCase())&&(n="http:"),e.agent.protocol=n,this.privWebsocketClient=new(r(_u))(this.privUri,e)}else this.privCertificateValidatedDeferral.resolve(),this.privWebsocketClient=new WebSocket(this.privUri);this.privWebsocketClient.binaryType="arraybuffer",this.privReceivingMessageQueue=new(0,xs.Queue),this.privDisconnectDeferral=new bs,this.privSendMessageQueue=new(0,xs.Queue),this.processSendQueue().catch((e=>{ys.instance.onEvent(new Zs(e))}))}catch(e){return this.privConnectionEstablishDeferral.resolve(new gs(500,e)),this.privConnectionEstablishDeferral.promise}return this.onEvent(new os(this.privConnectionId,this.privUri)),this.privWebsocketClient.onopen=e=>{this.privCertificateValidatedDeferral.promise.then((()=>{this.privConnectionState=Ha.Connected,this.onEvent(new as(this.privConnectionId)),this.privConnectionEstablishDeferral.resolve(new gs(200,""))}),(e=>{this.privConnectionEstablishDeferral.reject(e)}))},this.privWebsocketClient.onerror=e=>{this.onEvent(new ls(this.privConnectionId,e.message,e.type)),this.privLastErrorReceived=e.message},this.privWebsocketClient.onclose=e=>{this.privConnectionState===Ha.Connecting?(this.privConnectionState=Ha.Disconnected,this.privConnectionEstablishDeferral.resolve(new gs(e.code,e.reason+" "+this.privLastErrorReceived))):(this.privConnectionState=Ha.Disconnected,this.privWebsocketClient=null,this.onEvent(new ss(this.privConnectionId,e.code,e.reason))),this.onClose(e.code,e.reason).catch((e=>{ys.instance.onEvent(new Zs(e))}))},this.privWebsocketClient.onmessage=e=>{const t=(new Date).toISOString();if(this.privConnectionState===Ha.Connected){const n=new bs;if(this.privReceivingMessageQueue.enqueueFromPromise(n.promise),e.data instanceof ArrayBuffer){const r=new Cs(Ua.Binary,e.data);this.privMessageFormatter.toConnectionMessage(r).then((e=>{this.onEvent(new us(this.privConnectionId,t,e)),n.resolve(e)}),(e=>{n.reject(`Invalid binary message format. Error: ${e}`)}))}else{const r=new Cs(Ua.Text,e.data);this.privMessageFormatter.toConnectionMessage(r).then((e=>{this.onEvent(new us(this.privConnectionId,t,e)),n.resolve(e)}),(e=>{n.reject(`Invalid text message format. Error: ${e}`)}))}}},this.privConnectionEstablishDeferral.promise},this.send=e=>{if(this.privConnectionState!==Ha.Connected)return Promise.reject(`Cannot send on connection that is in ${Ha[this.privConnectionState]} state`);const t=new bs,n=new bs;return this.privSendMessageQueue.enqueueFromPromise(n.promise),this.privMessageFormatter.fromConnectionMessage(e).then((r=>{n.resolve({Message:e,RawWebsocketMessage:r,sendStatusDeferral:t})}),(e=>{n.reject(`Error formatting the message. ${e}`)})),t.promise},this.read=()=>this.privConnectionState!==Ha.Connected?Promise.reject(`Cannot read on connection that is in ${this.privConnectionState} state`):this.privReceivingMessageQueue.dequeue(),this.close=e=>this.privWebsocketClient?(this.privConnectionState!==Ha.Disconnected&&this.privWebsocketClient.close(1e3,e||"Normal closure by client"),this.privDisconnectDeferral.promise):Promise.resolve(),this.sendRawMessage=e=>{try{return e?(this.onEvent(new ds(this.privConnectionId,(new Date).toISOString(),e.Message)),this.isWebsocketOpen?(this.privWebsocketClient.send(e.RawWebsocketMessage.payload),Promise.resolve()):Promise.reject("websocket send error: Websocket not ready "+this.privConnectionId+" "+e.Message.id+" "+(new Error).stack)):Promise.resolve()}catch(e){return Promise.reject(`websocket send error: ${e}`)}},this.onEvent=e=>{this.privConnectionEvents.onEvent(e),ys.instance.onEvent(e)},!e)throw new fs("uri");if(!n)throw new fs("messageFormatter");this.proxyInfo=i,this.privConnectionEvents=new vs,this.privConnectionId=t,this.privMessageFormatter=n,this.privConnectionState=Ha.None,this.privUri=e,this.privHeaders=o,this.privEnableCompression=a,this.privHeaders[el.ConnectionId]=this.privConnectionId,this.privLastErrorReceived=""}get state(){return this.privConnectionState}get events(){return this.privConnectionEvents}onClose(e,t){return Zu(this,void 0,void 0,(function*(){const n=`Connection closed. ${e}: ${t}`;this.privConnectionState=Ha.Disconnected,this.privDisconnectDeferral.resolve(),yield this.privReceivingMessageQueue.drainAndDispose((e=>{}),n),yield this.privSendMessageQueue.drainAndDispose((e=>{e.sendStatusDeferral.reject(n)}),n)}))}processSendQueue(){return Zu(this,void 0,void 0,(function*(){for(;;){const e=this.privSendMessageQueue.dequeue(),t=yield e;if(!t)return;try{yield this.sendRawMessage(t),t.sendStatusDeferral.resolve()}catch(e){t.sendStatusDeferral.reject(e)}}}))}get isWebsocketOpen(){return this.privWebsocketClient&&this.privWebsocketClient.readyState===this.privWebsocketClient.OPEN}}$u.forceNpmWebSocket=!1;var ed=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class td{constructor(e,t,n,r,i,o=!1,a){if(this.privIsDisposed=!1,this.isDisposed=()=>this.privIsDisposed,this.state=()=>this.privConnectionMessageAdapter.state,this.open=()=>this.privConnectionMessageAdapter.open(),this.send=e=>this.privConnectionMessageAdapter.send(e),this.read=()=>this.privConnectionMessageAdapter.read(),!e)throw new fs("uri");if(!r)throw new fs("messageFormatter");this.privMessageFormatter=r;let s="",l=0;if(t)for(const n in t)if(n){s+=0===l&&-1===e.indexOf("?")?"?":"&";s+=`${n}=${encodeURIComponent(t[n])}`,l++}if(n)for(const t in n)if(t){s+=0===l&&-1===e.indexOf("?")?"?":"&";s+=`${t}=${encodeURIComponent(n[t])}`,l++}this.privUri=e+s,this.privId=a||Ba(),this.privConnectionMessageAdapter=new(0,Mu.WebsocketMessageAdapter)(this.privUri,this.id,this.privMessageFormatter,i,n,o)}dispose(){return ed(this,void 0,void 0,(function*(){this.privIsDisposed=!0,this.privConnectionMessageAdapter&&(yield this.privConnectionMessageAdapter.close())}))}get id(){return this.privId}get events(){return this.privConnectionMessageAdapter.events}}class nd{constructor(e,t){this.privBuffers=[],this.privReplayOffset=0,this.privLastShrinkOffset=0,this.privBufferStartOffset=0,this.privBufferSerial=0,this.privBufferedBytes=0,this.privReplay=!1,this.privLastChunkAcquiredTime=0,this.id=()=>this.privAudioNode.id(),this.privAudioNode=e,this.privBytesPerSecond=t}read(){if(this.privReplay&&0!==this.privBuffers.length){const e=this.privReplayOffset-this.privBufferStartOffset;let t=Math.round(e*this.privBytesPerSecond*1e-7);0!=t%2&&t++;let n=0;for(;n<this.privBuffers.length&&t>=this.privBuffers[n].chunk.buffer.byteLength;)t-=this.privBuffers[n++].chunk.buffer.byteLength;if(n<this.privBuffers.length){const e=this.privBuffers[n].chunk.buffer.slice(t);return this.privReplayOffset+=e.byteLength/this.privBytesPerSecond*1e7,n===this.privBuffers.length-1&&(this.privReplay=!1),Promise.resolve({buffer:e,isEnd:!1,timeReceived:this.privBuffers[n].chunk.timeReceived})}}return this.privAudioNode.read().then((e=>(e&&e.buffer&&(this.privBuffers.push(new rd(e,this.privBufferSerial++,this.privBufferedBytes)),this.privBufferedBytes+=e.buffer.byteLength),e)))}detach(){return this.privBuffers=void 0,this.privAudioNode.detach()}replay(){this.privBuffers&&0!==this.privBuffers.length&&(this.privReplay=!0,this.privReplayOffset=this.privLastShrinkOffset)}shrinkBuffers(e){if(void 0===this.privBuffers||0===this.privBuffers.length)return;this.privLastShrinkOffset=e;const t=e-this.privBufferStartOffset;let n=Math.round(t*this.privBytesPerSecond*1e-7),r=0;for(;r<this.privBuffers.length&&n>=this.privBuffers[r].chunk.buffer.byteLength;)n-=this.privBuffers[r++].chunk.buffer.byteLength;this.privBufferStartOffset=Math.round(e-n/this.privBytesPerSecond*1e7),this.privBuffers=this.privBuffers.slice(r)}findTimeAtOffset(e){if(e<this.privBufferStartOffset||void 0===this.privBuffers)return 0;for(const t of this.privBuffers){const n=t.byteOffset/this.privBytesPerSecond*1e7,r=n+t.chunk.buffer.byteLength/this.privBytesPerSecond*1e7;if(e>=n&&e<=r)return t.chunk.timeReceived}return 0}}class rd{constructor(e,t,n){this.chunk=e,this.serial=t,this.byteOffset=n}}class id{constructor(e,t,n,r){this.privProxyHostName=e,this.privProxyPort=t,this.privProxyUserName=n,this.privProxyPassword=r}static fromParameters(e){return new id(e.getProperty(cl.SpeechServiceConnection_ProxyHostName),parseInt(e.getProperty(cl.SpeechServiceConnection_ProxyPort),10),e.getProperty(cl.SpeechServiceConnection_ProxyUserName),e.getProperty(cl.SpeechServiceConnection_ProxyPassword))}static fromRecognizerConfig(e){return this.fromParameters(e.parameters)}get HostName(){return this.privProxyHostName}get Port(){return this.privProxyPort}get UserName(){return this.privProxyUserName}get Password(){return this.privProxyPassword}}var od={};e(od,"RestRequestType",(()=>ud),(e=>ud=e)),e(od,"RestMessageAdapter",(()=>hd),(e=>hd=e));var ad,sd;const ld=new Set(["json","buffer","string"]);sd=e=>(...t)=>{const n=new Set;let r,i,o,a="";return t.forEach((e=>{if("string"==typeof e)if(e.toUpperCase()===e){if(r){throw new Error(`Can't set method to ${e}, already set to ${r}.`)}r=e}else if(e.startsWith("http:")||e.startsWith("https:"))a=e;else{if(!ld.has(e))throw new Error(`Unknown encoding, ${e}`);i=e}else if("number"==typeof e)n.add(e);else{if("object"!=typeof e)throw new Error("Unknown type: "+typeof e);if(Array.isArray(e)||e instanceof Set)e.forEach((e=>n.add(e)));else{if(o)throw new Error("Cannot set headers twice.");o=e}}})),r||(r="GET"),0===n.size&&n.add(200),e(n,r,i,o,a)};class cd extends Error{constructor(e,...t){let n;super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,cd),this.name="StatusError",this.message=e.statusMessage,this.statusCode=e.status,this.res=e,this.json=e.json.bind(e),this.text=e.text.bind(e),this.arrayBuffer=e.arrayBuffer.bind(e);Object.defineProperty(this,"responseBody",{get:()=>(n||(n=this.arrayBuffer()),n)}),this.headers={};for(const[t,n]of e.headers.entries())this.headers[t.toLowerCase()]=n}}ad=sd(((e,t,n,r,i)=>async(o,a,s={})=>{o=i+(o||"");let l=new URL(o);if(r||(r={}),l.username&&(r.Authorization="Basic "+btoa(l.username+":"+l.password),l=new URL(l.protocol+"//"+l.host+l.pathname+l.search)),"https:"!==l.protocol&&"http:"!==l.protocol)throw new Error(`Unknown protocol, ${l.protocol}`);if(a)if(a instanceof ArrayBuffer||ArrayBuffer.isView(a)||"string"==typeof a);else{if("object"!=typeof a)throw new Error("Unknown body type.");a=JSON.stringify(a),r["Content-Type"]="application/json"}s=new Headers({...r||{},...s});const c=await fetch(l,{method:t,headers:s,body:a});if(c.statusCode=c.status,!e.has(c.status))throw new cd(c);return"json"===n?c.json():"buffer"===n?c.arrayBuffer():"string"===n?c.text():c}));var ud,dd,fd=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};(dd=ud||(ud={})).Get="GET",dd.Post="POST",dd.Delete="DELETE",dd.File="file";class hd{constructor(e){if(!e)throw new fs("configParams");this.privHeaders=e.headers,this.privIgnoreCache=e.ignoreCache}static extractHeaderValue(e,t){let n="";try{const r=t.trim().split(/[\r\n]+/),i={};r.forEach((e=>{const t=e.split(": "),n=t.shift().toLowerCase(),r=t.join(": ");i[n]=r})),n=i[e.toLowerCase()]}catch(e){}return n}set options(e){this.privHeaders=e.headers,this.privIgnoreCache=e.ignoreCache}setHeaders(e,t){this.privHeaders[e]=t}request(e,t,n={},i=null,o=null){const a=new bs,s=e===ud.File?"POST":e,l=(e,t={})=>{const n=e;return{data:JSON.stringify(t),headers:JSON.stringify(e.headers),json:t,ok:e.statusCode>=200&&e.statusCode<300,status:e.statusCode,statusText:t.error?t.error.message:n.statusText?n.statusText:n.statusMessage}},c=i=>{r(ad)(t,s,this.privHeaders,200,201,202,204,400,401,402,403,404)(""===this.queryParams(n)?"":"?"+this.queryParams(n),i).then((t=>fd(this,void 0,void 0,(function*(){if(e===ud.Delete||204===t.statusCode)a.resolve(l(t));else try{const e=yield t.json();a.resolve(l(t,e))}catch(e){a.resolve(l(t))}})))).catch((e=>{a.reject(e)}))};if(this.privIgnoreCache&&(this.privHeaders["Cache-Control"]="no-cache"),e===ud.File&&o){const e="multipart/form-data";this.privHeaders["content-type"]=e,this.privHeaders["Content-Type"]=e,"undefined"!=typeof Blob&&o instanceof Blob?(e=>{const t=new FileReader;return t.readAsArrayBuffer(e),new Promise((e=>{t.onloadend=()=>{e(t.result)}}))})(o).then((e=>{c(e)})).catch((e=>{a.reject(e)})):c(o)}else e===ud.Post&&i&&(this.privHeaders["content-type"]="application/json",this.privHeaders["Content-Type"]="application/json"),c(i);return a.promise}withQuery(e,t={}){const n=this.queryParams(t);return n?e+(-1===e.indexOf("?")?"?":"&")+n:e}queryParams(e={}){return Object.keys(e).map((t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t]))).join("&")}}class pd{static get requestOptions(){return pd.privDefaultRequestOptions}static get configParams(){return pd.privDefaultParams}static get restErrors(){return pd.privRestErrors}}pd.privDefaultRequestOptions={headers:{Accept:"application/json"},ignoreCache:!1,timeout:1e4},pd.privRestErrors={authInvalidSubscriptionKey:"You must specify either an authentication token to use, or a Cognitive Speech subscription key.",authInvalidSubscriptionRegion:"You must specify the Cognitive Speech region to use.",invalidArgs:"Required input not found: {arg}.",invalidCreateJoinConversationResponse:"Creating/Joining conversation failed with HTTP {status}.",invalidParticipantRequest:"The requested participant was not found.",permissionDeniedConnect:"Required credentials not found.",permissionDeniedConversation:"Invalid operation: only the host can {command} the conversation.",permissionDeniedParticipant:"Invalid operation: only the host can {command} a participant.",permissionDeniedSend:"Invalid operation: the conversation is not in a connected state.",permissionDeniedStart:"Invalid operation: there is already an active conversation."},pd.privDefaultParams={apiVersion:"api-version",authorization:"Authorization",clientAppId:"X-ClientAppId",contentTypeKey:"Content-Type",correlationId:"X-CorrelationId",languageCode:"language",nickname:"nickname",profanity:"profanity",requestId:"X-RequestId",roomId:"roomid",sessionToken:"token",subscriptionKey:"Ocp-Apim-Subscription-Key",subscriptionRegion:"Ocp-Apim-Subscription-Region",token:"X-CapitoToken"};class md{}var gd={};e(gd,"AudioInputStream",(()=>bd),(e=>bd=e)),e(gd,"PullAudioInputStreamImpl",(()=>Md),(e=>Md=e));var vd=a("bqBrJ").Buffer,yd=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class bd{constructor(){}static createPushStream(e){return wd.create(e)}static createPullStream(e,t){return Sd.create(e,t)}}class wd extends bd{static create(e){return new xd(e)}}class xd extends wd{constructor(e){super(),this.onEvent=e=>{this.privEvents.onEvent(e),ys.instance.onEvent(e)},this.privFormat=void 0===e?Ac.getDefaultInputFormat():e,this.privEvents=new vs,this.privId=Ba(),this.privStream=new Ns(this.privFormat.avgBytesPerSec/10)}get format(){return Promise.resolve(this.privFormat)}write(e){this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}id(){return this.privId}get blob(){return this.attach("id").then((e=>{const t=[];let n=vd.from("");const r=()=>e.read().then((e=>!e||e.isEnd?"undefined"!=typeof XMLHttpRequest&&"undefined"!=typeof Blob?Promise.resolve(new Blob(t)):Promise.resolve(vd.from(n)):("undefined"!=typeof Blob?t.push(e.buffer):n=vd.concat([n,this.toBuffer(e.buffer)]),r())));return r()}))}turnOn(){this.onEvent(new Ya(this.privId)),this.onEvent(new Ja(this.privId))}attach(e){return yd(this,void 0,void 0,(function*(){this.onEvent(new $a(this.privId,e)),yield this.turnOn();const t=this.privStream;return this.onEvent(new es(this.privId,e)),{detach:()=>yd(this,void 0,void 0,(function*(){return this.onEvent(new ts(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()}}))}detach(e){this.onEvent(new ts(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:bl.Unknown,manufacturer:"Speech SDK",model:"PushStream",samplerate:this.privFormat.samplesPerSec,type:xl.Stream})}toBuffer(e){const t=vd.alloc(e.byteLength),n=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=n[e];return t}}class Sd extends bd{constructor(){super()}static create(e,t){return new Md(e,t)}}class Md extends Sd{constructor(e,t){super(),this.onEvent=e=>{this.privEvents.onEvent(e),ys.instance.onEvent(e)},this.privFormat=void 0===t?_c.getDefaultInputFormat():t,this.privEvents=new vs,this.privId=Ba(),this.privCallback=e,this.privIsClosed=!1,this.privBufferSize=this.privFormat.avgBytesPerSec/10}get format(){return Promise.resolve(this.privFormat)}close(){this.privIsClosed=!0,this.privCallback.close()}id(){return this.privId}get blob(){return Promise.reject("Not implemented")}turnOn(){this.onEvent(new Ya(this.privId)),this.onEvent(new Ja(this.privId))}attach(e){return yd(this,void 0,void 0,(function*(){return this.onEvent(new $a(this.privId,e)),yield this.turnOn(),this.onEvent(new es(this.privId,e)),{detach:()=>(this.privCallback.close(),this.onEvent(new ts(this.privId,e)),this.turnOff()),id:()=>e,read:()=>{let e,t=0;for(;t<this.privBufferSize;){const n=new ArrayBuffer(this.privBufferSize-t),r=this.privCallback.read(n);if(void 0===e)e=n;else{new Int8Array(e).set(new Int8Array(n),t)}if(0===r)break;t+=r}return Promise.resolve({buffer:e.slice(0,t),isEnd:this.privIsClosed||0===t,timeReceived:Date.now()})}}}))}detach(e){this.onEvent(new ts(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:bl.Unknown,manufacturer:"Speech SDK",model:"PullStream",samplerate:this.privFormat.samplesPerSec,type:xl.Stream})}}var _d={};e(_d,"SpeakerAudioDestination",(()=>Cd),(e=>Cd=e));var Ad=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const Ed={[mc.PCM]:"audio/wav",[mc.MuLaw]:"audio/x-wav",[mc.MP3]:"audio/mpeg",[mc.OGG_OPUS]:"audio/ogg",[mc.WEBM_OPUS]:"audio/webm; codecs=opus",[mc.ALaw]:"audio/x-wav",[mc.FLAC]:"audio/flac"};class Cd{constructor(e){this.privPlaybackStarted=!1,this.privAppendingToBuffer=!1,this.privMediaSourceOpened=!1,this.privBytesReceived=0,this.privId=e||Ba(),this.privIsPaused=!1,this.privIsClosed=!1}id(){return this.privId}write(e,t,n){void 0!==this.privAudioBuffer?(this.privAudioBuffer.push(e),this.updateSourceBuffer().then((()=>{t&&t()}),(e=>{n&&n(e)}))):void 0!==this.privAudioOutputStream&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength)}close(e,t){if(this.privIsClosed=!0,void 0!==this.privSourceBuffer)this.handleSourceBufferUpdateEnd().then((()=>{e&&e()}),(e=>{t&&t(e)}));else if(void 0!==this.privAudioOutputStream)if(this.privFormat.formatTag!==mc.PCM&&this.privFormat.formatTag!==mc.MuLaw&&this.privFormat.formatTag!==mc.ALaw||!1!==this.privFormat.hasHeader){let n=new ArrayBuffer(this.privBytesReceived);this.privAudioOutputStream.read(n).then((r=>{n=Wc.SynthesisAdapterBase.addHeader(n,this.privFormat);const i=new Blob([n],{type:Ed[this.privFormat.formatTag]});this.privAudio.src=window.URL.createObjectURL(i),this.notifyPlayback().then((()=>{e&&e()}),(e=>{t&&t(e)}))}),(e=>{t&&t(e)}))}else console.warn("Play back is not supported for raw PCM, mulaw or alaw format without header."),this.onAudioEnd&&this.onAudioEnd(this);else this.onAudioEnd&&this.onAudioEnd(this)}set format(e){if("undefined"!=typeof AudioContext||void 0!==window.webkitAudioContext){this.privFormat=e;const t=Ed[this.privFormat.formatTag];void 0===t?console.warn(`Unknown mimeType for format ${mc[this.privFormat.formatTag]}; playback is not supported.`):"undefined"!=typeof MediaSource&&MediaSource.isTypeSupported(t)?(this.privAudio=new Audio,this.privAudioBuffer=[],this.privMediaSource=new MediaSource,this.privAudio.src=URL.createObjectURL(this.privMediaSource),this.privAudio.load(),this.privMediaSource.onsourceopen=e=>{this.privMediaSourceOpened=!0,this.privMediaSource.duration=1800,this.privSourceBuffer=this.privMediaSource.addSourceBuffer(t),this.privSourceBuffer.onupdate=e=>{this.updateSourceBuffer().catch((e=>{ys.instance.onEvent(new Zs(e))}))},this.privSourceBuffer.onupdateend=e=>{this.handleSourceBufferUpdateEnd().catch((e=>{ys.instance.onEvent(new Zs(e))}))},this.privSourceBuffer.onupdatestart=e=>{this.privAppendingToBuffer=!1}},this.updateSourceBuffer().catch((e=>{ys.instance.onEvent(new Zs(e))}))):(console.warn(`Format ${mc[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`),this.privAudioOutputStream=new(0,Ic.PullAudioOutputStreamImpl),this.privAudioOutputStream.format=this.privFormat,this.privAudio=new Audio)}}get volume(){return this.privAudio.volume}set volume(e){this.privAudio.volume=e}mute(){this.privAudio.muted=!0}unmute(){this.privAudio.muted=!1}get isClosed(){return this.privIsClosed}get currentTime(){return void 0!==this.privAudio?this.privAudio.currentTime:-1}pause(){this.privIsPaused||void 0===this.privAudio||(this.privAudio.pause(),this.privIsPaused=!0)}resume(e,t){this.privIsPaused&&void 0!==this.privAudio&&(this.privAudio.play().then((()=>{e&&e()}),(e=>{t&&t(e)})),this.privIsPaused=!1)}get internalAudio(){return this.privAudio}updateSourceBuffer(){return Ad(this,void 0,void 0,(function*(){if(void 0!==this.privAudioBuffer&&this.privAudioBuffer.length>0&&this.sourceBufferAvailable()){this.privAppendingToBuffer=!0;const e=this.privAudioBuffer.shift();try{this.privSourceBuffer.appendBuffer(e)}catch(t){return this.privAudioBuffer.unshift(e),void console.log("buffer filled, pausing addition of binaries until space is made")}yield this.notifyPlayback()}else this.canEndStream()&&(yield this.handleSourceBufferUpdateEnd())}))}handleSourceBufferUpdateEnd(){return Ad(this,void 0,void 0,(function*(){this.canEndStream()&&this.sourceBufferAvailable()&&(this.privMediaSource.endOfStream(),yield this.notifyPlayback())}))}notifyPlayback(){return Ad(this,void 0,void 0,(function*(){this.privPlaybackStarted||void 0===this.privAudio||(this.privPlaybackStarted=!0,this.onAudioStart&&this.onAudioStart(this),this.privAudio.onended=()=>{this.onAudioEnd&&this.onAudioEnd(this)},this.privIsPaused||(yield this.privAudio.play()))}))}canEndStream(){return this.isClosed&&void 0!==this.privSourceBuffer&&0===this.privAudioBuffer.length&&this.privMediaSourceOpened&&!this.privAppendingToBuffer&&"open"===this.privMediaSource.readyState}sourceBufferAvailable(){return void 0!==this.privSourceBuffer&&!this.privSourceBuffer.updating}}class kd{}_u=a("1DJXa");class Td{constructor(e){this.id=()=>this.privId,Wl.throwIfNullOrUndefined(_u.openSync,"\nFile System access not available, please use Push or PullAudioOutputStream"),this.privFd=_u.openSync(e,"w")}set format(e){Wl.throwIfNotUndefined(this.privAudioFormat,"format is already set"),this.privAudioFormat=e;let t=0;this.privAudioFormat.hasHeader&&(t=this.privAudioFormat.header.byteLength),void 0!==this.privFd&&(this.privWriteStream=_u.createWriteStream("",{fd:this.privFd,start:t,autoClose:!1}))}write(e){Wl.throwIfNullOrUndefined(this.privAudioFormat,"must set format before writing."),void 0!==this.privWriteStream&&this.privWriteStream.write(new Uint8Array(e.slice(0)))}close(){void 0!==this.privFd&&(this.privWriteStream.on("finish",(()=>{this.privAudioFormat.hasHeader&&(this.privAudioFormat.updateHeader(this.privWriteStream.bytesWritten),_u.writeSync(this.privFd,new Int8Array(this.privAudioFormat.header),0,this.privAudioFormat.header.byteLength,0)),_u.closeSync(this.privFd),this.privFd=void 0})),this.privWriteStream.end())}}class Id{static fromDefaultMicrophoneInput(){const e=new xu(!0);return new Od(new(0,$s.MicAudioSource)(e))}static fromMicrophoneInput(e){const t=new xu(!0);return new Od(new(0,$s.MicAudioSource)(t,e))}static fromWavFileInput(e,t="unnamedBuffer.wav"){return new Od(new(0,yu.FileAudioSource)(e,t))}static fromStreamInput(e){if(e instanceof md)return new Od(new(0,gd.PullAudioInputStreamImpl)(e));if(e instanceof gd.AudioInputStream)return new Od(e);if("undefined"!=typeof MediaStream&&e instanceof MediaStream){const t=new xu(!1);return new Od(new(0,$s.MicAudioSource)(t,null,null,e))}throw new Error("Not Supported Type")}static fromDefaultSpeakerOutput(){return new Rd(new(0,_d.SpeakerAudioDestination))}static fromSpeakerOutput(e){if(void 0===e)return Id.fromDefaultSpeakerOutput();if(e instanceof _d.SpeakerAudioDestination)return new Rd(e);throw new Error("Not Supported Type")}static fromAudioFileOutput(e){return new Rd(new Td(e))}static fromStreamOutput(e){if(e instanceof kd)return new Rd(new(0,Ic.PushAudioOutputStreamImpl)(e));if(e instanceof Ic.PushAudioOutputStream)return new Rd(e);if(e instanceof Ic.PullAudioOutputStream)return new Rd(e);throw new Error("Not Supported Type")}}class Od extends Id{constructor(e){super(),this.privSource=e}get format(){return this.privSource.format}close(e,t){this.privSource.turnOff().then((()=>{e&&e()}),(e=>{t&&t(e)}))}id(){return this.privSource.id()}get blob(){return this.privSource.blob}turnOn(){return this.privSource.turnOn()}attach(e){return this.privSource.attach(e)}detach(e){return this.privSource.detach(e)}turnOff(){return this.privSource.turnOff()}get events(){return this.privSource.events}setProperty(e,t){if(Wl.throwIfNull(t,"value"),void 0===this.privSource.setProperty)throw new Error("This AudioConfig instance does not support setting properties.");this.privSource.setProperty(e,t)}getProperty(e,t){if(void 0!==this.privSource.getProperty)return this.privSource.getProperty(e,t);throw new Error("This AudioConfig instance does not support getting properties.")}get deviceInfo(){return this.privSource.deviceInfo}}class Rd extends Id{constructor(e){super(),this.privDestination=e}set format(e){this.privDestination.format=e}write(e){this.privDestination.write(e)}close(){this.privDestination.close()}id(){return this.privDestination.id()}setProperty(e,t){throw new Error("This AudioConfig instance does not support setting properties.")}getProperty(e,t){throw new Error("This AudioConfig instance does not support getting properties.")}}var Pd={};e(Pd,"SpeechRecognizer",(()=>jd),(e=>jd=e));var Nd={};e(Nd,"Recognizer",(()=>Dd),(e=>Dd=e));var Ld=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Dd{constructor(e,t,n){this.audioConfig=void 0!==e?e:Id.fromDefaultMicrophoneInput(),this.privDisposed=!1,this.privProperties=t.clone(),this.privConnectionFactory=n,this.implCommonRecognizerSetup()}close(e,t){Wl.throwIfDisposed(this.privDisposed),ws(this.dispose(!0),e,t)}get internalData(){return this.privReco}dispose(e){return Ld(this,void 0,void 0,(function*(){this.privDisposed||(this.privDisposed=!0,e&&this.privReco&&(yield this.privReco.audioSource.turnOff(),yield this.privReco.dispose()))}))}static get telemetryEnabled(){return dl.ServiceRecognizerBase.telemetryDataEnabled}static enableTelemetry(e){dl.ServiceRecognizerBase.telemetryDataEnabled=e}implCommonRecognizerSetup(){let e="undefined"!=typeof window?"Browser":"Node",t="unknown",n="unknown";"undefined"!=typeof navigator&&(e=e+"/"+navigator.platform,t=navigator.userAgent,n=navigator.appVersion);const r=this.createRecognizerConfig(new El(new Cl(new Tl(e,t,n))));this.privReco=this.createServiceRecognizer(Dd.getAuthFromProperties(this.privProperties),this.privConnectionFactory,this.audioConfig,r)}recognizeOnceAsyncImpl(e){return Ld(this,void 0,void 0,(function*(){Wl.throwIfDisposed(this.privDisposed);const t=new bs;yield this.implRecognizerStop(),yield this.privReco.recognize(e,t.resolve,t.reject);const n=yield t.promise;return yield this.implRecognizerStop(),n}))}startContinuousRecognitionAsyncImpl(e){return Ld(this,void 0,void 0,(function*(){Wl.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop(),yield this.privReco.recognize(e,void 0,void 0)}))}stopContinuousRecognitionAsyncImpl(){return Ld(this,void 0,void 0,(function*(){Wl.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop()}))}implRecognizerStop(){return Ld(this,void 0,void 0,(function*(){this.privReco&&(yield this.privReco.stopRecognizing())}))}static getAuthFromProperties(e){const t=e.getProperty(cl.SpeechServiceConnection_Key,void 0);return t&&""!==t?new nl(t):new il((t=>{const n=e.getProperty(cl.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(n)}),(t=>{const n=e.getProperty(cl.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(n)}))}}var Bd=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class jd extends Nd.Recognizer{constructor(e,t){const n=e;Wl.throwIfNull(n,"speechConfig"),Wl.throwIfNullOrWhitespace(n.properties.getProperty(cl.SpeechServiceConnection_RecoLanguage),cl[cl.SpeechServiceConnection_RecoLanguage]),super(t,n.properties,new zl),this.privDisposedRecognizer=!1}static FromConfig(e,t,n){const r=e;t.properties.mergeTo(r.properties);return new jd(e,n)}get endpointId(){return Wl.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(cl.SpeechServiceConnection_EndpointId,"00000000-0000-0000-0000-000000000000")}get authorizationToken(){return this.properties.getProperty(cl.SpeechServiceAuthorization_Token)}set authorizationToken(e){Wl.throwIfNullOrWhitespace(e,"token"),this.properties.setProperty(cl.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return Wl.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(cl.SpeechServiceConnection_RecoLanguage)}get outputFormat(){return Wl.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(fu,Ol[Ol.Simple])===Ol[Ol.Simple]?Ol.Simple:Ol.Detailed}get properties(){return this.privProperties}recognizeOnceAsync(e,t){ws(this.recognizeOnceAsyncImpl(ml.Interactive),e,t)}startContinuousRecognitionAsync(e,t){ws(this.startContinuousRecognitionAsyncImpl(ml.Conversation),e,t)}stopContinuousRecognitionAsync(e,t){ws(this.stopContinuousRecognitionAsyncImpl(),e,t)}startKeywordRecognitionAsync(e,t,n){Wl.throwIfNull(e,"model"),n&&n("Not yet implemented.")}stopKeywordRecognitionAsync(e,t){e&&e()}close(e,t){Wl.throwIfDisposed(this.privDisposedRecognizer),ws(this.dispose(!0),e,t)}dispose(e){const t=Object.create(null,{dispose:{get:()=>super.dispose}});return Bd(this,void 0,void 0,(function*(){this.privDisposedRecognizer||(e&&(this.privDisposedRecognizer=!0,yield this.implRecognizerStop()),yield t.dispose.call(this,e))}))}createRecognizerConfig(e){return new Al(e,this.properties)}createServiceRecognizer(e,t,n,r){return new(0,Ql.SpeechServiceRecognizer)(e,t,n,r,this)}}var Fd,Ud,zd,Hd,Vd={};e(Vd,"SpeechSynthesizer",(()=>Kd),(e=>Kd=e)),(Ud=Fd||(Fd={}))[Ud.Unknown=0]="Unknown",Ud[Ud.Female=1]="Female",Ud[Ud.Male=2]="Male",(Hd=zd||(zd={}))[Hd.OnlineNeural=1]="OnlineNeural",Hd[Hd.OnlineStandard=2]="OnlineStandard",Hd[Hd.OfflineNeural=3]="OfflineNeural",Hd[Hd.OfflineStandard=4]="OfflineStandard";class Wd{constructor(e){if(this.privStyleList=[],this.privVoicePath="",e&&(this.privName=e.Name,this.privLocale=e.Locale,this.privShortName=e.ShortName,this.privLocalName=e.LocalName,this.privVoiceType=e.VoiceType.endsWith("Standard")?zd.OnlineStandard:zd.OnlineNeural,this.privGender="Male"===e.Gender?Fd.Male:"Female"===e.Gender?Fd.Female:Fd.Unknown,e.StyleList&&Array.isArray(e.StyleList)))for(const t of e.StyleList)this.privStyleList.push(t)}get name(){return this.privName}get locale(){return this.privLocale}get shortName(){return this.privShortName}get localName(){return this.privLocalName}get gender(){return this.privGender}get voiceType(){return this.privVoiceType}get styleList(){return this.privStyleList}get voicePath(){return this.privVoicePath}}class Gd extends qc{constructor(e,t){if(Array.isArray(t)){super(e,Pl.VoicesListRetrieved,void 0,new Gl),this.privVoices=[];for(const e of t)this.privVoices.push(new Wd(e))}else super(e,Pl.Canceled,t.errorDetails?t.errorDetails:"Error information unavailable",new Gl)}get voices(){return this.privVoices}}var qd=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Kd{constructor(e,t){const n=e;Wl.throwIfNull(n,"speechConfig"),null!==t&&(this.audioConfig=void 0===t?"undefined"==typeof window?void 0:Id.fromDefaultSpeakerOutput():t),this.privProperties=n.properties.clone(),this.privDisposed=!1,this.privSynthesizing=!1,this.privConnectionFactory=new Hl,this.synthesisRequestQueue=new(0,xs.Queue),this.implCommonSynthesizeSetup()}get authorizationToken(){return this.properties.getProperty(cl.SpeechServiceAuthorization_Token)}set authorizationToken(e){Wl.throwIfNullOrWhitespace(e,"token"),this.properties.setProperty(cl.SpeechServiceAuthorization_Token,e)}get properties(){return this.privProperties}get autoDetectSourceLanguage(){return"OpenRange"===this.properties.getProperty(cl.SpeechServiceConnection_AutoDetectSourceLanguages)}static FromConfig(e,t,n){const r=e;return t.properties.mergeTo(r.properties),new Kd(e,n)}buildSsml(e){const t={"af-ZA":"af-ZA-AdriNeural","am-ET":"am-ET-AmehaNeural","ar-AE":"ar-AE-FatimaNeural","ar-BH":"ar-BH-AliNeural","ar-DZ":"ar-DZ-AminaNeural","ar-EG":"ar-EG-SalmaNeural","ar-IQ":"ar-IQ-BasselNeural","ar-JO":"ar-JO-SanaNeural","ar-KW":"ar-KW-FahedNeural","ar-LY":"ar-LY-ImanNeural","ar-MA":"ar-MA-JamalNeural","ar-QA":"ar-QA-AmalNeural","ar-SA":"ar-SA-HamedNeural","ar-SY":"ar-SY-AmanyNeural","ar-TN":"ar-TN-HediNeural","ar-YE":"ar-YE-MaryamNeural","bg-BG":"bg-BG-BorislavNeural","bn-BD":"bn-BD-NabanitaNeural","ca-ES":"ca-ES-JoanaNeural","cs-CZ":"cs-CZ-AntoninNeural","cy-GB":"cy-GB-AledNeural","da-DK":"da-DK-ChristelNeural","de-AT":"de-AT-IngridNeural","de-CH":"de-CH-JanNeural","de-DE":"de-DE-KatjaNeural","el-GR":"el-GR-AthinaNeural","en-AU":"en-AU-NatashaNeural","en-CA":"en-CA-ClaraNeural","en-GB":"en-GB-LibbyNeural","en-HK":"en-HK-SamNeural","en-IE":"en-IE-ConnorNeural","en-IN":"en-IN-NeerjaNeural","en-KE":"en-KE-AsiliaNeural","en-NG":"en-NG-AbeoNeural","en-NZ":"en-NZ-MitchellNeural","en-PH":"en-PH-JamesNeural","en-SG":"en-SG-LunaNeural","en-TZ":"en-TZ-ElimuNeural","en-US":"en-US-JennyNeural","en-ZA":"en-ZA-LeahNeural","es-AR":"es-AR-ElenaNeural","es-BO":"es-BO-MarceloNeural","es-CL":"es-CL-CatalinaNeural","es-CO":"es-CO-GonzaloNeural","es-CR":"es-CR-JuanNeural","es-CU":"es-CU-BelkysNeural","es-DO":"es-DO-EmilioNeural","es-EC":"es-EC-AndreaNeural","es-ES":"es-ES-AlvaroNeural","es-GQ":"es-GQ-JavierNeural","es-GT":"es-GT-AndresNeural","es-HN":"es-HN-CarlosNeural","es-MX":"es-MX-DaliaNeural","es-NI":"es-NI-FedericoNeural","es-PA":"es-PA-MargaritaNeural","es-PE":"es-PE-AlexNeural","es-PR":"es-PR-KarinaNeural","es-PY":"es-PY-MarioNeural","es-SV":"es-SV-LorenaNeural","es-US":"es-US-AlonsoNeural","es-UY":"es-UY-MateoNeural","es-VE":"es-VE-PaolaNeural","et-EE":"et-EE-AnuNeural","fa-IR":"fa-IR-DilaraNeural","fi-FI":"fi-FI-SelmaNeural","fil-PH":"fil-PH-AngeloNeural","fr-BE":"fr-BE-CharlineNeural","fr-CA":"fr-CA-SylvieNeural","fr-CH":"fr-CH-ArianeNeural","fr-FR":"fr-FR-DeniseNeural","ga-IE":"ga-IE-ColmNeural","gl-ES":"gl-ES-RoiNeural","gu-IN":"gu-IN-DhwaniNeural","he-IL":"he-IL-AvriNeural","hi-IN":"hi-IN-MadhurNeural","hr-HR":"hr-HR-GabrijelaNeural","hu-HU":"hu-HU-NoemiNeural","id-ID":"id-ID-ArdiNeural","it-IT":"it-IT-IsabellaNeural","ja-JP":"ja-JP-NanamiNeural","jv-ID":"jv-ID-DimasNeural","km-KH":"km-KH-PisethNeural","ko-KR":"ko-KR-SunHiNeural","lt-LT":"lt-LT-LeonasNeural","lv-LV":"lv-LV-EveritaNeural","mr-IN":"mr-IN-AarohiNeural","ms-MY":"ms-MY-OsmanNeural","mt-MT":"mt-MT-GraceNeural","my-MM":"my-MM-NilarNeural","nb-NO":"nb-NO-PernilleNeural","nl-BE":"nl-BE-ArnaudNeural","nl-NL":"nl-NL-ColetteNeural","pl-PL":"pl-PL-AgnieszkaNeural","pt-BR":"pt-BR-FranciscaNeural","pt-PT":"pt-PT-DuarteNeural","ro-RO":"ro-RO-AlinaNeural","ru-RU":"ru-RU-SvetlanaNeural","sk-SK":"sk-SK-LukasNeural","sl-SI":"sl-SI-PetraNeural","so-SO":"so-SO-MuuseNeural","su-ID":"su-ID-JajangNeural","sv-SE":"sv-SE-SofieNeural","sw-KE":"sw-KE-RafikiNeural","sw-TZ":"sw-TZ-DaudiNeural","ta-IN":"ta-IN-PallaviNeural","ta-LK":"ta-LK-KumarNeural","ta-SG":"ta-SG-AnbuNeural","te-IN":"te-IN-MohanNeural","th-TH":"th-TH-PremwadeeNeural","tr-TR":"tr-TR-AhmetNeural","uk-UA":"uk-UA-OstapNeural","ur-IN":"ur-IN-GulNeural","ur-PK":"ur-PK-AsadNeural","uz-UZ":"uz-UZ-MadinaNeural","vi-VN":"vi-VN-HoaiMyNeural","zh-CN":"zh-CN-XiaoxiaoNeural","zh-HK":"zh-HK-HiuMaanNeural","zh-TW":"zh-TW-HsiaoChenNeural","zu-ZA":"zu-ZA-ThandoNeural"};let n=this.properties.getProperty(cl.SpeechServiceConnection_SynthLanguage,"en-US"),r=this.properties.getProperty(cl.SpeechServiceConnection_SynthVoice,""),i=Kd.XMLEncode(e);return this.autoDetectSourceLanguage?n="en-US":r=r||t[n],r&&(i=`<voice name='${r}'>${i}</voice>`),i=`<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='http://www.w3.org/2001/mstts' xmlns:emo='http://www.w3.org/2009/10/emotionml' xml:lang='${n}'>${i}</speak>`,i}speakTextAsync(e,t,n,r){this.speakImpl(e,!1,t,n,r)}speakSsmlAsync(e,t,n,r){this.speakImpl(e,!0,t,n,r)}getVoicesAsync(e=""){return qd(this,void 0,void 0,(function*(){return this.getVoices(e)}))}close(e,t){Wl.throwIfDisposed(this.privDisposed),ws(this.dispose(!0),e,t)}get internalData(){return this.privAdapter}dispose(e){return qd(this,void 0,void 0,(function*(){this.privDisposed||(e&&this.privAdapter&&(yield this.privAdapter.dispose()),this.privDisposed=!0)}))}createSynthesizerConfig(e){return new uu(e,this.privProperties)}createSynthesisAdapter(e,t,n,r){return new(0,Wc.SynthesisAdapterBase)(e,t,r,this,this.audioConfig)}implCommonSynthesizeSetup(){let e="undefined"!=typeof window?"Browser":"Node",t="unknown",n="unknown";"undefined"!=typeof navigator&&(e=e+"/"+navigator.platform,t=navigator.userAgent,n=navigator.appVersion);const r=this.createSynthesizerConfig(new El(new Cl(new Tl(e,t,n)))),i=this.privProperties.getProperty(cl.SpeechServiceConnection_Key,void 0),o=i&&""!==i?new nl(i):new il((e=>{const t=this.privProperties.getProperty(cl.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}),(e=>{const t=this.privProperties.getProperty(cl.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}));this.privAdapter=this.createSynthesisAdapter(o,this.privConnectionFactory,this.audioConfig,r),this.privAdapter.audioOutputFormat=Ec.fromSpeechSynthesisOutputFormat(hc[this.properties.getProperty(cl.SpeechServiceConnection_SynthOutputFormat,void 0)]),this.privRestAdapter=new cu(r)}speakImpl(e,t,n,r,i){try{Wl.throwIfDisposed(this.privDisposed);const o=Ba();let a;a=i instanceof kd?new(0,Ic.PushAudioOutputStreamImpl)(i):i instanceof Ic.PullAudioOutputStream?i:void 0!==i?new Td(i):void 0,this.synthesisRequestQueue.enqueue(new Yd(o,e,t,(e=>{if(this.privSynthesizing=!1,n)try{n(e)}catch(e){r&&r(e)}n=void 0,this.adapterSpeak().catch((()=>{}))}),(e=>{r&&r(e)}),a)),this.adapterSpeak().catch((()=>{}))}catch(e){if(r)if(e instanceof Error){const t=e;r(t.name+": "+t.message)}else r(e);this.dispose(!0).catch((()=>{}))}}getVoices(e){return qd(this,void 0,void 0,(function*(){const t=Ba(),n=yield this.privRestAdapter.getVoicesList(t);if(n.ok&&Array.isArray(n.json)){let r=n.json;return e&&e.length>0&&(r=r.filter((t=>!!t.Locale&&t.Locale.toLowerCase()===e.toLowerCase()))),new Gd(t,r)}return new Gd(t,{errorDetails:`Error: ${n.status}: ${n.statusText}`})}))}adapterSpeak(){return qd(this,void 0,void 0,(function*(){if(!this.privDisposed&&!this.privSynthesizing){this.privSynthesizing=!0;const e=yield this.synthesisRequestQueue.dequeue();return this.privAdapter.Speak(e.text,e.isSSML,e.requestId,e.cb,e.err,e.dataStream)}}))}static XMLEncode(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}}class Yd{constructor(e,t,n,r,i,o){this.requestId=e,this.text=t,this.isSSML=n,this.cb=r,this.err=i,this.dataStream=o}}var Jd=a("4IUwl");var Qd={error:console.error,info:console.info,success:console.log};u=a("85Hg2"),Jd=a("4IUwl"),Jd=a("4IUwl");var Xd=({className:e,title:t,loading:n=!0})=>(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:r(Jd)(e,{"memori-loading-icon":n}),"aria-label":t,children:(0,s.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});var Zd=({primary:e=!1,outlined:t=!1,ghost:n=!1,padded:i=!0,shape:o="rounded",danger:a=!1,loading:l=!1,disabled:c=!1,block:u=!1,icon:d,className:f,title:h,id:p,htmlType:m,onClick:g,onMouseDown:v,onMouseUp:y,onMouseLeave:b,onTouchStart:w,onTouchEnd:x,children:S})=>(0,s.jsxs)("button",{id:p,type:m,onClick:g,onMouseDown:v,onMouseUp:y,onMouseLeave:b,onTouchStart:w,onTouchEnd:x,title:h,disabled:l||c,className:r(Jd)("memori-button",{"memori-button--primary":e,"memori-button--outlined":t,"memori-button--ghost":n,"memori-button--square":"square"===o,"memori-button--rounded":"rounded"===o,"memori-button--circle":"circle"===o,"memori-button--padded":i,"memori-button--block":u,"memori-button--with-icon":(d||l)&&S,"memori-button--icon-only":(d||l)&&!S,"memori-button--danger":a,"memori-button--loading":l},f),children:[d&&!l&&(0,s.jsx)("span",{className:"memori-button--icon",children:d}),l&&(0,s.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,s.jsx)(Xd,{loading:!0})}),S]});u=a("85Hg2"),u=a("85Hg2"),u=a("85Hg2");function $d(e,t,...n){if(e in t){let r=t[e];return"function"==typeof r?r(...n):r}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((e=>`"${e}"`)).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,$d),r}var ef,tf,nf=((tf=nf||{})[tf.None=0]="None",tf[tf.RenderStrategy=1]="RenderStrategy",tf[tf.Static=2]="Static",tf),rf=((ef=rf||{})[ef.Unmount=0]="Unmount",ef[ef.Hidden=1]="Hidden",ef);function of({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:i,visible:o=!0,name:a}){let s=sf(t,e);if(o)return af(s,n,r,a);let l=null!=i?i:0;if(2&l){let{static:e=!1,...t}=s;if(e)return af(t,n,r,a)}if(1&l){let{unmount:e=!0,...t}=s;return $d(e?0:1,{0:()=>null,1:()=>af({...t,hidden:!0,style:{display:"none"}},n,r,a)})}return af(s,n,r,a)}function af(e,t={},n,r){let{as:i=n,children:o,refName:a="ref",...s}=uf(e,["unmount","static"]),l=void 0!==e.ref?{[a]:e.ref}:{},c="function"==typeof o?o(t):o;s.className&&"function"==typeof s.className&&(s.className=s.className(t));let d={};if(t){let e=!1,n=[];for(let[r,i]of Object.entries(t))"boolean"==typeof i&&(e=!0),!0===i&&n.push(r);e&&(d["data-headlessui-state"]=n.join(" "))}if(i===u.Fragment&&Object.keys(cf(s)).length>0){if(!(0,u.isValidElement)(c)||Array.isArray(c)&&c.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(s).map((e=>` - ${e}`)).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((e=>` - ${e}`)).join("\n")].join("\n"));return(0,u.cloneElement)(c,Object.assign({},sf(c.props,cf(uf(s,["ref"]))),d,l,function(...e){return{ref:e.every((e=>null==e))?void 0:t=>{for(let n of e)null!=n&&("function"==typeof n?n(t):n.current=t)}}}(c.ref,l.ref)))}return(0,u.createElement)(i,Object.assign({},uf(s,["ref"]),i!==u.Fragment&&l,i!==u.Fragment&&d),c)}function sf(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map((e=>[e,void 0]))));for(let e in n)Object.assign(t,{[e](t,...r){let i=n[e];for(let e of i){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function lf(e){var t;return Object.assign((0,u.forwardRef)(e),{displayName:null!=(t=e.displayName)?t:e.name})}function cf(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function uf(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}let df=(0,(u=a("85Hg2")).createContext)(null);df.displayName="OpenClosedContext";var ff=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ff||{});function hf(){return(0,u.useContext)(df)}function pf({value:e,children:t}){return r(u).createElement(df.Provider,{value:e},t)}u=a("85Hg2"),u=a("85Hg2");const mf="undefined"==typeof window||"undefined"==typeof document;let gf=mf?u.useEffect:u.useLayoutEffect;function vf(){let e=(0,u.useRef)(!1);return gf((()=>(e.current=!0,()=>{e.current=!1})),[]),e}u=a("85Hg2");function yf(e){let t=(0,u.useRef)(e);return gf((()=>{t.current=e}),[e]),t}u=a("85Hg2");let bf={serverHandoffComplete:!1};function wf(){let[e,t]=(0,u.useState)(bf.serverHandoffComplete);return(0,u.useEffect)((()=>{!0!==e&&t(!0)}),[e]),(0,u.useEffect)((()=>{!1===bf.serverHandoffComplete&&(bf.serverHandoffComplete=!0)}),[]),e}u=a("85Hg2"),u=a("85Hg2");let xf=function(e){let t=yf(e);return r(u).useCallback(((...e)=>t.current(...e)),[t])},Sf=Symbol();function Mf(e,t=!0){return Object.assign(e,{[Sf]:t})}function _f(...e){let t=(0,u.useRef)(e);(0,u.useEffect)((()=>{t.current=e}),[e]);let n=xf((e=>{for(let n of t.current)null!=n&&("function"==typeof n?n(e):n.current=e)}));return e.every((e=>null==e||(null==e?void 0:e[Sf])))?void 0:n}function Af(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function Ef(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e}))))}function Cf(){let e=[],t=[],n={enqueue(e){t.push(e)},addEventListener:(e,t,r,i)=>(e.addEventListener(t,r,i),n.add((()=>e.removeEventListener(t,r,i)))),requestAnimationFrame(...e){let t=requestAnimationFrame(...e);return n.add((()=>cancelAnimationFrame(t)))},nextFrame:(...e)=>n.requestAnimationFrame((()=>n.requestAnimationFrame(...e))),setTimeout(...e){let t=setTimeout(...e);return n.add((()=>clearTimeout(t)))},microTask(...e){let t={current:!0};return Ef((()=>{t.current&&e[0]()})),n.add((()=>{t.current=!1}))},add:t=>(e.push(t),()=>{let n=e.indexOf(t);if(n>=0){let[t]=e.splice(n,1);t()}}),dispose(){for(let t of e.splice(0))t()},async workQueue(){for(let e of t.splice(0))await e()}};return n}function kf(e,...t){e&&t.length>0&&e.classList.add(...t)}function Tf(e,...t){e&&t.length>0&&e.classList.remove(...t)}var If,Of=((If=Of||{}).Ended="ended",If.Cancelled="cancelled",If);function Rf(e,t,n,r){let i=n?"enter":"leave",o=Cf(),a=void 0!==r?Af(r):()=>{};"enter"===i&&(e.removeAttribute("hidden"),e.style.display="");let s=$d(i,{enter:()=>t.enter,leave:()=>t.leave}),l=$d(i,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),c=$d(i,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return Tf(e,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),kf(e,...s,...c),o.nextFrame((()=>{Tf(e,...c),kf(e,...l),function(e,t){let n=Cf();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:i}=getComputedStyle(e),[o,a]=[r,i].map((e=>{let[t=0]=e.split(",").filter(Boolean).map((e=>e.includes("ms")?parseFloat(e):1e3*parseFloat(e))).sort(((e,t)=>t-e));return t}));if(o+a!==0){let r=[];r.push(n.addEventListener(e,"transitionrun",(i=>{i.target===i.currentTarget&&(r.splice(0).forEach((e=>e())),r.push(n.addEventListener(e,"transitionend",(e=>{e.target===e.currentTarget&&(t("ended"),r.splice(0).forEach((e=>e())))})),n.addEventListener(e,"transitioncancel",(e=>{e.target===e.currentTarget&&(t("cancelled"),r.splice(0).forEach((e=>e())))}))))})))}else t("ended");n.add((()=>t("cancelled"))),n.dispose}(e,(n=>("ended"===n&&(Tf(e,...s),kf(e,...t.entered)),a(n))))})),o.dispose}function Pf(){let[e]=(0,u.useState)(Cf);return(0,u.useEffect)((()=>()=>e.dispose()),[e]),e}function Nf({container:e,direction:t,classes:n,onStart:r,onStop:i}){let o=vf(),a=Pf(),s=yf(t);gf((()=>{let t=Cf();a.add(t.dispose);let l=e.current;if(l&&"idle"!==s.current&&o.current)return t.dispose(),r.current(s.current),t.add(Rf(l,n.current,"enter"===s.current,(e=>{t.dispose(),$d(e,{[Of.Ended](){i.current(s.current)},[Of.Cancelled]:()=>{}})}))),t.dispose}),[t])}function Lf(e=""){return e.split(" ").filter((e=>e.trim().length>1))}let Df=(0,(u=a("85Hg2")).createContext)(null);Df.displayName="TransitionContext";var Bf,jf=((Bf=jf||{}).Visible="visible",Bf.Hidden="hidden",Bf);let Ff=(0,u.createContext)(null);function Uf(e){return"children"in e?Uf(e.children):e.current.filter((({el:e})=>null!==e.current)).filter((({state:e})=>"visible"===e)).length>0}function zf(e,t){let n=yf(e),r=(0,u.useRef)([]),i=vf(),o=Pf(),a=xf(((e,t=rf.Hidden)=>{let a=r.current.findIndex((({el:t})=>t===e));-1!==a&&($d(t,{[rf.Unmount](){r.current.splice(a,1)},[rf.Hidden](){r.current[a].state="hidden"}}),o.microTask((()=>{var e;!Uf(r)&&i.current&&(null==(e=n.current)||e.call(n))})))})),s=xf((e=>{let t=r.current.find((({el:t})=>t===e));return t?"visible"!==t.state&&(t.state="visible"):r.current.push({el:e,state:"visible"}),()=>a(e,rf.Unmount)})),l=(0,u.useRef)([]),c=(0,u.useRef)(Promise.resolve()),d=(0,u.useRef)({enter:[],leave:[],idle:[]}),f=xf(((e,n,r)=>{l.current.splice(0),t&&(t.chains.current[n]=t.chains.current[n].filter((([t])=>t!==e))),null==t||t.chains.current[n].push([e,new Promise((e=>{l.current.push(e)}))]),null==t||t.chains.current[n].push([e,new Promise((e=>{Promise.all(d.current[n].map((([e,t])=>t))).then((()=>e()))}))]),"enter"===n?c.current=c.current.then((()=>null==t?void 0:t.wait.current)).then((()=>r(n))):r(n)})),h=xf(((e,t,n)=>{Promise.all(d.current[t].splice(0).map((([e,t])=>t))).then((()=>{var e;null==(e=l.current.shift())||e()})).then((()=>n(t)))}));return(0,u.useMemo)((()=>({children:r,register:s,unregister:a,onStart:f,onStop:h,wait:c,chains:d})),[s,a,r,f,h,d,c])}function Hf(){}Ff.displayName="NestingContext";let Vf=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Wf(e){var t;let n={};for(let r of Vf)n[r]=null!=(t=e[r])?t:Hf;return n}let Gf=nf.RenderStrategy,qf=lf((function(e,t){let{beforeEnter:n,afterEnter:i,beforeLeave:o,afterLeave:a,enter:s,enterFrom:l,enterTo:c,entered:d,leave:f,leaveFrom:h,leaveTo:p,...m}=e,g=(0,u.useRef)(null),v=_f(g,t),y=m.unmount?rf.Unmount:rf.Hidden,{show:b,appear:w,initial:x}=function(){let e=(0,u.useContext)(Df);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),[S,M]=(0,u.useState)(b?"visible":"hidden"),_=function(){let e=(0,u.useContext)(Ff);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),{register:A,unregister:E}=_,C=(0,u.useRef)(null);(0,u.useEffect)((()=>A(g)),[A,g]),(0,u.useEffect)((()=>{if(y===rf.Hidden&&g.current)return b&&"visible"!==S?void M("visible"):$d(S,{hidden:()=>E(g),visible:()=>A(g)})}),[S,g,A,E,b,y]);let k=yf({enter:Lf(s),enterFrom:Lf(l),enterTo:Lf(c),entered:Lf(d),leave:Lf(f),leaveFrom:Lf(h),leaveTo:Lf(p)}),T=function(e){let t=(0,u.useRef)(Wf(e));return(0,u.useEffect)((()=>{t.current=Wf(e)}),[e]),t}({beforeEnter:n,afterEnter:i,beforeLeave:o,afterLeave:a}),I=wf();(0,u.useEffect)((()=>{if(I&&"visible"===S&&null===g.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[g,S,I]);let O=x&&!w,R=!I||O||C.current===b?"idle":b?"enter":"leave",P=xf((e=>$d(e,{enter:()=>T.current.beforeEnter(),leave:()=>T.current.beforeLeave(),idle:()=>{}}))),N=xf((e=>$d(e,{enter:()=>T.current.afterEnter(),leave:()=>T.current.afterLeave(),idle:()=>{}}))),L=zf((()=>{M("hidden"),E(g)}),_);Nf({container:g,classes:k,direction:R,onStart:yf((e=>{L.onStart(g,e,P)})),onStop:yf((e=>{L.onStop(g,e,N),"leave"===e&&!Uf(L)&&(M("hidden"),E(g))}))}),(0,u.useEffect)((()=>{!O||(y===rf.Hidden?C.current=null:C.current=b)}),[b,O,S]);let D=m,B={ref:v};return r(u).createElement(Ff.Provider,{value:L},r(u).createElement(pf,{value:$d(S,{visible:ff.Open,hidden:ff.Closed})},of({ourProps:B,theirProps:D,defaultTag:"div",features:Gf,visible:"visible"===S,name:"Transition.Child"})))})),Kf=lf((function(e,t){let{show:n,appear:i=!1,unmount:o,...a}=e,s=(0,u.useRef)(null),l=_f(s,t);wf();let c=hf();if(void 0===n&&null!==c&&(n=$d(c,{[ff.Open]:!0,[ff.Closed]:!1})),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[d,f]=(0,u.useState)(n?"visible":"hidden"),h=zf((()=>{f("hidden")})),[p,m]=(0,u.useState)(!0),g=(0,u.useRef)([n]);gf((()=>{!1!==p&&g.current[g.current.length-1]!==n&&(g.current.push(n),m(!1))}),[g,n]);let v=(0,u.useMemo)((()=>({show:n,appear:i,initial:p})),[n,i,p]);(0,u.useEffect)((()=>{if(n)f("visible");else if(Uf(h)){let e=s.current;if(!e)return;let t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&f("hidden")}else f("hidden")}),[n,h]);let y={unmount:o};return r(u).createElement(Ff.Provider,{value:h},r(u).createElement(Df.Provider,{value:v},of({ourProps:{...y,as:u.Fragment,children:r(u).createElement(qf,{ref:l,...y,...a})},theirProps:{},defaultTag:u.Fragment,features:Gf,visible:"visible"===d,name:"Transition"})))})),Yf=lf((function(e,t){let n=null!==(0,u.useContext)(Df),i=null!==hf();return r(u).createElement(r(u).Fragment,null,!n&&i?r(u).createElement(Kf,{ref:t,...e}):r(u).createElement(qf,{ref:t,...e}))})),Jf=Object.assign(Kf,{Child:Yf,Root:Kf});u=a("85Hg2");var Qf,Xf=((Qf=Xf||{}).Space=" ",Qf.Enter="Enter",Qf.Escape="Escape",Qf.Backspace="Backspace",Qf.Delete="Delete",Qf.ArrowLeft="ArrowLeft",Qf.ArrowUp="ArrowUp",Qf.ArrowRight="ArrowRight",Qf.ArrowDown="ArrowDown",Qf.Home="Home",Qf.End="End",Qf.PageUp="PageUp",Qf.PageDown="PageDown",Qf.Tab="Tab",Qf);function Zf(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=""===(null==t?void 0:t.getAttribute("disabled"));return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(n))&&r}var $f;u=a("85Hg2");let eh=0;function th(){return++eh}let nh=null!=($f=r(u).useId)?$f:function(){let e=wf(),[t,n]=r(u).useState(e?th:null);return gf((()=>{null===t&&n(th())}),[t]),null!=t?""+t:void 0};u=a("85Hg2");var rh=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(rh||{});let ih=lf((function(e,t){let{features:n=1,...r}=e;return of({ourProps:{ref:t,"aria-hidden":2==(2&n)||void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...4==(4&n)&&2!=(2&n)&&{display:"none"}}},theirProps:r,slot:{},defaultTag:"div",name:"Hidden"})}));function oh(e){return mf?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let ah=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((e=>`${e}:not([tabindex='-1'])`)).join(",");var sh,lh=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(lh||{}),ch=((sh=ch||{})[sh.Error=0]="Error",sh[sh.Overflow=1]="Overflow",sh[sh.Success=2]="Success",sh[sh.Underflow=3]="Underflow",sh),uh=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(uh||{});function dh(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(ah))}var fh=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(fh||{});function hh(e,t=0){var n;return e!==(null==(n=oh(e))?void 0:n.body)&&$d(t,{0:()=>e.matches(ah),1(){let t=e;for(;null!==t;){if(t.matches(ah))return!0;t=t.parentElement}return!1}})}function ph(e){let t=oh(e);Cf().nextFrame((()=>{t&&!hh(t.activeElement,0)&&mh(e)}))}function mh(e){null==e||e.focus({preventScroll:!0})}let gh=["textarea","input"].join(",");function vh(e,t=(e=>e)){return e.slice().sort(((e,n)=>{let r=t(e),i=t(n);if(null===r||null===i)return 0;let o=r.compareDocumentPosition(i);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0}))}function yh(e,t){return bh(dh(),t,!0,e)}function bh(e,t,n=!0,r=null){let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,o=Array.isArray(e)?n?vh(e):e:dh(e);r=null!=r?r:i.activeElement;let a,s=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,o.indexOf(r))-1;if(4&t)return Math.max(0,o.indexOf(r))+1;if(8&t)return o.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=32&t?{preventScroll:!0}:{},u=0,d=o.length;do{if(u>=d||u+d<=0)return 0;let e=l+u;if(16&t)e=(e+d)%d;else{if(e<0)return 3;if(e>=d)return 1}a=o[e],null==a||a.focus(c),u+=s}while(a!==i.activeElement);return 6&t&&function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,gh))&&n}(a)&&a.select(),a.hasAttribute("tabindex")||a.setAttribute("tabindex","0"),2}u=a("85Hg2"),u=a("85Hg2");function wh(e,t,n){let r=yf(t);(0,u.useEffect)((()=>{function t(e){r.current(e)}return window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)}),[e,n])}var xh=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(xh||{});function Sh(){let e=(0,u.useRef)(0);return wh("keydown",(t=>{"Tab"===t.key&&(e.current=t.shiftKey?1:0)}),!0),e}u=a("85Hg2");function Mh(...e){return(0,u.useMemo)((()=>oh(...e)),[...e])}u=a("85Hg2");function _h(e,t,n,r){let i=yf(n);(0,u.useEffect)((()=>{function n(e){i.current(e)}return(e=null!=e?e:window).addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}),[e,t,r])}u=a("85Hg2");function Ah(e,t){let n=(0,u.useRef)([]),r=xf(e);(0,u.useEffect)((()=>{let e=[...n.current];for(let[i,o]of t.entries())if(n.current[i]!==o){let i=r(t,e);return n.current=t,i}}),[r,...t])}var Eh=(e=>(e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e))(Eh||{});let Ch=Object.assign(lf((function(e,t){let n=(0,u.useRef)(null),i=_f(n,t),{initialFocus:o,containers:a,features:s=30,...l}=e;wf()||(s=1);let c=Mh(n);!function({ownerDocument:e},t){let n=(0,u.useRef)(null);_h(null==e?void 0:e.defaultView,"focusout",(e=>{!t||n.current||(n.current=e.target)}),!0),Ah((()=>{t||((null==e?void 0:e.activeElement)===(null==e?void 0:e.body)&&mh(n.current),n.current=null)}),[t]);let r=(0,u.useRef)(!1);(0,u.useEffect)((()=>(r.current=!1,()=>{r.current=!0,Ef((()=>{!r.current||(mh(n.current),n.current=null)}))})),[])}({ownerDocument:c},Boolean(16&s));let d=function({ownerDocument:e,container:t,initialFocus:n},r){let i=(0,u.useRef)(null),o=vf();return Ah((()=>{if(!r)return;let a=t.current;!a||Ef((()=>{if(!o.current)return;let t=null==e?void 0:e.activeElement;if(null!=n&&n.current){if((null==n?void 0:n.current)===t)return void(i.current=t)}else if(a.contains(t))return void(i.current=t);null!=n&&n.current?mh(n.current):bh(a,lh.First)===ch.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),i.current=null==e?void 0:e.activeElement}))}),[r]),i}({ownerDocument:c,container:n,initialFocus:o},Boolean(2&s));!function({ownerDocument:e,container:t,containers:n,previousActiveElement:r},i){let o=vf();_h(null==e?void 0:e.defaultView,"focus",(e=>{if(!i||!o.current)return;let a=new Set(null==n?void 0:n.current);a.add(t);let s=r.current;if(!s)return;let l=e.target;l&&l instanceof HTMLElement?function(e,t){var n;for(let r of e)if(null!=(n=r.current)&&n.contains(t))return!0;return!1}(a,l)?(r.current=l,mh(l)):(e.preventDefault(),e.stopPropagation(),mh(s)):mh(r.current)}),!0)}({ownerDocument:c,container:n,containers:a,previousActiveElement:d},Boolean(8&s));let f=Sh(),h=xf((()=>{let e=n.current;!e||$d(f.current,{[xh.Forwards]:()=>bh(e,lh.First),[xh.Backwards]:()=>bh(e,lh.Last)})})),p={ref:i};return r(u).createElement(r(u).Fragment,null,Boolean(4&s)&&r(u).createElement(ih,{as:"button",type:"button",onFocus:h,features:rh.Focusable}),of({ourProps:p,theirProps:l,defaultTag:"div",name:"FocusTrap"}),Boolean(4&s)&&r(u).createElement(ih,{as:"button",type:"button",onFocus:h,features:rh.Focusable}))})),{features:Eh});let kh=new Set,Th=new Map;function Ih(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function Oh(e){let t=Th.get(e);!t||(null===t["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}function Rh(e,t=!0){gf((()=>{if(!t||!e.current)return;let n=e.current,r=oh(n);if(r){kh.add(n);for(let e of Th.keys())e.contains(n)&&(Oh(e),Th.delete(e));return r.querySelectorAll("body > *").forEach((e=>{if(e instanceof HTMLElement){for(let t of kh)if(e.contains(t))return;1===kh.size&&(Th.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),Ih(e))}})),()=>{if(kh.delete(n),kh.size>0)r.querySelectorAll("body > *").forEach((e=>{if(e instanceof HTMLElement&&!Th.has(e)){for(let t of kh)if(e.contains(t))return;Th.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),Ih(e)}}));else for(let e of Th.keys())Oh(e),Th.delete(e)}}}),[t])}u=a("85Hg2"),c=a("2BCLI");let Ph=(0,(u=a("85Hg2")).createContext)(!1);function Nh(e){return r(u).createElement(Ph.Provider,{value:e.force},e.children)}function Lh(e){let t=(0,u.useContext)(Ph),n=(0,u.useContext)(Fh),r=Mh(e),[i,o]=(0,u.useState)((()=>{if(!t&&null!==n||mf)return null;let e=null==r?void 0:r.getElementById("headlessui-portal-root");if(e)return e;if(null===r)return null;let i=r.createElement("div");return i.setAttribute("id","headlessui-portal-root"),r.body.appendChild(i)}));return(0,u.useEffect)((()=>{null!==i&&(null!=r&&r.body.contains(i)||null==r||r.body.appendChild(i))}),[i,r]),(0,u.useEffect)((()=>{t||null!==n&&o(n.current)}),[n,o,t]),i}let Dh=u.Fragment,Bh=lf((function(e,t){let n=e,r=(0,u.useRef)(null),i=_f(Mf((e=>{r.current=e})),t),o=Mh(r),a=Lh(r),[s]=(0,u.useState)((()=>{var e;return mf?null:null!=(e=null==o?void 0:o.createElement("div"))?e:null})),l=wf(),d=(0,u.useRef)(!1);return gf((()=>{if(d.current=!1,a&&s)return a.contains(s)||(s.setAttribute("data-headlessui-portal",""),a.appendChild(s)),()=>{d.current=!0,Ef((()=>{var e;!d.current||!a||!s||(a.removeChild(s),a.childNodes.length<=0&&(null==(e=a.parentElement)||e.removeChild(a)))}))}}),[a,s]),l&&a&&s?(0,c.createPortal)(of({ourProps:{ref:i},theirProps:n,defaultTag:Dh,name:"Portal"}),s):null})),jh=u.Fragment,Fh=(0,u.createContext)(null),Uh=lf((function(e,t){let{target:n,...i}=e,o={ref:_f(t)};return r(u).createElement(Fh.Provider,{value:n},of({ourProps:o,theirProps:i,defaultTag:jh,name:"Popover.Group"}))})),zh=Object.assign(Bh,{Group:Uh});let Hh=(0,(u=a("85Hg2")).createContext)(null);function Vh(){let e=(0,u.useContext)(Hh);if(null===e){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,Vh),e}return e}function Wh(){let[e,t]=(0,u.useState)([]);return[e.length>0?e.join(" "):void 0,(0,u.useMemo)((()=>function(e){let n=xf((e=>(t((t=>[...t,e])),()=>t((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),i=(0,u.useMemo)((()=>({register:n,slot:e.slot,name:e.name,props:e.props})),[n,e.slot,e.name,e.props]);return r(u).createElement(Hh.Provider,{value:i},e.children)}),[t])]}let Gh=lf((function(e,t){let n=Vh(),r=`headlessui-description-${nh()}`,i=_f(t);gf((()=>n.register(r)),[r,n.register]);let o=e;return of({ourProps:{ref:i,...n.props,id:r},theirProps:o,slot:n.slot||{},defaultTag:"p",name:n.name||"Description"})}));let qh=(0,(u=a("85Hg2")).createContext)((()=>{}));qh.displayName="StackContext";var Kh=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(Kh||{});function Yh({children:e,onUpdate:t,type:n,element:i,enabled:o}){let a=(0,u.useContext)(qh),s=xf(((...e)=>{null==t||t(...e),a(...e)}));return gf((()=>{let e=void 0===o||!0===o;return e&&s(0,n,i),()=>{e&&s(1,n,i)}}),[s,n,i,o]),r(u).createElement(qh.Provider,{value:s},e)}u=a("85Hg2"),u=a("85Hg2");function Jh(e,t,n){let r=yf(t);(0,u.useEffect)((()=>{function t(e){r.current(e)}return document.addEventListener(e,t,n),()=>document.removeEventListener(e,t,n)}),[e,n])}function Qh(e,t,n=!0){let r=(0,u.useRef)(!1);function i(n,i){if(!r.current||n.defaultPrevented)return;let o=function e(t){return"function"==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(e),a=i(n);if(null!==a&&a.getRootNode().contains(a)){for(let e of o){if(null===e)continue;let t=e instanceof HTMLElement?e:e.current;if(null!=t&&t.contains(a))return}return!hh(a,fh.Loose)&&-1!==a.tabIndex&&n.preventDefault(),t(n,a)}}(0,u.useEffect)((()=>{requestAnimationFrame((()=>{r.current=n}))}),[n]);let o=(0,u.useRef)(null);Jh("mousedown",(e=>{var t,n;r.current&&(o.current=(null==(n=null==(t=e.composedPath)?void 0:t.call(e))?void 0:n[0])||e.target)}),!0),Jh("click",(e=>{!o.current||(i(e,(()=>o.current)),o.current=null)}),!0),Jh("blur",(e=>i(e,(()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null))),!0)}var Xh=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Xh||{}),Zh=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Zh||{});let $h={0:(e,t)=>e.titleId===t.id?e:{...e,titleId:t.id}},ep=(0,u.createContext)(null);function tp(e){let t=(0,u.useContext)(ep);if(null===t){let t=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,tp),t}return t}function np(e,t){(0,u.useEffect)((()=>{var n;if(!t||!e)return;let r=Cf();function i(e,t,n){let i=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),r.add((()=>{Object.assign(e.style,{[t]:i})}))}let o=e.documentElement,a=(null!=(n=e.defaultView)?n:window).innerWidth-o.clientWidth;if(i(o,"overflow","hidden"),a>0){i(o,"paddingRight",`${a-(o.clientWidth-o.offsetWidth)}px`)}if(/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0){let e=window.pageYOffset;i(o,"position","fixed"),i(o,"marginTop",`-${e}px`),i(o,"width","100%"),r.add((()=>window.scrollTo(0,e)))}return r.dispose}),[e,t])}function rp(e,t){return $d(t.type,$h,e,t)}ep.displayName="DialogContext";let ip=nf.RenderStrategy|nf.Static,op=lf((function(e,t){let{open:n,onClose:i,initialFocus:o,__demoMode:a=!1,...s}=e,[l,c]=(0,u.useState)(0),d=hf();void 0===n&&null!==d&&(n=$d(d,{[ff.Open]:!0,[ff.Closed]:!1}));let f=(0,u.useRef)(new Set),h=(0,u.useRef)(null),p=_f(h,t),m=(0,u.useRef)(null),g=Mh(h),v=e.hasOwnProperty("open")||null!==d,y=e.hasOwnProperty("onClose");if(!v&&!y)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!v)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!y)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof n)throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${n}`);if("function"!=typeof i)throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${i}`);let b=n?0:1,[w,x]=(0,u.useReducer)(rp,{titleId:null,descriptionId:null,panelRef:(0,u.createRef)()}),S=xf((()=>i(!1))),M=xf((e=>x({type:0,id:e}))),_=!!wf()&&(!a&&0===b),A=l>1,E=null!==(0,u.useContext)(ep),C=A?"parent":"leaf";Rh(h,!!A&&_),Qh((()=>{var e,t;return[...Array.from(null!=(e=null==g?void 0:g.querySelectorAll("body > *, [data-headlessui-portal]"))?e:[]).filter((e=>!(!(e instanceof HTMLElement)||e.contains(m.current)||w.panelRef.current&&e.contains(w.panelRef.current)))),null!=(t=w.panelRef.current)?t:h.current]}),S,_&&!A),_h(null==g?void 0:g.defaultView,"keydown",(e=>{e.defaultPrevented||e.key===Xf.Escape&&0===b&&(A||(e.preventDefault(),e.stopPropagation(),S()))})),np(g,0===b&&!E),(0,u.useEffect)((()=>{if(0!==b||!h.current)return;let e=new IntersectionObserver((e=>{for(let t of e)0===t.boundingClientRect.x&&0===t.boundingClientRect.y&&0===t.boundingClientRect.width&&0===t.boundingClientRect.height&&S()}));return e.observe(h.current),()=>e.disconnect()}),[b,h,S]);let[k,T]=Wh(),I=`headlessui-dialog-${nh()}`,O=(0,u.useMemo)((()=>[{dialogState:b,close:S,setTitleId:M},w]),[b,w,S,M]),R=(0,u.useMemo)((()=>({open:0===b})),[b]),P={ref:p,id:I,role:"dialog","aria-modal":0===b||void 0,"aria-labelledby":w.titleId,"aria-describedby":k};return r(u).createElement(Yh,{type:"Dialog",enabled:0===b,element:h,onUpdate:xf(((e,t,n)=>{"Dialog"===t&&$d(e,{[Kh.Add](){f.current.add(n),c((e=>e+1))},[Kh.Remove](){f.current.add(n),c((e=>e-1))}})}))},r(u).createElement(Nh,{force:!0},r(u).createElement(zh,null,r(u).createElement(ep.Provider,{value:O},r(u).createElement(zh.Group,{target:h},r(u).createElement(Nh,{force:!1},r(u).createElement(T,{slot:R,name:"Dialog.Description"},r(u).createElement(Ch,{initialFocus:o,containers:f,features:_?$d(C,{parent:Ch.features.RestoreFocus,leaf:Ch.features.All&~Ch.features.FocusLock}):Ch.features.None},of({ourProps:P,theirProps:s,slot:R,defaultTag:"div",features:ip,visible:0===b,name:"Dialog"})))))))),r(u).createElement(ih,{features:rh.Hidden,ref:m}))})),ap=lf((function(e,t){let[{dialogState:n,close:r}]=tp("Dialog.Overlay");return of({ourProps:{ref:_f(t),id:`headlessui-dialog-overlay-${nh()}`,"aria-hidden":!0,onClick:xf((e=>{if(e.target===e.currentTarget){if(Zf(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),r()}}))},theirProps:e,slot:(0,u.useMemo)((()=>({open:0===n})),[n]),defaultTag:"div",name:"Dialog.Overlay"})})),sp=lf((function(e,t){let[{dialogState:n},i]=tp("Dialog.Backdrop"),o=_f(t),a=`headlessui-dialog-backdrop-${nh()}`;(0,u.useEffect)((()=>{if(null===i.panelRef.current)throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.")}),[i.panelRef]);let s=(0,u.useMemo)((()=>({open:0===n})),[n]);return r(u).createElement(Nh,{force:!0},r(u).createElement(zh,null,of({ourProps:{ref:o,id:a,"aria-hidden":!0},theirProps:e,slot:s,defaultTag:"div",name:"Dialog.Backdrop"})))})),lp=lf((function(e,t){let[{dialogState:n},r]=tp("Dialog.Panel"),i=_f(t,r.panelRef),o=`headlessui-dialog-panel-${nh()}`,a=(0,u.useMemo)((()=>({open:0===n})),[n]);return of({ourProps:{ref:i,id:o,onClick:xf((e=>{e.stopPropagation()}))},theirProps:e,slot:a,defaultTag:"div",name:"Dialog.Panel"})})),cp=lf((function(e,t){let[{dialogState:n,setTitleId:r}]=tp("Dialog.Title"),i=`headlessui-dialog-title-${nh()}`,o=_f(t);(0,u.useEffect)((()=>(r(i),()=>r(null))),[i,r]);let a=(0,u.useMemo)((()=>({open:0===n})),[n]);return of({ourProps:{ref:o,id:i},theirProps:e,slot:a,defaultTag:"h2",name:"Dialog.Title"})})),up=Object.assign(op,{Backdrop:sp,Panel:lp,Overlay:ap,Title:cp,Description:Gh});Jd=a("4IUwl");var dp=({spinning:e=!1,primary:t=!1,className:n,children:i})=>(0,s.jsxs)("div",{className:r(Jd)("memori-spin",n,{"memori-spin--spinning":e,"memori-spin--primary":t}),children:[i,(0,s.jsx)("div",{className:"memori-spin--spinner",children:(0,s.jsx)(Xd,{loading:!0})})]});var fp=({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:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Jd=a("4IUwl");var hp=({open:e=!1,onClose:t,className:n,title:i,description:o,children:a,footer:l,loading:c=!1,closable:d=!0,width:f="100%",widthMd:h="100%"})=>{const{t:p}=Te();return(0,s.jsx)(Jf,{appear:!0,show:e,as:r(u).Fragment,children:(0,s.jsxs)(up,{open:e,onClose:t,className:r(Jd)("memori-modal",n),children:[(0,s.jsx)(Jf.Child,{as:r(u).Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)("div",{className:"memori-modal--backdrop"})}),(0,s.jsx)("div",{className:"memori-modal--container",children:(0,s.jsx)("div",{className:"memori-modal--container-scrollable",children:(0,s.jsx)(Jf.Child,{as:r(u).Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsxs)(up.Panel,{className:"memori-modal--panel",children:[(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-modal--panel {\n --memori-modal--width: ${f};\n --memori-modal--width-md: ${h};\n }\n `}}),d&&(0,s.jsx)("div",{className:"memori-modal--close",children:(0,s.jsx)(Zd,{ghost:!0,padded:!0,shape:"circle",icon:(0,s.jsx)(fp,{}),title:p("close")||"Close",onClick:()=>t(!1)})}),(0,s.jsxs)(dp,{spinning:c,children:[i&&(0,s.jsx)(up.Title,{className:"memori-modal--title",children:i}),o&&(0,s.jsx)(up.Description,{className:"memori-modal--description",children:o}),a,l&&(0,s.jsx)("div",{className:"memori-modal--footer",children:l})]})]})})})})]})})},pp=(u=a("85Hg2"),e=>"checkbox"===e.type),mp=e=>e instanceof Date,gp=e=>null==e;const vp=e=>"object"==typeof e;var yp=e=>!gp(e)&&!Array.isArray(e)&&vp(e)&&!mp(e),bp=e=>yp(e)&&e.target?pp(e.target)?e.target.checked:e.target.value:e,wp=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),xp=e=>Array.isArray(e)?e.filter(Boolean):[],Sp=e=>void 0===e,Mp=(e,t,n)=>{if(!t||!yp(e))return n;const r=xp(t.split(/[,[\].]+?/)).reduce(((e,t)=>gp(e)?e:e[t]),e);return Sp(r)||r===e?Sp(e[t])?n:e[t]:r};const _p="blur",Ap="focusout",Ep="onBlur",Cp="onChange",kp="onSubmit",Tp="onTouched",Ip="all",Op="max",Rp="min",Pp="maxLength",Np="minLength",Lp="pattern",Dp="required",Bp="validate";r(u).createContext(null);var jp=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Ip&&(t._proxyFormState[i]=!r||Ip),n&&(n[i]=!0),e[i]}});return i},Fp=e=>yp(e)&&!Object.keys(e).length,Up=(e,t,n)=>{const{name:r,...i}=e;return Fp(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!n||Ip)))},zp=e=>Array.isArray(e)?e:[e];function Hp(e){const t=r(u).useRef(e);t.current=e,r(u).useEffect((()=>{const n=!e.disabled&&t.current.subject.subscribe({next:t.current.callback});return()=>{n&&n.unsubscribe()}}),[e.disabled])}var Vp=e=>"string"==typeof e,Wp=(e,t,n,r)=>Vp(e)?(r&&t.watch.add(e),Mp(n,e)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),Mp(n,e)))):(t.watchAll=!!r,n),Gp="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function qp(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(Gp&&(e instanceof Blob||e instanceof FileList)||!n&&!yp(e))return e;if(t=n?[]:{},Array.isArray(e)||(e=>{const t=e.constructor&&e.constructor.prototype;return yp(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)t[n]=qp(e[n]);else t=e}return t}var Kp=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Yp=e=>/^\w*$/.test(e),Jp=e=>xp(e.replace(/["|']|\]/g,"").split(/\.|\[/));function Qp(e,t,n){let r=-1;const i=Yp(t)?[t]:Jp(t),o=i.length,a=o-1;for(;++r<o;){const t=i[r];let o=n;if(r!==a){const n=e[t];o=yp(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}e[t]=o,e=e[t]}return e}const Xp=(e,t,n)=>{for(const r of n||Object.keys(e)){const n=Mp(e,r);if(n){const{_f:e,...r}=n;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else yp(r)&&Xp(r,t)}}};var Zp=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))))),$p=(e,t,n)=>{const r=xp(Mp(e,n));return Qp(r,"root",t[n]),Qp(e,n,r),e},em=e=>"boolean"==typeof e,tm=e=>"file"===e.type,nm=e=>"function"==typeof e,rm=e=>Vp(e)||r(u).isValidElement(e),im=e=>"radio"===e.type,om=e=>e instanceof RegExp;const am={value:!1,isValid:!1},sm={value:!0,isValid:!0};var lm=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Sp(e[0].attributes.value)?Sp(e[0].value)||""===e[0].value?sm:{value:e[0].value,isValid:!0}:sm:am}return am};const cm={isValid:!1,value:null};var um=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),cm):cm;function dm(e,t,n="validate"){if(rm(e)||Array.isArray(e)&&e.every(rm)||em(e)&&!e)return{type:n,message:rm(e)?e:"",ref:t}}var fm=e=>yp(e)&&!om(e)?e:{value:e,message:""},hm=async(e,t,n,r,i)=>{const{ref:o,refs:a,required:s,maxLength:l,minLength:c,min:u,max:d,pattern:f,validate:h,name:p,valueAsNumber:m,mount:g,disabled:v}=e._f;if(!g||v)return{};const y=a?a[0]:o,b=e=>{r&&y.reportValidity&&(y.setCustomValidity(em(e)?"":e||""),y.reportValidity())},w={},x=im(o),S=pp(o),M=x||S,_=(m||tm(o))&&!o.value||""===t||Array.isArray(t)&&!t.length,A=Kp.bind(null,p,n,w),E=(e,t,n,r=Pp,i=Np)=>{const a=e?t:n;w[p]={type:e?r:i,message:a,ref:o,...A(e?r:i,a)}};if(i?!Array.isArray(t)||!t.length:s&&(!M&&(_||gp(t))||em(t)&&!t||S&&!lm(a).isValid||x&&!um(a).isValid)){const{value:e,message:t}=rm(s)?{value:!!s,message:s}:fm(s);if(e&&(w[p]={type:Dp,message:t,ref:y,...A(Dp,t)},!n))return b(t),w}if(!(_||gp(u)&&gp(d))){let e,r;const i=fm(d),a=fm(u);if(gp(t)||isNaN(t)){const n=o.valueAsDate||new Date(t),s=e=>new Date((new Date).toDateString()+" "+e),l="time"==o.type,c="week"==o.type;Vp(i.value)&&t&&(e=l?s(t)>s(i.value):c?t>i.value:n>new Date(i.value)),Vp(a.value)&&t&&(r=l?s(t)<s(a.value):c?t<a.value:n<new Date(a.value))}else{const n=o.valueAsNumber||(t?+t:t);gp(i.value)||(e=n>i.value),gp(a.value)||(r=n<a.value)}if((e||r)&&(E(!!e,i.message,a.message,Op,Rp),!n))return b(w[p].message),w}if((l||c)&&!_&&(Vp(t)||i&&Array.isArray(t))){const e=fm(l),r=fm(c),i=!gp(e.value)&&t.length>e.value,o=!gp(r.value)&&t.length<r.value;if((i||o)&&(E(i,e.message,r.message),!n))return b(w[p].message),w}if(f&&!_&&Vp(t)){const{value:e,message:r}=fm(f);if(om(e)&&!t.match(e)&&(w[p]={type:Lp,message:r,ref:o,...A(Lp,r)},!n))return b(r),w}if(h)if(nm(h)){const e=dm(await h(t),y);if(e&&(w[p]={...e,...A(Bp,e.message)},!n))return b(e.message),w}else if(yp(h)){let e={};for(const r in h){if(!Fp(e)&&!n)break;const i=dm(await h[r](t),y,r);i&&(e={...i,...A(r,i.message)},b(i.message),n&&(w[p]=e))}if(!Fp(e)&&(w[p]={ref:y,...e},!n))return w}return b(!0),w};var pm=e=>({isOnSubmit:!e||e===kp,isOnBlur:e===Ep,isOnChange:e===Cp,isOnAll:e===Ip,isOnTouch:e===Tp});function mm(e){for(const t in e)if(!Sp(e[t]))return!1;return!0}function gm(e,t){const n=Yp(t)?[t]:Jp(t),r=1==n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Sp(e)?r++:e[t[r++]];return e}(e,n),i=n[n.length-1];let o;r&&delete r[i];for(let t=0;t<n.slice(0,-1).length;t++){let r,i=-1;const a=n.slice(0,-(t+1)),s=a.length-1;for(t>0&&(o=e);++i<a.length;){const t=a[i];r=r?r[t]:e[t],s===i&&(yp(r)&&Fp(r)||Array.isArray(r)&&mm(r))&&(o?delete o[t]:delete e[t]),o=r}}return e}function vm(){let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}}var ym=e=>gp(e)||!vp(e);function bm(e,t){if(ym(e)||ym(t))return e===t;if(mp(e)&&mp(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const n=e[i];if(!r.includes(i))return!1;if("ref"!==i){const e=t[i];if(mp(n)&&mp(e)||yp(n)&&yp(e)||Array.isArray(n)&&Array.isArray(e)?!bm(n,e):n!==e)return!1}}return!0}var wm=e=>{const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},xm=e=>"select-multiple"===e.type,Sm=e=>wm(e)&&e.isConnected,Mm=e=>{for(const t in e)if(nm(e[t]))return!0;return!1};function _m(e,t={}){const n=Array.isArray(e);if(yp(e)||n)for(const n in e)Array.isArray(e[n])||yp(e[n])&&!Mm(e[n])?(t[n]=Array.isArray(e[n])?[]:{},_m(e[n],t[n])):gp(e[n])||(t[n]=!0);return t}function Am(e,t,n){const r=Array.isArray(e);if(yp(e)||r)for(const r in e)Array.isArray(e[r])||yp(e[r])&&!Mm(e[r])?Sp(t)||ym(n[r])?n[r]=Array.isArray(e[r])?_m(e[r],[]):{..._m(e[r])}:Am(e[r],gp(t)?{}:t[r],n[r]):bm(e[r],t[r])?delete n[r]:n[r]=!0;return n}var Em=(e,t)=>Am(e,t,_m(t)),Cm=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Sp(e)?e:t?""===e?NaN:e?+e:e:n&&Vp(e)?new Date(e):r?r(e):e;function km(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return tm(t)?t.files:im(t)?um(e.refs).value:xm(t)?[...t.selectedOptions].map((({value:e})=>e)):pp(t)?lm(e.refs).value:Cm(Sp(t.value)?e.ref.value:t.value,e)}var Tm=e=>Sp(e)?e:om(e)?e.source:yp(e)?om(e.value)?e.value.source:e.value:e;function Im(e,t,n){const r=Mp(e,n);if(r||Yp(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const r=i.join("."),o=Mp(t,r),a=Mp(e,r);if(o&&!Array.isArray(o)&&n!==r)return{name:n};if(a&&a.type)return{name:r,error:a};i.pop()}return{name:n}}const Om={mode:kp,reValidateMode:Cp,shouldFocusError:!0};function Rm(e={}){let t,n={...Om,...e},r={submitCount:0,isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},i={},o=qp(n.defaultValues)||{},a=n.shouldUnregister?{}:qp(o),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c=0,u={};const d={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={watch:vm(),array:vm(),state:vm()},h=pm(n.mode),p=pm(n.reValidateMode),m=n.criteriaMode===Ip,g=async()=>{let e=!1;return d.isValid&&(e=n.resolver?Fp((await w()).errors):await x(i,!0),e!==r.isValid&&(r.isValid=e,f.state.next({isValid:e}))),e},v=(e,t,n,r)=>{const l=Mp(i,e);if(l){const i=Mp(a,e,Sp(n)?Mp(o,e):n);Sp(i)||r&&r.defaultChecked||t?Qp(a,e,t?i:km(l._f)):_(e,i),s.mount&&g()}},y=(e,t,n,i,a)=>{let s=!1,l=!1;const c={name:e};if(d.isDirty&&(l=r.isDirty,r.isDirty=c.isDirty=S(),s=l!==c.isDirty),d.dirtyFields&&(!n||i)){l=Mp(r.dirtyFields,e);const n=bm(Mp(o,e),t);n?gm(r.dirtyFields,e):Qp(r.dirtyFields,e,!0),c.dirtyFields=r.dirtyFields,s=s||l!==!n}if(n){const t=Mp(r.touchedFields,e);t||(Qp(r.touchedFields,e,n),c.touchedFields=r.touchedFields,s=s||d.touchedFields&&t!==n)}return s&&a&&f.state.next(c),s?c:{}},b=(n,i,o,a)=>{const s=Mp(r.errors,n),l=d.isValid&&em(i)&&r.isValid!==i;var h;if(e.delayError&&o?(h=()=>((e,t)=>{Qp(r.errors,e,t),f.state.next({errors:r.errors})})(n,o),t=e=>{clearTimeout(c),c=window.setTimeout(h,e)},t(e.delayError)):(clearTimeout(c),t=null,o?Qp(r.errors,n,o):gm(r.errors,n)),(o?!bm(s,o):s)||!Fp(a)||l){const e={...a,...l&&em(i)?{isValid:i}:{},errors:r.errors,name:n};r={...r,...e},f.state.next(e)}u[n]--,d.isValidating&&!Object.values(u).some((e=>e))&&(f.state.next({isValidating:!1}),u={})},w=async e=>n.resolver?await n.resolver({...a},n.context,((e,t,n,r)=>{const i={};for(const n of e){const e=Mp(t,n);e&&Qp(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}})(e||l.mount,i,n.criteriaMode,n.shouldUseNativeValidation)):{},x=async(e,t,i={valid:!0})=>{for(const o in e){const s=e[o];if(s){const{_f:e,...o}=s;if(e){const o=l.array.has(e.name),c=await hm(s,Mp(a,e.name),m,n.shouldUseNativeValidation,o);if(c[e.name]&&(i.valid=!1,t))break;!t&&(Mp(c,e.name)?o?$p(r.errors,c,e.name):Qp(r.errors,e.name,c[e.name]):gm(r.errors,e.name))}o&&await x(o,t,i)}}return i.valid},S=(e,t)=>(e&&t&&Qp(a,e,t),!bm(T(),o)),M=(e,t,n)=>Wp(e,l,{...s.mount?a:Sp(t)?o:Vp(e)?{[e]:t}:t},n),_=(e,t,n={})=>{const r=Mp(i,e);let o=t;if(r){const n=r._f;n&&(!n.disabled&&Qp(a,e,Cm(t,n)),o=Gp&&wm(n.ref)&&gp(t)?"":t,xm(n.ref)?[...n.ref.options].forEach((e=>e.selected=o.includes(e.value))):n.refs?pp(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(o)?!!o.find((t=>t===e.value)):o===e.value))):n.refs[0]&&(n.refs[0].checked=!!o):n.refs.forEach((e=>e.checked=e.value===o)):tm(n.ref)?n.ref.value="":(n.ref.value=o,n.ref.type||f.watch.next({name:e})))}(n.shouldDirty||n.shouldTouch)&&y(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&k(e)},A=(e,t,n)=>{for(const r in t){const o=t[r],a=`${e}.${r}`,s=Mp(i,a);!l.array.has(e)&&ym(o)&&(!s||s._f)||mp(o)?_(a,o,n):A(a,o,n)}},E=(e,t,n={})=>{const s=Mp(i,e),c=l.array.has(e),u=qp(t);Qp(a,e,u),c?(f.array.next({name:e,values:a}),(d.isDirty||d.dirtyFields)&&n.shouldDirty&&(r.dirtyFields=Em(o,a),f.state.next({name:e,dirtyFields:r.dirtyFields,isDirty:S(e,u)}))):!s||s._f||gp(u)?_(e,u,n):A(e,u,n),Zp(e,l)&&f.state.next({}),f.watch.next({name:e})},C=async e=>{const o=e.target;let s=o.name;const c=Mp(i,s);if(c){let x,S;const M=o.type?km(c._f):bp(e),_=e.type===_p||e.type===Ap,A=!((v=c._f).mount&&(v.required||v.min||v.max||v.maxLength||v.minLength||v.pattern||v.validate)||n.resolver||Mp(r.errors,s)||c._f.deps)||((e,t,n,r,i)=>!i.isOnAll&&(!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e))(_,Mp(r.touchedFields,s),r.isSubmitted,p,h),E=Zp(s,l,_);Qp(a,s,M),_?(c._f.onBlur&&c._f.onBlur(e),t&&t(0)):c._f.onChange&&c._f.onChange(e);const C=y(s,M,_,!1),T=!Fp(C)||E;if(!_&&f.watch.next({name:s,type:e.type}),A)return d.isValid&&g(),T&&f.state.next({name:s,...E?{}:C});if(!_&&E&&f.state.next({}),u[s]=u[s]?u[s]+1:1,f.state.next({isValidating:!0}),n.resolver){const{errors:e}=await w([s]),t=Im(r.errors,i,s),n=Im(e,i,t.name||s);x=n.error,s=n.name,S=Fp(e)}else x=(await hm(c,Mp(a,s),m,n.shouldUseNativeValidation))[s],g();c._f.deps&&k(c._f.deps),b(s,S,x,C)}var v},k=async(e,t={})=>{let o,a;const s=zp(e);if(f.state.next({isValidating:!0}),n.resolver){const t=await(async e=>{const{errors:t}=await w();if(e)for(const n of e){const e=Mp(t,n);e?Qp(r.errors,n,e):gm(r.errors,n)}else r.errors=t;return t})(Sp(e)?e:s);o=Fp(t),a=e?!s.some((e=>Mp(t,e))):o}else e?(a=(await Promise.all(s.map((async e=>{const t=Mp(i,e);return await x(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||r.isValid)&&g()):a=o=await x(i);return f.state.next({...!Vp(e)||d.isValid&&o!==r.isValid?{}:{name:e},...n.resolver||!e?{isValid:o}:{},errors:r.errors,isValidating:!1}),t.shouldFocus&&!a&&Xp(i,(e=>e&&Mp(r.errors,e)),e?s:l.mount),a},T=e=>{const t={...o,...s.mount?a:{}};return Sp(e)?t:Vp(e)?Mp(t,e):e.map((e=>Mp(t,e)))},I=(e,t)=>({invalid:!!Mp((t||r).errors,e),isDirty:!!Mp((t||r).dirtyFields,e),isTouched:!!Mp((t||r).touchedFields,e),error:Mp((t||r).errors,e)}),O=(e,t={})=>{for(const s of e?zp(e):l.mount)l.mount.delete(s),l.array.delete(s),Mp(i,s)&&(t.keepValue||(gm(i,s),gm(a,s)),!t.keepError&&gm(r.errors,s),!t.keepDirty&&gm(r.dirtyFields,s),!t.keepTouched&&gm(r.touchedFields,s),!n.shouldUnregister&&!t.keepDefaultValue&&gm(o,s));f.watch.next({}),f.state.next({...r,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&g()},R=(e,t={})=>{let r=Mp(i,e);const c=em(t.disabled);return Qp(i,e,{...r||{},_f:{...r&&r._f?r._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),r?c&&Qp(a,e,t.disabled?void 0:Mp(a,e,km(r._f))):v(e,!0,t.value),{...c?{disabled:t.disabled}:{},...n.shouldUseNativeValidation?{required:!!t.required,min:Tm(t.min),max:Tm(t.max),minLength:Tm(t.minLength),maxLength:Tm(t.maxLength),pattern:Tm(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:a=>{if(a){R(e,t),r=Mp(i,e);const n=Sp(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>im(e)||pp(e))(n),l=r._f.refs||[];if(s?l.find((e=>e===n)):n===r._f.ref)return;Qp(i,e,{_f:{...r._f,...s?{refs:[...l.filter(Sm),n,...Array.isArray(Mp(o,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),v(e,!1,void 0,n)}else r=Mp(i,e,{}),r._f&&(r._f.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!wp(l.array,e)||!s.action)&&l.unMount.add(e)}}},P=()=>n.shouldFocusError&&Xp(i,(e=>e&&Mp(r.errors,e)),l.mount);return{control:{register:R,unregister:O,getFieldState:I,_executeSchema:w,_focusError:P,_getWatch:M,_getDirty:S,_updateValid:g,_removeUnmounted:()=>{for(const e of l.unMount){const t=Mp(i,e);t&&(t._f.refs?t._f.refs.every((e=>!Sm(e))):!Sm(t._f.ref))&&O(e)}l.unMount=new Set},_updateFieldArray:(e,t=[],n,l,c=!0,u=!0)=>{if(l&&n){if(s.action=!0,u&&Array.isArray(Mp(i,e))){const t=n(Mp(i,e),l.argA,l.argB);c&&Qp(i,e,t)}if(u&&Array.isArray(Mp(r.errors,e))){const t=n(Mp(r.errors,e),l.argA,l.argB);c&&Qp(r.errors,e,t),((e,t)=>{!xp(Mp(e,t)).length&&gm(e,t)})(r.errors,e)}if(d.touchedFields&&u&&Array.isArray(Mp(r.touchedFields,e))){const t=n(Mp(r.touchedFields,e),l.argA,l.argB);c&&Qp(r.touchedFields,e,t)}d.dirtyFields&&(r.dirtyFields=Em(o,a)),f.state.next({isDirty:S(e,t),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Qp(a,e,t)},_getFieldArray:t=>xp(Mp(s.mount?a:o,t,e.shouldUnregister?Mp(o,t,[]):[])),_subjects:f,_proxyFormState:d,get _fields(){return i},get _formValues(){return a},get _stateFlags(){return s},set _stateFlags(e){s=e},get _defaultValues(){return o},get _names(){return l},set _names(e){l=e},get _formState(){return r},set _formState(e){r=e},get _options(){return n},set _options(e){n={...n,...e}}},trigger:k,register:R,handleSubmit:(e,t)=>async o=>{o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let s=!0,l=qp(a);f.state.next({isSubmitting:!0});try{if(n.resolver){const{errors:e,values:t}=await w();r.errors=e,l=t}else await x(i);Fp(r.errors)?(f.state.next({errors:{},isSubmitting:!0}),await e(l,o)):(t&&await t({...r.errors},o),P())}catch(e){throw s=!1,e}finally{r.isSubmitted=!0,f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Fp(r.errors)&&s,submitCount:r.submitCount+1,errors:r.errors})}},watch:(e,t)=>nm(e)?f.watch.subscribe({next:n=>e(M(void 0,t),n)}):M(e,t,!0),setValue:E,getValues:T,reset:(t,n)=>((t,n={})=>{const c=t||o,u=qp(c),h=t&&!Fp(t)?u:o;if(n.keepDefaultValues||(o=c),!n.keepValues){if(n.keepDirtyValues)for(const e of l.mount)Mp(r.dirtyFields,e)?Qp(h,e,Mp(a,e)):E(e,Mp(h,e));else{if(Gp&&Sp(t))for(const e of l.mount){const t=Mp(i,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(wm(e)){const t=e.closest("form");if(t){t.reset();break}}}}i={}}a=e.shouldUnregister?n.keepDefaultValues?qp(o):{}:u,f.array.next({values:h}),f.watch.next({values:h})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!n.keepIsValid,s.watch=!!e.shouldUnregister,f.state.next({submitCount:n.keepSubmitCount?r.submitCount:0,isDirty:n.keepDirty||n.keepDirtyValues?r.isDirty:!(!n.keepDefaultValues||bm(t,o)),isSubmitted:!!n.keepIsSubmitted&&r.isSubmitted,dirtyFields:n.keepDirty||n.keepDirtyValues?r.dirtyFields:n.keepDefaultValues&&t?Em(o,t):{},touchedFields:n.keepTouched?r.touchedFields:{},errors:n.keepErrors?r.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})})(nm(t)?t(a):t,n),resetField:(e,t={})=>{Mp(i,e)&&(Sp(t.defaultValue)?E(e,Mp(o,e)):(E(e,t.defaultValue),Qp(o,e,t.defaultValue)),t.keepTouched||gm(r.touchedFields,e),t.keepDirty||(gm(r.dirtyFields,e),r.isDirty=t.defaultValue?S(e,Mp(o,e)):S()),t.keepError||(gm(r.errors,e),d.isValid&&g()),f.state.next({...r}))},clearErrors:e=>{e?zp(e).forEach((e=>gm(r.errors,e))):r.errors={},f.state.next({errors:r.errors})},unregister:O,setError:(e,t,n)=>{const o=(Mp(i,e,{_f:{}})._f||{}).ref;Qp(r.errors,e,{...t,ref:o}),f.state.next({name:e,errors:r.errors,isValid:!1}),n&&n.shouldFocus&&o&&o.focus&&o.focus()},setFocus:(e,t={})=>{const n=Mp(i,e),r=n&&n._f;if(r){const e=r.refs?r.refs[0]:r.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:I}}function Pm(e={}){const t=r(u).useRef(),[n,i]=r(u).useState({isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:e.defaultValues});t.current||(t.current={...Rm(e),formState:n});const o=t.current.control;return o._options=e,Hp({subject:o._subjects.state,callback:r(u).useCallback((e=>{Up(e,o._proxyFormState,!0)&&(o._formState={...o._formState,...e},i({...o._formState}))}),[o])}),r(u).useEffect((()=>{o._stateFlags.mount||(o._proxyFormState.isValid&&o._updateValid(),o._stateFlags.mount=!0),o._stateFlags.watch&&(o._stateFlags.watch=!1,o._subjects.state.next({})),o._removeUnmounted()})),r(u).useEffect((()=>{n.submitCount&&o._focusError()}),[o,n.submitCount]),t.current.formState=jp(n,o),t.current}var Nm=({className:e,title:t})=>(0,s.jsxs)("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:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}),(0,s.jsx)("path",{d:"M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"})]});var Lm=({pwdOrTokens:e,setPwdOrTokens:t,onFinish:n,minimumNumberOfRecoveryTokens:r=1,showTokens:i=!0,openModal:o=!1,withModal:a=!1})=>{var l;const{t:c}=Te(),{register:d,handleSubmit:f,formState:{errors:h},setError:p}=Pm(),[m,g]=(0,u.useState)(1),[v,y]=(0,u.useState)(!!e),b=(0,s.jsxs)("form",{name:"memoriAuth",onSubmit:f((t=>{var i,o,a;"password"===e&&!(null===(i=t.password)||void 0===i?void 0:i.length)||"tokens"===e&&(((null===(o=null==t?void 0:t.tokens)||void 0===o?void 0:o.length)||0)<r||!(null===(a=null==t?void 0:t.tokens)||void 0===a?void 0:a.every((e=>e.length))))?p("tokens",{type:"minLength",message:"Tokens"}):n&&n(t).then((()=>{y(!1)}))})),className:"memori-auth-widget--form",children:[("password"===e||!i)&&(0,s.jsxs)("fieldset",{className:"memori-auth-widget--password-fieldset",children:[(0,s.jsxs)("label",{children:["Password:"," ",(0,s.jsx)("input",{className:"memori-auth-widget--input",required:!0,type:"password",placeholder:"Password",...d("password",{required:!0})})]}),i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("hr",{}),(0,s.jsx)(Zd,{outlined:!0,onClick:()=>t("tokens"),children:c("auth.useRecoveryTokens")||"Recovery tokens"})]})]}),"tokens"===e&&i&&(0,s.jsxs)("fieldset",{className:"memori-auth-widget--tokens-fieldset",name:"tokens",children:[(0,s.jsxs)("legend",{children:[c("auth.tokens"),": "]}),(w=m,Array.from({length:w},((e,t)=>t))).map((e=>(0,s.jsx)("label",{className:"memori-auth-widget--token",children:(0,s.jsx)("input",{type:"password",className:"memori-auth-widget--input",placeholder:"Recovery token",required:!0,autoComplete:"off",...d(`tokens.${e}`,{required:!0})})},e))),(0,s.jsx)(Zd,{onClick:()=>g((e=>e+1)),className:"memori-auth-widget--token-add",icon:(0,s.jsx)(Nm,{}),children:c("auth.addToken")||"Add token"}),(0,s.jsx)("hr",{}),(0,s.jsx)(Zd,{outlined:!0,onClick:()=>t("password"),children:c("auth.usePassword")||"Password"})]}),"minLength"===(null===(l=h.tokens)||void 0===l?void 0:l.type)&&(0,s.jsxs)("div",{className:"memori-auth-widget--error",children:[c("auth.atLeast")||"At least"," ",r]}),(0,s.jsx)(Zd,{htmlType:"submit",primary:!0,className:"memori-auth-widget--submit",children:c("confirm")||"Submit"})]});var w;return a?(0,s.jsx)(hp,{open:o||v,title:"Authentication",onClose:()=>t(null),closable:!1,children:b}):b};u=a("85Hg2"),Jd=a("4IUwl"),u=a("85Hg2");const Dm=()=>{let e=!1;if("maxTouchPoints"in navigator)e=navigator.maxTouchPoints>0;else if("msMaxTouchPoints"in navigator)e=navigator.msMaxTouchPoints>0;else{const n=window&&"matchMedia"in window&&matchMedia("(pointer:coarse)");if(n&&"(pointer:coarse)"===n.media)e=!!n.matches;else if("orientation"in window)e=!0;else{var t=null===navigator||void 0===navigator?void 0:navigator.userAgent;e=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(t)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(t)}}return e};const Bm=e=>e.slice(0,e.length/2).trim().toLowerCase()===e.slice(e.length/2+1).trim().toLowerCase()?e.slice(0,e.length/2):e,jm=({type:e,resourceURI:t,sessionID:n,baseURL:r="",apiURL:i=""})=>{let o="cover"===e?`${r}/images/memoriCover.png`:`${r}/images/memoriAvatar.png`;try{return t&&0!==t.length?t.includes("memoriai/memory")&&!t.includes("memori-ai-session-id")&&n?`${t}?memori-ai-session-id=${n}`:(t.startsWith("https://")||t.startsWith("http://"))&&new URL(t).hostname.includes("memori.ai")?`${t}${n?`/${n}`:""}`:t.startsWith("cloud://")?`${(null==i?void 0:i.replace(/v2/,"v1"))||""}/CloudAsset/${t.replace("cloud://","")}`:t.startsWith("guid://")?`${(null==i?void 0:i.replace(/v2/,"v1"))||""}/GuidAsset/${t.replace("guid://","")}`:t||o:o}catch(e){return t||o}};Jd=a("4IUwl");var Fm=({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:"M858.5 763.6a374 374 0 0 0-80.6-119.5 375.63 375.63 0 0 0-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 0 0-80.6 119.5A371.7 371.7 0 0 0 136 901.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 0 0 8-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"})});var Um=({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",className:e,"aria-label":t,children:(0,s.jsxs)("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[(0,s.jsx)("path",{fillRule:"evenodd",d:"M0 4a4 4 0 014-4h16a4 4 0 014 4v16a4 4 0 01-4 4H4a4 4 0 01-4-4zm4-2.4A2.4 2.4 0 001.6 4v16A2.4 2.4 0 004 22.4h16a2.4 2.4 0 002.4-2.4V4A2.4 2.4 0 0020 1.6z",clipRule:"evenodd"}),(0,s.jsx)("path",{fillRule:"evenodd",d:"M9.715 8.442a.798.798 0 00-1.43 0l-3.2 6.4a.799.799 0 101.431.716l.579-1.158h3.811l.578 1.158a.8.8 0 001.431-.716zm.391 4.358L9 10.589 7.894 12.8z",clipRule:"evenodd"}),(0,s.jsx)("path",{fillRule:"evenodd",d:"M17 8c.552 0 1 .358 1 .8v6.4c0 .442-.448.8-1 .8s-1-.358-1-.8V8.8c0-.442.448-.8 1-.8z",clipRule:"evenodd"})]})});Jd=a("4IUwl");var zm=({content:e,className:t,align:n="right",disabled:i=!1,visible:o=!1,children:a})=>(0,s.jsxs)("div",{className:r(Jd)("memori-tooltip",`memori-tooltip--align-${n}`,t,{"memori-tooltip--disabled":i,"memori-tooltip--visible":o}),children:[(0,s.jsx)("div",{className:"memori-tooltip--content",children:e}),(0,s.jsx)("div",{className:"memori-tooltip--trigger",children:a})]});u=a("85Hg2"),u=a("85Hg2");var Hm=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Hm||{});function Vm(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),i=null!=r?r:-1,o=(()=>{switch(e.focus){case 0:return n.findIndex((e=>!t.resolveDisabled(e)));case 1:{let e=n.slice().reverse().findIndex(((e,n,r)=>!(-1!==i&&r.length-n-1>=i)&&!t.resolveDisabled(e)));return-1===e?e:n.length-1-e}case 2:return n.findIndex(((e,n)=>!(n<=i)&&!t.resolveDisabled(e)));case 3:{let e=n.slice().reverse().findIndex((e=>!t.resolveDisabled(e)));return-1===e?e:n.length-1-e}case 4:return n.findIndex((n=>t.resolveId(n)===e.id));case 5:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}})();return-1===o?r:o}u=a("85Hg2");function Wm({container:e,accept:t,walk:n,enabled:r=!0}){let i=(0,u.useRef)(t),o=(0,u.useRef)(n);(0,u.useEffect)((()=>{i.current=t,o.current=n}),[t,n]),gf((()=>{if(!e||!r)return;let t=oh(e);if(!t)return;let n=i.current,a=o.current,s=Object.assign((e=>n(e)),{acceptNode:n}),l=t.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,s,!1);for(;l.nextNode();)a(l.currentNode)}),[e,r,i,o])}u=a("85Hg2");function Gm(e){var t;if(e.type)return e.type;let n=null!=(t=e.as)?t:"button";return"string"==typeof n&&"button"===n.toLowerCase()?"button":void 0}function qm(e,t){let[n,r]=(0,u.useState)((()=>Gm(e)));return gf((()=>{r(Gm(e))}),[e.type,e.as]),gf((()=>{n||!t.current||t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")}),[n,t]),n}var Km=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Km||{}),Ym=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ym||{}),Jm=(e=>(e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem",e))(Jm||{});function Qm(e,t=(e=>e)){let n=null!==e.activeItemIndex?e.items[e.activeItemIndex]:null,r=vh(t(e.items.slice()),(e=>e.dataRef.current.domRef.current)),i=n?r.indexOf(n):null;return-1===i&&(i=null),{items:r,activeItemIndex:i}}let Xm={1:e=>1===e.menuState?e:{...e,activeItemIndex:null,menuState:1},0:e=>0===e.menuState?e:{...e,menuState:0},2:(e,t)=>{var n;let r=Qm(e),i=Vm(t,{resolveItems:()=>r.items,resolveActiveIndex:()=>r.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeItemIndex:i,activationTrigger:null!=(n=t.trigger)?n:1}},3:(e,t)=>{let n=""!==e.searchQuery?0:1,r=e.searchQuery+t.value.toLowerCase(),i=(null!==e.activeItemIndex?e.items.slice(e.activeItemIndex+n).concat(e.items.slice(0,e.activeItemIndex+n)):e.items).find((e=>{var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(r))&&!e.dataRef.current.disabled})),o=i?e.items.indexOf(i):-1;return-1===o||o===e.activeItemIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeItemIndex:o,activationTrigger:1}},4:e=>""===e.searchQuery?e:{...e,searchQuery:"",searchActiveItemIndex:null},5:(e,t)=>{let n=Qm(e,(e=>[...e,{id:t.id,dataRef:t.dataRef}]));return{...e,...n}},6:(e,t)=>{let n=Qm(e,(e=>{let n=e.findIndex((e=>e.id===t.id));return-1!==n&&e.splice(n,1),e}));return{...e,...n,activationTrigger:1}}},Zm=(0,u.createContext)(null);function $m(e){let t=(0,u.useContext)(Zm);if(null===t){let t=new Error(`<${e} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,$m),t}return t}function eg(e,t){return $d(t.type,Xm,e,t)}Zm.displayName="MenuContext";let tg=u.Fragment,ng=lf((function(e,t){let n=(0,u.useReducer)(eg,{menuState:1,buttonRef:(0,u.createRef)(),itemsRef:(0,u.createRef)(),items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1}),[{menuState:i,itemsRef:o,buttonRef:a},s]=n,l=_f(t);Qh([a,o],((e,t)=>{var n;s({type:1}),hh(t,fh.Loose)||(e.preventDefault(),null==(n=a.current)||n.focus())}),0===i);let c=xf((()=>{s({type:1})})),d=(0,u.useMemo)((()=>({open:0===i,close:c})),[i,c]),f=e,h={ref:l};return r(u).createElement(Zm.Provider,{value:n},r(u).createElement(pf,{value:$d(i,{0:ff.Open,1:ff.Closed})},of({ourProps:h,theirProps:f,slot:d,defaultTag:tg,name:"Menu"})))})),rg=lf((function(e,t){var n;let[r,i]=$m("Menu.Button"),o=_f(r.buttonRef,t),a=`headlessui-menu-button-${nh()}`,s=Pf(),l=xf((e=>{switch(e.key){case Xf.Space:case Xf.Enter:case Xf.ArrowDown:e.preventDefault(),e.stopPropagation(),i({type:0}),s.nextFrame((()=>i({type:2,focus:Hm.First})));break;case Xf.ArrowUp:e.preventDefault(),e.stopPropagation(),i({type:0}),s.nextFrame((()=>i({type:2,focus:Hm.Last})))}})),c=xf((e=>{if(e.key===Xf.Space)e.preventDefault()})),d=xf((t=>{if(Zf(t.currentTarget))return t.preventDefault();e.disabled||(0===r.menuState?(i({type:1}),s.nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(t.preventDefault(),i({type:0})))})),f=(0,u.useMemo)((()=>({open:0===r.menuState})),[r]),h=e;return of({ourProps:{ref:o,id:a,type:qm(e,r.buttonRef),"aria-haspopup":!0,"aria-controls":null==(n=r.itemsRef.current)?void 0:n.id,"aria-expanded":e.disabled?void 0:0===r.menuState,onKeyDown:l,onKeyUp:c,onClick:d},theirProps:h,slot:f,defaultTag:"button",name:"Menu.Button"})})),ig=nf.RenderStrategy|nf.Static,og=lf((function(e,t){var n,r;let[i,o]=$m("Menu.Items"),a=_f(i.itemsRef,t),s=Mh(i.itemsRef),l=`headlessui-menu-items-${nh()}`,c=Pf(),d=hf(),f=null!==d?d===ff.Open:0===i.menuState;(0,u.useEffect)((()=>{let e=i.itemsRef.current;!e||0===i.menuState&&e!==(null==s?void 0:s.activeElement)&&e.focus({preventScroll:!0})}),[i.menuState,i.itemsRef,s]),Wm({container:i.itemsRef.current,enabled:0===i.menuState,accept:e=>"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let h=xf((e=>{var t,n;switch(c.dispose(),e.key){case Xf.Space:if(""!==i.searchQuery)return e.preventDefault(),e.stopPropagation(),o({type:3,value:e.key});case Xf.Enter:if(e.preventDefault(),e.stopPropagation(),o({type:1}),null!==i.activeItemIndex){let{dataRef:e}=i.items[i.activeItemIndex];null==(n=null==(t=e.current)?void 0:t.domRef.current)||n.click()}ph(i.buttonRef.current);break;case Xf.ArrowDown:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:Hm.Next});case Xf.ArrowUp:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:Hm.Previous});case Xf.Home:case Xf.PageUp:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:Hm.First});case Xf.End:case Xf.PageDown:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:Hm.Last});case Xf.Escape:e.preventDefault(),e.stopPropagation(),o({type:1}),Cf().nextFrame((()=>{var e;return null==(e=i.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case Xf.Tab:e.preventDefault(),e.stopPropagation(),o({type:1}),Cf().nextFrame((()=>{yh(i.buttonRef.current,e.shiftKey?lh.Previous:lh.Next)}));break;default:1===e.key.length&&(o({type:3,value:e.key}),c.setTimeout((()=>o({type:4})),350))}})),p=xf((e=>{if(e.key===Xf.Space)e.preventDefault()})),m=(0,u.useMemo)((()=>({open:0===i.menuState})),[i]),g=e;return of({ourProps:{"aria-activedescendant":null===i.activeItemIndex||null==(n=i.items[i.activeItemIndex])?void 0:n.id,"aria-labelledby":null==(r=i.buttonRef.current)?void 0:r.id,id:l,onKeyDown:h,onKeyUp:p,role:"menu",tabIndex:0,ref:a},theirProps:g,slot:m,defaultTag:"div",features:ig,visible:f,name:"Menu.Items"})})),ag=u.Fragment,sg=lf((function(e,t){let{disabled:n=!1,...r}=e,[i,o]=$m("Menu.Item"),a=`headlessui-menu-item-${nh()}`,s=null!==i.activeItemIndex&&i.items[i.activeItemIndex].id===a,l=(0,u.useRef)(null),c=_f(t,l);gf((()=>{if(0!==i.menuState||!s||0===i.activationTrigger)return;let e=Cf();return e.requestAnimationFrame((()=>{var e,t;null==(t=null==(e=l.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})),e.dispose}),[l,s,i.menuState,i.activationTrigger,i.activeItemIndex]);let d=(0,u.useRef)({disabled:n,domRef:l});gf((()=>{d.current.disabled=n}),[d,n]),gf((()=>{var e,t;d.current.textValue=null==(t=null==(e=l.current)?void 0:e.textContent)?void 0:t.toLowerCase()}),[d,l]),gf((()=>(o({type:5,id:a,dataRef:d}),()=>o({type:6,id:a}))),[d,a]);let f=xf((()=>{o({type:1})})),h=xf((e=>{if(n)return e.preventDefault();o({type:1}),ph(i.buttonRef.current)})),p=xf((()=>{if(n)return o({type:2,focus:Hm.Nothing});o({type:2,focus:Hm.Specific,id:a})})),m=xf((()=>{n||s||o({type:2,focus:Hm.Specific,id:a,trigger:0})})),g=xf((()=>{n||!s||o({type:2,focus:Hm.Nothing})})),v=(0,u.useMemo)((()=>({active:s,disabled:n,close:f})),[s,n,f]);return of({ourProps:{id:a,ref:c,role:"menuitem",tabIndex:!0===n?void 0:-1,"aria-disabled":!0===n||void 0,disabled:void 0,onClick:h,onFocus:p,onPointerMove:m,onMouseMove:m,onPointerLeave:g,onMouseLeave:g},theirProps:r,slot:v,defaultTag:ag,name:"Menu.Item"})})),lg=Object.assign(ng,{Button:rg,Items:og,Item:sg});var cg=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,"aria-label":t,children:[(0,s.jsx)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,s.jsx)("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17l-.59.59-.58.58V4h16v12zm-9-4h2v2h-2zm0-6h2v4h-2z"})]});const ug={"it-IT":"Non è quello che ti ho chiesto","fr-FR":"Ce n'est pas ce que je t'ai demandé","en-GB":"It's not what I asked"},dg={"it-IT":"La risposta non era corretta","fr-FR":"La réponse n'était pas correcte","en-GB":"The answer was not correct"},fg={"it-IT":"Non mi è piaciuta la risposta","fr-FR":"Je n'ai pas aimé la réponse","en-GB":"I didn't like the answer"};var hg=({memori:e,className:t,onNegativeClick:n,toggle:i=!1,dropdown:o=!1})=>{const[a,l]=(0,u.useState)(),c="it-IT"===e.culture?"it-IT":"fr-FR"===e.culture?"fr-FR":"en-GB",d=ug[c],f=dg[c],h=fg[c];return(0,s.jsx)("div",{className:"memori-chat--feedback"+(t?` ${t}`:""),children:o?(0,s.jsxs)(lg,{as:"div",className:"memori-chat--feedback-menu",children:[(0,s.jsx)(lg.Button,{as:r(u).Fragment,children:(0,s.jsx)(Zd,{ghost:!0,shape:"circle",title:"Feedback",className:"memori-chat--feedback-menu-button",disabled:!!a,icon:(0,s.jsx)(cg,{className:a?"memori-chat--feedback-clicked":void 0})})}),(0,s.jsx)(Jf,{as:r(u).Fragment,enter:"transition ease-out duration-200",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,s.jsx)(lg.Items,{className:"memori-chat--feedback-menu-items",children:(0,s.jsxs)("div",{className:"memori-chat--feedback-menu-items-container",children:[(0,s.jsx)(lg.Item,{children:({active:e})=>(0,s.jsx)("button",{className:"memori-chat--feedback-menu-item"+(e?" memori-chat--feedback-menu-item-active":""),onClick:()=>{l("up"===a&&i?void 0:"up")},children:h})},"ok"),(0,s.jsx)(lg.Item,{children:({active:e})=>(0,s.jsx)("button",{className:"memori-chat--feedback-menu-item"+(e?" memori-chat--feedback-menu-item-active":""),onClick:()=>{l("down"===a&&i?void 0:"down"),n(d)},children:f})},"no")]})})})]}):(0,s.jsx)(zm,{align:"left",content:"Feedback",children:(0,s.jsx)(Zd,{title:"Feedback",onClick:()=>{l("down"===a&&i?void 0:"down"),n(d)},ghost:!0,shape:"circle",icon:(0,s.jsx)(cg,{className:a?"memori-chat--feedback-clicked":void 0})})})})};var pg=({message:e,memori:t,tenant:n,baseUrl:i,apiUrl:o,showFeedback:a,simulateUserPrompt:l,showAIicon:c=!0})=>{const{t:u}=Te();return(0,s.jsxs)(s.Fragment,{children:[e.initial&&(0,s.jsx)("div",{className:"memori-chat--bubble-initial"}),(0,s.jsxs)(Jf,{show:!0,appear:!0,as:"div",className:r(Jd)("memori-chat--bubble-container",{"memori-chat--bubble-from-user":!!e.fromUser,"memori-chat--with-addon":e.generatedByAI&&c||a&&l}),children:[!e.fromUser&&(0,s.jsxs)(Jf.Child,{as:"picture",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),children:[(0,s.jsx)("source",{src:jm({type:"avatar",tenantID:null==n?void 0:n.id,resourceURI:t.avatarURL,baseURL:i,apiURL:o})}),(0,s.jsx)("img",{className:"memori-chat--bubble-avatar-img",alt:t.name,src:t.avatarURL&&t.avatarURL.length>0?jm({type:"avatar",tenantID:null==n?void 0:n.id,resourceURI:t.avatarURL,baseURL:i,apiURL:o}):jm({tenantID:null==n?void 0:n.id,type:"avatar",baseURL:i||"https://app.twincreator.com",apiURL:o})})]}),(0,s.jsxs)(Jf.Child,{as:"div",className:r(Jd)("memori-chat--bubble",{"memori-chat--user-bubble":!!e.fromUser,"memori-chat--with-addon":e.generatedByAI&&c||a&&l,"memori-chat--ai-generated":e.generatedByAI&&c,"memori-chat--with-feedback":a}),enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-09 translate-x-"+(e.fromUser?"30":"-30"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-09 translate-x-"+(e.fromUser?"30":"-30"),children:[(e.translatedText||e.text).split(/\r\n|\r|\n/).map(((e,t)=>(0,s.jsx)("p",{children:e},t))),(e.generatedByAI&&c||a&&l)&&(0,s.jsxs)("div",{className:"memori-chat--bubble-addon",children:[a&&!!l&&(0,s.jsx)(hg,{memori:t,className:"memori-chat--bubble-feedback",dropdown:!0,onNegativeClick:e=>{e&&l(e)}}),e.generatedByAI&&c&&(0,s.jsx)(zm,{align:"left",content:u("generatedByAI"),className:"memori-chat--bubble-ai-icon",children:(0,s.jsx)("span",{children:(0,s.jsx)(Um,{title:u("generatedByAI")||void 0})})})]})]}),e.fromUser&&(0,s.jsx)(Jf.Child,{as:"div",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),children:(0,s.jsx)(Fm,{})})]})]})};u=a("85Hg2"),u=a("85Hg2");var mg,gg=({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:"M574 665.4a8.03 8.03 0 0 0-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 0 0-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 0 0 0 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 0 0 0 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 0 0-11.3 0L372.3 598.7a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"})}),vg=(Jd=a("4IUwl"),{});mg=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function n(e,n){var r=e.el,i=e.elStyle,o=e.elHeight,a=e.rowsLimit,s=e.rowsWrapped,l=e.options,c=e.buffer,u=c;if(s===a+1)return t({},e);var d=c,f=s,h=o;return r.innerHTML=u=c.length?""+c+l.delimiter+n+l.replaceStr:""+n+l.replaceStr,parseFloat(i.height)>parseFloat(o)&&(f++,h=i.height,f===a+1)?(r.innerHTML=u="."===d[d.length-1]&&"..."===l.replaceStr?d+"..":""+d+l.replaceStr,t({},e,{elHeight:h,rowsWrapped:f})):(r.innerHTML=u=d.length?""+d+l.delimiter+n:""+n,t({},e,{buffer:u,elHeight:h,rowsWrapped:f}))}e.disableResponsive=function(e){window.removeEventListener("resize",e)},e.ellipsis=function e(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a={replaceStr:"...",responsive:!1,debounceDelay:250,delimiter:" "},s=t({},a,o),l=r&&(r instanceof NodeList?r:1===r.nodeType?[r]:document.querySelectorAll(r)),c=[],u=0;u<l.length;u++){var d=l[u];c[u]=d.innerHTML;var f=d.innerHTML.split(s.delimiter);d.innerHTML="";var h=window.getComputedStyle(d);f.reduce(n,{el:d,buffer:d.innerHTML,elStyle:h,elHeight:0,rowsLimit:i,rowsWrapped:0,options:s})}if(s.responsive){var p=!1,m=window.innerWidth,g=function(){if(window.innerWidth!==m){m=window.innerWidth;for(var n=0;n<l.length;n++)l[n].innerHTML=c[n];e(r,i,t({},o,{responsive:!1}))}},v=function(){clearTimeout(p),p=setTimeout(g,s.debounceDelay)};return window.addEventListener("resize",v),v}}},"function"==typeof define&&define.amd?define(["exports"],mg):mg(vg);Jd=a("4IUwl");var yg=({loading:e=!1,className:t,title:n,description:i,cover:o,hoverable:a=!1,children:l})=>(0,s.jsx)("div",{className:r(Jd)("memori-card",t,{"memori-card--loading":e,"memori-card--with-cover":o,"memori-card--hoverable":a}),children:(0,s.jsxs)(dp,{spinning:e,children:[o&&(0,s.jsx)("div",{className:"memori-card--cover",children:o}),(0,s.jsxs)("div",{className:"memori-card--content",children:[n&&(0,s.jsx)("h3",{className:"memori-card--title",children:n}),i&&(0,s.jsx)("p",{className:"memori-card--description",children:i}),(0,s.jsx)("div",{className:"memori-card--children",children:l})]})]})});const bg=({isChild:e=!1,item:t,baseUrl:n,onLinkPreviewInfo:i,descriptionOneLine:o=!1})=>{var a,l,c,d;const[f,h]=(0,u.useState)(null),p=(null===(a=t.url)||void 0===a?void 0:a.startsWith("http"))||!t.url||0===(null===(l=t.url)||void 0===l?void 0:l.length)?t.url:`https://${t.url}`;(0,u.useEffect)((()=>{var e,r;let o=(null===(e=t.url)||void 0===e?void 0:e.startsWith("http"))||!t.url||0===(null===(r=t.url)||void 0===r?void 0:r.length)?t.url:`https://${t.url}`;o&&o!==(null==f?void 0:f.urlKey)&&(async(e,t)=>{try{const n=await fetch(`${t||"https://app.twincreator.com"}/api/linkpreview/${encodeURIComponent(e)}`);return await n.json()}catch(e){return console.error("getSiteInfo",e),null}})(o,n).then((e=>{h(e?{...e,urlKey:o}:null),i&&e&&i(e)}))}),[null==t?void 0:t.url,n,i]);const m=t.title&&t.title.length>0?t.title:null==f?void 0:f.title,g=null==f?void 0:f.description,v=null==f?void 0:f.video,y=null!==(c=null==f?void 0:f.image)&&void 0!==c?c:null===(d=null==f?void 0:f.images)||void 0===d?void 0:d[0];return(0,u.useEffect)((()=>{setTimeout((()=>{(0,vg.ellipsis)(".memori-link-item--card .memori-card--description",3,{responsive:!0})}),300)}),[g,t.mediumID]),(0,s.jsx)("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:r(Jd)("memori-link-item--link",{"memori-link-item--link--child":e}),onClick:t=>{e||(t.preventDefault(),t.stopPropagation(),window.open(p,"_blank",`toolbar=yes,top=${.1*window.innerHeight},left=${.1*window.innerWidth},width=${.8*window.innerWidth},height=${.8*window.innerHeight}`))},children:(0,s.jsx)(yg,{hoverable:!0,className:r(Jd)("memori-link-item--card",{"memori-link-item--card-description-oneline":o,"memori-link-item--card-has-image":y,"memori-link-item--card-has-video":v}),cover:v?(0,s.jsx)("iframe",{width:"100%",height:"100%",src:v,title:"Video player",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}):y?(0,s.jsx)("img",{className:"memori-link-item--card-cover-img",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg==",srcSet:y.includes("data:image")?void 0:y,alt:t.title}):(0,s.jsx)("div",{className:"memori-link-item--card-cover-icon",children:(0,s.jsx)(gg,{className:"memori-link-item--icon"})}),title:m,description:g})})};var wg=({items:e,baseUrl:t,descriptionOneLine:n=!1,onLinkPreviewInfo:r})=>(0,s.jsx)(Jf,{appear:!0,show:!0,as:"div",className:"memori-link-items",children:(0,s.jsx)("div",{className:"memori-link-items--grid",children:e.map(((e,i)=>(0,s.jsx)(Jf.Child,{as:"div",className:"memori-link-item",enter:"ease-out duration-500 delay-"+100*i,enterFrom:"opacity-0 scale-95",enterTo:"opacity-1 scale-100",leave:"ease-in duration-300",leaveFrom:"opacity-1 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsx)(bg,{item:e,baseUrl:t,descriptionOneLine:n,onLinkPreviewInfo:r})},e.mediumID)))})});u=a("85Hg2");const xg=["va bene","no grazie","si","no","sì","arrivederci","non c'entrava","non mi è piaciuto"],Sg=async(e,t,n,r)=>{var i;const o=xg.indexOf(e.toLowerCase())>-1?"IT":null==n?void 0:n.toUpperCase(),a=await fetch(`${r||"https://app.twincreator.com"}/api/translate?text=${encodeURIComponent(e)}&target_lang=${t.toUpperCase()}${o?`&source_lang=${o}`:""}`,{method:"GET",headers:{Accept:"*/*"}}),s=await a.json();return null===(i=null==s?void 0:s.translations)||void 0===i?void 0:i[0]},Mg=[{value:"IT",label:"Italiano"},{value:"EN",label:"English"},{value:"DE",label:"Deutsch"},{value:"ES",label:"Español"},{value:"FR",label:"Français"},{value:"PT",label:"Português"},{value:"UK",label:"Українська"},{value:"RU",label:"Русский"}],_g=["image/jpeg","image/png","image/jpg","image/gif","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/pdf","video/mp4","video/avi","audio/mpeg3","audio/wav","audio/mpeg","video/mpeg","model/gltf-binary"],Ag="👤",Eg=[{name:"text",lang:"text",mimeType:"text/plain",monacoLang:"plaintext",executable:!0},{name:"javascript/jsx",lang:"jsx",mimeType:"text/javascript",monacoLang:"javascript",executable:!0},{name:"typescript/tsx",lang:"tsx",mimeType:"text/ecmascript",monacoLang:"typescript",executable:!0},{name:"json",lang:"json",mimeType:"application/json",monacoLang:"json",executable:!0},{name:"css",lang:"scss",mimeType:"text/css",monacoLang:"css",executable:!0},{name:"html/xml",lang:"tsx",mimeType:"application/xml",monacoLang:"xml"},{name:"bash",lang:"bash",mimeType:"application/x-sh",monacoLang:"shell"},{name:"python",lang:"python",mimeType:"text/x-python",monacoLang:"python"},{name:"cpp/csharp",lang:"cpp",mimeType:"text/x-c++src",monacoLang:"cpp"},{name:"php",lang:"php",mimeType:"application/x-php",monacoLang:"php"},{name:"ruby",lang:"ruby",mimeType:"text/x-ruby",monacoLang:"ruby"},{name:"sql",lang:"sql",mimeType:"text/x-sql",monacoLang:"sql"}];u=a("85Hg2");var Cg=({src:e,poster:t,alt:n=""})=>((0,u.useEffect)((()=>{const e=document.createElement("script");return e.src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js",e.type="module",document.head.appendChild(e),()=>{document.head.removeChild(e)}}),[]),(0,s.jsx)("div",{className:"model-viewer",children:(0,s.jsx)("model-viewer",{src:e,"ios-src":"",poster:t,alt:n,"shadow-intensity":"1","disable-zoom":!0,"camera-controls":!0,autoplay:!0})}));var kg=({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:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"})}),Tg={};function Ig(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}(Tg=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Ig(o,r,i,a,s,"next",e)}function s(e){Ig(o,r,i,a,s,"throw",e)}a(void 0)}))}}).__esModule=!0,Tg.default=Tg;var Og={};function Rg(){return Og=Rg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Og.__esModule=!0,Og.default=Og,Rg.apply(this,arguments)}(Og=Rg).__esModule=!0,Og.default=Og;var Pg={};(Pg=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}).__esModule=!0,Pg.default=Pg;var Ng={},Lg={},Dg=a("7h3ED").default,Bg={},jg=a("7h3ED").default;function Fg(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,Lg(r.key),r)}}(Bg=function(e,t){if("object"!==jg(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==jg(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}).__esModule=!0,Bg.default=Bg,(Lg=function(e){var t=Bg(e,"string");return"symbol"===Dg(t)?t:String(t)}).__esModule=!0,Lg.default=Lg,(Ng=function(e,t,n){return t&&Fg(e.prototype,t),n&&Fg(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}).__esModule=!0,Ng.default=Ng;var Ug={},zg={};function Hg(e,t){return zg=Hg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},zg.__esModule=!0,zg.default=zg,Hg(e,t)}(zg=Hg).__esModule=!0,zg.default=zg,(Ug=function(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&&zg(e,t)}).__esModule=!0,Ug.default=Ug;var Vg={},Wg=a("7h3ED").default,Gg={};(Gg=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}).__esModule=!0,Gg.default=Gg,(Vg=function(e,t){if(t&&("object"===Wg(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Gg(e)}).__esModule=!0,Vg.default=Vg;var qg={};function Kg(e){return qg=Kg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qg.__esModule=!0,qg.default=qg,Kg(e)}(qg=Kg).__esModule=!0,qg.default=qg;var Yg={};(Yg=function(e,t,n){return(t=Lg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}).__esModule=!0,Yg.default=Yg;var Jg,Qg=a("6EIcq")();Jg=Qg;try{regeneratorRuntime=Qg}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=Qg:Function("r","regeneratorRuntime = r")(Qg)}u=a("85Hg2");var Xg={},Zg={};(Zg=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}).__esModule=!0,Zg.default=Zg,(Xg=function(e,t){if(null==e)return{};var n,r,i=Zg(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}).__esModule=!0,Xg.default=Xg;var $g={},ev={},tv={};(tv=function(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}).__esModule=!0,tv.default=tv,(ev=function(e){if(Array.isArray(e))return tv(e)}).__esModule=!0,ev.default=ev;var nv={};(nv=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}).__esModule=!0,nv.default=nv;var rv={};rv=function(e,t){if(e){if("string"==typeof e)return tv(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)?tv(e,t):void 0}},rv.__esModule=!0,rv.default=rv;var iv={};(iv=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}).__esModule=!0,iv.default=iv,($g=function(e){return ev(e)||nv(e)||rv(e)||iv()}).__esModule=!0,$g.default=$g;u=a("85Hg2"),u=a("85Hg2");function ov(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 av(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ov(Object(n),!0).forEach((function(t){r(Yg)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ov(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var sv={};function lv(e){if(0===e.length||1===e.length)return e;var t,n,r=e.join(".");return sv[r]||(sv[r]=0===(n=(t=e).length)||1===n?t:2===n?[t[0],t[1],"".concat(t[0],".").concat(t[1]),"".concat(t[1],".").concat(t[0])]:3===n?[t[0],t[1],t[2],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0])]:n>=4?[t[0],t[1],t[2],t[3],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[2],".").concat(t[3]),"".concat(t[3],".").concat(t[0]),"".concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[0]),"".concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[3],".").concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[2],".").concat(t[1],".").concat(t[0])]:void 0),sv[r]}function cv(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=e.filter((function(e){return"token"!==e})),i=lv(r);return i.reduce((function(e,t){return av(av({},e),n[t])}),t)}function uv(e){return e.join(" ")}function dv(e){var t=e.node,n=e.stylesheet,i=e.style,o=void 0===i?{}:i,a=e.useInlineStyles,s=e.key,l=t.properties,c=t.type,d=t.tagName,f=t.value;if("text"===c)return f;if(d){var h,p=function(e,t){var n=0;return function(r){return n+=1,r.map((function(r,i){return dv({node:r,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(i)})}))}}(n,a);if(a){var m=Object.keys(n).reduce((function(e,t){return t.split(".").forEach((function(t){e.includes(t)||e.push(t)})),e}),[]),g=l.className&&l.className.includes("token")?["token"]:[],v=l.className&&g.concat(l.className.filter((function(e){return!m.includes(e)})));h=av(av({},l),{},{className:uv(v)||void 0,style:cv(l.className,Object.assign({},l.style,o),n)})}else h=av(av({},l),{},{className:uv(l.className)});var y=p(t.children);return r(u).createElement(d,r(Og)({key:s},h),y)}}var fv=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function hv(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 pv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hv(Object(n),!0).forEach((function(t){r(Yg)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var mv=/\n/g;function gv(e){var t=e.codeString,n=e.codeStyle,i=e.containerStyle,o=void 0===i?{float:"left",paddingRight:"10px"}:i,a=e.numberStyle,s=void 0===a?{}:a,l=e.startingLineNumber;return r(u).createElement("code",{style:Object.assign({},n,o)},function(e){var t=e.lines,n=e.startingLineNumber,i=e.style;return t.map((function(e,t){var o=t+n;return r(u).createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"==typeof i?i(o):i},"".concat(o,"\n"))}))}({lines:t.replace(/\n$/,"").split("\n"),style:s,startingLineNumber:l}))}function vv(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function yv(e,t,n){var r,i={display:"inline-block",minWidth:(r=n,"".concat(r.toString().length,".25em")),paddingRight:"1em",textAlign:"right",userSelect:"none"},o="function"==typeof e?e(t):e;return pv(pv({},i),o)}function bv(e){var t=e.children,n=e.lineNumber,r=e.lineNumberStyle,i=e.largestLineNumber,o=e.showInlineLineNumbers,a=e.lineProps,s=void 0===a?{}:a,l=e.className,c=void 0===l?[]:l,u=e.showLineNumbers,d=e.wrapLongLines,f="function"==typeof s?s(n):s;if(f.className=c,n&&o){var h=yv(r,n,i);t.unshift(vv(n,h))}return d&u&&(f.style=pv(pv({},f.style),{},{display:"flex"})),{type:"element",tagName:"span",properties:f,children:t}}function wv(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=0;i<e.length;i++){var o=e[i];if("text"===o.type)n.push(bv({children:[o],className:r($g)(new Set(t))}));else if(o.children){var a=t.concat(o.properties.className);wv(o.children,a).forEach((function(e){return n.push(e)}))}}return n}function xv(e,t,n,r,i,o,a,s,l){var c,u=wv(e.value),d=[],f=-1,h=0;function p(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return bv({children:e,lineNumber:t,lineNumberStyle:s,largestLineNumber:a,showInlineLineNumbers:i,lineProps:n,className:o,showLineNumbers:r,wrapLongLines:l})}function m(e,t){if(r&&t&&i){var n=yv(s,t,a);e.unshift(vv(t,n))}return e}function g(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t||r.length>0?p(e,n,r):m(e,n)}for(var v=function(){var e=u[h],t=e.children[0].value;if(t.match(mv)){var n=t.split("\n");n.forEach((function(t,i){var a=r&&d.length+o,s={type:"text",value:"".concat(t,"\n")};if(0===i){var l=g(u.slice(f+1,h).concat(bv({children:[s],className:e.properties.className})),a);d.push(l)}else if(i===n.length-1){var c=u[h+1]&&u[h+1].children&&u[h+1].children[0],p={type:"text",value:"".concat(t)};if(c){var m=bv({children:[p],className:e.properties.className});u.splice(h+1,0,m)}else{var v=g([p],a,e.properties.className);d.push(v)}}else{var y=g([s],a,e.properties.className);d.push(y)}})),f=h}h++};h<u.length;)v();if(f!==u.length-1){var y=u.slice(f+1,u.length);if(y&&y.length){var b=g(y,r&&d.length+o);d.push(b)}}return t?d:(c=[]).concat.apply(c,d)}function Sv(e){var t=e.rows,n=e.stylesheet,r=e.useInlineStyles;return t.map((function(e,t){return dv({node:e,stylesheet:n,useInlineStyles:r,key:"code-segement".concat(t)})}))}function Mv(e){return e&&void 0!==e.highlightAuto}function _v(e,t){return function(n){var i=n.language,o=n.children,a=n.style,s=void 0===a?t:a,l=n.customStyle,c=void 0===l?{}:l,d=n.codeTagProps,f=void 0===d?{className:i?"language-".concat(i):void 0,style:pv(pv({},s['code[class*="language-"]']),s['code[class*="language-'.concat(i,'"]')])}:d,h=n.useInlineStyles,p=void 0===h||h,m=n.showLineNumbers,g=void 0!==m&&m,v=n.showInlineLineNumbers,y=void 0===v||v,b=n.startingLineNumber,w=void 0===b?1:b,x=n.lineNumberContainerStyle,S=n.lineNumberStyle,M=void 0===S?{}:S,_=n.wrapLines,A=n.wrapLongLines,E=void 0!==A&&A,C=n.lineProps,k=void 0===C?{}:C,T=n.renderer,I=n.PreTag,O=void 0===I?"pre":I,R=n.CodeTag,P=void 0===R?"code":R,N=n.code,L=void 0===N?(Array.isArray(o)?o[0]:o)||"":N,D=n.astGenerator,B=r(Xg)(n,fv);D=D||e;var j=g?r(u).createElement(gv,{containerStyle:x,codeStyle:f.style||{},numberStyle:M,startingLineNumber:w,codeString:L}):null,F=s.hljs||s['pre[class*="language-"]']||{backgroundColor:"#fff"},U=Mv(D)?"hljs":"prismjs",z=p?Object.assign({},B,{style:Object.assign({},F,c)}):Object.assign({},B,{className:B.className?"".concat(U," ").concat(B.className):U,style:Object.assign({},c)});if(f.style=pv(pv({},f.style),{},E?{whiteSpace:"pre-wrap"}:{whiteSpace:"pre"}),!D)return r(u).createElement(O,z,j,r(u).createElement(P,f,L));(void 0===_&&T||E)&&(_=!0),T=T||Sv;var H=[{type:"text",value:L}],V=function(e){var t=e.astGenerator,n=e.language,r=e.code,i=e.defaultCodeValue;if(Mv(t)){var o=function(e,t){return-1!==e.listLanguages().indexOf(t)}(t,n);return"text"===n?{value:i,language:"text"}:o?t.highlight(n,r):t.highlightAuto(r)}try{return n&&"text"!==n?{value:t.highlight(r,n)}:{value:i}}catch(e){return{value:i}}}({astGenerator:D,language:i,code:L,defaultCodeValue:H});null===V.language&&(V.value=H);var W=xv(V,_,k,g,y,w,V.value.length+w,M,E);return r(u).createElement(O,z,r(u).createElement(P,f,!y&&j,T({rows:W,stylesheet:s,useInlineStyles:p})))}}function Av(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,i=r(qg)(e);if(t){var o=r(qg)(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return r(Vg)(this,n)}}var Ev,Cv,kv,Tv,Iv,Ov,Rv,Pv=function(e,t){return function(){var n=r(Tg)(r(Jg).mark((function n(i){var o;return r(Jg).wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t();case 2:o=n.sent,i(e,o.default||o);case 4:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()},Nv={abap:Pv("abap",(function(){return a("bwHpE")})),abnf:Pv("abnf",(function(){return a("daD87")})),actionscript:Pv("actionscript",(function(){return a("lpEgO")})),ada:Pv("ada",(function(){return a("1sGW9")})),agda:Pv("agda",(function(){return a("e9VyR")})),al:Pv("al",(function(){return a("kMFSe")})),antlr4:Pv("antlr4",(function(){return a("8HlsP")})),apacheconf:Pv("apacheconf",(function(){return a("isFCh")})),apex:Pv("apex",(function(){return a("gUXVM")})),apl:Pv("apl",(function(){return a("2L15v")})),applescript:Pv("applescript",(function(){return a("8XyFT")})),aql:Pv("aql",(function(){return a("gFWTI")})),arduino:Pv("arduino",(function(){return a("jI3VB")})),arff:Pv("arff",(function(){return a("6uYTH")})),asciidoc:Pv("asciidoc",(function(){return a("gdYKH")})),asm6502:Pv("asm6502",(function(){return a("ahFLg")})),asmatmel:Pv("asmatmel",(function(){return a("4irIu")})),aspnet:Pv("aspnet",(function(){return a("yDC6n")})),autohotkey:Pv("autohotkey",(function(){return a("a4xpy")})),autoit:Pv("autoit",(function(){return a("iNSix")})),avisynth:Pv("avisynth",(function(){return a("kEBnk")})),avroIdl:Pv("avroIdl",(function(){return a("lzthi")})),bash:Pv("bash",(function(){return Promise.resolve(a("3aDLI"))})),basic:Pv("basic",(function(){return a("cxDu6")})),batch:Pv("batch",(function(){return a("6zDll")})),bbcode:Pv("bbcode",(function(){return a("bPS87")})),bicep:Pv("bicep",(function(){return a("8dy5f")})),birb:Pv("birb",(function(){return a("3vHrY")})),bison:Pv("bison",(function(){return a("bCjBS")})),bnf:Pv("bnf",(function(){return a("4NqDW")})),brainfuck:Pv("brainfuck",(function(){return a("4s0KX")})),brightscript:Pv("brightscript",(function(){return a("jTsQ4")})),bro:Pv("bro",(function(){return a("5lMc2")})),bsl:Pv("bsl",(function(){return a("jBYxC")})),c:Pv("c",(function(){return Promise.resolve(a("lyZgY"))})),cfscript:Pv("cfscript",(function(){return a("coZDy")})),chaiscript:Pv("chaiscript",(function(){return a("e1zEN")})),cil:Pv("cil",(function(){return a("crKoM")})),clike:Pv("clike",(function(){return a("4kO9t")})),clojure:Pv("clojure",(function(){return a("01SpB")})),cmake:Pv("cmake",(function(){return a("9yG4p")})),cobol:Pv("cobol",(function(){return a("967Hn")})),coffeescript:Pv("coffeescript",(function(){return a("7Yi6H")})),concurnas:Pv("concurnas",(function(){return a("5tXmX")})),coq:Pv("coq",(function(){return a("ektdr")})),cpp:Pv("cpp",(function(){return Promise.resolve(a("lR39A"))})),crystal:Pv("crystal",(function(){return a("8gt4L")})),csharp:Pv("csharp",(function(){return a("7K6eJ")})),cshtml:Pv("cshtml",(function(){return a("cVu4i")})),csp:Pv("csp",(function(){return a("ecKo1")})),cssExtras:Pv("cssExtras",(function(){return a("gnpv8")})),css:Pv("css",(function(){return a("jx0H8")})),csv:Pv("csv",(function(){return a("f9kmW")})),cypher:Pv("cypher",(function(){return a("lojor")})),d:Pv("d",(function(){return a("6Qa0U")})),dart:Pv("dart",(function(){return a("74K1B")})),dataweave:Pv("dataweave",(function(){return a("93H6c")})),dax:Pv("dax",(function(){return a("cf9Y9")})),dhall:Pv("dhall",(function(){return a("f6UWv")})),diff:Pv("diff",(function(){return a("klPVo")})),django:Pv("django",(function(){return a("jfxe9")})),dnsZoneFile:Pv("dnsZoneFile",(function(){return a("5aMz5")})),docker:Pv("docker",(function(){return a("kOauC")})),dot:Pv("dot",(function(){return a("btE6k")})),ebnf:Pv("ebnf",(function(){return a("aT88c")})),editorconfig:Pv("editorconfig",(function(){return a("jWOl8")})),eiffel:Pv("eiffel",(function(){return a("kHJaX")})),ejs:Pv("ejs",(function(){return a("frfnA")})),elixir:Pv("elixir",(function(){return a("hcrJ2")})),elm:Pv("elm",(function(){return a("jd271")})),erb:Pv("erb",(function(){return a("gczXL")})),erlang:Pv("erlang",(function(){return a("FsabW")})),etlua:Pv("etlua",(function(){return a("9DI9l")})),excelFormula:Pv("excelFormula",(function(){return a("3QVue")})),factor:Pv("factor",(function(){return a("ltNCT")})),falselang:Pv("falselang",(function(){return a("g0Q6p")})),firestoreSecurityRules:Pv("firestoreSecurityRules",(function(){return a("ukA2V")})),flow:Pv("flow",(function(){return a("e5prn")})),fortran:Pv("fortran",(function(){return a("gIEL6")})),fsharp:Pv("fsharp",(function(){return a("3wQkt")})),ftl:Pv("ftl",(function(){return a("7ZVWs")})),gap:Pv("gap",(function(){return a("hOFj6")})),gcode:Pv("gcode",(function(){return a("95BzQ")})),gdscript:Pv("gdscript",(function(){return a("iul6t")})),gedcom:Pv("gedcom",(function(){return a("e0qJM")})),gherkin:Pv("gherkin",(function(){return a("2SHak")})),git:Pv("git",(function(){return a("l6VFH")})),glsl:Pv("glsl",(function(){return a("cEMfJ")})),gml:Pv("gml",(function(){return a("8UVTr")})),gn:Pv("gn",(function(){return a("kvibD")})),goModule:Pv("goModule",(function(){return a("icqjF")})),go:Pv("go",(function(){return a("jLkg8")})),graphql:Pv("graphql",(function(){return a("aYGNi")})),groovy:Pv("groovy",(function(){return a("4bTmH")})),haml:Pv("haml",(function(){return a("h2A6V")})),handlebars:Pv("handlebars",(function(){return a("79YVJ")})),haskell:Pv("haskell",(function(){return a("bsiLW")})),haxe:Pv("haxe",(function(){return a("94Kdj")})),hcl:Pv("hcl",(function(){return a("9CheR")})),hlsl:Pv("hlsl",(function(){return a("h3dqW")})),hoon:Pv("hoon",(function(){return a("9WbsW")})),hpkp:Pv("hpkp",(function(){return a("GiPN3")})),hsts:Pv("hsts",(function(){return a("eaSn9")})),http:Pv("http",(function(){return a("1uj7b")})),ichigojam:Pv("ichigojam",(function(){return a("ge562")})),icon:Pv("icon",(function(){return a("lVHUf")})),icuMessageFormat:Pv("icuMessageFormat",(function(){return a("aYoUL")})),idris:Pv("idris",(function(){return a("1RVAE")})),iecst:Pv("iecst",(function(){return a("bi7Dr")})),ignore:Pv("ignore",(function(){return a("cq0Pi")})),inform7:Pv("inform7",(function(){return a("31K4E")})),ini:Pv("ini",(function(){return a("l05OZ")})),io:Pv("io",(function(){return a("6bY1b")})),j:Pv("j",(function(){return a("1ebDS")})),java:Pv("java",(function(){return a("iEZZI")})),javadoc:Pv("javadoc",(function(){return a("aHy5a")})),javadoclike:Pv("javadoclike",(function(){return a("5f3rE")})),javascript:Pv("javascript",(function(){return a("7JDFI")})),javastacktrace:Pv("javastacktrace",(function(){return a("gdCGE")})),jexl:Pv("jexl",(function(){return a("cqMb9")})),jolie:Pv("jolie",(function(){return a("cEDX4")})),jq:Pv("jq",(function(){return a("kEWsh")})),jsExtras:Pv("jsExtras",(function(){return a("74PI8")})),jsTemplates:Pv("jsTemplates",(function(){return a("30TPr")})),jsdoc:Pv("jsdoc",(function(){return a("9DH5c")})),json:Pv("json",(function(){return Promise.resolve(a("l1Rj1"))})),json5:Pv("json5",(function(){return a("920rv")})),jsonp:Pv("jsonp",(function(){return a("9AwS1")})),jsstacktrace:Pv("jsstacktrace",(function(){return a("bYXMr")})),jsx:Pv("jsx",(function(){return Promise.resolve(a("6ho3O"))})),julia:Pv("julia",(function(){return a("g0ibH")})),keepalived:Pv("keepalived",(function(){return a("2hdnH")})),keyman:Pv("keyman",(function(){return a("cIufI")})),kotlin:Pv("kotlin",(function(){return a("c26dU")})),kumir:Pv("kumir",(function(){return a("iYAha")})),kusto:Pv("kusto",(function(){return a("9z1oX")})),latex:Pv("latex",(function(){return a("lCPLU")})),latte:Pv("latte",(function(){return a("c9oN0")})),less:Pv("less",(function(){return a("hA3V9")})),lilypond:Pv("lilypond",(function(){return a("hpHTA")})),liquid:Pv("liquid",(function(){return a("kpZTm")})),lisp:Pv("lisp",(function(){return a("chgK5")})),livescript:Pv("livescript",(function(){return a("2gdiv")})),llvm:Pv("llvm",(function(){return a("jUeFO")})),log:Pv("log",(function(){return a("3BFSQ")})),lolcode:Pv("lolcode",(function(){return a("lG9br")})),lua:Pv("lua",(function(){return a("cVGpd")})),magma:Pv("magma",(function(){return a("4LVzY")})),makefile:Pv("makefile",(function(){return a("2NviD")})),markdown:Pv("markdown",(function(){return a("jUFCF")})),markupTemplating:Pv("markupTemplating",(function(){return Promise.resolve(a("t3W0d"))})),markup:Pv("markup",(function(){return a("5hIXu")})),matlab:Pv("matlab",(function(){return a("kPAC0")})),maxscript:Pv("maxscript",(function(){return a("gHOJy")})),mel:Pv("mel",(function(){return a("9mj6e")})),mermaid:Pv("mermaid",(function(){return a("kozw5")})),mizar:Pv("mizar",(function(){return a("2bN6W")})),mongodb:Pv("mongodb",(function(){return a("eHKWX")})),monkey:Pv("monkey",(function(){return a("7Fh0C")})),moonscript:Pv("moonscript",(function(){return a("hDXwC")})),n1ql:Pv("n1ql",(function(){return a("j9bkC")})),n4js:Pv("n4js",(function(){return a("eTmBF")})),nand2tetrisHdl:Pv("nand2tetrisHdl",(function(){return a("ezjCf")})),naniscript:Pv("naniscript",(function(){return a("VxHk1")})),nasm:Pv("nasm",(function(){return a("ly95T")})),neon:Pv("neon",(function(){return a("7Fk34")})),nevod:Pv("nevod",(function(){return a("3U8Qv")})),nginx:Pv("nginx",(function(){return a("c6qVk")})),nim:Pv("nim",(function(){return a("1JdCk")})),nix:Pv("nix",(function(){return a("jcstS")})),nsis:Pv("nsis",(function(){return a("kEJqW")})),objectivec:Pv("objectivec",(function(){return a("lUP8A")})),ocaml:Pv("ocaml",(function(){return a("lhTAD")})),opencl:Pv("opencl",(function(){return a("8rxKO")})),openqasm:Pv("openqasm",(function(){return a("ib0uL")})),oz:Pv("oz",(function(){return a("csCUS")})),parigp:Pv("parigp",(function(){return a("2DkHE")})),parser:Pv("parser",(function(){return a("2cp75")})),pascal:Pv("pascal",(function(){return a("fViVl")})),pascaligo:Pv("pascaligo",(function(){return a("9Uuxa")})),pcaxis:Pv("pcaxis",(function(){return a("jUdnN")})),peoplecode:Pv("peoplecode",(function(){return a("l8w4e")})),perl:Pv("perl",(function(){return a("aX7dM")})),phpExtras:Pv("phpExtras",(function(){return a("3cMZl")})),php:Pv("php",(function(){return Promise.resolve(a("5li5P"))})),phpdoc:Pv("phpdoc",(function(){return a("bDyJN")})),plsql:Pv("plsql",(function(){return a("cPuMN")})),powerquery:Pv("powerquery",(function(){return a("jE1gU")})),powershell:Pv("powershell",(function(){return a("k7t0j")})),processing:Pv("processing",(function(){return a("jr8hV")})),prolog:Pv("prolog",(function(){return a("hpuat")})),promql:Pv("promql",(function(){return a("ckXC5")})),properties:Pv("properties",(function(){return a("fAh6P")})),protobuf:Pv("protobuf",(function(){return a("R6WqB")})),psl:Pv("psl",(function(){return a("Al65w")})),pug:Pv("pug",(function(){return a("dxbNS")})),puppet:Pv("puppet",(function(){return a("lrSuh")})),pure:Pv("pure",(function(){return a("6DKQK")})),purebasic:Pv("purebasic",(function(){return a("7ZkSb")})),purescript:Pv("purescript",(function(){return a("dBTYx")})),python:Pv("python",(function(){return Promise.resolve(a("kiy5M"))})),q:Pv("q",(function(){return a("4FXyy")})),qml:Pv("qml",(function(){return a("2zZFj")})),qore:Pv("qore",(function(){return a("iCK1Y")})),qsharp:Pv("qsharp",(function(){return a("dvH9H")})),r:Pv("r",(function(){return a("lQqRt")})),racket:Pv("racket",(function(){return a("eHKmq")})),reason:Pv("reason",(function(){return a("kkeLT")})),regex:Pv("regex",(function(){return a("llX50")})),rego:Pv("rego",(function(){return a("9hKdZ")})),renpy:Pv("renpy",(function(){return a("cJgw5")})),rest:Pv("rest",(function(){return a("867DK")})),rip:Pv("rip",(function(){return a("3Odjx")})),roboconf:Pv("roboconf",(function(){return a("gQ0Us")})),robotframework:Pv("robotframework",(function(){return a("bLCgx")})),ruby:Pv("ruby",(function(){return Promise.resolve(a("ch1PX"))})),rust:Pv("rust",(function(){return a("cInT8")})),sas:Pv("sas",(function(){return a("iz7eP")})),sass:Pv("sass",(function(){return a("hrDC3")})),scala:Pv("scala",(function(){return a("ub8Bf")})),scheme:Pv("scheme",(function(){return a("7NAAt")})),scss:Pv("scss",(function(){return Promise.resolve(a("fU6a0"))})),shellSession:Pv("shellSession",(function(){return a("7kKCv")})),smali:Pv("smali",(function(){return a("2lkCb")})),smalltalk:Pv("smalltalk",(function(){return a("4280y")})),smarty:Pv("smarty",(function(){return a("4hXYK")})),sml:Pv("sml",(function(){return a("jh2E8")})),solidity:Pv("solidity",(function(){return a("dTdF2")})),solutionFile:Pv("solutionFile",(function(){return a("iI5tm")})),soy:Pv("soy",(function(){return a("aoU5C")})),sparql:Pv("sparql",(function(){return a("ggrvb")})),splunkSpl:Pv("splunkSpl",(function(){return a("8LhCX")})),sqf:Pv("sqf",(function(){return a("3tDsu")})),sql:Pv("sql",(function(){return Promise.resolve(a("bnDV9"))})),squirrel:Pv("squirrel",(function(){return a("bxaUV")})),stan:Pv("stan",(function(){return a("dBqrq")})),stylus:Pv("stylus",(function(){return a("JlHVK")})),swift:Pv("swift",(function(){return a("c7NBs")})),systemd:Pv("systemd",(function(){return a("jprZl")})),t4Cs:Pv("t4Cs",(function(){return a("edsMI")})),t4Templating:Pv("t4Templating",(function(){return a("bS9Wa")})),t4Vb:Pv("t4Vb",(function(){return a("gYk20")})),tap:Pv("tap",(function(){return a("byv7d")})),tcl:Pv("tcl",(function(){return a("lUAIZ")})),textile:Pv("textile",(function(){return a("7J2LO")})),toml:Pv("toml",(function(){return a("eXtdM")})),tremor:Pv("tremor",(function(){return a("vyajH")})),tsx:Pv("tsx",(function(){return Promise.resolve(a("7cTnl"))})),tt2:Pv("tt2",(function(){return a("8XOOm")})),turtle:Pv("turtle",(function(){return a("1XvLQ")})),twig:Pv("twig",(function(){return a("i9Fpp")})),typescript:Pv("typescript",(function(){return Promise.resolve(a("fzL8k"))})),typoscript:Pv("typoscript",(function(){return a("kKk69")})),unrealscript:Pv("unrealscript",(function(){return a("jgq8Y")})),uorazor:Pv("uorazor",(function(){return a("dsZ00")})),uri:Pv("uri",(function(){return a("fqJRp")})),v:Pv("v",(function(){return a("bgfyB")})),vala:Pv("vala",(function(){return a("68x4q")})),vbnet:Pv("vbnet",(function(){return a("eUhQs")})),velocity:Pv("velocity",(function(){return a("fPNdV")})),verilog:Pv("verilog",(function(){return a("2fM1V")})),vhdl:Pv("vhdl",(function(){return a("hNF6q")})),vim:Pv("vim",(function(){return a("75TCr")})),visualBasic:Pv("visualBasic",(function(){return a("fc93z")})),warpscript:Pv("warpscript",(function(){return a("jgHlG")})),wasm:Pv("wasm",(function(){return a("dVZkI")})),webIdl:Pv("webIdl",(function(){return a("9Jnxv")})),wiki:Pv("wiki",(function(){return a("1Gimo")})),wolfram:Pv("wolfram",(function(){return a("4SyRT")})),wren:Pv("wren",(function(){return a("gaIVs")})),xeora:Pv("xeora",(function(){return a("lagad")})),xmlDoc:Pv("xmlDoc",(function(){return a("9DNYE")})),xojo:Pv("xojo",(function(){return a("ksF4f")})),xquery:Pv("xquery",(function(){return a("gXxHJ")})),yaml:Pv("yaml",(function(){return a("6rk3j")})),yang:Pv("yang",(function(){return a("kTyrQ")})),zig:Pv("zig",(function(){return a("d3mFC")}))},Lv=(Cv=(Ev={loader:function(){return a("bB2YF").then((function(e){return e.default||e}))},isLanguageRegistered:function(e,t){return e.registered(t)},languageLoaders:Nv,registerLanguage:function(e,t,n){return e.register(n)}}).loader,kv=Ev.isLanguageRegistered,Tv=Ev.registerLanguage,Iv=Ev.languageLoaders,Ov=Ev.noAsyncLoadingLanguages,Rv=function(e){r(Ug)(i,e);var t,n=Av(i);function i(){return r(Pg)(this,i),n.apply(this,arguments)}return r(Ng)(i,[{key:"componentDidUpdate",value:function(){!i.isRegistered(this.props.language)&&Iv&&this.loadLanguage()}},{key:"componentDidMount",value:function(){var e=this;i.astGeneratorPromise||i.loadAstGenerator(),i.astGenerator||i.astGeneratorPromise.then((function(){e.forceUpdate()})),!i.isRegistered(this.props.language)&&Iv&&this.loadLanguage()}},{key:"loadLanguage",value:function(){var e=this,t=this.props.language;"text"!==t&&i.loadLanguage(t).then((function(){return e.forceUpdate()})).catch((function(){}))}},{key:"normalizeLanguage",value:function(e){return i.isSupportedLanguage(e)?e:"text"}},{key:"render",value:function(){return r(u).createElement(i.highlightInstance,r(Og)({},this.props,{language:this.normalizeLanguage(this.props.language),astGenerator:i.astGenerator}))}}],[{key:"preload",value:function(){return i.loadAstGenerator()}},{key:"loadLanguage",value:(t=r(Tg)(r(Jg).mark((function e(t){var n;return r(Jg).wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof(n=Iv[t])){e.next=5;break}return e.abrupt("return",n(i.registerLanguage));case 5:throw new Error("Language ".concat(t," not supported"));case 6:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"isSupportedLanguage",value:function(e){return i.isRegistered(e)||"function"==typeof Iv[e]}},{key:"loadAstGenerator",value:function(){return i.astGeneratorPromise=Cv().then((function(e){i.astGenerator=e,Tv&&i.languages.forEach((function(t,n){return Tv(e,n,t)}))})),i.astGeneratorPromise}}]),i}(r(u).PureComponent),r(Yg)(Rv,"astGenerator",null),r(Yg)(Rv,"highlightInstance",_v(null,{})),r(Yg)(Rv,"astGeneratorPromise",null),r(Yg)(Rv,"languages",new Map),r(Yg)(Rv,"supportedLanguages",Ev.supportedLanguages||Object.keys(Iv||{})),r(Yg)(Rv,"isRegistered",(function(e){if(Ov)return!0;if(!Tv)throw new Error("Current syntax highlighter doesn't support registration of languages");return Rv.astGenerator?kv(Rv.astGenerator,e):Rv.languages.has(e)})),r(Yg)(Rv,"registerLanguage",(function(e,t){if(!Tv)throw new Error("Current syntax highlighter doesn't support registration of languages");if(Rv.astGenerator)return Tv(Rv.astGenerator,e,t);Rv.languages.set(e,t)})),Rv),Dv={},Bv={};(Bv=function(e){return e&&e.__esModule?e:{default:e}}).__esModule=!0,Bv.default=Bv,Object.defineProperty(Dv,"__esModule",{value:!0}),Object.defineProperty(Dv,"a11yDark",{enumerable:!0,get:function(){return qv.default}}),Object.defineProperty(Dv,"atomDark",{enumerable:!0,get:function(){return Kv.default}}),Object.defineProperty(Dv,"base16AteliersulphurpoolLight",{enumerable:!0,get:function(){return Yv.default}}),Object.defineProperty(Dv,"cb",{enumerable:!0,get:function(){return Jv.default}}),Object.defineProperty(Dv,"coldarkCold",{enumerable:!0,get:function(){return Qv.default}}),Object.defineProperty(Dv,"coldarkDark",{enumerable:!0,get:function(){return Xv.default}}),Object.defineProperty(Dv,"coy",{enumerable:!0,get:function(){return jv.default}}),Object.defineProperty(Dv,"coyWithoutShadows",{enumerable:!0,get:function(){return Zv.default}}),Object.defineProperty(Dv,"darcula",{enumerable:!0,get:function(){return $v.default}}),Object.defineProperty(Dv,"dark",{enumerable:!0,get:function(){return Fv.default}}),Object.defineProperty(Dv,"dracula",{enumerable:!0,get:function(){return ey.default}}),Object.defineProperty(Dv,"duotoneDark",{enumerable:!0,get:function(){return ty.default}}),Object.defineProperty(Dv,"duotoneEarth",{enumerable:!0,get:function(){return ny.default}}),Object.defineProperty(Dv,"duotoneForest",{enumerable:!0,get:function(){return ry.default}}),Object.defineProperty(Dv,"duotoneLight",{enumerable:!0,get:function(){return iy.default}}),Object.defineProperty(Dv,"duotoneSea",{enumerable:!0,get:function(){return oy.default}}),Object.defineProperty(Dv,"duotoneSpace",{enumerable:!0,get:function(){return ay.default}}),Object.defineProperty(Dv,"funky",{enumerable:!0,get:function(){return Uv.default}}),Object.defineProperty(Dv,"ghcolors",{enumerable:!0,get:function(){return sy.default}}),Object.defineProperty(Dv,"gruvboxDark",{enumerable:!0,get:function(){return ly.default}}),Object.defineProperty(Dv,"gruvboxLight",{enumerable:!0,get:function(){return cy.default}}),Object.defineProperty(Dv,"holiTheme",{enumerable:!0,get:function(){return uy.default}}),Object.defineProperty(Dv,"hopscotch",{enumerable:!0,get:function(){return dy.default}}),Object.defineProperty(Dv,"lucario",{enumerable:!0,get:function(){return fy.default}}),Object.defineProperty(Dv,"materialDark",{enumerable:!0,get:function(){return hy.default}}),Object.defineProperty(Dv,"materialLight",{enumerable:!0,get:function(){return py.default}}),Object.defineProperty(Dv,"materialOceanic",{enumerable:!0,get:function(){return my.default}}),Object.defineProperty(Dv,"nightOwl",{enumerable:!0,get:function(){return gy.default}}),Object.defineProperty(Dv,"nord",{enumerable:!0,get:function(){return vy.default}}),Object.defineProperty(Dv,"okaidia",{enumerable:!0,get:function(){return zv.default}}),Object.defineProperty(Dv,"oneDark",{enumerable:!0,get:function(){return yy.default}}),Object.defineProperty(Dv,"oneLight",{enumerable:!0,get:function(){return by.default}}),Object.defineProperty(Dv,"pojoaque",{enumerable:!0,get:function(){return wy.default}}),Object.defineProperty(Dv,"prism",{enumerable:!0,get:function(){return Gv.default}}),Object.defineProperty(Dv,"shadesOfPurple",{enumerable:!0,get:function(){return xy.default}}),Object.defineProperty(Dv,"solarizedDarkAtom",{enumerable:!0,get:function(){return Sy.default}}),Object.defineProperty(Dv,"solarizedlight",{enumerable:!0,get:function(){return Hv.default}}),Object.defineProperty(Dv,"synthwave84",{enumerable:!0,get:function(){return My.default}}),Object.defineProperty(Dv,"tomorrow",{enumerable:!0,get:function(){return Vv.default}}),Object.defineProperty(Dv,"twilight",{enumerable:!0,get:function(){return Wv.default}}),Object.defineProperty(Dv,"vs",{enumerable:!0,get:function(){return _y.default}}),Object.defineProperty(Dv,"vscDarkPlus",{enumerable:!0,get:function(){return Ay.default}}),Object.defineProperty(Dv,"xonokai",{enumerable:!0,get:function(){return Ey.default}}),Object.defineProperty(Dv,"zTouch",{enumerable:!0,get:function(){return Cy.default}});var jv=Bv(a("jcF8U")),Fv=Bv(a("3Tppx")),Uv=Bv(a("dBuK7")),zv=Bv(a("eEjWK")),Hv=Bv(a("awG2g")),Vv=Bv(a("2oFzQ")),Wv=Bv(a("4Au6Q")),Gv=Bv(a("dAPqs")),qv=Bv(a("8eAql")),Kv=Bv(a("cv2QE")),Yv=Bv(a("h5I9g")),Jv=Bv(a("i4C5w")),Qv=Bv(a("3kFKo")),Xv=Bv(a("17zK0")),Zv=Bv(a("5Avqr")),$v=Bv(a("1jHMv")),ey=Bv(a("7Q8CE")),ty=Bv(a("jKUos")),ny=Bv(a("Uzm4J")),ry=Bv(a("7yfkN")),iy=Bv(a("lT2l1")),oy=Bv(a("fZ9um")),ay=Bv(a("1MoQL")),sy=Bv(a("4uys7")),ly=Bv(a("kaYsk")),cy=Bv(a("kN6Vu")),uy=Bv(a("2Z6pG")),dy=Bv(a("4jQJK")),fy=Bv(a("bpXw0")),hy=Bv(a("i4S8s")),py=Bv(a("5bNr4")),my=Bv(a("5ZYWT")),gy=Bv(a("ihJCU")),vy=Bv(a("8iIbg")),yy=Bv(a("424u7")),by=Bv(a("jPiNI")),wy=Bv(a("OHVOA")),xy=Bv(a("2OKTL")),Sy=Bv(a("2Mg8H")),My=Bv(a("9Kud0")),_y=Bv(a("eCrmR")),Ay=Bv(a("8UhcQ")),Ey=Bv(a("dtU9z")),Cy=Bv(a("4xtLO")),ky={};Object.defineProperty(ky,"__esModule",{value:!0}),ky.default=void 0;var Ty=Bv(a("7cTnl")).default;ky.default=Ty;var Iy={};Object.defineProperty(Iy,"__esModule",{value:!0}),Iy.default=void 0;var Oy=Bv(a("l1Rj1")).default;Iy.default=Oy;var Ry={};Object.defineProperty(Ry,"__esModule",{value:!0}),Ry.default=void 0;var Py=Bv(a("fU6a0")).default;Ry.default=Py;var Ny={};Object.defineProperty(Ny,"__esModule",{value:!0}),Ny.default=void 0;var Ly=Bv(a("3aDLI")).default;Ny.default=Ly;var Dy={};Object.defineProperty(Dy,"__esModule",{value:!0}),Dy.default=void 0;var By=Bv(a("kiy5M")).default;Dy.default=By;var jy={};Object.defineProperty(jy,"__esModule",{value:!0}),jy.default=void 0;var Fy=Bv(a("lR39A")).default;jy.default=Fy;var Uy={};Object.defineProperty(Uy,"__esModule",{value:!0}),Uy.default=void 0;var zy=Bv(a("5li5P")).default;Uy.default=zy;var Hy={};Object.defineProperty(Hy,"__esModule",{value:!0}),Hy.default=void 0;var Vy=Bv(a("ch1PX")).default;Hy.default=Vy;var Wy={};Object.defineProperty(Wy,"__esModule",{value:!0}),Wy.default=void 0;var Gy=Bv(a("bnDV9")).default;Wy.default=Gy,Lv.registerLanguage("tsx",r(ky)),Lv.registerLanguage("json",r(Iy)),Lv.registerLanguage("scss",r(Ry)),Lv.registerLanguage("bash",r(Ny)),Lv.registerLanguage("python",r(Dy)),Lv.registerLanguage("cpp",r(jy)),Lv.registerLanguage("php",r(Uy)),Lv.registerLanguage("ruby",r(Hy)),Lv.registerLanguage("sql",r(Wy));var qy=({medium:e,className:t,preview:n=!1})=>{var r,i,o,a;const{t:l}=Te();return(0,s.jsxs)("div",{className:"memori-snippet",children:[(0,s.jsxs)("div",{className:"memori-snippet--content",children:[(0,s.jsx)(Lv,{"aria-labelledby":`#snippet-${e.mediumID}`,className:t,style:Dv.atomDark,showLineNumbers:!0,language:null!==(i=null===(r=Eg.find((t=>e.mimeType===t.mimeType)))||void 0===r?void 0:r.lang)&&void 0!==i?i:"text",children:(null===(o=e.content)||void 0===o?void 0:o.length)&&e.content.length>200&&n?`${e.content.slice(0,200)}\n...`:`${e.content}`}),(0,s.jsx)(Zd,{padded:!1,ghost:!0,className:"memori-snippet--copy-button",title:l("copy")||"Copy",icon:(0,s.jsx)(kg,{}),onClick:()=>{var t;return navigator.clipboard.writeText(null!==(t=e.content)&&void 0!==t?t:"")}})]}),!!(null===(a=e.title)||void 0===a?void 0:a.length)&&(0,s.jsx)("p",{id:`snippet-${e.mediumID}`,className:"memori-snippet--caption",children:e.title})]})};var Ky=({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:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"})});var Yy=({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:"M531.3 574.4l.3-1.4c5.8-23.9 13.1-53.7 7.4-80.7-3.8-21.3-19.5-29.6-32.9-30.2-15.8-.7-29.9 8.3-33.4 21.4-6.6 24-.7 56.8 10.1 98.6-13.6 32.4-35.3 79.5-51.2 107.5-29.6 15.3-69.3 38.9-75.2 68.7-1.2 5.5.2 12.5 3.5 18.8 3.7 7 9.6 12.4 16.5 15 3 1.1 6.6 2 10.8 2 17.6 0 46.1-14.2 84.1-79.4 5.8-1.9 11.8-3.9 17.6-5.9 27.2-9.2 55.4-18.8 80.9-23.1 28.2 15.1 60.3 24.8 82.1 24.8 21.6 0 30.1-12.8 33.3-20.5 5.6-13.5 2.9-30.5-6.2-39.6-13.2-13-45.3-16.4-95.3-10.2-24.6-15-40.7-35.4-52.4-65.8zM421.6 726.3c-13.9 20.2-24.4 30.3-30.1 34.7 6.7-12.3 19.8-25.3 30.1-34.7zm87.6-235.5c5.2 8.9 4.5 35.8.5 49.4-4.9-19.9-5.6-48.1-2.7-51.4.8.1 1.5.7 2.2 2zm-1.6 120.5c10.7 18.5 24.2 34.4 39.1 46.2-21.6 4.9-41.3 13-58.9 20.2-4.2 1.7-8.3 3.4-12.3 5 13.3-24.1 24.4-51.4 32.1-71.4zm155.6 65.5c.1.2.2.5-.4.9h-.2l-.2.3c-.8.5-9 5.3-44.3-8.6 40.6-1.9 45 7.3 45.1 7.4zm191.4-388.2L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"})});var Jy=({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:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0 0 10.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 0 0-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"})});var Qy=({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:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 0 0-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 0 0-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"})});const Xy=({isChild:e=!1,item:t,sessionID:n,tenantID:r,preview:i=!1,baseURL:o,apiURL:a,onClick:l})=>{const c=jm({resourceURI:t.url,sessionID:n,tenantID:r,baseURL:o,apiURL:a});switch(t.mimeType){case"image/jpeg":case"image/png":case"image/jpg":case"image/gif":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,onClick:n=>{e&&n.preventDefault(),l&&(n.preventDefault(),l(t.mediumID))},target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,className:"memori-media-item--card memori-media-item--image",cover:(0,s.jsxs)("picture",{className:"memori-media-item--figure",children:[!i&&(0,s.jsx)("source",{srcSet:[c,t.url,t.content].join(", "),type:t.mimeType}),(0,s.jsx)("img",{alt:t.title,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="}),t.title&&(0,s.jsx)("figcaption",{className:"memori-media-item--figure-caption",children:t.title})]})})});case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)(Qy,{className:"memori-media-item--icon"}),title:t.title})});case"application/vnd.ms-excel":case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)(Jy,{className:"memori-media-item--icon"}),title:t.title})});case"application/pdf":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)(Yy,{className:"memori-media-item--icon"}),title:t.title})});case"video/mp4":case"video/avi":case"video/mpeg":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,onClick:n=>{e&&n.preventDefault(),l&&(n.preventDefault(),l(t.mediumID))},target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)("video",{style:{width:"100%",height:"100%"},controls:!0,src:c,title:t.title}),title:t.title})});case"audio/mpeg3":case"audio/wav":case"audio/mpeg":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)("audio",{style:{width:"100%",height:"100%"},controls:!0,src:c}),title:t.title})});case"model/gltf-binary":return(0,s.jsx)(Cg,{src:c,alt:"",poster:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="});default:return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)(Ky,{className:"memori-media-item--icon"}),title:t.title})})}};var Zy=({items:e,sessionID:t,tenantID:n,translateTo:r,baseURL:i,apiURL:o})=>{const[a,l]=(0,u.useState)(e),[c,d]=(0,u.useState)(),f=(0,u.useCallback)((async()=>{if(!r)return;const t=await Promise.all((null!=e?e:[]).map((async e=>{var t;if(!e.title)return e;try{const n=await Sg(e.title,r);return{...e,title:null!==(t=n.text)&&void 0!==t?t:e.title}}catch(t){return console.error(t),e}})));l(t)}),[r,e]);return(0,u.useEffect)((()=>{r&&f()}),[r,f]),(0,u.useEffect)((()=>{e.filter((e=>{var t;return"text/javascript"===e.mimeType&&!!(null===(t=e.properties)||void 0===t?void 0:t.executable)})).forEach((e=>{var t;try{new Function(null!==(t=e.content)&&void 0!==t?t:"")()}catch(e){console.error(e)}}))}),[]),(0,s.jsxs)(Jf,{appear:!0,show:!0,as:"div",className:"memori-media-items",children:[(0,s.jsx)("div",{className:"memori-media-items--grid",children:a.filter((e=>{var t;return!(null===(t=e.properties)||void 0===t?void 0:t.executable)&&!Eg.map((e=>e.mimeType)).includes(e.mimeType)})).sort(((e,t)=>e.creationTimestamp>t.creationTimestamp?1:e.creationTimestamp<t.creationTimestamp?-1:0)).map(((e,r)=>(0,s.jsx)(Jf.Child,{as:"div",className:"memori-media-item",enter:"ease-out duration-500 delay-"+100*r,enterFrom:"opacity-0 scale-95",enterTo:"opacity-1 scale-100",leave:"ease-in duration-300",leaveFrom:"opacity-1 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsx)(Xy,{isChild:!0,sessionID:t,tenantID:n,baseURL:i,apiURL:o,onClick:e=>{d(a.find((t=>t.mediumID===e)))},item:{...e,title:e.title,url:e.url,content:e.content}})},e.url+"&index="+r)))}),a.filter((e=>{var t;return!(null===(t=e.properties)||void 0===t?void 0:t.executable)&&Eg.map((e=>e.mimeType)).includes(e.mimeType)})).map((e=>(0,s.jsx)(Jf.Child,{as:"div",className:"memori-media-item--snippet",enter:"ease-out duration-500",enterFrom:"opacity-0 translate-y-1",enterTo:"opacity-1 translate-y-0",leave:"ease-in duration-300",leaveFrom:"opacity-1",leaveTo:"opacity-0",children:(0,s.jsx)(qy,{medium:e},e.mediumID)},e.mediumID))),a.filter((e=>{var t;return"text/css"===e.mimeType&&!!(null===(t=e.properties)||void 0===t?void 0:t.executable)})).map((e=>(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:e.content||""}},e.mediumID))),(null==c?void 0:c.mediumID)&&(0,s.jsx)(hp,{width:"100%",widthMd:"100%",className:"memori-media-item--modal",open:!!c,onClose:()=>d(void 0),footer:null,children:(0,s.jsx)(Xy,{isChild:!0,sessionID:t,tenantID:n,baseURL:i,apiURL:o,item:{...c,title:c.title,url:c.url,content:c.content}})})]})};Jd=a("4IUwl");var $y=({hints:e=[],links:t=[],media:n=[],simulateUserPrompt:i=(()=>{}),sessionID:o,baseUrl:a,apiUrl:l,translateTo:c})=>{const{t:d}=Te(),[f,h]=(0,u.useState)(!0),[p,m]=(0,u.useState)(6);return(0,u.useEffect)((()=>{h(!0)}),[e]),(0,s.jsxs)("div",{className:"memori-media-widget",children:[(null==n?void 0:n.length)>0&&(0,s.jsx)(Zy,{items:n,sessionID:o,translateTo:c,baseURL:a,apiURL:l}),(null==t?void 0:t.length)>0&&(0,s.jsx)(wg,{items:t,baseUrl:a}),(null==e?void 0:e.length)>0&&f&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Jf,{appear:!0,show:!0,as:"ul",className:"memori-media--hints",children:e.slice(0,p).map(((e,t)=>(0,s.jsx)(Jf.Child,{as:"li",enter:"ease-out duration-500",enterFrom:"opacity-0 translate-y-1",enterTo:"opacity-1 translate-y-0",leave:"ease-in duration-300",leaveFrom:"opacity-1",leaveTo:"opacity-0",children:(0,s.jsx)(Zd,{className:r(Jd)("memori-media--hint"),primary:!0,onClick:()=>{i(e.originalText,e.text),h(!1)},onTouchEnd:()=>{i(e.originalText,e.text),h(!1)},children:e.text},e.text+t)},e.text+t)))}),e.length>p&&(0,s.jsx)("div",{className:"memori-hints--show-more",children:(0,s.jsx)(Zd,{className:"memori-hints--show-more-button",id:"showMoreHints",onClick:()=>m(p+6),children:d("expand")||"Expand"})})]})]})};Jd=a("4IUwl");var eb=({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:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2zM304 456a88 88 0 1 0 0-176 88 88 0 0 0 0 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z"})});var tb=({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:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0 0 12.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0 0 12.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 0 0 174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"})});var nb=({attachmentsMenuOpen:e,setAttachmentsMenuOpen:t,disabled:n=!1,authToken:i})=>(0,s.jsxs)(lg,{as:"div",className:"memori-upload-menu",children:[(0,s.jsx)(lg.Button,{disabled:n,className:r(Jd)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button","memori--conversation-button"),children:(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)(tb,{})})}),(0,s.jsxs)(lg.Items,{as:"ul",className:"memori-menu--overlay",children:[(0,s.jsx)(lg.Item,{as:"li",className:"memori-menu--li",children:(0,s.jsx)(Zd,{className:"memori-menu--button",ghost:!0,icon:(0,s.jsx)(gg,{}),outlined:"link"===e,onClick:()=>t("link"),children:"Link"})}),!!(null==i?void 0:i.length)&&(0,s.jsx)(lg.Item,{children:(0,s.jsx)(Zd,{className:"memori-menu--button",ghost:!0,icon:(0,s.jsx)(eb,{}),outlined:"media"===e,onClick:()=>t("media"),children:"Media"})})]})]});u=a("85Hg2"),u=a("85Hg2");function rb(e=0){let[t,n]=(0,u.useState)(e),r=(0,u.useCallback)((e=>n((t=>t|e))),[t]),i=(0,u.useCallback)((e=>Boolean(t&e)),[t]),o=(0,u.useCallback)((e=>n((t=>t&~e))),[n]),a=(0,u.useCallback)((e=>n((t=>t^e))),[n]);return{addFlag:r,hasFlag:i,removeFlag:o,toggleFlag:a}}let ib=(0,(u=a("85Hg2")).createContext)(null);function ob(){let e=(0,u.useContext)(ib);if(null===e){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,ob),e}return e}function ab(){let[e,t]=(0,u.useState)([]);return[e.length>0?e.join(" "):void 0,(0,u.useMemo)((()=>function(e){let n=xf((e=>(t((t=>[...t,e])),()=>t((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),i=(0,u.useMemo)((()=>({register:n,slot:e.slot,name:e.name,props:e.props})),[n,e.slot,e.name,e.props]);return r(u).createElement(ib.Provider,{value:i},e.children)}),[t])]}let sb=lf((function(e,t){let{passive:n=!1,...r}=e,i=ob(),o=`headlessui-label-${nh()}`,a=_f(t);gf((()=>i.register(o)),[o,i.register]);let s={ref:a,...i.props,id:o};return n&&("onClick"in s&&delete s.onClick,"onClick"in r&&delete r.onClick),of({ourProps:s,theirProps:r,slot:i.slot||{},defaultTag:"label",name:i.name||"Label"})}));function lb(e={},t=null,n=[]){for(let[r,i]of Object.entries(e))ub(n,cb(t,r),i);return n}function cb(e,t){return e?e+"["+t+"]":t}function ub(e,t,n){if(Array.isArray(n))for(let[r,i]of n.entries())ub(e,cb(t,r.toString()),i);else n instanceof Date?e.push([t,n.toISOString()]):"boolean"==typeof n?e.push([t,n?"1":"0"]):"string"==typeof n?e.push([t,n]):"number"==typeof n?e.push([t,`${n}`]):null==n?e.push([t,""]):lb(n,t,e)}function db(e){var t;let n=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(n)for(let e of n.elements)if("INPUT"===e.tagName&&"submit"===e.type||"BUTTON"===e.tagName&&"submit"===e.type||"INPUT"===e.nodeName&&"image"===e.type)return void e.click()}u=a("85Hg2");function fb(e,t,n){let[r,i]=(0,u.useState)(n),o=void 0!==e,a=(0,u.useRef)(o),s=(0,u.useRef)(!1),l=(0,u.useRef)(!1);return!o||a.current||s.current?!o&&a.current&&!l.current&&(l.current=!0,a.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(s.current=!0,a.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[o?e:r,xf((e=>(o||i(e),null==t?void 0:t(e))))]}var hb,pb=((hb=pb||{})[hb.RegisterOption=0]="RegisterOption",hb[hb.UnregisterOption=1]="UnregisterOption",hb);let mb={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:vh(n,(e=>e.element.current))}},1(e,t){let n=e.options.slice(),r=e.options.findIndex((e=>e.id===t.id));return-1===r?e:(n.splice(r,1),{...e,options:n})}},gb=(0,u.createContext)(null);function vb(e){let t=(0,u.useContext)(gb);if(null===t){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,vb),t}return t}function yb(e,t){return $d(t.type,mb,e,t)}gb.displayName="RadioGroupContext";let bb=lf((function(e,t){let{value:n,defaultValue:i,name:o,onChange:a,by:s=((e,t)=>e===t),disabled:l=!1,...c}=e,d=xf("string"==typeof s?(e,t)=>{let n=s;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:s),[f,h]=(0,u.useReducer)(yb,{options:[]}),p=f.options,[m,g]=ab(),[v,y]=Wh(),b=`headlessui-radiogroup-${nh()}`,w=(0,u.useRef)(null),x=_f(w,t),[S,M]=fb(n,a,i),_=(0,u.useMemo)((()=>p.find((e=>!e.propsRef.current.disabled))),[p]),A=(0,u.useMemo)((()=>p.some((e=>d(e.propsRef.current.value,S)))),[p,S]),E=xf((e=>{var t;if(l||d(e,S))return!1;let n=null==(t=p.find((t=>d(t.propsRef.current.value,e))))?void 0:t.propsRef.current;return(null==n||!n.disabled)&&(null==M||M(e),!0)}));Wm({container:w.current,accept:e=>"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let C=xf((e=>{let t=w.current;if(!t)return;let n=oh(t),r=p.filter((e=>!1===e.propsRef.current.disabled)).map((e=>e.element.current));switch(e.key){case Xf.Enter:db(e.currentTarget);break;case Xf.ArrowLeft:case Xf.ArrowUp:if(e.preventDefault(),e.stopPropagation(),bh(r,lh.Previous|lh.WrapAround)===ch.Success){let e=p.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&E(e.propsRef.current.value)}break;case Xf.ArrowRight:case Xf.ArrowDown:if(e.preventDefault(),e.stopPropagation(),bh(r,lh.Next|lh.WrapAround)===ch.Success){let e=p.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&E(e.propsRef.current.value)}break;case Xf.Space:{e.preventDefault(),e.stopPropagation();let t=p.find((e=>e.element.current===(null==n?void 0:n.activeElement)));t&&E(t.propsRef.current.value)}}})),k=xf((e=>(h({type:0,...e}),()=>h({type:1,id:e.id})))),T=(0,u.useMemo)((()=>({registerOption:k,firstOption:_,containsCheckedOption:A,change:E,disabled:l,value:S,compare:d})),[k,_,A,E,l,S,d]),I={ref:x,id:b,role:"radiogroup","aria-labelledby":m,"aria-describedby":v,onKeyDown:C},O=(0,u.useMemo)((()=>({value:S})),[S]);return r(u).createElement(y,{name:"RadioGroup.Description"},r(u).createElement(g,{name:"RadioGroup.Label"},r(u).createElement(gb.Provider,{value:T},null!=o&&null!=S&&lb({[o]:S}).map((([e,t])=>r(u).createElement(ih,{features:rh.Hidden,...cf({key:e,as:"input",type:"radio",checked:null!=t,hidden:!0,readOnly:!0,name:e,value:t})}))),of({ourProps:I,theirProps:c,slot:O,defaultTag:"div",name:"RadioGroup"}))))}));var wb=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(wb||{});let xb=lf((function(e,t){let n=(0,u.useRef)(null),i=_f(n,t),o=`headlessui-radiogroup-option-${nh()}`,[a,s]=ab(),[l,c]=Wh(),{addFlag:d,removeFlag:f,hasFlag:h}=rb(1),{value:p,disabled:m=!1,...g}=e,v=(0,u.useRef)({value:p,disabled:m});gf((()=>{v.current.value=p}),[p,v]),gf((()=>{v.current.disabled=m}),[m,v]);let{registerOption:y,disabled:b,change:w,firstOption:x,containsCheckedOption:S,value:M,compare:_}=vb("RadioGroup.Option");gf((()=>y({id:o,element:n,propsRef:v})),[o,y,n,e]);let A=xf((e=>{var t;if(Zf(e.currentTarget))return e.preventDefault();!w(p)||(d(2),null==(t=n.current)||t.focus())})),E=xf((e=>{if(Zf(e.currentTarget))return e.preventDefault();d(2)})),C=xf((()=>f(2))),k=(null==x?void 0:x.id)===o,T=b||m,I=_(M,p),O={ref:i,id:o,role:"radio","aria-checked":I?"true":"false","aria-labelledby":a,"aria-describedby":l,"aria-disabled":!!T||void 0,tabIndex:T?-1:I||!S&&k?0:-1,onClick:T?void 0:A,onFocus:T?void 0:E,onBlur:T?void 0:C},R=(0,u.useMemo)((()=>({checked:I,disabled:T,active:h(2)})),[I,T,h]);return r(u).createElement(c,{name:"RadioGroup.Description"},r(u).createElement(s,{name:"RadioGroup.Label"},of({ourProps:O,theirProps:g,slot:R,defaultTag:"div",name:"RadioGroup.Option"})))})),Sb=Object.assign(bb,{Option:xb,Label:sb,Description:Gh});Jd=a("4IUwl");var Mb=({sendOnEnter:e,setSendOnEnter:t})=>{const{t:n}=Te();return(0,s.jsxs)(lg,{as:"div",className:"memori-send-on-enter-menu",children:[(0,s.jsx)(lg.Button,{className:r(Jd)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button","memori--conversation-button"),children:(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)("span",{style:{display:"block",width:"1rem",height:"1rem"},children:"…"})})}),(0,s.jsx)(lg.Items,{className:"memori-menu--overlay",children:(0,s.jsxs)(Sb,{value:e,onChange:t,children:[(0,s.jsx)(Sb.Option,{value:"keypress",className:"memori-menu--option",children:({checked:e})=>(0,s.jsx)(lg.Item,{children:(0,s.jsx)(Zd,{className:"memori-menu--button",ghost:!0,outlined:e,icon:(0,s.jsx)("span",{className:"memori-menu--icon",children:e?"✓":""}),children:n("widget.sendOnKeypress")})})}),(0,s.jsx)(Sb.Option,{value:"click",className:"memori-menu--option",children:({checked:e})=>(0,s.jsx)(lg.Item,{children:(0,s.jsx)(Zd,{className:"memori-menu--button",ghost:!0,outlined:e,icon:(0,s.jsx)("span",{className:"memori-menu--icon",children:e?"✓":""}),children:n("widget.sendOnClick")})})})]})})]})};u=a("85Hg2"),Jd=a("4IUwl");var _b=({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:"M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 0 0 0 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0 0 13.5-4.7L863.9 169a7.9 7.9 0 0 0-8.9-8.9zM416.6 562.3a8.03 8.03 0 0 0-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 0 0-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"})});var Ab=({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:"M391 240.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L200 146.3a8.03 8.03 0 0 0-11.3 0l-42.4 42.3a8.03 8.03 0 0 0 0 11.3L280 333.6l-43.9 43.9a8.01 8.01 0 0 0 4.7 13.6L401 410c5.1.6 9.5-3.7 8.9-8.9L391 240.9zm10.1 373.2L240.8 633c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L146.3 824a8.03 8.03 0 0 0 0 11.3l42.4 42.3c3.1 3.1 8.2 3.1 11.3 0L333.7 744l43.7 43.7A8.01 8.01 0 0 0 391 783l18.9-160.1c.6-5.1-3.7-9.4-8.8-8.8zm221.8-204.2L783.2 391c6.6-.8 9.4-8.9 4.7-13.6L744 333.6 877.7 200c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.3a8.03 8.03 0 0 0-11.3 0L690.3 279.9l-43.7-43.7a8.01 8.01 0 0 0-13.6 4.7L614.1 401c-.6 5.2 3.7 9.5 8.8 8.9zM744 690.4l43.9-43.9a8.01 8.01 0 0 0-4.7-13.6L623 614c-5.1-.6-9.5 3.7-8.9 8.9L633 783.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L824 877.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L744 690.4z"})});var Eb=({disabled:e=!1,value:t,onChange:n,onPressEnter:i,onFocus:o,onBlur:a})=>{const[l,c]=(0,u.useState)(!1);return(0,s.jsx)("div",{"data-testid":"chat-textarea",className:r(Jd)("memori-chat-textarea",{"memori-chat-textarea--expanded":l,"memori-chat-textarea--disabled":e}),children:(0,s.jsxs)("div",{className:"memori-chat-textarea--inner",children:[(0,s.jsx)("textarea",{className:"memori-chat-textarea--input",disabled:e,value:t,onChange:e=>{n(e.target.value)},onKeyDownCapture:e=>{"Enter"===e.key&&!e.shiftKey&&i&&i(e)},onFocus:o,onBlur:a}),(0,s.jsx)("div",{className:"memori-chat-textarea--expand",children:(0,s.jsx)(Zd,{className:r(Jd)("memori-chat-textarea--expand-button"),onClick:()=>c(!l),padded:!1,ghost:!0,icon:l?(0,s.jsx)(Ab,{}):(0,s.jsx)(_b,{})})})]})})};var Cb=({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:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2-8.5 2.1-13.8 10.7-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})});u=a("85Hg2");var kb=({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:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"})});Jd=a("4IUwl");var Tb=({listening:e,stopAudio:t,startListening:n,stopListening:i})=>{const{t:o}=Te(),[a,l]=(0,u.useState)(),c=(0,u.useRef)(null),d=e=>{e.preventDefault(),l(o("write_and_speak.holdToSpeak")||"Hold to record"),c.current||(c.current=setTimeout((()=>{t(),l(o("write_and_speak.releaseToEndListening")||"Release to end listening"),n()}),300))},f=()=>{c.current&&(clearTimeout(c.current),c.current=null),i(),l(void 0)};return(0,u.useEffect)((()=>()=>f()),[]),(0,s.jsx)(zm,{visible:!!a,content:(0,s.jsx)("span",{children:a||o("write_and_speak.pressAndHoldToSpeak")||"Press and hold to speak"}),align:"topLeft",className:"memori-mic-btn-tooltip",children:(0,s.jsx)(Zd,{primary:!0,className:r(Jd)("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":e}),title:e?o("write_and_speak.micButtonPopoverListening")||"Listening":o("write_and_speak.micButtonPopover")||"Start listening",onMouseDown:d,onTouchStart:d,onMouseUp:f,onMouseLeave:f,onTouchEnd:f,shape:"circle",icon:(0,s.jsx)(kb,{})})})};Jd=a("4IUwl");var Ib=({dialogState:e,instruct:t=!1,sendOnEnter:n="click",setSendOnEnter:i,attachmentsMenuOpen:o,setAttachmentsMenuOpen:a,userMessage:l="",onChangeUserMessage:c,sendMessage:u,onTextareaFocus:d,onTextareaBlur:f,onTextareaPressEnter:h,showMicrophone:p=!1,microphoneMode:m="HOLD_TO_TALK",listening:g=!1,stopAudio:v,startListening:y,stopListening:b,authToken:w})=>{const{t:x}=Te();return(0,s.jsxs)("fieldset",{id:"chat-fieldset",className:"memori-chat-inputs",disabled:"X2a"===(null==e?void 0:e.state)||"X3"===(null==e?void 0:e.state),children:[(t||(null==e?void 0:e.acceptsMedia))&&(0,s.jsx)(nb,{attachmentsMenuOpen:o,setAttachmentsMenuOpen:a,authToken:w,disabled:!(null==e?void 0:e.acceptsMedia)}),(0,s.jsx)(Mb,{sendOnEnter:n,setSendOnEnter:i}),(0,s.jsx)(Eb,{value:l,onChange:c,onPressEnter:h,onFocus:d,onBlur:f,disabled:["R2","R3","R4","G3","X3"].includes((null==e?void 0:e.state)||"")}),(0,s.jsx)(Zd,{shape:"circle",primary:!!(null==l?void 0:l.length),disabled:!l||0===l.length,className:"memori-chat-inputs--send",onClick:()=>{u(l),v(),speechSynthesis.speak(new SpeechSynthesisUtterance(""))},title:x("send")||"Send",icon:(0,s.jsx)(Cb,{})}),p&&"HOLD_TO_TALK"===m&&(0,s.jsx)(Tb,{listening:g,startListening:y,stopListening:()=>{b(),(null==l?void 0:l.length)&&u(l)},stopAudio:v}),p&&"CONTINUOUS"===m&&(0,s.jsx)(Zd,{primary:!0,className:r(Jd)("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":g}),title:g?x("write_and_speak.micButtonPopoverListening")||"Listening":x("write_and_speak.micButtonPopover")||"Start listening",onClick:()=>{g?b():(v(),y())},shape:"circle",icon:(0,s.jsx)(kb,{})})]})};var Ob=({memori:e,tenant:t,sessionID:n,baseUrl:i,apiUrl:o,translateTo:a,memoriTyping:l,history:c=[],authToken:d,dialogState:f,simulateUserPrompt:h,showDates:p=!1,showContextPerLine:m=!1,showAIicon:g=!0,selectReceiverTag:v,preview:y=!1,instruct:b=!1,showInputs:w=!0,showMicrophone:x=!1,microphoneMode:S="HOLD_TO_TALK",sendOnEnter:M,setSendOnEnter:_,attachmentsMenuOpen:A,setAttachmentsMenuOpen:E,userMessage:C="",onChangeUserMessage:k,sendMessage:T,listening:I,isPlayingAudio:O,stopAudio:R,startListening:P,stopListening:N,resetTranscript:L})=>{var D,B,j,F,U;const z=()=>{setTimeout((()=>{var e,t,n,r,i;document.body.classList.contains("chat-focused")?(null===(e=document.querySelector(".ant-tabs-nav"))||void 0===e||e.scrollIntoView(),null===(t=document.querySelector(".memori-chat--content"))||void 0===t||t.scrollTo(0,null!==(r=null===(n=document.querySelector(".memori-chat--content"))||void 0===n?void 0:n.scrollHeight)&&void 0!==r?r:0)):null===(i=document.querySelector("#end-messages-ref"))||void 0===i||i.scrollIntoView({behavior:"smooth"})}),200)};(0,u.useEffect)((()=>{!y&&z()}),[c,y]);return(0,s.jsxs)("div",{className:r(Jd)("memori-chat--wrapper",{"memori-chat-wrapper--translate":a}),id:"chat-wrapper",lang:null==a?void 0:a.toUpperCase(),"data-memori-lang":null!==(F=null===(j=null===(B=null===(D=e.culture)||void 0===D?void 0:D.split("-"))||void 0===B?void 0:B[0])||void 0===j?void 0:j.toUpperCase())&&void 0!==F?F:"EN",children:[(0,s.jsx)("div",{className:r(Jd)("memori-chat--history",{"memori-chat--history-touch":Dm()}),children:(0,s.jsxs)("div",{className:r(Jd)("memori-chat--content",{"memori-chat--content-touch":Dm()}),children:[(0,s.jsx)("div",{className:r(Jd)("memori-chat--cover"),style:{backgroundImage:`url("${jm({type:"cover",tenantID:null==t?void 0:t.id,resourceURI:e.coverURL,baseURL:i,apiURL:o})}"), url("${jm({type:"cover",tenantID:null==t?void 0:t.id,baseURL:i||"https://app.twincreator.com",apiURL:o})}")`}}),c.map(((l,d)=>{var v,y,b,w;return(0,s.jsxs)(r(u).Fragment,{children:[(0,s.jsx)(pg,{message:l,memori:e,tenant:t,baseUrl:i,apiUrl:o,simulateUserPrompt:h,showAIicon:g,showFeedback:d===c.length-1&&!l.fromUser&&(null==f?void 0:f.acceptsFeedback)}),p&&!!l.timestamp&&(0,s.jsx)("small",{className:"memori-chat--timestamp "+(l.fromUser?"text-right":"text-left"),children:new Intl.DateTimeFormat("it",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(l.timestamp.endsWith("Z")?l.timestamp:`${l.timestamp}Z`))}),m&&!!Object.keys(null!==(v=l.contextVars)&&void 0!==v?v:{}).length&&(0,s.jsx)("div",{className:"memori-chat--context-vars",children:Object.keys(null!==(y=l.contextVars)&&void 0!==y?y:{}).map((e=>{var t,n,r;return"-"===(null===(t=l.contextVars)||void 0===t?void 0:t[e])?(0,s.jsx)("div",{className:"memori-chat--context-tag memori-chat--context-tag-canceled",children:(0,s.jsx)("span",{className:"memori-chat--context-tag-text",children:e})},e):"✔️"===(null===(n=l.contextVars)||void 0===n?void 0:n[e])?(0,s.jsx)("div",{className:"memori-chat--context-tag",children:(0,s.jsx)("span",{className:"memori-chat--context-tag-text",children:e})},e):(0,s.jsx)("div",{className:"memori-chat--context-tag",children:(0,s.jsxs)("span",{className:"memori-chat--context-tag-text",children:[e,": ",null===(r=l.contextVars)||void 0===r?void 0:r[e]]})},e)}))}),(0,s.jsx)($y,{simulateUserPrompt:h,media:null===(b=null==l?void 0:l.media)||void 0===b?void 0:b.filter((e=>"text/html"!==e.mimeType&&"text/plain"!==e.mimeType)),links:null===(w=null==l?void 0:l.media)||void 0===w?void 0:w.filter((e=>"text/html"===e.mimeType)),sessionID:n,baseUrl:i,apiUrl:o,translateTo:a})]},d)})),l&&(0,s.jsx)("div",{className:"memori-chat--bubble",children:(0,s.jsxs)("div",{id:"wave",children:[(0,s.jsx)("span",{className:"dot"}),(0,s.jsx)("span",{className:"dot"}),(0,s.jsx)("span",{className:"dot"})]})}),(null==f?void 0:f.hints)&&f.hints.length>0&&(0,s.jsx)($y,{simulateUserPrompt:h,hints:f.translatedHints?f.translatedHints:f.hints.map((e=>({text:e,originalText:e})))}),(0,s.jsx)("div",{id:"end-messages-ref"})]})}),"X3"===(null==f?void 0:f.state)&&n&&(0,s.jsx)("div",{className:"memori-chat--known-tags",children:Object.keys(null!==(U=f.knownTags)&&void 0!==U?U:{}).filter((t=>t!==e.giverTag)).map((e=>{var t;return(0,s.jsx)(Zd,{icon:(0,s.jsx)("span",{className:"memori-chat--known-tag-icon",children:e}),className:"memori-chat--known-tag",onClick:()=>v(e),children:null===(t=f.knownTags)||void 0===t?void 0:t[e]},e)}))}),w&&(0,s.jsx)(Ib,{userMessage:C,onChangeUserMessage:k,dialogState:f,instruct:b,authToken:d,sendMessage:T,microphoneMode:S,sendOnEnter:M,setSendOnEnter:_,attachmentsMenuOpen:A,setAttachmentsMenuOpen:E,onTextareaPressEnter:()=>{"keypress"===M&&(null==C?void 0:C.length)>0&&(N(),T(C),k(""),L())},onTextareaFocus:()=>{var e,t;N(),Dm()&&window.innerWidth<=768&&(null===(t=null===(e=document.getElementById("chat-wrapper"))||void 0===e?void 0:e.classList)||void 0===t||t.add("chat-focused"),setTimeout((()=>{z()}),300))},onTextareaBlur:()=>{var e,t,n;(null===(t=null===(e=document.getElementById("chat-wrapper"))||void 0===e?void 0:e.classList)||void 0===t?void 0:t.contains("chat-focused"))&&(null===(n=document.getElementById("chat-wrapper"))||void 0===n||n.classList.remove("chat-focused"),z())},startListening:P,stopListening:N,stopAudio:R,listening:I,isPlayingAudio:O,showMicrophone:x})]})};u=a("85Hg2");var Rb=({className:e,title:t})=>(0,s.jsxs)("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:"M140 188h584v164h76V144c0-17.7-14.3-32-32-32H96c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h544v-76H140V188z"}),(0,s.jsx)("path",{d:"M414.3 256h-60.6c-3.4 0-6.4 2.2-7.6 5.4L219 629.4c-.3.8-.4 1.7-.4 2.6 0 4.4 3.6 8 8 8h55.1c3.4 0 6.4-2.2 7.6-5.4L322 540h196.2L422 261.4c-1.3-3.2-4.3-5.4-7.7-5.4zm12.4 228h-85.5L384 360.2 426.7 484zM936 528H800v-93c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v93H592c-13.3 0-24 10.7-24 24v176c0 13.3 10.7 24 24 24h136v152c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V752h136c13.3 0 24-10.7 24-24V552c0-13.3-10.7-24-24-24zM728 680h-88v-80h88v80zm160 0h-88v-80h88v80z"})]});var Pb=({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:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"})});var Nb=({memoriName:e,blockedUntil:t,showGiverInfo:n=!1,showTitle:r=!1,marginLeft:i=!1})=>{const{t:o}=Te(),a=new Date(t);return a>new Date?(0,s.jsx)(zm,{className:"blocked-memori-badge--tooltip",content:(0,s.jsxs)(s.Fragment,{children:[!n&&o("memoriBlockedAnon",{name:e,date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(a)}),n&&o("memoriBlockedUntil",{date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(a)}),n&&` ${o("memoriBlockedReasonExceedChats")}`,n&&(0,s.jsx)("br",{}),n&&`\n${o("memoriBlockedGiverHelper")}`]}),children:(0,s.jsxs)("div",{className:"blocked-memori-badge--wrapper",children:[(0,s.jsx)("div",{className:"blocked-memori-badge "+(i?" margin-left":""),children:(0,s.jsx)(Pb,{className:"blocked-memori-badge--icon"})}),r&&(0,s.jsx)("span",{className:"blocked-memori-badge--title",children:o("memoriBlockedTitle")})]})}):null};u=a("85Hg2"),Jd=a("4IUwl"),u=a("85Hg2"),u=a("85Hg2");function Lb(e,t){let[n,r]=(0,u.useState)(e),i=yf(e);return gf((()=>r(i.current)),[i,r,...t]),n}var Db=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Db||{}),Bb=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Bb||{}),jb=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(jb||{}),Fb=(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))(Fb||{});function Ub(e,t=(e=>e)){let n=null!==e.activeOptionIndex?e.options[e.activeOptionIndex]:null,r=vh(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 zb={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 $d(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=Ub(e),i=Vm(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=Ub(e,(e=>[...e,n]));if(null===e.activeOptionIndex){let{value:i,mode:o,compare:a}=e.propsRef.current,s=t.dataRef.current.value;$d(o,{1:()=>i.some((e=>a(e,s))),0:()=>a(i,s)})&&(r.activeOptionIndex=r.options.indexOf(n))}return{...e,...r}},8:(e,t)=>{let n=Ub(e,(e=>{let n=e.findIndex((e=>e.id===t.id));return-1!==n&&e.splice(n,1),e}));return{...e,...n,activationTrigger:1}}},Hb=(0,u.createContext)(null);function Vb(e){let t=(0,u.useContext)(Hb);if(null===t){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Vb),t}return t}function Wb(e,t){return $d(t.type,zb,e,t)}Hb.displayName="ListboxContext";let Gb=u.Fragment,qb=lf((function(e,t){let{value:n,defaultValue:i,name:o,onChange:a,by:s=((e,t)=>e===t),disabled:l=!1,horizontal:c=!1,multiple:d=!1,...f}=e;const h=c?"horizontal":"vertical";let p=_f(t),[m,g]=fb(n,a,i),v=(0,u.useReducer)(Wb,{listboxState:1,propsRef:{current:{value:m,onChange:g,mode:d?1:0,compare:xf("string"==typeof s?(e,t)=>{let n=s;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:s)}},labelRef:(0,u.createRef)(),buttonRef:(0,u.createRef)(),optionsRef:(0,u.createRef)(),disabled:l,orientation:h,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1}),[{listboxState:y,propsRef:b,optionsRef:w,buttonRef:x},S]=v;b.current.value=m,b.current.mode=d?1:0,gf((()=>{b.current.onChange=e=>$d(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]),gf((()=>S({type:2,disabled:l})),[l]),gf((()=>S({type:3,orientation:h})),[h]),Qh([x,w],((e,t)=>{var n;S({type:1}),hh(t,fh.Loose)||(e.preventDefault(),null==(n=x.current)||n.focus())}),0===y);let M=(0,u.useMemo)((()=>({open:0===y,disabled:l,value:m})),[y,l,m]),_={ref:p};return r(u).createElement(Hb.Provider,{value:v},r(u).createElement(pf,{value:$d(y,{0:ff.Open,1:ff.Closed})},null!=o&&null!=m&&lb({[o]:m}).map((([e,t])=>r(u).createElement(ih,{features:rh.Hidden,...cf({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:e,value:t})}))),of({ourProps:_,theirProps:f,slot:M,defaultTag:Gb,name:"Listbox"})))})),Kb=lf((function(e,t){var n;let[r,i]=Vb("Listbox.Button"),o=_f(r.buttonRef,t),a=`headlessui-listbox-button-${nh()}`,s=Pf(),l=xf((e=>{switch(e.key){case Xf.Space:case Xf.Enter:case Xf.ArrowDown:e.preventDefault(),i({type:0}),s.nextFrame((()=>{r.propsRef.current.value||i({type:4,focus:Hm.First})}));break;case Xf.ArrowUp:e.preventDefault(),i({type:0}),s.nextFrame((()=>{r.propsRef.current.value||i({type:4,focus:Hm.Last})}))}})),c=xf((e=>{if(e.key===Xf.Space)e.preventDefault()})),d=xf((e=>{if(Zf(e.currentTarget))return e.preventDefault();0===r.listboxState?(i({type:1}),s.nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),i({type:0}))})),f=Lb((()=>{if(r.labelRef.current)return[r.labelRef.current.id,a].join(" ")}),[r.labelRef.current,a]),h=(0,u.useMemo)((()=>({open:0===r.listboxState,disabled:r.disabled,value:r.propsRef.current.value})),[r]),p=e;return of({ourProps:{ref:o,id:a,type:qm(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":f,disabled:r.disabled,onKeyDown:l,onKeyUp:c,onClick:d},theirProps:p,slot:h,defaultTag:"button",name:"Listbox.Button"})})),Yb=lf((function(e,t){let[n]=Vb("Listbox.Label"),r=`headlessui-listbox-label-${nh()}`;return of({ourProps:{ref:_f(n.labelRef,t),id:r,onClick:xf((()=>{var e;return null==(e=n.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))},theirProps:e,slot:(0,u.useMemo)((()=>({open:0===n.listboxState,disabled:n.disabled})),[n]),defaultTag:"label",name:"Listbox.Label"})})),Jb=nf.RenderStrategy|nf.Static,Qb=lf((function(e,t){var n;let[r,i]=Vb("Listbox.Options"),o=_f(r.optionsRef,t),a=`headlessui-listbox-options-${nh()}`,s=Pf(),l=Pf(),c=hf(),d=null!==c?c===ff.Open:0===r.listboxState;(0,u.useEffect)((()=>{var e;let t=r.optionsRef.current;!t||0===r.listboxState&&t!==(null==(e=oh(t))?void 0:e.activeElement)&&t.focus({preventScroll:!0})}),[r.listboxState,r.optionsRef]);let f=xf((e=>{switch(l.dispose(),e.key){case Xf.Space:if(""!==r.searchQuery)return e.preventDefault(),e.stopPropagation(),i({type:5,value:e.key});case Xf.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}),Cf().nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})})));break;case $d(r.orientation,{vertical:Xf.ArrowDown,horizontal:Xf.ArrowRight}):return e.preventDefault(),e.stopPropagation(),i({type:4,focus:Hm.Next});case $d(r.orientation,{vertical:Xf.ArrowUp,horizontal:Xf.ArrowLeft}):return e.preventDefault(),e.stopPropagation(),i({type:4,focus:Hm.Previous});case Xf.Home:case Xf.PageUp:return e.preventDefault(),e.stopPropagation(),i({type:4,focus:Hm.First});case Xf.End:case Xf.PageDown:return e.preventDefault(),e.stopPropagation(),i({type:4,focus:Hm.Last});case Xf.Escape:return e.preventDefault(),e.stopPropagation(),i({type:1}),s.nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case Xf.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(i({type:5,value:e.key}),l.setTimeout((()=>i({type:6})),350))}})),h=Lb((()=>{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]),p=(0,u.useMemo)((()=>({open:0===r.listboxState})),[r]),m=e;return of({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":h,"aria-orientation":r.orientation,id:a,onKeyDown:f,role:"listbox",tabIndex:0,ref:o},theirProps:m,slot:p,defaultTag:"ul",features:Jb,visible:d,name:"Listbox.Options"})})),Xb=lf((function(e,t){let{disabled:n=!1,value:r,...i}=e,[o,a]=Vb("Listbox.Option"),s=`headlessui-listbox-option-${nh()}`,l=null!==o.activeOptionIndex&&o.options[o.activeOptionIndex].id===s,{value:c,compare:d}=o.propsRef.current,f=$d(o.propsRef.current.mode,{1:()=>c.some((e=>d(e,r))),0:()=>d(c,r)}),h=(0,u.useRef)(null),p=_f(t,h);gf((()=>{if(0!==o.listboxState||!l||0===o.activationTrigger)return;let e=Cf();return e.requestAnimationFrame((()=>{var e,t;null==(t=null==(e=h.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})),e.dispose}),[h,l,o.listboxState,o.activationTrigger,o.activeOptionIndex]);let m=(0,u.useRef)({disabled:n,value:r,domRef:h});gf((()=>{m.current.disabled=n}),[m,n]),gf((()=>{m.current.value=r}),[m,r]),gf((()=>{var e,t;m.current.textValue=null==(t=null==(e=h.current)?void 0:e.textContent)?void 0:t.toLowerCase()}),[m,h]);let g=xf((()=>o.propsRef.current.onChange(r)));gf((()=>(a({type:7,id:s,dataRef:m}),()=>a({type:8,id:s}))),[m,s]);let v=xf((e=>{if(n)return e.preventDefault();g(),0===o.propsRef.current.mode&&(a({type:1}),Cf().nextFrame((()=>{var e;return null==(e=o.buttonRef.current)?void 0:e.focus({preventScroll:!0})})))})),y=xf((()=>{if(n)return a({type:4,focus:Hm.Nothing});a({type:4,focus:Hm.Specific,id:s})})),b=xf((()=>{n||l||a({type:4,focus:Hm.Specific,id:s,trigger:0})})),w=xf((()=>{n||!l||a({type:4,focus:Hm.Nothing})})),x=(0,u.useMemo)((()=>({active:l,selected:f,disabled:n})),[l,f,n]);return of({ourProps:{id:s,ref:p,role:"option",tabIndex:!0===n?void 0:-1,"aria-disabled":!0===n||void 0,"aria-selected":f,disabled:void 0,onClick:v,onFocus:y,onPointerMove:b,onMouseMove:b,onPointerLeave:w,onMouseLeave:w},theirProps:i,slot:x,defaultTag:"li",name:"Listbox.Option"})})),Zb=Object.assign(qb,{Button:Kb,Label:Yb,Options:Qb,Option:Xb});var $b=({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"})});var ew=({className:e,value:t,displayValue:n,options:i,onChange:o,disabled:a=!1,label:l,placeholder:c})=>(0,s.jsx)("div",{className:r(Jd)("memori-select",e),children:(0,s.jsxs)(Zb,{value:t,onChange:e=>{o(e)},disabled:a,name:"day",children:[(0,s.jsxs)(Zb.Label,{className:"memori-select--label",children:[l,":"]}),(0,s.jsxs)(Zb.Button,{"aria-label":l,className:"memori-select--button",children:[(0,s.jsx)("span",{className:r(Jd)("memori-select--value",{"memori-select--value-placeholder":!t}),children:t?n||t:c}),(0,s.jsx)("span",{className:"memori-select--icon",children:(0,s.jsx)($b,{})})]}),(0,s.jsx)(Jf,{as:u.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(Zb.Options,{className:"memori-select--options",children:i.map((e=>(0,s.jsx)(Zb.Option,{value:e.value,className:"memori-select--option",children:e.label},e.value)))})})]})});var tw=({memori:e,tenant:t,gamificationLevel:n,language:r,userLang:i,setUserLang:o,baseUrl:a,apiUrl:l,position:c,openPositionDrawer:d,integrationConfig:f,instruct:h=!1,clickedStart:p,onClickStart:m,initializeTTS:g})=>{var v,y,b;const{t:w,i18n:x}=Te(),[S,M]=(0,u.useState)(e.description),[_,A]=(0,u.useState)(!0);return(0,u.useEffect)((()=>{var t,n,i,o,s,l;(null!==(n=null===(t=x.language)||void 0===t?void 0:t.toUpperCase())&&void 0!==n?n:"IT")!==(null!==(i=null==r?void 0:r.toUpperCase())&&void 0!==i?i:"IT")&&(null===(o=e.description)||void 0===o?void 0:o.length)&&Sg(e.description,null!==(l=null===(s=x.language)||void 0===s?void 0:s.toUpperCase())&&void 0!==l?l:"IT",r,a).then((e=>{M(e.text)})).catch(console.error)}),[x.language,r,e.description,a]),(0,s.jsxs)("div",{className:"memori--start-panel",children:[(0,s.jsxs)("div",{className:"memori--cover",style:{backgroundImage:`url("${jm({type:"cover",tenantID:null==t?void 0:t.id,resourceURI:e.coverURL,baseURL:a,apiURL:l})}"), url("${jm({type:"cover",tenantID:null==t?void 0:t.id,baseURL:a,apiURL:l})}")`},children:[!!(null===(v=null==n?void 0:n.badge)||void 0===v?void 0:v.length)&&(0,s.jsx)("div",{className:"memori--gamification-badge",children:(0,s.jsx)(zm,{align:"left",content:`${w("gamification.level")} ${n.badge}, ${n.points} ${w("gamification.points")}`,children:(0,s.jsx)("span",{"aria-label":`${w("gamification.level")} ${n.badge}, ${n.points} ${w("gamification.points")}`,children:n.badge})})}),!!e.enableCompletions&&(0,s.jsx)("div",{className:"memori--completions-enabled",children:(0,s.jsx)(zm,{align:"left",content:w("completionsEnabled"),children:(0,s.jsx)("span",{"aria-label":w("completionsEnabled")||"Completions",children:(0,s.jsx)(Um,{})})})}),!!e.nsfw&&(0,s.jsx)("div",{className:"memori--nsfw",children:(0,s.jsx)(zm,{align:"left",content:w("nsfw"),children:(0,s.jsx)("span",{title:w("nsfw")||"NSFW",children:"🔞"})})})]}),(0,s.jsxs)("picture",{className:"memori--avatar",children:[(0,s.jsx)("source",{src:null!==(y=e.avatarURL)&&void 0!==y?y:jm({type:"avatar",tenantID:null==t?void 0:t.id,resourceURI:e.avatarURL,baseURL:a,apiURL:l})}),(0,s.jsx)("img",{alt:e.name,src:e.avatarURL&&e.avatarURL.length>0?jm({type:"avatar",tenantID:null==t?void 0:t.id,resourceURI:e.avatarURL,baseURL:a,apiURL:l}):jm({type:"avatar",tenantID:null==t?void 0:t.id,baseURL:a,apiURL:l})})]}),(0,s.jsx)("h2",{className:"memori--title",children:e.name}),e.needsPosition&&!c&&(0,s.jsxs)("div",{className:"memori--needsPosition",children:[(0,s.jsx)("p",{children:w("write_and_speak.requirePosition")}),(0,s.jsx)(Zd,{primary:!0,onClick:()=>d(),className:"memori--start-button",children:w("widget.position")})]}),(e.needsPosition&&c||!e.needsPosition)&&(0,s.jsxs)("div",{className:"memori--description",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"memori--description-text",children:S&&_?S:e.description}),S!==e.description&&(0,s.jsx)(Zd,{ghost:!0,className:"memori--translation-toggle",icon:(0,s.jsx)(Rb,{}),onClick:()=>{A((e=>!e))},children:w(_?"showOriginalText":"showTranslatedText")})]}),(null==f?void 0:f.multilanguage)&&!h&&(0,s.jsx)("div",{className:"memori--language-chooser",children:(0,s.jsx)(ew,{label:w("write_and_speak.iWantToTalkToIn",{name:e.name})||void 0,value:(null!=i?i:x.language).toUpperCase(),displayValue:null===(b=Mg.find((e=>e.value.toUpperCase()===(null!=i?i:x.language).toUpperCase())))||void 0===b?void 0:b.label,onChange:o,options:Mg.map((e=>({label:e.label,value:e.value.toUpperCase()})))})}),(0,s.jsx)(Zd,{primary:!0,disabled:!!e.blockedUntil&&!e.isGiver,loading:p,onClick:e=>{speechSynthesis.speak(new SpeechSynthesisUtterance("")),g&&g(),m&&m()},className:"memori--start-button",children:w("write_and_speak."+(h?"instructButton":"tryMeButton"))}),(0,s.jsx)("p",{className:"memori--start-description",children:w(h?"write_and_speak.pageInstructExplanation":"write_and_speak.pageTryMeExplanation")}),!!e.blockedUntil&&(0,s.jsx)(Nb,{memoriName:e.name,blockedUntil:e.blockedUntil,showGiverInfo:e.isGiver,showTitle:!0,marginLeft:!0})]})]})},nw=(u=a("85Hg2"),u=a("85Hg2"),{}),rw={};(rw=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}).__esModule=!0,rw.default=rw,(nw=function(e,t){if(null==e)return{};var n,r,i=rw(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}).__esModule=!0,nw.default=nw;u=a("85Hg2");var iw=["forwardedRef"];function ow(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 aw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ow(Object(n),!0).forEach((function(t){r(X)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ow(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}class sw extends u.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){console.error("Uncaught error:",e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,s.jsxs)("div",{style:{background:"rgba(255, 255, 255, 0.4)",color:"#000",padding:"2rem",borderRadius:"10px"},children:[(0,s.jsx)("h2",{children:this.props.t("error.generic")}),(0,s.jsx)(Zd,{primary:!0,onClick:()=>this.setState({hasError:!1}),children:this.props.t("error.tryAgain")||"Try again"})]}):this.props.children}}var lw=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){function i(i){var o=i.forwardedRef,a=r(nw)(i,iw),s=Te(e,aw(aw({},a),{},{keyPrefix:t.keyPrefix})),l=r(G)(s,3),c=l[0],d=l[1],f=l[2],h=aw(aw({},a),{},{t:c,i18n:d,tReady:f});return t.withRef&&o?h.ref=o:!t.withRef&&o&&(h.forwardedRef=o),(0,u.createElement)(n,h)}i.displayName="withI18nextTranslation(".concat(Ae(n),")"),i.WrappedComponent=n;return t.withRef?(0,u.forwardRef)((function(e,t){return(0,u.createElement)(i,Object.assign({},e,{forwardedRef:t}))})):i}}(["common"])(sw),cw=(u=a("85Hg2"),u=a("85Hg2"),{});e(cw,"REVISION",(()=>uw)),e(cw,"MOUSE",(()=>dw)),e(cw,"TOUCH",(()=>fw)),e(cw,"CullFaceNone",(()=>hw)),e(cw,"CullFaceBack",(()=>pw)),e(cw,"CullFaceFront",(()=>mw)),e(cw,"CullFaceFrontBack",(()=>gw)),e(cw,"BasicShadowMap",(()=>vw)),e(cw,"PCFShadowMap",(()=>yw)),e(cw,"PCFSoftShadowMap",(()=>bw)),e(cw,"VSMShadowMap",(()=>ww)),e(cw,"FrontSide",(()=>xw)),e(cw,"BackSide",(()=>Sw)),e(cw,"DoubleSide",(()=>Mw)),e(cw,"NoBlending",(()=>_w)),e(cw,"NormalBlending",(()=>Aw)),e(cw,"AdditiveBlending",(()=>Ew)),e(cw,"SubtractiveBlending",(()=>Cw)),e(cw,"MultiplyBlending",(()=>kw)),e(cw,"CustomBlending",(()=>Tw)),e(cw,"AddEquation",(()=>Iw)),e(cw,"SubtractEquation",(()=>Ow)),e(cw,"ReverseSubtractEquation",(()=>Rw)),e(cw,"MinEquation",(()=>Pw)),e(cw,"MaxEquation",(()=>Nw)),e(cw,"ZeroFactor",(()=>Lw)),e(cw,"OneFactor",(()=>Dw)),e(cw,"SrcColorFactor",(()=>Bw)),e(cw,"OneMinusSrcColorFactor",(()=>jw)),e(cw,"SrcAlphaFactor",(()=>Fw)),e(cw,"OneMinusSrcAlphaFactor",(()=>Uw)),e(cw,"DstAlphaFactor",(()=>zw)),e(cw,"OneMinusDstAlphaFactor",(()=>Hw)),e(cw,"DstColorFactor",(()=>Vw)),e(cw,"OneMinusDstColorFactor",(()=>Ww)),e(cw,"SrcAlphaSaturateFactor",(()=>Gw)),e(cw,"NeverDepth",(()=>qw)),e(cw,"AlwaysDepth",(()=>Kw)),e(cw,"LessDepth",(()=>Yw)),e(cw,"LessEqualDepth",(()=>Jw)),e(cw,"EqualDepth",(()=>Qw)),e(cw,"GreaterEqualDepth",(()=>Xw)),e(cw,"GreaterDepth",(()=>Zw)),e(cw,"NotEqualDepth",(()=>$w)),e(cw,"MultiplyOperation",(()=>ex)),e(cw,"MixOperation",(()=>tx)),e(cw,"AddOperation",(()=>nx)),e(cw,"NoToneMapping",(()=>rx)),e(cw,"LinearToneMapping",(()=>ix)),e(cw,"ReinhardToneMapping",(()=>ox)),e(cw,"CineonToneMapping",(()=>ax)),e(cw,"ACESFilmicToneMapping",(()=>sx)),e(cw,"CustomToneMapping",(()=>lx)),e(cw,"UVMapping",(()=>cx)),e(cw,"CubeReflectionMapping",(()=>ux)),e(cw,"CubeRefractionMapping",(()=>dx)),e(cw,"EquirectangularReflectionMapping",(()=>fx)),e(cw,"EquirectangularRefractionMapping",(()=>hx)),e(cw,"CubeUVReflectionMapping",(()=>px)),e(cw,"RepeatWrapping",(()=>mx)),e(cw,"ClampToEdgeWrapping",(()=>gx)),e(cw,"MirroredRepeatWrapping",(()=>vx)),e(cw,"NearestFilter",(()=>yx)),e(cw,"NearestMipmapNearestFilter",(()=>bx)),e(cw,"NearestMipMapNearestFilter",(()=>wx)),e(cw,"NearestMipmapLinearFilter",(()=>xx)),e(cw,"NearestMipMapLinearFilter",(()=>Sx)),e(cw,"LinearFilter",(()=>Mx)),e(cw,"LinearMipmapNearestFilter",(()=>_x)),e(cw,"LinearMipMapNearestFilter",(()=>Ax)),e(cw,"LinearMipmapLinearFilter",(()=>Ex)),e(cw,"LinearMipMapLinearFilter",(()=>Cx)),e(cw,"UnsignedByteType",(()=>kx)),e(cw,"ByteType",(()=>Tx)),e(cw,"ShortType",(()=>Ix)),e(cw,"UnsignedShortType",(()=>Ox)),e(cw,"IntType",(()=>Rx)),e(cw,"UnsignedIntType",(()=>Px)),e(cw,"FloatType",(()=>Nx)),e(cw,"HalfFloatType",(()=>Lx)),e(cw,"UnsignedShort4444Type",(()=>Dx)),e(cw,"UnsignedShort5551Type",(()=>Bx)),e(cw,"UnsignedInt248Type",(()=>jx)),e(cw,"AlphaFormat",(()=>Fx)),e(cw,"RGBFormat",(()=>Ux)),e(cw,"RGBAFormat",(()=>zx)),e(cw,"LuminanceFormat",(()=>Hx)),e(cw,"LuminanceAlphaFormat",(()=>Vx)),e(cw,"DepthFormat",(()=>Wx)),e(cw,"DepthStencilFormat",(()=>Gx)),e(cw,"RedFormat",(()=>qx)),e(cw,"RedIntegerFormat",(()=>Kx)),e(cw,"RGFormat",(()=>Yx)),e(cw,"RGIntegerFormat",(()=>Jx)),e(cw,"RGBAIntegerFormat",(()=>Qx)),e(cw,"RGB_S3TC_DXT1_Format",(()=>Xx)),e(cw,"RGBA_S3TC_DXT1_Format",(()=>Zx)),e(cw,"RGBA_S3TC_DXT3_Format",(()=>$x)),e(cw,"RGBA_S3TC_DXT5_Format",(()=>eS)),e(cw,"RGB_PVRTC_4BPPV1_Format",(()=>tS)),e(cw,"RGB_PVRTC_2BPPV1_Format",(()=>nS)),e(cw,"RGBA_PVRTC_4BPPV1_Format",(()=>rS)),e(cw,"RGBA_PVRTC_2BPPV1_Format",(()=>iS)),e(cw,"RGB_ETC1_Format",(()=>oS)),e(cw,"RGB_ETC2_Format",(()=>aS)),e(cw,"RGBA_ETC2_EAC_Format",(()=>sS)),e(cw,"RGBA_ASTC_4x4_Format",(()=>lS)),e(cw,"RGBA_ASTC_5x4_Format",(()=>cS)),e(cw,"RGBA_ASTC_5x5_Format",(()=>uS)),e(cw,"RGBA_ASTC_6x5_Format",(()=>dS)),e(cw,"RGBA_ASTC_6x6_Format",(()=>fS)),e(cw,"RGBA_ASTC_8x5_Format",(()=>hS)),e(cw,"RGBA_ASTC_8x6_Format",(()=>pS)),e(cw,"RGBA_ASTC_8x8_Format",(()=>mS)),e(cw,"RGBA_ASTC_10x5_Format",(()=>gS)),e(cw,"RGBA_ASTC_10x6_Format",(()=>vS)),e(cw,"RGBA_ASTC_10x8_Format",(()=>yS)),e(cw,"RGBA_ASTC_10x10_Format",(()=>bS)),e(cw,"RGBA_ASTC_12x10_Format",(()=>wS)),e(cw,"RGBA_ASTC_12x12_Format",(()=>xS)),e(cw,"RGBA_BPTC_Format",(()=>SS)),e(cw,"LoopOnce",(()=>MS)),e(cw,"LoopRepeat",(()=>_S)),e(cw,"LoopPingPong",(()=>AS)),e(cw,"InterpolateDiscrete",(()=>ES)),e(cw,"InterpolateLinear",(()=>CS)),e(cw,"InterpolateSmooth",(()=>kS)),e(cw,"ZeroCurvatureEnding",(()=>TS)),e(cw,"ZeroSlopeEnding",(()=>IS)),e(cw,"WrapAroundEnding",(()=>OS)),e(cw,"NormalAnimationBlendMode",(()=>RS)),e(cw,"AdditiveAnimationBlendMode",(()=>PS)),e(cw,"TrianglesDrawMode",(()=>NS)),e(cw,"TriangleStripDrawMode",(()=>LS)),e(cw,"TriangleFanDrawMode",(()=>DS)),e(cw,"LinearEncoding",(()=>BS)),e(cw,"sRGBEncoding",(()=>jS)),e(cw,"BasicDepthPacking",(()=>FS)),e(cw,"RGBADepthPacking",(()=>US)),e(cw,"TangentSpaceNormalMap",(()=>zS)),e(cw,"ObjectSpaceNormalMap",(()=>HS)),e(cw,"NoColorSpace",(()=>VS)),e(cw,"SRGBColorSpace",(()=>WS)),e(cw,"LinearSRGBColorSpace",(()=>GS)),e(cw,"ZeroStencilOp",(()=>qS)),e(cw,"KeepStencilOp",(()=>KS)),e(cw,"ReplaceStencilOp",(()=>YS)),e(cw,"IncrementStencilOp",(()=>JS)),e(cw,"DecrementStencilOp",(()=>QS)),e(cw,"IncrementWrapStencilOp",(()=>XS)),e(cw,"DecrementWrapStencilOp",(()=>ZS)),e(cw,"InvertStencilOp",(()=>$S)),e(cw,"NeverStencilFunc",(()=>eM)),e(cw,"LessStencilFunc",(()=>tM)),e(cw,"EqualStencilFunc",(()=>nM)),e(cw,"LessEqualStencilFunc",(()=>rM)),e(cw,"GreaterStencilFunc",(()=>iM)),e(cw,"NotEqualStencilFunc",(()=>oM)),e(cw,"GreaterEqualStencilFunc",(()=>aM)),e(cw,"AlwaysStencilFunc",(()=>sM)),e(cw,"StaticDrawUsage",(()=>lM)),e(cw,"DynamicDrawUsage",(()=>cM)),e(cw,"StreamDrawUsage",(()=>uM)),e(cw,"StaticReadUsage",(()=>dM)),e(cw,"DynamicReadUsage",(()=>fM)),e(cw,"StreamReadUsage",(()=>hM)),e(cw,"StaticCopyUsage",(()=>pM)),e(cw,"DynamicCopyUsage",(()=>mM)),e(cw,"StreamCopyUsage",(()=>gM)),e(cw,"GLSL1",(()=>vM)),e(cw,"GLSL3",(()=>yM)),e(cw,"_SRGBAFormat",(()=>bM)),e(cw,"EventDispatcher",(()=>wM)),e(cw,"MathUtils",(()=>NM)),e(cw,"Vector2",(()=>LM)),e(cw,"Matrix3",(()=>DM)),e(cw,"ColorManagement",(()=>WM)),e(cw,"Color",(()=>XM)),e(cw,"ImageUtils",(()=>$M)),e(cw,"Source",(()=>e_)),e(cw,"Texture",(()=>r_)),e(cw,"Vector4",(()=>i_)),e(cw,"WebGLRenderTarget",(()=>o_)),e(cw,"DataArrayTexture",(()=>a_)),e(cw,"WebGLArrayRenderTarget",(()=>s_)),e(cw,"Data3DTexture",(()=>l_)),e(cw,"WebGL3DRenderTarget",(()=>c_)),e(cw,"WebGLMultipleRenderTargets",(()=>u_)),e(cw,"Quaternion",(()=>d_)),e(cw,"Vector3",(()=>f_)),e(cw,"Box3",(()=>m_)),e(cw,"Sphere",(()=>N_)),e(cw,"Ray",(()=>H_)),e(cw,"Matrix4",(()=>V_)),e(cw,"Euler",(()=>$_)),e(cw,"Layers",(()=>eA)),e(cw,"Object3D",(()=>pA)),e(cw,"Triangle",(()=>AA)),e(cw,"Material",(()=>CA)),e(cw,"MeshBasicMaterial",(()=>kA)),e(cw,"BufferAttribute",(()=>OA)),e(cw,"Int8BufferAttribute",(()=>RA)),e(cw,"Uint8BufferAttribute",(()=>PA)),e(cw,"Uint8ClampedBufferAttribute",(()=>NA)),e(cw,"Int16BufferAttribute",(()=>LA)),e(cw,"Uint16BufferAttribute",(()=>DA)),e(cw,"Int32BufferAttribute",(()=>BA)),e(cw,"Uint32BufferAttribute",(()=>jA)),e(cw,"Float16BufferAttribute",(()=>FA)),e(cw,"Float32BufferAttribute",(()=>UA)),e(cw,"Float64BufferAttribute",(()=>zA)),e(cw,"BufferGeometry",(()=>JA)),e(cw,"Mesh",(()=>hE)),e(cw,"BoxGeometry",(()=>mE)),e(cw,"UniformsUtils",(()=>yE)),e(cw,"ShaderMaterial",(()=>bE)),e(cw,"Camera",(()=>wE)),e(cw,"PerspectiveCamera",(()=>xE)),e(cw,"CubeCamera",(()=>ME)),e(cw,"CubeTexture",(()=>_E)),e(cw,"WebGLCubeRenderTarget",(()=>AE)),e(cw,"Plane",(()=>TE)),e(cw,"Frustum",(()=>RE)),e(cw,"PlaneGeometry",(()=>LE)),e(cw,"ShaderChunk",(()=>DE)),e(cw,"UniformsLib",(()=>BE)),e(cw,"ShaderLib",(()=>jE)),e(cw,"OrthographicCamera",(()=>GE)),e(cw,"PMREMGenerator",(()=>eC)),e(cw,"MeshDepthMaterial",(()=>Qk)),e(cw,"MeshDistanceMaterial",(()=>Xk)),e(cw,"WebGLUtils",(()=>tT)),e(cw,"ArrayCamera",(()=>nT)),e(cw,"Group",(()=>rT)),e(cw,"DepthTexture",(()=>aT)),e(cw,"WebGLRenderer",(()=>uT)),e(cw,"WebGL1Renderer",(()=>dT)),e(cw,"FogExp2",(()=>fT)),e(cw,"Fog",(()=>hT)),e(cw,"Scene",(()=>pT)),e(cw,"InterleavedBuffer",(()=>mT)),e(cw,"InterleavedBufferAttribute",(()=>vT)),e(cw,"SpriteMaterial",(()=>yT)),e(cw,"Sprite",(()=>RT)),e(cw,"LOD",(()=>DT)),e(cw,"SkinnedMesh",(()=>HT)),e(cw,"Bone",(()=>VT)),e(cw,"DataTexture",(()=>WT)),e(cw,"Skeleton",(()=>KT)),e(cw,"InstancedBufferAttribute",(()=>YT)),e(cw,"InstancedMesh",(()=>$T)),e(cw,"LineBasicMaterial",(()=>eI)),e(cw,"Line",(()=>aI)),e(cw,"LineSegments",(()=>cI)),e(cw,"LineLoop",(()=>uI)),e(cw,"PointsMaterial",(()=>dI)),e(cw,"Points",(()=>gI)),e(cw,"VideoTexture",(()=>yI)),e(cw,"FramebufferTexture",(()=>bI)),e(cw,"CompressedTexture",(()=>wI)),e(cw,"CanvasTexture",(()=>xI)),e(cw,"Curve",(()=>SI)),e(cw,"EllipseCurve",(()=>MI)),e(cw,"ArcCurve",(()=>_I)),e(cw,"CatmullRomCurve3",(()=>II)),e(cw,"CubicBezierCurve",(()=>NI)),e(cw,"CubicBezierCurve3",(()=>LI)),e(cw,"LineCurve",(()=>DI)),e(cw,"LineCurve3",(()=>BI)),e(cw,"QuadraticBezierCurve",(()=>jI)),e(cw,"QuadraticBezierCurve3",(()=>FI)),e(cw,"SplineCurve",(()=>UI)),e(cw,"CurvePath",(()=>HI)),e(cw,"Path",(()=>VI)),e(cw,"LatheGeometry",(()=>WI)),e(cw,"CapsuleGeometry",(()=>GI)),e(cw,"CircleGeometry",(()=>qI)),e(cw,"CylinderGeometry",(()=>KI)),e(cw,"ConeGeometry",(()=>YI)),e(cw,"PolyhedronGeometry",(()=>JI)),e(cw,"DodecahedronGeometry",(()=>QI)),e(cw,"EdgesGeometry",(()=>tO)),e(cw,"Shape",(()=>nO)),e(cw,"ShapeUtils",(()=>kO)),e(cw,"ExtrudeGeometry",(()=>OO)),e(cw,"IcosahedronGeometry",(()=>PO)),e(cw,"OctahedronGeometry",(()=>NO)),e(cw,"RingGeometry",(()=>LO)),e(cw,"ShapeGeometry",(()=>DO)),e(cw,"SphereGeometry",(()=>BO)),e(cw,"TetrahedronGeometry",(()=>jO)),e(cw,"TorusGeometry",(()=>FO)),e(cw,"TorusKnotGeometry",(()=>UO)),e(cw,"TubeGeometry",(()=>zO)),e(cw,"WireframeGeometry",(()=>HO)),e(cw,"ShadowMaterial",(()=>GO)),e(cw,"RawShaderMaterial",(()=>qO)),e(cw,"MeshStandardMaterial",(()=>KO)),e(cw,"MeshPhysicalMaterial",(()=>YO)),e(cw,"MeshPhongMaterial",(()=>JO)),e(cw,"MeshToonMaterial",(()=>QO)),e(cw,"MeshNormalMaterial",(()=>XO)),e(cw,"MeshLambertMaterial",(()=>ZO)),e(cw,"MeshMatcapMaterial",(()=>$O)),e(cw,"LineDashedMaterial",(()=>eR)),e(cw,"AnimationUtils",(()=>sR)),e(cw,"Interpolant",(()=>lR)),e(cw,"CubicInterpolant",(()=>cR)),e(cw,"LinearInterpolant",(()=>uR)),e(cw,"DiscreteInterpolant",(()=>dR)),e(cw,"KeyframeTrack",(()=>fR)),e(cw,"BooleanKeyframeTrack",(()=>hR)),e(cw,"ColorKeyframeTrack",(()=>pR)),e(cw,"NumberKeyframeTrack",(()=>mR)),e(cw,"QuaternionLinearInterpolant",(()=>gR)),e(cw,"QuaternionKeyframeTrack",(()=>vR)),e(cw,"StringKeyframeTrack",(()=>yR)),e(cw,"VectorKeyframeTrack",(()=>bR)),e(cw,"AnimationClip",(()=>wR)),e(cw,"Cache",(()=>SR)),e(cw,"LoadingManager",(()=>MR)),e(cw,"DefaultLoadingManager",(()=>_R)),e(cw,"Loader",(()=>AR)),e(cw,"FileLoader",(()=>kR)),e(cw,"AnimationLoader",(()=>TR)),e(cw,"CompressedTextureLoader",(()=>IR)),e(cw,"ImageLoader",(()=>OR)),e(cw,"CubeTextureLoader",(()=>RR)),e(cw,"DataTextureLoader",(()=>PR)),e(cw,"TextureLoader",(()=>NR)),e(cw,"Light",(()=>LR)),e(cw,"HemisphereLight",(()=>DR)),e(cw,"SpotLight",(()=>HR)),e(cw,"PointLight",(()=>KR)),e(cw,"DirectionalLight",(()=>JR)),e(cw,"AmbientLight",(()=>QR)),e(cw,"RectAreaLight",(()=>XR)),e(cw,"SphericalHarmonics3",(()=>ZR)),e(cw,"LightProbe",(()=>$R)),e(cw,"MaterialLoader",(()=>eP)),e(cw,"LoaderUtils",(()=>tP)),e(cw,"InstancedBufferGeometry",(()=>nP)),e(cw,"BufferGeometryLoader",(()=>rP)),e(cw,"ObjectLoader",(()=>iP)),e(cw,"ImageBitmapLoader",(()=>lP)),e(cw,"AudioContext",(()=>uP)),e(cw,"AudioLoader",(()=>dP)),e(cw,"HemisphereLightProbe",(()=>fP)),e(cw,"AmbientLightProbe",(()=>hP)),e(cw,"StereoCamera",(()=>vP)),e(cw,"Clock",(()=>yP)),e(cw,"AudioListener",(()=>_P)),e(cw,"Audio",(()=>AP)),e(cw,"PositionalAudio",(()=>IP)),e(cw,"AudioAnalyser",(()=>OP)),e(cw,"PropertyMixer",(()=>RP)),e(cw,"PropertyBinding",(()=>FP)),e(cw,"AnimationObjectGroup",(()=>UP)),e(cw,"AnimationMixer",(()=>VP)),e(cw,"Uniform",(()=>WP)),e(cw,"UniformsGroup",(()=>qP)),e(cw,"InstancedInterleavedBuffer",(()=>KP)),e(cw,"GLBufferAttribute",(()=>YP)),e(cw,"Raycaster",(()=>JP)),e(cw,"Spherical",(()=>ZP)),e(cw,"Cylindrical",(()=>$P)),e(cw,"Box2",(()=>tN)),e(cw,"Line3",(()=>iN)),e(cw,"SpotLightHelper",(()=>aN)),e(cw,"SkeletonHelper",(()=>uN)),e(cw,"PointLightHelper",(()=>fN)),e(cw,"HemisphereLightHelper",(()=>gN)),e(cw,"GridHelper",(()=>vN)),e(cw,"PolarGridHelper",(()=>yN)),e(cw,"DirectionalLightHelper",(()=>SN)),e(cw,"CameraHelper",(()=>AN)),e(cw,"BoxHelper",(()=>kN)),e(cw,"Box3Helper",(()=>TN)),e(cw,"PlaneHelper",(()=>IN)),e(cw,"ArrowHelper",(()=>NN)),e(cw,"AxesHelper",(()=>LN)),e(cw,"ShapePath",(()=>DN)),e(cw,"DataUtils",(()=>FN)),e(cw,"ImmediateRenderObject",(()=>UN)),e(cw,"WebGLMultisampleRenderTarget",(()=>zN)),e(cw,"DataTexture2DArray",(()=>HN)),e(cw,"DataTexture3D",(()=>VN)),e(cw,"BoxBufferGeometry",(()=>WN)),e(cw,"CapsuleBufferGeometry",(()=>GN)),e(cw,"CircleBufferGeometry",(()=>qN)),e(cw,"ConeBufferGeometry",(()=>KN)),e(cw,"CylinderBufferGeometry",(()=>YN)),e(cw,"DodecahedronBufferGeometry",(()=>JN)),e(cw,"ExtrudeBufferGeometry",(()=>QN)),e(cw,"IcosahedronBufferGeometry",(()=>XN)),e(cw,"LatheBufferGeometry",(()=>ZN)),e(cw,"OctahedronBufferGeometry",(()=>$N)),e(cw,"PlaneBufferGeometry",(()=>eL)),e(cw,"PolyhedronBufferGeometry",(()=>tL)),e(cw,"RingBufferGeometry",(()=>nL)),e(cw,"ShapeBufferGeometry",(()=>rL)),e(cw,"SphereBufferGeometry",(()=>iL)),e(cw,"TetrahedronBufferGeometry",(()=>oL)),e(cw,"TorusBufferGeometry",(()=>aL)),e(cw,"TorusKnotBufferGeometry",(()=>sL)),e(cw,"TubeBufferGeometry",(()=>lL));
97
+ r.version="2.29.4",i(Jn),r.fn=lo,r.min=$n,r.max=er,r.now=tr,r.utc=p,r.unix=co,r.months=vo,r.isDate=d,r.locale=mn,r.invalid=y,r.duration=kr,r.isMoment=M,r.weekdays=bo,r.parseZone=uo,r.localeData=yn,r.isDuration=sr,r.monthsShort=yo,r.weekdaysMin=xo,r.defineLocale=gn,r.updateLocale=vn,r.locales=bn,r.weekdaysShort=wo,r.normalizeUnits=re,r.relativeTimeRounding=ia,r.relativeTimeThreshold=oa,r.calendarFormat=zr,r.prototype=lo,r.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},r}()})),a("juxiN").register(JSON.parse('{"adfgW":"index.js","cmazm":"abap.bc6c1a94.js","jPTA1":"abnf.a3fdbafa.js","jdWNC":"actionscript.59d9b9ea.js","2CBqg":"ada.7ae8a3a8.js","3wHhO":"agda.c22a72e2.js","kFVdl":"al.43edf93f.js","3V4RR":"antlr4.fab93bd9.js","ksX9L":"apacheconf.1ea6f6bc.js","3N81M":"apex.5f5d0b00.js","lBh32":"apl.f0e0255a.js","1cOI2":"applescript.f8873ad2.js","hwV5I":"aql.0596cd74.js","cxQUy":"arduino.8a10351d.js","h8XDs":"arff.b6eba224.js","1glOK":"asciidoc.3591554e.js","5YI5Q":"asm6502.eb3baf93.js","5aM2c":"asmatmel.93b67168.js","aKcNk":"aspnet.a154be94.js","bYGuI":"csharp.60bc2788.js","4ffJ6":"autohotkey.dc99c6b5.js","6o8gr":"autoit.7bd54007.js","d0QlI":"avisynth.506bbdad.js","1vpfH":"avro-idl.ab78e3d7.js","d78C2":"basic.09310972.js","1V5ou":"batch.5c48c918.js","h9qnw":"bbcode.4e0cb2f2.js","eluAn":"bicep.e394696d.js","jD2Yh":"birb.54766d79.js","3ligT":"bison.2c2552ab.js","cSnAi":"bnf.ec556d42.js","gmloY":"brainfuck.4e81eb1d.js","77rtQ":"brightscript.3c7cc723.js","hfFki":"bro.8db28f8a.js","8SYqo":"bsl.260fabfb.js","i4HkI":"cfscript.92c90b90.js","1rBYK":"chaiscript.76481f4b.js","gQYEz":"cil.622792d1.js","bq2uf":"clike.36346267.js","h7tza":"clojure.9da4900e.js","aK2oY":"cmake.234b57e3.js","3V5TZ":"cobol.2e8bd2ea.js","72v5N":"coffeescript.261b318a.js","lNJYg":"concurnas.9d189a8c.js","cHo4f":"coq.917e2a53.js","7GKmU":"crystal.d23925f3.js","a5f4n":"cshtml.92086949.js","2nOzn":"csp.9b5dd573.js","iZH8k":"css-extras.7f3088a6.js","3V9km":"css.fb6f00e3.js","7TCh4":"csv.06af3522.js","8MqYl":"cypher.6af6e534.js","6Oo3A":"d.303192e5.js","6ks0D":"dart.6fb62874.js","huqsT":"dataweave.e97ef31d.js","YtcLG":"dax.013d5e9a.js","1s9Hz":"dhall.d5ee83ba.js","b677V":"diff.9ef56ea8.js","ak2pO":"django.13b0bb49.js","8LDFZ":"dns-zone-file.189b08c5.js","1awLf":"docker.1da9769e.js","9dPYr":"dot.8dca92f3.js","e2ZjS":"ebnf.58c0fa63.js","9h8KW":"editorconfig.9c7b63a5.js","4SWgd":"eiffel.090bab86.js","6HmuU":"ejs.0ee535c3.js","2KAkF":"elixir.dc192ee6.js","jPV3v":"elm.c88782bd.js","agNrQ":"erb.55ec7cf0.js","9BmS2":"erlang.956455fa.js","fqf1c":"etlua.79f6dba5.js","cgMSr":"lua.88c0a077.js","92McF":"excel-formula.d0dd1424.js","juFxG":"factor.e311ca38.js","1dWPh":"false.a93fe44c.js","2k0b2":"firestore-security-rules.4ea155d7.js","dvL1Q":"flow.96e0f48a.js","5oumN":"fortran.0811bc79.js","fP8jO":"fsharp.0119d0fd.js","7L6sP":"ftl.c5671dbe.js","2ujce":"gap.b0574953.js","hzgIA":"gcode.29260c31.js","5MUDD":"gdscript.545f127b.js","ghckm":"gedcom.d53f8a81.js","ian9z":"gherkin.0c5a099f.js","dsuH3":"git.2d89a25c.js","dvV8S":"glsl.0bf837a6.js","6BDWE":"gml.04204c1b.js","btSYt":"gn.cbb4c3be.js","j94Lr":"go-module.2bebc9b8.js","207xG":"go.cc49e5b2.js","iQ4Nh":"graphql.3d658adb.js","9E9pJ":"groovy.3e5836cd.js","hLXUt":"haml.9a056759.js","5ob5h":"handlebars.8c13dfe6.js","1nDhS":"haskell.3c80aa72.js","kQehe":"haxe.40a1dc98.js","1sziu":"hcl.84488f47.js","28Tam":"hlsl.323b0c17.js","awNOU":"hoon.df16cb45.js","eeLMI":"hpkp.9c950797.js","gjEKw":"hsts.0440ab7b.js","3bCJ7":"http.96d5f1c1.js","id4YZ":"ichigojam.c0bd16f5.js","5TKHe":"icon.439feb9f.js","eijPh":"icu-message-format.e96f6551.js","lv8gR":"idris.d3811412.js","bW8K3":"iecst.3fdbbc52.js","b8EBv":"ignore.00726ce9.js","jOS96":"inform7.65978ef5.js","dn3Yf":"ini.1cbb0515.js","iUSU6":"io.e628fd7e.js","6wbwo":"j.b959d174.js","5qA0j":"java.0ffd8069.js","hdx4d":"javadoc.b99752ae.js","jRMSs":"javadoclike.8cc3d825.js","l2DRD":"javascript.fe729813.js","cpOeo":"javastacktrace.cc22fb4b.js","fSVrK":"jexl.2cce5cc0.js","03mi8":"jolie.d8f352cd.js","j6YjP":"jq.65b95777.js","6JQIv":"js-extras.7d041902.js","5nVrm":"js-templates.a3463d0b.js","9gPZY":"jsdoc.0c5cc4d3.js","8q0xA":"json5.b9de5531.js","fIx8j":"jsonp.eefdc553.js","a3ur7":"jsstacktrace.8d3a2b71.js","bKtxi":"julia.679e1c74.js","9vqI0":"keepalived.e694c167.js","lDUCl":"keyman.d1406200.js","gcEXq":"kotlin.fd040b34.js","cxxOt":"kumir.b2072cfc.js","b8NIc":"kusto.98546fcc.js","iXz7U":"latex.ecc17a0d.js","9nRbn":"latte.18295a4f.js","lWxq2":"less.a8a986ab.js","7dEcL":"lilypond.0423d709.js","ck7Ll":"scheme.4039466f.js","hI3m3":"liquid.533f073c.js","7qpQZ":"lisp.b075bd53.js","8Cm1D":"livescript.2b19fb05.js","9sT8D":"llvm.6b74465d.js","gQkTU":"log.b74346d6.js","86y52":"lolcode.0fbc730a.js","6bXdx":"magma.bbb66246.js","hDIxO":"makefile.bf1a7653.js","4wRUQ":"markdown.4a5510a8.js","66rgq":"markup.973a8c4c.js","iAx9A":"matlab.caaa1e9f.js","5SXMq":"maxscript.58a0bf4d.js","gnQ55":"mel.c5da9d2e.js","8G54S":"mermaid.ced53190.js","gfXsu":"mizar.4e6d6035.js","7nZsb":"mongodb.5c4e0cf9.js","hUs37":"monkey.9be800f3.js","fKqwA":"moonscript.fc782589.js","luHXo":"n1ql.7f05115f.js","j0sqX":"n4js.318f41b7.js","avS2d":"nand2tetris-hdl.be3bb656.js","8fNUI":"naniscript.ec3afc9a.js","6PKtR":"nasm.1ee2623a.js","2LUGi":"neon.1d5a4ec8.js","esMLb":"nevod.6908715c.js","jQ8dR":"nginx.404fbeb4.js","1kuW2":"nim.36bf497b.js","7YxPR":"nix.3af3b6b2.js","b1EPY":"nsis.94e1fb71.js","j169M":"objectivec.49a6b342.js","1b4qw":"ocaml.c5fca1eb.js","c0JxA":"opencl.4194613a.js","54ivl":"openqasm.4b589cb3.js","kYO5l":"oz.498e9cbd.js","811Qi":"parigp.ed6a3789.js","gXO52":"parser.3329b2ab.js","4SQCy":"pascal.82aebbcf.js","9KuwN":"pascaligo.4bbd3a85.js","eM7TR":"pcaxis.e636466e.js","6w6GH":"peoplecode.32e124c6.js","eQPpI":"perl.7d72d7fd.js","b83gb":"php-extras.9606406b.js","l8BPM":"phpdoc.617f8af6.js","2cVRv":"plsql.482f8da9.js","gOyA3":"powerquery.486ee359.js","1BYb4":"powershell.856a4dd0.js","lIwm5":"processing.2c7d4403.js","cHCln":"prolog.812b5c86.js","d460J":"promql.8e6b9da4.js","lAnQP":"properties.40afd4d0.js","dG8OA":"protobuf.84963e3e.js","eRbDh":"psl.9c32166c.js","27W0o":"pug.54462c11.js","75Y4h":"puppet.2646aef5.js","kgGGG":"pure.a10bd6b4.js","hFuIq":"purebasic.629b75cd.js","db2yj":"purescript.216751ba.js","8ZppB":"q.b46a94a4.js","iFM89":"qml.bd71f711.js","7FNJV":"qore.d7e006f8.js","6AsUF":"qsharp.7bab07d1.js","7Xrsp":"r.3036c5c0.js","dh9BI":"racket.b867dd29.js","8pRTf":"reason.405183ad.js","kUbHD":"regex.aa4684b4.js","bNx4l":"rego.61da6b5d.js","jbksA":"renpy.ff0ce389.js","gP26j":"rest.91bee177.js","6FCYh":"rip.33f479a4.js","lEjxk":"roboconf.0ba2e9bf.js","c8BOJ":"robotframework.72ccad61.js","elAoE":"rust.9a35cb62.js","eDL1o":"sas.b3b3be64.js","gIQMB":"sass.165275f3.js","i7Y8T":"scala.a51a6234.js","OzRer":"shell-session.c47a7880.js","hZA2W":"smali.46e3f703.js","gT51y":"smalltalk.fb31e155.js","2OoIP":"smarty.abd6973e.js","33hrk":"sml.6d8c2545.js","3uuqi":"solidity.80562c5b.js","kHJvD":"solution-file.30e00f5f.js","6iiDq":"soy.46a7ec1f.js","2TkEp":"sparql.dbb56be0.js","eirDq":"turtle.b8836781.js","jmDes":"splunk-spl.149146f6.js","81dr7":"sqf.ea070acb.js","i4XqC":"squirrel.1efaf6f3.js","1zw3p":"stan.6efb4565.js","kfIG2":"stylus.d4d41ca4.js","dksml":"swift.ea86fdd0.js","4w3mZ":"systemd.df819c28.js","6b6p1":"t4-cs.b3eaa646.js","budu0":"t4-templating.db399052.js","7RUUk":"t4-vb.082c208c.js","2cwdT":"vbnet.ac572fcc.js","fBA7X":"tap.82e5520b.js","gqbYu":"yaml.3d0bf472.js","lCVk7":"tcl.fffb53bb.js","aKXaK":"textile.20ae1d45.js","ks7hU":"toml.69754057.js","kCJbl":"tremor.262b95d4.js","iZ71n":"tt2.f07906cb.js","5mLLA":"twig.a95c4964.js","i9AIa":"typoscript.3dbd38d9.js","iHNMy":"unrealscript.e5c3fc1d.js","bKWLJ":"uorazor.cf3ed6dc.js","2XcAn":"uri.59c4e10c.js","enDcg":"v.fe8e0874.js","db4Ta":"vala.386e6270.js","cmaSk":"velocity.9a0ffb21.js","29RKO":"verilog.4308f028.js","4aBVG":"vhdl.ca8ee4c0.js","6Jrfy":"vim.897929a5.js","kNyzl":"visual-basic.bc36aaac.js","4LJ5s":"warpscript.6d00b50f.js","6Ocza":"wasm.029f651e.js","hvPGO":"web-idl.97fc763d.js","lS90V":"wiki.1179d7f8.js","9LY8Y":"wolfram.7017e6a0.js","bFBdJ":"wren.d4121438.js","iskNq":"xeora.cce693be.js","ek7X7":"xml-doc.025d4193.js","hwA94":"xojo.843f212e.js","f8rnQ":"xquery.50701bd4.js","3Q9qv":"yang.2c70775f.js","a0Oht":"zig.e33efe11.js","dnGOp":"core.ade097c7.js"}'));var s;s=a("9Hk4c");var l,c=a("2BCLI"),u=a("85Hg2");l=a("bG9xl")();const d=e=>e?new URL(e.startsWith("http")?e:`https://${e}`).origin:"https://backend.memori.ai";var f=a("dCyaf");const h=(e,t)=>r(f)(`${t.apiUrl}${e}`,{...t,body:(null==t?void 0:t.body)?JSON.stringify(t.body):void 0,mode:"cors",credentials:"include",headers:{"Content-Type":"application/json",...null==t?void 0:t.headers}}).then((e=>(null==t?void 0:t.text)?e.text():e.json()));var p=e=>({getTenantPublicMemoriList:t=>h(`/TenantPublicMemori/${encodeURI(t)}`,{apiUrl:e}),getTenantMetaverseMemoriList:t=>h(`/TenantMetaverseMemori/${encodeURI(t)}`,{apiUrl:e}),getPublicMemoriList:t=>h(`/PublicMemori/${t}`,{apiUrl:e}),getAllMemori:t=>h(`/AllMemori/${t}`,{apiUrl:e}),getUserByIDMemoriList:(t,n,r)=>h(`/UserMemoriByID/${t}/${n}${r?`/${r}`:""}`,{apiUrl:e}),getUserMemoriList:(t,n,r)=>h(`/UserMemori/${t}/${n}${r?`/${r}`:""}`,{apiUrl:e}),getMemoriList:t=>h(`/Memori/${t}`,{apiUrl:e}),getSharedMemoriList:t=>h(`/SharedMemori/${t}`,{apiUrl:e}),getTenantCategories:t=>h(`/TenantMemoriCategories/${encodeURI(t)}`,{apiUrl:e}),getMemoriConfigs:t=>h(`/MemoriConfigs/${t}`,{apiUrl:e}),createMemori:(t,n)=>h(`/Memori/${t}`,{apiUrl:e,body:n,method:"POST"}),updateMemori:(t,n)=>h(`/Memori/${t}/${n.memoriID}`,{apiUrl:e,body:n,method:"PATCH"}),deleteMemori:(t,n)=>h(`/Memori/${t}`,{apiUrl:e,body:n,method:"DELETE"}),getMemoriById:(t,n)=>h(`/Memori/${t}/${n}`,{apiUrl:e}),getMemoriByUserAndId:(t,n,r,i)=>h(`/MemoriById/${t}/${n}/${r}${i?`/${i}`:""}`,{apiUrl:e}),getMemori:(t,n,r,i)=>h(`/Memori/${encodeURI(t)}/${encodeURI(n)}/${encodeURI(r)}/${null!=i?i:""}`,{apiUrl:e}),getMemoriSessions:(t,n,r,i)=>h(`/MemoriSessions/${t}/${n}${r?`/${r}`:""}${r&&i?`/${i}`:""}`,{apiUrl:e}),transferMemori:(t,n)=>h(`/TransferMemori/${t}`,{apiUrl:e,body:n,method:"POST"}),memoriContentUpdated:(t,n)=>h(`/MemoriContentUpdated/${t}/${n}`,{apiUrl:e,method:"POST"})}),m=e=>({userSignUp:t=>h("/User",{apiUrl:e,body:t,method:"POST"}),userConfirmSignUp:t=>h("/UserConfirm",{apiUrl:e,body:t,method:"POST"}),userLogin:t=>h("/Login",{apiUrl:e,body:t,method:"POST"}),userLogout:t=>h(`/Logout/${t}`,{apiUrl:e,method:"POST"}),getUser:(t,n)=>h(`/User/${t}/${n}`,{apiUrl:e}),getUsersList:t=>h(`/Users/${t}`,{apiUrl:e}),deleteUser:(t,n)=>h(`/User/${t}/${n}`,{apiUrl:e,method:"DELETE"}),updateUser:(t,n,r)=>h(`/User/${t}/${n}`,{apiUrl:e,method:"PATCH",body:r}),resetPassword:t=>h("/ResetPassword",{apiUrl:e,body:t,method:"POST"}),resetConfirm:t=>h("/ResetConfirm",{apiUrl:e,body:t,method:"POST"}),recoverUsername:t=>h("/RecoverUsername",{apiUrl:e,body:t,method:"POST"}),getTenantConfig:t=>h(`/Tenant/${t}`,{apiUrl:e}),resendVerificationCode:t=>h("/ResendVerificationCode",{apiUrl:e,body:t,method:"POST"}),createUser:(t,n)=>h(`/User/${t}`,{apiUrl:e,body:n,method:"POST"})}),g=e=>({getMemoriIntegrationsList:(t,n)=>h(`/Integrations/${t}/${n}`,{apiUrl:e}),getAllIntegrationsList:t=>h(`/AllIntegrations/${t}`,{apiUrl:e}),getIntegration:(t,n)=>h(`/Integration/${t}/${n}`,{apiUrl:e}),deleteIntegration:(t,n)=>h(`/Integration/${t}/${n}`,{apiUrl:e,method:"DELETE"}),createIntegration:(t,n)=>h(`/Integration/${t}`,{apiUrl:e,method:"POST",body:n}),updateIntegration:(t,n,r)=>h(`/Integration/${t}/${n}`,{apiUrl:e,method:"PATCH",body:r})}),v=e=>({getUploadAssetURL:(t,n,r)=>`${e}/Asset/${t}/${n}${r?`/${r}`:""}`,uploadAsset:async(t,n,r,i,o)=>{const a=new FormData,s=await fetch(n),l=await s.blob();a.append(t,l,t);const c=await fetch(`${e}/Asset/${r}/${i}${o?`/${o}`:""}`,{method:"POST",body:a});return await c.json()},getAsset:(t,n)=>h(`/Asset/${t}/${n}`,{apiUrl:e,method:"GET"}),updateAsset:(t,n,r)=>h(`/Asset/${t}/${n.split("/").reverse()[0]}`,{apiUrl:e,method:"PATCH",body:r}),deleteAsset:(t,n)=>h(`/Asset/${t}/${n.split("/").reverse()[0]}`,{apiUrl:e,method:"DELETE"})}),y=e=>({getSentInvitations:t=>h(`/SentInvitations/${t}`,{apiUrl:e}),getMemoriInvitations:(t,n)=>h(`/MemoriInvitations/${t}/${n}`,{apiUrl:e}),getReceivedInvitations:t=>h(`/ReceivedInvitations/${t}`,{apiUrl:e}),getAllInvitations:t=>h(`/AllInvitations/${t}`,{apiUrl:e}),getInvitation:(t,n)=>h(`/Invitation/${t}/${n}`,{apiUrl:e}),updateInvitation:(t,n)=>h(`/Invitation/${t}/${n.invitationID}`,{apiUrl:e,method:"PATCH",body:n}),deleteInvitation:(t,n)=>h(`/Invitation/${t}/${n}`,{apiUrl:e,method:"DELETE"}),acceptInvitation:(t,n)=>h(`/AcceptInvitation/${t}/${n}`,{apiUrl:e,method:"POST"}),rejectInvitation:(t,n)=>h(`/RejectInvitation/${t}/${n}`,{apiUrl:e,method:"POST"}),sendInvitation:(t,n)=>h(`/SendInvitation/${t}`,{apiUrl:e,method:"POST",body:n})}),b=e=>({getTenantConsumptionLogs:(t,n,r,i,o)=>h(`/TenantConsumptionLogs/${t}/${n}/${r}${i?`/${i}`:""}${i&&o?`/${o}`:""}`,{apiUrl:e}),getUserConsumptionLogs:(t,n,r,i,o)=>h(`/UserConsumptionLogs/${t}/${n}/${r}${i?`/${i}`:""}${i&&o?`/${o}`:""}`,{apiUrl:e}),getMemoriConsumptionLogs:(t,n,r,i,o)=>h(`/MemoriConsumptionLogs/${t}/${n}/${r}${i?`/${i}`:""}${i&&o?`/${o}`:""}`,{apiUrl:e})}),w=e=>({getTenantNotifications:t=>h(`/TenantNotifications/${t}`,{apiUrl:e}),getUserNotifications:t=>h(`/UserNotifications/${t}`,{apiUrl:e})});var x=e=>({asset:v(e),memori:p(e),user:m(e),integration:g(e),invitation:y(e),consumptionLogs:b(e),notifications:w(e),...v(e),...p(e),...m(e),...g(e),...y(e),...b(e),...w(e)}),S=e=>({getCorrelationPairs:async(t,n,r)=>h(`/CorrelationPairs/${t}${n?`/${n}${r?`/${r}`:""}`:""}`,{method:"GET",apiUrl:e}),postCorrelationPair:async(t,n)=>h(`/CorrelationPair/${t}`,{method:"POST",apiUrl:e,body:n}),deleteCorrelationPair:async(t,n)=>h(`/CorrelationPair/${t}/${n}`,{method:"DELETE",apiUrl:e})}),M=e=>({postTextEnteredEvent:async({sessionId:t,text:n})=>h(`/TextEnteredEvent/${t}`,{method:"POST",apiUrl:e,body:{text:n}}),postPlaceChangedEvent:async({sessionId:t,placeName:n,latitude:r,longitude:i,uncertaintyKm:o})=>h(`/PlaceChangedEvent/${t}`,{method:"POST",apiUrl:e,body:{placeName:n,latitude:r,longitude:i,uncertaintyKm:o}}),postDateChangedEvent:async t=>h(`/DateChangedEvent/${t}`,{method:"POST",apiUrl:e}),postTagChangedEvent:async(t,n)=>h(`/TagChangedEvent/${t}`,{method:"POST",apiUrl:e,body:{tag:n}}),postTimeoutEvent:async t=>h(`/TimeoutEvent/${t}`,{method:"POST",apiUrl:e}),postMediumSelectedEvent:async(t,n)=>h(`/MediumSelectedEvent/${t}`,{method:"POST",apiUrl:e,body:{medium:n}}),postDateSelectedEvent:async t=>h(`/DateSelectedEvent/${t}`,{method:"GET",apiUrl:e}),postPlaceSelectedEvent:async t=>h(`/PlaceSelectedEvent/${t}`,{method:"GET",apiUrl:e}),postTagSelectedEvent:async t=>h(`/TagSelectedEvent/${t}`,{method:"GET",apiUrl:e})}),_=e=>({importCSV:async(t,n,r)=>h(`/ImportExport/ImportCSV/${t}`,{method:"POST",apiUrl:e,body:{rows:n,...r}}),importProcesses:async t=>h(`/ImportExport/ImportProcesses/${t}`,{method:"GET",apiUrl:e}),importStatus:async t=>h(`/ImportExport/ImportStatus/${t}`,{method:"GET",apiUrl:e}),stopImport:async t=>h(`/ImportExport/StopImport/${t}`,{method:"POST",apiUrl:e}),importTXT:async(t,n,r)=>h(`/ImportExport/ImportTXT/${t}`,{method:"POST",apiUrl:e,body:{rows:n,...r}}),exportCSV:async(t,n)=>h(`/ImportExport/ExportCSV/${t}`,{method:"POST",apiUrl:e,body:n,text:!0})}),A=e=>({getIntents:async t=>h(`/Intents/${t}`,{method:"GET",apiUrl:e}),getIntent:async(t,n)=>h(`/Intent/${t}/${n}`,{method:"GET",apiUrl:e}),patchIntent:async(t,n)=>h(`/Intent/${t}/${n.intentID}`,{method:"PATCH",apiUrl:e,body:n}),deleteIntent:async(t,n)=>h(`/Intent/${t}/${n}`,{method:"DELETE",apiUrl:e}),createIntent:async(t,n)=>h(`/Intent/${t}`,{method:"POST",apiUrl:e,body:n}),getIntentSlots:async t=>h(`/IntentSlots/${t}`,{method:"GET",apiUrl:e}),getIntentSlot:async(t,n)=>h(`/IntentSlot/${t}/${n}`,{method:"GET",apiUrl:e}),patchIntentSlot:async(t,n)=>h(`/IntentSlot/${t}/${n.intentSlotID}`,{method:"PATCH",apiUrl:e,body:n}),deleteIntentSlot:async(t,n)=>h(`/IntentSlot/${t}/${n}`,{method:"DELETE",apiUrl:e}),createIntentSlot:async(t,n)=>h(`/IntentSlot/${t}`,{method:"POST",apiUrl:e,body:n})}),E=e=>({getLocalizationKeys:async t=>h(`/LocalizationKeys/${t}`,{method:"GET",apiUrl:e}),getLocalizationKey:async(t,n)=>h(`/LocalizationKey/${t}/${n}`,{method:"GET",apiUrl:e}),deleteLocalizationKey:async(t,n)=>h(`/LocalizationKey/${t}/${n}`,{method:"DELETE",apiUrl:e}),postLocalizationKey:async(t,n)=>h(`/LocalizationKey/${t}`,{method:"POST",apiUrl:e,body:n}),patchLocalizationKey:async(t,n)=>h(`/LocalizationKey/${t}`,{method:"PATCH",apiUrl:e,body:n})}),C=e=>({getMedia:async(t,n)=>h(`/Media/${t}/${n}`,{method:"GET",apiUrl:e}),deleteMedia:async(t,n)=>h(`/Media/${t}/${n}`,{method:"DELETE",apiUrl:e}),getMedium:async(t,n,r)=>h(`/Medium/${t}/${n}/${r}`,{method:"GET",apiUrl:e}),patchMedium:async(t,n,r)=>h(`/Medium/${t}/${n}/${r}`,{method:"GET",apiUrl:e}),deleteMedium:(t,n,r)=>h(`/Medium/${t}/${n}/${r}`,{method:"GET",apiUrl:e}),postMedium:async(t,n)=>h(`/Medium/${t}/${n}`,{method:"GET",apiUrl:e})}),k=e=>({getMemories:async(t,n)=>h(`/Memories/${t}${n?`/${n}`:""}`,{method:"GET",apiUrl:e}),getMemoriesPaginated:async(t,n,r,i)=>h(`/Memories/${t}/${n}/${r}${i?`/${i}`:""}`,{method:"GET",apiUrl:e}),getMemory:async(t,n)=>h(`/Memory/${t}/${n}`,{method:"GET",apiUrl:e}),patchMemory:async(t,n)=>h(`/Memory/${t}/${n.memoryID}`,{method:"PATCH",apiUrl:e,body:n}),deleteMemory:async(t,n)=>h(`/Memory/${t}/${n}`,{method:"DELETE",apiUrl:e}),postMemory:async(t,n)=>h(`/Memory/${t}`,{method:"POST",apiUrl:e,body:n}),getMemoryAccess:async(t,n)=>h(`/MemoryAccess/${t}/${n}`,{method:"GET",apiUrl:e})}),T=e=>({getWordVector:async(t,n)=>h(`/WordVector/${t}/${n}`,{method:"GET",apiUrl:e}),getSimilarWords:async(t,n)=>h(`/SimilarWords/${t}/${n}`,{method:"GET",apiUrl:e}),guessLanguage:async(t,n)=>h(`/GuessLanguage/${t}`,{method:"POST",apiUrl:e,body:{text:n}}),computeSimilarity:async(t,n,r,i,o)=>h(`/ComputeSimilarity/${t}`,{method:"POST",apiUrl:e,body:{referenceText:n,referenceTextType:r,comparisonText:i,comparisonTextType:o}}),checkWords:async(t,n)=>h(`/CheckWords/${t}`,{method:"POST",apiUrl:e,body:{text:n}})}),I=e=>({getPeople:async t=>h(`/People/${t}`,{method:"GET",apiUrl:e}),getPerson:async(t,n)=>h(`/Person/${t}/${n}`,{method:"GET",apiUrl:e}),patchPerson:async(t,n)=>h(`/Person/${t}/${n.personID}`,{method:"PATCH",body:n,apiUrl:e}),deletePerson:async(t,n)=>h(`/Person/${t}/${n}`,{method:"DELETE",apiUrl:e}),postPerson:async(t,n)=>h(`/Person/${t}`,{method:"POST",body:n,apiUrl:e})}),O=e=>({getPromptedQuestions:async t=>h(`/PromptedQuestions/${t}`,{method:"GET",apiUrl:e}),getPromptedQuestion:async(t,n)=>h(`/PromptedQuestion/${t}/${n}`,{method:"GET",apiUrl:e}),patchPromptedQuestion:async(t,n)=>h(`/PromptedQuestion/${t}/${n}`,{method:"GET",apiUrl:e}),deletePromptedQuestion:async(t,n)=>h(`/PromptedQuestion/${t}/${n}`,{method:"GET",apiUrl:e}),postPromptedQuestion:async t=>h(`/PromptedQuestion/${t}`,{method:"GET",apiUrl:e})}),R=e=>({searchMemory:async(t,n)=>h(`/Search/${t}`,{method:"POST",body:n,apiUrl:e}),postRandom:async t=>h(`/Random/${t}`,{method:"POST",apiUrl:e}),postHints:async t=>h(`/Hints/${t}`,{method:"GET",apiUrl:e})}),P=e=>({initSession:async t=>h("/Session",{method:"POST",body:t,apiUrl:e}),getSession:async t=>h(`/Session/${t}`,{method:"GET",apiUrl:e}),deleteSession:async t=>h(`/Session/${t}`,{method:"DELETE",apiUrl:e})}),N=e=>({getStatistics:async t=>h(`/Statistics/${t}`,{method:"GET",apiUrl:e}),getContentQualityIndexes:async t=>h(`/ContentQualityIndexes/${t}`,{method:"GET",apiUrl:e}),getTextQualityIndexes:async t=>h(`/TextQualityIndexes/${t}`,{method:"GET",apiUrl:e}),getEventLogs:async(t,n,r)=>h(`/EventLogs/${t}/${n}/${r}`,{method:"GET",apiUrl:e}),getMemoryEventLogs:async(t,n,r,i)=>h(`/EventLogs/${t}/${n}/${r}/${i}`,{method:"GET",apiUrl:e}),getIntentEventLogs:async(t,n,r,i)=>h(`/EventLogs/${t}/${n}/${r}/${i}`,{method:"GET",apiUrl:e})}),L=e=>({getUnansweredQuestions:async t=>h(`/UnansweredQuestions/${t}`,{method:"GET",apiUrl:e}),getUnansweredQuestionsPaginated:async(t,n,r)=>h(`/UnansweredQuestions/${t}/${n}/${r}`,{method:"GET",apiUrl:e}),postUnansweredQuestion:async(t,n)=>h(`/UnansweredQuestion/${t}`,{method:"POST",apiUrl:e,body:n}),deleteUnansweredQuestion:async(t,n)=>h(`/UnansweredQuestion/${t}/${n}`,{method:"DELETE",apiUrl:e})}),D=e=>({getContextVars:async t=>h(`/ContextVars/${t}`,{method:"GET",apiUrl:e}),getContextVarNames:async t=>h(`/ContextVarNames/${t}`,{method:"GET",apiUrl:e}),getContextVarValues:async(t,n)=>h(`/ContextVarValues/${t}/${n}`,{method:"GET",apiUrl:e})}),B=e=>({getCustomWords:async t=>h(`/CustomWords/${t}`,{method:"GET",apiUrl:e}),getCustomWord:async(t,n)=>h(`/CustomWord/${t}/${n}`,{method:"GET",apiUrl:e}),deleteCustomWord:async(t,n)=>h(`/CustomWord/${t}/${n}`,{method:"DELETE",apiUrl:e}),postCustomWord:async(t,n)=>h(`/CustomWord/${t}`,{method:"POST",apiUrl:e,body:n}),patchCustomWord:async(t,n)=>h(`/CustomWord/${t}/${n.customWordID}`,{method:"PATCH",apiUrl:e,body:n})}),j=e=>({getChatLogs:async(t,n,r)=>h(`/ChatLogs/${t}${n?`/${n}`:""}${n&&r?`/${r}`:""}`,{method:"GET",apiUrl:e}),getSessionChatLogs:async(t,n)=>h(`/SessionChatLogs/${t}/${n}`,{method:"GET",apiUrl:e}),deleteChatLogs:async(t,n,r)=>h(`/ChatLogs/${t}${n?`/${n}`:""}${n&&r?`/${r}`:""}`,{method:"DELETE",apiUrl:e}),deleteChatLog:async(t,n)=>h(`/ChatLog/${t}/${n}`,{method:"DELETE",apiUrl:e})}),F=e=>({correlationPairs:S(e),...S(e),dialog:M(e),...M(e),importExport:_(e),..._(e),intents:A(e),...A(e),localizationKeys:E(e),...E(e),media:C(e),...C(e),memories:k(e),...k(e),nlp:T(e),...T(e),people:I(e),...I(e),promptedQuestions:O(e),...O(e),search:R(e),...R(e),session:P(e),...P(e),stats:N(e),...N(e),unansweredQuestions:L(e),...L(e),contextVars:D(e),...D(e),customDictionary:B(e),...B(e),chatLogs:j(e),...j(e)}),U={};e(U,"allowedMediaTypes",(()=>z)),e(U,"anonTag",(()=>H));const z=["image/jpeg","image/png","image/jpg","image/gif","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/pdf","video/mp4","video/avi","audio/mpeg3","audio/wav","audio/mpeg","video/mpeg","model/gltf-binary"],H="👤";var V=e=>({getResourceUrl:({type:t,resourceURI:n,sessionID:r,baseURL:i="https://app.twincreator.com"})=>{let o="cover"===t?`${i}/images/memoriCover.png`:`${i}/images/memoriAvatar.png`;return n&&0!==n.length?n.includes("memoriai/memory")?`${n}?memori-ai-session-id=${r}`:n.startsWith("https://")||n.startsWith("http://")?`${n}${r?`/${r}`:""}`:n.startsWith("cloud://")?`${e.replace(/v2/,"v1")}/CloudAsset/${n.replace("cloud://","")}`:n.startsWith("guid://")?`${e.replace(/v2/,"v1")}/GuidAsset/${n.replace("guid://","")}`:o:o}});var W=e=>{const t=d(e);return{backend:x(`${t}/api/v2`),...F(`${t}/memori/v2`),constants:U,asset:V(`${t}/api/v2`)}},G=(u=a("85Hg2"),{}),q={};(q=function(e){if(Array.isArray(e))return e}).__esModule=!0,q.default=q;var K={};(K=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}).__esModule=!0,K.default=K;var Y={},J={};(J=function(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}).__esModule=!0,J.default=J,Y=function(e,t){if(e){if("string"==typeof e)return J(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)?J(e,t):void 0}},Y.__esModule=!0,Y.default=Y;var Q={};(Q=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}).__esModule=!0,Q.default=Q,(G=function(e,t){return q(e)||K(e,t)||Y(e,t)||Q()}).__esModule=!0,G.default=G;var X={},Z={},$={};function ee(e){return $=ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$.__esModule=!0,$.default=$,ee(e)}($=ee).__esModule=!0,$.default=$;var te=$.default,ne={},re=$.default;(ne=function(e,t){if("object"!==re(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==re(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}).__esModule=!0,ne.default=ne,(Z=function(e){var t=ne(e,"string");return"symbol"===te(t)?t:String(t)}).__esModule=!0,Z.default=Z,(X=function(e,t,n){return(t=Z(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}).__esModule=!0,X.default=X;u=a("85Hg2");var ie={};(ie=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}).__esModule=!0,ie.default=ie;var oe={};function ae(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,Z(r.key),r)}}(oe=function(e,t,n){return t&&ae(e.prototype,t),n&&ae(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}).__esModule=!0,oe.default=oe;u=a("85Hg2");var se=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,le={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},ce=function(e){return le[e]};function ue(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 de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ue(Object(n),!0).forEach((function(t){r(X)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var fe,he={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:function(e){return e.replace(se,ce)}},pe=(0,u.createContext)();function me(){return he}var ge=function(){function e(){r(ie)(this,e),this.usedNamespaces={}}return r(oe)(e,[{key:"addUsedNamespaces",value:function(e){var t=this;e.forEach((function(e){t.usedNamespaces[e]||(t.usedNamespaces[e]=!0)}))}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),e}();function ve(){return fe}var ye={type:"3rdParty",init:function(e){!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};he=de(de({},he),e)}(e.options.react),function(e){fe=e}(e)}};function be(){if(console&&console.warn){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];"string"==typeof n[0]&&(n[0]="react-i18next:: ".concat(n[0])),(e=console).warn.apply(e,n)}}var we={};function xe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];"string"==typeof t[0]&&we[t[0]]||("string"==typeof t[0]&&(we[t[0]]=new Date),be.apply(void 0,t))}function Se(e,t,n){e.loadNamespaces(t,(function(){if(e.isInitialized)n();else{e.on("initialized",(function t(){setTimeout((function(){e.off("initialized",t)}),0),n()}))}}))}function Me(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.languages[0],i=!!t.options&&t.options.fallbackLng,o=t.languages[t.languages.length-1];if("cimode"===r.toLowerCase())return!0;var a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};return!(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e))&&(!!t.hasResourceBundle(r,e)||(!(t.services.backendConnector.backend&&(!t.options.resources||t.options.partialBundledLanguages))||!(!a(r,e)||i&&!a(o,e))))}function _e(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t.languages||!t.languages.length)return xe("i18n.languages were undefined or empty",t.languages),!0;var r=void 0!==t.options.ignoreJSONStructure;return r?t.hasLoadedNamespace(e,{precheck:function(t,r){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}):Me(e,t,n)}function Ae(e){return e.displayName||e.name||("string"==typeof e&&e.length>0?e:"Unknown")}function Ee(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 Ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ee(Object(n),!0).forEach((function(t){r(X)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ke=function(e,t){var n=(0,u.useRef)();return(0,u.useEffect)((function(){n.current=t?n.current:e}),[e,t]),n.current};function Te(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.i18n,i=(0,u.useContext)(pe)||{},o=i.i18n,a=i.defaultNS,s=n||o||ve();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new ge),!s){xe("You will need to pass in an i18next instance by using initReactI18next");var l=function(e){return Array.isArray(e)?e[e.length-1]:e},c=[l,{},!1];return c.t=l,c.i18n={},c.ready=!1,c}s.options.react&&void 0!==s.options.react.wait&&xe("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var d=Ce(Ce(Ce({},me()),s.options.react),t),f=d.useSuspense,h=d.keyPrefix,p=e||a||s.options&&s.options.defaultNS;p="string"==typeof p?[p]:p||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(p);var m=(s.isInitialized||s.initializedStoreOnce)&&p.every((function(e){return _e(e,s,d)}));function g(){return s.getFixedT(null,"fallback"===d.nsMode?p:p[0],h)}var v=(0,u.useState)(g),y=r(G)(v,2),b=y[0],w=y[1],x=p.join(),S=ke(x),M=(0,u.useRef)(!0);(0,u.useEffect)((function(){var e=d.bindI18n,t=d.bindI18nStore;function n(){M.current&&w(g)}return M.current=!0,m||f||Se(s,p,(function(){M.current&&w(g)})),m&&S&&S!==x&&M.current&&w(g),e&&s&&s.on(e,n),t&&s&&s.store.on(t,n),function(){M.current=!1,e&&s&&e.split(" ").forEach((function(e){return s.off(e,n)})),t&&s&&t.split(" ").forEach((function(e){return s.store.off(e,n)}))}}),[s,x]);var _=(0,u.useRef)(!0);(0,u.useEffect)((function(){M.current&&!_.current&&w(g),_.current=!1}),[s,h]);var A=[b,s,m];if(A.t=b,A.i18n=s,A.ready=m,m)return A;if(!m&&!f)return A;throw new Promise((function(e){Se(s,p,(function(){e()}))}))}var Ie={};!function(e,t,n,r){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(t),a=i(n),s=i(r),l=function(e,t,n){return{endTime:t,insertTime:n,type:"exponentialRampToValue",value:e}},c=function(e,t,n){return{endTime:t,insertTime:n,type:"linearRampToValue",value:e}},u=function(e,t){return{startTime:t,type:"setValue",value:e}},d=function(e,t,n){return{duration:n,startTime:t,type:"setValueCurve",values:e}},f=function(e,t,n){var r=n.startTime,i=n.target,o=n.timeConstant;return i+(t-i)*Math.exp((r-e)/o)},h=function(e){return"exponentialRampToValue"===e.type},p=function(e){return"linearRampToValue"===e.type},m=function(e){return h(e)||p(e)},g=function(e){return"setValue"===e.type},v=function(e){return"setValueCurve"===e.type},y=function e(t,n,r,i){var o=t[n];return void 0===o?i:m(o)||g(o)?o.value:v(o)?o.values[o.values.length-1]:f(r,e(t,n-1,o.startTime,i),o)},b=function(e,t,n,r,i){return void 0===n?[r.insertTime,i]:m(n)?[n.endTime,n.value]:g(n)?[n.startTime,n.value]:v(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,y(e,t-1,n.startTime,i)]},w=function(e){return"cancelAndHold"===e.type},x=function(e){return"cancelScheduledValues"===e.type},S=function(e){return w(e)||x(e)?e.cancelTime:h(e)||p(e)?e.endTime:e.startTime},M=function(e,t,n,r){var i=r.endTime,o=r.value;return n===o?o:0<n&&0<o||n<0&&o<0?n*Math.pow(o/n,(e-t)/(i-t)):0},_=function(e,t,n,r){return n+(e-t)/(r.endTime-t)*(r.value-n)},A=function(e,t){var n=Math.floor(t),r=Math.ceil(t);return n===r?e[n]:(1-(t-n))*e[n]+(1-(r-t))*e[r]},E=function(e,t){var n=t.duration,r=t.startTime,i=t.values,o=(e-r)/n*(i.length-1);return A(i,o)},C=function(e){return"setTarget"===e.type},k=function(e){function t(e){a.default(this,t),this._automationEvents=[],this._currenTime=0,this._defaultValue=e}return s.default(t,[{key:e,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:"add",value:function(e){var t=S(e);if(w(e)||x(e)){var n=this._automationEvents.findIndex((function(n){return x(e)&&v(n)?n.startTime+n.duration>=t:S(n)>=t})),r=this._automationEvents[n];if(-1!==n&&(this._automationEvents=this._automationEvents.slice(0,n)),w(e)){var i=this._automationEvents[this._automationEvents.length-1];if(void 0!==r&&m(r)){if(C(i))throw new Error("The internal list is malformed.");var o=v(i)?i.startTime+i.duration:S(i),a=v(i)?i.values[i.values.length-1]:i.value,s=h(r)?M(t,o,a,r):_(t,o,a,r),f=h(r)?l(s,t,this._currenTime):c(s,t,this._currenTime);this._automationEvents.push(f)}void 0!==i&&C(i)&&this._automationEvents.push(u(this.getValue(t),t)),void 0!==i&&v(i)&&i.startTime+i.duration>t&&(this._automationEvents[this._automationEvents.length-1]=d(new Float32Array([6,7]),i.startTime,t-i.startTime))}}else{var g=this._automationEvents.findIndex((function(e){return S(e)>t})),y=-1===g?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[g-1];if(void 0!==y&&v(y)&&S(y)+y.duration>t)return!1;var b=h(e)?l(e.value,e.endTime,this._currenTime):p(e)?c(e.value,t,this._currenTime):e;if(-1===g)this._automationEvents.push(b);else{if(v(e)&&t+e.duration>S(this._automationEvents[g]))return!1;this._automationEvents.splice(g,0,b)}}return!0}},{key:"flush",value:function(e){var t=this._automationEvents.findIndex((function(t){return S(t)>e}));if(t>1){var n=this._automationEvents.slice(t-1),r=n[0];C(r)&&n.unshift(u(y(this._automationEvents,t-2,r.startTime,this._defaultValue),r.startTime)),this._automationEvents=n}}},{key:"getValue",value:function(e){if(0===this._automationEvents.length)return this._defaultValue;var t=this._automationEvents.findIndex((function(t){return S(t)>e})),n=this._automationEvents[t],r=(-1===t?this._automationEvents.length:t)-1,i=this._automationEvents[r];if(void 0!==i&&C(i)&&(void 0===n||!m(n)||n.insertTime>e))return f(e,y(this._automationEvents,r-1,i.startTime,this._defaultValue),i);if(void 0!==i&&g(i)&&(void 0===n||!m(n)))return i.value;if(void 0!==i&&v(i)&&(void 0===n||!m(n)||i.startTime+i.duration>e))return e<i.startTime+i.duration?E(e,i):i.values[i.values.length-1];if(void 0!==i&&m(i)&&(void 0===n||!m(n)))return i.value;if(void 0!==n&&h(n)){var a=b(this._automationEvents,r,i,n,this._defaultValue),s=o.default(a,2),l=s[0],c=s[1];return M(e,l,c,n)}if(void 0!==n&&p(n)){var u=b(this._automationEvents,r,i,n,this._defaultValue),d=o.default(u,2),w=d[0],x=d[1];return _(e,w,x,n)}return this._defaultValue}}]),t}(Symbol.iterator),T=function(e){return{cancelTime:e,type:"cancelAndHold"}},I=function(e){return{cancelTime:e,type:"cancelScheduledValues"}},O=function(e,t){return{endTime:t,type:"exponentialRampToValue",value:e}},R=function(e,t){return{endTime:t,type:"linearRampToValue",value:e}},P=function(e,t,n){return{startTime:t,target:e,timeConstant:n,type:"setTarget"}};e.AutomationEventList=k,e.createCancelAndHoldAutomationEvent=T,e.createCancelScheduledValuesAutomationEvent=I,e.createExponentialRampToValueAutomationEvent=O,e.createLinearRampToValueAutomationEvent=R,e.createSetTargetAutomationEvent=P,e.createSetValueAutomationEvent=u,e.createSetValueCurveAutomationEvent=d,Object.defineProperty(e,"__esModule",{value:!0})}(Ie,a("kagof"),a("4qTFT"),a("9uC66"));const Oe=new WeakSet,Re=new WeakMap,Pe=new WeakMap,Ne=new WeakMap,Le=new WeakMap,De=new WeakMap,Be=new WeakMap,je=new WeakMap,Fe=new WeakMap,Ue=new WeakMap,ze={construct:()=>ze},He=e=>{try{new new Proxy(e,ze)}catch{return!1}return!0},Ve=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,We=(e,t)=>{const n=[];let r=e.replace(/^[\s]+/,""),i=r.match(Ve);for(;null!==i;){const e=i[1].slice(1,-1),o=i[0].replace(/([\s]+)?;?$/,"").replace(e,new URL(e,t).toString());n.push(o),r=r.slice(i[0].length).replace(/^[\s]+/,""),i=r.match(Ve)}return[n.join(";"),r]},Ge=e=>{if(void 0!==e&&!Array.isArray(e))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},qe=e=>{if(!He(e))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===e.prototype||"object"!=typeof e.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},Ke=(e,t)=>{const n=e.get(t);if(void 0===n)throw new Error("A value with the given key could not be found.");return n},Ye=(e,t)=>{const n=Array.from(e).filter(t);if(n.length>1)throw Error("More than one element was found.");if(0===n.length)throw Error("No element was found.");const[r]=n;return e.delete(r),r},Je=(e,t,n,r)=>{const i=Ke(e,t),o=Ye(i,(e=>e[0]===n&&e[1]===r));return 0===i.size&&e.delete(t),o},Qe=e=>Ke(Be,e),Xe=e=>{if(Oe.has(e))throw new Error("The AudioNode is already stored.");Oe.add(e),Qe(e).forEach((e=>e(!0)))},Ze=e=>"port"in e,$e=e=>{if(!Oe.has(e))throw new Error("The AudioNode is not stored.");Oe.delete(e),Qe(e).forEach((e=>e(!1)))},et=(e,t)=>{!Ze(e)&&t.every((e=>0===e.size))&&$e(e)},tt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},nt=(e,t)=>e.context===t,rt=e=>{try{e.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},it=()=>new DOMException("","IndexSizeError"),ot=e=>{var t;e.getChannelData=(t=e.getChannelData,n=>{try{return t.call(e,n)}catch(e){if(12===e.code)throw it();throw e}})},at={numberOfChannels:1},st=-34028234663852886e22,lt=34028234663852886e22,ct=e=>Oe.has(e),ut={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},dt=e=>"playbackRate"in e,ft=e=>"frequency"in e&&"gain"in e,ht=e=>"offset"in e,pt=e=>!("frequency"in e)&&"gain"in e,mt=e=>"detune"in e&&"frequency"in e,gt=e=>"pan"in e,vt=e=>Ke(Re,e),yt=e=>Ke(Ne,e),bt=(e,t)=>{const{activeInputs:n}=vt(e);n.forEach((n=>n.forEach((([n])=>{t.includes(e)||bt(n,[...t,e])}))));const r=dt(e)?[e.playbackRate]:Ze(e)?Array.from(e.parameters.values()):ft(e)?[e.Q,e.detune,e.frequency,e.gain]:ht(e)?[e.offset]:pt(e)?[e.gain]:mt(e)?[e.detune,e.frequency]:gt(e)?[e.pan]:[];for(const e of r){const n=yt(e);void 0!==n&&n.activeInputs.forEach((([e])=>bt(e,t)))}ct(e)&&$e(e)},wt=e=>{bt(e.destination,[])},xt=e=>void 0===e||"number"==typeof e||"string"==typeof e&&("balanced"===e||"interactive"===e||"playback"===e),St=e=>"context"in e,Mt=e=>St(e[0]),_t=(e,t,n,r)=>{for(const t of e)if(n(t)){if(r)return!1;throw Error("The set contains at least one similar element.")}return e.add(t),!0},At=(e,t,[n,r],i)=>{_t(e,[t,n,r],(e=>e[0]===t&&e[1]===n),i)},Et=(e,[t,n,r],i)=>{const o=e.get(t);void 0===o?e.set(t,new Set([[n,r]])):_t(o,[n,r],(e=>e[0]===n),i)},Ct=e=>"inputs"in e,kt=(e,t,n,r)=>{if(Ct(t)){const i=t.inputs[r];return e.connect(i,n,0),[i,n,0]}return e.connect(t,n,r),[t,n,r]},Tt=(e,t,n)=>{for(const r of e)if(r[0]===t&&r[1]===n)return e.delete(r),r;return null},It=(e,t,n)=>Ye(e,(e=>e[0]===t&&e[1]===n)),Ot=(e,t)=>{if(!Qe(e).delete(t))throw new Error("Missing the expected event listener.")},Rt=(e,t,n)=>{const r=Ke(e,t),i=Ye(r,(e=>e[0]===n));return 0===r.size&&e.delete(t),i},Pt=(e,t,n,r)=>{Ct(t)?e.disconnect(t.inputs[r],n,0):e.disconnect(t,n,r)},Nt=e=>Ke(Pe,e),Lt=e=>Ke(Le,e),Dt=e=>je.has(e),Bt=e=>!Oe.has(e),jt=(e,t)=>new Promise((n=>{if(null!==t)n(!0);else{const t=e.createScriptProcessor(256,1,1),r=e.createGain(),i=e.createBuffer(1,2,44100),o=i.getChannelData(0);o[0]=1,o[1]=1;const a=e.createBufferSource();a.buffer=i,a.loop=!0,a.connect(t).connect(e.destination),a.connect(r),a.disconnect(r),t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0);Array.prototype.some.call(i,(e=>1===e))?n(!0):n(!1),a.stop(),t.onaudioprocess=null,a.disconnect(t),t.disconnect(e.destination)},a.start()}})),Ft=(e,t)=>{const n=new Map;for(const t of e)for(const e of t){const t=n.get(e);n.set(e,void 0===t?1:t+1)}n.forEach(((e,n)=>t(n,e)))},Ut=e=>"context"in e,zt=e=>{const t=new Map;var n,r;e.connect=(n=e.connect.bind(e),(e,r=0,i=0)=>{const o=Ut(e)?n(e,r,i):n(e,r),a=t.get(e);return void 0===a?t.set(e,[{input:i,output:r}]):a.every((e=>e.input!==i||e.output!==r))&&a.push({input:i,output:r}),o}),e.disconnect=(r=e.disconnect,(n,i,o)=>{if(r.apply(e),void 0===n)t.clear();else if("number"==typeof n)for(const[e,r]of t){const i=r.filter((e=>e.output!==n));0===i.length?t.delete(e):t.set(e,i)}else if(t.has(n))if(void 0===i)t.delete(n);else{const e=t.get(n);if(void 0!==e){const r=e.filter((e=>e.output!==i&&(e.input!==o||void 0===o)));0===r.length?t.delete(n):t.set(n,r)}}for(const[n,r]of t)r.forEach((t=>{Ut(n)?e.connect(n,t.output,t.input):e.connect(n,t.output)}))})},Ht=(e,t,n,r)=>{const{activeInputs:i,passiveInputs:o}=yt(t),{outputs:a}=vt(e),s=Qe(e),l=a=>{const s=Nt(e),l=Lt(t);if(a){const t=Rt(o,e,n);At(i,e,t,!1),r||Dt(e)||s.connect(l,n)}else{const t=It(i,e,n);Et(o,t,!1),r||Dt(e)||s.disconnect(l,n)}};return!!_t(a,[t,n],(e=>e[0]===t&&e[1]===n),!0)&&(s.add(l),ct(e)?At(i,e,[n,l],!0):Et(o,[e,n,l],!0),!0)},Vt=(e,t,n,r,i)=>{const[o,a]=((e,t,n,r)=>{const{activeInputs:i,passiveInputs:o}=vt(t),a=Tt(i[r],e,n);if(null===a)return[Je(o,e,n,r)[2],!1];return[a[2],!0]})(e,n,r,i);if(null!==o&&(Ot(e,o),!a||t||Dt(e)||Pt(Nt(e),Nt(n),r,i)),ct(n)){const{activeInputs:e}=vt(n);et(n,e)}},Wt=(e,t,n,r)=>{const[i,o]=((e,t,n)=>{const{activeInputs:r,passiveInputs:i}=yt(t),o=Tt(r,e,n);if(null===o)return[Rt(i,e,n)[1],!1];return[o[2],!0]})(e,n,r);null!==i&&(Ot(e,i),!o||t||Dt(e)||Nt(e).disconnect(Lt(n),r))};class Gt{constructor(e){this._map=new Map(e)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(e,t=null){return this._map.forEach(((n,r)=>e.call(t,n,r,this)))}get(e){return this._map.get(e)}has(e){return this._map.has(e)}keys(){return this._map.keys()}values(){return this._map.values()}}const qt={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function Kt(e,t,n,r,i){if("function"==typeof e.copyFromChannel)0===t[n].byteLength&&(t[n]=new Float32Array(128)),e.copyFromChannel(t[n],r,i);else{const o=e.getChannelData(r);if(0===t[n].byteLength)t[n]=o.slice(i,i+128);else{const e=new Float32Array(o.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);t[n].set(e)}}}const Yt=(e,t,n,r,i)=>{"function"==typeof e.copyToChannel?0!==t[n].byteLength&&e.copyToChannel(t[n],r,i):0!==t[n].byteLength&&e.getChannelData(r).set(t[n],i)},Jt=(e,t)=>{const n=[];for(let r=0;r<e;r+=1){const e=[],i="number"==typeof t?t:t[r];for(let t=0;t<i;t+=1)e.push(new Float32Array(128));n.push(e)}return n},Qt=(e,t)=>{const n=Ke(Ue,e),r=Nt(t);return Ke(n,r)},Xt=async(e,t,n,r,i,o,a)=>{const s=null===t?128*Math.ceil(e.context.length/128):t.length,l=r.channelCount*r.numberOfInputs,c=i.reduce(((e,t)=>e+t),0),u=0===c?null:n.createBuffer(c,s,n.sampleRate);if(void 0===o)throw new Error("Missing the processor constructor.");const d=vt(e),f=await Qt(n,e),h=Jt(r.numberOfInputs,r.channelCount),p=Jt(r.numberOfOutputs,i),m=Array.from(e.parameters.keys()).reduce(((e,t)=>({...e,[t]:new Float32Array(128)})),{});for(let c=0;c<s;c+=128){if(r.numberOfInputs>0&&null!==t)for(let e=0;e<r.numberOfInputs;e+=1)for(let n=0;n<r.channelCount;n+=1)Kt(t,h[e],n,n,c);void 0!==o.parameterDescriptors&&null!==t&&o.parameterDescriptors.forEach((({name:e},n)=>{Kt(t,m,e,l+n,c)}));for(let e=0;e<r.numberOfInputs;e+=1)for(let t=0;t<i[e];t+=1)0===p[e][t].byteLength&&(p[e][t]=new Float32Array(128));try{const e=h.map(((e,t)=>0===d.activeInputs[t].size?[]:e)),t=a(c/n.sampleRate,n.sampleRate,(()=>f.process(e,p,m)));if(null!==u)for(let e=0,t=0;e<r.numberOfOutputs;e+=1){for(let n=0;n<i[e];n+=1)Yt(u,p[e],n,t+n,c);t+=i[e]}if(!t)break}catch(t){e.dispatchEvent(new ErrorEvent("processorerror",{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}));break}}return u},Zt={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},$t={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},en={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},tn={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},nn={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},rn=e=>{const{port1:t,port2:n}=new MessageChannel;return new Promise((r=>{const i=()=>{n.onmessage=null,t.close(),n.close(),r()};n.onmessage=()=>i();try{t.postMessage(e,[e])}finally{i()}}))},on={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},an=e=>"delayTime"in e,sn=(e,t,n)=>{const r=t[n];if(void 0===r)throw e();return r},ln={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},cn={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},un=()=>new DOMException("","InvalidStateError"),dn=()=>new DOMException("","InvalidAccessError"),fn=e=>{var t;e.getFrequencyResponse=(t=e.getFrequencyResponse,(n,r,i)=>{if(n.length!==r.length||r.length!==i.length)throw dn();return t.call(e,n,r,i)})},hn={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},pn=(e,t,n,r,i,o,a,s,l,c,u)=>{const d=c.length;let f=s;for(let s=0;s<d;s+=1){let d=n[0]*c[s];for(let t=1;t<i;t+=1){const r=f-t&l-1;d+=n[t]*o[r],d-=e[t]*a[r]}for(let e=i;e<r;e+=1)d+=n[e]*o[f-e&l-1];for(let n=i;n<t;n+=1)d-=e[n]*a[f-n&l-1];o[f]=c[s],a[f]=d,f=f+1&l-1,u[s]=d}return f},mn={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},gn=e=>{const t=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=e.decodeAudioData(t.buffer,(()=>{}));return void 0!==n&&(n.catch((()=>{})),!0)}catch{}return!1},vn={numberOfChannels:1},yn=(e,t,n)=>{const r=t[n];void 0!==r&&r!==e[n]&&(e[n]=r)},bn=(e,t)=>{yn(e,t,"channelCount"),yn(e,t,"channelCountMode"),yn(e,t,"channelInterpretation")},wn=e=>"function"==typeof e.getFloatTimeDomainData,xn=(e,t,n)=>{const r=t[n];void 0!==r&&r!==e[n].value&&(e[n].value=r)},Sn=e=>{e.start=(t=>{let n=!1;return(r=0,i=0,o)=>{if(n)throw un();t.call(e,r,i,o),n=!0}})(e.start)},Mn=e=>{var t;e.start=(t=e.start,(n=0,r=0,i)=>{if("number"==typeof i&&i<0||r<0||n<0)throw new RangeError("The parameters can't be negative.");t.call(e,n,r,i)})},_n=e=>{var t;e.stop=(t=e.stop,(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");t.call(e,n)})},An=e=>{const{port1:t}=new MessageChannel;try{t.postMessage(e)}finally{t.close()}},En=(e,t)=>null===e?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(e*t))))),Cn=e=>new Promise(((t,n)=>{const{port1:r,port2:i}=new MessageChannel;r.onmessage=({data:e})=>{r.close(),i.close(),t(e)},r.onmessageerror=({data:e})=>{r.close(),i.close(),n(e)},i.postMessage(e)})),kn=async(e,t)=>new e(await Cn(t)),Tn=(e,t,n,r)=>{let i=Ue.get(e);void 0===i&&(i=new WeakMap,Ue.set(e,i));const o=kn(n,r);return i.set(t,o),o},In=(e,t)=>{const n=e.createBiquadFilter();return bn(n,t),xn(n,t,"Q"),xn(n,t,"detune"),xn(n,t,"frequency"),xn(n,t,"gain"),yn(n,t,"type"),n},On=e=>{const t=e.numberOfOutputs;Object.defineProperty(e,"channelCount",{get:()=>t,set:e=>{if(e!==t)throw un()}}),Object.defineProperty(e,"channelCountMode",{get:()=>"explicit",set:e=>{if("explicit"!==e)throw un()}}),Object.defineProperty(e,"channelInterpretation",{get:()=>"discrete",set:e=>{if("discrete"!==e)throw un()}})},Rn=(e,t)=>{const n=e.createChannelSplitter(t.numberOfOutputs);return bn(n,t),On(n),n},Pn=(e,t)=>(e.connect=t.connect.bind(t),e.disconnect=t.disconnect.bind(t),e),Nn=(e,t)=>{const n=e.createDelay(t.maxDelayTime);return bn(n,t),xn(n,t,"delayTime"),n},Ln=(e,t)=>{const n=e.createGain();return bn(n,t),xn(n,t,"gain"),n};function Dn(e,t){const n=t[0]*t[0]+t[1]*t[1];return[(e[0]*t[0]+e[1]*t[1])/n,(e[1]*t[0]-e[0]*t[1])/n]}function Bn(e,t){let n=[0,0];for(let o=e.length-1;o>=0;o-=1)i=t,n=[(r=n)[0]*i[0]-r[1]*i[1],r[0]*i[1]+r[1]*i[0]],n[0]+=e[o];var r,i;return n}const jn=(e,t,n,r)=>e.createScriptProcessor(t,n,r),Fn=()=>new DOMException("","NotSupportedError"),Un={numberOfChannels:1},zn={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},Hn={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},Vn={disableNormalization:!1},Wn={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},Gn=()=>new DOMException("","UnknownError"),qn={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},Kn=(e,t,n)=>void 0===e.copyFromChannel?e.getChannelData(n)[0]:(e.copyFromChannel(t,n),t[0]),Yn=e=>{if(null===e)return!1;const t=e.length;return t%2!=0?0!==e[Math.floor(t/2)]:e[t/2-1]+e[t/2]!==0},Jn=(e,t,n,r)=>{let i=e;for(;!i.hasOwnProperty(t);)i=Object.getPrototypeOf(i);const{get:o,set:a}=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,{get:n(o),set:r(a)})},Qn=(e,t,n)=>{try{e.setValueAtTime(t,n)}catch(r){if(9!==r.code)throw r;Qn(e,t,n+1e-7)}},Xn=e=>{const t=e.createOscillator();try{t.start(-1)}catch(e){return e instanceof RangeError}return!1},Zn=e=>{const t=e.createBuffer(1,1,44100),n=e.createBufferSource();n.buffer=t,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},$n=e=>{const t=e.createOscillator();try{t.stop(-1)}catch(e){return e instanceof RangeError}return!1},er=(e,t)=>{const n=t.createGain();e.connect(n);const r=(i=e.disconnect,()=>{i.call(e,n),e.removeEventListener("ended",r)});var i;e.addEventListener("ended",r),Pn(e,n),e.stop=(t=>{let r=!1;return(i=0)=>{if(r)try{t.call(e,i)}catch{n.gain.setValueAtTime(0,i)}else t.call(e,i),r=!0}})(e.stop)},tr=(e,t)=>n=>{const r={value:e};return Object.defineProperties(n,{currentTarget:r,target:r}),"function"==typeof t?t.call(e,n):t.handleEvent.call(e,n)},nr=(rr=_t,(e,t,[n,r,i],o)=>{rr(e[r],[t,n,i],(e=>e[0]===t&&e[1]===n),o)});var rr;const ir=(e=>(t,n,[r,i,o],a)=>{const s=t.get(r);void 0===s?t.set(r,new Set([[i,n,o]])):e(s,[i,n,o],(e=>e[0]===i&&e[1]===n),a)})(_t),or=(ar=Ye,(e,t,n,r)=>ar(e[r],(e=>e[0]===t&&e[1]===n)));var ar;const sr=new WeakMap,lr=(cr=sr,e=>{var t;return null!==(t=cr.get(e))&&void 0!==t?t:0});var cr;const ur=(dr=new Map,fr=new WeakMap,(e,t)=>{const n=fr.get(e);if(void 0!==n)return n;const r=dr.get(e);if(void 0!==r)return r;try{const n=t();return n instanceof Promise?(dr.set(e,n),n.catch((()=>!1)).then((t=>(dr.delete(e),fr.set(e,t),t)))):(fr.set(e,n),n)}catch{return fr.set(e,!1),!1}});var dr,fr;const hr="undefined"==typeof window?null:window,pr=(mr=ur,gr=it,(e,t)=>{const n=e.createAnalyser();if(bn(n,t),!(t.maxDecibels>t.minDecibels))throw gr();return yn(n,t,"fftSize"),yn(n,t,"maxDecibels"),yn(n,t,"minDecibels"),yn(n,t,"smoothingTimeConstant"),mr(wn,(()=>wn(n)))||(e=>{e.getFloatTimeDomainData=t=>{const n=new Uint8Array(t.length);e.getByteTimeDomainData(n);const r=Math.max(n.length,e.fftSize);for(let e=0;e<r;e+=1)t[e]=.0078125*(n[e]-128);return t}})(n),n});var mr,gr;const vr=(yr=vt,e=>{const t=yr(e);if(null===t.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return t.renderer});var yr;const br=((e,t,n)=>async(r,i,o)=>{const a=e(r);await Promise.all(a.activeInputs.map(((e,a)=>Array.from(e).map((async([e,s])=>{const l=t(e),c=await l.render(e,i),u=r.context.destination;n(e)||r===u&&n(r)||c.connect(o,s,a)})))).reduce(((e,t)=>[...e,...t]),[]))})(vt,vr,Dt),wr=(xr=pr,Sr=Nt,Mr=br,()=>{const e=new WeakMap;return{render(t,n){const r=e.get(n);return void 0!==r?Promise.resolve(r):(async(t,n)=>{let r=Sr(t);if(!nt(r,n)){const e={channelCount:r.channelCount,channelCountMode:r.channelCountMode,channelInterpretation:r.channelInterpretation,fftSize:r.fftSize,maxDecibels:r.maxDecibels,minDecibels:r.minDecibels,smoothingTimeConstant:r.smoothingTimeConstant};r=xr(n,e)}return e.set(n,r),await Mr(t,n,r),r})(t,n)}}});var xr,Sr,Mr;const _r=(Ar=De,e=>{const t=Ar.get(e);if(void 0===t)throw un();return t});var Ar;const Er=(e=>null===e?null:e.hasOwnProperty("OfflineAudioContext")?e.OfflineAudioContext:e.hasOwnProperty("webkitOfflineAudioContext")?e.webkitOfflineAudioContext:null)(hr),Cr=(kr=Er,e=>null!==kr&&e instanceof kr);var kr;const Tr=new WeakMap,Ir=(Or=tr,class{constructor(e){this._nativeEventTarget=e,this._listeners=new WeakMap}addEventListener(e,t,n){if(null!==t){let r=this._listeners.get(t);void 0===r&&(r=Or(this,t),"function"==typeof t&&this._listeners.set(t,r)),this._nativeEventTarget.addEventListener(e,r,n)}}dispatchEvent(e){return this._nativeEventTarget.dispatchEvent(e)}removeEventListener(e,t,n){const r=null===t?void 0:this._listeners.get(t);this._nativeEventTarget.removeEventListener(e,void 0===r?null:r,n)}});var Or;const Rr=(e=>null===e?null:e.hasOwnProperty("AudioContext")?e.AudioContext:e.hasOwnProperty("webkitAudioContext")?e.webkitAudioContext:null)(hr),Pr=(Nr=Rr,e=>null!==Nr&&e instanceof Nr);var Nr;const Lr=(e=>t=>null!==e&&"function"==typeof e.AudioNode&&t instanceof e.AudioNode)(hr),Dr=(e=>t=>null!==e&&"function"==typeof e.AudioParam&&t instanceof e.AudioParam)(hr),Br=(e=>null===e?null:e.hasOwnProperty("AudioWorkletNode")?e.AudioWorkletNode:null)(hr),jr=((e,t,n,r,i,o,a,s,l,c,u,d,f,h,p,m)=>class extends c{constructor(t,r,i,o){super(i),this._context=t,this._nativeAudioNode=i;const a=u(t);d(a)&&!0!==n(jt,(()=>jt(a,m)))&&zt(i),Pe.set(this,i),Be.set(this,new Set),"closed"!==t.state&&r&&Xe(this),e(this,o,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(e){this._nativeAudioNode.channelCount=e}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(e){this._nativeAudioNode.channelCountMode=e}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(e){this._nativeAudioNode.channelInterpretation=e}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(e,n=0,s=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();const c=u(this._context),d=p(c);if(f(e)||h(e))throw o();if(St(e)){const i=Nt(e);try{const t=kt(this._nativeAudioNode,i,n,s),r=Bt(this);(d||r)&&this._nativeAudioNode.disconnect(...t),"closed"!==this.context.state&&!r&&Bt(e)&&Xe(e)}catch(e){if(12===e.code)throw o();throw e}if(t(this,e,n,s,d)){const t=l([this],e);Ft(t,r(d))}return e}const m=Lt(e);if("playbackRate"===m.name&&1024===m.maxValue)throw a();try{this._nativeAudioNode.connect(m,n),(d||Bt(this))&&this._nativeAudioNode.disconnect(m,n)}catch(e){if(12===e.code)throw o();throw e}if(Ht(this,e,n,d)){const t=l([this],e);Ft(t,r(d))}}disconnect(e,t,n){let r;const a=u(this._context),c=p(a);if(void 0===e)r=((e,t)=>{const n=vt(e),r=[];for(const i of n.outputs)Mt(i)?Vt(e,t,...i):Wt(e,t,...i),r.push(i[0]);return n.outputs.clear(),r})(this,c);else if("number"==typeof e){if(e<0||e>=this.numberOfOutputs)throw i();r=((e,t,n)=>{const r=vt(e),i=[];for(const o of r.outputs)o[1]===n&&(Mt(o)?Vt(e,t,...o):Wt(e,t,...o),i.push(o[0]),r.outputs.delete(o));return i})(this,c,e)}else{if(void 0!==t&&(t<0||t>=this.numberOfOutputs))throw i();if(St(e)&&void 0!==n&&(n<0||n>=e.numberOfInputs))throw i();if(r=((e,t,n,r,i)=>{const o=vt(e);return Array.from(o.outputs).filter((e=>!(e[0]!==n||void 0!==r&&e[1]!==r||void 0!==i&&e[2]!==i))).map((n=>(Mt(n)?Vt(e,t,...n):Wt(e,t,...n),o.outputs.delete(n),n[0])))})(this,c,e,t,n),0===r.length)throw o()}for(const e of r){const t=l([this],e);Ft(t,s)}}})((Fr=Re,(e,t,n)=>{const r=[];for(let e=0;e<n.numberOfInputs;e+=1)r.push(new Set);Fr.set(e,{activeInputs:r,outputs:new Set,passiveInputs:new WeakMap,renderer:t})}),((e,t,n,r,i,o,a,s,l,c,u,d,f)=>{const h=new WeakMap;return(p,m,g,v,y)=>{const{activeInputs:b,passiveInputs:w}=o(m),{outputs:x}=o(p),S=s(p),M=o=>{const s=l(m),c=l(p);if(o){const t=Je(w,p,g,v);e(b,p,t,!1),y||d(p)||n(c,s,g,v),f(m)&&Xe(m)}else{const e=r(b,p,g,v);t(w,v,e,!1),y||d(p)||i(c,s,g,v);const n=a(m);if(0===n)u(m)&&et(m,b);else{const e=h.get(m);void 0!==e&&clearTimeout(e),h.set(m,setTimeout((()=>{u(m)&&et(m,b)}),1e3*n))}}};return!!c(x,[m,g,v],(e=>e[0]===m&&e[1]===g&&e[2]===v),!0)&&(S.add(M),u(p)?e(b,p,[g,v,M],!0):t(w,v,[p,g,M],!0),!0)}})(nr,ir,kt,or,Pt,vt,lr,Qe,Nt,_t,ct,Dt,Bt),ur,((e,t,n,r,i,o)=>a=>(s,l)=>{const c=e.get(s);if(void 0===c){if(!a&&o(s)){const e=r(s),{outputs:o}=n(s);for(const n of o)if(Mt(n)){const i=r(n[0]);t(e,i,n[1],n[2])}else{const t=i(n[0]);e.disconnect(t,n[1])}}e.set(s,l)}else e.set(s,c+l)})(je,Pt,vt,Nt,Lt,ct),it,dn,Fn,((e,t,n,r,i,o,a,s)=>(l,c)=>{const u=t.get(l);if(void 0===u)throw new Error("Missing the expected cycle count.");const d=o(l.context),f=s(d);if(u===c){if(t.delete(l),!f&&a(l)){const t=r(l),{outputs:o}=n(l);for(const n of o)if(Mt(n)){const i=r(n[0]);e(t,i,n[1],n[2])}else{const e=i(n[0]);t.connect(e,n[1])}}}else t.set(l,u-c)})(kt,je,vt,Nt,Lt,_r,ct,Cr),((e,t,n)=>function r(i,o){const a=St(o)?o:n(e,o);if(an(a))return[];if(i[0]===a)return[i];if(i.includes(a))return[];const{outputs:s}=t(a);return Array.from(s).map((e=>r([...i,a],e[0]))).reduce(((e,t)=>e.concat(t)),[])})(Tr,vt,Ke),Ir,_r,Pr,Lr,Dr,Cr,Br);var Fr;const Ur=((e,t,n,r,i,o)=>class extends e{constructor(e,n){const a=i(e),s={...tt,...n},l=r(a,s);super(e,!1,l,o(a)?t():null),this._nativeAnalyserNode=l}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(e){this._nativeAnalyserNode.fftSize=e}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(e){const t=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=e,!(e>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=t,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(e){const t=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=e,!(this._nativeAnalyserNode.maxDecibels>e))throw this._nativeAnalyserNode.minDecibels=t,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(e){this._nativeAnalyserNode.smoothingTimeConstant=e}getByteFrequencyData(e){this._nativeAnalyserNode.getByteFrequencyData(e)}getByteTimeDomainData(e){this._nativeAnalyserNode.getByteTimeDomainData(e)}getFloatFrequencyData(e){this._nativeAnalyserNode.getFloatFrequencyData(e)}getFloatTimeDomainData(e){this._nativeAnalyserNode.getFloatTimeDomainData(e)}})(jr,wr,it,pr,_r,Cr),zr=new WeakSet,Hr=(e=>null===e?null:e.hasOwnProperty("AudioBuffer")?e.AudioBuffer:null)(hr),Vr=(Wr=new Uint32Array(1),e=>(Wr[0]=e,Wr[0]));var Wr;const Gr=((e,t)=>n=>{n.copyFromChannel=(r,i,o=0)=>{const a=e(o),s=e(i);if(s>=n.numberOfChannels)throw t();const l=n.length,c=n.getChannelData(s),u=r.length;for(let e=a<0?-a:0;e+a<l&&e<u;e+=1)r[e]=c[e+a]},n.copyToChannel=(r,i,o=0)=>{const a=e(o),s=e(i);if(s>=n.numberOfChannels)throw t();const l=n.length,c=n.getChannelData(s),u=r.length;for(let e=a<0?-a:0;e+a<l&&e<u;e+=1)c[e+a]=r[e]}})(Vr,it),qr=(Kr=Vr,e=>{var t,n;e.copyFromChannel=(t=e.copyFromChannel,(n,r,i=0)=>{const o=Kr(i),a=Kr(r);if(o<e.length)return t.call(e,n,a,o)}),e.copyToChannel=(n=e.copyToChannel,(t,r,i=0)=>{const o=Kr(i),a=Kr(r);if(o<e.length)return n.call(e,t,a,o)})});var Kr;const Yr=((e,t,n,r,i,o,a,s)=>{let l=null;return class c{constructor(c){if(null===i)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:u,numberOfChannels:d,sampleRate:f}={...at,...c};null===l&&(l=new i(1,1,44100));const h=null!==r&&t(o,o)?new r({length:u,numberOfChannels:d,sampleRate:f}):l.createBuffer(d,u,f);if(0===h.numberOfChannels)throw n();return"function"!=typeof h.copyFromChannel?(a(h),ot(h)):t(rt,(()=>rt(h)))||s(h),e.add(h),h}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===c.prototype||e.has(t)}}})(zr,ur,Fn,Hr,Er,(Jr=Hr,()=>{if(null===Jr)return!1;try{new Jr({length:1,sampleRate:44100})}catch{return!1}return!0}),Gr,qr);var Jr;const Qr=(Xr=Ln,(e,t)=>{const n=Xr(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});t.connect(n).connect(e.destination);const r=()=>{t.removeEventListener("ended",r),t.disconnect(n),n.disconnect()};t.addEventListener("ended",r)});var Xr;const Zr=($r=vr,ei=yt,ti=Dt,async(e,t,n)=>{const r=ei(e);await Promise.all(Array.from(r.activeInputs).map((async([e,r])=>{const i=$r(e),o=await i.render(e,t);ti(e)||o.connect(n,r)})))});var $r,ei,ti;const ni=(ri=Zr,(e,t,n)=>ri(t,e,n));var ri;const ii=((e,t,n,r,i,o,a,s,l,c,u)=>(d,f)=>{const h=d.createBufferSource();return bn(h,f),xn(h,f,"playbackRate"),yn(h,f,"buffer"),yn(h,f,"loop"),yn(h,f,"loopEnd"),yn(h,f,"loopStart"),t(n,(()=>n(d)))||Sn(h),t(r,(()=>r(d)))||l(h),t(i,(()=>i(d)))||c(h,d),t(o,(()=>o(d)))||Mn(h),t(a,(()=>a(d)))||u(h,d),t(s,(()=>s(d)))||_n(h),e(d,h),h})(Qr,ur,(e=>{const t=e.createBufferSource();t.start();try{t.start()}catch{return!0}return!1}),(e=>{const t=e.createBufferSource(),n=e.createBuffer(1,1,44100);t.buffer=n;try{t.start(0,1)}catch{return!1}return!0}),(e=>{const t=e.createBufferSource();t.start();try{t.stop()}catch{return!1}return!0}),Xn,Zn,$n,(e=>{var t;e.start=(t=e.start,(n=0,r=0,i)=>{const o=e.buffer,a=null===o?r:Math.min(o.duration,r);null!==o&&a>o.duration-.5/e.context.sampleRate?t.call(e,n,0,0):t.call(e,n,a,i)})}),(oi=Jn,(e,t)=>{const n=t.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=n),oi(e,"buffer",(t=>()=>{const r=t.call(e);return r===n?null:r}),(t=>r=>t.call(e,null===r?n:r)))}),er);var oi;const ai=((e,t)=>(n,r,i)=>(e(r).replay(i),t(r,n,i)))((e=>t=>{const n=e(t);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer})(yt),Zr),si=((e,t,n,r,i)=>()=>{const o=new WeakMap;let a=null,s=null;return{set start(e){a=e},set stop(e){s=e},render(l,c){const u=o.get(c);return void 0!==u?Promise.resolve(u):(async(l,c)=>{let u=n(l);const d=nt(u,c);if(!d){const e={buffer:u.buffer,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,loop:u.loop,loopEnd:u.loopEnd,loopStart:u.loopStart,playbackRate:u.playbackRate.value};u=t(c,e),null!==a&&u.start(...a),null!==s&&u.stop(s)}return o.set(c,u),d?await e(c,l.playbackRate,u.playbackRate):await r(c,l.playbackRate,u.playbackRate),await i(l,c,u),u})(l,c)}}})(ni,ii,Nt,ai,br),li=((e,t,n,r,i,o,a,s,l,c,u,d,f)=>(h,p,m,g=null,v=null)=>{const y=new(0,Ie.AutomationEventList)(m.defaultValue),b=p?r(y):null,w={get defaultValue(){return m.defaultValue},get maxValue(){return null===g?m.maxValue:g},get minValue(){return null===v?m.minValue:v},get value(){return m.value},set value(e){m.value=e,w.setValueAtTime(e,h.context.currentTime)},cancelAndHoldAtTime(e){if("function"==typeof m.cancelAndHoldAtTime)null===b&&y.flush(h.context.currentTime),y.add(i(e)),m.cancelAndHoldAtTime(e);else{const t=Array.from(y).pop();null===b&&y.flush(h.context.currentTime),y.add(i(e));const n=Array.from(y).pop();m.cancelScheduledValues(e),t!==n&&void 0!==n&&("exponentialRampToValue"===n.type?m.exponentialRampToValueAtTime(n.value,n.endTime):"linearRampToValue"===n.type?m.linearRampToValueAtTime(n.value,n.endTime):"setValue"===n.type?m.setValueAtTime(n.value,n.startTime):"setValueCurve"===n.type&&m.setValueCurveAtTime(n.values,n.startTime,n.duration))}return w},cancelScheduledValues:e=>(null===b&&y.flush(h.context.currentTime),y.add(o(e)),m.cancelScheduledValues(e),w),exponentialRampToValueAtTime(e,t){if(0===e)throw new RangeError;if(!Number.isFinite(t)||t<0)throw new RangeError;return null===b&&y.flush(h.context.currentTime),y.add(a(e,t)),m.exponentialRampToValueAtTime(e,t),w},linearRampToValueAtTime:(e,t)=>(null===b&&y.flush(h.context.currentTime),y.add(s(e,t)),m.linearRampToValueAtTime(e,t),w),setTargetAtTime:(e,t,n)=>(null===b&&y.flush(h.context.currentTime),y.add(l(e,t,n)),m.setTargetAtTime(e,t,n),w),setValueAtTime:(e,t)=>(null===b&&y.flush(h.context.currentTime),y.add(c(e,t)),m.setValueAtTime(e,t),w),setValueCurveAtTime(e,t,n){const r=e instanceof Float32Array?e:new Float32Array(e);if(null!==d&&"webkitAudioContext"===d.name){const e=t+n,i=h.context.sampleRate,o=Math.ceil(t*i),a=Math.floor(e*i),s=a-o,l=new Float32Array(s);for(let e=0;e<s;e+=1){const a=(r.length-1)/n*((o+e)/i-t),s=Math.floor(a),c=Math.ceil(a);l[e]=s===c?r[s]:(1-(a-s))*r[s]+(1-(c-a))*r[c]}null===b&&y.flush(h.context.currentTime),y.add(u(l,t,n)),m.setValueCurveAtTime(l,t,n);const c=a/i;c<e&&f(w,l[l.length-1],c),f(w,r[r.length-1],e)}else null===b&&y.flush(h.context.currentTime),y.add(u(r,t,n)),m.setValueCurveAtTime(r,t,n);return w}};return n.set(w,m),t.set(w,h),e(w,b),w})((ci=Ne,(e,t)=>{ci.set(e,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:t})}),Tr,Le,(e=>({replay(t){for(const n of e)if("exponentialRampToValue"===n.type){const{endTime:e,value:r}=n;t.exponentialRampToValueAtTime(r,e)}else if("linearRampToValue"===n.type){const{endTime:e,value:r}=n;t.linearRampToValueAtTime(r,e)}else if("setTarget"===n.type){const{startTime:e,target:r,timeConstant:i}=n;t.setTargetAtTime(r,e,i)}else if("setValue"===n.type){const{startTime:e,value:r}=n;t.setValueAtTime(r,e)}else{if("setValueCurve"!==n.type)throw new Error("Can't apply an unknown automation.");{const{duration:e,startTime:r,values:i}=n;t.setValueCurveAtTime(i,r,e)}}}})),Ie.createCancelAndHoldAutomationEvent,Ie.createCancelScheduledValuesAutomationEvent,Ie.createExponentialRampToValueAutomationEvent,Ie.createLinearRampToValueAutomationEvent,Ie.createSetTargetAutomationEvent,Ie.createSetValueAutomationEvent,Ie.createSetValueCurveAutomationEvent,Rr,Qn);var ci;const ui=((e,t,n,r,i,o,a,s)=>class extends e{constructor(e,r){const s=o(e),l={...ut,...r},c=i(s,l),u=a(s),d=u?t():null;super(e,!1,c,d),this._audioBufferSourceNodeRenderer=d,this._isBufferNullified=!1,this._isBufferSet=null!==l.buffer,this._nativeAudioBufferSourceNode=c,this._onended=null,this._playbackRate=n(this,u,c.playbackRate,lt,st)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(e){if(this._nativeAudioBufferSourceNode.buffer=e,null!==e){if(this._isBufferSet)throw r();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(e){this._nativeAudioBufferSourceNode.loop=e}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(e){this._nativeAudioBufferSourceNode.loopEnd=e}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(e){this._nativeAudioBufferSourceNode.loopStart=e}get onended(){return this._onended}set onended(e){const t="function"==typeof e?s(this,e):null;this._nativeAudioBufferSourceNode.onended=t;const n=this._nativeAudioBufferSourceNode.onended;this._onended=null!==n&&n===t?e:n}get playbackRate(){return this._playbackRate}start(e=0,t=0,n){if(this._nativeAudioBufferSourceNode.start(e,t,n),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===n?[e,t]:[e,t,n]),"closed"!==this.context.state){Xe(this);const e=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",e),ct(this)&&$e(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",e)}}stop(e=0){this._nativeAudioBufferSourceNode.stop(e),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=e)}})(jr,si,li,un,ii,_r,Cr,tr),di=((e,t,n,r,i,o,a,s)=>class extends e{constructor(e,n){const r=o(e),l=a(r),c=i(r,n,l);super(e,!1,c,l?t(s):null),this._isNodeOfNativeOfflineAudioContext=l,this._nativeAudioDestinationNode=c}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(e>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=e}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=e}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}})(jr,(e=>{const t=new WeakMap;return{render(n,r){const i=t.get(r);return void 0!==i?Promise.resolve(i):(async(n,r)=>{const i=r.destination;return t.set(r,i),await e(n,r,i),i})(n,r)}}}),it,un,((e,t)=>(n,r,i)=>{const o=n.destination;if(o.channelCount!==r)try{o.channelCount=r}catch{}i&&"explicit"!==o.channelCountMode&&(o.channelCountMode="explicit"),0===o.maxChannelCount&&Object.defineProperty(o,"maxChannelCount",{value:r});const a=e(n,{channelCount:r,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,gain:1});return t(a,"channelCount",(e=>()=>e.call(a)),(e=>t=>{e.call(a,t);try{o.channelCount=t}catch(e){if(t>o.maxChannelCount)throw e}})),t(a,"channelCountMode",(e=>()=>e.call(a)),(e=>t=>{e.call(a,t),o.channelCountMode=t})),t(a,"channelInterpretation",(e=>()=>e.call(a)),(e=>t=>{e.call(a,t),o.channelInterpretation=t})),Object.defineProperty(a,"maxChannelCount",{get:()=>o.maxChannelCount}),a.connect(o),a})(Ln,Jn),_r,Cr,br),fi=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=nt(l,s);if(!c){const e={Q:l.Q.value,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,detune:l.detune.value,frequency:l.frequency.value,gain:l.gain.value,type:l.type};l=t(s,e)}return o.set(s,l),c?(await e(s,a.Q,l.Q),await e(s,a.detune,l.detune),await e(s,a.frequency,l.frequency),await e(s,a.gain,l.gain)):(await r(s,a.Q,l.Q),await r(s,a.detune,l.detune),await r(s,a.frequency,l.frequency),await r(s,a.gain,l.gain)),await i(a,s,l),l})(a,s)}}})(ni,In,Nt,ai,br),hi=(e=>(t,n)=>e.set(t,n))(sr),pi=(mi=jr,gi=li,vi=fi,yi=dn,bi=In,wi=_r,xi=Cr,Si=hi,class extends mi{constructor(e,t){const n=wi(e),r={...Zt,...t},i=bi(n,r),o=xi(n);super(e,!1,i,o?vi():null),this._Q=gi(this,o,i.Q,lt,st),this._detune=gi(this,o,i.detune,1200*Math.log2(lt),-1200*Math.log2(lt)),this._frequency=gi(this,o,i.frequency,e.sampleRate/2,0),this._gain=gi(this,o,i.gain,40*Math.log10(lt),st),this._nativeBiquadFilterNode=i,Si(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(e){this._nativeBiquadFilterNode.type=e}getFrequencyResponse(e,t,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(e,t,n)}catch(e){if(11===e.code)throw yi();throw e}if(e.length!==t.length||t.length!==n.length)throw yi()}});var mi,gi,vi,yi,bi,wi,xi,Si;const Mi=((e,t)=>(n,r,i)=>{const o=new Set;var a,s;return n.connect=(a=n.connect,(i,s=0,l=0)=>{const c=0===o.size;if(t(i))return a.call(n,i,s,l),e(o,[i,s,l],(e=>e[0]===i&&e[1]===s&&e[2]===l),!0),c&&r(),i;a.call(n,i,s),e(o,[i,s],(e=>e[0]===i&&e[1]===s),!0),c&&r()}),n.disconnect=(s=n.disconnect,(e,r,a)=>{const l=o.size>0;if(void 0===e)s.apply(n),o.clear();else if("number"==typeof e){s.call(n,e);for(const t of o)t[1]===e&&o.delete(t)}else{t(e)?s.call(n,e,r,a):s.call(n,e,r);for(const t of o)t[0]!==e||void 0!==r&&t[1]!==r||void 0!==a&&t[2]!==a||o.delete(t)}const c=0===o.size;l&&c&&i()}),n})(_t,Lr),_i=(Ai=un,Ei=Mi,(e,t)=>{t.channelCount=1,t.channelCountMode="explicit",Object.defineProperty(t,"channelCount",{get:()=>1,set:()=>{throw Ai()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:()=>{throw Ai()}});const n=e.createBufferSource();Ei(t,(()=>{const e=t.numberOfInputs;for(let r=0;r<e;r+=1)n.connect(t,0,r)}),(()=>n.disconnect(t)))});var Ai,Ei;const Ci=((e,t)=>(n,r)=>{const i=n.createChannelMerger(r.numberOfInputs);return null!==e&&"webkitAudioContext"===e.name&&t(n,i),bn(i,r),i})(Rr,_i),ki=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!nt(a,o)){const t={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfInputs:a.numberOfInputs};a=e(o,t)}return r.set(o,a),await n(i,o,a),a})(i,o)}}})(Ci,Nt,br),Ti=((e,t,n,r,i)=>class extends e{constructor(e,o){const a=r(e),s={...$t,...o};super(e,!1,n(a,s),i(a)?t():null)}})(jr,ki,Ci,_r,Cr),Ii=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!nt(a,o)){const t={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfOutputs:a.numberOfOutputs};a=e(o,t)}return r.set(o,a),await n(i,o,a),a})(i,o)}}})(Rn,Nt,br),Oi=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=r(e),l=o({...en,...a});super(e,!1,n(s,l),i(s)?t():null)}})(jr,Ii,Rn,_r,Cr,(e=>({...e,channelCount:e.numberOfOutputs}))),Ri=((e,t,n,r)=>(i,{offset:o,...a})=>{const s=i.createBuffer(1,2,44100),l=t(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),c=n(i,{...a,gain:o}),u=s.getChannelData(0);u[0]=1,u[1]=1,l.buffer=s,l.loop=!0;const d={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(e){c.channelCount=e},get channelCountMode(){return c.channelCountMode},set channelCountMode(e){c.channelCountMode=e},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(e){c.channelInterpretation=e},get context(){return c.context},get inputs(){return[]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get offset(){return c.gain},get onended(){return l.onended},set onended(e){l.onended=e},addEventListener:(...e)=>l.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>l.dispatchEvent(e[0]),removeEventListener:(...e)=>l.removeEventListener(e[0],e[1],e[2]),start(e=0){l.start.call(l,e)},stop(e=0){l.stop.call(l,e)}};return e(i,l),r(Pn(d,c),(()=>l.connect(c)),(()=>l.disconnect(c)))})(Qr,ii,Ln,Mi),Pi=((e,t,n,r,i)=>(o,a)=>{if(void 0===o.createConstantSource)return n(o,a);const s=o.createConstantSource();return bn(s,a),xn(s,a,"offset"),t(r,(()=>r(o)))||Mn(s),t(i,(()=>i(o)))||_n(s),e(o,s),s})(Qr,ur,Ri,Xn,$n),Ni=((e,t,n,r,i)=>()=>{const o=new WeakMap;let a=null,s=null;return{set start(e){a=e},set stop(e){s=e},render(l,c){const u=o.get(c);return void 0!==u?Promise.resolve(u):(async(l,c)=>{let u=n(l);const d=nt(u,c);if(!d){const e={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,offset:u.offset.value};u=t(c,e),null!==a&&u.start(a),null!==s&&u.stop(s)}return o.set(c,u),d?await e(c,l.offset,u.offset):await r(c,l.offset,u.offset),await i(l,c,u),u})(l,c)}}})(ni,Pi,Nt,ai,br),Li=((e,t,n,r,i,o,a)=>class extends e{constructor(e,a){const s=i(e),l={...tn,...a},c=r(s,l),u=o(s),d=u?n():null;super(e,!1,c,d),this._constantSourceNodeRenderer=d,this._nativeConstantSourceNode=c,this._offset=t(this,u,c.offset,lt,st),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(e){const t="function"==typeof e?a(this,e):null;this._nativeConstantSourceNode.onended=t;const n=this._nativeConstantSourceNode.onended;this._onended=null!==n&&n===t?e:n}start(e=0){if(this._nativeConstantSourceNode.start(e),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=e),"closed"!==this.context.state){Xe(this);const e=()=>{this._nativeConstantSourceNode.removeEventListener("ended",e),ct(this)&&$e(this)};this._nativeConstantSourceNode.addEventListener("ended",e)}}stop(e=0){this._nativeConstantSourceNode.stop(e),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=e)}})(jr,li,Ni,Pi,_r,Cr,tr),Di=((e,t)=>(n,r)=>{const i=n.createConvolver();if(bn(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),yn(i,r,"buffer"),r.channelCount>2)throw e();if(t(i,"channelCount",(e=>()=>e.call(i)),(t=>n=>{if(n>2)throw e();return t.call(i,n)})),"max"===r.channelCountMode)throw e();return t(i,"channelCountMode",(e=>()=>e.call(i)),(t=>n=>{if("max"===n)throw e();return t.call(i,n)})),i})(Fn,Jn),Bi=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!nt(a,o)){const t={buffer:a.buffer,channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,disableNormalization:!a.normalize};a=e(o,t)}return r.set(o,a),Ct(a)?await n(i,o,a.inputs[0]):await n(i,o,a),a})(i,o)}}})(Di,Nt,br),ji=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=r(e),l={...nn,...a},c=n(s,l);super(e,!1,c,i(s)?t():null),this._isBufferNullified=!1,this._nativeConvolverNode=c,null!==l.buffer&&o(this,l.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(e){if(this._nativeConvolverNode.buffer=e,null===e&&null!==this._nativeConvolverNode.buffer){const e=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=e.createBuffer(1,1,e.sampleRate),this._isBufferNullified=!0,o(this,0)}else this._isBufferNullified=!1,o(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(e){this._nativeConvolverNode.normalize=e}})(jr,Bi,Di,_r,Cr,hi),Fi=((e,t,n,r,i)=>o=>{const a=new WeakMap;return{render(s,l){const c=a.get(l);return void 0!==c?Promise.resolve(c):(async(s,l)=>{let c=n(s);const u=nt(c,l);if(!u){const e={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,delayTime:c.delayTime.value,maxDelayTime:o};c=t(l,e)}return a.set(l,c),u?await e(l,s.delayTime,c.delayTime):await r(l,s.delayTime,c.delayTime),await i(s,l,c),c})(s,l)}}})(ni,Nn,Nt,ai,br),Ui=((e,t,n,r,i,o,a)=>class extends e{constructor(e,s){const l=i(e),c={...on,...s},u=r(l,c),d=o(l);super(e,!1,u,d?n(c.maxDelayTime):null),this._delayTime=t(this,d,u.delayTime),a(this,c.maxDelayTime)}get delayTime(){return this._delayTime}})(jr,li,Fi,Nn,_r,Cr,hi),zi=(Hi=Fn,(e,t)=>{const n=e.createDynamicsCompressor();if(bn(n,t),t.channelCount>2)throw Hi();if("max"===t.channelCountMode)throw Hi();return xn(n,t,"attack"),xn(n,t,"knee"),xn(n,t,"ratio"),xn(n,t,"release"),xn(n,t,"threshold"),n});var Hi;const Vi=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=nt(l,s);if(!c){const e={attack:l.attack.value,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,knee:l.knee.value,ratio:l.ratio.value,release:l.release.value,threshold:l.threshold.value};l=t(s,e)}return o.set(s,l),c?(await e(s,a.attack,l.attack),await e(s,a.knee,l.knee),await e(s,a.ratio,l.ratio),await e(s,a.release,l.release),await e(s,a.threshold,l.threshold)):(await r(s,a.attack,l.attack),await r(s,a.knee,l.knee),await r(s,a.ratio,l.ratio),await r(s,a.release,l.release),await r(s,a.threshold,l.threshold)),await i(a,s,l),l})(a,s)}}})(ni,zi,Nt,ai,br),Wi=((e,t,n,r,i,o,a,s)=>class extends e{constructor(e,i){const l=o(e),c={...ln,...i},u=r(l,c),d=a(l);super(e,!1,u,d?n():null),this._attack=t(this,d,u.attack),this._knee=t(this,d,u.knee),this._nativeDynamicsCompressorNode=u,this._ratio=t(this,d,u.ratio),this._release=t(this,d,u.release),this._threshold=t(this,d,u.threshold),s(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(e){const t=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=e,e>2)throw this._nativeDynamicsCompressorNode.channelCount=t,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(e){const t=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=e,"max"===e)throw this._nativeDynamicsCompressorNode.channelCountMode=t,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return"number"==typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}})(jr,li,Vi,zi,Fn,_r,Cr,hi),Gi=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=nt(l,s);if(!c){const e={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,gain:l.gain.value};l=t(s,e)}return o.set(s,l),c?await e(s,a.gain,l.gain):await r(s,a.gain,l.gain),await i(a,s,l),l})(a,s)}}})(ni,Ln,Nt,ai,br),qi=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=i(e),l={...cn,...a},c=r(s,l),u=o(s);super(e,!1,c,u?n():null),this._gain=t(this,u,c.gain,lt,st)}get gain(){return this._gain}})(jr,li,Gi,Ln,_r,Cr),Ki=((e,t,n,r)=>(i,o,{channelCount:a,channelCountMode:s,channelInterpretation:l,feedback:c,feedforward:u})=>{const d=En(o,i.sampleRate),f=c instanceof Float64Array?c:new Float64Array(c),h=u instanceof Float64Array?u:new Float64Array(u),p=f.length,m=h.length,g=Math.min(p,m);if(0===p||p>20)throw r();if(0===f[0])throw t();if(0===m||m>20)throw r();if(0===h[0])throw t();if(1!==f[0]){for(let e=0;e<m;e+=1)h[e]/=f[0];for(let e=1;e<p;e+=1)f[e]/=f[0]}const v=n(i,d,a,a);v.channelCount=a,v.channelCountMode=s,v.channelInterpretation=l;const y=[],b=[],w=[];for(let e=0;e<a;e+=1){y.push(0);const e=new Float32Array(32),t=new Float32Array(32);e.fill(0),t.fill(0),b.push(e),w.push(t)}v.onaudioprocess=e=>{const t=e.inputBuffer,n=e.outputBuffer,r=t.numberOfChannels;for(let e=0;e<r;e+=1){const r=t.getChannelData(e),i=n.getChannelData(e);y[e]=pn(f,p,h,m,g,b[e],w[e],y[e],32,r,i)}};const x=i.sampleRate/2;return Pn({get bufferSize(){return d},get channelCount(){return v.channelCount},set channelCount(e){v.channelCount=e},get channelCountMode(){return v.channelCountMode},set channelCountMode(e){v.channelCountMode=e},get channelInterpretation(){return v.channelInterpretation},set channelInterpretation(e){v.channelInterpretation=e},get context(){return v.context},get inputs(){return[v]},get numberOfInputs(){return v.numberOfInputs},get numberOfOutputs(){return v.numberOfOutputs},addEventListener:(...e)=>v.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>v.dispatchEvent(e[0]),getFrequencyResponse(t,n,r){if(t.length!==n.length||n.length!==r.length)throw e();const i=t.length;for(let e=0;e<i;e+=1){const i=-Math.PI*(t[e]/x),o=[Math.cos(i),Math.sin(i)],a=Dn(Bn(h,o),Bn(f,o));n[e]=Math.sqrt(a[0]*a[0]+a[1]*a[1]),r[e]=Math.atan2(a[1],a[0])}},removeEventListener:(...e)=>v.removeEventListener(e[0],e[1],e[2])},v)})(dn,un,jn,Fn),Yi=((e,t,n,r)=>i=>e(gn,(()=>gn(i)))?Promise.resolve(e(r,r)).then((e=>{if(!e){const e=n(i,512,0,1);i.oncomplete=()=>{e.onaudioprocess=null,e.disconnect()},e.onaudioprocess=()=>i.currentTime,e.connect(i.destination)}return i.startRendering()})):new Promise((e=>{const n=t(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});i.oncomplete=t=>{n.disconnect(),e(t.renderedBuffer)},n.connect(i.destination),i.startRendering()})))(ur,Ln,jn,((e,t)=>()=>{if(null===t)return Promise.resolve(!1);const n=new t(1,1,44100),r=e(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise((e=>{n.oncomplete=()=>{r.disconnect(),e(0!==n.currentTime)},n.startRendering()}))})(Ln,Er)),Ji=((e,t,n,r,i)=>(o,a)=>{const s=new WeakMap;let l=null;const c=async(c,u)=>{let d=null,f=t(c);const h=nt(f,u);if(void 0===u.createIIRFilter?d=e(u,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):h||(f=u.createIIRFilter(a,o)),s.set(u,null===d?f:d),null!==d){if(null===l){if(null===n)throw new Error("Missing the native OfflineAudioContext constructor.");const e=new n(c.context.destination.channelCount,c.context.length,u.sampleRate);l=(async()=>{await r(c,e,e.destination);return((e,t,n,r)=>{const i=n instanceof Float64Array?n:new Float64Array(n),o=r instanceof Float64Array?r:new Float64Array(r),a=i.length,s=o.length,l=Math.min(a,s);if(1!==i[0]){for(let e=0;e<a;e+=1)o[e]/=i[0];for(let e=1;e<s;e+=1)i[e]/=i[0]}const c=new Float32Array(32),u=new Float32Array(32),d=t.createBuffer(e.numberOfChannels,e.length,e.sampleRate),f=e.numberOfChannels;for(let t=0;t<f;t+=1){const n=e.getChannelData(t),r=d.getChannelData(t);c.fill(0),u.fill(0),pn(i,a,o,s,l,c,u,0,32,n,r)}return d})(await i(e),u,o,a)})()}const e=await l;return d.buffer=e,d.start(0),d}return await r(c,u,f),f};return{render(e,t){const n=s.get(t);return void 0!==n?Promise.resolve(n):c(e,t)}}})(ii,Nt,Er,br,Yi),Qi=(Xi=Ki,(e,t,n)=>{if(void 0===e.createIIRFilter)return Xi(e,t,n);const r=e.createIIRFilter(n.feedforward,n.feedback);return bn(r,n),r});var Xi;const Zi=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=r(e),l=i(s),c={...hn,...a},u=t(s,l?null:e.baseLatency,c);super(e,!1,u,l?n(c.feedback,c.feedforward):null),fn(u),this._nativeIIRFilterNode=u,o(this,1)}getFrequencyResponse(e,t,n){return this._nativeIIRFilterNode.getFrequencyResponse(e,t,n)}})(jr,Qi,Ji,_r,Cr,hi),$i=((e,t,n,r,i,o,a,s)=>(l,c)=>{const u=c.listener,{forwardX:d,forwardY:f,forwardZ:h,positionX:p,positionY:m,positionZ:g,upX:v,upY:y,upZ:b}=void 0===u.forwardX?(()=>{const d=new Float32Array(1),f=t(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),h=a(c);let p=!1,m=[0,0,-1,0,1,0],g=[0,0,0];const v=()=>{if(p)return;p=!0;const e=r(c,256,9,0);e.onaudioprocess=({inputBuffer:e})=>{const t=[o(e,d,0),o(e,d,1),o(e,d,2),o(e,d,3),o(e,d,4),o(e,d,5)];t.some(((e,t)=>e!==m[t]))&&(u.setOrientation(...t),m=t);const n=[o(e,d,6),o(e,d,7),o(e,d,8)];n.some(((e,t)=>e!==g[t]))&&(u.setPosition(...n),g=n)},f.connect(e)},y=e=>t=>{t!==m[e]&&(m[e]=t,u.setOrientation(...m))},b=e=>t=>{t!==g[e]&&(g[e]=t,u.setPosition(...g))},w=(t,r,o)=>{const a=n(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:r});a.connect(f,0,t),a.start(),Object.defineProperty(a.offset,"defaultValue",{get:()=>r});const u=e({context:l},h,a.offset,lt,st);var d,p,m,g,y,b,w;return s(u,"value",(e=>()=>e.call(u)),(e=>t=>{try{e.call(u,t)}catch(e){if(9!==e.code)throw e}v(),h&&o(t)})),u.cancelAndHoldAtTime=(d=u.cancelAndHoldAtTime,h?()=>{throw i()}:(...e)=>{const t=d.apply(u,e);return v(),t}),u.cancelScheduledValues=(p=u.cancelScheduledValues,h?()=>{throw i()}:(...e)=>{const t=p.apply(u,e);return v(),t}),u.exponentialRampToValueAtTime=(m=u.exponentialRampToValueAtTime,h?()=>{throw i()}:(...e)=>{const t=m.apply(u,e);return v(),t}),u.linearRampToValueAtTime=(g=u.linearRampToValueAtTime,h?()=>{throw i()}:(...e)=>{const t=g.apply(u,e);return v(),t}),u.setTargetAtTime=(y=u.setTargetAtTime,h?()=>{throw i()}:(...e)=>{const t=y.apply(u,e);return v(),t}),u.setValueAtTime=(b=u.setValueAtTime,h?()=>{throw i()}:(...e)=>{const t=b.apply(u,e);return v(),t}),u.setValueCurveAtTime=(w=u.setValueCurveAtTime,h?()=>{throw i()}:(...e)=>{const t=w.apply(u,e);return v(),t}),u};return{forwardX:w(0,0,y(0)),forwardY:w(1,0,y(1)),forwardZ:w(2,-1,y(2)),positionX:w(6,0,b(0)),positionY:w(7,0,b(1)),positionZ:w(8,0,b(2)),upX:w(3,0,y(3)),upY:w(4,1,y(4)),upZ:w(5,0,y(5))}})():u;return{get forwardX(){return d},get forwardY(){return f},get forwardZ(){return h},get positionX(){return p},get positionY(){return m},get positionZ(){return g},get upX(){return v},get upY(){return y},get upZ(){return b}}})(li,Ci,Pi,jn,Fn,Kn,Cr,Jn),eo=new WeakMap,to=((e,t,n,r,i,o)=>class extends n{constructor(n,o){super(n),this._nativeContext=n,De.set(this,n),r(n)&&i.set(n,new Set),this._destination=new e(this,o),this._listener=t(this,n),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(e){const t="function"==typeof e?o(this,e):null;this._nativeContext.onstatechange=t;const n=this._nativeContext.onstatechange;this._onstatechange=null!==n&&n===t?e:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}})(di,$i,Ir,Cr,eo,tr),no=((e,t,n,r,i,o)=>(a,s)=>{const l=a.createOscillator();return bn(l,s),xn(l,s,"detune"),xn(l,s,"frequency"),void 0!==s.periodicWave?l.setPeriodicWave(s.periodicWave):yn(l,s,"type"),t(n,(()=>n(a)))||Mn(l),t(r,(()=>r(a)))||o(l,a),t(i,(()=>i(a)))||_n(l),e(a,l),l})(Qr,ur,Xn,Zn,$n,er),ro=((e,t,n,r,i)=>()=>{const o=new WeakMap;let a=null,s=null,l=null;return{set periodicWave(e){a=e},set start(e){s=e},set stop(e){l=e},render(c,u){const d=o.get(u);return void 0!==d?Promise.resolve(d):(async(c,u)=>{let d=n(c);const f=nt(d,u);if(!f){const e={channelCount:d.channelCount,channelCountMode:d.channelCountMode,channelInterpretation:d.channelInterpretation,detune:d.detune.value,frequency:d.frequency.value,periodicWave:null===a?void 0:a,type:d.type};d=t(u,e),null!==s&&d.start(s),null!==l&&d.stop(l)}return o.set(u,d),f?(await e(u,c.detune,d.detune),await e(u,c.frequency,d.frequency)):(await r(u,c.detune,d.detune),await r(u,c.frequency,d.frequency)),await i(c,u,d),d})(c,u)}}})(ni,no,Nt,ai,br),io=((e,t,n,r,i,o,a)=>class extends e{constructor(e,a){const s=i(e),l={...zn,...a},c=n(s,l),u=o(s),d=u?r():null,f=e.sampleRate/2;super(e,!1,c,d),this._detune=t(this,u,c.detune,153600,-153600),this._frequency=t(this,u,c.frequency,f,-f),this._nativeOscillatorNode=c,this._onended=null,this._oscillatorNodeRenderer=d,null!==this._oscillatorNodeRenderer&&void 0!==l.periodicWave&&(this._oscillatorNodeRenderer.periodicWave=l.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(e){const t="function"==typeof e?a(this,e):null;this._nativeOscillatorNode.onended=t;const n=this._nativeOscillatorNode.onended;this._onended=null!==n&&n===t?e:n}get type(){return this._nativeOscillatorNode.type}set type(e){this._nativeOscillatorNode.type=e,null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(e){this._nativeOscillatorNode.setPeriodicWave(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=e)}start(e=0){if(this._nativeOscillatorNode.start(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=e),"closed"!==this.context.state){Xe(this);const e=()=>{this._nativeOscillatorNode.removeEventListener("ended",e),ct(this)&&$e(this)};this._nativeOscillatorNode.addEventListener("ended",e)}}stop(e=0){this._nativeOscillatorNode.stop(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=e)}})(jr,li,no,ro,_r,Cr,tr),oo=(ao=ii,(e,t)=>{const n=ao(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),r=e.createBuffer(1,2,44100);return n.buffer=r,n.loop=!0,n.connect(t),n.start(),()=>{n.stop(),n.disconnect(t)}});var ao;const so=((e,t,n,r,i)=>(o,{curve:a,oversample:s,...l})=>{const c=o.createWaveShaper(),u=o.createWaveShaper();bn(c,l),bn(u,l);const d=n(o,{...l,gain:1}),f=n(o,{...l,gain:-1}),h=n(o,{...l,gain:1}),p=n(o,{...l,gain:-1});let m=null,g=!1,v=null;const y={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(e){d.channelCount=e,f.channelCount=e,c.channelCount=e,h.channelCount=e,u.channelCount=e,p.channelCount=e},get channelCountMode(){return c.channelCountMode},set channelCountMode(e){d.channelCountMode=e,f.channelCountMode=e,c.channelCountMode=e,h.channelCountMode=e,u.channelCountMode=e,p.channelCountMode=e},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(e){d.channelInterpretation=e,f.channelInterpretation=e,c.channelInterpretation=e,h.channelInterpretation=e,u.channelInterpretation=e,p.channelInterpretation=e},get context(){return c.context},get curve(){return v},set curve(n){if(null!==n&&n.length<2)throw t();if(null===n)c.curve=n,u.curve=n;else{const e=n.length,t=new Float32Array(e+2-e%2),r=new Float32Array(e+2-e%2);t[0]=n[0],r[0]=-n[e-1];const i=Math.ceil((e+1)/2),o=(e+1)/2-1;for(let a=1;a<i;a+=1){const s=a/i*o,l=Math.floor(s),c=Math.ceil(s);t[a]=l===c?n[l]:(1-(s-l))*n[l]+(1-(c-s))*n[c],r[a]=l===c?-n[e-1-l]:-(1-(s-l))*n[e-1-l]-(1-(c-s))*n[e-1-c]}t[i]=e%2==1?n[i-1]:(n[i-2]+n[i-1])/2,c.curve=t,u.curve=r}v=n,g&&(r(v)&&null===m?m=e(o,d):null!==m&&(m(),m=null))},get inputs(){return[d]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get oversample(){return c.oversample},set oversample(e){c.oversample=e,u.oversample=e},addEventListener:(...e)=>d.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>d.dispatchEvent(e[0]),removeEventListener:(...e)=>d.removeEventListener(e[0],e[1],e[2])};null!==a&&(y.curve=a instanceof Float32Array?a:new Float32Array(a)),s!==y.oversample&&(y.oversample=s);return i(Pn(y,h),(()=>{d.connect(c).connect(h),d.connect(f).connect(u).connect(p).connect(h),g=!0,r(v)&&(m=e(o,d))}),(()=>{d.disconnect(c),c.disconnect(h),d.disconnect(f),f.disconnect(u),u.disconnect(p),p.disconnect(h),g=!1,null!==m&&(m(),m=null)}))})(oo,un,Ln,Yn,Mi),lo=((e,t,n,r,i,o,a)=>(s,l)=>{const c=s.createWaveShaper();if(null!==o&&"webkitAudioContext"===o.name&&void 0===s.createGain().gain.automationRate)return n(s,l);bn(c,l);const u=null===l.curve||l.curve instanceof Float32Array?l.curve:new Float32Array(l.curve);if(null!==u&&u.length<2)throw t();yn(c,{curve:u},"curve"),yn(c,l,"oversample");let d=null,f=!1;a(c,"curve",(e=>()=>e.call(c)),(t=>n=>(t.call(c,n),f&&(r(n)&&null===d?d=e(s,c):r(n)||null===d||(d(),d=null)),n)));return i(c,(()=>{f=!0,r(c.curve)&&(d=e(s,c))}),(()=>{f=!1,null!==d&&(d(),d=null)}))})(oo,un,so,Yn,Mi,Rr,Jn),co=((e,t,n,r,i,o,a,s,l,c)=>(u,{coneInnerAngle:d,coneOuterAngle:f,coneOuterGain:h,distanceModel:p,maxDistance:m,orientationX:g,orientationY:v,orientationZ:y,panningModel:b,positionX:w,positionY:x,positionZ:S,refDistance:M,rolloffFactor:_,...A})=>{const E=u.createPanner();if(A.channelCount>2)throw a();if("max"===A.channelCountMode)throw a();bn(E,A);const C={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},k=n(u,{...C,channelInterpretation:"speakers",numberOfInputs:6}),T=r(u,{...A,gain:1}),I=r(u,{...C,gain:1}),O=r(u,{...C,gain:0}),R=r(u,{...C,gain:0}),P=r(u,{...C,gain:0}),N=r(u,{...C,gain:0}),L=r(u,{...C,gain:0}),D=i(u,256,6,1),B=o(u,{...C,curve:new Float32Array([1,1]),oversample:"none"});let j=[g,v,y],F=[w,x,S];const U=new Float32Array(1);D.onaudioprocess=({inputBuffer:e})=>{const t=[l(e,U,0),l(e,U,1),l(e,U,2)];t.some(((e,t)=>e!==j[t]))&&(E.setOrientation(...t),j=t);const n=[l(e,U,3),l(e,U,4),l(e,U,5)];n.some(((e,t)=>e!==F[t]))&&(E.setPosition(...n),F=n)},Object.defineProperty(O.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(P.gain,"defaultValue",{get:()=>0}),Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(L.gain,"defaultValue",{get:()=>0});const z={get bufferSize(){},get channelCount(){return E.channelCount},set channelCount(e){if(e>2)throw a();T.channelCount=e,E.channelCount=e},get channelCountMode(){return E.channelCountMode},set channelCountMode(e){if("max"===e)throw a();T.channelCountMode=e,E.channelCountMode=e},get channelInterpretation(){return E.channelInterpretation},set channelInterpretation(e){T.channelInterpretation=e,E.channelInterpretation=e},get coneInnerAngle(){return E.coneInnerAngle},set coneInnerAngle(e){E.coneInnerAngle=e},get coneOuterAngle(){return E.coneOuterAngle},set coneOuterAngle(e){E.coneOuterAngle=e},get coneOuterGain(){return E.coneOuterGain},set coneOuterGain(e){if(e<0||e>1)throw t();E.coneOuterGain=e},get context(){return E.context},get distanceModel(){return E.distanceModel},set distanceModel(e){E.distanceModel=e},get inputs(){return[T]},get maxDistance(){return E.maxDistance},set maxDistance(e){if(e<0)throw new RangeError;E.maxDistance=e},get numberOfInputs(){return E.numberOfInputs},get numberOfOutputs(){return E.numberOfOutputs},get orientationX(){return I.gain},get orientationY(){return O.gain},get orientationZ(){return R.gain},get panningModel(){return E.panningModel},set panningModel(e){E.panningModel=e},get positionX(){return P.gain},get positionY(){return N.gain},get positionZ(){return L.gain},get refDistance(){return E.refDistance},set refDistance(e){if(e<0)throw new RangeError;E.refDistance=e},get rolloffFactor(){return E.rolloffFactor},set rolloffFactor(e){if(e<0)throw new RangeError;E.rolloffFactor=e},addEventListener:(...e)=>T.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>T.dispatchEvent(e[0]),removeEventListener:(...e)=>T.removeEventListener(e[0],e[1],e[2])};d!==z.coneInnerAngle&&(z.coneInnerAngle=d),f!==z.coneOuterAngle&&(z.coneOuterAngle=f),h!==z.coneOuterGain&&(z.coneOuterGain=h),p!==z.distanceModel&&(z.distanceModel=p),m!==z.maxDistance&&(z.maxDistance=m),g!==z.orientationX.value&&(z.orientationX.value=g),v!==z.orientationY.value&&(z.orientationY.value=v),y!==z.orientationZ.value&&(z.orientationZ.value=y),b!==z.panningModel&&(z.panningModel=b),w!==z.positionX.value&&(z.positionX.value=w),x!==z.positionY.value&&(z.positionY.value=x),S!==z.positionZ.value&&(z.positionZ.value=S),M!==z.refDistance&&(z.refDistance=M),_!==z.rolloffFactor&&(z.rolloffFactor=_),1===j[0]&&0===j[1]&&0===j[2]||E.setOrientation(...j),0===F[0]&&0===F[1]&&0===F[2]||E.setPosition(...F);return c(Pn(z,E),(()=>{T.connect(E),e(T,B,0,0),B.connect(I).connect(k,0,0),B.connect(O).connect(k,0,1),B.connect(R).connect(k,0,2),B.connect(P).connect(k,0,3),B.connect(N).connect(k,0,4),B.connect(L).connect(k,0,5),k.connect(D).connect(u.destination)}),(()=>{T.disconnect(E),s(T,B,0,0),B.disconnect(I),I.disconnect(k),B.disconnect(O),O.disconnect(k),B.disconnect(R),R.disconnect(k),B.disconnect(P),P.disconnect(k),B.disconnect(N),N.disconnect(k),B.disconnect(L),L.disconnect(k),k.disconnect(D),D.disconnect(u.destination)}))})(kt,un,Ci,Ln,jn,lo,Fn,Pt,Kn,Mi),uo=(fo=co,(e,t)=>{const n=e.createPanner();return void 0===n.orientationX?fo(e,t):(bn(n,t),xn(n,t,"orientationX"),xn(n,t,"orientationY"),xn(n,t,"orientationZ"),xn(n,t,"positionX"),xn(n,t,"positionY"),xn(n,t,"positionZ"),yn(n,t,"coneInnerAngle"),yn(n,t,"coneOuterAngle"),yn(n,t,"coneOuterGain"),yn(n,t,"distanceModel"),yn(n,t,"maxDistance"),yn(n,t,"panningModel"),yn(n,t,"refDistance"),yn(n,t,"rolloffFactor"),n)});var fo;const ho=((e,t,n,r,i,o,a,s,l,c)=>()=>{const u=new WeakMap;let d=null;return{render(f,h){const p=u.get(h);return void 0!==p?Promise.resolve(p):(async(f,h)=>{let p=null,m=o(f);const g={channelCount:m.channelCount,channelCountMode:m.channelCountMode,channelInterpretation:m.channelInterpretation},v={...g,coneInnerAngle:m.coneInnerAngle,coneOuterAngle:m.coneOuterAngle,coneOuterGain:m.coneOuterGain,distanceModel:m.distanceModel,maxDistance:m.maxDistance,panningModel:m.panningModel,refDistance:m.refDistance,rolloffFactor:m.rolloffFactor},y=nt(m,h);if("bufferSize"in m)p=r(h,{...g,gain:1});else if(!y){const e={...v,orientationX:m.orientationX.value,orientationY:m.orientationY.value,orientationZ:m.orientationZ.value,positionX:m.positionX.value,positionY:m.positionY.value,positionZ:m.positionZ.value};m=i(h,e)}if(u.set(h,null===p?m:p),null!==p){if(null===d){if(null===a)throw new Error("Missing the native OfflineAudioContext constructor.");const e=new a(6,f.context.length,h.sampleRate),r=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});r.connect(e.destination),d=(async()=>{const t=await Promise.all([f.orientationX,f.orientationY,f.orientationZ,f.positionX,f.positionY,f.positionZ].map((async(t,r)=>{const i=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===r?1:0});return await s(e,t,i.offset),i})));for(let e=0;e<6;e+=1)t[e].connect(r,0,e),t[e].start(0);return c(e)})()}const e=await d,o=r(h,{...g,gain:1});await l(f,h,o);const u=[];for(let t=0;t<e.numberOfChannels;t+=1)u.push(e.getChannelData(t));let m=[u[0][0],u[1][0],u[2][0]],y=[u[3][0],u[4][0],u[5][0]],b=r(h,{...g,gain:1}),w=i(h,{...v,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:y[0],positionY:y[1],positionZ:y[2]});o.connect(b).connect(w.inputs[0]),w.connect(p);for(let t=128;t<e.length;t+=128){const e=[u[0][t],u[1][t],u[2][t]],n=[u[3][t],u[4][t],u[5][t]];if(e.some(((e,t)=>e!==m[t]))||n.some(((e,t)=>e!==y[t]))){m=e,y=n;const a=t/h.sampleRate;b.gain.setValueAtTime(0,a),b=r(h,{...g,gain:0}),w=i(h,{...v,orientationX:m[0],orientationY:m[1],orientationZ:m[2],positionX:y[0],positionY:y[1],positionZ:y[2]}),b.gain.setValueAtTime(1,a),o.connect(b).connect(w.inputs[0]),w.connect(p)}}return p}return y?(await e(h,f.orientationX,m.orientationX),await e(h,f.orientationY,m.orientationY),await e(h,f.orientationZ,m.orientationZ),await e(h,f.positionX,m.positionX),await e(h,f.positionY,m.positionY),await e(h,f.positionZ,m.positionZ)):(await s(h,f.orientationX,m.orientationX),await s(h,f.orientationY,m.orientationY),await s(h,f.orientationZ,m.orientationZ),await s(h,f.positionX,m.positionX),await s(h,f.positionY,m.positionY),await s(h,f.positionZ,m.positionZ)),Ct(m)?await l(f,h,m.inputs[0]):await l(f,h,m),m})(f,h)}}})(ni,Ci,Pi,Ln,uo,Nt,Er,ai,br,Yi),po=((e,t,n,r,i,o,a)=>class extends e{constructor(e,s){const l=i(e),c={...Hn,...s},u=n(l,c),d=o(l);super(e,!1,u,d?r():null),this._nativePannerNode=u,this._orientationX=t(this,d,u.orientationX,lt,st),this._orientationY=t(this,d,u.orientationY,lt,st),this._orientationZ=t(this,d,u.orientationZ,lt,st),this._positionX=t(this,d,u.positionX,lt,st),this._positionY=t(this,d,u.positionY,lt,st),this._positionZ=t(this,d,u.positionZ,lt,st),a(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(e){this._nativePannerNode.coneInnerAngle=e}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(e){this._nativePannerNode.coneOuterAngle=e}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(e){this._nativePannerNode.coneOuterGain=e}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(e){this._nativePannerNode.distanceModel=e}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(e){this._nativePannerNode.maxDistance=e}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(e){this._nativePannerNode.panningModel=e}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(e){this._nativePannerNode.refDistance=e}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(e){this._nativePannerNode.rolloffFactor=e}})(jr,li,uo,ho,_r,Cr,hi),mo=(e=>(t,{disableNormalization:n,imag:r,real:i})=>{const o=r instanceof Float32Array?r:new Float32Array(r),a=i instanceof Float32Array?i:new Float32Array(i),s=t.createPeriodicWave(a,o,{disableNormalization:n});if(Array.from(r).length<2)throw e();return s})(it),go=((e,t,n,r)=>class i{constructor(i,o){const a=t(i),s=r({...Vn,...o}),l=e(a,s);return n.add(l),l}static[Symbol.hasInstance](e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===i.prototype||n.has(e)}})(mo,_r,new WeakSet,(e=>{const{imag:t,real:n}=e;return void 0===t?void 0===n?{...e,imag:[0,0],real:[0,0]}:{...e,imag:Array.from(n,(()=>0)),real:n}:void 0===n?{...e,imag:t,real:Array.from(t,(()=>0))}:{...e,imag:t,real:n}})),vo=((e,t,n,r,i,o)=>{const a=16385,s=new Float32Array([1,1]),l=Math.PI/2,c={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},u={...c,oversample:"none"},d=(e,o,d,f,h)=>{if(1===o)return((e,t,i,o)=>{const d=new Float32Array(a),f=new Float32Array(a);for(let e=0;e<a;e+=1){const t=e/16384*l;d[e]=Math.cos(t),f[e]=Math.sin(t)}const h=n(e,{...c,gain:0}),p=r(e,{...u,curve:d}),m=r(e,{...u,curve:s}),g=n(e,{...c,gain:0}),v=r(e,{...u,curve:f});return{connectGraph(){t.connect(h),t.connect(void 0===m.inputs?m:m.inputs[0]),t.connect(g),m.connect(i),i.connect(void 0===p.inputs?p:p.inputs[0]),i.connect(void 0===v.inputs?v:v.inputs[0]),p.connect(h.gain),v.connect(g.gain),h.connect(o,0,0),g.connect(o,0,1)},disconnectGraph(){t.disconnect(h),t.disconnect(void 0===m.inputs?m:m.inputs[0]),t.disconnect(g),m.disconnect(i),i.disconnect(void 0===p.inputs?p:p.inputs[0]),i.disconnect(void 0===v.inputs?v:v.inputs[0]),p.disconnect(h.gain),v.disconnect(g.gain),h.disconnect(o,0,0),g.disconnect(o,0,1)}}})(e,d,f,h);if(2===o)return((e,i,o,d)=>{const f=new Float32Array(a),h=new Float32Array(a),p=new Float32Array(a),m=new Float32Array(a),g=Math.floor(8192.5);for(let e=0;e<a;e+=1)if(e>g){const t=(e-g)/(16384-g)*l;f[e]=Math.cos(t),h[e]=Math.sin(t),p[e]=0,m[e]=1}else{const t=e/(16384-g)*l;f[e]=1,h[e]=0,p[e]=Math.cos(t),m[e]=Math.sin(t)}const v=t(e,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),y=n(e,{...c,gain:0}),b=r(e,{...u,curve:f}),w=n(e,{...c,gain:0}),x=r(e,{...u,curve:h}),S=r(e,{...u,curve:s}),M=n(e,{...c,gain:0}),_=r(e,{...u,curve:p}),A=n(e,{...c,gain:0}),E=r(e,{...u,curve:m});return{connectGraph(){i.connect(v),i.connect(void 0===S.inputs?S:S.inputs[0]),v.connect(y,0),v.connect(w,0),v.connect(M,1),v.connect(A,1),S.connect(o),o.connect(void 0===b.inputs?b:b.inputs[0]),o.connect(void 0===x.inputs?x:x.inputs[0]),o.connect(void 0===_.inputs?_:_.inputs[0]),o.connect(void 0===E.inputs?E:E.inputs[0]),b.connect(y.gain),x.connect(w.gain),_.connect(M.gain),E.connect(A.gain),y.connect(d,0,0),M.connect(d,0,0),w.connect(d,0,1),A.connect(d,0,1)},disconnectGraph(){i.disconnect(v),i.disconnect(void 0===S.inputs?S:S.inputs[0]),v.disconnect(y,0),v.disconnect(w,0),v.disconnect(M,1),v.disconnect(A,1),S.disconnect(o),o.disconnect(void 0===b.inputs?b:b.inputs[0]),o.disconnect(void 0===x.inputs?x:x.inputs[0]),o.disconnect(void 0===_.inputs?_:_.inputs[0]),o.disconnect(void 0===E.inputs?E:E.inputs[0]),b.disconnect(y.gain),x.disconnect(w.gain),_.disconnect(M.gain),E.disconnect(A.gain),y.disconnect(d,0,0),M.disconnect(d,0,0),w.disconnect(d,0,1),A.disconnect(d,0,1)}}})(e,d,f,h);throw i()};return(t,{channelCount:r,channelCountMode:a,pan:s,...l})=>{if("max"===a)throw i();const c=e(t,{...l,channelCount:1,channelCountMode:a,numberOfInputs:2}),u=n(t,{...l,channelCount:r,channelCountMode:a,gain:1}),f=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:s});let{connectGraph:h,disconnectGraph:p}=d(t,r,u,f,c);Object.defineProperty(f.gain,"defaultValue",{get:()=>0}),Object.defineProperty(f.gain,"maxValue",{get:()=>1}),Object.defineProperty(f.gain,"minValue",{get:()=>-1});const m={get bufferSize(){},get channelCount(){return u.channelCount},set channelCount(e){u.channelCount!==e&&(g&&p(),({connectGraph:h,disconnectGraph:p}=d(t,e,u,f,c)),g&&h()),u.channelCount=e},get channelCountMode(){return u.channelCountMode},set channelCountMode(e){if("clamped-max"===e||"max"===e)throw i();u.channelCountMode=e},get channelInterpretation(){return u.channelInterpretation},set channelInterpretation(e){u.channelInterpretation=e},get context(){return u.context},get inputs(){return[u]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return u.numberOfOutputs},get pan(){return f.gain},addEventListener:(...e)=>u.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>u.dispatchEvent(e[0]),removeEventListener:(...e)=>u.removeEventListener(e[0],e[1],e[2])};let g=!1;return o(Pn(m,c),(()=>{h(),g=!0}),(()=>{p(),g=!1}))}})(Ci,Rn,Ln,lo,Fn,Mi),yo=((e,t)=>(n,r)=>{const i=r.channelCountMode;if("clamped-max"===i)throw t();if(void 0===n.createStereoPanner)return e(n,r);const o=n.createStereoPanner();return bn(o,r),xn(o,r,"pan"),Object.defineProperty(o,"channelCountMode",{get:()=>i,set:e=>{if(e!==i)throw t()}}),o})(vo,Fn),bo=((e,t,n,r,i)=>()=>{const o=new WeakMap;return{render(a,s){const l=o.get(s);return void 0!==l?Promise.resolve(l):(async(a,s)=>{let l=n(a);const c=nt(l,s);if(!c){const e={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,pan:l.pan.value};l=t(s,e)}return o.set(s,l),c?await e(s,a.pan,l.pan):await r(s,a.pan,l.pan),Ct(l)?await i(a,s,l.inputs[0]):await i(a,s,l),l})(a,s)}}})(ni,yo,Nt,ai,br),wo=((e,t,n,r,i,o)=>class extends e{constructor(e,a){const s=i(e),l={...Wn,...a},c=n(s,l),u=o(s);super(e,!1,c,u?r():null),this._pan=t(this,u,c.pan)}get pan(){return this._pan}})(jr,li,yo,bo,_r,Cr),xo=((e,t,n)=>()=>{const r=new WeakMap;return{render(i,o){const a=r.get(o);return void 0!==a?Promise.resolve(a):(async(i,o)=>{let a=t(i);if(!nt(a,o)){const t={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,curve:a.curve,oversample:a.oversample};a=e(o,t)}return r.set(o,a),Ct(a)?await n(i,o,a.inputs[0]):await n(i,o,a),a})(i,o)}}})(lo,Nt,br),So=((e,t,n,r,i,o,a)=>class extends e{constructor(e,t){const s=i(e),l={...qn,...t},c=n(s,l);super(e,!0,c,o(s)?r():null),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,a(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(e){if(null===e)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(e.length<2)throw t();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=e}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(e){this._nativeWaveShaperNode.oversample=e}})(jr,un,lo,xo,_r,Cr,hi),Mo=(e=>null!==e&&e.isSecureContext)(hr),_o=(e=>(t,n,r)=>{Object.defineProperties(e,{currentFrame:{configurable:!0,get:()=>Math.round(t*n)},currentTime:{configurable:!0,get:()=>t}});try{return r()}finally{null!==e&&(delete e.currentFrame,delete e.currentTime)}})(hr),Ao=new WeakMap,Eo=((e,t)=>n=>{let r=e.get(n);if(void 0!==r)return r;if(null===t)throw new Error("Missing the native OfflineAudioContext constructor.");return r=new t(1,1,44100),e.set(n,r),r})(Ao,Er),Co=Mo?((e,t,n,r,i,o,a,s,l,c,u,d,f)=>{let h=0;return(p,m,g={credentials:"omit"})=>{const v=u.get(p);if(void 0!==v&&v.has(m))return Promise.resolve();const y=c.get(p);if(void 0!==y){const e=y.get(m);if(void 0!==e)return e}const b=o(p),w=void 0===b.audioWorklet?i(m).then((([e,t])=>{const[r,i]=We(e,t);return n(`${r};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}\n})})(window,'_AWGS')`)})).then((()=>{const e=f._AWGS.pop();if(void 0===e)throw new SyntaxError;r(b.currentTime,b.sampleRate,(()=>e(class{},void 0,((e,n)=>{if(""===e.trim())throw t();const r=Fe.get(b);if(void 0!==r){if(r.has(e))throw t();qe(n),Ge(n.parameterDescriptors),r.set(e,n)}else qe(n),Ge(n.parameterDescriptors),Fe.set(b,new Map([[e,n]]))}),b.sampleRate,void 0,void 0)))})):Promise.all([i(m),Promise.resolve(e(d,d))]).then((([[e,t],n])=>{const r=h+1;h=r;const[i,o]=We(e,t),c=new Blob([`${i};((AudioWorkletProcessor,registerProcessor)=>{${o}\n})(${n?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${n?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${r}',class extends AudioWorkletProcessor{process(){return !1}})`],{type:"application/javascript; charset=utf-8"}),u=URL.createObjectURL(c);return b.audioWorklet.addModule(u,g).then((()=>{if(s(b))return b;const e=a(b);return e.audioWorklet.addModule(u,g).then((()=>e))})).then((e=>{if(null===l)throw new SyntaxError;try{new l(e,`__sac${r}`)}catch{throw new SyntaxError}})).finally((()=>URL.revokeObjectURL(u)))}));return void 0===y?c.set(p,new Map([[m,w]])):y.set(m,w),w.then((()=>{const e=u.get(p);void 0===e?u.set(p,new Set([m])):e.add(m)})).finally((()=>{const e=c.get(p);void 0!==e&&e.delete(m)})),w}})(ur,Fn,(e=>t=>new Promise(((n,r)=>{if(null===e)return void r(new SyntaxError);const i=e.document.head;if(null===i)r(new SyntaxError);else{const o=e.document.createElement("script"),a=new Blob([t],{type:"application/javascript"}),s=URL.createObjectURL(a),l=e.onerror,c=()=>{e.onerror=l,URL.revokeObjectURL(s)};e.onerror=(t,n,i,o,a)=>n===s||n===e.location.href&&1===i&&1===o?(c(),r(a),!1):null!==l?l(t,n,i,o,a):void 0,o.onerror=()=>{c(),r(new SyntaxError)},o.onload=()=>{c(),n()},o.src=s,o.type="module",i.appendChild(o)}})))(hr),_o,(ko=()=>new DOMException("","AbortError"),async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw ko()}),_r,Eo,Cr,Br,new WeakMap,new WeakMap,((e,t)=>async()=>{if(null===e)return!0;if(null===t)return!1;const n=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),r=new t(1,128,44100),i=URL.createObjectURL(n);let o=!1,a=!1;try{await r.audioWorklet.addModule(i);const t=new e(r,"a",{numberOfOutputs:0}),n=r.createOscillator();t.port.onmessage=()=>o=!0,t.onprocessorerror=()=>a=!0,n.connect(t),n.start(0),await r.startRendering()}catch{}finally{URL.revokeObjectURL(i)}return o&&!a})(Br,Er),hr):void 0;var ko;const To=((e,t)=>n=>e(n)||t(n))(Pr,Cr),Io=((e,t,n,r,i,o,a,s,l,c,u)=>(d,f)=>{const h=a(d)?d:o(d);if(i.has(f)){const e=n();return Promise.reject(e)}try{i.add(f)}catch{}return t(l,(()=>l(h)))?h.decodeAudioData(f).then((n=>(rn(f).catch((()=>{})),t(s,(()=>s(n)))||u(n),e.add(n),n))):new Promise(((t,n)=>{const i=async()=>{try{await rn(f)}catch{}},o=e=>{n(e),i()};try{h.decodeAudioData(f,(n=>{"function"!=typeof n.copyFromChannel&&(c(n),ot(n)),e.add(n),i().then((()=>t(n)))}),(e=>{o(null===e?r():e)}))}catch(e){o(e)}}))})(zr,ur,(()=>new DOMException("","DataCloneError")),(()=>new DOMException("","EncodingError")),new WeakSet,_r,To,rt,gn,Gr,qr),Oo=(Ro=Co,Po=Ur,No=Yr,Lo=ui,Do=pi,Bo=Ti,jo=Oi,Fo=Li,Uo=ji,zo=Io,Ho=Ui,Vo=Wi,Wo=qi,Go=Zi,qo=to,Ko=io,Yo=po,Jo=go,Qo=wo,Xo=So,class extends qo{constructor(e,t){super(e,t),this._nativeContext=e,this._audioWorklet=void 0===Ro?void 0:{addModule:(e,t)=>Ro(this,e,t)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new Po(this)}createBiquadFilter(){return new Do(this)}createBuffer(e,t,n){return new No({length:t,numberOfChannels:e,sampleRate:n})}createBufferSource(){return new Lo(this)}createChannelMerger(e=6){return new Bo(this,{numberOfInputs:e})}createChannelSplitter(e=6){return new jo(this,{numberOfOutputs:e})}createConstantSource(){return new Fo(this)}createConvolver(){return new Uo(this)}createDelay(e=1){return new Ho(this,{maxDelayTime:e})}createDynamicsCompressor(){return new Vo(this)}createGain(){return new Wo(this)}createIIRFilter(e,t){return new Go(this,{feedback:t,feedforward:e})}createOscillator(){return new Ko(this)}createPanner(){return new Yo(this)}createPeriodicWave(e,t,n={disableNormalization:!1}){return new Jo(this,{...n,imag:t,real:e})}createStereoPanner(){return new Qo(this)}createWaveShaper(){return new Xo(this)}decodeAudioData(e,t,n){return zo(this._nativeContext,e).then((e=>("function"==typeof t&&t(e),e)),(e=>{throw"function"==typeof n&&n(e),e}))}});var Ro,Po,No,Lo,Do,Bo,jo,Fo,Uo,zo,Ho,Vo,Wo,Go,qo,Ko,Yo,Jo,Qo,Xo;const Zo=((e,t,n,r)=>class extends e{constructor(e,i){const o=n(e),a=t(o,i);if(r(o))throw TypeError();super(e,!0,a,null),this._nativeMediaElementAudioSourceNode=a}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}})(jr,((e,t)=>e.createMediaElementSource(t.mediaElement)),_r,Cr),$o=((e,t,n,r)=>class extends e{constructor(e,i){const o=n(e);if(r(o))throw new TypeError;const a={...mn,...i},s=t(o,a);super(e,!1,s,null),this._nativeMediaStreamAudioDestinationNode=s}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(jr,((e,t)=>{const n=e.createMediaStreamDestination();return bn(n,t),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n}),_r,Cr),ea=((e,t,n,r)=>class extends e{constructor(e,i){const o=n(e),a=t(o,i);if(r(o))throw new TypeError;super(e,!0,a,null),this._nativeMediaStreamAudioSourceNode=a}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}})(jr,((e,{mediaStream:t})=>{const n=t.getAudioTracks();n.sort(((e,t)=>e.id<t.id?-1:e.id>t.id?1:0));const r=n.slice(0,1),i=e.createMediaStreamSource(new MediaStream(r));return Object.defineProperty(i,"mediaStream",{value:t}),i}),_r,Cr),ta=((e,t)=>(n,{mediaStreamTrack:r})=>{if("function"==typeof n.createMediaStreamTrackSource)return n.createMediaStreamTrackSource(r);const i=new MediaStream([r]),o=n.createMediaStreamSource(i);if("audio"!==r.kind)throw e();if(t(n))throw new TypeError;return o})(un,Cr),na=((e,t,n)=>class extends e{constructor(e,r){const i=n(e);super(e,!0,t(i,r),null)}})(jr,ta,_r),ra=((e,t,n,r,i,o,a,s,l)=>class extends e{constructor(e={}){if(null===l)throw new Error("Missing the native AudioContext constructor.");let t;try{t=new l(e)}catch(e){if(12===e.code&&"sampleRate is not in range"===e.message)throw n();throw e}if(null===t)throw r();if(!xt(e.latencyHint))throw new TypeError(`The provided value '${e.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(void 0!==e.sampleRate&&t.sampleRate!==e.sampleRate)throw n();super(t,2);const{latencyHint:i}=e,{sampleRate:o}=t;if(this._baseLatency="number"==typeof t.baseLatency?t.baseLatency:"balanced"===i?512/o:"interactive"===i||void 0===i?256/o:"playback"===i?1024/o:128*Math.max(2,Math.min(128,Math.round(i*o/128)))/o,this._nativeAudioContext=t,"webkitAudioContext"===l.name?(this._nativeGainNode=t.createGain(),this._nativeOscillatorNode=t.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(t.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,"running"===t.state){this._state="suspended";const e=()=>{"suspended"===this._state&&(this._state=null),t.removeEventListener("statechange",e)};t.addEventListener("statechange",e)}}get baseLatency(){return this._baseLatency}get state(){return null!==this._state?this._state:this._nativeAudioContext.state}close(){return"closed"===this.state?this._nativeAudioContext.close().then((()=>{throw t()})):("suspended"===this._state&&(this._state=null),this._nativeAudioContext.close().then((()=>{null!==this._nativeGainNode&&null!==this._nativeOscillatorNode&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),wt(this)})))}createMediaElementSource(e){return new i(this,{mediaElement:e})}createMediaStreamDestination(){return new o(this)}createMediaStreamSource(e){return new a(this,{mediaStream:e})}createMediaStreamTrackSource(e){return new s(this,{mediaStreamTrack:e})}resume(){return"suspended"===this._state?new Promise(((e,t)=>{const n=()=>{this._nativeAudioContext.removeEventListener("statechange",n),"running"===this._nativeAudioContext.state?e():this.resume().then(e,t)};this._nativeAudioContext.addEventListener("statechange",n)})):this._nativeAudioContext.resume().catch((e=>{if(void 0===e||15===e.code)throw t();throw e}))}suspend(){return this._nativeAudioContext.suspend().catch((e=>{if(void 0===e)throw t();throw e}))}})(Oo,un,Fn,Gn,Zo,$o,ea,na,Rr),ia=(oa=eo,e=>{const t=oa.get(e);if(void 0===t)throw new Error("The context has no set of AudioWorkletNodes.");return t});var oa;const aa=(sa=ia,(e,t)=>{sa(e).add(t)});var sa;const la=(e=>(t,n,r=0,i=0)=>{const o=t[r];if(void 0===o)throw e();return Ut(n)?o.connect(n,0,i):o.connect(n,0)})(it),ca=(e=>(t,n)=>{e(t).delete(n)})(ia),ua=(e=>(t,n,r,i=0)=>void 0===n?t.forEach((e=>e.disconnect())):"number"==typeof n?sn(e,t,n).disconnect():Ut(n)?void 0===r?t.forEach((e=>e.disconnect(n))):void 0===i?sn(e,t,r).disconnect(n,0):sn(e,t,r).disconnect(n,0,i):void 0===r?t.forEach((e=>e.disconnect(n))):sn(e,t,r).disconnect(n,0))(it),da=new WeakMap,fa=(ha=da,pa=Ke,e=>pa(ha,e));var ha,pa;const ma=((e,t,n,r,i,o,a,s,l,c,u,d,f)=>(h,p,m,g)=>{if(0===g.numberOfInputs&&0===g.numberOfOutputs)throw l();const v=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(v.some((e=>e<1)))throw l();if(v.length!==g.numberOfOutputs)throw t();if("explicit"!==g.channelCountMode)throw l();const y=g.channelCount*g.numberOfInputs,b=v.reduce(((e,t)=>e+t),0),w=void 0===m.parameterDescriptors?0:m.parameterDescriptors.length;if(y+w>6||b>6)throw l();const x=new MessageChannel,S=[],M=[];for(let e=0;e<g.numberOfInputs;e+=1)S.push(a(h,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),M.push(i(h,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const _=[];if(void 0!==m.parameterDescriptors)for(const{defaultValue:e,maxValue:t,minValue:n,name:r}of m.parameterDescriptors){const i=o(h,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:void 0!==g.parameterData[r]?g.parameterData[r]:void 0===e?0:e});Object.defineProperties(i.offset,{defaultValue:{get:()=>void 0===e?0:e},maxValue:{get:()=>void 0===t?lt:t},minValue:{get:()=>void 0===n?st:n}}),_.push(i)}const A=r(h,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,y+w)}),E=En(p,h.sampleRate),C=s(h,E,y+w,Math.max(1,b)),k=i(h,{channelCount:Math.max(1,b),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,b)}),T=[];for(let e=0;e<g.numberOfOutputs;e+=1)T.push(r(h,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:v[e]}));for(let e=0;e<g.numberOfInputs;e+=1){S[e].connect(M[e]);for(let t=0;t<g.channelCount;t+=1)M[e].connect(A,t,e*g.channelCount+t)}const I=new Gt(void 0===m.parameterDescriptors?[]:m.parameterDescriptors.map((({name:e},t)=>{const n=_[t];return n.connect(A,0,y+t),n.start(0),[e,n.offset]})));A.connect(C);let O=g.channelInterpretation,R=null;const P=0===g.numberOfOutputs?[C]:T,N={get bufferSize(){return E},get channelCount(){return g.channelCount},set channelCount(e){throw n()},get channelCountMode(){return g.channelCountMode},set channelCountMode(e){throw n()},get channelInterpretation(){return O},set channelInterpretation(e){for(const t of S)t.channelInterpretation=e;O=e},get context(){return C.context},get inputs(){return S},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},get onprocessorerror(){return R},set onprocessorerror(e){"function"==typeof R&&N.removeEventListener("processorerror",R),R="function"==typeof e?e:null,"function"==typeof R&&N.addEventListener("processorerror",R)},get parameters(){return I},get port(){return x.port2},addEventListener:(...e)=>C.addEventListener(e[0],e[1],e[2]),connect:e.bind(null,P),disconnect:c.bind(null,P),dispatchEvent:(...e)=>C.dispatchEvent(e[0]),removeEventListener:(...e)=>C.removeEventListener(e[0],e[1],e[2])},L=new Map;var D,B;x.port1.addEventListener=(D=x.port1.addEventListener,(...e)=>{if("message"===e[0]){const t="function"==typeof e[1]?e[1]:"object"==typeof e[1]&&null!==e[1]&&"function"==typeof e[1].handleEvent?e[1].handleEvent:null;if(null!==t){const n=L.get(e[1]);void 0!==n?e[1]=n:(e[1]=e=>{u(h.currentTime,h.sampleRate,(()=>t(e)))},L.set(t,e[1]))}}return D.call(x.port1,e[0],e[1],e[2])}),x.port1.removeEventListener=(B=x.port1.removeEventListener,(...e)=>{if("message"===e[0]){const t=L.get(e[1]);void 0!==t&&(L.delete(e[1]),e[1]=t)}return B.call(x.port1,e[0],e[1],e[2])});let j=null;Object.defineProperty(x.port1,"onmessage",{get:()=>j,set:e=>{"function"==typeof j&&x.port1.removeEventListener("message",j),j="function"==typeof e?e:null,"function"==typeof j&&(x.port1.addEventListener("message",j),x.port1.start())}}),m.prototype.port=x.port1;let F=null;Tn(h,N,m,g).then((e=>F=e));const U=Jt(g.numberOfInputs,g.channelCount),z=Jt(g.numberOfOutputs,v),H=void 0===m.parameterDescriptors?[]:m.parameterDescriptors.reduce(((e,{name:t})=>({...e,[t]:new Float32Array(128)})),{});let V=!0;const W=()=>{g.numberOfOutputs>0&&C.disconnect(k);for(let e=0,t=0;e<g.numberOfOutputs;e+=1){const n=T[e];for(let r=0;r<v[e];r+=1)k.disconnect(n,t+r,r);t+=v[e]}},G=new Map;C.onaudioprocess=({inputBuffer:e,outputBuffer:t})=>{if(null!==F){const n=d(N);for(let r=0;r<E;r+=128){for(let t=0;t<g.numberOfInputs;t+=1)for(let n=0;n<g.channelCount;n+=1)Kt(e,U[t],n,n,r);void 0!==m.parameterDescriptors&&m.parameterDescriptors.forEach((({name:t},n)=>{Kt(e,H,t,y+n,r)}));for(let e=0;e<g.numberOfInputs;e+=1)for(let t=0;t<v[e];t+=1)0===z[e][t].byteLength&&(z[e][t]=new Float32Array(128));try{const e=U.map(((e,t)=>{if(n[t].size>0)return G.set(t,E/128),e;const r=G.get(t);return void 0===r?[]:(e.every((e=>e.every((e=>0===e))))&&(1===r?G.delete(t):G.set(t,r-1)),e)})),i=u(h.currentTime+r/h.sampleRate,h.sampleRate,(()=>F.process(e,z,H)));V=i;for(let e=0,n=0;e<g.numberOfOutputs;e+=1){for(let i=0;i<v[e];i+=1)Yt(t,z[e],i,n+i,r);n+=v[e]}}catch(e){V=!1,N.dispatchEvent(new ErrorEvent("processorerror",{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}))}if(!V){for(let e=0;e<g.numberOfInputs;e+=1){S[e].disconnect(M[e]);for(let t=0;t<g.channelCount;t+=1)M[r].disconnect(A,t,e*g.channelCount+t)}if(void 0!==m.parameterDescriptors){const e=m.parameterDescriptors.length;for(let t=0;t<e;t+=1){const e=_[t];e.disconnect(A,0,y+t),e.stop()}}A.disconnect(C),C.onaudioprocess=null,q?W():J();break}}}};let q=!1;const K=a(h,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),Y=()=>C.connect(K).connect(h.destination),J=()=>{C.disconnect(K),K.disconnect()};return Y(),f(N,(()=>{if(V){J(),g.numberOfOutputs>0&&C.connect(k);for(let e=0,t=0;e<g.numberOfOutputs;e+=1){const n=T[e];for(let r=0;r<v[e];r+=1)k.connect(n,t+r,r);t+=v[e]}}q=!0}),(()=>{V&&(Y(),W()),q=!1}))})(la,it,un,Ci,Rn,Pi,Ln,jn,Fn,ua,_o,fa,Mi),ga=((e,t,n,r,i)=>(o,a,s,l,c,u)=>{if(null!==s)try{const t=new s(o,l,u),r=new Map;let a=null;if(Object.defineProperties(t,{channelCount:{get:()=>u.channelCount,set:()=>{throw e()}},channelCountMode:{get:()=>"explicit",set:()=>{throw e()}},onprocessorerror:{get:()=>a,set:e=>{"function"==typeof a&&t.removeEventListener("processorerror",a),a="function"==typeof e?e:null,"function"==typeof a&&t.addEventListener("processorerror",a)}}}),t.addEventListener=(f=t.addEventListener,(...e)=>{if("processorerror"===e[0]){const t="function"==typeof e[1]?e[1]:"object"==typeof e[1]&&null!==e[1]&&"function"==typeof e[1].handleEvent?e[1].handleEvent:null;if(null!==t){const n=r.get(e[1]);void 0!==n?e[1]=n:(e[1]=n=>{"error"===n.type?(Object.defineProperties(n,{type:{value:"processorerror"}}),t(n)):t(new ErrorEvent(e[0],{...n}))},r.set(t,e[1]))}}return f.call(t,"error",e[1],e[2]),f.call(t,...e)}),t.removeEventListener=(d=t.removeEventListener,(...e)=>{if("processorerror"===e[0]){const t=r.get(e[1]);void 0!==t&&(r.delete(e[1]),e[1]=t)}return d.call(t,"error",e[1],e[2]),d.call(t,e[0],e[1],e[2])}),0!==u.numberOfOutputs){const e=n(o,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});t.connect(e).connect(o.destination);return i(t,(()=>e.disconnect()),(()=>e.connect(o.destination)))}return t}catch(e){if(11===e.code)throw r();throw e}var d,f;if(void 0===c)throw r();return An(u),t(o,a,c,u)})(un,ma,Ln,Fn,Mi),va=((e,t,n,r,i,o,a,s,l,c,u,d,f,h,p,m)=>(g,v,y)=>{const b=new WeakMap;let w=null;return{render(x,S){s(S,x);const M=b.get(S);return void 0!==M?Promise.resolve(M):(async(s,x)=>{let S=u(s),M=null;const _=nt(S,x),A=Array.isArray(v.outputChannelCount)?v.outputChannelCount:Array.from(v.outputChannelCount);if(null===d){const e=A.reduce(((e,t)=>e+t),0),n=i(x,{channelCount:Math.max(1,e),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,e)}),o=[];for(let e=0;e<s.numberOfOutputs;e+=1)o.push(r(x,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:A[e]}));const c=a(x,{channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation,gain:1});c.connect=t.bind(null,o),c.disconnect=l.bind(null,o),M=[n,o,c]}else _||(S=new d(x,g));if(b.set(x,null===M?S:M[2]),null!==M){if(null===w){if(void 0===y)throw new Error("Missing the processor constructor.");if(null===f)throw new Error("Missing the native OfflineAudioContext constructor.");const e=s.channelCount*s.numberOfInputs,t=void 0===y.parameterDescriptors?0:y.parameterDescriptors.length,n=e+t,l=async()=>{const l=new f(n,128*Math.ceil(s.context.length/128),x.sampleRate),c=[],u=[];for(let e=0;e<v.numberOfInputs;e+=1)c.push(a(l,{channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation,gain:1})),u.push(i(l,{channelCount:v.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:v.channelCount}));const d=await Promise.all(Array.from(s.parameters.values()).map((async e=>{const t=o(l,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:e.value});return await h(l,e,t.offset),t}))),g=r(l,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,e+t)});for(let e=0;e<v.numberOfInputs;e+=1){c[e].connect(u[e]);for(let t=0;t<v.channelCount;t+=1)u[e].connect(g,t,e*v.channelCount+t)}for(const[t,n]of d.entries())n.connect(g,0,e+t),n.start(0);return g.connect(l.destination),await Promise.all(c.map((e=>p(s,l,e)))),m(l)};w=Xt(s,0===n?null:await l(),x,v,A,y,c)}const e=await w,t=n(x,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[l,u,d]=M;null!==e&&(t.buffer=e,t.start(0)),t.connect(l);for(let e=0,t=0;e<s.numberOfOutputs;e+=1){const n=u[e];for(let r=0;r<A[e];r+=1)l.connect(n,t+r,r);t+=A[e]}return d}if(_)for(const[t,n]of s.parameters.entries())await e(x,n,S.parameters.get(t));else for(const[e,t]of s.parameters.entries())await h(x,t,S.parameters.get(e));return await p(s,x,S),S})(x,S)}}})(ni,la,ii,Ci,Rn,Pi,Ln,ca,ua,_o,Nt,Br,Er,ai,br,Yi),ya=(ba=Ao,e=>ba.get(e));var ba;const wa=(e=>(t,n)=>{e.set(t,n)})(da),xa=(Mo&&((e,t,n,r,i,o,a,s,l,c,u,d,f,h)=>{})(aa,jr,li,va,ga,vt,ya,_r,Cr,Br,(e=>({...e,outputChannelCount:void 0!==e.outputChannelCount?e.outputChannelCount:1===e.numberOfInputs&&1===e.numberOfOutputs?[e.channelCount]:Array.from({length:e.numberOfOutputs},(()=>1))})),wa,(e=>{const{port1:t,port2:n}=new MessageChannel;try{t.postMessage(e)}finally{t.close(),n.close()}}),tr),((e,t,n,r,i)=>{})(un,Fn,Gn,to,Rr),((e,t)=>(n,r,i)=>{if(null===t)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new t(n,r,i)}catch(t){if("SyntaxError"===t.name)throw e();throw t}})(Fn,Er)),Sa=((e,t,n,r,i,o,a,s)=>(l,c)=>n(l).render(l,c).then((()=>Promise.all(Array.from(r(c)).map((e=>n(e).render(e,c)))))).then((()=>i(c))).then((n=>("function"!=typeof n.copyFromChannel?(a(n),ot(n)):t(o,(()=>o(n)))||s(n),e.add(n),n))))(zr,ur,vr,ia,Yi,rt,Gr,qr);Ma=Pe,_a=Lr;var Ma,_a;Aa=Le,Ea=Dr;var Aa,Ea;var Ca,ka=new Uint8Array(16);function Ta(){if(!Ca&&!(Ca="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ca(ka)}var Ia=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var Oa=function(e){return"string"==typeof e&&Ia.test(e)},Ra=[],Pa=0;Pa<256;++Pa)Ra.push((Pa+256).toString(16).substr(1));var Na=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Ra[e[t+0]]+Ra[e[t+1]]+Ra[e[t+2]]+Ra[e[t+3]]+"-"+Ra[e[t+4]]+Ra[e[t+5]]+"-"+Ra[e[t+6]]+Ra[e[t+7]]+"-"+Ra[e[t+8]]+Ra[e[t+9]]+"-"+Ra[e[t+10]]+Ra[e[t+11]]+Ra[e[t+12]]+Ra[e[t+13]]+Ra[e[t+14]]+Ra[e[t+15]]).toLowerCase();if(!Oa(n))throw TypeError("Stringified UUID is invalid");return n};var La=function(e,t,n){var r=(e=e||{}).random||(e.rng||Ta)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return Na(r)};const Da=()=>La(),Ba=()=>Da().replace(new RegExp("-","g"),"").toUpperCase();var ja,Fa,Ua,za,Ha,Va,Wa,Ga;(Fa=ja||(ja={}))[Fa.Debug=0]="Debug",Fa[Fa.Info=1]="Info",Fa[Fa.Warning=2]="Warning",Fa[Fa.Error=3]="Error";class qa{constructor(e,t){this.privName=e,this.privEventId=Ba(),this.privEventTime=(new Date).toISOString(),this.privEventType=t,this.privMetadata={}}get name(){return this.privName}get eventId(){return this.privEventId}get eventTime(){return this.privEventTime}get eventType(){return this.privEventType}get metadata(){return this.privMetadata}}class Ka extends qa{constructor(e,t,n=ja.Info){super(e,n),this.privAudioSourceId=t}get audioSourceId(){return this.privAudioSourceId}}class Ya extends Ka{constructor(e){super("AudioSourceInitializingEvent",e)}}class Ja extends Ka{constructor(e){super("AudioSourceReadyEvent",e)}}class Qa extends Ka{constructor(e){super("AudioSourceOffEvent",e)}}class Xa extends Ka{constructor(e,t){super("AudioSourceErrorEvent",e,ja.Error),this.privError=t}get error(){return this.privError}}class Za extends Ka{constructor(e,t,n){super(e,t),this.privAudioNodeId=n}get audioNodeId(){return this.privAudioNodeId}}class $a extends Za{constructor(e,t){super("AudioStreamNodeAttachingEvent",e,t)}}class es extends Za{constructor(e,t){super("AudioStreamNodeAttachedEvent",e,t)}}class ts extends Za{constructor(e,t){super("AudioStreamNodeDetachedEvent",e,t)}}class ns extends Za{constructor(e,t,n){super("AudioStreamNodeErrorEvent",e,t),this.privError=n}get error(){return this.privError}}class rs extends qa{constructor(e,t,n=ja.Info){super(e,n),this.privJsonResult=t}get jsonString(){return this.privJsonResult}}class is extends qa{constructor(e,t,n=ja.Info){super(e,n),this.privConnectionId=t}get connectionId(){return this.privConnectionId}}class os extends is{constructor(e,t,n){super("ConnectionStartEvent",e),this.privUri=t,this.privHeaders=n}get uri(){return this.privUri}get headers(){return this.privHeaders}}class as extends is{constructor(e,t){super("ConnectionEstablishedEvent",e)}}class ss extends is{constructor(e,t,n){super("ConnectionClosedEvent",e,ja.Debug),this.privReason=n,this.privStatusCode=t}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class ls extends is{constructor(e,t,n){super("ConnectionErrorEvent",e,ja.Debug),this.privMessage=t,this.privType=n}get message(){return this.privMessage}get type(){return this.privType}}class cs extends is{constructor(e,t,n){super("ConnectionEstablishErrorEvent",e,ja.Error),this.privStatusCode=t,this.privReason=n}get reason(){return this.privReason}get statusCode(){return this.privStatusCode}}class us extends is{constructor(e,t,n){super("ConnectionMessageReceivedEvent",e),this.privNetworkReceivedTime=t,this.privMessage=n}get networkReceivedTime(){return this.privNetworkReceivedTime}get message(){return this.privMessage}}class ds extends is{constructor(e,t,n){super("ConnectionMessageSentEvent",e),this.privNetworkSentTime=t,this.privMessage=n}get networkSentTime(){return this.privNetworkSentTime}get message(){return this.privMessage}}class fs extends Error{constructor(e){super(e),this.name="ArgumentNull",this.message=e}}class hs extends Error{constructor(e){super(e),this.name="InvalidOperation",this.message=e}}class ps extends Error{constructor(e,t){super(t),this.name=e+"ObjectDisposed",this.message=t}}(za=Ua||(Ua={}))[za.Text=0]="Text",za[za.Binary=1]="Binary";class ms{constructor(e,t,n,r){if(this.privBody=null,e===Ua.Text&&t&&"string"!=typeof t)throw new hs("Payload must be a string");if(e===Ua.Binary&&t&&!(t instanceof ArrayBuffer))throw new hs("Payload must be ArrayBuffer");switch(this.privMessageType=e,this.privBody=t,this.privHeaders=n||{},this.privId=r||Ba(),this.messageType){case Ua.Binary:this.privSize=null!==this.binaryBody?this.binaryBody.byteLength:0;break;case Ua.Text:this.privSize=this.textBody.length}}get messageType(){return this.privMessageType}get headers(){return this.privHeaders}get body(){return this.privBody}get textBody(){if(this.privMessageType===Ua.Binary)throw new hs("Not supported for binary message");return this.privBody}get binaryBody(){if(this.privMessageType===Ua.Text)throw new hs("Not supported for text message");return this.privBody}get id(){return this.privId}}class gs{constructor(e,t){this.privStatusCode=e,this.privReason=t}get statusCode(){return this.privStatusCode}get reason(){return this.privReason}}class vs{constructor(e){this.privEventListeners={},this.privIsDisposed=!1,this.onEvent=e=>{if(this.isDisposed())throw new ps("EventSource");if(this.metadata)for(const t in this.metadata)t&&e.metadata&&(e.metadata[t]||(e.metadata[t]=this.metadata[t]));for(const t in this.privEventListeners)t&&this.privEventListeners[t]&&this.privEventListeners[t](e)},this.attach=e=>{const t=Ba();return this.privEventListeners[t]=e,{detach:()=>(delete this.privEventListeners[t],Promise.resolve())}},this.attachListener=e=>this.attach(e.onEvent),this.isDisposed=()=>this.privIsDisposed,this.dispose=()=>{this.privEventListeners=null,this.privIsDisposed=!0},this.privMetadata=e}get metadata(){return this.privMetadata}}class ys{static get instance(){return ys.privInstance}}ys.privInstance=new vs,ys.setEventSource=e=>{if(!e)throw new fs("eventSource");ys.privInstance=e},(Va=Ha||(Ha={}))[Va.None=0]="None",Va[Va.Connected=1]="Connected",Va[Va.Connecting=2]="Connecting",Va[Va.Disconnected=3]="Disconnected",(Ga=Wa||(Wa={}))[Ga.None=0]="None",Ga[Ga.Resolved=1]="Resolved",Ga[Ga.Rejected=2]="Rejected";class bs{constructor(){this.resolve=e=>(this.privResolve(e),this),this.reject=e=>(this.privReject(e),this),this.privPromise=new Promise(((e,t)=>{this.privResolve=e,this.privReject=t}))}get promise(){return this.privPromise}}function ws(e,t,n){e.then((e=>{try{t&&t(e)}catch(e){if(n)try{if(e instanceof Error){const t=e;n(t.name+": "+t.message)}else n(e)}catch(e){}}}),(e=>{if(n)try{if(e instanceof Error){const t=e;n(t.name+": "+t.message)}else n(e)}catch(e){}}))}var xs={};e(xs,"Queue",(()=>Es),(e=>Es=e));class Ss{constructor(e){if(this.privSubscriptionIdCounter=0,this.privAddSubscriptions={},this.privRemoveSubscriptions={},this.privDisposedSubscriptions={},this.privDisposeReason=null,this.get=e=>(this.throwIfDisposed(),this.privList[e]),this.first=()=>this.get(0),this.last=()=>this.get(this.length()-1),this.add=e=>{this.throwIfDisposed(),this.insertAt(this.privList.length,e)},this.insertAt=(e,t)=>{this.throwIfDisposed(),0===e?this.privList.unshift(t):e===this.privList.length?this.privList.push(t):this.privList.splice(e,0,t),this.triggerSubscriptions(this.privAddSubscriptions)},this.removeFirst=()=>(this.throwIfDisposed(),this.removeAt(0)),this.removeLast=()=>(this.throwIfDisposed(),this.removeAt(this.length()-1)),this.removeAt=e=>(this.throwIfDisposed(),this.remove(e,1)[0]),this.remove=(e,t)=>{this.throwIfDisposed();const n=this.privList.splice(e,t);return this.triggerSubscriptions(this.privRemoveSubscriptions),n},this.clear=()=>{this.throwIfDisposed(),this.remove(0,this.length())},this.length=()=>(this.throwIfDisposed(),this.privList.length),this.onAdded=e=>{this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privAddSubscriptions[t]=e,{detach:()=>(delete this.privAddSubscriptions[t],Promise.resolve())}},this.onRemoved=e=>{this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privRemoveSubscriptions[t]=e,{detach:()=>(delete this.privRemoveSubscriptions[t],Promise.resolve())}},this.onDisposed=e=>{this.throwIfDisposed();const t=this.privSubscriptionIdCounter++;return this.privDisposedSubscriptions[t]=e,{detach:()=>(delete this.privDisposedSubscriptions[t],Promise.resolve())}},this.join=e=>(this.throwIfDisposed(),this.privList.join(e)),this.toArray=()=>{const e=Array();return this.privList.forEach((t=>{e.push(t)})),e},this.any=e=>(this.throwIfDisposed(),e?this.where(e).length()>0:this.length()>0),this.all=e=>(this.throwIfDisposed(),this.where(e).length()===this.length()),this.forEach=e=>{this.throwIfDisposed();for(let t=0;t<this.length();t++)e(this.privList[t],t)},this.select=e=>{this.throwIfDisposed();const t=[];for(let n=0;n<this.privList.length;n++)t.push(e(this.privList[n],n));return new Ss(t)},this.where=e=>{this.throwIfDisposed();const t=new Ss;for(let n=0;n<this.privList.length;n++)e(this.privList[n],n)&&t.add(this.privList[n]);return t},this.orderBy=e=>{this.throwIfDisposed();const t=this.toArray().sort(e);return new Ss(t)},this.orderByDesc=e=>(this.throwIfDisposed(),this.orderBy(((t,n)=>e(n,t)))),this.clone=()=>(this.throwIfDisposed(),new Ss(this.toArray())),this.concat=e=>(this.throwIfDisposed(),new Ss(this.privList.concat(e.toArray()))),this.concatArray=e=>(this.throwIfDisposed(),new Ss(this.privList.concat(e))),this.isDisposed=()=>null==this.privList,this.dispose=e=>{this.isDisposed()||(this.privDisposeReason=e,this.privList=null,this.privAddSubscriptions=null,this.privRemoveSubscriptions=null,this.triggerSubscriptions(this.privDisposedSubscriptions))},this.throwIfDisposed=()=>{if(this.isDisposed())throw new ps("List",this.privDisposeReason)},this.triggerSubscriptions=e=>{if(e)for(const t in e)t&&e[t]()},this.privList=[],e)for(const t of e)this.privList.push(t)}}var Ms,_s,As=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};(_s=Ms||(Ms={}))[_s.Dequeue=0]="Dequeue",_s[_s.Peek=1]="Peek";class Es{constructor(e){this.privPromiseStore=new Ss,this.privIsDrainInProgress=!1,this.privIsDisposing=!1,this.privDisposeReason=null,this.enqueue=e=>{this.throwIfDispose(),this.enqueueFromPromise(new Promise(((t,n)=>{t(e)})))},this.enqueueFromPromise=e=>{this.throwIfDispose(),e.then((e=>{this.privList.add(e)}),(e=>{}))},this.dequeue=()=>{this.throwIfDispose();const e=new bs;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:Ms.Dequeue}),this.drain()),e.promise},this.peek=()=>{this.throwIfDispose();const e=new bs;return this.privSubscribers&&(this.privSubscribers.add({deferral:e,type:Ms.Peek}),this.drain()),e.promise},this.length=()=>(this.throwIfDispose(),this.privList.length()),this.isDisposed=()=>null==this.privSubscribers,this.drain=()=>{if(!this.privIsDrainInProgress&&!this.privIsDisposing){this.privIsDrainInProgress=!0;const e=this.privSubscribers,t=this.privList;if(e&&t){for(;t.length()>0&&e.length()>0&&!this.privIsDisposing;){const n=e.removeFirst();if(n.type===Ms.Peek)n.deferral.resolve(t.first());else{const e=t.removeFirst();n.deferral.resolve(e)}}this.privSubscribers===e&&(this.privSubscribers=e),this.privList===t&&(this.privList=t)}this.privIsDrainInProgress=!1}},this.throwIfDispose=()=>{if(this.isDisposed()){if(this.privDisposeReason)throw new hs(this.privDisposeReason);throw new ps("Queue")}if(this.privIsDisposing)throw new hs("Queue disposing")},this.privList=e||new Ss,this.privDetachables=[],this.privSubscribers=new Ss,this.privDetachables.push(this.privList.onAdded(this.drain))}drainAndDispose(e,t){return As(this,void 0,void 0,(function*(){if(!this.isDisposed()&&!this.privIsDisposing){this.privDisposeReason=t,this.privIsDisposing=!0;const n=this.privSubscribers;if(n){for(;n.length()>0;){n.removeFirst().deferral.resolve(void 0)}this.privSubscribers===n&&(this.privSubscribers=n)}for(const e of this.privDetachables)yield e.detach();if(this.privPromiseStore.length()>0&&e){const t=[];return this.privPromiseStore.toArray().forEach((e=>{t.push(e)})),Promise.all(t).finally((()=>{this.privSubscribers=null,this.privList.forEach(((t,n)=>{e(t)})),this.privList=null})).then()}this.privSubscribers=null,this.privList=null}}))}dispose(e){return As(this,void 0,void 0,(function*(){yield this.drainAndDispose(null,e)}))}}class Cs{constructor(e,t,n){if(this.privPayload=null,!t)throw new fs("payload");if(e===Ua.Binary&&"ArrayBuffer"!==t.__proto__.constructor.name)throw new hs("Payload must be ArrayBuffer");if(e===Ua.Text&&"string"!=typeof t)throw new hs("Payload must be a string");this.privMessageType=e,this.privPayload=t,this.privId=n||Ba()}get messageType(){return this.privMessageType}get payload(){return this.privPayload}get textContent(){if(this.privMessageType===Ua.Binary)throw new hs("Not supported for binary message");return this.privPayload}get binaryContent(){if(this.privMessageType===Ua.Text)throw new hs("Not supported for text message");return this.privPayload}get id(){return this.privId}}class ks{constructor(e,t){this.encode=e=>{const t=this.downSampleAudioFrame(e,this.privActualSampleRate,this.privDesiredSampleRate);if(!t)return null;const n=2*t.length,r=new ArrayBuffer(n),i=new DataView(r);return this.floatTo16BitPCM(i,0,t),r},this.setString=(e,t,n)=>{for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))},this.floatTo16BitPCM=(e,t,n)=>{for(let r=0;r<n.length;r++,t+=2){const i=Math.max(-1,Math.min(1,n[r]));e.setInt16(t,i<0?32768*i:32767*i,!0)}},this.downSampleAudioFrame=(e,t,n)=>{if(!e)return null;if(n===t||n>t)return e;const r=t/n,i=Math.round(e.length/r),o=new Float32Array(i);let a=0,s=0;for(;s<i;){const t=Math.round((s+1)*r);let n=0,i=0;for(;a<t&&a<e.length;)n+=e[a++],i++;o[s++]=n/i}return o},this.privActualSampleRate=e,this.privDesiredSampleRate=t}}var Ts={};e(Ts,"Stream",(()=>Ps),(e=>Ps=e));var Is,Os,Rs=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Ps{constructor(e){this.privIsWriteEnded=!1,this.privIsReadEnded=!1,this.read=()=>{if(this.privIsReadEnded)throw new hs("Stream read has already finished");return this.privReaderQueue.dequeue().then((e=>Rs(this,void 0,void 0,(function*(){return(void 0===e||e.isEnd)&&(yield this.privReaderQueue.dispose("End of stream reached")),e}))))},this.readEnded=()=>{this.privIsReadEnded||(this.privIsReadEnded=!0,this.privReaderQueue=new(0,xs.Queue))},this.throwIfClosed=()=>{if(this.privIsWriteEnded)throw new hs("Stream closed")},this.privId=e||Ba(),this.privReaderQueue=new(0,xs.Queue)}get isClosed(){return this.privIsWriteEnded}get isReadEnded(){return this.privIsReadEnded}get id(){return this.privId}close(){this.privIsWriteEnded||(this.writeStreamChunk({buffer:null,isEnd:!0,timeReceived:Date.now()}),this.privIsWriteEnded=!0)}writeStreamChunk(e){if(this.throwIfClosed(),!this.privReaderQueue.isDisposed())try{this.privReaderQueue.enqueue(e)}catch(e){}}}(Os=Is||(Is={}))[Os.Success=0]="Success",Os[Os.Error=1]="Error";class Ns extends Ts.Stream{constructor(e,t){super(t),this.privTargetChunkSize=e,this.privNextBufferReadyBytes=0}writeStreamChunk(e){if(e.isEnd||0===this.privNextBufferReadyBytes&&e.buffer.byteLength===this.privTargetChunkSize)return void super.writeStreamChunk(e);let t=0;for(;t<e.buffer.byteLength;){void 0===this.privNextBufferToWrite&&(this.privNextBufferToWrite=new ArrayBuffer(this.privTargetChunkSize),this.privNextBufferStartTime=e.timeReceived);const n=Math.min(e.buffer.byteLength-t,this.privTargetChunkSize-this.privNextBufferReadyBytes),r=new Uint8Array(this.privNextBufferToWrite),i=new Uint8Array(e.buffer.slice(t,n+t));r.set(i,this.privNextBufferReadyBytes),this.privNextBufferReadyBytes+=n,t+=n,this.privNextBufferReadyBytes===this.privTargetChunkSize&&(super.writeStreamChunk({buffer:this.privNextBufferToWrite,isEnd:!1,timeReceived:this.privNextBufferStartTime}),this.privNextBufferReadyBytes=0,this.privNextBufferToWrite=void 0)}}close(){0===this.privNextBufferReadyBytes||this.isClosed||super.writeStreamChunk({buffer:this.privNextBufferToWrite.slice(0,this.privNextBufferReadyBytes),isEnd:!1,timeReceived:this.privNextBufferStartTime}),super.close()}}class Ls{}Ls.workerTimers=null,Ls.clearTimeout=e=>Ls.timers().clearTimeout(e),Ls.setTimeout=(e,t)=>Ls.timers().setTimeout(e,t),Ls.load=e=>{const t=new Map([[0,()=>{}]]),n=new Map,r=new Worker(e);r.addEventListener("message",(({data:e})=>{if(Ls.isCallNotification(e)){const{params:{timerId:r}}=e,i=t.get(r);if("number"==typeof i){const e=n.get(i);if(void 0===e||e!==r)throw new Error("The timer is in an undefined state.")}else{if(void 0===i)throw new Error("The timer is in an undefined state.");i(),t.delete(r)}}else{if(!Ls.isClearResponse(e)){const{error:{message:t}}=e;throw new Error(t)}{const{id:r}=e,i=n.get(r);if(void 0===i)throw new Error("The timer is in an undefined state.");n.delete(r),t.delete(i)}}}));return{clearTimeout:e=>{const i=Math.random();n.set(i,e),t.set(e,i),r.postMessage({id:i,method:"clear",params:{timerId:e}})},setTimeout:(e,n)=>{const i=Math.random();return t.set(i,e),r.postMessage({id:null,method:"set",params:{delay:n,now:performance.now(),timerId:i}}),i}}},Ls.loadWorkerTimers=()=>()=>{if(null!==Ls.workerTimers)return Ls.workerTimers;const e=new Blob(['!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return u})),n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return d}));const r=new Map,o=new Map,i=e=>{const t=r.get(e);if(void 0===t)throw new Error(\'There is no interval scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(t),r.delete(e)},u=e=>{const t=o.get(e);if(void 0===t)throw new Error(\'There is no timeout scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(t),o.delete(e)},f=(e,t)=>{let n,r;if("performance"in self){const o=performance.now();n=o,r=e-Math.max(0,o-t)}else n=Date.now(),r=e;return{expected:n+r,remainingDelay:r}},c=(e,t,n,r)=>{const o="performance"in self?performance.now():Date.now();o>n?postMessage({id:null,method:"call",params:{timerId:t}}):e.set(t,setTimeout(c,n-o,e,t,n))},a=(e,t,n)=>{const{expected:o,remainingDelay:i}=f(e,n);r.set(t,setTimeout(c,i,r,t,o))},d=(e,t,n)=>{const{expected:r,remainingDelay:i}=f(e,n);o.set(t,setTimeout(c,i,o,t,r))}},function(e,t,n){"use strict";n.r(t);var r=n(2);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(3);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(4);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o);var f=n(5);for(var o in f)"default"!==o&&function(e){n.d(t,e,(function(){return f[e]}))}(o);var c=n(6);for(var o in c)"default"!==o&&function(e){n.d(t,e,(function(){return c[e]}))}(o);var a=n(7);for(var o in a)"default"!==o&&function(e){n.d(t,e,(function(){return a[e]}))}(o);var d=n(8);for(var o in d)"default"!==o&&function(e){n.d(t,e,(function(){return d[e]}))}(o);var s=n(9);for(var o in s)"default"!==o&&function(e){n.d(t,e,(function(){return s[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(11);for(var o in r)"default"!==o&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(12);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);var u=n(13);for(var o in u)"default"!==o&&function(e){n.d(t,e,(function(){return u[e]}))}(o)},function(e,t){},function(e,t){},function(e,t){},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(1);for(var i in o)"default"!==i&&function(e){n.d(t,e,(function(){return o[e]}))}(i);var u=n(10);for(var i in u)"default"!==i&&function(e){n.d(t,e,(function(){return u[e]}))}(i);addEventListener("message",({data:e})=>{try{if("clear"===e.method){const{id:t,params:{timerId:n}}=e;Object(r.b)(n),postMessage({error:null,id:t})}else{if("set"!==e.method)throw new Error(\'The given method "\'.concat(e.method,\'" is not supported\'));{const{params:{delay:t,now:n,timerId:o}}=e;Object(r.d)(t,o,n)}}}catch(t){postMessage({error:{message:t.message},id:e.id,result:null})}})}]);'],{type:"application/javascript; charset=utf-8"}),t=URL.createObjectURL(e);return Ls.workerTimers=Ls.load(t),Ls.workerTimers.setTimeout((()=>URL.revokeObjectURL(t)),0),Ls.workerTimers},Ls.timers=Ls.loadWorkerTimers(),Ls.isCallNotification=e=>void 0!==e.method&&"call"===e.method,Ls.isClearResponse=e=>null===e.error&&"number"==typeof e.id;class Ds extends qa{constructor(e,t,n){super(e,t),this.privSignature=n}}class Bs extends Ds{constructor(e){super("OCSPMemoryCacheHitEvent",ja.Debug,e)}}class js extends Ds{constructor(e){super("OCSPCacheMissEvent",ja.Debug,e)}}class Fs extends Ds{constructor(e){super("OCSPDiskCacheHitEvent",ja.Debug,e)}}class Us extends Ds{constructor(e){super("OCSPCacheUpdateNeededEvent",ja.Debug,e)}}class zs extends Ds{constructor(e){super("OCSPMemoryCacheStoreEvent",ja.Debug,e)}}class Hs extends Ds{constructor(e){super("OCSPDiskCacheStoreEvent",ja.Debug,e)}}class Vs extends Ds{constructor(e){super("OCSPCacheUpdateCompleteEvent",ja.Debug,e)}}class Ws extends Ds{constructor(){super("OCSPStapleReceivedEvent",ja.Debug,"")}}class Gs extends Ds{constructor(e,t){super("OCSPCacheEntryExpiredEvent",ja.Debug,e),this.privExpireTime=t}}class qs extends Ds{constructor(e,t,n){super("OCSPCacheEntryNeedsRefreshEvent",ja.Debug,e),this.privExpireTime=n,this.privStartTime=t}}class Ks extends Ds{constructor(e,t,n){super("OCSPCacheHitEvent",ja.Debug,e),this.privExpireTime=n,this.privExpireTimeString=new Date(n).toLocaleDateString(),this.privStartTime=t,this.privStartTimeString=new Date(t).toLocaleTimeString()}}class Ys extends Ds{constructor(e,t){super("OCSPVerificationFailedEvent",ja.Debug,e),this.privError=t}}class Js extends Ds{constructor(e,t){super("OCSPCacheFetchErrorEvent",ja.Debug,e),this.privError=t}}class Qs extends Ds{constructor(e){super("OCSPResponseRetrievedEvent",ja.Debug,e)}}class Xs extends Ds{constructor(e,t){super("OCSPCacheUpdateErrorEvent",ja.Debug,e),this.privError=t}}class Zs extends qa{constructor(e){super("BackgroundEvent",ja.Error),this.privError=e}get error(){return this.privError}}var $s={};e($s,"MicAudioSource",(()=>vu),(e=>vu=e));class el{}el.AuthKey="Ocp-Apim-Subscription-Key",el.ConnectionId="X-ConnectionId",el.ContentType="Content-Type",el.CustomCommandsAppId="X-CommandsAppId",el.Path="Path",el.RequestId="X-RequestId",el.RequestStreamId="X-StreamId",el.RequestTimestamp="X-Timestamp";class tl{constructor(e,t){this.privHeaderName=e,this.privToken=t}get headerName(){return this.privHeaderName}get token(){return this.privToken}}class nl{constructor(e){if(this.fetch=e=>Promise.resolve(this.privAuthInfo),this.fetchOnExpiry=e=>Promise.resolve(this.privAuthInfo),!e)throw new fs("subscriptionKey");this.privAuthInfo=new tl(el.AuthKey,e)}}const rl="Authorization";class il{constructor(e,t){if(this.fetch=e=>this.privFetchCallback(e).then((e=>new tl(rl,il.privTokenPrefix+e))),this.fetchOnExpiry=e=>this.privFetchOnExpiryCallback(e).then((e=>new tl(rl,il.privTokenPrefix+e))),!e)throw new fs("fetchCallback");if(!t)throw new fs("fetchOnExpiryCallback");this.privFetchCallback=e,this.privFetchOnExpiryCallback=t}}il.privTokenPrefix="bearer ";var ol,al,sl,ll,cl,ul,dl={};e(dl,"ServiceRecognizerBase",(()=>_l),(e=>_l=e)),(al=ol||(ol={}))[al.Error=0]="Error",al[al.EndOfStream=1]="EndOfStream",(ll=sl||(sl={}))[ll.NoError=0]="NoError",ll[ll.AuthenticationFailure=1]="AuthenticationFailure",ll[ll.BadRequestParameters=2]="BadRequestParameters",ll[ll.TooManyRequests=3]="TooManyRequests",ll[ll.ConnectionFailure=4]="ConnectionFailure",ll[ll.ServiceTimeout=5]="ServiceTimeout",ll[ll.ServiceError=6]="ServiceError",ll[ll.RuntimeError=7]="RuntimeError",ll[ll.Forbidden=8]="Forbidden",(ul=cl||(cl={}))[ul.SpeechServiceConnection_Key=0]="SpeechServiceConnection_Key",ul[ul.SpeechServiceConnection_Endpoint=1]="SpeechServiceConnection_Endpoint",ul[ul.SpeechServiceConnection_Region=2]="SpeechServiceConnection_Region",ul[ul.SpeechServiceAuthorization_Token=3]="SpeechServiceAuthorization_Token",ul[ul.SpeechServiceAuthorization_Type=4]="SpeechServiceAuthorization_Type",ul[ul.SpeechServiceConnection_EndpointId=5]="SpeechServiceConnection_EndpointId",ul[ul.SpeechServiceConnection_TranslationToLanguages=6]="SpeechServiceConnection_TranslationToLanguages",ul[ul.SpeechServiceConnection_TranslationVoice=7]="SpeechServiceConnection_TranslationVoice",ul[ul.SpeechServiceConnection_TranslationFeatures=8]="SpeechServiceConnection_TranslationFeatures",ul[ul.SpeechServiceConnection_IntentRegion=9]="SpeechServiceConnection_IntentRegion",ul[ul.SpeechServiceConnection_ProxyHostName=10]="SpeechServiceConnection_ProxyHostName",ul[ul.SpeechServiceConnection_ProxyPort=11]="SpeechServiceConnection_ProxyPort",ul[ul.SpeechServiceConnection_ProxyUserName=12]="SpeechServiceConnection_ProxyUserName",ul[ul.SpeechServiceConnection_ProxyPassword=13]="SpeechServiceConnection_ProxyPassword",ul[ul.SpeechServiceConnection_RecoMode=14]="SpeechServiceConnection_RecoMode",ul[ul.SpeechServiceConnection_RecoLanguage=15]="SpeechServiceConnection_RecoLanguage",ul[ul.Speech_SessionId=16]="Speech_SessionId",ul[ul.SpeechServiceConnection_SynthLanguage=17]="SpeechServiceConnection_SynthLanguage",ul[ul.SpeechServiceConnection_SynthVoice=18]="SpeechServiceConnection_SynthVoice",ul[ul.SpeechServiceConnection_SynthOutputFormat=19]="SpeechServiceConnection_SynthOutputFormat",ul[ul.SpeechServiceConnection_AutoDetectSourceLanguages=20]="SpeechServiceConnection_AutoDetectSourceLanguages",ul[ul.SpeechServiceResponse_RequestDetailedResultTrueFalse=21]="SpeechServiceResponse_RequestDetailedResultTrueFalse",ul[ul.SpeechServiceResponse_RequestProfanityFilterTrueFalse=22]="SpeechServiceResponse_RequestProfanityFilterTrueFalse",ul[ul.SpeechServiceResponse_JsonResult=23]="SpeechServiceResponse_JsonResult",ul[ul.SpeechServiceResponse_JsonErrorDetails=24]="SpeechServiceResponse_JsonErrorDetails",ul[ul.CancellationDetails_Reason=25]="CancellationDetails_Reason",ul[ul.CancellationDetails_ReasonText=26]="CancellationDetails_ReasonText",ul[ul.CancellationDetails_ReasonDetailedText=27]="CancellationDetails_ReasonDetailedText",ul[ul.LanguageUnderstandingServiceResponse_JsonResult=28]="LanguageUnderstandingServiceResponse_JsonResult",ul[ul.SpeechServiceConnection_Url=29]="SpeechServiceConnection_Url",ul[ul.SpeechServiceConnection_InitialSilenceTimeoutMs=30]="SpeechServiceConnection_InitialSilenceTimeoutMs",ul[ul.SpeechServiceConnection_EndSilenceTimeoutMs=31]="SpeechServiceConnection_EndSilenceTimeoutMs",ul[ul.SpeechServiceConnection_EnableAudioLogging=32]="SpeechServiceConnection_EnableAudioLogging",ul[ul.SpeechServiceResponse_ProfanityOption=33]="SpeechServiceResponse_ProfanityOption",ul[ul.SpeechServiceResponse_PostProcessingOption=34]="SpeechServiceResponse_PostProcessingOption",ul[ul.SpeechServiceResponse_RequestWordLevelTimestamps=35]="SpeechServiceResponse_RequestWordLevelTimestamps",ul[ul.SpeechServiceResponse_StablePartialResultThreshold=36]="SpeechServiceResponse_StablePartialResultThreshold",ul[ul.SpeechServiceResponse_OutputFormatOption=37]="SpeechServiceResponse_OutputFormatOption",ul[ul.SpeechServiceResponse_TranslationRequestStablePartialResult=38]="SpeechServiceResponse_TranslationRequestStablePartialResult",ul[ul.Conversation_ApplicationId=39]="Conversation_ApplicationId",ul[ul.Conversation_DialogType=40]="Conversation_DialogType",ul[ul.Conversation_Initial_Silence_Timeout=41]="Conversation_Initial_Silence_Timeout",ul[ul.Conversation_From_Id=42]="Conversation_From_Id",ul[ul.Conversation_Conversation_Id=43]="Conversation_Conversation_Id",ul[ul.Conversation_Custom_Voice_Deployment_Ids=44]="Conversation_Custom_Voice_Deployment_Ids",ul[ul.Conversation_Speech_Activity_Template=45]="Conversation_Speech_Activity_Template",ul[ul.Conversation_Request_Bot_Status_Messages=46]="Conversation_Request_Bot_Status_Messages",ul[ul.Conversation_Agent_Connection_Id=47]="Conversation_Agent_Connection_Id",ul[ul.SpeechServiceConnection_Host=48]="SpeechServiceConnection_Host",ul[ul.ConversationTranslator_Host=49]="ConversationTranslator_Host",ul[ul.ConversationTranslator_Name=50]="ConversationTranslator_Name",ul[ul.ConversationTranslator_CorrelationId=51]="ConversationTranslator_CorrelationId",ul[ul.ConversationTranslator_Token=52]="ConversationTranslator_Token",ul[ul.PronunciationAssessment_ReferenceText=53]="PronunciationAssessment_ReferenceText",ul[ul.PronunciationAssessment_GradingSystem=54]="PronunciationAssessment_GradingSystem",ul[ul.PronunciationAssessment_Granularity=55]="PronunciationAssessment_Granularity",ul[ul.PronunciationAssessment_EnableMiscue=56]="PronunciationAssessment_EnableMiscue",ul[ul.PronunciationAssessment_Json=57]="PronunciationAssessment_Json",ul[ul.PronunciationAssessment_Params=58]="PronunciationAssessment_Params",ul[ul.SpeakerRecognition_Api_Version=59]="SpeakerRecognition_Api_Version";class fl{constructor(e){this.privSessionId=e}get sessionId(){return this.privSessionId}}class hl extends fl{constructor(e,t){super(t),this.privOffset=e}get offset(){return this.privOffset}}class pl extends ms{constructor(e,t,n,r,i,o,a,s){if(!t)throw new fs("path");if(!n)throw new fs("requestId");const l={};if(l[el.Path]=t,l[el.RequestId]=n,l[el.RequestTimestamp]=(new Date).toISOString(),r&&(l[el.ContentType]=r),o&&(l[el.RequestStreamId]=o),a)for(const e in a)e&&(l[e]=a[e]);s?super(e,i,l,s):super(e,i,l),this.privPath=t,this.privRequestId=n,this.privContentType=r,this.privStreamId=o,this.privAdditionalHeaders=a}get path(){return this.privPath}get requestId(){return this.privRequestId}get contentType(){return this.privContentType}get streamId(){return this.privStreamId}get additionalHeaders(){return this.privAdditionalHeaders}}pl.fromConnectionMessage=e=>{let t=null,n=null,r=null,i=null,o=null;const a={};if(e.headers)for(const s in e.headers)s&&(s.toLowerCase()===el.Path.toLowerCase()?t=e.headers[s]:s.toLowerCase()===el.RequestId.toLowerCase()?n=e.headers[s]:s.toLowerCase()===el.RequestTimestamp.toLowerCase()?i=e.headers[s]:s.toLowerCase()===el.ContentType.toLowerCase()?r=e.headers[s]:s.toLowerCase()===el.RequestStreamId.toLowerCase()?o=e.headers[s]:a[s]=e.headers[s]);return new pl(e.messageType,t,n,r,e.body,o,a,e.id)};var ml,gl,vl,yl,bl,wl,xl,Sl,Ml=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class _l{constructor(e,t,n,r,i){if(this.privSetTimeout=setTimeout,this.privIsLiveAudio=!1,this.recognizeOverride=void 0,this.disconnectOverride=void 0,this.receiveMessageOverride=void 0,this.sendSpeechContext=e=>{const t=this.speechContext.toJSON();if(this.privRequestSession.onSpeechContext(),t)return e.send(new pl(Ua.Text,"speech.context",this.privRequestSession.requestId,"application/json",t))},this.sendPrePayloadJSONOverride=void 0,this.postConnectImplOverride=void 0,this.configConnectionOverride=void 0,this.sendSpeechServiceConfig=(e,t,n)=>{if(!0!==_l.telemetryDataEnabled){const e={context:{system:JSON.parse(n).context.system}};n=JSON.stringify(e)}if("true"===this.privRecognizerConfig.parameters.getProperty("TranscriptionService_SingleChannel","false").toLowerCase()){const e=JSON.parse(n);e.context.DisableReferenceChannel="True",e.context.MicSpec="1_0_0",n=JSON.stringify(e)}if(n)return e.send(new pl(Ua.Text,"speech.config",t.requestId,"application/json",n))},!e)throw new fs("authentication");if(!t)throw new fs("connectionFactory");if(!n)throw new fs("audioSource");if(!r)throw new fs("recognizerConfig");this.privMustReportEndOfStream=!1,this.privAuthentication=e,this.privConnectionFactory=t,this.privAudioSource=n,this.privRecognizerConfig=r,this.privIsDisposed=!1,this.privRecognizer=i,this.privRequestSession=new(0,ac.RequestSession)(this.privAudioSource.id()),this.privConnectionEvents=new vs,this.privServiceEvents=new vs,this.privDynamicGrammar=new Mc,this.privSpeechContext=new Sc(this.privDynamicGrammar),this.privAgentConfig=new zc,"undefined"!=typeof Blob&&"undefined"!=typeof Worker&&(this.privSetTimeout=Ls.setTimeout),this.connectionEvents.attach((e=>Ml(this,void 0,void 0,(function*(){if("ConnectionClosedEvent"===e.name){const t=e;(1003===t.statusCode||1007===t.statusCode||1002===t.statusCode||4e3===t.statusCode||this.privRequestSession.numConnectionAttempts>this.privRecognizerConfig.maxRetryCount)&&(yield this.cancelRecognitionLocal(ol.Error,1007===t.statusCode?sl.BadRequestParameters:sl.ConnectionFailure,t.reason+" websocket error code: "+t.statusCode))}}))))}get audioSource(){return this.privAudioSource}get speechContext(){return this.privSpeechContext}get dynamicGrammar(){return this.privDynamicGrammar}get agentConfig(){return this.privAgentConfig}set conversationTranslatorToken(e){this.privRecognizerConfig.parameters.setProperty(cl.ConversationTranslator_Token,e)}set authentication(e){this.privAuthentication=this.authentication}isDisposed(){return this.privIsDisposed}dispose(e){return Ml(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,this.privConnectionConfigurationPromise)try{const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}catch(e){return}}))}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}get recognitionMode(){return this.privRecognizerConfig.recognitionMode}recognize(e,t,n){return Ml(this,void 0,void 0,(function*(){if(void 0!==this.recognizeOverride)return this.recognizeOverride(e,t,n);this.privConnectionConfigurationPromise=null,this.privRecognizerConfig.recognitionMode=e,this.privSuccessCallback=t,this.privErrorCallback=n,this.privRequestSession.startNewRecognition(),this.privRequestSession.listenForServiceTelemetry(this.privAudioSource.events);const r=this.connectImpl();let i;try{const e=yield this.audioSource.attach(this.privRequestSession.audioNodeId),t=yield this.audioSource.format,n=yield this.audioSource.deviceInfo;this.privIsLiveAudio=n.type&&n.type===xl.Microphones,i=new nd(e,t.avgBytesPerSec),yield this.privRequestSession.onAudioSourceAttachCompleted(i,!1),this.privRecognizerConfig.SpeechServiceConfig.Context.audio={source:n}}catch(e){throw yield this.privRequestSession.onStopRecognizing(),e}try{yield r}catch(e){return void(yield this.cancelRecognitionLocal(ol.Error,sl.ConnectionFailure,e))}const o=new fl(this.privRequestSession.sessionId);this.privRecognizer.sessionStarted&&this.privRecognizer.sessionStarted(this.privRecognizer,o);this.receiveMessage();this.sendAudio(i).catch((e=>Ml(this,void 0,void 0,(function*(){yield this.cancelRecognitionLocal(ol.Error,sl.RuntimeError,e)}))))}))}stopRecognizing(){return Ml(this,void 0,void 0,(function*(){if(this.privRequestSession.isRecognizing)try{yield this.audioSource.turnOff(),yield this.sendFinalAudio(),yield this.privRequestSession.onStopRecognizing(),yield this.privRequestSession.turnCompletionPromise}finally{yield this.privRequestSession.dispose()}}))}connect(){return Ml(this,void 0,void 0,(function*(){return yield this.connectImpl(),Promise.resolve()}))}connectAsync(e,t){this.connectImpl().then((n=>{try{e&&e()}catch(e){t&&t(e)}}),(e=>{try{t&&t(e)}catch(e){}}))}disconnect(){return Ml(this,void 0,void 0,(function*(){yield this.cancelRecognitionLocal(ol.Error,sl.NoError,"Disconnecting"),void 0!==this.disconnectOverride&&(yield this.disconnectOverride());try{yield(yield this.privConnectionPromise).dispose()}catch(e){}this.privConnectionPromise=null}))}sendMessage(e){}sendNetworkMessage(e,t){return Ml(this,void 0,void 0,(function*(){const n="string"==typeof t?Ua.Text:Ua.Binary,r="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new pl(n,e,this.privRequestSession.requestId,r,t))}))}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}sendTelemetryData(){return Ml(this,void 0,void 0,(function*(){const e=this.privRequestSession.getTelemetry();if(!0!==_l.telemetryDataEnabled||this.privIsDisposed||null===e)return;if(_l.telemetryData)try{_l.telemetryData(e)}catch(e){}const t=yield this.fetchConnection();yield t.send(new pl(Ua.Text,"telemetry",this.privRequestSession.requestId,"application/json",e))}))}cancelRecognitionLocal(e,t,n){return Ml(this,void 0,void 0,(function*(){this.privRequestSession.isRecognizing&&(yield this.privRequestSession.onStopRecognizing(),this.cancelRecognition(this.privRequestSession.sessionId,this.privRequestSession.requestId,e,t,n))}))}receiveMessage(){return Ml(this,void 0,void 0,(function*(){try{if(this.privIsDisposed)return;let e=yield this.fetchConnection();const t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(!t)return this.privRequestSession.isRecognizing?this.receiveMessage():void 0;this.privServiceHasSentMessage=!0;const n=pl.fromConnectionMessage(t);if(n.requestId.toLowerCase()===this.privRequestSession.requestId.toLowerCase())switch(n.path.toLowerCase()){case"turn.start":this.privMustReportEndOfStream=!0,this.privRequestSession.onServiceTurnStartResponse();break;case"speech.startdetected":const t=Yl.fromJSON(n.textBody),r=new hl(t.Offset,this.privRequestSession.sessionId);this.privRecognizer.speechStartDetected&&this.privRecognizer.speechStartDetected(this.privRecognizer,r);break;case"speech.enddetected":let i;i=n.textBody.length>0?n.textBody:"{ Offset: 0 }";const o=Yl.fromJSON(i);this.privRecognizerConfig.isContinuousRecognition&&this.privRequestSession.onServiceRecognized(o.Offset+this.privRequestSession.currentTurnAudioOffset);const a=new hl(o.Offset+this.privRequestSession.currentTurnAudioOffset,this.privRequestSession.sessionId);this.privRecognizer.speechEndDetected&&this.privRecognizer.speechEndDetected(this.privRecognizer,a);break;case"turn.end":yield this.sendTelemetryData(),this.privRequestSession.isSpeechEnded&&this.privMustReportEndOfStream&&(this.privMustReportEndOfStream=!1,yield this.cancelRecognitionLocal(ol.EndOfStream,sl.NoError,void 0));const s=new fl(this.privRequestSession.sessionId);if(yield this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition),!this.privRecognizerConfig.isContinuousRecognition||this.privRequestSession.isSpeechEnded||!this.privRequestSession.isRecognizing)return void(this.privRecognizer.sessionStopped&&this.privRecognizer.sessionStopped(this.privRecognizer,s));e=yield this.fetchConnection(),yield this.sendPrePayloadJSON(e);break;default:(yield this.processTypeSpecificMessages(n))||this.privServiceEvents&&this.serviceEvents.onEvent(new rs(n.path.toLowerCase(),n.textBody))}return this.receiveMessage()}catch(e){return null}}))}sendPrePayloadJSON(e){return Ml(this,void 0,void 0,(function*(){if(void 0!==this.sendPrePayloadJSONOverride)return this.sendPrePayloadJSONOverride(e);yield this.sendSpeechContext(e),yield this.sendWaveHeader(e)}))}sendWaveHeader(e){return Ml(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;return e.send(new pl(Ua.Binary,"audio",this.privRequestSession.requestId,"audio/x-wav",t.header))}))}connectImpl(){return this.privConnectionPromise?this.privConnectionPromise.then((e=>e.state()===Ha.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=null,this.privServiceHasSentMessage=!1,this.connectImpl()):this.privConnectionPromise),(e=>(this.privConnectionId=null,this.privConnectionPromise=null,this.privServiceHasSentMessage=!1,this.connectImpl()))):(this.privConnectionPromise=this.retryableConnect(),this.privConnectionPromise.catch((()=>{})),void 0!==this.postConnectImplOverride?this.postConnectImplOverride(this.privConnectionPromise):this.privConnectionPromise)}fetchConnection(){return Ml(this,void 0,void 0,(function*(){return this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===Ha.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=null,this.privServiceHasSentMessage=!1,this.fetchConnection()):this.privConnectionConfigurationPromise),(e=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=null,this.privServiceHasSentMessage=!1,this.fetchConnection()))):(this.privConnectionConfigurationPromise=this.configureConnection(),yield this.privConnectionConfigurationPromise)}))}sendAudio(e){return Ml(this,void 0,void 0,(function*(){const t=yield this.audioSource.format;let n=Date.now();const r=this.privRecognizerConfig.parameters.getProperty("SPEECH-TransmitLengthBeforThrottleMs","5000"),i=t.avgBytesPerSec/1e3*parseInt(r,10),o=this.privRequestSession.recogNumber,a=()=>Ml(this,void 0,void 0,(function*(){if(!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===o){const r=yield this.fetchConnection(),s=yield e.read();if(this.privRequestSession.isSpeechEnded)return;let l,c;if(!s||s.isEnd?(l=null,c=0):(l=s.buffer,this.privRequestSession.onAudioSent(l.byteLength),c=i>=this.privRequestSession.bytesSent?0:Math.max(0,n-Date.now())),0!==c&&(yield this.delay(c)),null!==l&&(n=Date.now()+1e3*l.byteLength/(2*t.avgBytesPerSec)),!this.privIsDisposed&&!this.privRequestSession.isSpeechEnded&&this.privRequestSession.isRecognizing&&this.privRequestSession.recogNumber===o){if(r.send(new pl(Ua.Binary,"audio",this.privRequestSession.requestId,null,l)).catch((()=>{this.privRequestSession.onServiceTurnEndResponse(this.privRecognizerConfig.isContinuousRecognition).catch((()=>{}))})),!(null==s?void 0:s.isEnd))return a();this.privIsLiveAudio||this.privRequestSession.onSpeechEnded()}}}));return a()}))}retryableConnect(){return Ml(this,void 0,void 0,(function*(){let e=!1;this.privAuthFetchEventId=Ba();const t=this.privRequestSession.sessionId;this.privConnectionId=void 0!==t?t:Ba(),this.privRequestSession.onPreConnectionStart(this.privAuthFetchEventId,this.privConnectionId);let n=0,r="";for(;this.privRequestSession.numConnectionAttempts<=this.privRecognizerConfig.maxRetryCount;){const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId),i=yield t;yield this.privRequestSession.onAuthCompleted(!1);const o=this.privConnectionFactory.create(this.privRecognizerConfig,i,this.privConnectionId);this.privRequestSession.listenForServiceTelemetry(o.events),o.events.attach((e=>{this.connectionEvents.onEvent(e)}));const a=yield o.open();if(200===a.statusCode)return yield this.privRequestSession.onConnectionEstablishCompleted(a.statusCode),Promise.resolve(o);1006===a.statusCode&&(e=!0),n=a.statusCode,r=a.reason,this.privRequestSession.onRetryConnection()}return yield this.privRequestSession.onConnectionEstablishCompleted(n,r),Promise.reject(`Unable to contact server. StatusCode: ${n}, ${this.privRecognizerConfig.parameters.getProperty(cl.SpeechServiceConnection_Endpoint)} Reason: ${r}`)}))}delay(e){return new Promise(((t,n)=>{this.privSetTimeout(t,e)}))}writeBufferToConsole(e){let t="Buffer Size: ";if(null===e)t+="null";else{const n=new Uint8Array(e);t+=e.byteLength+"\r\n";for(let r=0;r<e.byteLength;r++)t+=n[r].toString(16).padStart(2,"0")+" "}console.info(t)}sendFinalAudio(){return Ml(this,void 0,void 0,(function*(){const e=yield this.fetchConnection();yield e.send(new pl(Ua.Binary,"audio",this.privRequestSession.requestId,null,null))}))}configureConnection(){return Ml(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privRequestSession,this.privRecognizerConfig.SpeechServiceConfig.serialize()),yield this.sendPrePayloadJSON(e),e)}))}}_l.telemetryDataEnabled=!0,(gl=ml||(ml={}))[gl.Interactive=0]="Interactive",gl[gl.Conversation=1]="Conversation",gl[gl.Dictation=2]="Dictation",(yl=vl||(vl={}))[yl.Simple=0]="Simple",yl[yl.Detailed=1]="Detailed";class Al{constructor(e,t){this.privRecognitionMode=ml.Interactive,this.privSpeechServiceConfig=e||new El(new Cl(null)),this.privParameters=t,this.privMaxRetryCount=parseInt(t.getProperty("SPEECH-Error-MaxRetryCount","4"),10)}get parameters(){return this.privParameters}get recognitionMode(){return this.privRecognitionMode}set recognitionMode(e){this.privRecognitionMode=e,this.privRecognitionActivityTimeout=e===ml.Interactive?8e3:25e3,this.privSpeechServiceConfig.Recognition=ml[e]}get SpeechServiceConfig(){return this.privSpeechServiceConfig}get recognitionActivityTimeout(){return this.privRecognitionActivityTimeout}get isContinuousRecognition(){return this.privRecognitionMode!==ml.Interactive}get autoDetectSourceLanguages(){return this.parameters.getProperty(cl.SpeechServiceConnection_AutoDetectSourceLanguages,void 0)}get maxRetryCount(){return this.privMaxRetryCount}}class El{constructor(e){this.serialize=()=>JSON.stringify(this,((e,t)=>{if(t&&"object"==typeof t){const e={};for(const n in t)Object.hasOwnProperty.call(t,n)&&(e[n&&n.charAt(0).toLowerCase()+n.substring(1)]=t[n]);return e}return t})),this.context=e}get Context(){return this.context}get Recognition(){return this.recognition}set Recognition(e){this.recognition=e.toLowerCase()}}class Cl{constructor(e){this.system=new kl,this.os=e}}class kl{constructor(){this.name="SpeechSDK",this.version="1.20.0",this.build="JavaScript",this.lang="JavaScript"}}class Tl{constructor(e,t,n){this.platform=e,this.name=t,this.version=n}}(wl=bl||(bl={})).Bluetooth="Bluetooth",wl.Wired="Wired",wl.WiFi="WiFi",wl.Cellular="Cellular",wl.InBuilt="InBuilt",wl.Unknown="Unknown",(Sl=xl||(xl={})).Phone="Phone",Sl.Speaker="Speaker",Sl.Car="Car",Sl.Headset="Headset",Sl.Thermostat="Thermostat",Sl.Microphones="Microphones",Sl.Deskphone="Deskphone",Sl.RemoteControl="RemoteControl",Sl.Unknown="Unknown",Sl.File="File",Sl.Stream="Stream";class Il{constructor(){this.toConnectionMessage=e=>{const t=new bs;try{if(e.messageType===Ua.Text){const n=e.textContent;let r={},i=null;if(n){const e=n.split("\r\n\r\n");e&&e.length>0&&(r=this.parseHeaders(e[0]),e.length>1&&(i=e[1]))}t.resolve(new ms(e.messageType,i,r,e.id))}else if(e.messageType===Ua.Binary){const n=e.binaryContent;let r={},i=null;if(!n||n.byteLength<2)throw new Error("Invalid binary message format. Header length missing.");const o=new DataView(n),a=o.getInt16(0);if(n.byteLength<a+2)throw new Error("Invalid binary message format. Header content missing.");let s="";for(let e=0;e<a;e++)s+=String.fromCharCode(o.getInt8(e+2));r=this.parseHeaders(s),n.byteLength>a+2&&(i=n.slice(2+a)),t.resolve(new ms(e.messageType,i,r,e.id))}}catch(e){t.reject(`Error formatting the message. Error: ${e}`)}return t.promise},this.fromConnectionMessage=e=>{const t=new bs;try{if(e.messageType===Ua.Text){const n=`${this.makeHeaders(e)}\r\n${e.textBody?e.textBody:""}`;t.resolve(new Cs(Ua.Text,n,e.id))}else if(e.messageType===Ua.Binary){const n=this.makeHeaders(e),r=e.binaryBody,i=this.stringToArrayBuffer(n),o=new Int8Array(i),a=o.byteLength,s=new Int8Array(2+a+(r?r.byteLength:0));if(s[0]=a>>8&255,s[1]=255&a,s.set(o,2),r){const e=new Int8Array(r);s.set(e,2+a)}const l=s.buffer;t.resolve(new Cs(Ua.Binary,l,e.id))}}catch(e){t.reject(`Error formatting the message. ${e}`)}return t.promise},this.makeHeaders=e=>{let t="";if(e.headers)for(const n in e.headers)n&&(t+=`${n}: ${e.headers[n]}\r\n`);return t},this.parseHeaders=e=>{const t={};if(e){const n=e.match(/[^\r\n]+/g);if(t)for(const e of n)if(e){const n=e.indexOf(":"),r=n>0?e.substr(0,n).trim().toLowerCase():e,i=n>0&&e.length>n+1?e.substr(n+1).trim():"";t[r]=i}}return t},this.stringToArrayBuffer=e=>{const t=new ArrayBuffer(e.length),n=new DataView(t);for(let t=0;t<e.length;t++)n.setUint8(t,e.charCodeAt(t));return t}}}var Ol,Rl,Pl,Nl,Ll,Dl,Bl,jl;(Rl=Ol||(Ol={}))[Rl.Simple=0]="Simple",Rl[Rl.Detailed=1]="Detailed";class Fl{}Fl.BotId="botid",Fl.CustomSpeechDeploymentId="cid",Fl.CustomVoiceDeploymentId="deploymentId",Fl.EnableAudioLogging="storeAudio",Fl.EnableLanguageId="lidEnabled",Fl.EnableWordLevelTimestamps="wordLevelTimestamps",Fl.EndSilenceTimeoutMs="endSilenceTimeoutMs",Fl.Format="format",Fl.InitialSilenceTimeoutMs="initialSilenceTimeoutMs",Fl.Language="language",Fl.Profanity="profanity",Fl.RequestBotStatusMessages="enableBotMessageStatus",Fl.StableIntermediateThreshold="stableIntermediateThreshold",Fl.StableTranslation="stableTranslation",Fl.TestHooks="testhooks";class Ul{static getHostSuffix(e){if(e){if(e.toLowerCase().startsWith("china"))return".azure.cn";if(e.toLowerCase().startsWith("usgov"))return".azure.us"}return".microsoft.com"}setCommonUrlParams(e,t,n){this.setUrlParameter(cl.SpeechServiceConnection_EnableAudioLogging,Fl.EnableAudioLogging,e,t,n),this.setUrlParameter(cl.SpeechServiceResponse_RequestWordLevelTimestamps,Fl.EnableWordLevelTimestamps,e,t,n),this.setUrlParameter(cl.SpeechServiceResponse_ProfanityOption,Fl.Profanity,e,t,n),this.setUrlParameter(cl.SpeechServiceConnection_InitialSilenceTimeoutMs,Fl.InitialSilenceTimeoutMs,e,t,n),this.setUrlParameter(cl.SpeechServiceConnection_EndSilenceTimeoutMs,Fl.EndSilenceTimeoutMs,e,t,n),this.setUrlParameter(cl.SpeechServiceResponse_StablePartialResultThreshold,Fl.StableIntermediateThreshold,e,t,n);const r=JSON.parse(e.parameters.getProperty(pu,"{}"));Object.keys(r).forEach(((e,n,i)=>{t[e]=r[e]}))}setUrlParameter(e,t,n,r,i){const o=n.parameters.getProperty(e,void 0);!o||i&&-1!==i.search(t)||(r[t]=o.toLocaleLowerCase())}}class zl extends Ul{constructor(){super(...arguments),this.interactiveRelativeUri="/speech/recognition/interactive/cognitiveservices/v1",this.conversationRelativeUri="/speech/recognition/conversation/cognitiveservices/v1",this.dictationRelativeUri="/speech/recognition/dictation/cognitiveservices/v1",this.create=(e,t,n)=>{let r=e.parameters.getProperty(cl.SpeechServiceConnection_Endpoint,void 0);const i=e.parameters.getProperty(cl.SpeechServiceConnection_Region,void 0),o=Ul.getHostSuffix(i),a=e.parameters.getProperty(cl.SpeechServiceConnection_Host,"wss://"+i+".stt.speech"+o),s={},l=e.parameters.getProperty(cl.SpeechServiceConnection_EndpointId,void 0),c=e.parameters.getProperty(cl.SpeechServiceConnection_RecoLanguage,void 0);if(l?r&&-1!==r.search(Fl.CustomSpeechDeploymentId)||(s[Fl.CustomSpeechDeploymentId]=l):c&&(r&&-1!==r.search(Fl.Language)||(s[Fl.Language]=c)),r&&-1!==r.search(Fl.Format)||(s[Fl.Format]=e.parameters.getProperty(fu,Ol[Ol.Simple]).toLowerCase()),void 0!==e.autoDetectSourceLanguages&&(s[Fl.EnableLanguageId]="true"),this.setCommonUrlParams(e,s,r),!r)switch(e.recognitionMode){case ml.Conversation:r="true"===e.parameters.getProperty(mu,"false")?a+this.dictationRelativeUri:a+this.conversationRelativeUri;break;case ml.Dictation:r=a+this.dictationRelativeUri;break;default:r=a+this.interactiveRelativeUri}const u={};void 0!==t.token&&""!==t.token&&(u[t.headerName]=t.token),u[el.ConnectionId]=n,e.parameters.setProperty(cl.SpeechServiceConnection_Url,r);const d="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false");return new(0,Su.WebsocketConnection)(r,s,u,new Il,id.fromRecognizerConfig(e),d,n)}}}class Hl{constructor(){this.synthesisUri="/cognitiveservices/websocket/v1",this.create=(e,t,n)=>{let r=e.parameters.getProperty(cl.SpeechServiceConnection_Endpoint,void 0);const i=e.parameters.getProperty(cl.SpeechServiceConnection_Region,void 0),o=Ul.getHostSuffix(i),a=e.parameters.getProperty(cl.SpeechServiceConnection_EndpointId,void 0),s=void 0===a?"tts":"voice",l=e.parameters.getProperty(cl.SpeechServiceConnection_Host,"wss://"+i+"."+s+".speech"+o);r||(r=l+this.synthesisUri);const c={};void 0!==t.token&&""!==t.token&&(c[t.headerName]=t.token),c[el.ConnectionId]=n,void 0!==a&&(c[Fl.CustomVoiceDeploymentId]=a),e.parameters.setProperty(cl.SpeechServiceConnection_Url,r);const u="true"===e.parameters.getProperty("SPEECH-EnableWebsocketCompression","false");return new(0,Su.WebsocketConnection)(r,{},c,new Il,id.fromParameters(e.parameters),u,n)}}}(Nl=Pl||(Pl={}))[Nl.NoMatch=0]="NoMatch",Nl[Nl.Canceled=1]="Canceled",Nl[Nl.RecognizingSpeech=2]="RecognizingSpeech",Nl[Nl.RecognizedSpeech=3]="RecognizedSpeech",Nl[Nl.RecognizedKeyword=4]="RecognizedKeyword",Nl[Nl.RecognizingIntent=5]="RecognizingIntent",Nl[Nl.RecognizedIntent=6]="RecognizedIntent",Nl[Nl.TranslatingSpeech=7]="TranslatingSpeech",Nl[Nl.TranslatedSpeech=8]="TranslatedSpeech",Nl[Nl.SynthesizingAudio=9]="SynthesizingAudio",Nl[Nl.SynthesizingAudioCompleted=10]="SynthesizingAudioCompleted",Nl[Nl.SynthesizingAudioStarted=11]="SynthesizingAudioStarted",Nl[Nl.EnrollingVoiceProfile=12]="EnrollingVoiceProfile",Nl[Nl.EnrolledVoiceProfile=13]="EnrolledVoiceProfile",Nl[Nl.RecognizedSpeakers=14]="RecognizedSpeakers",Nl[Nl.RecognizedSpeaker=15]="RecognizedSpeaker",Nl[Nl.ResetVoiceProfile=16]="ResetVoiceProfile",Nl[Nl.DeletedVoiceProfile=17]="DeletedVoiceProfile",Nl[Nl.VoicesListRetrieved=18]="VoicesListRetrieved";class Vl{static implTranslateRecognitionResult(e){let t=Pl.Canceled;switch(e){case Bl.Success:t=Pl.RecognizedSpeech;break;case Bl.NoMatch:case Bl.InitialSilenceTimeout:case Bl.BabbleTimeout:case Bl.EndOfDictation:t=Pl.NoMatch;break;case Bl.Error:case Bl.BadRequest:case Bl.Forbidden:default:t=Pl.Canceled}return t}static implTranslateCancelResult(e){let t=ol.EndOfStream;switch(e){case Bl.Success:case Bl.EndOfDictation:case Bl.NoMatch:t=ol.EndOfStream;break;case Bl.InitialSilenceTimeout:case Bl.BabbleTimeout:case Bl.Error:case Bl.BadRequest:case Bl.Forbidden:default:t=ol.Error}return t}static implTranslateCancelErrorCode(e){let t=sl.NoError;switch(e){case Bl.Error:t=sl.ServiceError;break;case Bl.TooManyRequests:t=sl.TooManyRequests;break;case Bl.BadRequest:t=sl.BadRequestParameters;break;case Bl.Forbidden:t=sl.Forbidden;break;default:t=sl.NoError}return t}static implTranslateErrorDetails(e){let t="The speech service encountered an internal error and could not continue.";switch(e){case sl.Forbidden:t="The recognizer is using a free subscription that ran out of quota.";break;case sl.BadRequestParameters:t="Invalid parameter or unsupported audio format in the request.";break;case sl.TooManyRequests:t="The number of parallel requests exceeded the number of allowed concurrent transcriptions."}return t}}(Dl=Ll||(Ll={}))[Dl.Success=0]="Success",Dl[Dl.SynthesisEnd=1]="SynthesisEnd",Dl[Dl.Error=2]="Error",(jl=Bl||(Bl={}))[jl.Success=0]="Success",jl[jl.NoMatch=1]="NoMatch",jl[jl.InitialSilenceTimeout=2]="InitialSilenceTimeout",jl[jl.BabbleTimeout=3]="BabbleTimeout",jl[jl.Error=4]="Error",jl[jl.EndOfDictation=5]="EndOfDictation",jl[jl.TooManyRequests=6]="TooManyRequests",jl[jl.BadRequest=7]="BadRequest",jl[jl.Forbidden=8]="Forbidden";class Wl{static throwIfNullOrUndefined(e,t){if(null==e)throw new Error("throwIfNullOrUndefined:"+t)}static throwIfNull(e,t){if(null===e)throw new Error("throwIfNull:"+t)}static throwIfNullOrWhitespace(e,t){if(Wl.throwIfNullOrUndefined(e,t),(""+e).trim().length<1)throw new Error("throwIfNullOrWhitespace:"+t)}static throwIfDisposed(e){if(e)throw new Error("the object is already disposed")}static throwIfArrayEmptyOrWhitespace(e,t){if(Wl.throwIfNullOrUndefined(e,t),0===e.length)throw new Error("throwIfArrayEmptyOrWhitespace:"+t);for(const n of e)Wl.throwIfNullOrWhitespace(n,t)}static throwIfFileDoesNotExist(e,t){Wl.throwIfNullOrWhitespace(e,t)}static throwIfNotUndefined(e,t){if(void 0!==e)throw new Error("throwIfNotUndefined:"+t)}}class Gl{constructor(){this.privKeys=[],this.privValues=[]}getProperty(e,t){let n;n="string"==typeof e?e:cl[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===n)return this.privValues[e];return t}setProperty(e,t){let n;n="string"==typeof e?e:cl[e];for(let e=0;e<this.privKeys.length;e++)if(this.privKeys[e]===n)return void(this.privValues[e]=t);this.privKeys.push(n),this.privValues.push(t)}clone(){const e=new Gl;for(let t=0;t<this.privKeys.length;t++)e.privKeys.push(this.privKeys[t]),e.privValues.push(this.privValues[t]);return e}mergeTo(e){this.privKeys.forEach((t=>{if(void 0===e.getProperty(t,void 0)){const n=this.getProperty(t);e.setProperty(t,n)}}))}get keys(){return this.privKeys}}class ql{constructor(e,t,n,r,i,o,a,s,l,c){this.privResultId=e,this.privReason=t,this.privText=n,this.privDuration=r,this.privOffset=i,this.privLanguage=o,this.privLanguageDetectionConfidence=a,this.privErrorDetails=s,this.privJson=l,this.privProperties=c}get resultId(){return this.privResultId}get reason(){return this.privReason}get text(){return this.privText}get duration(){return this.privDuration}get offset(){return this.privOffset}get language(){return this.privLanguage}get languageDetectionConfidence(){return this.privLanguageDetectionConfidence}get errorDetails(){return this.privErrorDetails}get json(){return this.privJson}get properties(){return this.privProperties}}class Kl extends ql{constructor(e,t,n,r,i,o,a,s,l,c,u){super(e,t,n,r,i,o,a,l,c,u),this.privSpeakerId=s}get speakerId(){return this.privSpeakerId}}class Yl{constructor(e){this.privSpeechStartDetected=JSON.parse(e)}static fromJSON(e){return new Yl(e)}get Offset(){return this.privSpeechStartDetected.Offset}}class Jl{constructor(e){this.privSpeechHypothesis=JSON.parse(e)}static fromJSON(e){return new Jl(e)}get Text(){return this.privSpeechHypothesis.Text}get Offset(){return this.privSpeechHypothesis.Offset}get Duration(){return this.privSpeechHypothesis.Duration}get Language(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSpeechHypothesis.PrimaryLanguage?void 0:this.privSpeechHypothesis.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSpeechHypothesis.SpeakerId}}var Ql={};e(Ql,"SpeechServiceRecognizer",(()=>tc),(e=>tc=e));class Xl extends hl{constructor(e,t,n){super(t,n),this.privResult=e}get result(){return this.privResult}}class Zl extends hl{constructor(e,t,n,r,i){super(r,i),this.privReason=e,this.privErrorDetails=t,this.privErrorCode=n}get reason(){return this.privReason}get errorCode(){return this.privErrorCode}get errorDetails(){return this.privErrorDetails}}class $l extends Zl{}var ec=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class tc extends dl.ServiceRecognizerBase{constructor(e,t,n,r,i){if(super(e,t,n,r,i),this.privSpeechRecognizer=i,void 0!==r.autoDetectSourceLanguages){const e=r.autoDetectSourceLanguages.split(",");this.privSpeechContext.setSection("languageId",{languages:e,onSuccess:{action:"Recognize"},onUnknown:{action:"None"}}),this.privSpeechContext.setSection("phraseOutput",{interimResults:{resultType:"Auto"},phraseResults:{resultType:"Always"}})}}processTypeSpecificMessages(e){return ec(this,void 0,void 0,(function*(){let t;const n=new Gl;n.setProperty(cl.SpeechServiceResponse_JsonResult,e.textBody);let r=!1;switch(e.path.toLowerCase()){case"speech.hypothesis":case"speech.fragment":const i=Jl.fromJSON(e.textBody),o=i.Offset+this.privRequestSession.currentTurnAudioOffset;t=new Kl(this.privRequestSession.requestId,Pl.RecognizingSpeech,i.Text,i.Duration,o,i.Language,i.LanguageDetectionConfidence,void 0,void 0,e.textBody,n),this.privRequestSession.onHypothesis(o);const a=new Xl(t,i.Duration,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognizing)try{this.privSpeechRecognizer.recognizing(this.privSpeechRecognizer,a)}catch(e){}r=!0;break;case"speech.phrase":const s=rc.fromJSON(e.textBody),l=Vl.implTranslateRecognitionResult(s.RecognitionStatus);if(this.privRequestSession.onPhraseRecognized(this.privRequestSession.currentTurnAudioOffset+s.Offset+s.Duration),Pl.Canceled===l){const e=Vl.implTranslateCancelResult(s.RecognitionStatus),t=Vl.implTranslateCancelErrorCode(s.RecognitionStatus);yield this.cancelRecognitionLocal(e,t,Vl.implTranslateErrorDetails(t))}else{if(!this.privRequestSession.isSpeechEnded||l!==Pl.NoMatch||s.RecognitionStatus===Bl.InitialSilenceTimeout){if(this.privRecognizerConfig.parameters.getProperty(fu)===Ol[Ol.Simple])t=new Kl(this.privRequestSession.requestId,l,s.DisplayText,s.Duration,s.Offset+this.privRequestSession.currentTurnAudioOffset,s.Language,s.LanguageDetectionConfidence,void 0,void 0,e.textBody,n);else{const r=nc.fromJSON(e.textBody),i=r.Offset+this.privRequestSession.currentTurnAudioOffset,o=r.getJsonWithCorrectedOffsets(i);t=new Kl(this.privRequestSession.requestId,l,r.RecognitionStatus===Bl.Success?r.NBest[0].Display:void 0,r.Duration,i,r.Language,r.LanguageDetectionConfidence,void 0,void 0,o,n)}const r=new Xl(t,t.offset,this.privRequestSession.sessionId);if(this.privSpeechRecognizer.recognized)try{this.privSpeechRecognizer.recognized(this.privSpeechRecognizer,r)}catch(e){}}if(this.privSuccessCallback){try{this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}this.privSuccessCallback=void 0,this.privErrorCallback=void 0}}r=!0}return r}))}cancelRecognition(e,t,n,r,i){const o=new Gl;if(o.setProperty(hu,sl[r]),this.privSpeechRecognizer.canceled){const t=new $l(n,i,r,void 0,e);try{this.privSpeechRecognizer.canceled(this.privSpeechRecognizer,t)}catch(e){}}if(this.privSuccessCallback){const e=new Kl(t,Pl.Canceled,void 0,void 0,void 0,void 0,void 0,void 0,i,void 0,o);try{this.privSuccessCallback(e),this.privSuccessCallback=void 0}catch(e){}}}}class nc{constructor(e){this.privDetailedSpeechPhrase=JSON.parse(e),this.privDetailedSpeechPhrase.RecognitionStatus=Bl[this.privDetailedSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new nc(e)}getJsonWithCorrectedOffsets(e){if(this.privDetailedSpeechPhrase.NBest){let t;for(const e of this.privDetailedSpeechPhrase.NBest)if(e.Words&&e.Words[0]){t=e.Words[0].Offset;break}if(t&&t<e){const n=e-t;for(const e of this.privDetailedSpeechPhrase.NBest)if(e.Words)for(const t of e.Words)t.Offset+=n}}return JSON.stringify(this.privDetailedSpeechPhrase)}get RecognitionStatus(){return this.privDetailedSpeechPhrase.RecognitionStatus}get NBest(){return this.privDetailedSpeechPhrase.NBest}get Duration(){return this.privDetailedSpeechPhrase.Duration}get Offset(){return this.privDetailedSpeechPhrase.Offset}get Language(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privDetailedSpeechPhrase.PrimaryLanguage?void 0:this.privDetailedSpeechPhrase.PrimaryLanguage.Confidence}get Text(){return this.privDetailedSpeechPhrase.NBest&&this.privDetailedSpeechPhrase.NBest[0]?this.privDetailedSpeechPhrase.NBest[0].Display:this.privDetailedSpeechPhrase.DisplayText}get SpeakerId(){return this.privDetailedSpeechPhrase.SpeakerId}}class rc{constructor(e){this.privSimpleSpeechPhrase=JSON.parse(e),this.privSimpleSpeechPhrase.RecognitionStatus=Bl[this.privSimpleSpeechPhrase.RecognitionStatus]}static fromJSON(e){return new rc(e)}get RecognitionStatus(){return this.privSimpleSpeechPhrase.RecognitionStatus}get DisplayText(){return this.privSimpleSpeechPhrase.DisplayText}get Offset(){return this.privSimpleSpeechPhrase.Offset}get Duration(){return this.privSimpleSpeechPhrase.Duration}get Language(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Language}get LanguageDetectionConfidence(){return void 0===this.privSimpleSpeechPhrase.PrimaryLanguage?void 0:this.privSimpleSpeechPhrase.PrimaryLanguage.Confidence}get SpeakerId(){return this.privSimpleSpeechPhrase.SpeakerId}}var ic,oc,ac={};e(ac,"RequestSession",(()=>xc),(e=>xc=e));class sc extends qa{constructor(e,t,n,r=ja.Info){super(e,r),this.privRequestId=t,this.privSessionId=n}get requestId(){return this.privRequestId}get sessionId(){return this.privSessionId}}class lc extends sc{constructor(e,t,n,r){super("RecognitionTriggeredEvent",e,t),this.privAudioSourceId=n,this.privAudioNodeId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class cc extends sc{constructor(e,t,n,r){super("ListeningStartedEvent",e,t),this.privAudioSourceId=n,this.privAudioNodeId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}}class uc extends sc{constructor(e,t,n){super("ConnectingToServiceEvent",e,n),this.privAuthFetchEventid=t}get authFetchEventid(){return this.privAuthFetchEventid}}class dc extends sc{constructor(e,t,n,r,i){super("RecognitionStartedEvent",e,i),this.privAudioSourceId=t,this.privAudioNodeId=n,this.privAuthFetchEventId=r}get audioSourceId(){return this.privAudioSourceId}get audioNodeId(){return this.privAudioNodeId}get authFetchEventId(){return this.privAuthFetchEventId}}(oc=ic||(ic={}))[oc.Success=0]="Success",oc[oc.AudioSourceError=1]="AudioSourceError",oc[oc.AudioSourceTimeout=2]="AudioSourceTimeout",oc[oc.AuthTokenFetchError=3]="AuthTokenFetchError",oc[oc.AuthTokenFetchTimeout=4]="AuthTokenFetchTimeout",oc[oc.UnAuthorized=5]="UnAuthorized",oc[oc.ConnectTimeout=6]="ConnectTimeout",oc[oc.ConnectError=7]="ConnectError",oc[oc.ClientRecognitionActivityTimeout=8]="ClientRecognitionActivityTimeout",oc[oc.UnknownError=9]="UnknownError";class fc{constructor(e,t,n){this.privIsDisposed=!1,this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.onEvent=e=>{if(!this.privIsDisposed&&(e instanceof lc&&e.requestId===this.privRequestId&&(this.privListeningTriggerMetric={End:e.eventTime,Name:"ListeningTrigger",Start:e.eventTime}),e instanceof $a&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof es&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicStartTime=e.eventTime),e instanceof Xa&&e.audioSourceId===this.privAudioSourceId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof ns&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Error:e.error,Name:"Microphone",Start:this.privMicStartTime})),e instanceof ts&&e.audioSourceId===this.privAudioSourceId&&e.audioNodeId===this.privAudioNodeId&&(this.privMicMetric||(this.privMicMetric={End:e.eventTime,Name:"Microphone",Start:this.privMicStartTime})),e instanceof uc&&e.requestId===this.privRequestId&&(this.privConnectionId=e.sessionId),e instanceof os&&e.connectionId===this.privConnectionId&&(this.privConnectionStartTime=e.eventTime),e instanceof as&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof cs&&e.connectionId===this.privConnectionId&&(this.privConnectionEstablishMetric||(this.privConnectionEstablishMetric={End:e.eventTime,Error:this.getConnectionError(e.statusCode),Id:this.privConnectionId,Name:"Connection",Start:this.privConnectionStartTime})),e instanceof us&&e.connectionId===this.privConnectionId&&e.message&&e.message.headers&&e.message.headers.path)){this.privReceivedMessages[e.message.headers.path]||(this.privReceivedMessages[e.message.headers.path]=new Array);const t=50;this.privReceivedMessages[e.message.headers.path].length<t&&this.privReceivedMessages[e.message.headers.path].push(e.networkReceivedTime)}},this.getTelemetry=()=>{const e=new Array;this.privListeningTriggerMetric&&e.push(this.privListeningTriggerMetric),this.privMicMetric&&e.push(this.privMicMetric),this.privConnectionEstablishMetric&&e.push(this.privConnectionEstablishMetric),this.privPhraseLatencies.length>0&&e.push({PhraseLatencyMs:this.privPhraseLatencies}),this.privHypothesisLatencies.length>0&&e.push({FirstHypothesisLatencyMs:this.privHypothesisLatencies});const t={Metrics:e,ReceivedMessages:this.privReceivedMessages},n=JSON.stringify(t);return this.privReceivedMessages={},this.privListeningTriggerMetric=null,this.privMicMetric=null,this.privConnectionEstablishMetric=null,this.privPhraseLatencies=[],this.privHypothesisLatencies=[],n},this.dispose=()=>{this.privIsDisposed=!0},this.getConnectionError=e=>{switch(e){case 400:case 1002:case 1003:case 1005:case 1007:case 1008:case 1009:return"BadRequest";case 401:return"Unauthorized";case 403:return"Forbidden";case 503:case 1001:return"ServerUnavailable";case 500:case 1011:return"ServerError";case 408:case 504:return"Timeout";default:return"statuscode:"+e.toString()}},this.privRequestId=e,this.privAudioSourceId=t,this.privAudioNodeId=n,this.privReceivedMessages={},this.privPhraseLatencies=[],this.privHypothesisLatencies=[]}phraseReceived(e){e>0&&this.privPhraseLatencies.push(Date.now()-e)}hypothesisReceived(e){e>0&&this.privHypothesisLatencies.push(Date.now()-e)}get hasTelemetry(){return 0!==Object.keys(this.privReceivedMessages).length||null!==this.privListeningTriggerMetric||null!==this.privMicMetric||null!==this.privConnectionEstablishMetric||0!==this.privPhraseLatencies.length||0!==this.privHypothesisLatencies.length}}var hc,pc,mc,gc,vc,yc,bc,wc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class xc{constructor(e){this.privIsDisposed=!1,this.privDetachables=new Array,this.privIsAudioNodeDetached=!1,this.privIsRecognizing=!1,this.privIsSpeechEnded=!1,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privHypothesisReceived=!1,this.privBytesSent=0,this.privRecogNumber=0,this.privInTurn=!1,this.privConnectionAttempts=0,this.onPreConnectionStart=(e,t)=>{this.privAuthFetchEventId=e,this.privSessionId=t,this.onEvent(new uc(this.privRequestId,this.privAuthFetchEventId,this.privSessionId))},this.onSpeechContext=()=>{this.privRequestId=Ba()},this.onServiceTurnStartResponse=()=>{this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch((()=>{}))),this.privInTurn=!0,this.privTurnDeferral=new bs},this.getTelemetry=()=>this.privServiceTelemetryListener.hasTelemetry?this.privServiceTelemetryListener.getTelemetry():null,this.onEvent=e=>{this.privServiceTelemetryListener&&this.privServiceTelemetryListener.onEvent(e),ys.instance.onEvent(e)},this.privAudioSourceId=e,this.privRequestId=Ba(),this.privAudioNodeId=Ba(),this.privTurnDeferral=new bs,this.privTurnDeferral.resolve()}get sessionId(){return this.privSessionId}get requestId(){return this.privRequestId}get audioNodeId(){return this.privAudioNodeId}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSpeechEnded(){return this.privIsSpeechEnded}get isRecognizing(){return this.privIsRecognizing}get currentTurnAudioOffset(){return this.privTurnStartAudioOffset}get recogNumber(){return this.privRecogNumber}get numConnectionAttempts(){return this.privConnectionAttempts}get bytesSent(){return this.privBytesSent}listenForServiceTelemetry(e){this.privServiceTelemetryListener&&this.privDetachables.push(e.attachListener(this.privServiceTelemetryListener))}startNewRecognition(){this.privIsSpeechEnded=!1,this.privIsRecognizing=!0,this.privTurnStartAudioOffset=0,this.privLastRecoOffset=0,this.privRecogNumber++,this.privServiceTelemetryListener=new fc(this.privRequestId,this.privAudioSourceId,this.privAudioNodeId),this.onEvent(new lc(this.requestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}onAudioSourceAttachCompleted(e,t,n){return wc(this,void 0,void 0,(function*(){this.privAudioNode=e,this.privIsAudioNodeDetached=!1,t?yield this.onComplete():this.onEvent(new cc(this.privRequestId,this.privSessionId,this.privAudioSourceId,this.privAudioNodeId))}))}onAuthCompleted(e,t){return wc(this,void 0,void 0,(function*(){e&&(yield this.onComplete())}))}onConnectionEstablishCompleted(e,t){return wc(this,void 0,void 0,(function*(){if(200===e)return this.onEvent(new dc(this.requestId,this.privAudioSourceId,this.privAudioNodeId,this.privAuthFetchEventId,this.privSessionId)),this.privAudioNode&&this.privAudioNode.replay(),this.privTurnStartAudioOffset=this.privLastRecoOffset,void(this.privBytesSent=0);403===e&&(yield this.onComplete())}))}onServiceTurnEndResponse(e){return wc(this,void 0,void 0,(function*(){this.privTurnDeferral.resolve(),!e||this.isSpeechEnded?(yield this.onComplete(),this.privInTurn=!1):(this.privTurnStartAudioOffset=this.privLastRecoOffset,this.privAudioNode.replay())}))}onHypothesis(e){this.privHypothesisReceived||(this.privHypothesisReceived=!0,this.privServiceTelemetryListener.hypothesisReceived(this.privAudioNode.findTimeAtOffset(e)))}onPhraseRecognized(e){this.privServiceTelemetryListener.phraseReceived(this.privAudioNode.findTimeAtOffset(e)),this.onServiceRecognized(e)}onServiceRecognized(e){this.privLastRecoOffset=e,this.privHypothesisReceived=!1,this.privAudioNode.shrinkBuffers(e),this.privConnectionAttempts=0}onAudioSent(e){this.privBytesSent+=e}onRetryConnection(){this.privConnectionAttempts++}dispose(e){var t;return wc(this,void 0,void 0,(function*(){if(!this.privIsDisposed){this.privIsDisposed=!0;for(const e of this.privDetachables)yield e.detach();null===(t=this.privServiceTelemetryListener)||void 0===t||t.dispose(),this.privIsRecognizing=!1}}))}onStopRecognizing(){return wc(this,void 0,void 0,(function*(){yield this.onComplete()}))}onSpeechEnded(){this.privIsSpeechEnded=!0}onComplete(){return wc(this,void 0,void 0,(function*(){this.privIsRecognizing&&(this.privIsRecognizing=!1,yield this.detachAudioNode())}))}detachAudioNode(){return wc(this,void 0,void 0,(function*(){this.privIsAudioNodeDetached||(this.privIsAudioNodeDetached=!0,this.privAudioNode&&(yield this.privAudioNode.detach()))}))}}class Sc{constructor(e){this.privContext={},this.privDynamicGrammar=e}setSection(e,t){this.privContext[e]=t}setPronunciationAssessmentParams(e){void 0===this.privContext.phraseDetection&&(this.privContext.phraseDetection={enrichment:{pronunciationAssessment:{}}}),this.privContext.phraseDetection.enrichment.pronunciationAssessment=JSON.parse(e),void 0===this.privContext.phraseOutput&&(this.privContext.phraseOutput={detailed:{options:[]},format:{}}),this.privContext.phraseOutput.format="Detailed",this.privContext.phraseOutput.detailed.options.push("PronunciationAssessment"),-1===this.privContext.phraseOutput.detailed.options.indexOf("WordTimings")&&this.privContext.phraseOutput.detailed.options.push("WordTimings"),-1===this.privContext.phraseOutput.detailed.options.indexOf("SNR")&&this.privContext.phraseOutput.detailed.options.push("SNR")}toJSON(){const e=this.privDynamicGrammar.generateGrammarObject();this.setSection("dgi",e);return JSON.stringify(this.privContext)}}class Mc{addPhrase(e){this.privPhrases||(this.privPhrases=[]),e instanceof Array?this.privPhrases=this.privPhrases.concat(e):this.privPhrases.push(e)}clearPhrases(){this.privPhrases=void 0}addReferenceGrammar(e){this.privGrammars||(this.privGrammars=[]),e instanceof Array?this.privGrammars=this.privGrammars.concat(e):this.privGrammars.push(e)}clearGrammars(){this.privGrammars=void 0}generateGrammarObject(){if(void 0===this.privGrammars&&void 0===this.privPhrases)return;const e={};if(e.ReferenceGrammars=this.privGrammars,void 0!==this.privPhrases&&0!==this.privPhrases.length){const t=[];this.privPhrases.forEach(((e,n,r)=>{t.push({Text:e})})),e.Groups=[{Type:"Generic",Items:t}]}return e}}(pc=hc||(hc={}))[pc.Raw8Khz8BitMonoMULaw=0]="Raw8Khz8BitMonoMULaw",pc[pc.Riff16Khz16KbpsMonoSiren=1]="Riff16Khz16KbpsMonoSiren",pc[pc.Audio16Khz16KbpsMonoSiren=2]="Audio16Khz16KbpsMonoSiren",pc[pc.Audio16Khz32KBitRateMonoMp3=3]="Audio16Khz32KBitRateMonoMp3",pc[pc.Audio16Khz128KBitRateMonoMp3=4]="Audio16Khz128KBitRateMonoMp3",pc[pc.Audio16Khz64KBitRateMonoMp3=5]="Audio16Khz64KBitRateMonoMp3",pc[pc.Audio24Khz48KBitRateMonoMp3=6]="Audio24Khz48KBitRateMonoMp3",pc[pc.Audio24Khz96KBitRateMonoMp3=7]="Audio24Khz96KBitRateMonoMp3",pc[pc.Audio24Khz160KBitRateMonoMp3=8]="Audio24Khz160KBitRateMonoMp3",pc[pc.Raw16Khz16BitMonoTrueSilk=9]="Raw16Khz16BitMonoTrueSilk",pc[pc.Riff16Khz16BitMonoPcm=10]="Riff16Khz16BitMonoPcm",pc[pc.Riff8Khz16BitMonoPcm=11]="Riff8Khz16BitMonoPcm",pc[pc.Riff24Khz16BitMonoPcm=12]="Riff24Khz16BitMonoPcm",pc[pc.Riff8Khz8BitMonoMULaw=13]="Riff8Khz8BitMonoMULaw",pc[pc.Raw16Khz16BitMonoPcm=14]="Raw16Khz16BitMonoPcm",pc[pc.Raw24Khz16BitMonoPcm=15]="Raw24Khz16BitMonoPcm",pc[pc.Raw8Khz16BitMonoPcm=16]="Raw8Khz16BitMonoPcm",pc[pc.Ogg16Khz16BitMonoOpus=17]="Ogg16Khz16BitMonoOpus",pc[pc.Ogg24Khz16BitMonoOpus=18]="Ogg24Khz16BitMonoOpus",pc[pc.Raw48Khz16BitMonoPcm=19]="Raw48Khz16BitMonoPcm",pc[pc.Riff48Khz16BitMonoPcm=20]="Riff48Khz16BitMonoPcm",pc[pc.Audio48Khz96KBitRateMonoMp3=21]="Audio48Khz96KBitRateMonoMp3",pc[pc.Audio48Khz192KBitRateMonoMp3=22]="Audio48Khz192KBitRateMonoMp3",pc[pc.Ogg48Khz16BitMonoOpus=23]="Ogg48Khz16BitMonoOpus",pc[pc.Webm16Khz16BitMonoOpus=24]="Webm16Khz16BitMonoOpus",pc[pc.Webm24Khz16BitMonoOpus=25]="Webm24Khz16BitMonoOpus",pc[pc.Raw24Khz16BitMonoTrueSilk=26]="Raw24Khz16BitMonoTrueSilk",pc[pc.Raw8Khz8BitMonoALaw=27]="Raw8Khz8BitMonoALaw",pc[pc.Riff8Khz8BitMonoALaw=28]="Riff8Khz8BitMonoALaw",pc[pc.Webm24Khz16Bit24KbpsMonoOpus=29]="Webm24Khz16Bit24KbpsMonoOpus",pc[pc.Audio16Khz16Bit32KbpsMonoOpus=30]="Audio16Khz16Bit32KbpsMonoOpus",pc[pc.Audio24Khz16Bit48KbpsMonoOpus=31]="Audio24Khz16Bit48KbpsMonoOpus",pc[pc.Audio24Khz16Bit24KbpsMonoOpus=32]="Audio24Khz16Bit24KbpsMonoOpus",(gc=mc||(mc={}))[gc.PCM=1]="PCM",gc[gc.MuLaw=2]="MuLaw",gc[gc.Siren=3]="Siren",gc[gc.MP3=4]="MP3",gc[gc.SILKSkype=5]="SILKSkype",gc[gc.OGG_OPUS=6]="OGG_OPUS",gc[gc.WEBM_OPUS=7]="WEBM_OPUS",gc[gc.ALaw=8]="ALaw",gc[gc.FLAC=9]="FLAC",gc[gc.OPUS=10]="OPUS";class _c{static getDefaultInputFormat(){return Ac.getDefaultInputFormat()}static getWaveFormat(e,t,n,r){return new Ac(e,t,n,r)}static getWaveFormatPCM(e,t,n){return new Ac(e,t,n)}}class Ac extends _c{constructor(e=16e3,t=16,n=1,r=mc.PCM){super(),this.setString=(e,t,n)=>{for(let r=0;r<n.length;r++)e.setUint8(t+r,n.charCodeAt(r))};let i=!0;switch(r){case mc.PCM:this.formatTag=1;break;case mc.ALaw:this.formatTag=6;break;case mc.MuLaw:this.formatTag=7;break;default:i=!1}if(this.bitsPerSample=t,this.samplesPerSec=e,this.channels=n,this.avgBytesPerSec=this.samplesPerSec*this.channels*(this.bitsPerSample/8),this.blockAlign=this.channels*Math.max(this.bitsPerSample,8),i){this.privHeader=new ArrayBuffer(44);const e=new DataView(this.privHeader);this.setString(e,0,"RIFF"),e.setUint32(4,0,!0),this.setString(e,8,"WAVEfmt "),e.setUint32(16,16,!0),e.setUint16(20,this.formatTag,!0),e.setUint16(22,this.channels,!0),e.setUint32(24,this.samplesPerSec,!0),e.setUint32(28,this.avgBytesPerSec,!0),e.setUint16(32,this.channels*(this.bitsPerSample/8),!0),e.setUint16(34,this.bitsPerSample,!0),this.setString(e,36,"data"),e.setUint32(40,0,!0)}}static getDefaultInputFormat(){return new Ac}static getAudioContext(e){const t=window.AudioContext||window.webkitAudioContext||!1;if(t)return void 0!==e&&navigator.mediaDevices.getSupportedConstraints().sampleRate?new t({sampleRate:e}):new t;throw new Error("Browser does not support Web Audio API (AudioContext is not available).")}close(){}get header(){return this.privHeader}}class Ec extends Ac{constructor(e,t,n,r,i,o,a,s,l){super(n,o,t,e),this.formatTag=e,this.avgBytesPerSec=r,this.blockAlign=i,this.priAudioFormatString=a,this.priRequestAudioFormatString=s,this.priHasHeader=l}static fromSpeechSynthesisOutputFormat(e){return void 0===e?Ec.getDefaultOutputFormat():Ec.fromSpeechSynthesisOutputFormatString(Ec.SpeechSynthesisOutputFormatToString[e])}static fromSpeechSynthesisOutputFormatString(e){switch(e){case"raw-8khz-8bit-mono-mulaw":return new Ec(mc.MuLaw,1,8e3,8e3,1,8,e,e,!1);case"riff-16khz-16kbps-mono-siren":return new Ec(mc.Siren,1,16e3,2e3,40,0,e,"audio-16khz-16kbps-mono-siren",!0);case"audio-16khz-16kbps-mono-siren":return new Ec(mc.Siren,1,16e3,2e3,40,0,e,e,!1);case"audio-16khz-32kbitrate-mono-mp3":return new Ec(mc.MP3,1,16e3,4096,2,16,e,e,!1);case"audio-16khz-128kbitrate-mono-mp3":return new Ec(mc.MP3,1,16e3,16384,2,16,e,e,!1);case"audio-16khz-64kbitrate-mono-mp3":return new Ec(mc.MP3,1,16e3,8192,2,16,e,e,!1);case"audio-24khz-48kbitrate-mono-mp3":return new Ec(mc.MP3,1,24e3,6144,2,16,e,e,!1);case"audio-24khz-96kbitrate-mono-mp3":return new Ec(mc.MP3,1,24e3,12288,2,16,e,e,!1);case"audio-24khz-160kbitrate-mono-mp3":return new Ec(mc.MP3,1,24e3,20480,2,16,e,e,!1);case"raw-16khz-16bit-mono-truesilk":return new Ec(mc.SILKSkype,1,16e3,32e3,2,16,e,e,!1);case"riff-8khz-16bit-mono-pcm":return new Ec(mc.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!0);case"riff-24khz-16bit-mono-pcm":return new Ec(mc.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!0);case"riff-8khz-8bit-mono-mulaw":return new Ec(mc.MuLaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-mulaw",!0);case"raw-16khz-16bit-mono-pcm":return new Ec(mc.PCM,1,16e3,32e3,2,16,e,"raw-16khz-16bit-mono-pcm",!1);case"raw-24khz-16bit-mono-pcm":return new Ec(mc.PCM,1,24e3,48e3,2,16,e,"raw-24khz-16bit-mono-pcm",!1);case"raw-8khz-16bit-mono-pcm":return new Ec(mc.PCM,1,8e3,16e3,2,16,e,"raw-8khz-16bit-mono-pcm",!1);case"ogg-16khz-16bit-mono-opus":return new Ec(mc.OGG_OPUS,1,16e3,8192,2,16,e,e,!1);case"ogg-24khz-16bit-mono-opus":return new Ec(mc.OGG_OPUS,1,24e3,8192,2,16,e,e,!1);case"raw-48khz-16bit-mono-pcm":return new Ec(mc.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!1);case"riff-48khz-16bit-mono-pcm":return new Ec(mc.PCM,1,48e3,96e3,2,16,e,"raw-48khz-16bit-mono-pcm",!0);case"audio-48khz-96kbitrate-mono-mp3":return new Ec(mc.MP3,1,48e3,12288,2,16,e,e,!1);case"audio-48khz-192kbitrate-mono-mp3":return new Ec(mc.MP3,1,48e3,24576,2,16,e,e,!1);case"ogg-48khz-16bit-mono-opus":return new Ec(mc.OGG_OPUS,1,48e3,12e3,2,16,e,e,!1);case"webm-16khz-16bit-mono-opus":return new Ec(mc.WEBM_OPUS,1,16e3,4e3,2,16,e,e,!1);case"webm-24khz-16bit-mono-opus":return new Ec(mc.WEBM_OPUS,1,24e3,6e3,2,16,e,e,!1);case"webm-24khz-16bit-24kbps-mono-opus":return new Ec(mc.WEBM_OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-16khz-16bit-32kbps-mono-opus":return new Ec(mc.OPUS,1,16e3,4e3,2,16,e,e,!1);case"audio-24khz-16bit-48kbps-mono-opus":return new Ec(mc.OPUS,1,24e3,6e3,2,16,e,e,!1);case"audio-24khz-16bit-24kbps-mono-opus":return new Ec(mc.OPUS,1,24e3,3e3,2,16,e,e,!1);case"audio-24khz-16bit-mono-flac":return new Ec(mc.FLAC,1,24e3,24e3,2,16,e,e,!1);case"audio-48khz-16bit-mono-flac":return new Ec(mc.FLAC,1,48e3,3e4,2,16,e,e,!1);case"raw-24khz-16bit-mono-truesilk":return new Ec(mc.SILKSkype,1,24e3,48e3,2,16,e,e,!1);case"raw-8khz-8bit-mono-alaw":return new Ec(mc.ALaw,1,8e3,8e3,1,8,e,e,!1);case"riff-8khz-8bit-mono-alaw":return new Ec(mc.ALaw,1,8e3,8e3,1,8,e,"raw-8khz-8bit-mono-alaw",!0);default:return new Ec(mc.PCM,1,16e3,32e3,2,16,"riff-16khz-16bit-mono-pcm","raw-16khz-16bit-mono-pcm",!0)}}static getDefaultOutputFormat(){return Ec.fromSpeechSynthesisOutputFormatString("undefined"!=typeof window?"audio-24khz-48kbitrate-mono-mp3":"riff-16khz-16bit-mono-pcm")}get hasHeader(){return this.priHasHeader}get header(){if(this.hasHeader)return this.privHeader}updateHeader(e){if(this.priHasHeader){new DataView(this.privHeader).setUint32(40,e,!0)}}get requestAudioFormatString(){return this.priRequestAudioFormatString}}Ec.SpeechSynthesisOutputFormatToString={[hc.Raw8Khz8BitMonoMULaw]:"raw-8khz-8bit-mono-mulaw",[hc.Riff16Khz16KbpsMonoSiren]:"riff-16khz-16kbps-mono-siren",[hc.Audio16Khz16KbpsMonoSiren]:"audio-16khz-16kbps-mono-siren",[hc.Audio16Khz32KBitRateMonoMp3]:"audio-16khz-32kbitrate-mono-mp3",[hc.Audio16Khz128KBitRateMonoMp3]:"audio-16khz-128kbitrate-mono-mp3",[hc.Audio16Khz64KBitRateMonoMp3]:"audio-16khz-64kbitrate-mono-mp3",[hc.Audio24Khz48KBitRateMonoMp3]:"audio-24khz-48kbitrate-mono-mp3",[hc.Audio24Khz96KBitRateMonoMp3]:"audio-24khz-96kbitrate-mono-mp3",[hc.Audio24Khz160KBitRateMonoMp3]:"audio-24khz-160kbitrate-mono-mp3",[hc.Raw16Khz16BitMonoTrueSilk]:"raw-16khz-16bit-mono-truesilk",[hc.Riff16Khz16BitMonoPcm]:"riff-16khz-16bit-mono-pcm",[hc.Riff8Khz16BitMonoPcm]:"riff-8khz-16bit-mono-pcm",[hc.Riff24Khz16BitMonoPcm]:"riff-24khz-16bit-mono-pcm",[hc.Riff8Khz8BitMonoMULaw]:"riff-8khz-8bit-mono-mulaw",[hc.Raw16Khz16BitMonoPcm]:"raw-16khz-16bit-mono-pcm",[hc.Raw24Khz16BitMonoPcm]:"raw-24khz-16bit-mono-pcm",[hc.Raw8Khz16BitMonoPcm]:"raw-8khz-16bit-mono-pcm",[hc.Ogg16Khz16BitMonoOpus]:"ogg-16khz-16bit-mono-opus",[hc.Ogg24Khz16BitMonoOpus]:"ogg-24khz-16bit-mono-opus",[hc.Raw48Khz16BitMonoPcm]:"raw-48khz-16bit-mono-pcm",[hc.Riff48Khz16BitMonoPcm]:"riff-48khz-16bit-mono-pcm",[hc.Audio48Khz96KBitRateMonoMp3]:"audio-48khz-96kbitrate-mono-mp3",[hc.Audio48Khz192KBitRateMonoMp3]:"audio-48khz-192kbitrate-mono-mp3",[hc.Ogg48Khz16BitMonoOpus]:"ogg-48khz-16bit-mono-opus",[hc.Webm16Khz16BitMonoOpus]:"webm-16khz-16bit-mono-opus",[hc.Webm24Khz16BitMonoOpus]:"webm-24khz-16bit-mono-opus",[hc.Webm24Khz16Bit24KbpsMonoOpus]:"webm-24khz-16bit-24kbps-mono-opus",[hc.Raw24Khz16BitMonoTrueSilk]:"raw-24khz-16bit-mono-truesilk",[hc.Raw8Khz8BitMonoALaw]:"raw-8khz-8bit-mono-alaw",[hc.Riff8Khz8BitMonoALaw]:"riff-8khz-8bit-mono-alaw",[hc.Audio16Khz16Bit32KbpsMonoOpus]:"audio-16khz-16bit-32kbps-mono-opus",[hc.Audio24Khz16Bit48KbpsMonoOpus]:"audio-24khz-16bit-48kbps-mono-opus",[hc.Audio24Khz16Bit24KbpsMonoOpus]:"audio-24khz-16bit-24kbps-mono-opus"},(yc=vc||(vc={}))[yc.Masked=0]="Masked",yc[yc.Removed=1]="Removed",yc[yc.Raw=2]="Raw";class Cc{constructor(){}static fromSubscription(e,t){Wl.throwIfNullOrWhitespace(e,"subscriptionKey"),Wl.throwIfNullOrWhitespace(t,"region");const n=new kc;return n.setProperty(cl.SpeechServiceConnection_Region,t),n.setProperty(cl.SpeechServiceConnection_IntentRegion,t),n.setProperty(cl.SpeechServiceConnection_Key,e),n}static fromEndpoint(e,t){Wl.throwIfNull(e,"endpoint");const n=new kc;return n.setProperty(cl.SpeechServiceConnection_Endpoint,e.href),void 0!==t&&n.setProperty(cl.SpeechServiceConnection_Key,t),n}static fromHost(e,t){Wl.throwIfNull(e,"hostName");const n=new kc;return n.setProperty(cl.SpeechServiceConnection_Host,e.protocol+"//"+e.hostname+(""===e.port?"":":"+e.port)),void 0!==t&&n.setProperty(cl.SpeechServiceConnection_Key,t),n}static fromAuthorizationToken(e,t){Wl.throwIfNull(e,"authorizationToken"),Wl.throwIfNullOrWhitespace(t,"region");const n=new kc;return n.setProperty(cl.SpeechServiceConnection_Region,t),n.setProperty(cl.SpeechServiceConnection_IntentRegion,t),n.authorizationToken=e,n}close(){}}class kc extends Cc{constructor(){super(),this.privProperties=new Gl,this.speechRecognitionLanguage="en-US",this.outputFormat=Ol.Simple}get properties(){return this.privProperties}get endPoint(){return new URL(this.privProperties.getProperty(cl.SpeechServiceConnection_Endpoint))}get subscriptionKey(){return this.privProperties.getProperty(cl.SpeechServiceConnection_Key)}get region(){return this.privProperties.getProperty(cl.SpeechServiceConnection_Region)}get authorizationToken(){return this.privProperties.getProperty(cl.SpeechServiceAuthorization_Token)}set authorizationToken(e){this.privProperties.setProperty(cl.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return this.privProperties.getProperty(cl.SpeechServiceConnection_RecoLanguage)}set speechRecognitionLanguage(e){this.privProperties.setProperty(cl.SpeechServiceConnection_RecoLanguage,e)}get autoDetectSourceLanguages(){return this.privProperties.getProperty(cl.SpeechServiceConnection_AutoDetectSourceLanguages)}set autoDetectSourceLanguages(e){this.privProperties.setProperty(cl.SpeechServiceConnection_AutoDetectSourceLanguages,e)}get outputFormat(){return Ol[this.privProperties.getProperty(fu,void 0)]}set outputFormat(e){this.privProperties.setProperty(fu,Ol[e])}get endpointId(){return this.privProperties.getProperty(cl.SpeechServiceConnection_EndpointId)}set endpointId(e){this.privProperties.setProperty(cl.SpeechServiceConnection_EndpointId,e)}setProperty(e,t){Wl.throwIfNull(t,"value"),this.privProperties.setProperty(e,t)}getProperty(e,t){return this.privProperties.getProperty(e,t)}setProxy(e,t,n,r){this.setProperty(cl[cl.SpeechServiceConnection_ProxyHostName],e),this.setProperty(cl[cl.SpeechServiceConnection_ProxyPort],t),this.setProperty(cl[cl.SpeechServiceConnection_ProxyUserName],n),this.setProperty(cl[cl.SpeechServiceConnection_ProxyPassword],r)}setServiceProperty(e,t,n){const r=JSON.parse(this.privProperties.getProperty(pu,"{}"));r[e]=t,this.privProperties.setProperty(pu,JSON.stringify(r))}setProfanity(e){this.privProperties.setProperty(cl.SpeechServiceResponse_ProfanityOption,vc[e])}enableAudioLogging(){this.privProperties.setProperty(cl.SpeechServiceConnection_EnableAudioLogging,"true")}requestWordLevelTimestamps(){this.privProperties.setProperty(cl.SpeechServiceResponse_RequestWordLevelTimestamps,"true")}enableDictation(){this.privProperties.setProperty(mu,"true")}clone(){const e=new kc;return e.privProperties=this.privProperties.clone(),e}get speechSynthesisLanguage(){return this.privProperties.getProperty(cl.SpeechServiceConnection_SynthLanguage)}set speechSynthesisLanguage(e){this.privProperties.setProperty(cl.SpeechServiceConnection_SynthLanguage,e)}get speechSynthesisVoiceName(){return this.privProperties.getProperty(cl.SpeechServiceConnection_SynthVoice)}set speechSynthesisVoiceName(e){this.privProperties.setProperty(cl.SpeechServiceConnection_SynthVoice,e)}get speechSynthesisOutputFormat(){return hc[this.privProperties.getProperty(cl.SpeechServiceConnection_SynthOutputFormat,void 0)]}set speechSynthesisOutputFormat(e){this.privProperties.setProperty(cl.SpeechServiceConnection_SynthOutputFormat,hc[e])}}class Tc{constructor(){}set applicationId(e){}}Tc.DialogTypes=((bc=class{}).BotFramework="bot_framework",bc.CustomCommands="custom_commands",bc);var Ic={};e(Ic,"AudioOutputStream",(()=>Nc),(e=>Nc=e)),e(Ic,"PullAudioOutputStream",(()=>Lc),(e=>Lc=e)),e(Ic,"PullAudioOutputStreamImpl",(()=>Dc),(e=>Dc=e)),e(Ic,"PushAudioOutputStream",(()=>Bc),(e=>Bc=e)),e(Ic,"PushAudioOutputStreamImpl",(()=>jc),(e=>jc=e));var Oc,Rc,Pc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Nc{constructor(){}static createPullStream(){return Lc.create()}}class Lc extends Nc{static create(){return new Dc}}class Dc extends Lc{constructor(){super(),this.privId=Ba(),this.privStream=new(0,Ts.Stream)}set format(e){null==e&&(this.privFormat=Ec.getDefaultOutputFormat()),this.privFormat=e}get format(){return this.privFormat}get isClosed(){return this.privStream.isClosed}id(){return this.privId}read(e){return Pc(this,void 0,void 0,(function*(){const t=new Int8Array(e);let n=0;if(void 0!==this.privLastChunkView){if(this.privLastChunkView.length>e.byteLength)return t.set(this.privLastChunkView.slice(0,e.byteLength)),this.privLastChunkView=this.privLastChunkView.slice(e.byteLength),Promise.resolve(e.byteLength);t.set(this.privLastChunkView),n=this.privLastChunkView.length,this.privLastChunkView=void 0}for(;n<e.byteLength&&!this.privStream.isReadEnded;){const r=yield this.privStream.read();if(void 0===r||r.isEnd)yield this.privStream.readEnded();else{let i;r.buffer.byteLength>e.byteLength-n?(i=r.buffer.slice(0,e.byteLength-n),this.privLastChunkView=new Int8Array(r.buffer.slice(e.byteLength-n))):i=r.buffer,t.set(new Int8Array(i),n),n+=i.byteLength}}return n}))}write(e){Wl.throwIfNullOrUndefined(this.privStream,"must set format before writing"),this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}}class Bc extends Nc{constructor(){super()}static create(e){return new jc(e)}}class jc extends Bc{constructor(e){super(),this.privId=Ba(),this.privCallback=e}set format(e){}write(e){this.privCallback.write&&this.privCallback.write(e)}close(){this.privCallback.close&&this.privCallback.close()}id(){return this.privId}}(Rc=Oc||(Oc={}))[Rc.None=0]="None",Rc[Rc.TextToSpeechAudio=1]="TextToSpeechAudio";var Fc,Uc;class zc{toJsonString(){return JSON.stringify(this.iPrivConfig)}get(){return this.iPrivConfig}set(e){this.iPrivConfig=e}}(Uc=Fc||(Fc={})).WordBoundary="WordBoundary",Uc.Bookmark="Bookmark",Uc.Viseme="Viseme";class Hc{constructor(e){this.privSynthesisAudioMetadata=JSON.parse(e)}static fromJSON(e){return new Hc(e)}get Metadata(){return this.privSynthesisAudioMetadata.Metadata}}var Vc={};e(Vc,"SynthesisTurn",(()=>lu),(e=>lu=e));var Wc={};e(Wc,"SynthesisAdapterBase",(()=>Zc),(e=>Zc=e));class Gc{constructor(e){this.privResult=e}get result(){return this.privResult}}class qc{constructor(e,t,n,r){this.privResultId=e,this.privReason=t,this.privErrorDetails=n,this.privProperties=r}get resultId(){return this.privResultId}get reason(){return this.privReason}get errorDetails(){return this.privErrorDetails}get properties(){return this.privProperties}}class Kc extends qc{constructor(e,t,n,r,i){super(e,t,r,i),this.privAudioData=n}get audioData(){return this.privAudioData}}class Yc{constructor(e,t,n,r){this.privAudioOffset=e,this.privText=t,this.privWordLength=n,this.privTextOffset=r}get audioOffset(){return this.privAudioOffset}get text(){return this.privText}get wordLength(){return this.privWordLength}get textOffset(){return this.privTextOffset}}class Jc{constructor(e,t){this.privAudioOffset=e,this.privText=t}get audioOffset(){return this.privAudioOffset}get text(){return this.privText}}class Qc{constructor(e,t,n){this.privAudioOffset=e,this.privVisemeId=t,this.privAnimation=n}get audioOffset(){return this.privAudioOffset}get visemeId(){return this.privVisemeId}get animation(){return this.privAnimation}}var Xc=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Zc{constructor(e,t,n,r,i){if(this.speakOverride=void 0,this.receiveMessageOverride=void 0,this.connectImplOverride=void 0,this.configConnectionOverride=void 0,this.sendSynthesisContext=e=>{const t=this.synthesisContext.toJSON();if(t)return e.send(new pl(Ua.Text,"synthesis.context",this.privSynthesisTurn.requestId,"application/json",t))},this.sendSpeechServiceConfig=(e,t)=>{if(t)return e.send(new pl(Ua.Text,"speech.config",this.privSynthesisTurn.requestId,"application/json",t))},this.sendSsmlMessage=(e,t,n)=>e.send(new pl(Ua.Text,"ssml",n,"application/ssml+xml",t)),!e)throw new fs("authentication");if(!t)throw new fs("connectionFactory");if(!n)throw new fs("synthesizerConfig");this.privAuthentication=e,this.privConnectionFactory=t,this.privSynthesizerConfig=n,this.privIsDisposed=!1,this.privSpeechSynthesizer=r,this.privSessionAudioDestination=i,this.privSynthesisTurn=new(0,Vc.SynthesisTurn),this.privConnectionEvents=new vs,this.privServiceEvents=new vs,this.privSynthesisContext=new du(this.privSpeechSynthesizer),this.privAgentConfig=new zc,this.connectionEvents.attach((e=>{if("ConnectionClosedEvent"===e.name){const t=e;1e3!==t.statusCode&&this.cancelSynthesisLocal(ol.Error,1007===t.statusCode?sl.BadRequestParameters:sl.ConnectionFailure,t.reason+" websocket error code: "+t.statusCode)}}))}get synthesisContext(){return this.privSynthesisContext}get agentConfig(){return this.privAgentConfig}get connectionEvents(){return this.privConnectionEvents}get serviceEvents(){return this.privServiceEvents}set activityTemplate(e){this.privActivityTemplate=e}get activityTemplate(){return this.privActivityTemplate}set audioOutputFormat(e){this.privAudioOutputFormat=e,this.privSynthesisTurn.audioOutputFormat=e,void 0!==this.privSessionAudioDestination&&(this.privSessionAudioDestination.format=e),void 0!==this.synthesisContext&&(this.synthesisContext.audioOutputFormat=e)}static addHeader(e,t){if(!t.hasHeader)return e;t.updateHeader(e.byteLength);const n=new Uint8Array(e.byteLength+t.header.byteLength);return n.set(new Uint8Array(t.header),0),n.set(new Uint8Array(e),t.header.byteLength),n.buffer}isDisposed(){return this.privIsDisposed}dispose(e){return Xc(this,void 0,void 0,(function*(){if(this.privIsDisposed=!0,void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.close(),this.privConnectionConfigurationPromise){const t=yield this.privConnectionConfigurationPromise;yield t.dispose(e)}}))}connect(){return Xc(this,void 0,void 0,(function*(){yield this.connectImpl()}))}sendNetworkMessage(e,t){return Xc(this,void 0,void 0,(function*(){const n="string"==typeof t?Ua.Text:Ua.Binary,r="string"==typeof t?"application/json":"";return(yield this.fetchConnection()).send(new pl(n,e,this.privSynthesisTurn.requestId,r,t))}))}Speak(e,t,n,r,i,o){return Xc(this,void 0,void 0,(function*(){let a;if(a=t?e:this.privSpeechSynthesizer.buildSsml(e),void 0!==this.speakOverride)return this.speakOverride(a,n,r,i);this.privSuccessCallback=r,this.privErrorCallback=i,this.privSynthesisTurn.startNewSynthesis(n,e,t,o);try{yield this.connectImpl();const e=yield this.fetchConnection();yield this.sendSynthesisContext(e),yield this.sendSsmlMessage(e,a,n);const t=new Gc(new Kc(n,Pl.SynthesizingAudioStarted));this.privSpeechSynthesizer.synthesisStarted&&this.privSpeechSynthesizer.synthesisStarted(this.privSpeechSynthesizer,t);this.receiveMessage()}catch(e){return this.cancelSynthesisLocal(ol.Error,sl.ConnectionFailure,e),Promise.reject(e)}}))}cancelSynthesis(e,t,n,r){const i=new Gl;i.setProperty(hu,sl[n]);const o=new Kc(e,Pl.Canceled,void 0,r,i);if(this.privSpeechSynthesizer.SynthesisCanceled){const e=new Gc(o);try{this.privSpeechSynthesizer.SynthesisCanceled(this.privSpeechSynthesizer,e)}catch(e){}}if(this.privSuccessCallback)try{this.privSuccessCallback(o)}catch(e){}}cancelSynthesisLocal(e,t,n){this.privSynthesisTurn.isSynthesizing&&(this.privSynthesisTurn.onStopSynthesizing(),this.cancelSynthesis(this.privSynthesisTurn.requestId,e,t,n))}processTypeSpecificMessages(e,t,n){return!0}receiveMessage(){return Xc(this,void 0,void 0,(function*(){try{const e=yield this.fetchConnection(),t=yield e.read();if(void 0!==this.receiveMessageOverride)return this.receiveMessageOverride();if(this.privIsDisposed)return;if(!t)return this.privSynthesisTurn.isSynthesizing?this.receiveMessage():void 0;this.privServiceHasSentMessage=!0;const n=pl.fromConnectionMessage(t);if(n.requestId.toLowerCase()===this.privSynthesisTurn.requestId.toLowerCase())switch(n.path.toLowerCase()){case"turn.start":this.privSynthesisTurn.onServiceTurnStartResponse();break;case"response":this.privSynthesisTurn.onServiceResponseMessage(n.textBody);break;case"audio":if(this.privSynthesisTurn.streamId.toLowerCase()===n.streamId.toLowerCase()&&n.binaryBody){if(this.privSynthesisTurn.onAudioChunkReceived(n.binaryBody),this.privSpeechSynthesizer.synthesizing)try{const e=Zc.addHeader(n.binaryBody,this.privSynthesisTurn.audioOutputFormat),t=new Gc(new Kc(this.privSynthesisTurn.requestId,Pl.SynthesizingAudio,e));this.privSpeechSynthesizer.synthesizing(this.privSpeechSynthesizer,t)}catch(e){}void 0!==this.privSessionAudioDestination&&this.privSessionAudioDestination.write(n.binaryBody)}break;case"audio.metadata":const e=Hc.fromJSON(n.textBody).Metadata;for(const t of e)switch(t.Type){case Fc.WordBoundary:this.privSynthesisTurn.onWordBoundaryEvent(t.Data.text.Text);const e=new Yc(t.Data.Offset,t.Data.text.Text,t.Data.text.Length,this.privSynthesisTurn.currentTextOffset);if(this.privSpeechSynthesizer.wordBoundary)try{this.privSpeechSynthesizer.wordBoundary(this.privSpeechSynthesizer,e)}catch(e){}break;case Fc.Bookmark:const n=new Jc(t.Data.Offset,t.Data.Bookmark);if(this.privSpeechSynthesizer.bookmarkReached)try{this.privSpeechSynthesizer.bookmarkReached(this.privSpeechSynthesizer,n)}catch(e){}break;case Fc.Viseme:if(this.privSynthesisTurn.onVisemeMetadataReceived(t),t.Data.IsLastAnimation){const e=new Qc(t.Data.Offset,t.Data.VisemeId,this.privSynthesisTurn.getAndClearVisemeAnimation());if(this.privSpeechSynthesizer.visemeReceived)try{this.privSpeechSynthesizer.visemeReceived(this.privSpeechSynthesizer,e)}catch(e){}}}break;case"turn.end":let t;this.privSynthesisTurn.onServiceTurnEndResponse();try{const e=yield this.privSynthesisTurn.getAllReceivedAudioWithHeader();t=new Kc(this.privSynthesisTurn.requestId,Pl.SynthesizingAudioCompleted,e),this.privSuccessCallback&&this.privSuccessCallback(t)}catch(e){this.privErrorCallback&&this.privErrorCallback(e)}if(this.privSpeechSynthesizer.synthesisCompleted)try{this.privSpeechSynthesizer.synthesisCompleted(this.privSpeechSynthesizer,new Gc(t))}catch(e){}break;default:this.processTypeSpecificMessages(n)||this.privServiceEvents&&this.serviceEvents.onEvent(new rs(n.path.toLowerCase(),n.textBody))}return this.receiveMessage()}catch(e){}}))}connectImpl(e=!1){if(this.privConnectionPromise)return this.privConnectionPromise.then((e=>e.state()===Ha.Disconnected?(this.privConnectionId=null,this.privConnectionPromise=null,this.privServiceHasSentMessage=!1,this.connectImpl()):this.privConnectionPromise),(e=>(this.privConnectionId=null,this.privConnectionPromise=null,this.privServiceHasSentMessage=!1,this.connectImpl())));this.privAuthFetchEventId=Ba(),this.privConnectionId=Ba(),this.privSynthesisTurn.onPreConnectionStart(this.privAuthFetchEventId,this.privConnectionId);const t=e?this.privAuthentication.fetchOnExpiry(this.privAuthFetchEventId):this.privAuthentication.fetch(this.privAuthFetchEventId);return this.privConnectionPromise=t.then((t=>Xc(this,void 0,void 0,(function*(){yield this.privSynthesisTurn.onAuthCompleted(!1);const n=this.privConnectionFactory.create(this.privSynthesizerConfig,t,this.privConnectionId);n.events.attach((e=>{this.connectionEvents.onEvent(e)}));const r=yield n.open();return 200===r.statusCode?(yield this.privSynthesisTurn.onConnectionEstablishCompleted(r.statusCode),Promise.resolve(n)):403!==r.statusCode||e?(yield this.privSynthesisTurn.onConnectionEstablishCompleted(r.statusCode,r.reason),Promise.reject(`Unable to contact server. StatusCode: ${r.statusCode}, ${this.privSynthesizerConfig.parameters.getProperty(cl.SpeechServiceConnection_Endpoint)} Reason: ${r.reason}`)):this.connectImpl(!0)}))),(e=>Xc(this,void 0,void 0,(function*(){throw yield this.privSynthesisTurn.onAuthCompleted(!0,e),new Error(e)})))),this.privConnectionPromise.catch((()=>{})),this.privConnectionPromise}fetchConnection(){return Xc(this,void 0,void 0,(function*(){return this.privConnectionConfigurationPromise?this.privConnectionConfigurationPromise.then((e=>e.state()===Ha.Disconnected?(this.privConnectionId=null,this.privConnectionConfigurationPromise=null,this.privServiceHasSentMessage=!1,this.fetchConnection()):this.privConnectionConfigurationPromise),(e=>(this.privConnectionId=null,this.privConnectionConfigurationPromise=null,this.privServiceHasSentMessage=!1,this.fetchConnection()))):(this.privConnectionConfigurationPromise=this.configureConnection(),yield this.privConnectionConfigurationPromise)}))}configureConnection(){return Xc(this,void 0,void 0,(function*(){const e=yield this.connectImpl();return void 0!==this.configConnectionOverride?this.configConnectionOverride(e):(yield this.sendSpeechServiceConfig(e,this.privSynthesizerConfig.SpeechServiceConfig.serialize()),e)}))}}Zc.telemetryDataEnabled=!0;class $c extends qa{constructor(e,t,n=ja.Info){super(e,n),this.privRequestId=t}get requestId(){return this.privRequestId}}class eu extends $c{constructor(e,t,n){super("SynthesisTriggeredEvent",e),this.privSessionAudioDestinationId=t,this.privTurnAudioDestinationId=n}get audioSessionDestinationId(){return this.privSessionAudioDestinationId}get audioTurnDestinationId(){return this.privTurnAudioDestinationId}}class tu extends $c{constructor(e,t){super("ConnectingToSynthesisServiceEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}class nu extends $c{constructor(e,t){super("SynthesisStartedEvent",e),this.privAuthFetchEventId=t}get authFetchEventId(){return this.privAuthFetchEventId}}var ru,iu,ou,au,su=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class lu{constructor(){this.privIsDisposed=!1,this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!1,this.privBytesReceived=0,this.privInTurn=!1,this.privTextOffset=0,this.privNextSearchTextIndex=0,this.onPreConnectionStart=(e,t)=>{this.privAuthFetchEventId=e,this.onEvent(new tu(this.privRequestId,this.privAuthFetchEventId))},this.onAuthCompleted=(e,t)=>{e&&this.onComplete()},this.onConnectionEstablishCompleted=(e,t)=>{if(200===e)return this.onEvent(new nu(this.requestId,this.privAuthFetchEventId)),void(this.privBytesReceived=0);403===e&&this.onComplete()},this.onServiceResponseMessage=e=>{const t=JSON.parse(e);this.streamId=t.audio.streamId},this.onServiceTurnEndResponse=()=>{this.privInTurn=!1,this.privTurnDeferral.resolve(),this.onComplete()},this.onServiceTurnStartResponse=()=>{this.privTurnDeferral&&this.privInTurn&&(this.privTurnDeferral.reject("Another turn started before current completed."),this.privTurnDeferral.promise.then().catch((()=>{}))),this.privInTurn=!0,this.privTurnDeferral=new bs},this.dispose=e=>{this.privIsDisposed||(this.privIsDisposed=!0)},this.onEvent=e=>{ys.instance.onEvent(e)},this.onComplete=()=>{this.privIsSynthesizing&&(this.privIsSynthesizing=!1,this.privIsSynthesisEnded=!0,this.privAudioOutputStream.close(),this.privInTurn=!1,void 0!==this.privTurnAudioDestination&&(this.privTurnAudioDestination.close(),this.privTurnAudioDestination=void 0))},this.privRequestId=Ba(),this.privTurnDeferral=new bs,this.privTurnDeferral.resolve()}get requestId(){return this.privRequestId}get streamId(){return this.privStreamId}set streamId(e){this.privStreamId=e}get audioOutputFormat(){return this.privAudioOutputFormat}set audioOutputFormat(e){this.privAudioOutputFormat=e}get turnCompletionPromise(){return this.privTurnDeferral.promise}get isSynthesisEnded(){return this.privIsSynthesisEnded}get isSynthesizing(){return this.privIsSynthesizing}get currentTextOffset(){return this.privTextOffset}get bytesReceived(){return this.privBytesReceived}getAllReceivedAudio(){return su(this,void 0,void 0,(function*(){return this.privReceivedAudio?Promise.resolve(this.privReceivedAudio):this.privIsSynthesisEnded?(yield this.readAllAudioFromStream(),Promise.resolve(this.privReceivedAudio)):null}))}getAllReceivedAudioWithHeader(){return su(this,void 0,void 0,(function*(){if(this.privReceivedAudioWithHeader)return this.privReceivedAudioWithHeader;if(!this.privIsSynthesisEnded)return null;if(this.audioOutputFormat.hasHeader){const e=yield this.getAllReceivedAudio();return this.privReceivedAudioWithHeader=Wc.SynthesisAdapterBase.addHeader(e,this.audioOutputFormat),this.privReceivedAudioWithHeader}return this.getAllReceivedAudio()}))}startNewSynthesis(e,t,n,r){this.privIsSynthesisEnded=!1,this.privIsSynthesizing=!0,this.privRequestId=e,this.privRawText=t,this.privIsSSML=n,this.privAudioOutputStream=new(0,Ic.PullAudioOutputStreamImpl),this.privAudioOutputStream.format=this.privAudioOutputFormat,this.privReceivedAudio=null,this.privReceivedAudioWithHeader=null,this.privBytesReceived=0,this.privTextOffset=0,this.privNextSearchTextIndex=0,this.privPartialVisemeAnimation="",void 0!==r&&(this.privTurnAudioDestination=r,this.privTurnAudioDestination.format=this.privAudioOutputFormat),this.onEvent(new eu(this.requestId,void 0,void 0===r?void 0:r.id()))}onAudioChunkReceived(e){this.isSynthesizing&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength,void 0!==this.privTurnAudioDestination&&this.privTurnAudioDestination.write(e))}onWordBoundaryEvent(e){this.updateTextOffset(e)}onVisemeMetadataReceived(e){void 0!==e.Data.AnimationChunk&&(this.privPartialVisemeAnimation+=e.Data.AnimationChunk)}onStopSynthesizing(){this.onComplete()}getAndClearVisemeAnimation(){const e=this.privPartialVisemeAnimation;return this.privPartialVisemeAnimation="",e}updateTextOffset(e){this.privTextOffset>=0&&(this.privTextOffset=this.privRawText.indexOf(e,this.privNextSearchTextIndex),this.privTextOffset>=0&&(this.privNextSearchTextIndex=this.privTextOffset+e.length),this.privIsSSML&&this.privRawText.indexOf("<",this.privTextOffset+1)>this.privRawText.indexOf(">",this.privTextOffset+1)&&this.updateTextOffset(e))}readAllAudioFromStream(){return su(this,void 0,void 0,(function*(){if(this.privIsSynthesisEnded){this.privReceivedAudio=new ArrayBuffer(this.bytesReceived);try{yield this.privAudioOutputStream.read(this.privReceivedAudio)}catch(e){this.privReceivedAudio=new ArrayBuffer(0)}}}))}}class cu{constructor(e){let t=e.parameters.getProperty(cl.SpeechServiceConnection_Endpoint,void 0);if(!t){const n=e.parameters.getProperty(cl.SpeechServiceConnection_Region,"westus"),r=Ul.getHostSuffix(n);t=e.parameters.getProperty(cl.SpeechServiceConnection_Host,`https://${n}.tts.speech${r}`)}this.privUri=`${t}/cognitiveservices/voices/list`;const n=pd.requestOptions;n.headers[pd.configParams.subscriptionKey]=e.parameters.getProperty(cl.SpeechServiceConnection_Key,void 0),this.privRestAdapter=new(0,od.RestMessageAdapter)(n)}getVoicesList(e){return this.privRestAdapter.setHeaders(el.ConnectionId,e),this.privRestAdapter.request(od.RestRequestType.Get,this.privUri)}}(iu=ru||(ru={}))[iu.Standard=0]="Standard",iu[iu.Custom=1]="Custom";class uu{constructor(e,t){this.privSynthesisServiceType=ru.Standard,this.privSpeechServiceConfig=e||new El(new Cl(null)),this.privParameters=t}get parameters(){return this.privParameters}get synthesisServiceType(){return this.privSynthesisServiceType}set synthesisServiceType(e){this.privSynthesisServiceType=e}get SpeechServiceConfig(){return this.privSpeechServiceConfig}}class du{constructor(e){this.privContext={},this.privSpeechSynthesizer=e}setSection(e,t){this.privContext[e]=t}set audioOutputFormat(e){this.privAudioOutputFormat=e}toJSON(){const e=this.buildSynthesisContext();return this.setSection("synthesis",e),JSON.stringify(this.privContext)}buildSynthesisContext(){return{audio:{metadataOptions:{bookmarkEnabled:!!this.privSpeechSynthesizer.bookmarkReached,sentenceBoundaryEnabled:!1,visemeEnabled:!!this.privSpeechSynthesizer.visemeReceived,wordBoundaryEnabled:!!this.privSpeechSynthesizer.wordBoundary},outputFormat:this.privAudioOutputFormat.requestAudioFormatString},language:{autoDetection:this.privSpeechSynthesizer.autoDetectSourceLanguage}}}}(au=ou||(ou={}))[au.TextIndependentIdentification=0]="TextIndependentIdentification",au[au.TextDependentVerification=1]="TextDependentVerification",au[au.TextIndependentVerification=2]="TextIndependentVerification";const fu="OutputFormat",hu="CancellationErrorCode",pu="ServiceProperties",mu="ForceDictation";var gu=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class vu{constructor(e,t,n,r){this.privRecorder=e,this.deviceId=t,this.privStreams={},this.turnOn=()=>{if(this.privInitializeDeferral)return this.privInitializeDeferral.promise;this.privInitializeDeferral=new bs;try{this.createAudioContext()}catch(e){if(e instanceof Error){const t=e;this.privInitializeDeferral.reject(t.name+": "+t.message)}else this.privInitializeDeferral.reject(e);return this.privInitializeDeferral.promise}const e=window.navigator;let t=e.getUserMedia||e.webkitGetUserMedia||e.mozGetUserMedia||e.msGetUserMedia;if(e.mediaDevices&&(t=(t,n,r)=>{e.mediaDevices.getUserMedia(t).then(n).catch(r)}),t){const e=()=>{this.onEvent(new Ya(this.privId)),this.privMediaStream&&this.privMediaStream.active?(this.onEvent(new Ja(this.privId)),this.privInitializeDeferral.resolve()):t({audio:!this.deviceId||{deviceId:this.deviceId},video:!1},(e=>{this.privMediaStream=e,this.onEvent(new Ja(this.privId)),this.privInitializeDeferral.resolve()}),(e=>{const t=`Error occurred during microphone initialization: ${e}`;this.privInitializeDeferral.reject(t),this.onEvent(new Xa(this.privId,t))}))};"suspended"===this.privContext.state?this.privContext.resume().then(e).catch((e=>{this.privInitializeDeferral.reject(`Failed to initialize audio context: ${e}`)})):e()}else{const e="Browser does not support getUserMedia.";this.privInitializeDeferral.reject(e),this.onEvent(new Xa(e,""))}return this.privInitializeDeferral.promise},this.id=()=>this.privId,this.attach=e=>(this.onEvent(new $a(this.privId,e)),this.listen(e).then((t=>(this.onEvent(new es(this.privId,e)),{detach:()=>gu(this,void 0,void 0,(function*(){return t.readEnded(),delete this.privStreams[e],this.onEvent(new ts(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()})))),this.detach=e=>{e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new ts(this.privId,e)))},this.listen=e=>gu(this,void 0,void 0,(function*(){yield this.turnOn();const t=new Ns(this.privOutputChunkSize,e);this.privStreams[e]=t;try{this.privRecorder.record(this.privContext,this.privMediaStream,t)}catch(t){throw this.onEvent(new ns(this.privId,e,t)),t}return t})),this.onEvent=e=>{this.privEvents.onEvent(e),ys.instance.onEvent(e)},this.createAudioContext=()=>{this.privContext||(this.privContext=Ac.getAudioContext(vu.AUDIOFORMAT.samplesPerSec))},this.privOutputChunkSize=vu.AUDIOFORMAT.avgBytesPerSec/10,this.privId=n||Ba(),this.privEvents=new vs,this.privMediaStream=r||null,this.privIsClosing=!1}get format(){return Promise.resolve(vu.AUDIOFORMAT)}get blob(){return Promise.reject("Not implemented for Mic input")}turnOff(){return gu(this,void 0,void 0,(function*(){for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&t.close()}this.onEvent(new Qa(this.privId)),this.privInitializeDeferral&&(yield this.privInitializeDeferral,this.privInitializeDeferral=null),yield this.destroyAudioContext()}))}get events(){return this.privEvents}get deviceInfo(){return this.getMicrophoneLabel().then((e=>({bitspersample:vu.AUDIOFORMAT.bitsPerSample,channelcount:vu.AUDIOFORMAT.channels,connectivity:bl.Unknown,manufacturer:"Speech SDK",model:e,samplerate:vu.AUDIOFORMAT.samplesPerSec,type:xl.Microphones})))}setProperty(e,t){if("MICROPHONE-WorkletSourceUrl"!==e)throw new Error("Property '"+e+"' is not supported on Microphone.");this.privRecorder.setWorkletUrl(t)}getMicrophoneLabel(){const e="microphone";if(void 0!==this.privMicrophoneLabel)return Promise.resolve(this.privMicrophoneLabel);if(void 0===this.privMediaStream||!this.privMediaStream.active)return Promise.resolve(e);this.privMicrophoneLabel=e;const t=this.privMediaStream.getTracks()[0].getSettings().deviceId;if(void 0===t)return Promise.resolve(this.privMicrophoneLabel);const n=new bs;return navigator.mediaDevices.enumerateDevices().then((e=>{for(const n of e)if(n.deviceId===t){this.privMicrophoneLabel=n.label;break}n.resolve(this.privMicrophoneLabel)}),(()=>n.resolve(this.privMicrophoneLabel))),n.promise}destroyAudioContext(){return gu(this,void 0,void 0,(function*(){if(!this.privContext)return;this.privRecorder.releaseMediaResources(this.privContext);let e=!1;"close"in this.privContext&&(e=!0),e?this.privIsClosing||(this.privIsClosing=!0,yield this.privContext.close(),this.privContext=null,this.privIsClosing=!1):null!==this.privContext&&"running"===this.privContext.state&&(yield this.privContext.suspend())}))}}vu.AUDIOFORMAT=_c.getDefaultInputFormat();var yu={};e(yu,"FileAudioSource",(()=>wu),(e=>wu=e));var bu=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class wu{constructor(e,t,n){this.privStreams={},this.privHeaderEnd=44,this.turnOn=()=>{if(this.privFilename.lastIndexOf(".wav")!==this.privFilename.length-4){const e=this.privFilename+" is not supported. Only WAVE files are allowed at the moment.";return this.onEvent(new Xa(e,"")),Promise.reject(e)}this.onEvent(new Ya(this.privId)),this.onEvent(new Ja(this.privId))},this.id=()=>this.privId,this.attach=e=>bu(this,void 0,void 0,(function*(){this.onEvent(new $a(this.privId,e));const t=yield this.upload(e);return this.onEvent(new es(this.privId,e)),Promise.resolve({detach:()=>bu(this,void 0,void 0,(function*(){t.readEnded(),delete this.privStreams[e],this.onEvent(new ts(this.privId,e)),yield this.turnOff()})),id:()=>e,read:()=>t.read()})})),this.detach=e=>{e&&this.privStreams[e]&&(this.privStreams[e].close(),delete this.privStreams[e],this.onEvent(new ts(this.privId,e)))},this.turnOff=()=>{for(const e in this.privStreams)if(e){const t=this.privStreams[e];t&&!t.isClosed&&t.close()}return this.onEvent(new Qa(this.privId)),Promise.resolve()},this.onEvent=e=>{this.privEvents.onEvent(e),ys.instance.onEvent(e)},this.privId=n||Ba(),this.privEvents=new vs,this.privSource=e,"undefined"!=typeof window&&"undefined"!=typeof Blob&&this.privSource instanceof Blob?this.privFilename=e.name:this.privFilename=t||"unknown.wav",this.privAudioFormatPromise=this.readHeader()}get format(){return this.privAudioFormatPromise}get blob(){return Promise.resolve(this.privSource)}get events(){return this.privEvents}get deviceInfo(){return this.privAudioFormatPromise.then((e=>Promise.resolve({bitspersample:e.bitsPerSample,channelcount:e.channels,connectivity:bl.Unknown,manufacturer:"Speech SDK",model:"File",samplerate:e.samplesPerSec,type:xl.File})))}readHeader(){const e=this.privSource.slice(0,512),t=new bs,n=e=>{const n=new DataView(e),r=e=>String.fromCharCode(n.getUint8(e),n.getUint8(e+1),n.getUint8(e+2),n.getUint8(e+3));if("RIFF"!==r(0))return void t.reject("Invalid WAV header in file, RIFF was not found");if("WAVE"!==r(8)||"fmt "!==r(12))return void t.reject("Invalid WAV header in file, WAVEfmt was not found");const i=n.getInt32(16,!0),o=n.getUint16(22,!0),a=n.getUint32(24,!0),s=n.getUint16(34,!0);let l=36+Math.max(i-16,0);for(;"data"!==r(l);l+=2)if(l>504)return void t.reject("Invalid WAV header in file, data block was not found");this.privHeaderEnd=l+8,t.resolve(_c.getWaveFormatPCM(a,s,o))};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&e instanceof Blob){const t=new FileReader;t.onload=e=>{const t=e.target.result;n(t)},t.readAsArrayBuffer(e)}else{const t=e;n(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength))}return t.promise}upload(e){return bu(this,void 0,void 0,(function*(){const t=t=>{const n=`Error occurred while processing '${this.privFilename}'. ${t}`;throw this.onEvent(new ns(this.privId,e,n)),new Error(n)};try{yield this.turnOn();const n=yield this.privAudioFormatPromise,r=new Ns(n.avgBytesPerSec/10,e);this.privStreams[e]=r;const i=this.privSource.slice(this.privHeaderEnd),o=e=>{r.isClosed||(r.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()}),r.close())};if("undefined"!=typeof window&&"undefined"!=typeof Blob&&i instanceof Blob){const e=new FileReader;e.onerror=e=>{t(e.toString())},e.onload=e=>{const t=e.target.result;o(t)},e.readAsArrayBuffer(i)}else{const e=i;o(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}return r}catch(e){t(e)}}))}}class xu{constructor(e){this.record=(e,t,n)=>{const r=new ks(e.sampleRate,16e3);let i=!0;const o=e.createMediaStreamSource(t);if(!this.privSpeechProcessorScript){const e=new Blob(["class SP extends AudioWorkletProcessor {\n constructor(options) {\n super(options);\n }\n process(inputs, outputs) {\n const input = inputs[0];\n const output = [];\n for (let channel = 0; channel < input.length; channel += 1) {\n output[channel] = input[channel];\n }\n this.port.postMessage(output[0]);\n return true;\n }\n }\n registerProcessor('speech-processor', SP);"],{type:"application/javascript; charset=utf-8"});this.privSpeechProcessorScript=URL.createObjectURL(e)}const a=()=>{const a=(()=>{let t=0;try{return e.createScriptProcessor(t,1,1)}catch(n){t=2048;let r=e.sampleRate;for(;t<16384&&r>=32e3;)t<<=1,r>>=1;return e.createScriptProcessor(t,1,1)}})();a.onaudioprocess=e=>{const t=e.inputBuffer.getChannelData(0);if(n&&!n.isClosed){const e=r.encode(t);e&&(n.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()}),i=!1)}},o.connect(a),a.connect(e.destination),this.privMediaResources={scriptProcessorNode:a,source:o,stream:t}};if(this.privSpeechProcessorScript&&e.audioWorklet)e.audioWorklet.addModule(this.privSpeechProcessorScript).then((()=>{const a=new AudioWorkletNode(e,"speech-processor");a.port.onmessage=e=>{const t=e.data;if(n&&!n.isClosed){const e=r.encode(t);e&&(n.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()}),i=!1)}},o.connect(a),a.connect(e.destination),this.privMediaResources={scriptProcessorNode:a,source:o,stream:t}})).catch((()=>{a()}));else try{a()}catch(e){throw new Error(`Unable to start audio worklet node for PCMRecorder: ${e}`)}},this.releaseMediaResources=e=>{this.privMediaResources&&(this.privMediaResources.scriptProcessorNode&&(this.privMediaResources.scriptProcessorNode.disconnect(e.destination),this.privMediaResources.scriptProcessorNode=null),this.privMediaResources.source&&(this.privMediaResources.source.disconnect(),this.privStopInputOnRelease&&this.privMediaResources.stream.getTracks().forEach((e=>e.stop())),this.privMediaResources.source=null))},this.privStopInputOnRelease=e}setWorkletUrl(e){this.privSpeechProcessorScript=e}}var Su={};e(Su,"WebsocketConnection",(()=>td),(e=>td=e));var Mu={};e(Mu,"WebsocketMessageAdapter",(()=>$u),(e=>$u=e));var _u=a("1DJXa"),Au={};e(Au,"CertCheckAgent",(()=>Xu),(e=>Xu=e));var Eu,Cu;_u=a("1DJXa");Cu=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e};var ku,Tu,Iu={};e(Iu,"stringify",(()=>ku),(e=>ku=e)),e(Iu,"parse",(()=>Tu),(e=>Tu=e));var Ou=Object.prototype.hasOwnProperty;function Ru(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Pu(e){try{return encodeURIComponent(e)}catch(e){return null}}ku=function(e,t){t=t||"";var n,r,i=[];for(r in"string"!=typeof t&&(t="?"),e)if(Ou.call(e,r)){if((n=e[r])||null!=n&&!isNaN(n)||(n=""),r=Pu(r),n=Pu(n),null===r||null===n)continue;i.push(r+"="+n)}return i.length?t+i.join("&"):""},Tu=function(e){for(var t,n=/([^=?#&]+)=?([^&]*)/g,r={};t=n.exec(e);){var i=Ru(t[1]),o=Ru(t[2]);null===i||null===o||i in r||(r[i]=o)}return r};var Nu=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Lu=/[\n\r\t]/g,Du=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Bu=/:\d+$/,ju=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Fu=/^[a-zA-Z]:/;function Uu(e){return(e||"").toString().replace(Nu,"")}var zu=[["#","hash"],["?","query"],function(e,t){return Wu(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Hu={hash:1,query:1};function Vu(e){var n,r=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},i={},o=typeof(e=e||r);if("blob:"===e.protocol)i=new qu(unescape(e.pathname),{});else if("string"===o)for(n in i=new qu(e,{}),Hu)delete i[n];else if("object"===o){for(n in e)n in Hu||(i[n]=e[n]);void 0===i.slashes&&(i.slashes=Du.test(e.href))}return i}function Wu(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function Gu(e,t){e=(e=Uu(e)).replace(Lu,""),t=t||{};var n,r=ju.exec(e),i=r[1]?r[1].toLowerCase():"",o=!!r[2],a=!!r[3],s=0;return o?a?(n=r[2]+r[3]+r[4],s=r[2].length+r[3].length):(n=r[2]+r[4],s=r[2].length):a?(n=r[3]+r[4],s=r[3].length):n=r[4],"file:"===i?s>=2&&(n=n.slice(2)):Wu(i)?n=r[4]:i?o&&(n=n.slice(2)):s>=2&&Wu(t.protocol)&&(n=r[4]),{protocol:i,slashes:o||Wu(i),slashesCount:s,rest:n}}function qu(e,t,n){if(e=(e=Uu(e)).replace(Lu,""),!(this instanceof qu))return new qu(e,t,n);var r,i,o,a,s,l,c=zu.slice(),u=typeof t,d=this,f=0;for("object"!==u&&"string"!==u&&(n=t,t=null),n&&"function"!=typeof n&&(n=Iu.parse),r=!(i=Gu(e||"",t=Vu(t))).protocol&&!i.slashes,d.slashes=i.slashes||r&&t.slashes,d.protocol=i.protocol||t.protocol||"",e=i.rest,("file:"===i.protocol&&(2!==i.slashesCount||Fu.test(e))||!i.slashes&&(i.protocol||i.slashesCount<2||!Wu(d.protocol)))&&(c[3]=[/(.*)/,"pathname"]);f<c.length;f++)"function"!=typeof(a=c[f])?(o=a[0],l=a[1],o!=o?d[l]=e:"string"==typeof o?~(s="@"===o?e.lastIndexOf(o):e.indexOf(o))&&("number"==typeof a[2]?(d[l]=e.slice(0,s),e=e.slice(s+a[2])):(d[l]=e.slice(s),e=e.slice(0,s))):(s=o.exec(e))&&(d[l]=s[1],e=e.slice(0,s.index)),d[l]=d[l]||r&&a[3]&&t[l]||"",a[4]&&(d[l]=d[l].toLowerCase())):e=a(e,d);n&&(d.query=n(d.query)),r&&t.slashes&&"/"!==d.pathname.charAt(0)&&(""!==d.pathname||""!==t.pathname)&&(d.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=n.length,i=n[r-1],o=!1,a=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),a++):a&&(0===r&&(o=!0),n.splice(r,1),a--);return o&&n.unshift(""),"."!==i&&".."!==i||n.push(""),n.join("/")}(d.pathname,t.pathname)),"/"!==d.pathname.charAt(0)&&Wu(d.protocol)&&(d.pathname="/"+d.pathname),Cu(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(~(s=d.auth.indexOf(":"))?(d.username=d.auth.slice(0,s),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(s+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin="file:"!==d.protocol&&Wu(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}qu.prototype={set:function(e,t,n){var r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||Iu.parse)(t)),r[e]=t;break;case"port":r[e]=t,Cu(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,Bu.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!n;break;case"pathname":case"hash":if(t){var i="pathname"===e?"/":"#";r[e]=t.charAt(0)!==i?i+t:t}else r[e]=t;break;case"username":case"password":r[e]=encodeURIComponent(t);break;case"auth":var o=t.indexOf(":");~o?(r.username=t.slice(0,o),r.username=encodeURIComponent(decodeURIComponent(r.username)),r.password=t.slice(o+1),r.password=encodeURIComponent(decodeURIComponent(r.password))):r.username=encodeURIComponent(decodeURIComponent(t))}for(var a=0;a<zu.length;a++){var s=zu[a];s[4]&&(r[s[1]]=r[s[1]].toLowerCase())}return r.auth=r.password?r.username+":"+r.password:r.username,r.origin="file:"!==r.protocol&&Wu(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=Iu.stringify);var t,n=this,r=n.host,i=n.protocol;i&&":"!==i.charAt(i.length-1)&&(i+=":");var o=i+(n.protocol&&n.slashes||Wu(n.protocol)?"//":"");return n.username?(o+=n.username,n.password&&(o+=":"+n.password),o+="@"):n.password?(o+=":"+n.password,o+="@"):"file:"!==n.protocol&&Wu(n.protocol)&&!r&&"/"!==n.pathname&&(o+="@"),(":"===r[r.length-1]||Bu.test(n.hostname)&&!n.port)&&(r+=":"),o+=r+n.pathname,(t="object"==typeof n.query?e(n.query):n.query)&&(o+="?"!==t.charAt(0)?"?"+t:t),n.hash&&(o+=n.hash),o}},qu.extractProtocol=Gu,qu.location=Vu,qu.trimLeft=Uu,qu.qs=Iu,Eu=qu;var Ku=a("5U18c"),Yu=(_u=a("1DJXa"),_u=a("1DJXa"),_u=a("1DJXa"),_u=a("1DJXa"),a("ePtPP")),Ju=a("bqBrJ").Buffer,Qu=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Xu{constructor(e){e&&(this.privProxyInfo=e),Xu.privDiskCache||(Xu.privDiskCache=new(r(_u))("microsoft-cognitiveservices-speech-sdk-cache",{supportBuffer:!0,location:void 0}))}static forceReinitDiskCache(){Xu.privDiskCache=void 0,Xu.privMemCache={}}GetAgent(e){const t=new(r(_u).Agent)(this.CreateConnection);if(void 0!==this.privProxyInfo&&void 0!==this.privProxyInfo.HostName&&this.privProxyInfo.Port>0){t["privProxyInfo"]=this.privProxyInfo}return t}static GetProxyAgent(e){const t={host:e.HostName,port:e.Port};e.UserName?t.headers={"Proxy-Authentication":"Basic "+new Ju(e.UserName+":"+(void 0===e.Password)?"":e.Password).toString("base64")}:t.headers={},t.headers.requestOCSP="true";return new(r(_u))(t)}static OCSPCheck(e,t){return Qu(this,void 0,void 0,(function*(){let n,r,i=!1;const o=yield e;o.cork();const a=o;return new Promise(((e,s)=>{o.on("OCSPResponse",(e=>{e&&(this.onEvent(new Ws),r=e)})),o.on("error",(e=>{i||(i=!0,o.destroy(),s(e))})),a.on("secure",(()=>Qu(this,void 0,void 0,(function*(){const l=a.getPeerCertificate(!0);try{const a=yield this.GetIssuer(l);n=Ku.request.generate(l.raw,a.raw);const s=n.id.toString("hex");if(!r){const e=yield Xu.GetResponseFromCache(s,n,t);r=e}yield this.VerifyOCSPResponse(r,n,t),o.uncork(),i=!0,e(o)}catch(e){o.destroy(),i=!0,s(e)}}))))}))}))}static GetIssuer(e){return e.issuerCertificate?Promise.resolve(e.issuerCertificate):new Promise(((t,n)=>{new Ku.Agent({}).fetchIssuer(e,null,((e,r)=>{e?n(e):t(r)}))}))}static GetResponseFromCache(e,t,n){return Qu(this,void 0,void 0,(function*(){let r=Xu.privMemCache[e];if(r&&this.onEvent(new Bs(e)),!r)try{const t=yield Xu.privDiskCache.get(e);t.isCached&&(Xu.onEvent(new Fs(e)),Xu.StoreMemoryCacheEntry(e,t.value),r=t.value)}catch(e){r=null}if(!r)return r;try{const i=Ku.utils.parseResponse(r).value.tbsResponseData;if(i.responses.length<1)return void this.onEvent(new Js(e,"Not enough data in cached response"));const o=i.responses[0].thisUpdate,a=i.responses[0].nextUpdate;if(a<Date.now()+this.testTimeOffset-6e4)this.onEvent(new Gs(e,a)),r=null;else{const r=Math.min(864e5,(a-o)/2);a-(Date.now()+this.testTimeOffset)<r?(this.onEvent(new qs(e,o,a)),this.UpdateCache(t,n).catch((t=>{this.onEvent(new Xs(e,t.toString()))}))):this.onEvent(new Ks(e,o,a))}}catch(t){this.onEvent(new Js(e,t)),r=null}return r||this.onEvent(new js(e)),r}))}static VerifyOCSPResponse(e,t,n){return Qu(this,void 0,void 0,(function*(){let r=e;t.certID.toString("hex");return r||(r=yield Xu.GetOCSPResponse(t,n)),new Promise(((i,o)=>{Ku.verify({request:t,response:r},((a,s)=>{a?(Xu.onEvent(new Ys(t.id.toString("hex"),a)),e?this.VerifyOCSPResponse(null,t,n).then((()=>{i()}),(e=>{o(e)})):o(a)):(e||Xu.StoreCacheEntry(t.id.toString("hex"),r),i())}))}))}))}static UpdateCache(e,t){return Qu(this,void 0,void 0,(function*(){const n=e.id.toString("hex");this.onEvent(new Us(n));const r=yield this.GetOCSPResponse(e,t);this.StoreCacheEntry(n,r),this.onEvent(new Vs(e.id.toString("hex")))}))}static StoreCacheEntry(e,t){this.StoreMemoryCacheEntry(e,t),this.StoreDiskCacheEntry(e,t)}static StoreMemoryCacheEntry(e,t){this.privMemCache[e]=t,this.onEvent(new zs(e))}static StoreDiskCacheEntry(e,t){this.privDiskCache.set(e,t).then((()=>{this.onEvent(new Hs(e))}))}static GetOCSPResponse(e,t){let n={};if(t){const e=Xu.GetProxyAgent(t);n.agent=e}return new Promise(((t,i)=>{Ku.utils.getAuthorityInfo(e.cert,"1.3.6.1.5.5.7.48.1",((o,a)=>{if(o)return void i(o);const s=r(Eu)(a);s.path=s.pathname,n=Object.assign(Object.assign({},n),s),Ku.utils.getResponse(n,e.data,((n,r)=>{n?i(n):(this.onEvent(new Qs(e.certID.toString("hex"))),t(r))}))}))}))}CreateConnection(e,t){const n=void 0!==Yu&&t.secureEndpoint;let r;if(t=Object.assign(Object.assign({},t),{requestOCSP:!Xu.forceDisableOCSPStapling,servername:t.host}),this.privProxyInfo){const n=Xu.GetProxyAgent(this.privProxyInfo);r=new Promise(((r,i)=>{n.callback(e,t,((e,t)=>{e?i(e):r(t)}))}))}else r=(t.secureEndpoint,Promise.resolve(_u.connect(t)));return n?Xu.OCSPCheck(r,this.privProxyInfo):r}}Xu.testTimeOffset=0,Xu.forceDisableOCSPStapling=!1,Xu.privMemCache={},Xu.onEvent=e=>{ys.instance.onEvent(e)};var Zu=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class $u{constructor(e,t,n,i,o,a){if(this.open=()=>{if(this.privConnectionState===Ha.Disconnected)return Promise.reject(`Cannot open a connection that is in ${this.privConnectionState} state`);if(this.privConnectionEstablishDeferral)return this.privConnectionEstablishDeferral.promise;this.privConnectionEstablishDeferral=new bs,this.privCertificateValidatedDeferral=new bs,this.privConnectionState=Ha.Connecting;try{if("undefined"==typeof WebSocket||$u.forceNpmWebSocket){const e={headers:this.privHeaders,perMessageDeflate:this.privEnableCompression};this.privCertificateValidatedDeferral.resolve();const t=new(0,Au.CertCheckAgent)(this.proxyInfo);e.agent=t.GetAgent();let n=new URL(this.privUri).protocol;"wss:"===(null==n?void 0:n.toLocaleLowerCase())?n="https:":"ws:"===(null==n?void 0:n.toLocaleLowerCase())&&(n="http:"),e.agent.protocol=n,this.privWebsocketClient=new(r(_u))(this.privUri,e)}else this.privCertificateValidatedDeferral.resolve(),this.privWebsocketClient=new WebSocket(this.privUri);this.privWebsocketClient.binaryType="arraybuffer",this.privReceivingMessageQueue=new(0,xs.Queue),this.privDisconnectDeferral=new bs,this.privSendMessageQueue=new(0,xs.Queue),this.processSendQueue().catch((e=>{ys.instance.onEvent(new Zs(e))}))}catch(e){return this.privConnectionEstablishDeferral.resolve(new gs(500,e)),this.privConnectionEstablishDeferral.promise}return this.onEvent(new os(this.privConnectionId,this.privUri)),this.privWebsocketClient.onopen=e=>{this.privCertificateValidatedDeferral.promise.then((()=>{this.privConnectionState=Ha.Connected,this.onEvent(new as(this.privConnectionId)),this.privConnectionEstablishDeferral.resolve(new gs(200,""))}),(e=>{this.privConnectionEstablishDeferral.reject(e)}))},this.privWebsocketClient.onerror=e=>{this.onEvent(new ls(this.privConnectionId,e.message,e.type)),this.privLastErrorReceived=e.message},this.privWebsocketClient.onclose=e=>{this.privConnectionState===Ha.Connecting?(this.privConnectionState=Ha.Disconnected,this.privConnectionEstablishDeferral.resolve(new gs(e.code,e.reason+" "+this.privLastErrorReceived))):(this.privConnectionState=Ha.Disconnected,this.privWebsocketClient=null,this.onEvent(new ss(this.privConnectionId,e.code,e.reason))),this.onClose(e.code,e.reason).catch((e=>{ys.instance.onEvent(new Zs(e))}))},this.privWebsocketClient.onmessage=e=>{const t=(new Date).toISOString();if(this.privConnectionState===Ha.Connected){const n=new bs;if(this.privReceivingMessageQueue.enqueueFromPromise(n.promise),e.data instanceof ArrayBuffer){const r=new Cs(Ua.Binary,e.data);this.privMessageFormatter.toConnectionMessage(r).then((e=>{this.onEvent(new us(this.privConnectionId,t,e)),n.resolve(e)}),(e=>{n.reject(`Invalid binary message format. Error: ${e}`)}))}else{const r=new Cs(Ua.Text,e.data);this.privMessageFormatter.toConnectionMessage(r).then((e=>{this.onEvent(new us(this.privConnectionId,t,e)),n.resolve(e)}),(e=>{n.reject(`Invalid text message format. Error: ${e}`)}))}}},this.privConnectionEstablishDeferral.promise},this.send=e=>{if(this.privConnectionState!==Ha.Connected)return Promise.reject(`Cannot send on connection that is in ${Ha[this.privConnectionState]} state`);const t=new bs,n=new bs;return this.privSendMessageQueue.enqueueFromPromise(n.promise),this.privMessageFormatter.fromConnectionMessage(e).then((r=>{n.resolve({Message:e,RawWebsocketMessage:r,sendStatusDeferral:t})}),(e=>{n.reject(`Error formatting the message. ${e}`)})),t.promise},this.read=()=>this.privConnectionState!==Ha.Connected?Promise.reject(`Cannot read on connection that is in ${this.privConnectionState} state`):this.privReceivingMessageQueue.dequeue(),this.close=e=>this.privWebsocketClient?(this.privConnectionState!==Ha.Disconnected&&this.privWebsocketClient.close(1e3,e||"Normal closure by client"),this.privDisconnectDeferral.promise):Promise.resolve(),this.sendRawMessage=e=>{try{return e?(this.onEvent(new ds(this.privConnectionId,(new Date).toISOString(),e.Message)),this.isWebsocketOpen?(this.privWebsocketClient.send(e.RawWebsocketMessage.payload),Promise.resolve()):Promise.reject("websocket send error: Websocket not ready "+this.privConnectionId+" "+e.Message.id+" "+(new Error).stack)):Promise.resolve()}catch(e){return Promise.reject(`websocket send error: ${e}`)}},this.onEvent=e=>{this.privConnectionEvents.onEvent(e),ys.instance.onEvent(e)},!e)throw new fs("uri");if(!n)throw new fs("messageFormatter");this.proxyInfo=i,this.privConnectionEvents=new vs,this.privConnectionId=t,this.privMessageFormatter=n,this.privConnectionState=Ha.None,this.privUri=e,this.privHeaders=o,this.privEnableCompression=a,this.privHeaders[el.ConnectionId]=this.privConnectionId,this.privLastErrorReceived=""}get state(){return this.privConnectionState}get events(){return this.privConnectionEvents}onClose(e,t){return Zu(this,void 0,void 0,(function*(){const n=`Connection closed. ${e}: ${t}`;this.privConnectionState=Ha.Disconnected,this.privDisconnectDeferral.resolve(),yield this.privReceivingMessageQueue.drainAndDispose((e=>{}),n),yield this.privSendMessageQueue.drainAndDispose((e=>{e.sendStatusDeferral.reject(n)}),n)}))}processSendQueue(){return Zu(this,void 0,void 0,(function*(){for(;;){const e=this.privSendMessageQueue.dequeue(),t=yield e;if(!t)return;try{yield this.sendRawMessage(t),t.sendStatusDeferral.resolve()}catch(e){t.sendStatusDeferral.reject(e)}}}))}get isWebsocketOpen(){return this.privWebsocketClient&&this.privWebsocketClient.readyState===this.privWebsocketClient.OPEN}}$u.forceNpmWebSocket=!1;var ed=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class td{constructor(e,t,n,r,i,o=!1,a){if(this.privIsDisposed=!1,this.isDisposed=()=>this.privIsDisposed,this.state=()=>this.privConnectionMessageAdapter.state,this.open=()=>this.privConnectionMessageAdapter.open(),this.send=e=>this.privConnectionMessageAdapter.send(e),this.read=()=>this.privConnectionMessageAdapter.read(),!e)throw new fs("uri");if(!r)throw new fs("messageFormatter");this.privMessageFormatter=r;let s="",l=0;if(t)for(const n in t)if(n){s+=0===l&&-1===e.indexOf("?")?"?":"&";s+=`${n}=${encodeURIComponent(t[n])}`,l++}if(n)for(const t in n)if(t){s+=0===l&&-1===e.indexOf("?")?"?":"&";s+=`${t}=${encodeURIComponent(n[t])}`,l++}this.privUri=e+s,this.privId=a||Ba(),this.privConnectionMessageAdapter=new(0,Mu.WebsocketMessageAdapter)(this.privUri,this.id,this.privMessageFormatter,i,n,o)}dispose(){return ed(this,void 0,void 0,(function*(){this.privIsDisposed=!0,this.privConnectionMessageAdapter&&(yield this.privConnectionMessageAdapter.close())}))}get id(){return this.privId}get events(){return this.privConnectionMessageAdapter.events}}class nd{constructor(e,t){this.privBuffers=[],this.privReplayOffset=0,this.privLastShrinkOffset=0,this.privBufferStartOffset=0,this.privBufferSerial=0,this.privBufferedBytes=0,this.privReplay=!1,this.privLastChunkAcquiredTime=0,this.id=()=>this.privAudioNode.id(),this.privAudioNode=e,this.privBytesPerSecond=t}read(){if(this.privReplay&&0!==this.privBuffers.length){const e=this.privReplayOffset-this.privBufferStartOffset;let t=Math.round(e*this.privBytesPerSecond*1e-7);0!=t%2&&t++;let n=0;for(;n<this.privBuffers.length&&t>=this.privBuffers[n].chunk.buffer.byteLength;)t-=this.privBuffers[n++].chunk.buffer.byteLength;if(n<this.privBuffers.length){const e=this.privBuffers[n].chunk.buffer.slice(t);return this.privReplayOffset+=e.byteLength/this.privBytesPerSecond*1e7,n===this.privBuffers.length-1&&(this.privReplay=!1),Promise.resolve({buffer:e,isEnd:!1,timeReceived:this.privBuffers[n].chunk.timeReceived})}}return this.privAudioNode.read().then((e=>(e&&e.buffer&&(this.privBuffers.push(new rd(e,this.privBufferSerial++,this.privBufferedBytes)),this.privBufferedBytes+=e.buffer.byteLength),e)))}detach(){return this.privBuffers=void 0,this.privAudioNode.detach()}replay(){this.privBuffers&&0!==this.privBuffers.length&&(this.privReplay=!0,this.privReplayOffset=this.privLastShrinkOffset)}shrinkBuffers(e){if(void 0===this.privBuffers||0===this.privBuffers.length)return;this.privLastShrinkOffset=e;const t=e-this.privBufferStartOffset;let n=Math.round(t*this.privBytesPerSecond*1e-7),r=0;for(;r<this.privBuffers.length&&n>=this.privBuffers[r].chunk.buffer.byteLength;)n-=this.privBuffers[r++].chunk.buffer.byteLength;this.privBufferStartOffset=Math.round(e-n/this.privBytesPerSecond*1e7),this.privBuffers=this.privBuffers.slice(r)}findTimeAtOffset(e){if(e<this.privBufferStartOffset||void 0===this.privBuffers)return 0;for(const t of this.privBuffers){const n=t.byteOffset/this.privBytesPerSecond*1e7,r=n+t.chunk.buffer.byteLength/this.privBytesPerSecond*1e7;if(e>=n&&e<=r)return t.chunk.timeReceived}return 0}}class rd{constructor(e,t,n){this.chunk=e,this.serial=t,this.byteOffset=n}}class id{constructor(e,t,n,r){this.privProxyHostName=e,this.privProxyPort=t,this.privProxyUserName=n,this.privProxyPassword=r}static fromParameters(e){return new id(e.getProperty(cl.SpeechServiceConnection_ProxyHostName),parseInt(e.getProperty(cl.SpeechServiceConnection_ProxyPort),10),e.getProperty(cl.SpeechServiceConnection_ProxyUserName),e.getProperty(cl.SpeechServiceConnection_ProxyPassword))}static fromRecognizerConfig(e){return this.fromParameters(e.parameters)}get HostName(){return this.privProxyHostName}get Port(){return this.privProxyPort}get UserName(){return this.privProxyUserName}get Password(){return this.privProxyPassword}}var od={};e(od,"RestRequestType",(()=>ud),(e=>ud=e)),e(od,"RestMessageAdapter",(()=>hd),(e=>hd=e));var ad,sd;const ld=new Set(["json","buffer","string"]);sd=e=>(...t)=>{const n=new Set;let r,i,o,a="";return t.forEach((e=>{if("string"==typeof e)if(e.toUpperCase()===e){if(r){throw new Error(`Can't set method to ${e}, already set to ${r}.`)}r=e}else if(e.startsWith("http:")||e.startsWith("https:"))a=e;else{if(!ld.has(e))throw new Error(`Unknown encoding, ${e}`);i=e}else if("number"==typeof e)n.add(e);else{if("object"!=typeof e)throw new Error("Unknown type: "+typeof e);if(Array.isArray(e)||e instanceof Set)e.forEach((e=>n.add(e)));else{if(o)throw new Error("Cannot set headers twice.");o=e}}})),r||(r="GET"),0===n.size&&n.add(200),e(n,r,i,o,a)};class cd extends Error{constructor(e,...t){let n;super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,cd),this.name="StatusError",this.message=e.statusMessage,this.statusCode=e.status,this.res=e,this.json=e.json.bind(e),this.text=e.text.bind(e),this.arrayBuffer=e.arrayBuffer.bind(e);Object.defineProperty(this,"responseBody",{get:()=>(n||(n=this.arrayBuffer()),n)}),this.headers={};for(const[t,n]of e.headers.entries())this.headers[t.toLowerCase()]=n}}ad=sd(((e,t,n,r,i)=>async(o,a,s={})=>{o=i+(o||"");let l=new URL(o);if(r||(r={}),l.username&&(r.Authorization="Basic "+btoa(l.username+":"+l.password),l=new URL(l.protocol+"//"+l.host+l.pathname+l.search)),"https:"!==l.protocol&&"http:"!==l.protocol)throw new Error(`Unknown protocol, ${l.protocol}`);if(a)if(a instanceof ArrayBuffer||ArrayBuffer.isView(a)||"string"==typeof a);else{if("object"!=typeof a)throw new Error("Unknown body type.");a=JSON.stringify(a),r["Content-Type"]="application/json"}s=new Headers({...r||{},...s});const c=await fetch(l,{method:t,headers:s,body:a});if(c.statusCode=c.status,!e.has(c.status))throw new cd(c);return"json"===n?c.json():"buffer"===n?c.arrayBuffer():"string"===n?c.text():c}));var ud,dd,fd=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};(dd=ud||(ud={})).Get="GET",dd.Post="POST",dd.Delete="DELETE",dd.File="file";class hd{constructor(e){if(!e)throw new fs("configParams");this.privHeaders=e.headers,this.privIgnoreCache=e.ignoreCache}static extractHeaderValue(e,t){let n="";try{const r=t.trim().split(/[\r\n]+/),i={};r.forEach((e=>{const t=e.split(": "),n=t.shift().toLowerCase(),r=t.join(": ");i[n]=r})),n=i[e.toLowerCase()]}catch(e){}return n}set options(e){this.privHeaders=e.headers,this.privIgnoreCache=e.ignoreCache}setHeaders(e,t){this.privHeaders[e]=t}request(e,t,n={},i=null,o=null){const a=new bs,s=e===ud.File?"POST":e,l=(e,t={})=>{const n=e;return{data:JSON.stringify(t),headers:JSON.stringify(e.headers),json:t,ok:e.statusCode>=200&&e.statusCode<300,status:e.statusCode,statusText:t.error?t.error.message:n.statusText?n.statusText:n.statusMessage}},c=i=>{r(ad)(t,s,this.privHeaders,200,201,202,204,400,401,402,403,404)(""===this.queryParams(n)?"":"?"+this.queryParams(n),i).then((t=>fd(this,void 0,void 0,(function*(){if(e===ud.Delete||204===t.statusCode)a.resolve(l(t));else try{const e=yield t.json();a.resolve(l(t,e))}catch(e){a.resolve(l(t))}})))).catch((e=>{a.reject(e)}))};if(this.privIgnoreCache&&(this.privHeaders["Cache-Control"]="no-cache"),e===ud.File&&o){const e="multipart/form-data";this.privHeaders["content-type"]=e,this.privHeaders["Content-Type"]=e,"undefined"!=typeof Blob&&o instanceof Blob?(e=>{const t=new FileReader;return t.readAsArrayBuffer(e),new Promise((e=>{t.onloadend=()=>{e(t.result)}}))})(o).then((e=>{c(e)})).catch((e=>{a.reject(e)})):c(o)}else e===ud.Post&&i&&(this.privHeaders["content-type"]="application/json",this.privHeaders["Content-Type"]="application/json"),c(i);return a.promise}withQuery(e,t={}){const n=this.queryParams(t);return n?e+(-1===e.indexOf("?")?"?":"&")+n:e}queryParams(e={}){return Object.keys(e).map((t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t]))).join("&")}}class pd{static get requestOptions(){return pd.privDefaultRequestOptions}static get configParams(){return pd.privDefaultParams}static get restErrors(){return pd.privRestErrors}}pd.privDefaultRequestOptions={headers:{Accept:"application/json"},ignoreCache:!1,timeout:1e4},pd.privRestErrors={authInvalidSubscriptionKey:"You must specify either an authentication token to use, or a Cognitive Speech subscription key.",authInvalidSubscriptionRegion:"You must specify the Cognitive Speech region to use.",invalidArgs:"Required input not found: {arg}.",invalidCreateJoinConversationResponse:"Creating/Joining conversation failed with HTTP {status}.",invalidParticipantRequest:"The requested participant was not found.",permissionDeniedConnect:"Required credentials not found.",permissionDeniedConversation:"Invalid operation: only the host can {command} the conversation.",permissionDeniedParticipant:"Invalid operation: only the host can {command} a participant.",permissionDeniedSend:"Invalid operation: the conversation is not in a connected state.",permissionDeniedStart:"Invalid operation: there is already an active conversation."},pd.privDefaultParams={apiVersion:"api-version",authorization:"Authorization",clientAppId:"X-ClientAppId",contentTypeKey:"Content-Type",correlationId:"X-CorrelationId",languageCode:"language",nickname:"nickname",profanity:"profanity",requestId:"X-RequestId",roomId:"roomid",sessionToken:"token",subscriptionKey:"Ocp-Apim-Subscription-Key",subscriptionRegion:"Ocp-Apim-Subscription-Region",token:"X-CapitoToken"};class md{}var gd={};e(gd,"AudioInputStream",(()=>bd),(e=>bd=e)),e(gd,"PullAudioInputStreamImpl",(()=>Md),(e=>Md=e));var vd=a("bqBrJ").Buffer,yd=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class bd{constructor(){}static createPushStream(e){return wd.create(e)}static createPullStream(e,t){return Sd.create(e,t)}}class wd extends bd{static create(e){return new xd(e)}}class xd extends wd{constructor(e){super(),this.onEvent=e=>{this.privEvents.onEvent(e),ys.instance.onEvent(e)},this.privFormat=void 0===e?Ac.getDefaultInputFormat():e,this.privEvents=new vs,this.privId=Ba(),this.privStream=new Ns(this.privFormat.avgBytesPerSec/10)}get format(){return Promise.resolve(this.privFormat)}write(e){this.privStream.writeStreamChunk({buffer:e,isEnd:!1,timeReceived:Date.now()})}close(){this.privStream.close()}id(){return this.privId}get blob(){return this.attach("id").then((e=>{const t=[];let n=vd.from("");const r=()=>e.read().then((e=>!e||e.isEnd?"undefined"!=typeof XMLHttpRequest&&"undefined"!=typeof Blob?Promise.resolve(new Blob(t)):Promise.resolve(vd.from(n)):("undefined"!=typeof Blob?t.push(e.buffer):n=vd.concat([n,this.toBuffer(e.buffer)]),r())));return r()}))}turnOn(){this.onEvent(new Ya(this.privId)),this.onEvent(new Ja(this.privId))}attach(e){return yd(this,void 0,void 0,(function*(){this.onEvent(new $a(this.privId,e)),yield this.turnOn();const t=this.privStream;return this.onEvent(new es(this.privId,e)),{detach:()=>yd(this,void 0,void 0,(function*(){return this.onEvent(new ts(this.privId,e)),this.turnOff()})),id:()=>e,read:()=>t.read()}}))}detach(e){this.onEvent(new ts(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:bl.Unknown,manufacturer:"Speech SDK",model:"PushStream",samplerate:this.privFormat.samplesPerSec,type:xl.Stream})}toBuffer(e){const t=vd.alloc(e.byteLength),n=new Uint8Array(e);for(let e=0;e<t.length;++e)t[e]=n[e];return t}}class Sd extends bd{constructor(){super()}static create(e,t){return new Md(e,t)}}class Md extends Sd{constructor(e,t){super(),this.onEvent=e=>{this.privEvents.onEvent(e),ys.instance.onEvent(e)},this.privFormat=void 0===t?_c.getDefaultInputFormat():t,this.privEvents=new vs,this.privId=Ba(),this.privCallback=e,this.privIsClosed=!1,this.privBufferSize=this.privFormat.avgBytesPerSec/10}get format(){return Promise.resolve(this.privFormat)}close(){this.privIsClosed=!0,this.privCallback.close()}id(){return this.privId}get blob(){return Promise.reject("Not implemented")}turnOn(){this.onEvent(new Ya(this.privId)),this.onEvent(new Ja(this.privId))}attach(e){return yd(this,void 0,void 0,(function*(){return this.onEvent(new $a(this.privId,e)),yield this.turnOn(),this.onEvent(new es(this.privId,e)),{detach:()=>(this.privCallback.close(),this.onEvent(new ts(this.privId,e)),this.turnOff()),id:()=>e,read:()=>{let e,t=0;for(;t<this.privBufferSize;){const n=new ArrayBuffer(this.privBufferSize-t),r=this.privCallback.read(n);if(void 0===e)e=n;else{new Int8Array(e).set(new Int8Array(n),t)}if(0===r)break;t+=r}return Promise.resolve({buffer:e.slice(0,t),isEnd:this.privIsClosed||0===t,timeReceived:Date.now()})}}}))}detach(e){this.onEvent(new ts(this.privId,e))}turnOff(){}get events(){return this.privEvents}get deviceInfo(){return Promise.resolve({bitspersample:this.privFormat.bitsPerSample,channelcount:this.privFormat.channels,connectivity:bl.Unknown,manufacturer:"Speech SDK",model:"PullStream",samplerate:this.privFormat.samplesPerSec,type:xl.Stream})}}var _d={};e(_d,"SpeakerAudioDestination",(()=>Cd),(e=>Cd=e));var Ad=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};const Ed={[mc.PCM]:"audio/wav",[mc.MuLaw]:"audio/x-wav",[mc.MP3]:"audio/mpeg",[mc.OGG_OPUS]:"audio/ogg",[mc.WEBM_OPUS]:"audio/webm; codecs=opus",[mc.ALaw]:"audio/x-wav",[mc.FLAC]:"audio/flac"};class Cd{constructor(e){this.privPlaybackStarted=!1,this.privAppendingToBuffer=!1,this.privMediaSourceOpened=!1,this.privBytesReceived=0,this.privId=e||Ba(),this.privIsPaused=!1,this.privIsClosed=!1}id(){return this.privId}write(e,t,n){void 0!==this.privAudioBuffer?(this.privAudioBuffer.push(e),this.updateSourceBuffer().then((()=>{t&&t()}),(e=>{n&&n(e)}))):void 0!==this.privAudioOutputStream&&(this.privAudioOutputStream.write(e),this.privBytesReceived+=e.byteLength)}close(e,t){if(this.privIsClosed=!0,void 0!==this.privSourceBuffer)this.handleSourceBufferUpdateEnd().then((()=>{e&&e()}),(e=>{t&&t(e)}));else if(void 0!==this.privAudioOutputStream)if(this.privFormat.formatTag!==mc.PCM&&this.privFormat.formatTag!==mc.MuLaw&&this.privFormat.formatTag!==mc.ALaw||!1!==this.privFormat.hasHeader){let n=new ArrayBuffer(this.privBytesReceived);this.privAudioOutputStream.read(n).then((r=>{n=Wc.SynthesisAdapterBase.addHeader(n,this.privFormat);const i=new Blob([n],{type:Ed[this.privFormat.formatTag]});this.privAudio.src=window.URL.createObjectURL(i),this.notifyPlayback().then((()=>{e&&e()}),(e=>{t&&t(e)}))}),(e=>{t&&t(e)}))}else console.warn("Play back is not supported for raw PCM, mulaw or alaw format without header."),this.onAudioEnd&&this.onAudioEnd(this);else this.onAudioEnd&&this.onAudioEnd(this)}set format(e){if("undefined"!=typeof AudioContext||void 0!==window.webkitAudioContext){this.privFormat=e;const t=Ed[this.privFormat.formatTag];void 0===t?console.warn(`Unknown mimeType for format ${mc[this.privFormat.formatTag]}; playback is not supported.`):"undefined"!=typeof MediaSource&&MediaSource.isTypeSupported(t)?(this.privAudio=new Audio,this.privAudioBuffer=[],this.privMediaSource=new MediaSource,this.privAudio.src=URL.createObjectURL(this.privMediaSource),this.privAudio.load(),this.privMediaSource.onsourceopen=e=>{this.privMediaSourceOpened=!0,this.privMediaSource.duration=1800,this.privSourceBuffer=this.privMediaSource.addSourceBuffer(t),this.privSourceBuffer.onupdate=e=>{this.updateSourceBuffer().catch((e=>{ys.instance.onEvent(new Zs(e))}))},this.privSourceBuffer.onupdateend=e=>{this.handleSourceBufferUpdateEnd().catch((e=>{ys.instance.onEvent(new Zs(e))}))},this.privSourceBuffer.onupdatestart=e=>{this.privAppendingToBuffer=!1}},this.updateSourceBuffer().catch((e=>{ys.instance.onEvent(new Zs(e))}))):(console.warn(`Format ${mc[this.privFormat.formatTag]} could not be played by MSE, streaming playback is not enabled.`),this.privAudioOutputStream=new(0,Ic.PullAudioOutputStreamImpl),this.privAudioOutputStream.format=this.privFormat,this.privAudio=new Audio)}}get volume(){return this.privAudio.volume}set volume(e){this.privAudio.volume=e}mute(){this.privAudio.muted=!0}unmute(){this.privAudio.muted=!1}get isClosed(){return this.privIsClosed}get currentTime(){return void 0!==this.privAudio?this.privAudio.currentTime:-1}pause(){this.privIsPaused||void 0===this.privAudio||(this.privAudio.pause(),this.privIsPaused=!0)}resume(e,t){this.privIsPaused&&void 0!==this.privAudio&&(this.privAudio.play().then((()=>{e&&e()}),(e=>{t&&t(e)})),this.privIsPaused=!1)}get internalAudio(){return this.privAudio}updateSourceBuffer(){return Ad(this,void 0,void 0,(function*(){if(void 0!==this.privAudioBuffer&&this.privAudioBuffer.length>0&&this.sourceBufferAvailable()){this.privAppendingToBuffer=!0;const e=this.privAudioBuffer.shift();try{this.privSourceBuffer.appendBuffer(e)}catch(t){return this.privAudioBuffer.unshift(e),void console.log("buffer filled, pausing addition of binaries until space is made")}yield this.notifyPlayback()}else this.canEndStream()&&(yield this.handleSourceBufferUpdateEnd())}))}handleSourceBufferUpdateEnd(){return Ad(this,void 0,void 0,(function*(){this.canEndStream()&&this.sourceBufferAvailable()&&(this.privMediaSource.endOfStream(),yield this.notifyPlayback())}))}notifyPlayback(){return Ad(this,void 0,void 0,(function*(){this.privPlaybackStarted||void 0===this.privAudio||(this.privPlaybackStarted=!0,this.onAudioStart&&this.onAudioStart(this),this.privAudio.onended=()=>{this.onAudioEnd&&this.onAudioEnd(this)},this.privIsPaused||(yield this.privAudio.play()))}))}canEndStream(){return this.isClosed&&void 0!==this.privSourceBuffer&&0===this.privAudioBuffer.length&&this.privMediaSourceOpened&&!this.privAppendingToBuffer&&"open"===this.privMediaSource.readyState}sourceBufferAvailable(){return void 0!==this.privSourceBuffer&&!this.privSourceBuffer.updating}}class kd{}_u=a("1DJXa");class Td{constructor(e){this.id=()=>this.privId,Wl.throwIfNullOrUndefined(_u.openSync,"\nFile System access not available, please use Push or PullAudioOutputStream"),this.privFd=_u.openSync(e,"w")}set format(e){Wl.throwIfNotUndefined(this.privAudioFormat,"format is already set"),this.privAudioFormat=e;let t=0;this.privAudioFormat.hasHeader&&(t=this.privAudioFormat.header.byteLength),void 0!==this.privFd&&(this.privWriteStream=_u.createWriteStream("",{fd:this.privFd,start:t,autoClose:!1}))}write(e){Wl.throwIfNullOrUndefined(this.privAudioFormat,"must set format before writing."),void 0!==this.privWriteStream&&this.privWriteStream.write(new Uint8Array(e.slice(0)))}close(){void 0!==this.privFd&&(this.privWriteStream.on("finish",(()=>{this.privAudioFormat.hasHeader&&(this.privAudioFormat.updateHeader(this.privWriteStream.bytesWritten),_u.writeSync(this.privFd,new Int8Array(this.privAudioFormat.header),0,this.privAudioFormat.header.byteLength,0)),_u.closeSync(this.privFd),this.privFd=void 0})),this.privWriteStream.end())}}class Id{static fromDefaultMicrophoneInput(){const e=new xu(!0);return new Od(new(0,$s.MicAudioSource)(e))}static fromMicrophoneInput(e){const t=new xu(!0);return new Od(new(0,$s.MicAudioSource)(t,e))}static fromWavFileInput(e,t="unnamedBuffer.wav"){return new Od(new(0,yu.FileAudioSource)(e,t))}static fromStreamInput(e){if(e instanceof md)return new Od(new(0,gd.PullAudioInputStreamImpl)(e));if(e instanceof gd.AudioInputStream)return new Od(e);if("undefined"!=typeof MediaStream&&e instanceof MediaStream){const t=new xu(!1);return new Od(new(0,$s.MicAudioSource)(t,null,null,e))}throw new Error("Not Supported Type")}static fromDefaultSpeakerOutput(){return new Rd(new(0,_d.SpeakerAudioDestination))}static fromSpeakerOutput(e){if(void 0===e)return Id.fromDefaultSpeakerOutput();if(e instanceof _d.SpeakerAudioDestination)return new Rd(e);throw new Error("Not Supported Type")}static fromAudioFileOutput(e){return new Rd(new Td(e))}static fromStreamOutput(e){if(e instanceof kd)return new Rd(new(0,Ic.PushAudioOutputStreamImpl)(e));if(e instanceof Ic.PushAudioOutputStream)return new Rd(e);if(e instanceof Ic.PullAudioOutputStream)return new Rd(e);throw new Error("Not Supported Type")}}class Od extends Id{constructor(e){super(),this.privSource=e}get format(){return this.privSource.format}close(e,t){this.privSource.turnOff().then((()=>{e&&e()}),(e=>{t&&t(e)}))}id(){return this.privSource.id()}get blob(){return this.privSource.blob}turnOn(){return this.privSource.turnOn()}attach(e){return this.privSource.attach(e)}detach(e){return this.privSource.detach(e)}turnOff(){return this.privSource.turnOff()}get events(){return this.privSource.events}setProperty(e,t){if(Wl.throwIfNull(t,"value"),void 0===this.privSource.setProperty)throw new Error("This AudioConfig instance does not support setting properties.");this.privSource.setProperty(e,t)}getProperty(e,t){if(void 0!==this.privSource.getProperty)return this.privSource.getProperty(e,t);throw new Error("This AudioConfig instance does not support getting properties.")}get deviceInfo(){return this.privSource.deviceInfo}}class Rd extends Id{constructor(e){super(),this.privDestination=e}set format(e){this.privDestination.format=e}write(e){this.privDestination.write(e)}close(){this.privDestination.close()}id(){return this.privDestination.id()}setProperty(e,t){throw new Error("This AudioConfig instance does not support setting properties.")}getProperty(e,t){throw new Error("This AudioConfig instance does not support getting properties.")}}var Pd={};e(Pd,"SpeechRecognizer",(()=>jd),(e=>jd=e));var Nd={};e(Nd,"Recognizer",(()=>Dd),(e=>Dd=e));var Ld=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Dd{constructor(e,t,n){this.audioConfig=void 0!==e?e:Id.fromDefaultMicrophoneInput(),this.privDisposed=!1,this.privProperties=t.clone(),this.privConnectionFactory=n,this.implCommonRecognizerSetup()}close(e,t){Wl.throwIfDisposed(this.privDisposed),ws(this.dispose(!0),e,t)}get internalData(){return this.privReco}dispose(e){return Ld(this,void 0,void 0,(function*(){this.privDisposed||(this.privDisposed=!0,e&&this.privReco&&(yield this.privReco.audioSource.turnOff(),yield this.privReco.dispose()))}))}static get telemetryEnabled(){return dl.ServiceRecognizerBase.telemetryDataEnabled}static enableTelemetry(e){dl.ServiceRecognizerBase.telemetryDataEnabled=e}implCommonRecognizerSetup(){let e="undefined"!=typeof window?"Browser":"Node",t="unknown",n="unknown";"undefined"!=typeof navigator&&(e=e+"/"+navigator.platform,t=navigator.userAgent,n=navigator.appVersion);const r=this.createRecognizerConfig(new El(new Cl(new Tl(e,t,n))));this.privReco=this.createServiceRecognizer(Dd.getAuthFromProperties(this.privProperties),this.privConnectionFactory,this.audioConfig,r)}recognizeOnceAsyncImpl(e){return Ld(this,void 0,void 0,(function*(){Wl.throwIfDisposed(this.privDisposed);const t=new bs;yield this.implRecognizerStop(),yield this.privReco.recognize(e,t.resolve,t.reject);const n=yield t.promise;return yield this.implRecognizerStop(),n}))}startContinuousRecognitionAsyncImpl(e){return Ld(this,void 0,void 0,(function*(){Wl.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop(),yield this.privReco.recognize(e,void 0,void 0)}))}stopContinuousRecognitionAsyncImpl(){return Ld(this,void 0,void 0,(function*(){Wl.throwIfDisposed(this.privDisposed),yield this.implRecognizerStop()}))}implRecognizerStop(){return Ld(this,void 0,void 0,(function*(){this.privReco&&(yield this.privReco.stopRecognizing())}))}static getAuthFromProperties(e){const t=e.getProperty(cl.SpeechServiceConnection_Key,void 0);return t&&""!==t?new nl(t):new il((t=>{const n=e.getProperty(cl.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(n)}),(t=>{const n=e.getProperty(cl.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(n)}))}}var Bd=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class jd extends Nd.Recognizer{constructor(e,t){const n=e;Wl.throwIfNull(n,"speechConfig"),Wl.throwIfNullOrWhitespace(n.properties.getProperty(cl.SpeechServiceConnection_RecoLanguage),cl[cl.SpeechServiceConnection_RecoLanguage]),super(t,n.properties,new zl),this.privDisposedRecognizer=!1}static FromConfig(e,t,n){const r=e;t.properties.mergeTo(r.properties);return new jd(e,n)}get endpointId(){return Wl.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(cl.SpeechServiceConnection_EndpointId,"00000000-0000-0000-0000-000000000000")}get authorizationToken(){return this.properties.getProperty(cl.SpeechServiceAuthorization_Token)}set authorizationToken(e){Wl.throwIfNullOrWhitespace(e,"token"),this.properties.setProperty(cl.SpeechServiceAuthorization_Token,e)}get speechRecognitionLanguage(){return Wl.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(cl.SpeechServiceConnection_RecoLanguage)}get outputFormat(){return Wl.throwIfDisposed(this.privDisposedRecognizer),this.properties.getProperty(fu,Ol[Ol.Simple])===Ol[Ol.Simple]?Ol.Simple:Ol.Detailed}get properties(){return this.privProperties}recognizeOnceAsync(e,t){ws(this.recognizeOnceAsyncImpl(ml.Interactive),e,t)}startContinuousRecognitionAsync(e,t){ws(this.startContinuousRecognitionAsyncImpl(ml.Conversation),e,t)}stopContinuousRecognitionAsync(e,t){ws(this.stopContinuousRecognitionAsyncImpl(),e,t)}startKeywordRecognitionAsync(e,t,n){Wl.throwIfNull(e,"model"),n&&n("Not yet implemented.")}stopKeywordRecognitionAsync(e,t){e&&e()}close(e,t){Wl.throwIfDisposed(this.privDisposedRecognizer),ws(this.dispose(!0),e,t)}dispose(e){const t=Object.create(null,{dispose:{get:()=>super.dispose}});return Bd(this,void 0,void 0,(function*(){this.privDisposedRecognizer||(e&&(this.privDisposedRecognizer=!0,yield this.implRecognizerStop()),yield t.dispose.call(this,e))}))}createRecognizerConfig(e){return new Al(e,this.properties)}createServiceRecognizer(e,t,n,r){return new(0,Ql.SpeechServiceRecognizer)(e,t,n,r,this)}}var Fd,Ud,zd,Hd,Vd={};e(Vd,"SpeechSynthesizer",(()=>Kd),(e=>Kd=e)),(Ud=Fd||(Fd={}))[Ud.Unknown=0]="Unknown",Ud[Ud.Female=1]="Female",Ud[Ud.Male=2]="Male",(Hd=zd||(zd={}))[Hd.OnlineNeural=1]="OnlineNeural",Hd[Hd.OnlineStandard=2]="OnlineStandard",Hd[Hd.OfflineNeural=3]="OfflineNeural",Hd[Hd.OfflineStandard=4]="OfflineStandard";class Wd{constructor(e){if(this.privStyleList=[],this.privVoicePath="",e&&(this.privName=e.Name,this.privLocale=e.Locale,this.privShortName=e.ShortName,this.privLocalName=e.LocalName,this.privVoiceType=e.VoiceType.endsWith("Standard")?zd.OnlineStandard:zd.OnlineNeural,this.privGender="Male"===e.Gender?Fd.Male:"Female"===e.Gender?Fd.Female:Fd.Unknown,e.StyleList&&Array.isArray(e.StyleList)))for(const t of e.StyleList)this.privStyleList.push(t)}get name(){return this.privName}get locale(){return this.privLocale}get shortName(){return this.privShortName}get localName(){return this.privLocalName}get gender(){return this.privGender}get voiceType(){return this.privVoiceType}get styleList(){return this.privStyleList}get voicePath(){return this.privVoicePath}}class Gd extends qc{constructor(e,t){if(Array.isArray(t)){super(e,Pl.VoicesListRetrieved,void 0,new Gl),this.privVoices=[];for(const e of t)this.privVoices.push(new Wd(e))}else super(e,Pl.Canceled,t.errorDetails?t.errorDetails:"Error information unavailable",new Gl)}get voices(){return this.privVoices}}var qd=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))};class Kd{constructor(e,t){const n=e;Wl.throwIfNull(n,"speechConfig"),null!==t&&(this.audioConfig=void 0===t?"undefined"==typeof window?void 0:Id.fromDefaultSpeakerOutput():t),this.privProperties=n.properties.clone(),this.privDisposed=!1,this.privSynthesizing=!1,this.privConnectionFactory=new Hl,this.synthesisRequestQueue=new(0,xs.Queue),this.implCommonSynthesizeSetup()}get authorizationToken(){return this.properties.getProperty(cl.SpeechServiceAuthorization_Token)}set authorizationToken(e){Wl.throwIfNullOrWhitespace(e,"token"),this.properties.setProperty(cl.SpeechServiceAuthorization_Token,e)}get properties(){return this.privProperties}get autoDetectSourceLanguage(){return"OpenRange"===this.properties.getProperty(cl.SpeechServiceConnection_AutoDetectSourceLanguages)}static FromConfig(e,t,n){const r=e;return t.properties.mergeTo(r.properties),new Kd(e,n)}buildSsml(e){const t={"af-ZA":"af-ZA-AdriNeural","am-ET":"am-ET-AmehaNeural","ar-AE":"ar-AE-FatimaNeural","ar-BH":"ar-BH-AliNeural","ar-DZ":"ar-DZ-AminaNeural","ar-EG":"ar-EG-SalmaNeural","ar-IQ":"ar-IQ-BasselNeural","ar-JO":"ar-JO-SanaNeural","ar-KW":"ar-KW-FahedNeural","ar-LY":"ar-LY-ImanNeural","ar-MA":"ar-MA-JamalNeural","ar-QA":"ar-QA-AmalNeural","ar-SA":"ar-SA-HamedNeural","ar-SY":"ar-SY-AmanyNeural","ar-TN":"ar-TN-HediNeural","ar-YE":"ar-YE-MaryamNeural","bg-BG":"bg-BG-BorislavNeural","bn-BD":"bn-BD-NabanitaNeural","ca-ES":"ca-ES-JoanaNeural","cs-CZ":"cs-CZ-AntoninNeural","cy-GB":"cy-GB-AledNeural","da-DK":"da-DK-ChristelNeural","de-AT":"de-AT-IngridNeural","de-CH":"de-CH-JanNeural","de-DE":"de-DE-KatjaNeural","el-GR":"el-GR-AthinaNeural","en-AU":"en-AU-NatashaNeural","en-CA":"en-CA-ClaraNeural","en-GB":"en-GB-LibbyNeural","en-HK":"en-HK-SamNeural","en-IE":"en-IE-ConnorNeural","en-IN":"en-IN-NeerjaNeural","en-KE":"en-KE-AsiliaNeural","en-NG":"en-NG-AbeoNeural","en-NZ":"en-NZ-MitchellNeural","en-PH":"en-PH-JamesNeural","en-SG":"en-SG-LunaNeural","en-TZ":"en-TZ-ElimuNeural","en-US":"en-US-JennyNeural","en-ZA":"en-ZA-LeahNeural","es-AR":"es-AR-ElenaNeural","es-BO":"es-BO-MarceloNeural","es-CL":"es-CL-CatalinaNeural","es-CO":"es-CO-GonzaloNeural","es-CR":"es-CR-JuanNeural","es-CU":"es-CU-BelkysNeural","es-DO":"es-DO-EmilioNeural","es-EC":"es-EC-AndreaNeural","es-ES":"es-ES-AlvaroNeural","es-GQ":"es-GQ-JavierNeural","es-GT":"es-GT-AndresNeural","es-HN":"es-HN-CarlosNeural","es-MX":"es-MX-DaliaNeural","es-NI":"es-NI-FedericoNeural","es-PA":"es-PA-MargaritaNeural","es-PE":"es-PE-AlexNeural","es-PR":"es-PR-KarinaNeural","es-PY":"es-PY-MarioNeural","es-SV":"es-SV-LorenaNeural","es-US":"es-US-AlonsoNeural","es-UY":"es-UY-MateoNeural","es-VE":"es-VE-PaolaNeural","et-EE":"et-EE-AnuNeural","fa-IR":"fa-IR-DilaraNeural","fi-FI":"fi-FI-SelmaNeural","fil-PH":"fil-PH-AngeloNeural","fr-BE":"fr-BE-CharlineNeural","fr-CA":"fr-CA-SylvieNeural","fr-CH":"fr-CH-ArianeNeural","fr-FR":"fr-FR-DeniseNeural","ga-IE":"ga-IE-ColmNeural","gl-ES":"gl-ES-RoiNeural","gu-IN":"gu-IN-DhwaniNeural","he-IL":"he-IL-AvriNeural","hi-IN":"hi-IN-MadhurNeural","hr-HR":"hr-HR-GabrijelaNeural","hu-HU":"hu-HU-NoemiNeural","id-ID":"id-ID-ArdiNeural","it-IT":"it-IT-IsabellaNeural","ja-JP":"ja-JP-NanamiNeural","jv-ID":"jv-ID-DimasNeural","km-KH":"km-KH-PisethNeural","ko-KR":"ko-KR-SunHiNeural","lt-LT":"lt-LT-LeonasNeural","lv-LV":"lv-LV-EveritaNeural","mr-IN":"mr-IN-AarohiNeural","ms-MY":"ms-MY-OsmanNeural","mt-MT":"mt-MT-GraceNeural","my-MM":"my-MM-NilarNeural","nb-NO":"nb-NO-PernilleNeural","nl-BE":"nl-BE-ArnaudNeural","nl-NL":"nl-NL-ColetteNeural","pl-PL":"pl-PL-AgnieszkaNeural","pt-BR":"pt-BR-FranciscaNeural","pt-PT":"pt-PT-DuarteNeural","ro-RO":"ro-RO-AlinaNeural","ru-RU":"ru-RU-SvetlanaNeural","sk-SK":"sk-SK-LukasNeural","sl-SI":"sl-SI-PetraNeural","so-SO":"so-SO-MuuseNeural","su-ID":"su-ID-JajangNeural","sv-SE":"sv-SE-SofieNeural","sw-KE":"sw-KE-RafikiNeural","sw-TZ":"sw-TZ-DaudiNeural","ta-IN":"ta-IN-PallaviNeural","ta-LK":"ta-LK-KumarNeural","ta-SG":"ta-SG-AnbuNeural","te-IN":"te-IN-MohanNeural","th-TH":"th-TH-PremwadeeNeural","tr-TR":"tr-TR-AhmetNeural","uk-UA":"uk-UA-OstapNeural","ur-IN":"ur-IN-GulNeural","ur-PK":"ur-PK-AsadNeural","uz-UZ":"uz-UZ-MadinaNeural","vi-VN":"vi-VN-HoaiMyNeural","zh-CN":"zh-CN-XiaoxiaoNeural","zh-HK":"zh-HK-HiuMaanNeural","zh-TW":"zh-TW-HsiaoChenNeural","zu-ZA":"zu-ZA-ThandoNeural"};let n=this.properties.getProperty(cl.SpeechServiceConnection_SynthLanguage,"en-US"),r=this.properties.getProperty(cl.SpeechServiceConnection_SynthVoice,""),i=Kd.XMLEncode(e);return this.autoDetectSourceLanguage?n="en-US":r=r||t[n],r&&(i=`<voice name='${r}'>${i}</voice>`),i=`<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='http://www.w3.org/2001/mstts' xmlns:emo='http://www.w3.org/2009/10/emotionml' xml:lang='${n}'>${i}</speak>`,i}speakTextAsync(e,t,n,r){this.speakImpl(e,!1,t,n,r)}speakSsmlAsync(e,t,n,r){this.speakImpl(e,!0,t,n,r)}getVoicesAsync(e=""){return qd(this,void 0,void 0,(function*(){return this.getVoices(e)}))}close(e,t){Wl.throwIfDisposed(this.privDisposed),ws(this.dispose(!0),e,t)}get internalData(){return this.privAdapter}dispose(e){return qd(this,void 0,void 0,(function*(){this.privDisposed||(e&&this.privAdapter&&(yield this.privAdapter.dispose()),this.privDisposed=!0)}))}createSynthesizerConfig(e){return new uu(e,this.privProperties)}createSynthesisAdapter(e,t,n,r){return new(0,Wc.SynthesisAdapterBase)(e,t,r,this,this.audioConfig)}implCommonSynthesizeSetup(){let e="undefined"!=typeof window?"Browser":"Node",t="unknown",n="unknown";"undefined"!=typeof navigator&&(e=e+"/"+navigator.platform,t=navigator.userAgent,n=navigator.appVersion);const r=this.createSynthesizerConfig(new El(new Cl(new Tl(e,t,n)))),i=this.privProperties.getProperty(cl.SpeechServiceConnection_Key,void 0),o=i&&""!==i?new nl(i):new il((e=>{const t=this.privProperties.getProperty(cl.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}),(e=>{const t=this.privProperties.getProperty(cl.SpeechServiceAuthorization_Token,void 0);return Promise.resolve(t)}));this.privAdapter=this.createSynthesisAdapter(o,this.privConnectionFactory,this.audioConfig,r),this.privAdapter.audioOutputFormat=Ec.fromSpeechSynthesisOutputFormat(hc[this.properties.getProperty(cl.SpeechServiceConnection_SynthOutputFormat,void 0)]),this.privRestAdapter=new cu(r)}speakImpl(e,t,n,r,i){try{Wl.throwIfDisposed(this.privDisposed);const o=Ba();let a;a=i instanceof kd?new(0,Ic.PushAudioOutputStreamImpl)(i):i instanceof Ic.PullAudioOutputStream?i:void 0!==i?new Td(i):void 0,this.synthesisRequestQueue.enqueue(new Yd(o,e,t,(e=>{if(this.privSynthesizing=!1,n)try{n(e)}catch(e){r&&r(e)}n=void 0,this.adapterSpeak().catch((()=>{}))}),(e=>{r&&r(e)}),a)),this.adapterSpeak().catch((()=>{}))}catch(e){if(r)if(e instanceof Error){const t=e;r(t.name+": "+t.message)}else r(e);this.dispose(!0).catch((()=>{}))}}getVoices(e){return qd(this,void 0,void 0,(function*(){const t=Ba(),n=yield this.privRestAdapter.getVoicesList(t);if(n.ok&&Array.isArray(n.json)){let r=n.json;return e&&e.length>0&&(r=r.filter((t=>!!t.Locale&&t.Locale.toLowerCase()===e.toLowerCase()))),new Gd(t,r)}return new Gd(t,{errorDetails:`Error: ${n.status}: ${n.statusText}`})}))}adapterSpeak(){return qd(this,void 0,void 0,(function*(){if(!this.privDisposed&&!this.privSynthesizing){this.privSynthesizing=!0;const e=yield this.synthesisRequestQueue.dequeue();return this.privAdapter.Speak(e.text,e.isSSML,e.requestId,e.cb,e.err,e.dataStream)}}))}static XMLEncode(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}}class Yd{constructor(e,t,n,r,i,o){this.requestId=e,this.text=t,this.isSSML=n,this.cb=r,this.err=i,this.dataStream=o}}var Jd=a("4IUwl");var Qd={error:console.error,info:console.info,success:console.log};u=a("85Hg2"),Jd=a("4IUwl"),Jd=a("4IUwl");var Xd=({className:e,title:t,loading:n=!0})=>(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:r(Jd)(e,{"memori-loading-icon":n}),"aria-label":t,children:(0,s.jsx)("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})});var Zd=({primary:e=!1,outlined:t=!1,ghost:n=!1,padded:i=!0,shape:o="rounded",danger:a=!1,loading:l=!1,disabled:c=!1,block:u=!1,icon:d,className:f,title:h,id:p,htmlType:m,onClick:g,onMouseDown:v,onMouseUp:y,onMouseLeave:b,onTouchStart:w,onTouchEnd:x,children:S})=>(0,s.jsxs)("button",{id:p,type:m,onClick:g,onMouseDown:v,onMouseUp:y,onMouseLeave:b,onTouchStart:w,onTouchEnd:x,title:h,disabled:l||c,className:r(Jd)("memori-button",{"memori-button--primary":e,"memori-button--outlined":t,"memori-button--ghost":n,"memori-button--square":"square"===o,"memori-button--rounded":"rounded"===o,"memori-button--circle":"circle"===o,"memori-button--padded":i,"memori-button--block":u,"memori-button--with-icon":(d||l)&&S,"memori-button--icon-only":(d||l)&&!S,"memori-button--danger":a,"memori-button--loading":l},f),children:[d&&!l&&(0,s.jsx)("span",{className:"memori-button--icon",children:d}),l&&(0,s.jsx)("span",{className:"memori-button--icon loading-icon",children:(0,s.jsx)(Xd,{loading:!0})}),S]});u=a("85Hg2"),u=a("85Hg2"),u=a("85Hg2");function $d(e,t,...n){if(e in t){let r=t[e];return"function"==typeof r?r(...n):r}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((e=>`"${e}"`)).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,$d),r}var ef,tf,nf=((tf=nf||{})[tf.None=0]="None",tf[tf.RenderStrategy=1]="RenderStrategy",tf[tf.Static=2]="Static",tf),rf=((ef=rf||{})[ef.Unmount=0]="Unmount",ef[ef.Hidden=1]="Hidden",ef);function of({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:i,visible:o=!0,name:a}){let s=sf(t,e);if(o)return af(s,n,r,a);let l=null!=i?i:0;if(2&l){let{static:e=!1,...t}=s;if(e)return af(t,n,r,a)}if(1&l){let{unmount:e=!0,...t}=s;return $d(e?0:1,{0:()=>null,1:()=>af({...t,hidden:!0,style:{display:"none"}},n,r,a)})}return af(s,n,r,a)}function af(e,t={},n,r){let{as:i=n,children:o,refName:a="ref",...s}=uf(e,["unmount","static"]),l=void 0!==e.ref?{[a]:e.ref}:{},c="function"==typeof o?o(t):o;s.className&&"function"==typeof s.className&&(s.className=s.className(t));let d={};if(t){let e=!1,n=[];for(let[r,i]of Object.entries(t))"boolean"==typeof i&&(e=!0),!0===i&&n.push(r);e&&(d["data-headlessui-state"]=n.join(" "))}if(i===u.Fragment&&Object.keys(cf(s)).length>0){if(!(0,u.isValidElement)(c)||Array.isArray(c)&&c.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(s).map((e=>` - ${e}`)).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((e=>` - ${e}`)).join("\n")].join("\n"));return(0,u.cloneElement)(c,Object.assign({},sf(c.props,cf(uf(s,["ref"]))),d,l,function(...e){return{ref:e.every((e=>null==e))?void 0:t=>{for(let n of e)null!=n&&("function"==typeof n?n(t):n.current=t)}}}(c.ref,l.ref)))}return(0,u.createElement)(i,Object.assign({},uf(s,["ref"]),i!==u.Fragment&&l,i!==u.Fragment&&d),c)}function sf(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map((e=>[e,void 0]))));for(let e in n)Object.assign(t,{[e](t,...r){let i=n[e];for(let e of i){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function lf(e){var t;return Object.assign((0,u.forwardRef)(e),{displayName:null!=(t=e.displayName)?t:e.name})}function cf(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function uf(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}let df=(0,(u=a("85Hg2")).createContext)(null);df.displayName="OpenClosedContext";var ff=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ff||{});function hf(){return(0,u.useContext)(df)}function pf({value:e,children:t}){return r(u).createElement(df.Provider,{value:e},t)}u=a("85Hg2"),u=a("85Hg2");const mf="undefined"==typeof window||"undefined"==typeof document;let gf=mf?u.useEffect:u.useLayoutEffect;function vf(){let e=(0,u.useRef)(!1);return gf((()=>(e.current=!0,()=>{e.current=!1})),[]),e}u=a("85Hg2");function yf(e){let t=(0,u.useRef)(e);return gf((()=>{t.current=e}),[e]),t}u=a("85Hg2");let bf={serverHandoffComplete:!1};function wf(){let[e,t]=(0,u.useState)(bf.serverHandoffComplete);return(0,u.useEffect)((()=>{!0!==e&&t(!0)}),[e]),(0,u.useEffect)((()=>{!1===bf.serverHandoffComplete&&(bf.serverHandoffComplete=!0)}),[]),e}u=a("85Hg2"),u=a("85Hg2");let xf=function(e){let t=yf(e);return r(u).useCallback(((...e)=>t.current(...e)),[t])},Sf=Symbol();function Mf(e,t=!0){return Object.assign(e,{[Sf]:t})}function _f(...e){let t=(0,u.useRef)(e);(0,u.useEffect)((()=>{t.current=e}),[e]);let n=xf((e=>{for(let n of t.current)null!=n&&("function"==typeof n?n(e):n.current=e)}));return e.every((e=>null==e||(null==e?void 0:e[Sf])))?void 0:n}function Af(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function Ef(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e}))))}function Cf(){let e=[],t=[],n={enqueue(e){t.push(e)},addEventListener:(e,t,r,i)=>(e.addEventListener(t,r,i),n.add((()=>e.removeEventListener(t,r,i)))),requestAnimationFrame(...e){let t=requestAnimationFrame(...e);return n.add((()=>cancelAnimationFrame(t)))},nextFrame:(...e)=>n.requestAnimationFrame((()=>n.requestAnimationFrame(...e))),setTimeout(...e){let t=setTimeout(...e);return n.add((()=>clearTimeout(t)))},microTask(...e){let t={current:!0};return Ef((()=>{t.current&&e[0]()})),n.add((()=>{t.current=!1}))},add:t=>(e.push(t),()=>{let n=e.indexOf(t);if(n>=0){let[t]=e.splice(n,1);t()}}),dispose(){for(let t of e.splice(0))t()},async workQueue(){for(let e of t.splice(0))await e()}};return n}function kf(e,...t){e&&t.length>0&&e.classList.add(...t)}function Tf(e,...t){e&&t.length>0&&e.classList.remove(...t)}var If,Of=((If=Of||{}).Ended="ended",If.Cancelled="cancelled",If);function Rf(e,t,n,r){let i=n?"enter":"leave",o=Cf(),a=void 0!==r?Af(r):()=>{};"enter"===i&&(e.removeAttribute("hidden"),e.style.display="");let s=$d(i,{enter:()=>t.enter,leave:()=>t.leave}),l=$d(i,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),c=$d(i,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return Tf(e,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),kf(e,...s,...c),o.nextFrame((()=>{Tf(e,...c),kf(e,...l),function(e,t){let n=Cf();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:i}=getComputedStyle(e),[o,a]=[r,i].map((e=>{let[t=0]=e.split(",").filter(Boolean).map((e=>e.includes("ms")?parseFloat(e):1e3*parseFloat(e))).sort(((e,t)=>t-e));return t}));if(o+a!==0){let r=[];r.push(n.addEventListener(e,"transitionrun",(i=>{i.target===i.currentTarget&&(r.splice(0).forEach((e=>e())),r.push(n.addEventListener(e,"transitionend",(e=>{e.target===e.currentTarget&&(t("ended"),r.splice(0).forEach((e=>e())))})),n.addEventListener(e,"transitioncancel",(e=>{e.target===e.currentTarget&&(t("cancelled"),r.splice(0).forEach((e=>e())))}))))})))}else t("ended");n.add((()=>t("cancelled"))),n.dispose}(e,(n=>("ended"===n&&(Tf(e,...s),kf(e,...t.entered)),a(n))))})),o.dispose}function Pf(){let[e]=(0,u.useState)(Cf);return(0,u.useEffect)((()=>()=>e.dispose()),[e]),e}function Nf({container:e,direction:t,classes:n,onStart:r,onStop:i}){let o=vf(),a=Pf(),s=yf(t);gf((()=>{let t=Cf();a.add(t.dispose);let l=e.current;if(l&&"idle"!==s.current&&o.current)return t.dispose(),r.current(s.current),t.add(Rf(l,n.current,"enter"===s.current,(e=>{t.dispose(),$d(e,{[Of.Ended](){i.current(s.current)},[Of.Cancelled]:()=>{}})}))),t.dispose}),[t])}function Lf(e=""){return e.split(" ").filter((e=>e.trim().length>1))}let Df=(0,(u=a("85Hg2")).createContext)(null);Df.displayName="TransitionContext";var Bf,jf=((Bf=jf||{}).Visible="visible",Bf.Hidden="hidden",Bf);let Ff=(0,u.createContext)(null);function Uf(e){return"children"in e?Uf(e.children):e.current.filter((({el:e})=>null!==e.current)).filter((({state:e})=>"visible"===e)).length>0}function zf(e,t){let n=yf(e),r=(0,u.useRef)([]),i=vf(),o=Pf(),a=xf(((e,t=rf.Hidden)=>{let a=r.current.findIndex((({el:t})=>t===e));-1!==a&&($d(t,{[rf.Unmount](){r.current.splice(a,1)},[rf.Hidden](){r.current[a].state="hidden"}}),o.microTask((()=>{var e;!Uf(r)&&i.current&&(null==(e=n.current)||e.call(n))})))})),s=xf((e=>{let t=r.current.find((({el:t})=>t===e));return t?"visible"!==t.state&&(t.state="visible"):r.current.push({el:e,state:"visible"}),()=>a(e,rf.Unmount)})),l=(0,u.useRef)([]),c=(0,u.useRef)(Promise.resolve()),d=(0,u.useRef)({enter:[],leave:[],idle:[]}),f=xf(((e,n,r)=>{l.current.splice(0),t&&(t.chains.current[n]=t.chains.current[n].filter((([t])=>t!==e))),null==t||t.chains.current[n].push([e,new Promise((e=>{l.current.push(e)}))]),null==t||t.chains.current[n].push([e,new Promise((e=>{Promise.all(d.current[n].map((([e,t])=>t))).then((()=>e()))}))]),"enter"===n?c.current=c.current.then((()=>null==t?void 0:t.wait.current)).then((()=>r(n))):r(n)})),h=xf(((e,t,n)=>{Promise.all(d.current[t].splice(0).map((([e,t])=>t))).then((()=>{var e;null==(e=l.current.shift())||e()})).then((()=>n(t)))}));return(0,u.useMemo)((()=>({children:r,register:s,unregister:a,onStart:f,onStop:h,wait:c,chains:d})),[s,a,r,f,h,d,c])}function Hf(){}Ff.displayName="NestingContext";let Vf=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Wf(e){var t;let n={};for(let r of Vf)n[r]=null!=(t=e[r])?t:Hf;return n}let Gf=nf.RenderStrategy,qf=lf((function(e,t){let{beforeEnter:n,afterEnter:i,beforeLeave:o,afterLeave:a,enter:s,enterFrom:l,enterTo:c,entered:d,leave:f,leaveFrom:h,leaveTo:p,...m}=e,g=(0,u.useRef)(null),v=_f(g,t),y=m.unmount?rf.Unmount:rf.Hidden,{show:b,appear:w,initial:x}=function(){let e=(0,u.useContext)(Df);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),[S,M]=(0,u.useState)(b?"visible":"hidden"),_=function(){let e=(0,u.useContext)(Ff);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),{register:A,unregister:E}=_,C=(0,u.useRef)(null);(0,u.useEffect)((()=>A(g)),[A,g]),(0,u.useEffect)((()=>{if(y===rf.Hidden&&g.current)return b&&"visible"!==S?void M("visible"):$d(S,{hidden:()=>E(g),visible:()=>A(g)})}),[S,g,A,E,b,y]);let k=yf({enter:Lf(s),enterFrom:Lf(l),enterTo:Lf(c),entered:Lf(d),leave:Lf(f),leaveFrom:Lf(h),leaveTo:Lf(p)}),T=function(e){let t=(0,u.useRef)(Wf(e));return(0,u.useEffect)((()=>{t.current=Wf(e)}),[e]),t}({beforeEnter:n,afterEnter:i,beforeLeave:o,afterLeave:a}),I=wf();(0,u.useEffect)((()=>{if(I&&"visible"===S&&null===g.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[g,S,I]);let O=x&&!w,R=!I||O||C.current===b?"idle":b?"enter":"leave",P=xf((e=>$d(e,{enter:()=>T.current.beforeEnter(),leave:()=>T.current.beforeLeave(),idle:()=>{}}))),N=xf((e=>$d(e,{enter:()=>T.current.afterEnter(),leave:()=>T.current.afterLeave(),idle:()=>{}}))),L=zf((()=>{M("hidden"),E(g)}),_);Nf({container:g,classes:k,direction:R,onStart:yf((e=>{L.onStart(g,e,P)})),onStop:yf((e=>{L.onStop(g,e,N),"leave"===e&&!Uf(L)&&(M("hidden"),E(g))}))}),(0,u.useEffect)((()=>{!O||(y===rf.Hidden?C.current=null:C.current=b)}),[b,O,S]);let D=m,B={ref:v};return r(u).createElement(Ff.Provider,{value:L},r(u).createElement(pf,{value:$d(S,{visible:ff.Open,hidden:ff.Closed})},of({ourProps:B,theirProps:D,defaultTag:"div",features:Gf,visible:"visible"===S,name:"Transition.Child"})))})),Kf=lf((function(e,t){let{show:n,appear:i=!1,unmount:o,...a}=e,s=(0,u.useRef)(null),l=_f(s,t);wf();let c=hf();if(void 0===n&&null!==c&&(n=$d(c,{[ff.Open]:!0,[ff.Closed]:!1})),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[d,f]=(0,u.useState)(n?"visible":"hidden"),h=zf((()=>{f("hidden")})),[p,m]=(0,u.useState)(!0),g=(0,u.useRef)([n]);gf((()=>{!1!==p&&g.current[g.current.length-1]!==n&&(g.current.push(n),m(!1))}),[g,n]);let v=(0,u.useMemo)((()=>({show:n,appear:i,initial:p})),[n,i,p]);(0,u.useEffect)((()=>{if(n)f("visible");else if(Uf(h)){let e=s.current;if(!e)return;let t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&f("hidden")}else f("hidden")}),[n,h]);let y={unmount:o};return r(u).createElement(Ff.Provider,{value:h},r(u).createElement(Df.Provider,{value:v},of({ourProps:{...y,as:u.Fragment,children:r(u).createElement(qf,{ref:l,...y,...a})},theirProps:{},defaultTag:u.Fragment,features:Gf,visible:"visible"===d,name:"Transition"})))})),Yf=lf((function(e,t){let n=null!==(0,u.useContext)(Df),i=null!==hf();return r(u).createElement(r(u).Fragment,null,!n&&i?r(u).createElement(Kf,{ref:t,...e}):r(u).createElement(qf,{ref:t,...e}))})),Jf=Object.assign(Kf,{Child:Yf,Root:Kf});u=a("85Hg2");var Qf,Xf=((Qf=Xf||{}).Space=" ",Qf.Enter="Enter",Qf.Escape="Escape",Qf.Backspace="Backspace",Qf.Delete="Delete",Qf.ArrowLeft="ArrowLeft",Qf.ArrowUp="ArrowUp",Qf.ArrowRight="ArrowRight",Qf.ArrowDown="ArrowDown",Qf.Home="Home",Qf.End="End",Qf.PageUp="PageUp",Qf.PageDown="PageDown",Qf.Tab="Tab",Qf);function Zf(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=""===(null==t?void 0:t.getAttribute("disabled"));return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(n))&&r}var $f;u=a("85Hg2");let eh=0;function th(){return++eh}let nh=null!=($f=r(u).useId)?$f:function(){let e=wf(),[t,n]=r(u).useState(e?th:null);return gf((()=>{null===t&&n(th())}),[t]),null!=t?""+t:void 0};u=a("85Hg2");var rh=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(rh||{});let ih=lf((function(e,t){let{features:n=1,...r}=e;return of({ourProps:{ref:t,"aria-hidden":2==(2&n)||void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...4==(4&n)&&2!=(2&n)&&{display:"none"}}},theirProps:r,slot:{},defaultTag:"div",name:"Hidden"})}));function oh(e){return mf?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let ah=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((e=>`${e}:not([tabindex='-1'])`)).join(",");var sh,lh=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(lh||{}),ch=((sh=ch||{})[sh.Error=0]="Error",sh[sh.Overflow=1]="Overflow",sh[sh.Success=2]="Success",sh[sh.Underflow=3]="Underflow",sh),uh=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(uh||{});function dh(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(ah))}var fh=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(fh||{});function hh(e,t=0){var n;return e!==(null==(n=oh(e))?void 0:n.body)&&$d(t,{0:()=>e.matches(ah),1(){let t=e;for(;null!==t;){if(t.matches(ah))return!0;t=t.parentElement}return!1}})}function ph(e){let t=oh(e);Cf().nextFrame((()=>{t&&!hh(t.activeElement,0)&&mh(e)}))}function mh(e){null==e||e.focus({preventScroll:!0})}let gh=["textarea","input"].join(",");function vh(e,t=(e=>e)){return e.slice().sort(((e,n)=>{let r=t(e),i=t(n);if(null===r||null===i)return 0;let o=r.compareDocumentPosition(i);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0}))}function yh(e,t){return bh(dh(),t,!0,e)}function bh(e,t,n=!0,r=null){let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,o=Array.isArray(e)?n?vh(e):e:dh(e);r=null!=r?r:i.activeElement;let a,s=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,o.indexOf(r))-1;if(4&t)return Math.max(0,o.indexOf(r))+1;if(8&t)return o.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=32&t?{preventScroll:!0}:{},u=0,d=o.length;do{if(u>=d||u+d<=0)return 0;let e=l+u;if(16&t)e=(e+d)%d;else{if(e<0)return 3;if(e>=d)return 1}a=o[e],null==a||a.focus(c),u+=s}while(a!==i.activeElement);return 6&t&&function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,gh))&&n}(a)&&a.select(),a.hasAttribute("tabindex")||a.setAttribute("tabindex","0"),2}u=a("85Hg2"),u=a("85Hg2");function wh(e,t,n){let r=yf(t);(0,u.useEffect)((()=>{function t(e){r.current(e)}return window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)}),[e,n])}var xh=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(xh||{});function Sh(){let e=(0,u.useRef)(0);return wh("keydown",(t=>{"Tab"===t.key&&(e.current=t.shiftKey?1:0)}),!0),e}u=a("85Hg2");function Mh(...e){return(0,u.useMemo)((()=>oh(...e)),[...e])}u=a("85Hg2");function _h(e,t,n,r){let i=yf(n);(0,u.useEffect)((()=>{function n(e){i.current(e)}return(e=null!=e?e:window).addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}),[e,t,r])}u=a("85Hg2");function Ah(e,t){let n=(0,u.useRef)([]),r=xf(e);(0,u.useEffect)((()=>{let e=[...n.current];for(let[i,o]of t.entries())if(n.current[i]!==o){let i=r(t,e);return n.current=t,i}}),[r,...t])}var Eh=(e=>(e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e))(Eh||{});let Ch=Object.assign(lf((function(e,t){let n=(0,u.useRef)(null),i=_f(n,t),{initialFocus:o,containers:a,features:s=30,...l}=e;wf()||(s=1);let c=Mh(n);!function({ownerDocument:e},t){let n=(0,u.useRef)(null);_h(null==e?void 0:e.defaultView,"focusout",(e=>{!t||n.current||(n.current=e.target)}),!0),Ah((()=>{t||((null==e?void 0:e.activeElement)===(null==e?void 0:e.body)&&mh(n.current),n.current=null)}),[t]);let r=(0,u.useRef)(!1);(0,u.useEffect)((()=>(r.current=!1,()=>{r.current=!0,Ef((()=>{!r.current||(mh(n.current),n.current=null)}))})),[])}({ownerDocument:c},Boolean(16&s));let d=function({ownerDocument:e,container:t,initialFocus:n},r){let i=(0,u.useRef)(null),o=vf();return Ah((()=>{if(!r)return;let a=t.current;!a||Ef((()=>{if(!o.current)return;let t=null==e?void 0:e.activeElement;if(null!=n&&n.current){if((null==n?void 0:n.current)===t)return void(i.current=t)}else if(a.contains(t))return void(i.current=t);null!=n&&n.current?mh(n.current):bh(a,lh.First)===ch.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),i.current=null==e?void 0:e.activeElement}))}),[r]),i}({ownerDocument:c,container:n,initialFocus:o},Boolean(2&s));!function({ownerDocument:e,container:t,containers:n,previousActiveElement:r},i){let o=vf();_h(null==e?void 0:e.defaultView,"focus",(e=>{if(!i||!o.current)return;let a=new Set(null==n?void 0:n.current);a.add(t);let s=r.current;if(!s)return;let l=e.target;l&&l instanceof HTMLElement?function(e,t){var n;for(let r of e)if(null!=(n=r.current)&&n.contains(t))return!0;return!1}(a,l)?(r.current=l,mh(l)):(e.preventDefault(),e.stopPropagation(),mh(s)):mh(r.current)}),!0)}({ownerDocument:c,container:n,containers:a,previousActiveElement:d},Boolean(8&s));let f=Sh(),h=xf((()=>{let e=n.current;!e||$d(f.current,{[xh.Forwards]:()=>bh(e,lh.First),[xh.Backwards]:()=>bh(e,lh.Last)})})),p={ref:i};return r(u).createElement(r(u).Fragment,null,Boolean(4&s)&&r(u).createElement(ih,{as:"button",type:"button",onFocus:h,features:rh.Focusable}),of({ourProps:p,theirProps:l,defaultTag:"div",name:"FocusTrap"}),Boolean(4&s)&&r(u).createElement(ih,{as:"button",type:"button",onFocus:h,features:rh.Focusable}))})),{features:Eh});let kh=new Set,Th=new Map;function Ih(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function Oh(e){let t=Th.get(e);!t||(null===t["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}function Rh(e,t=!0){gf((()=>{if(!t||!e.current)return;let n=e.current,r=oh(n);if(r){kh.add(n);for(let e of Th.keys())e.contains(n)&&(Oh(e),Th.delete(e));return r.querySelectorAll("body > *").forEach((e=>{if(e instanceof HTMLElement){for(let t of kh)if(e.contains(t))return;1===kh.size&&(Th.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),Ih(e))}})),()=>{if(kh.delete(n),kh.size>0)r.querySelectorAll("body > *").forEach((e=>{if(e instanceof HTMLElement&&!Th.has(e)){for(let t of kh)if(e.contains(t))return;Th.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),Ih(e)}}));else for(let e of Th.keys())Oh(e),Th.delete(e)}}}),[t])}u=a("85Hg2"),c=a("2BCLI");let Ph=(0,(u=a("85Hg2")).createContext)(!1);function Nh(e){return r(u).createElement(Ph.Provider,{value:e.force},e.children)}function Lh(e){let t=(0,u.useContext)(Ph),n=(0,u.useContext)(Fh),r=Mh(e),[i,o]=(0,u.useState)((()=>{if(!t&&null!==n||mf)return null;let e=null==r?void 0:r.getElementById("headlessui-portal-root");if(e)return e;if(null===r)return null;let i=r.createElement("div");return i.setAttribute("id","headlessui-portal-root"),r.body.appendChild(i)}));return(0,u.useEffect)((()=>{null!==i&&(null!=r&&r.body.contains(i)||null==r||r.body.appendChild(i))}),[i,r]),(0,u.useEffect)((()=>{t||null!==n&&o(n.current)}),[n,o,t]),i}let Dh=u.Fragment,Bh=lf((function(e,t){let n=e,r=(0,u.useRef)(null),i=_f(Mf((e=>{r.current=e})),t),o=Mh(r),a=Lh(r),[s]=(0,u.useState)((()=>{var e;return mf?null:null!=(e=null==o?void 0:o.createElement("div"))?e:null})),l=wf(),d=(0,u.useRef)(!1);return gf((()=>{if(d.current=!1,a&&s)return a.contains(s)||(s.setAttribute("data-headlessui-portal",""),a.appendChild(s)),()=>{d.current=!0,Ef((()=>{var e;!d.current||!a||!s||(a.removeChild(s),a.childNodes.length<=0&&(null==(e=a.parentElement)||e.removeChild(a)))}))}}),[a,s]),l&&a&&s?(0,c.createPortal)(of({ourProps:{ref:i},theirProps:n,defaultTag:Dh,name:"Portal"}),s):null})),jh=u.Fragment,Fh=(0,u.createContext)(null),Uh=lf((function(e,t){let{target:n,...i}=e,o={ref:_f(t)};return r(u).createElement(Fh.Provider,{value:n},of({ourProps:o,theirProps:i,defaultTag:jh,name:"Popover.Group"}))})),zh=Object.assign(Bh,{Group:Uh});let Hh=(0,(u=a("85Hg2")).createContext)(null);function Vh(){let e=(0,u.useContext)(Hh);if(null===e){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,Vh),e}return e}function Wh(){let[e,t]=(0,u.useState)([]);return[e.length>0?e.join(" "):void 0,(0,u.useMemo)((()=>function(e){let n=xf((e=>(t((t=>[...t,e])),()=>t((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),i=(0,u.useMemo)((()=>({register:n,slot:e.slot,name:e.name,props:e.props})),[n,e.slot,e.name,e.props]);return r(u).createElement(Hh.Provider,{value:i},e.children)}),[t])]}let Gh=lf((function(e,t){let n=Vh(),r=`headlessui-description-${nh()}`,i=_f(t);gf((()=>n.register(r)),[r,n.register]);let o=e;return of({ourProps:{ref:i,...n.props,id:r},theirProps:o,slot:n.slot||{},defaultTag:"p",name:n.name||"Description"})}));let qh=(0,(u=a("85Hg2")).createContext)((()=>{}));qh.displayName="StackContext";var Kh=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(Kh||{});function Yh({children:e,onUpdate:t,type:n,element:i,enabled:o}){let a=(0,u.useContext)(qh),s=xf(((...e)=>{null==t||t(...e),a(...e)}));return gf((()=>{let e=void 0===o||!0===o;return e&&s(0,n,i),()=>{e&&s(1,n,i)}}),[s,n,i,o]),r(u).createElement(qh.Provider,{value:s},e)}u=a("85Hg2"),u=a("85Hg2");function Jh(e,t,n){let r=yf(t);(0,u.useEffect)((()=>{function t(e){r.current(e)}return document.addEventListener(e,t,n),()=>document.removeEventListener(e,t,n)}),[e,n])}function Qh(e,t,n=!0){let r=(0,u.useRef)(!1);function i(n,i){if(!r.current||n.defaultPrevented)return;let o=function e(t){return"function"==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(e),a=i(n);if(null!==a&&a.getRootNode().contains(a)){for(let e of o){if(null===e)continue;let t=e instanceof HTMLElement?e:e.current;if(null!=t&&t.contains(a))return}return!hh(a,fh.Loose)&&-1!==a.tabIndex&&n.preventDefault(),t(n,a)}}(0,u.useEffect)((()=>{requestAnimationFrame((()=>{r.current=n}))}),[n]);let o=(0,u.useRef)(null);Jh("mousedown",(e=>{var t,n;r.current&&(o.current=(null==(n=null==(t=e.composedPath)?void 0:t.call(e))?void 0:n[0])||e.target)}),!0),Jh("click",(e=>{!o.current||(i(e,(()=>o.current)),o.current=null)}),!0),Jh("blur",(e=>i(e,(()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null))),!0)}var Xh=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Xh||{}),Zh=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Zh||{});let $h={0:(e,t)=>e.titleId===t.id?e:{...e,titleId:t.id}},ep=(0,u.createContext)(null);function tp(e){let t=(0,u.useContext)(ep);if(null===t){let t=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,tp),t}return t}function np(e,t){(0,u.useEffect)((()=>{var n;if(!t||!e)return;let r=Cf();function i(e,t,n){let i=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),r.add((()=>{Object.assign(e.style,{[t]:i})}))}let o=e.documentElement,a=(null!=(n=e.defaultView)?n:window).innerWidth-o.clientWidth;if(i(o,"overflow","hidden"),a>0){i(o,"paddingRight",`${a-(o.clientWidth-o.offsetWidth)}px`)}if(/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0){let e=window.pageYOffset;i(o,"position","fixed"),i(o,"marginTop",`-${e}px`),i(o,"width","100%"),r.add((()=>window.scrollTo(0,e)))}return r.dispose}),[e,t])}function rp(e,t){return $d(t.type,$h,e,t)}ep.displayName="DialogContext";let ip=nf.RenderStrategy|nf.Static,op=lf((function(e,t){let{open:n,onClose:i,initialFocus:o,__demoMode:a=!1,...s}=e,[l,c]=(0,u.useState)(0),d=hf();void 0===n&&null!==d&&(n=$d(d,{[ff.Open]:!0,[ff.Closed]:!1}));let f=(0,u.useRef)(new Set),h=(0,u.useRef)(null),p=_f(h,t),m=(0,u.useRef)(null),g=Mh(h),v=e.hasOwnProperty("open")||null!==d,y=e.hasOwnProperty("onClose");if(!v&&!y)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!v)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!y)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof n)throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${n}`);if("function"!=typeof i)throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${i}`);let b=n?0:1,[w,x]=(0,u.useReducer)(rp,{titleId:null,descriptionId:null,panelRef:(0,u.createRef)()}),S=xf((()=>i(!1))),M=xf((e=>x({type:0,id:e}))),_=!!wf()&&(!a&&0===b),A=l>1,E=null!==(0,u.useContext)(ep),C=A?"parent":"leaf";Rh(h,!!A&&_),Qh((()=>{var e,t;return[...Array.from(null!=(e=null==g?void 0:g.querySelectorAll("body > *, [data-headlessui-portal]"))?e:[]).filter((e=>!(!(e instanceof HTMLElement)||e.contains(m.current)||w.panelRef.current&&e.contains(w.panelRef.current)))),null!=(t=w.panelRef.current)?t:h.current]}),S,_&&!A),_h(null==g?void 0:g.defaultView,"keydown",(e=>{e.defaultPrevented||e.key===Xf.Escape&&0===b&&(A||(e.preventDefault(),e.stopPropagation(),S()))})),np(g,0===b&&!E),(0,u.useEffect)((()=>{if(0!==b||!h.current)return;let e=new IntersectionObserver((e=>{for(let t of e)0===t.boundingClientRect.x&&0===t.boundingClientRect.y&&0===t.boundingClientRect.width&&0===t.boundingClientRect.height&&S()}));return e.observe(h.current),()=>e.disconnect()}),[b,h,S]);let[k,T]=Wh(),I=`headlessui-dialog-${nh()}`,O=(0,u.useMemo)((()=>[{dialogState:b,close:S,setTitleId:M},w]),[b,w,S,M]),R=(0,u.useMemo)((()=>({open:0===b})),[b]),P={ref:p,id:I,role:"dialog","aria-modal":0===b||void 0,"aria-labelledby":w.titleId,"aria-describedby":k};return r(u).createElement(Yh,{type:"Dialog",enabled:0===b,element:h,onUpdate:xf(((e,t,n)=>{"Dialog"===t&&$d(e,{[Kh.Add](){f.current.add(n),c((e=>e+1))},[Kh.Remove](){f.current.add(n),c((e=>e-1))}})}))},r(u).createElement(Nh,{force:!0},r(u).createElement(zh,null,r(u).createElement(ep.Provider,{value:O},r(u).createElement(zh.Group,{target:h},r(u).createElement(Nh,{force:!1},r(u).createElement(T,{slot:R,name:"Dialog.Description"},r(u).createElement(Ch,{initialFocus:o,containers:f,features:_?$d(C,{parent:Ch.features.RestoreFocus,leaf:Ch.features.All&~Ch.features.FocusLock}):Ch.features.None},of({ourProps:P,theirProps:s,slot:R,defaultTag:"div",features:ip,visible:0===b,name:"Dialog"})))))))),r(u).createElement(ih,{features:rh.Hidden,ref:m}))})),ap=lf((function(e,t){let[{dialogState:n,close:r}]=tp("Dialog.Overlay");return of({ourProps:{ref:_f(t),id:`headlessui-dialog-overlay-${nh()}`,"aria-hidden":!0,onClick:xf((e=>{if(e.target===e.currentTarget){if(Zf(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),r()}}))},theirProps:e,slot:(0,u.useMemo)((()=>({open:0===n})),[n]),defaultTag:"div",name:"Dialog.Overlay"})})),sp=lf((function(e,t){let[{dialogState:n},i]=tp("Dialog.Backdrop"),o=_f(t),a=`headlessui-dialog-backdrop-${nh()}`;(0,u.useEffect)((()=>{if(null===i.panelRef.current)throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.")}),[i.panelRef]);let s=(0,u.useMemo)((()=>({open:0===n})),[n]);return r(u).createElement(Nh,{force:!0},r(u).createElement(zh,null,of({ourProps:{ref:o,id:a,"aria-hidden":!0},theirProps:e,slot:s,defaultTag:"div",name:"Dialog.Backdrop"})))})),lp=lf((function(e,t){let[{dialogState:n},r]=tp("Dialog.Panel"),i=_f(t,r.panelRef),o=`headlessui-dialog-panel-${nh()}`,a=(0,u.useMemo)((()=>({open:0===n})),[n]);return of({ourProps:{ref:i,id:o,onClick:xf((e=>{e.stopPropagation()}))},theirProps:e,slot:a,defaultTag:"div",name:"Dialog.Panel"})})),cp=lf((function(e,t){let[{dialogState:n,setTitleId:r}]=tp("Dialog.Title"),i=`headlessui-dialog-title-${nh()}`,o=_f(t);(0,u.useEffect)((()=>(r(i),()=>r(null))),[i,r]);let a=(0,u.useMemo)((()=>({open:0===n})),[n]);return of({ourProps:{ref:o,id:i},theirProps:e,slot:a,defaultTag:"h2",name:"Dialog.Title"})})),up=Object.assign(op,{Backdrop:sp,Panel:lp,Overlay:ap,Title:cp,Description:Gh});Jd=a("4IUwl");var dp=({spinning:e=!1,primary:t=!1,className:n,children:i})=>(0,s.jsxs)("div",{className:r(Jd)("memori-spin",n,{"memori-spin--spinning":e,"memori-spin--primary":t}),children:[i,(0,s.jsx)("div",{className:"memori-spin--spinner",children:(0,s.jsx)(Xd,{loading:!0})})]});var fp=({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:"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"})});Jd=a("4IUwl");var hp=({open:e=!1,onClose:t,className:n,title:i,description:o,children:a,footer:l,loading:c=!1,closable:d=!0,width:f="100%",widthMd:h="100%"})=>{const{t:p}=Te();return(0,s.jsx)(Jf,{appear:!0,show:e,as:r(u).Fragment,children:(0,s.jsxs)(up,{open:e,onClose:t,className:r(Jd)("memori-modal",n),children:[(0,s.jsx)(Jf.Child,{as:r(u).Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)("div",{className:"memori-modal--backdrop"})}),(0,s.jsx)("div",{className:"memori-modal--container",children:(0,s.jsx)("div",{className:"memori-modal--container-scrollable",children:(0,s.jsx)(Jf.Child,{as:r(u).Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsxs)(up.Panel,{className:"memori-modal--panel",children:[(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-modal--panel {\n --memori-modal--width: ${f};\n --memori-modal--width-md: ${h};\n }\n `}}),d&&(0,s.jsx)("div",{className:"memori-modal--close",children:(0,s.jsx)(Zd,{ghost:!0,padded:!0,shape:"circle",icon:(0,s.jsx)(fp,{}),title:p("close")||"Close",onClick:()=>t(!1)})}),(0,s.jsxs)(dp,{spinning:c,children:[i&&(0,s.jsx)(up.Title,{className:"memori-modal--title",children:i}),o&&(0,s.jsx)(up.Description,{className:"memori-modal--description",children:o}),a,l&&(0,s.jsx)("div",{className:"memori-modal--footer",children:l})]})]})})})})]})})},pp=(u=a("85Hg2"),e=>"checkbox"===e.type),mp=e=>e instanceof Date,gp=e=>null==e;const vp=e=>"object"==typeof e;var yp=e=>!gp(e)&&!Array.isArray(e)&&vp(e)&&!mp(e),bp=e=>yp(e)&&e.target?pp(e.target)?e.target.checked:e.target.value:e,wp=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),xp=e=>Array.isArray(e)?e.filter(Boolean):[],Sp=e=>void 0===e,Mp=(e,t,n)=>{if(!t||!yp(e))return n;const r=xp(t.split(/[,[\].]+?/)).reduce(((e,t)=>gp(e)?e:e[t]),e);return Sp(r)||r===e?Sp(e[t])?n:e[t]:r};const _p="blur",Ap="focusout",Ep="onBlur",Cp="onChange",kp="onSubmit",Tp="onTouched",Ip="all",Op="max",Rp="min",Pp="maxLength",Np="minLength",Lp="pattern",Dp="required",Bp="validate";r(u).createContext(null);var jp=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Ip&&(t._proxyFormState[i]=!r||Ip),n&&(n[i]=!0),e[i]}});return i},Fp=e=>yp(e)&&!Object.keys(e).length,Up=(e,t,n)=>{const{name:r,...i}=e;return Fp(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!n||Ip)))},zp=e=>Array.isArray(e)?e:[e];function Hp(e){const t=r(u).useRef(e);t.current=e,r(u).useEffect((()=>{const n=!e.disabled&&t.current.subject.subscribe({next:t.current.callback});return()=>{n&&n.unsubscribe()}}),[e.disabled])}var Vp=e=>"string"==typeof e,Wp=(e,t,n,r)=>Vp(e)?(r&&t.watch.add(e),Mp(n,e)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),Mp(n,e)))):(t.watchAll=!!r,n),Gp="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function qp(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(Gp&&(e instanceof Blob||e instanceof FileList)||!n&&!yp(e))return e;if(t=n?[]:{},Array.isArray(e)||(e=>{const t=e.constructor&&e.constructor.prototype;return yp(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)t[n]=qp(e[n]);else t=e}return t}var Kp=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Yp=e=>/^\w*$/.test(e),Jp=e=>xp(e.replace(/["|']|\]/g,"").split(/\.|\[/));function Qp(e,t,n){let r=-1;const i=Yp(t)?[t]:Jp(t),o=i.length,a=o-1;for(;++r<o;){const t=i[r];let o=n;if(r!==a){const n=e[t];o=yp(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}e[t]=o,e=e[t]}return e}const Xp=(e,t,n)=>{for(const r of n||Object.keys(e)){const n=Mp(e,r);if(n){const{_f:e,...r}=n;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else yp(r)&&Xp(r,t)}}};var Zp=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))))),$p=(e,t,n)=>{const r=xp(Mp(e,n));return Qp(r,"root",t[n]),Qp(e,n,r),e},em=e=>"boolean"==typeof e,tm=e=>"file"===e.type,nm=e=>"function"==typeof e,rm=e=>Vp(e)||r(u).isValidElement(e),im=e=>"radio"===e.type,om=e=>e instanceof RegExp;const am={value:!1,isValid:!1},sm={value:!0,isValid:!0};var lm=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Sp(e[0].attributes.value)?Sp(e[0].value)||""===e[0].value?sm:{value:e[0].value,isValid:!0}:sm:am}return am};const cm={isValid:!1,value:null};var um=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),cm):cm;function dm(e,t,n="validate"){if(rm(e)||Array.isArray(e)&&e.every(rm)||em(e)&&!e)return{type:n,message:rm(e)?e:"",ref:t}}var fm=e=>yp(e)&&!om(e)?e:{value:e,message:""},hm=async(e,t,n,r,i)=>{const{ref:o,refs:a,required:s,maxLength:l,minLength:c,min:u,max:d,pattern:f,validate:h,name:p,valueAsNumber:m,mount:g,disabled:v}=e._f;if(!g||v)return{};const y=a?a[0]:o,b=e=>{r&&y.reportValidity&&(y.setCustomValidity(em(e)?"":e||""),y.reportValidity())},w={},x=im(o),S=pp(o),M=x||S,_=(m||tm(o))&&!o.value||""===t||Array.isArray(t)&&!t.length,A=Kp.bind(null,p,n,w),E=(e,t,n,r=Pp,i=Np)=>{const a=e?t:n;w[p]={type:e?r:i,message:a,ref:o,...A(e?r:i,a)}};if(i?!Array.isArray(t)||!t.length:s&&(!M&&(_||gp(t))||em(t)&&!t||S&&!lm(a).isValid||x&&!um(a).isValid)){const{value:e,message:t}=rm(s)?{value:!!s,message:s}:fm(s);if(e&&(w[p]={type:Dp,message:t,ref:y,...A(Dp,t)},!n))return b(t),w}if(!(_||gp(u)&&gp(d))){let e,r;const i=fm(d),a=fm(u);if(gp(t)||isNaN(t)){const n=o.valueAsDate||new Date(t),s=e=>new Date((new Date).toDateString()+" "+e),l="time"==o.type,c="week"==o.type;Vp(i.value)&&t&&(e=l?s(t)>s(i.value):c?t>i.value:n>new Date(i.value)),Vp(a.value)&&t&&(r=l?s(t)<s(a.value):c?t<a.value:n<new Date(a.value))}else{const n=o.valueAsNumber||(t?+t:t);gp(i.value)||(e=n>i.value),gp(a.value)||(r=n<a.value)}if((e||r)&&(E(!!e,i.message,a.message,Op,Rp),!n))return b(w[p].message),w}if((l||c)&&!_&&(Vp(t)||i&&Array.isArray(t))){const e=fm(l),r=fm(c),i=!gp(e.value)&&t.length>e.value,o=!gp(r.value)&&t.length<r.value;if((i||o)&&(E(i,e.message,r.message),!n))return b(w[p].message),w}if(f&&!_&&Vp(t)){const{value:e,message:r}=fm(f);if(om(e)&&!t.match(e)&&(w[p]={type:Lp,message:r,ref:o,...A(Lp,r)},!n))return b(r),w}if(h)if(nm(h)){const e=dm(await h(t),y);if(e&&(w[p]={...e,...A(Bp,e.message)},!n))return b(e.message),w}else if(yp(h)){let e={};for(const r in h){if(!Fp(e)&&!n)break;const i=dm(await h[r](t),y,r);i&&(e={...i,...A(r,i.message)},b(i.message),n&&(w[p]=e))}if(!Fp(e)&&(w[p]={ref:y,...e},!n))return w}return b(!0),w};var pm=e=>({isOnSubmit:!e||e===kp,isOnBlur:e===Ep,isOnChange:e===Cp,isOnAll:e===Ip,isOnTouch:e===Tp});function mm(e){for(const t in e)if(!Sp(e[t]))return!1;return!0}function gm(e,t){const n=Yp(t)?[t]:Jp(t),r=1==n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Sp(e)?r++:e[t[r++]];return e}(e,n),i=n[n.length-1];let o;r&&delete r[i];for(let t=0;t<n.slice(0,-1).length;t++){let r,i=-1;const a=n.slice(0,-(t+1)),s=a.length-1;for(t>0&&(o=e);++i<a.length;){const t=a[i];r=r?r[t]:e[t],s===i&&(yp(r)&&Fp(r)||Array.isArray(r)&&mm(r))&&(o?delete o[t]:delete e[t]),o=r}}return e}function vm(){let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}}var ym=e=>gp(e)||!vp(e);function bm(e,t){if(ym(e)||ym(t))return e===t;if(mp(e)&&mp(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const n=e[i];if(!r.includes(i))return!1;if("ref"!==i){const e=t[i];if(mp(n)&&mp(e)||yp(n)&&yp(e)||Array.isArray(n)&&Array.isArray(e)?!bm(n,e):n!==e)return!1}}return!0}var wm=e=>{const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},xm=e=>"select-multiple"===e.type,Sm=e=>wm(e)&&e.isConnected,Mm=e=>{for(const t in e)if(nm(e[t]))return!0;return!1};function _m(e,t={}){const n=Array.isArray(e);if(yp(e)||n)for(const n in e)Array.isArray(e[n])||yp(e[n])&&!Mm(e[n])?(t[n]=Array.isArray(e[n])?[]:{},_m(e[n],t[n])):gp(e[n])||(t[n]=!0);return t}function Am(e,t,n){const r=Array.isArray(e);if(yp(e)||r)for(const r in e)Array.isArray(e[r])||yp(e[r])&&!Mm(e[r])?Sp(t)||ym(n[r])?n[r]=Array.isArray(e[r])?_m(e[r],[]):{..._m(e[r])}:Am(e[r],gp(t)?{}:t[r],n[r]):bm(e[r],t[r])?delete n[r]:n[r]=!0;return n}var Em=(e,t)=>Am(e,t,_m(t)),Cm=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Sp(e)?e:t?""===e?NaN:e?+e:e:n&&Vp(e)?new Date(e):r?r(e):e;function km(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return tm(t)?t.files:im(t)?um(e.refs).value:xm(t)?[...t.selectedOptions].map((({value:e})=>e)):pp(t)?lm(e.refs).value:Cm(Sp(t.value)?e.ref.value:t.value,e)}var Tm=e=>Sp(e)?e:om(e)?e.source:yp(e)?om(e.value)?e.value.source:e.value:e;function Im(e,t,n){const r=Mp(e,n);if(r||Yp(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const r=i.join("."),o=Mp(t,r),a=Mp(e,r);if(o&&!Array.isArray(o)&&n!==r)return{name:n};if(a&&a.type)return{name:r,error:a};i.pop()}return{name:n}}const Om={mode:kp,reValidateMode:Cp,shouldFocusError:!0};function Rm(e={}){let t,n={...Om,...e},r={submitCount:0,isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},i={},o=qp(n.defaultValues)||{},a=n.shouldUnregister?{}:qp(o),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c=0,u={};const d={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={watch:vm(),array:vm(),state:vm()},h=pm(n.mode),p=pm(n.reValidateMode),m=n.criteriaMode===Ip,g=async()=>{let e=!1;return d.isValid&&(e=n.resolver?Fp((await w()).errors):await x(i,!0),e!==r.isValid&&(r.isValid=e,f.state.next({isValid:e}))),e},v=(e,t,n,r)=>{const l=Mp(i,e);if(l){const i=Mp(a,e,Sp(n)?Mp(o,e):n);Sp(i)||r&&r.defaultChecked||t?Qp(a,e,t?i:km(l._f)):_(e,i),s.mount&&g()}},y=(e,t,n,i,a)=>{let s=!1,l=!1;const c={name:e};if(d.isDirty&&(l=r.isDirty,r.isDirty=c.isDirty=S(),s=l!==c.isDirty),d.dirtyFields&&(!n||i)){l=Mp(r.dirtyFields,e);const n=bm(Mp(o,e),t);n?gm(r.dirtyFields,e):Qp(r.dirtyFields,e,!0),c.dirtyFields=r.dirtyFields,s=s||l!==!n}if(n){const t=Mp(r.touchedFields,e);t||(Qp(r.touchedFields,e,n),c.touchedFields=r.touchedFields,s=s||d.touchedFields&&t!==n)}return s&&a&&f.state.next(c),s?c:{}},b=(n,i,o,a)=>{const s=Mp(r.errors,n),l=d.isValid&&em(i)&&r.isValid!==i;var h;if(e.delayError&&o?(h=()=>((e,t)=>{Qp(r.errors,e,t),f.state.next({errors:r.errors})})(n,o),t=e=>{clearTimeout(c),c=window.setTimeout(h,e)},t(e.delayError)):(clearTimeout(c),t=null,o?Qp(r.errors,n,o):gm(r.errors,n)),(o?!bm(s,o):s)||!Fp(a)||l){const e={...a,...l&&em(i)?{isValid:i}:{},errors:r.errors,name:n};r={...r,...e},f.state.next(e)}u[n]--,d.isValidating&&!Object.values(u).some((e=>e))&&(f.state.next({isValidating:!1}),u={})},w=async e=>n.resolver?await n.resolver({...a},n.context,((e,t,n,r)=>{const i={};for(const n of e){const e=Mp(t,n);e&&Qp(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}})(e||l.mount,i,n.criteriaMode,n.shouldUseNativeValidation)):{},x=async(e,t,i={valid:!0})=>{for(const o in e){const s=e[o];if(s){const{_f:e,...o}=s;if(e){const o=l.array.has(e.name),c=await hm(s,Mp(a,e.name),m,n.shouldUseNativeValidation,o);if(c[e.name]&&(i.valid=!1,t))break;!t&&(Mp(c,e.name)?o?$p(r.errors,c,e.name):Qp(r.errors,e.name,c[e.name]):gm(r.errors,e.name))}o&&await x(o,t,i)}}return i.valid},S=(e,t)=>(e&&t&&Qp(a,e,t),!bm(T(),o)),M=(e,t,n)=>Wp(e,l,{...s.mount?a:Sp(t)?o:Vp(e)?{[e]:t}:t},n),_=(e,t,n={})=>{const r=Mp(i,e);let o=t;if(r){const n=r._f;n&&(!n.disabled&&Qp(a,e,Cm(t,n)),o=Gp&&wm(n.ref)&&gp(t)?"":t,xm(n.ref)?[...n.ref.options].forEach((e=>e.selected=o.includes(e.value))):n.refs?pp(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(o)?!!o.find((t=>t===e.value)):o===e.value))):n.refs[0]&&(n.refs[0].checked=!!o):n.refs.forEach((e=>e.checked=e.value===o)):tm(n.ref)?n.ref.value="":(n.ref.value=o,n.ref.type||f.watch.next({name:e})))}(n.shouldDirty||n.shouldTouch)&&y(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&k(e)},A=(e,t,n)=>{for(const r in t){const o=t[r],a=`${e}.${r}`,s=Mp(i,a);!l.array.has(e)&&ym(o)&&(!s||s._f)||mp(o)?_(a,o,n):A(a,o,n)}},E=(e,t,n={})=>{const s=Mp(i,e),c=l.array.has(e),u=qp(t);Qp(a,e,u),c?(f.array.next({name:e,values:a}),(d.isDirty||d.dirtyFields)&&n.shouldDirty&&(r.dirtyFields=Em(o,a),f.state.next({name:e,dirtyFields:r.dirtyFields,isDirty:S(e,u)}))):!s||s._f||gp(u)?_(e,u,n):A(e,u,n),Zp(e,l)&&f.state.next({}),f.watch.next({name:e})},C=async e=>{const o=e.target;let s=o.name;const c=Mp(i,s);if(c){let x,S;const M=o.type?km(c._f):bp(e),_=e.type===_p||e.type===Ap,A=!((v=c._f).mount&&(v.required||v.min||v.max||v.maxLength||v.minLength||v.pattern||v.validate)||n.resolver||Mp(r.errors,s)||c._f.deps)||((e,t,n,r,i)=>!i.isOnAll&&(!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e))(_,Mp(r.touchedFields,s),r.isSubmitted,p,h),E=Zp(s,l,_);Qp(a,s,M),_?(c._f.onBlur&&c._f.onBlur(e),t&&t(0)):c._f.onChange&&c._f.onChange(e);const C=y(s,M,_,!1),T=!Fp(C)||E;if(!_&&f.watch.next({name:s,type:e.type}),A)return d.isValid&&g(),T&&f.state.next({name:s,...E?{}:C});if(!_&&E&&f.state.next({}),u[s]=u[s]?u[s]+1:1,f.state.next({isValidating:!0}),n.resolver){const{errors:e}=await w([s]),t=Im(r.errors,i,s),n=Im(e,i,t.name||s);x=n.error,s=n.name,S=Fp(e)}else x=(await hm(c,Mp(a,s),m,n.shouldUseNativeValidation))[s],g();c._f.deps&&k(c._f.deps),b(s,S,x,C)}var v},k=async(e,t={})=>{let o,a;const s=zp(e);if(f.state.next({isValidating:!0}),n.resolver){const t=await(async e=>{const{errors:t}=await w();if(e)for(const n of e){const e=Mp(t,n);e?Qp(r.errors,n,e):gm(r.errors,n)}else r.errors=t;return t})(Sp(e)?e:s);o=Fp(t),a=e?!s.some((e=>Mp(t,e))):o}else e?(a=(await Promise.all(s.map((async e=>{const t=Mp(i,e);return await x(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||r.isValid)&&g()):a=o=await x(i);return f.state.next({...!Vp(e)||d.isValid&&o!==r.isValid?{}:{name:e},...n.resolver||!e?{isValid:o}:{},errors:r.errors,isValidating:!1}),t.shouldFocus&&!a&&Xp(i,(e=>e&&Mp(r.errors,e)),e?s:l.mount),a},T=e=>{const t={...o,...s.mount?a:{}};return Sp(e)?t:Vp(e)?Mp(t,e):e.map((e=>Mp(t,e)))},I=(e,t)=>({invalid:!!Mp((t||r).errors,e),isDirty:!!Mp((t||r).dirtyFields,e),isTouched:!!Mp((t||r).touchedFields,e),error:Mp((t||r).errors,e)}),O=(e,t={})=>{for(const s of e?zp(e):l.mount)l.mount.delete(s),l.array.delete(s),Mp(i,s)&&(t.keepValue||(gm(i,s),gm(a,s)),!t.keepError&&gm(r.errors,s),!t.keepDirty&&gm(r.dirtyFields,s),!t.keepTouched&&gm(r.touchedFields,s),!n.shouldUnregister&&!t.keepDefaultValue&&gm(o,s));f.watch.next({}),f.state.next({...r,...t.keepDirty?{isDirty:S()}:{}}),!t.keepIsValid&&g()},R=(e,t={})=>{let r=Mp(i,e);const c=em(t.disabled);return Qp(i,e,{...r||{},_f:{...r&&r._f?r._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),r?c&&Qp(a,e,t.disabled?void 0:Mp(a,e,km(r._f))):v(e,!0,t.value),{...c?{disabled:t.disabled}:{},...n.shouldUseNativeValidation?{required:!!t.required,min:Tm(t.min),max:Tm(t.max),minLength:Tm(t.minLength),maxLength:Tm(t.maxLength),pattern:Tm(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:a=>{if(a){R(e,t),r=Mp(i,e);const n=Sp(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>im(e)||pp(e))(n),l=r._f.refs||[];if(s?l.find((e=>e===n)):n===r._f.ref)return;Qp(i,e,{_f:{...r._f,...s?{refs:[...l.filter(Sm),n,...Array.isArray(Mp(o,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),v(e,!1,void 0,n)}else r=Mp(i,e,{}),r._f&&(r._f.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!wp(l.array,e)||!s.action)&&l.unMount.add(e)}}},P=()=>n.shouldFocusError&&Xp(i,(e=>e&&Mp(r.errors,e)),l.mount);return{control:{register:R,unregister:O,getFieldState:I,_executeSchema:w,_focusError:P,_getWatch:M,_getDirty:S,_updateValid:g,_removeUnmounted:()=>{for(const e of l.unMount){const t=Mp(i,e);t&&(t._f.refs?t._f.refs.every((e=>!Sm(e))):!Sm(t._f.ref))&&O(e)}l.unMount=new Set},_updateFieldArray:(e,t=[],n,l,c=!0,u=!0)=>{if(l&&n){if(s.action=!0,u&&Array.isArray(Mp(i,e))){const t=n(Mp(i,e),l.argA,l.argB);c&&Qp(i,e,t)}if(u&&Array.isArray(Mp(r.errors,e))){const t=n(Mp(r.errors,e),l.argA,l.argB);c&&Qp(r.errors,e,t),((e,t)=>{!xp(Mp(e,t)).length&&gm(e,t)})(r.errors,e)}if(d.touchedFields&&u&&Array.isArray(Mp(r.touchedFields,e))){const t=n(Mp(r.touchedFields,e),l.argA,l.argB);c&&Qp(r.touchedFields,e,t)}d.dirtyFields&&(r.dirtyFields=Em(o,a)),f.state.next({isDirty:S(e,t),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Qp(a,e,t)},_getFieldArray:t=>xp(Mp(s.mount?a:o,t,e.shouldUnregister?Mp(o,t,[]):[])),_subjects:f,_proxyFormState:d,get _fields(){return i},get _formValues(){return a},get _stateFlags(){return s},set _stateFlags(e){s=e},get _defaultValues(){return o},get _names(){return l},set _names(e){l=e},get _formState(){return r},set _formState(e){r=e},get _options(){return n},set _options(e){n={...n,...e}}},trigger:k,register:R,handleSubmit:(e,t)=>async o=>{o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let s=!0,l=qp(a);f.state.next({isSubmitting:!0});try{if(n.resolver){const{errors:e,values:t}=await w();r.errors=e,l=t}else await x(i);Fp(r.errors)?(f.state.next({errors:{},isSubmitting:!0}),await e(l,o)):(t&&await t({...r.errors},o),P())}catch(e){throw s=!1,e}finally{r.isSubmitted=!0,f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Fp(r.errors)&&s,submitCount:r.submitCount+1,errors:r.errors})}},watch:(e,t)=>nm(e)?f.watch.subscribe({next:n=>e(M(void 0,t),n)}):M(e,t,!0),setValue:E,getValues:T,reset:(t,n)=>((t,n={})=>{const c=t||o,u=qp(c),h=t&&!Fp(t)?u:o;if(n.keepDefaultValues||(o=c),!n.keepValues){if(n.keepDirtyValues)for(const e of l.mount)Mp(r.dirtyFields,e)?Qp(h,e,Mp(a,e)):E(e,Mp(h,e));else{if(Gp&&Sp(t))for(const e of l.mount){const t=Mp(i,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(wm(e)){const t=e.closest("form");if(t){t.reset();break}}}}i={}}a=e.shouldUnregister?n.keepDefaultValues?qp(o):{}:u,f.array.next({values:h}),f.watch.next({values:h})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!n.keepIsValid,s.watch=!!e.shouldUnregister,f.state.next({submitCount:n.keepSubmitCount?r.submitCount:0,isDirty:n.keepDirty||n.keepDirtyValues?r.isDirty:!(!n.keepDefaultValues||bm(t,o)),isSubmitted:!!n.keepIsSubmitted&&r.isSubmitted,dirtyFields:n.keepDirty||n.keepDirtyValues?r.dirtyFields:n.keepDefaultValues&&t?Em(o,t):{},touchedFields:n.keepTouched?r.touchedFields:{},errors:n.keepErrors?r.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})})(nm(t)?t(a):t,n),resetField:(e,t={})=>{Mp(i,e)&&(Sp(t.defaultValue)?E(e,Mp(o,e)):(E(e,t.defaultValue),Qp(o,e,t.defaultValue)),t.keepTouched||gm(r.touchedFields,e),t.keepDirty||(gm(r.dirtyFields,e),r.isDirty=t.defaultValue?S(e,Mp(o,e)):S()),t.keepError||(gm(r.errors,e),d.isValid&&g()),f.state.next({...r}))},clearErrors:e=>{e?zp(e).forEach((e=>gm(r.errors,e))):r.errors={},f.state.next({errors:r.errors})},unregister:O,setError:(e,t,n)=>{const o=(Mp(i,e,{_f:{}})._f||{}).ref;Qp(r.errors,e,{...t,ref:o}),f.state.next({name:e,errors:r.errors,isValid:!1}),n&&n.shouldFocus&&o&&o.focus&&o.focus()},setFocus:(e,t={})=>{const n=Mp(i,e),r=n&&n._f;if(r){const e=r.refs?r.refs[0]:r.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:I}}function Pm(e={}){const t=r(u).useRef(),[n,i]=r(u).useState({isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:e.defaultValues});t.current||(t.current={...Rm(e),formState:n});const o=t.current.control;return o._options=e,Hp({subject:o._subjects.state,callback:r(u).useCallback((e=>{Up(e,o._proxyFormState,!0)&&(o._formState={...o._formState,...e},i({...o._formState}))}),[o])}),r(u).useEffect((()=>{o._stateFlags.mount||(o._proxyFormState.isValid&&o._updateValid(),o._stateFlags.mount=!0),o._stateFlags.watch&&(o._stateFlags.watch=!1,o._subjects.state.next({})),o._removeUnmounted()})),r(u).useEffect((()=>{n.submitCount&&o._focusError()}),[o,n.submitCount]),t.current.formState=jp(n,o),t.current}var Nm=({className:e,title:t})=>(0,s.jsxs)("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:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}),(0,s.jsx)("path",{d:"M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"})]});var Lm=({pwdOrTokens:e,setPwdOrTokens:t,onFinish:n,minimumNumberOfRecoveryTokens:r=1,showTokens:i=!0,openModal:o=!1,withModal:a=!1})=>{var l;const{t:c}=Te(),{register:d,handleSubmit:f,formState:{errors:h},setError:p}=Pm(),[m,g]=(0,u.useState)(1),[v,y]=(0,u.useState)(!!e),b=(0,s.jsxs)("form",{name:"memoriAuth",onSubmit:f((t=>{var i,o,a;"password"===e&&!(null===(i=t.password)||void 0===i?void 0:i.length)||"tokens"===e&&(((null===(o=null==t?void 0:t.tokens)||void 0===o?void 0:o.length)||0)<r||!(null===(a=null==t?void 0:t.tokens)||void 0===a?void 0:a.every((e=>e.length))))?p("tokens",{type:"minLength",message:"Tokens"}):n&&n(t).then((()=>{y(!1)}))})),className:"memori-auth-widget--form",children:[("password"===e||!i)&&(0,s.jsxs)("fieldset",{className:"memori-auth-widget--password-fieldset",children:[(0,s.jsxs)("label",{children:["Password:"," ",(0,s.jsx)("input",{className:"memori-auth-widget--input",required:!0,type:"password",placeholder:"Password",...d("password",{required:!0})})]}),i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("hr",{}),(0,s.jsx)(Zd,{outlined:!0,onClick:()=>t("tokens"),children:c("auth.useRecoveryTokens")||"Recovery tokens"})]})]}),"tokens"===e&&i&&(0,s.jsxs)("fieldset",{className:"memori-auth-widget--tokens-fieldset",name:"tokens",children:[(0,s.jsxs)("legend",{children:[c("auth.tokens"),": "]}),(w=m,Array.from({length:w},((e,t)=>t))).map((e=>(0,s.jsx)("label",{className:"memori-auth-widget--token",children:(0,s.jsx)("input",{type:"password",className:"memori-auth-widget--input",placeholder:"Recovery token",required:!0,autoComplete:"off",...d(`tokens.${e}`,{required:!0})})},e))),(0,s.jsx)(Zd,{onClick:()=>g((e=>e+1)),className:"memori-auth-widget--token-add",icon:(0,s.jsx)(Nm,{}),children:c("auth.addToken")||"Add token"}),(0,s.jsx)("hr",{}),(0,s.jsx)(Zd,{outlined:!0,onClick:()=>t("password"),children:c("auth.usePassword")||"Password"})]}),"minLength"===(null===(l=h.tokens)||void 0===l?void 0:l.type)&&(0,s.jsxs)("div",{className:"memori-auth-widget--error",children:[c("auth.atLeast")||"At least"," ",r]}),(0,s.jsx)(Zd,{htmlType:"submit",primary:!0,className:"memori-auth-widget--submit",children:c("confirm")||"Submit"})]});var w;return a?(0,s.jsx)(hp,{open:o||v,title:"Authentication",onClose:()=>t(null),closable:!1,children:b}):b};u=a("85Hg2"),Jd=a("4IUwl"),u=a("85Hg2");const Dm=()=>{let e=!1;if("maxTouchPoints"in navigator)e=navigator.maxTouchPoints>0;else if("msMaxTouchPoints"in navigator)e=navigator.msMaxTouchPoints>0;else{const n=window&&"matchMedia"in window&&matchMedia("(pointer:coarse)");if(n&&"(pointer:coarse)"===n.media)e=!!n.matches;else if("orientation"in window)e=!0;else{var t=null===navigator||void 0===navigator?void 0:navigator.userAgent;e=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(t)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(t)}}return e};const Bm=e=>e.slice(0,e.length/2).trim().toLowerCase()===e.slice(e.length/2+1).trim().toLowerCase()?e.slice(0,e.length/2):e,jm=({type:e,resourceURI:t,sessionID:n,baseURL:r="",apiURL:i=""})=>{let o="cover"===e?`${r}/images/memoriCover.png`:`${r}/images/memoriAvatar.png`;try{return t&&0!==t.length?t.includes("memoriai/memory")&&!t.includes("memori-ai-session-id")&&n?`${t}?memori-ai-session-id=${n}`:(t.startsWith("https://")||t.startsWith("http://"))&&new URL(t).hostname.includes("memori.ai")?`${t}${n?`/${n}`:""}`:t.startsWith("cloud://")?`${(null==i?void 0:i.replace(/v2/,"v1"))||""}/CloudAsset/${t.replace("cloud://","")}`:t.startsWith("guid://")?`${(null==i?void 0:i.replace(/v2/,"v1"))||""}/GuidAsset/${t.replace("guid://","")}`:t||o:o}catch(e){return t||o}};Jd=a("4IUwl");var Fm=({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:"M858.5 763.6a374 374 0 0 0-80.6-119.5 375.63 375.63 0 0 0-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 0 0-80.6 119.5A371.7 371.7 0 0 0 136 901.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 0 0 8-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"})});var Um=({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",className:e,"aria-label":t,children:(0,s.jsxs)("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[(0,s.jsx)("path",{fillRule:"evenodd",d:"M0 4a4 4 0 014-4h16a4 4 0 014 4v16a4 4 0 01-4 4H4a4 4 0 01-4-4zm4-2.4A2.4 2.4 0 001.6 4v16A2.4 2.4 0 004 22.4h16a2.4 2.4 0 002.4-2.4V4A2.4 2.4 0 0020 1.6z",clipRule:"evenodd"}),(0,s.jsx)("path",{fillRule:"evenodd",d:"M9.715 8.442a.798.798 0 00-1.43 0l-3.2 6.4a.799.799 0 101.431.716l.579-1.158h3.811l.578 1.158a.8.8 0 001.431-.716zm.391 4.358L9 10.589 7.894 12.8z",clipRule:"evenodd"}),(0,s.jsx)("path",{fillRule:"evenodd",d:"M17 8c.552 0 1 .358 1 .8v6.4c0 .442-.448.8-1 .8s-1-.358-1-.8V8.8c0-.442.448-.8 1-.8z",clipRule:"evenodd"})]})});Jd=a("4IUwl");var zm=({content:e,className:t,align:n="right",disabled:i=!1,visible:o=!1,children:a})=>(0,s.jsxs)("div",{className:r(Jd)("memori-tooltip",`memori-tooltip--align-${n}`,t,{"memori-tooltip--disabled":i,"memori-tooltip--visible":o}),children:[(0,s.jsx)("div",{className:"memori-tooltip--content",children:e}),(0,s.jsx)("div",{className:"memori-tooltip--trigger",children:a})]});u=a("85Hg2"),u=a("85Hg2");var Hm=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Hm||{});function Vm(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),i=null!=r?r:-1,o=(()=>{switch(e.focus){case 0:return n.findIndex((e=>!t.resolveDisabled(e)));case 1:{let e=n.slice().reverse().findIndex(((e,n,r)=>!(-1!==i&&r.length-n-1>=i)&&!t.resolveDisabled(e)));return-1===e?e:n.length-1-e}case 2:return n.findIndex(((e,n)=>!(n<=i)&&!t.resolveDisabled(e)));case 3:{let e=n.slice().reverse().findIndex((e=>!t.resolveDisabled(e)));return-1===e?e:n.length-1-e}case 4:return n.findIndex((n=>t.resolveId(n)===e.id));case 5:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}})();return-1===o?r:o}u=a("85Hg2");function Wm({container:e,accept:t,walk:n,enabled:r=!0}){let i=(0,u.useRef)(t),o=(0,u.useRef)(n);(0,u.useEffect)((()=>{i.current=t,o.current=n}),[t,n]),gf((()=>{if(!e||!r)return;let t=oh(e);if(!t)return;let n=i.current,a=o.current,s=Object.assign((e=>n(e)),{acceptNode:n}),l=t.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,s,!1);for(;l.nextNode();)a(l.currentNode)}),[e,r,i,o])}u=a("85Hg2");function Gm(e){var t;if(e.type)return e.type;let n=null!=(t=e.as)?t:"button";return"string"==typeof n&&"button"===n.toLowerCase()?"button":void 0}function qm(e,t){let[n,r]=(0,u.useState)((()=>Gm(e)));return gf((()=>{r(Gm(e))}),[e.type,e.as]),gf((()=>{n||!t.current||t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")}),[n,t]),n}var Km=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Km||{}),Ym=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ym||{}),Jm=(e=>(e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem",e))(Jm||{});function Qm(e,t=(e=>e)){let n=null!==e.activeItemIndex?e.items[e.activeItemIndex]:null,r=vh(t(e.items.slice()),(e=>e.dataRef.current.domRef.current)),i=n?r.indexOf(n):null;return-1===i&&(i=null),{items:r,activeItemIndex:i}}let Xm={1:e=>1===e.menuState?e:{...e,activeItemIndex:null,menuState:1},0:e=>0===e.menuState?e:{...e,menuState:0},2:(e,t)=>{var n;let r=Qm(e),i=Vm(t,{resolveItems:()=>r.items,resolveActiveIndex:()=>r.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeItemIndex:i,activationTrigger:null!=(n=t.trigger)?n:1}},3:(e,t)=>{let n=""!==e.searchQuery?0:1,r=e.searchQuery+t.value.toLowerCase(),i=(null!==e.activeItemIndex?e.items.slice(e.activeItemIndex+n).concat(e.items.slice(0,e.activeItemIndex+n)):e.items).find((e=>{var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(r))&&!e.dataRef.current.disabled})),o=i?e.items.indexOf(i):-1;return-1===o||o===e.activeItemIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeItemIndex:o,activationTrigger:1}},4:e=>""===e.searchQuery?e:{...e,searchQuery:"",searchActiveItemIndex:null},5:(e,t)=>{let n=Qm(e,(e=>[...e,{id:t.id,dataRef:t.dataRef}]));return{...e,...n}},6:(e,t)=>{let n=Qm(e,(e=>{let n=e.findIndex((e=>e.id===t.id));return-1!==n&&e.splice(n,1),e}));return{...e,...n,activationTrigger:1}}},Zm=(0,u.createContext)(null);function $m(e){let t=(0,u.useContext)(Zm);if(null===t){let t=new Error(`<${e} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,$m),t}return t}function eg(e,t){return $d(t.type,Xm,e,t)}Zm.displayName="MenuContext";let tg=u.Fragment,ng=lf((function(e,t){let n=(0,u.useReducer)(eg,{menuState:1,buttonRef:(0,u.createRef)(),itemsRef:(0,u.createRef)(),items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1}),[{menuState:i,itemsRef:o,buttonRef:a},s]=n,l=_f(t);Qh([a,o],((e,t)=>{var n;s({type:1}),hh(t,fh.Loose)||(e.preventDefault(),null==(n=a.current)||n.focus())}),0===i);let c=xf((()=>{s({type:1})})),d=(0,u.useMemo)((()=>({open:0===i,close:c})),[i,c]),f=e,h={ref:l};return r(u).createElement(Zm.Provider,{value:n},r(u).createElement(pf,{value:$d(i,{0:ff.Open,1:ff.Closed})},of({ourProps:h,theirProps:f,slot:d,defaultTag:tg,name:"Menu"})))})),rg=lf((function(e,t){var n;let[r,i]=$m("Menu.Button"),o=_f(r.buttonRef,t),a=`headlessui-menu-button-${nh()}`,s=Pf(),l=xf((e=>{switch(e.key){case Xf.Space:case Xf.Enter:case Xf.ArrowDown:e.preventDefault(),e.stopPropagation(),i({type:0}),s.nextFrame((()=>i({type:2,focus:Hm.First})));break;case Xf.ArrowUp:e.preventDefault(),e.stopPropagation(),i({type:0}),s.nextFrame((()=>i({type:2,focus:Hm.Last})))}})),c=xf((e=>{if(e.key===Xf.Space)e.preventDefault()})),d=xf((t=>{if(Zf(t.currentTarget))return t.preventDefault();e.disabled||(0===r.menuState?(i({type:1}),s.nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(t.preventDefault(),i({type:0})))})),f=(0,u.useMemo)((()=>({open:0===r.menuState})),[r]),h=e;return of({ourProps:{ref:o,id:a,type:qm(e,r.buttonRef),"aria-haspopup":!0,"aria-controls":null==(n=r.itemsRef.current)?void 0:n.id,"aria-expanded":e.disabled?void 0:0===r.menuState,onKeyDown:l,onKeyUp:c,onClick:d},theirProps:h,slot:f,defaultTag:"button",name:"Menu.Button"})})),ig=nf.RenderStrategy|nf.Static,og=lf((function(e,t){var n,r;let[i,o]=$m("Menu.Items"),a=_f(i.itemsRef,t),s=Mh(i.itemsRef),l=`headlessui-menu-items-${nh()}`,c=Pf(),d=hf(),f=null!==d?d===ff.Open:0===i.menuState;(0,u.useEffect)((()=>{let e=i.itemsRef.current;!e||0===i.menuState&&e!==(null==s?void 0:s.activeElement)&&e.focus({preventScroll:!0})}),[i.menuState,i.itemsRef,s]),Wm({container:i.itemsRef.current,enabled:0===i.menuState,accept:e=>"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let h=xf((e=>{var t,n;switch(c.dispose(),e.key){case Xf.Space:if(""!==i.searchQuery)return e.preventDefault(),e.stopPropagation(),o({type:3,value:e.key});case Xf.Enter:if(e.preventDefault(),e.stopPropagation(),o({type:1}),null!==i.activeItemIndex){let{dataRef:e}=i.items[i.activeItemIndex];null==(n=null==(t=e.current)?void 0:t.domRef.current)||n.click()}ph(i.buttonRef.current);break;case Xf.ArrowDown:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:Hm.Next});case Xf.ArrowUp:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:Hm.Previous});case Xf.Home:case Xf.PageUp:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:Hm.First});case Xf.End:case Xf.PageDown:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:Hm.Last});case Xf.Escape:e.preventDefault(),e.stopPropagation(),o({type:1}),Cf().nextFrame((()=>{var e;return null==(e=i.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case Xf.Tab:e.preventDefault(),e.stopPropagation(),o({type:1}),Cf().nextFrame((()=>{yh(i.buttonRef.current,e.shiftKey?lh.Previous:lh.Next)}));break;default:1===e.key.length&&(o({type:3,value:e.key}),c.setTimeout((()=>o({type:4})),350))}})),p=xf((e=>{if(e.key===Xf.Space)e.preventDefault()})),m=(0,u.useMemo)((()=>({open:0===i.menuState})),[i]),g=e;return of({ourProps:{"aria-activedescendant":null===i.activeItemIndex||null==(n=i.items[i.activeItemIndex])?void 0:n.id,"aria-labelledby":null==(r=i.buttonRef.current)?void 0:r.id,id:l,onKeyDown:h,onKeyUp:p,role:"menu",tabIndex:0,ref:a},theirProps:g,slot:m,defaultTag:"div",features:ig,visible:f,name:"Menu.Items"})})),ag=u.Fragment,sg=lf((function(e,t){let{disabled:n=!1,...r}=e,[i,o]=$m("Menu.Item"),a=`headlessui-menu-item-${nh()}`,s=null!==i.activeItemIndex&&i.items[i.activeItemIndex].id===a,l=(0,u.useRef)(null),c=_f(t,l);gf((()=>{if(0!==i.menuState||!s||0===i.activationTrigger)return;let e=Cf();return e.requestAnimationFrame((()=>{var e,t;null==(t=null==(e=l.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})),e.dispose}),[l,s,i.menuState,i.activationTrigger,i.activeItemIndex]);let d=(0,u.useRef)({disabled:n,domRef:l});gf((()=>{d.current.disabled=n}),[d,n]),gf((()=>{var e,t;d.current.textValue=null==(t=null==(e=l.current)?void 0:e.textContent)?void 0:t.toLowerCase()}),[d,l]),gf((()=>(o({type:5,id:a,dataRef:d}),()=>o({type:6,id:a}))),[d,a]);let f=xf((()=>{o({type:1})})),h=xf((e=>{if(n)return e.preventDefault();o({type:1}),ph(i.buttonRef.current)})),p=xf((()=>{if(n)return o({type:2,focus:Hm.Nothing});o({type:2,focus:Hm.Specific,id:a})})),m=xf((()=>{n||s||o({type:2,focus:Hm.Specific,id:a,trigger:0})})),g=xf((()=>{n||!s||o({type:2,focus:Hm.Nothing})})),v=(0,u.useMemo)((()=>({active:s,disabled:n,close:f})),[s,n,f]);return of({ourProps:{id:a,ref:c,role:"menuitem",tabIndex:!0===n?void 0:-1,"aria-disabled":!0===n||void 0,disabled:void 0,onClick:h,onFocus:p,onPointerMove:m,onMouseMove:m,onPointerLeave:g,onMouseLeave:g},theirProps:r,slot:v,defaultTag:ag,name:"Menu.Item"})})),lg=Object.assign(ng,{Button:rg,Items:og,Item:sg});var cg=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,"aria-label":t,children:[(0,s.jsx)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,s.jsx)("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17l-.59.59-.58.58V4h16v12zm-9-4h2v2h-2zm0-6h2v4h-2z"})]});const ug={"it-IT":"Non è quello che ti ho chiesto","fr-FR":"Ce n'est pas ce que je t'ai demandé","en-GB":"It's not what I asked"},dg={"it-IT":"La risposta non era corretta","fr-FR":"La réponse n'était pas correcte","en-GB":"The answer was not correct"},fg={"it-IT":"Non mi è piaciuta la risposta","fr-FR":"Je n'ai pas aimé la réponse","en-GB":"I didn't like the answer"};var hg=({memori:e,className:t,onNegativeClick:n,toggle:i=!1,dropdown:o=!1})=>{const[a,l]=(0,u.useState)(),c="it-IT"===e.culture?"it-IT":"fr-FR"===e.culture?"fr-FR":"en-GB",d=ug[c],f=dg[c],h=fg[c];return(0,s.jsx)("div",{className:"memori-chat--feedback"+(t?` ${t}`:""),children:o?(0,s.jsxs)(lg,{as:"div",className:"memori-chat--feedback-menu",children:[(0,s.jsx)(lg.Button,{as:r(u).Fragment,children:(0,s.jsx)(Zd,{ghost:!0,shape:"circle",title:"Feedback",className:"memori-chat--feedback-menu-button",disabled:!!a,icon:(0,s.jsx)(cg,{className:a?"memori-chat--feedback-clicked":void 0})})}),(0,s.jsx)(Jf,{as:r(u).Fragment,enter:"transition ease-out duration-200",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,s.jsx)(lg.Items,{className:"memori-chat--feedback-menu-items",children:(0,s.jsxs)("div",{className:"memori-chat--feedback-menu-items-container",children:[(0,s.jsx)(lg.Item,{children:({active:e})=>(0,s.jsx)("button",{className:"memori-chat--feedback-menu-item"+(e?" memori-chat--feedback-menu-item-active":""),onClick:()=>{l("up"===a&&i?void 0:"up")},children:h})},"ok"),(0,s.jsx)(lg.Item,{children:({active:e})=>(0,s.jsx)("button",{className:"memori-chat--feedback-menu-item"+(e?" memori-chat--feedback-menu-item-active":""),onClick:()=>{l("down"===a&&i?void 0:"down"),n(d)},children:f})},"no")]})})})]}):(0,s.jsx)(zm,{align:"left",content:"Feedback",children:(0,s.jsx)(Zd,{title:"Feedback",onClick:()=>{l("down"===a&&i?void 0:"down"),n(d)},ghost:!0,shape:"circle",icon:(0,s.jsx)(cg,{className:a?"memori-chat--feedback-clicked":void 0})})})})};var pg=({message:e,memori:t,tenant:n,baseUrl:i,apiUrl:o,showFeedback:a,simulateUserPrompt:l,showAIicon:c=!0})=>{const{t:u}=Te();return(0,s.jsxs)(s.Fragment,{children:[e.initial&&(0,s.jsx)("div",{className:"memori-chat--bubble-initial"}),(0,s.jsxs)(Jf,{show:!0,appear:!0,as:"div",className:r(Jd)("memori-chat--bubble-container",{"memori-chat--bubble-from-user":!!e.fromUser,"memori-chat--with-addon":e.generatedByAI&&c||a&&l}),children:[!e.fromUser&&(0,s.jsxs)(Jf.Child,{as:"picture",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),children:[(0,s.jsx)("source",{src:jm({type:"avatar",tenantID:null==n?void 0:n.id,resourceURI:t.avatarURL,baseURL:i,apiURL:o})}),(0,s.jsx)("img",{className:"memori-chat--bubble-avatar-img",alt:t.name,src:t.avatarURL&&t.avatarURL.length>0?jm({type:"avatar",tenantID:null==n?void 0:n.id,resourceURI:t.avatarURL,baseURL:i,apiURL:o}):jm({tenantID:null==n?void 0:n.id,type:"avatar",baseURL:i||"https://app.twincreator.com",apiURL:o})})]}),(0,s.jsxs)(Jf.Child,{as:"div",className:r(Jd)("memori-chat--bubble",{"memori-chat--user-bubble":!!e.fromUser,"memori-chat--with-addon":e.generatedByAI&&c||a&&l,"memori-chat--ai-generated":e.generatedByAI&&c,"memori-chat--with-feedback":a}),enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-09 translate-x-"+(e.fromUser?"30":"-30"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-09 translate-x-"+(e.fromUser?"30":"-30"),children:[(e.translatedText||e.text).split(/\r\n|\r|\n/).map(((e,t)=>(0,s.jsx)("p",{children:e},t))),(e.generatedByAI&&c||a&&l)&&(0,s.jsxs)("div",{className:"memori-chat--bubble-addon",children:[a&&!!l&&(0,s.jsx)(hg,{memori:t,className:"memori-chat--bubble-feedback",dropdown:!0,onNegativeClick:e=>{e&&l(e)}}),e.generatedByAI&&c&&(0,s.jsx)(zm,{align:"left",content:u("generatedByAI"),className:"memori-chat--bubble-ai-icon",children:(0,s.jsx)("span",{children:(0,s.jsx)(Um,{title:u("generatedByAI")||void 0})})})]})]}),e.fromUser&&(0,s.jsx)(Jf.Child,{as:"div",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),children:(0,s.jsx)(Fm,{})})]})]})};u=a("85Hg2"),u=a("85Hg2");var mg,gg=({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:"M574 665.4a8.03 8.03 0 0 0-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 0 0-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 0 0 0 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 0 0 0 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 0 0-11.3 0L372.3 598.7a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"})}),vg=(Jd=a("4IUwl"),{});mg=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function n(e,n){var r=e.el,i=e.elStyle,o=e.elHeight,a=e.rowsLimit,s=e.rowsWrapped,l=e.options,c=e.buffer,u=c;if(s===a+1)return t({},e);var d=c,f=s,h=o;return r.innerHTML=u=c.length?""+c+l.delimiter+n+l.replaceStr:""+n+l.replaceStr,parseFloat(i.height)>parseFloat(o)&&(f++,h=i.height,f===a+1)?(r.innerHTML=u="."===d[d.length-1]&&"..."===l.replaceStr?d+"..":""+d+l.replaceStr,t({},e,{elHeight:h,rowsWrapped:f})):(r.innerHTML=u=d.length?""+d+l.delimiter+n:""+n,t({},e,{buffer:u,elHeight:h,rowsWrapped:f}))}e.disableResponsive=function(e){window.removeEventListener("resize",e)},e.ellipsis=function e(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a={replaceStr:"...",responsive:!1,debounceDelay:250,delimiter:" "},s=t({},a,o),l=r&&(r instanceof NodeList?r:1===r.nodeType?[r]:document.querySelectorAll(r)),c=[],u=0;u<l.length;u++){var d=l[u];c[u]=d.innerHTML;var f=d.innerHTML.split(s.delimiter);d.innerHTML="";var h=window.getComputedStyle(d);f.reduce(n,{el:d,buffer:d.innerHTML,elStyle:h,elHeight:0,rowsLimit:i,rowsWrapped:0,options:s})}if(s.responsive){var p=!1,m=window.innerWidth,g=function(){if(window.innerWidth!==m){m=window.innerWidth;for(var n=0;n<l.length;n++)l[n].innerHTML=c[n];e(r,i,t({},o,{responsive:!1}))}},v=function(){clearTimeout(p),p=setTimeout(g,s.debounceDelay)};return window.addEventListener("resize",v),v}}},"function"==typeof define&&define.amd?define(["exports"],mg):mg(vg);Jd=a("4IUwl");var yg=({loading:e=!1,className:t,title:n,description:i,cover:o,hoverable:a=!1,children:l})=>(0,s.jsx)("div",{className:r(Jd)("memori-card",t,{"memori-card--loading":e,"memori-card--with-cover":o,"memori-card--hoverable":a}),children:(0,s.jsxs)(dp,{spinning:e,children:[o&&(0,s.jsx)("div",{className:"memori-card--cover",children:o}),(0,s.jsxs)("div",{className:"memori-card--content",children:[n&&(0,s.jsx)("h3",{className:"memori-card--title",children:n}),i&&(0,s.jsx)("p",{className:"memori-card--description",children:i}),(0,s.jsx)("div",{className:"memori-card--children",children:l})]})]})});const bg=({isChild:e=!1,item:t,baseUrl:n,onLinkPreviewInfo:i,descriptionOneLine:o=!1})=>{var a,l,c,d;const[f,h]=(0,u.useState)(null),p=(null===(a=t.url)||void 0===a?void 0:a.startsWith("http"))||!t.url||0===(null===(l=t.url)||void 0===l?void 0:l.length)?t.url:`https://${t.url}`;(0,u.useEffect)((()=>{var e,r;let o=(null===(e=t.url)||void 0===e?void 0:e.startsWith("http"))||!t.url||0===(null===(r=t.url)||void 0===r?void 0:r.length)?t.url:`https://${t.url}`;o&&o!==(null==f?void 0:f.urlKey)&&(async(e,t)=>{try{const n=await fetch(`${t||"https://app.twincreator.com"}/api/linkpreview/${encodeURIComponent(e)}`);return await n.json()}catch(e){return console.error("getSiteInfo",e),null}})(o,n).then((e=>{h(e?{...e,urlKey:o}:null),i&&e&&i(e)}))}),[null==t?void 0:t.url,n,i]);const m=t.title&&t.title.length>0?t.title:null==f?void 0:f.title,g=null==f?void 0:f.description,v=null==f?void 0:f.video,y=null!==(c=null==f?void 0:f.image)&&void 0!==c?c:null===(d=null==f?void 0:f.images)||void 0===d?void 0:d[0];return(0,u.useEffect)((()=>{setTimeout((()=>{(0,vg.ellipsis)(".memori-link-item--card .memori-card--description",3,{responsive:!0})}),300)}),[g,t.mediumID]),(0,s.jsx)("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:r(Jd)("memori-link-item--link",{"memori-link-item--link--child":e}),onClick:t=>{e||(t.preventDefault(),t.stopPropagation(),window.open(p,"_blank",`toolbar=yes,top=${.1*window.innerHeight},left=${.1*window.innerWidth},width=${.8*window.innerWidth},height=${.8*window.innerHeight}`))},children:(0,s.jsx)(yg,{hoverable:!0,className:r(Jd)("memori-link-item--card",{"memori-link-item--card-description-oneline":o,"memori-link-item--card-has-image":y,"memori-link-item--card-has-video":v}),cover:v?(0,s.jsx)("iframe",{width:"100%",height:"100%",src:v,title:"Video player",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}):y?(0,s.jsx)("img",{className:"memori-link-item--card-cover-img",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg==",srcSet:y.includes("data:image")?void 0:y,alt:t.title}):(0,s.jsx)("div",{className:"memori-link-item--card-cover-icon",children:(0,s.jsx)(gg,{className:"memori-link-item--icon"})}),title:m,description:g})})};var wg=({items:e,baseUrl:t,descriptionOneLine:n=!1,onLinkPreviewInfo:r})=>(0,s.jsx)(Jf,{appear:!0,show:!0,as:"div",className:"memori-link-items",children:(0,s.jsx)("div",{className:"memori-link-items--grid",children:e.map(((e,i)=>(0,s.jsx)(Jf.Child,{as:"div",className:"memori-link-item",enter:"ease-out duration-500 delay-"+100*i,enterFrom:"opacity-0 scale-95",enterTo:"opacity-1 scale-100",leave:"ease-in duration-300",leaveFrom:"opacity-1 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsx)(bg,{item:e,baseUrl:t,descriptionOneLine:n,onLinkPreviewInfo:r})},e.mediumID)))})});u=a("85Hg2");const xg=["va bene","no grazie","si","no","sì","arrivederci","non c'entrava","non mi è piaciuto"],Sg=async(e,t,n,r)=>{var i;const o=xg.indexOf(e.toLowerCase())>-1?"IT":null==n?void 0:n.toUpperCase(),a=await fetch(`${r||"https://app.twincreator.com"}/api/translate?text=${encodeURIComponent(e)}&target_lang=${t.toUpperCase()}${o?`&source_lang=${o}`:""}`,{method:"GET",headers:{Accept:"*/*"}}),s=await a.json();return null===(i=null==s?void 0:s.translations)||void 0===i?void 0:i[0]},Mg=[{value:"IT",label:"Italiano"},{value:"EN",label:"English"},{value:"DE",label:"Deutsch"},{value:"ES",label:"Español"},{value:"FR",label:"Français"},{value:"PT",label:"Português"},{value:"UK",label:"Українська"},{value:"RU",label:"Русский"},{value:"PL",label:"Polski"}],_g=["image/jpeg","image/png","image/jpg","image/gif","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/pdf","video/mp4","video/avi","audio/mpeg3","audio/wav","audio/mpeg","video/mpeg","model/gltf-binary"],Ag="👤",Eg=[{name:"text",lang:"text",mimeType:"text/plain",monacoLang:"plaintext",executable:!0},{name:"javascript/jsx",lang:"jsx",mimeType:"text/javascript",monacoLang:"javascript",executable:!0},{name:"typescript/tsx",lang:"tsx",mimeType:"text/ecmascript",monacoLang:"typescript",executable:!0},{name:"json",lang:"json",mimeType:"application/json",monacoLang:"json",executable:!0},{name:"css",lang:"scss",mimeType:"text/css",monacoLang:"css",executable:!0},{name:"html/xml",lang:"tsx",mimeType:"application/xml",monacoLang:"xml"},{name:"bash",lang:"bash",mimeType:"application/x-sh",monacoLang:"shell"},{name:"python",lang:"python",mimeType:"text/x-python",monacoLang:"python"},{name:"cpp/csharp",lang:"cpp",mimeType:"text/x-c++src",monacoLang:"cpp"},{name:"php",lang:"php",mimeType:"application/x-php",monacoLang:"php"},{name:"ruby",lang:"ruby",mimeType:"text/x-ruby",monacoLang:"ruby"},{name:"sql",lang:"sql",mimeType:"text/x-sql",monacoLang:"sql"}];u=a("85Hg2");var Cg=({src:e,poster:t,alt:n=""})=>((0,u.useEffect)((()=>{const e=document.createElement("script");return e.src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js",e.type="module",document.head.appendChild(e),()=>{document.head.removeChild(e)}}),[]),(0,s.jsx)("div",{className:"model-viewer",children:(0,s.jsx)("model-viewer",{src:e,"ios-src":"",poster:t,alt:n,"shadow-intensity":"1","disable-zoom":!0,"camera-controls":!0,autoplay:!0})}));var kg=({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:"M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"})}),Tg={};function Ig(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}(Tg=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Ig(o,r,i,a,s,"next",e)}function s(e){Ig(o,r,i,a,s,"throw",e)}a(void 0)}))}}).__esModule=!0,Tg.default=Tg;var Og={};function Rg(){return Og=Rg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Og.__esModule=!0,Og.default=Og,Rg.apply(this,arguments)}(Og=Rg).__esModule=!0,Og.default=Og;var Pg={};(Pg=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}).__esModule=!0,Pg.default=Pg;var Ng={},Lg={},Dg=a("7h3ED").default,Bg={},jg=a("7h3ED").default;function Fg(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,Lg(r.key),r)}}(Bg=function(e,t){if("object"!==jg(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==jg(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}).__esModule=!0,Bg.default=Bg,(Lg=function(e){var t=Bg(e,"string");return"symbol"===Dg(t)?t:String(t)}).__esModule=!0,Lg.default=Lg,(Ng=function(e,t,n){return t&&Fg(e.prototype,t),n&&Fg(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}).__esModule=!0,Ng.default=Ng;var Ug={},zg={};function Hg(e,t){return zg=Hg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},zg.__esModule=!0,zg.default=zg,Hg(e,t)}(zg=Hg).__esModule=!0,zg.default=zg,(Ug=function(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&&zg(e,t)}).__esModule=!0,Ug.default=Ug;var Vg={},Wg=a("7h3ED").default,Gg={};(Gg=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}).__esModule=!0,Gg.default=Gg,(Vg=function(e,t){if(t&&("object"===Wg(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Gg(e)}).__esModule=!0,Vg.default=Vg;var qg={};function Kg(e){return qg=Kg=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qg.__esModule=!0,qg.default=qg,Kg(e)}(qg=Kg).__esModule=!0,qg.default=qg;var Yg={};(Yg=function(e,t,n){return(t=Lg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}).__esModule=!0,Yg.default=Yg;var Jg,Qg=a("6EIcq")();Jg=Qg;try{regeneratorRuntime=Qg}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=Qg:Function("r","regeneratorRuntime = r")(Qg)}u=a("85Hg2");var Xg={},Zg={};(Zg=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}).__esModule=!0,Zg.default=Zg,(Xg=function(e,t){if(null==e)return{};var n,r,i=Zg(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}).__esModule=!0,Xg.default=Xg;var $g={},ev={},tv={};(tv=function(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}).__esModule=!0,tv.default=tv,(ev=function(e){if(Array.isArray(e))return tv(e)}).__esModule=!0,ev.default=ev;var nv={};(nv=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}).__esModule=!0,nv.default=nv;var rv={};rv=function(e,t){if(e){if("string"==typeof e)return tv(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)?tv(e,t):void 0}},rv.__esModule=!0,rv.default=rv;var iv={};(iv=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}).__esModule=!0,iv.default=iv,($g=function(e){return ev(e)||nv(e)||rv(e)||iv()}).__esModule=!0,$g.default=$g;u=a("85Hg2"),u=a("85Hg2");function ov(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 av(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ov(Object(n),!0).forEach((function(t){r(Yg)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ov(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var sv={};function lv(e){if(0===e.length||1===e.length)return e;var t,n,r=e.join(".");return sv[r]||(sv[r]=0===(n=(t=e).length)||1===n?t:2===n?[t[0],t[1],"".concat(t[0],".").concat(t[1]),"".concat(t[1],".").concat(t[0])]:3===n?[t[0],t[1],t[2],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0])]:n>=4?[t[0],t[1],t[2],t[3],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[2],".").concat(t[3]),"".concat(t[3],".").concat(t[0]),"".concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[0]),"".concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[3],".").concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[2],".").concat(t[1],".").concat(t[0])]:void 0),sv[r]}function cv(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=e.filter((function(e){return"token"!==e})),i=lv(r);return i.reduce((function(e,t){return av(av({},e),n[t])}),t)}function uv(e){return e.join(" ")}function dv(e){var t=e.node,n=e.stylesheet,i=e.style,o=void 0===i?{}:i,a=e.useInlineStyles,s=e.key,l=t.properties,c=t.type,d=t.tagName,f=t.value;if("text"===c)return f;if(d){var h,p=function(e,t){var n=0;return function(r){return n+=1,r.map((function(r,i){return dv({node:r,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(i)})}))}}(n,a);if(a){var m=Object.keys(n).reduce((function(e,t){return t.split(".").forEach((function(t){e.includes(t)||e.push(t)})),e}),[]),g=l.className&&l.className.includes("token")?["token"]:[],v=l.className&&g.concat(l.className.filter((function(e){return!m.includes(e)})));h=av(av({},l),{},{className:uv(v)||void 0,style:cv(l.className,Object.assign({},l.style,o),n)})}else h=av(av({},l),{},{className:uv(l.className)});var y=p(t.children);return r(u).createElement(d,r(Og)({key:s},h),y)}}var fv=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function hv(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 pv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hv(Object(n),!0).forEach((function(t){r(Yg)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hv(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var mv=/\n/g;function gv(e){var t=e.codeString,n=e.codeStyle,i=e.containerStyle,o=void 0===i?{float:"left",paddingRight:"10px"}:i,a=e.numberStyle,s=void 0===a?{}:a,l=e.startingLineNumber;return r(u).createElement("code",{style:Object.assign({},n,o)},function(e){var t=e.lines,n=e.startingLineNumber,i=e.style;return t.map((function(e,t){var o=t+n;return r(u).createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"==typeof i?i(o):i},"".concat(o,"\n"))}))}({lines:t.replace(/\n$/,"").split("\n"),style:s,startingLineNumber:l}))}function vv(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function yv(e,t,n){var r,i={display:"inline-block",minWidth:(r=n,"".concat(r.toString().length,".25em")),paddingRight:"1em",textAlign:"right",userSelect:"none"},o="function"==typeof e?e(t):e;return pv(pv({},i),o)}function bv(e){var t=e.children,n=e.lineNumber,r=e.lineNumberStyle,i=e.largestLineNumber,o=e.showInlineLineNumbers,a=e.lineProps,s=void 0===a?{}:a,l=e.className,c=void 0===l?[]:l,u=e.showLineNumbers,d=e.wrapLongLines,f="function"==typeof s?s(n):s;if(f.className=c,n&&o){var h=yv(r,n,i);t.unshift(vv(n,h))}return d&u&&(f.style=pv(pv({},f.style),{},{display:"flex"})),{type:"element",tagName:"span",properties:f,children:t}}function wv(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=0;i<e.length;i++){var o=e[i];if("text"===o.type)n.push(bv({children:[o],className:r($g)(new Set(t))}));else if(o.children){var a=t.concat(o.properties.className);wv(o.children,a).forEach((function(e){return n.push(e)}))}}return n}function xv(e,t,n,r,i,o,a,s,l){var c,u=wv(e.value),d=[],f=-1,h=0;function p(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return bv({children:e,lineNumber:t,lineNumberStyle:s,largestLineNumber:a,showInlineLineNumbers:i,lineProps:n,className:o,showLineNumbers:r,wrapLongLines:l})}function m(e,t){if(r&&t&&i){var n=yv(s,t,a);e.unshift(vv(t,n))}return e}function g(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t||r.length>0?p(e,n,r):m(e,n)}for(var v=function(){var e=u[h],t=e.children[0].value;if(t.match(mv)){var n=t.split("\n");n.forEach((function(t,i){var a=r&&d.length+o,s={type:"text",value:"".concat(t,"\n")};if(0===i){var l=g(u.slice(f+1,h).concat(bv({children:[s],className:e.properties.className})),a);d.push(l)}else if(i===n.length-1){var c=u[h+1]&&u[h+1].children&&u[h+1].children[0],p={type:"text",value:"".concat(t)};if(c){var m=bv({children:[p],className:e.properties.className});u.splice(h+1,0,m)}else{var v=g([p],a,e.properties.className);d.push(v)}}else{var y=g([s],a,e.properties.className);d.push(y)}})),f=h}h++};h<u.length;)v();if(f!==u.length-1){var y=u.slice(f+1,u.length);if(y&&y.length){var b=g(y,r&&d.length+o);d.push(b)}}return t?d:(c=[]).concat.apply(c,d)}function Sv(e){var t=e.rows,n=e.stylesheet,r=e.useInlineStyles;return t.map((function(e,t){return dv({node:e,stylesheet:n,useInlineStyles:r,key:"code-segement".concat(t)})}))}function Mv(e){return e&&void 0!==e.highlightAuto}function _v(e,t){return function(n){var i=n.language,o=n.children,a=n.style,s=void 0===a?t:a,l=n.customStyle,c=void 0===l?{}:l,d=n.codeTagProps,f=void 0===d?{className:i?"language-".concat(i):void 0,style:pv(pv({},s['code[class*="language-"]']),s['code[class*="language-'.concat(i,'"]')])}:d,h=n.useInlineStyles,p=void 0===h||h,m=n.showLineNumbers,g=void 0!==m&&m,v=n.showInlineLineNumbers,y=void 0===v||v,b=n.startingLineNumber,w=void 0===b?1:b,x=n.lineNumberContainerStyle,S=n.lineNumberStyle,M=void 0===S?{}:S,_=n.wrapLines,A=n.wrapLongLines,E=void 0!==A&&A,C=n.lineProps,k=void 0===C?{}:C,T=n.renderer,I=n.PreTag,O=void 0===I?"pre":I,R=n.CodeTag,P=void 0===R?"code":R,N=n.code,L=void 0===N?(Array.isArray(o)?o[0]:o)||"":N,D=n.astGenerator,B=r(Xg)(n,fv);D=D||e;var j=g?r(u).createElement(gv,{containerStyle:x,codeStyle:f.style||{},numberStyle:M,startingLineNumber:w,codeString:L}):null,F=s.hljs||s['pre[class*="language-"]']||{backgroundColor:"#fff"},U=Mv(D)?"hljs":"prismjs",z=p?Object.assign({},B,{style:Object.assign({},F,c)}):Object.assign({},B,{className:B.className?"".concat(U," ").concat(B.className):U,style:Object.assign({},c)});if(f.style=pv(pv({},f.style),{},E?{whiteSpace:"pre-wrap"}:{whiteSpace:"pre"}),!D)return r(u).createElement(O,z,j,r(u).createElement(P,f,L));(void 0===_&&T||E)&&(_=!0),T=T||Sv;var H=[{type:"text",value:L}],V=function(e){var t=e.astGenerator,n=e.language,r=e.code,i=e.defaultCodeValue;if(Mv(t)){var o=function(e,t){return-1!==e.listLanguages().indexOf(t)}(t,n);return"text"===n?{value:i,language:"text"}:o?t.highlight(n,r):t.highlightAuto(r)}try{return n&&"text"!==n?{value:t.highlight(r,n)}:{value:i}}catch(e){return{value:i}}}({astGenerator:D,language:i,code:L,defaultCodeValue:H});null===V.language&&(V.value=H);var W=xv(V,_,k,g,y,w,V.value.length+w,M,E);return r(u).createElement(O,z,r(u).createElement(P,f,!y&&j,T({rows:W,stylesheet:s,useInlineStyles:p})))}}function Av(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,i=r(qg)(e);if(t){var o=r(qg)(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return r(Vg)(this,n)}}var Ev,Cv,kv,Tv,Iv,Ov,Rv,Pv=function(e,t){return function(){var n=r(Tg)(r(Jg).mark((function n(i){var o;return r(Jg).wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t();case 2:o=n.sent,i(e,o.default||o);case 4:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}()},Nv={abap:Pv("abap",(function(){return a("bwHpE")})),abnf:Pv("abnf",(function(){return a("daD87")})),actionscript:Pv("actionscript",(function(){return a("lpEgO")})),ada:Pv("ada",(function(){return a("1sGW9")})),agda:Pv("agda",(function(){return a("e9VyR")})),al:Pv("al",(function(){return a("kMFSe")})),antlr4:Pv("antlr4",(function(){return a("8HlsP")})),apacheconf:Pv("apacheconf",(function(){return a("isFCh")})),apex:Pv("apex",(function(){return a("gUXVM")})),apl:Pv("apl",(function(){return a("2L15v")})),applescript:Pv("applescript",(function(){return a("8XyFT")})),aql:Pv("aql",(function(){return a("gFWTI")})),arduino:Pv("arduino",(function(){return a("jI3VB")})),arff:Pv("arff",(function(){return a("6uYTH")})),asciidoc:Pv("asciidoc",(function(){return a("gdYKH")})),asm6502:Pv("asm6502",(function(){return a("ahFLg")})),asmatmel:Pv("asmatmel",(function(){return a("4irIu")})),aspnet:Pv("aspnet",(function(){return a("yDC6n")})),autohotkey:Pv("autohotkey",(function(){return a("a4xpy")})),autoit:Pv("autoit",(function(){return a("iNSix")})),avisynth:Pv("avisynth",(function(){return a("kEBnk")})),avroIdl:Pv("avroIdl",(function(){return a("lzthi")})),bash:Pv("bash",(function(){return Promise.resolve(a("3aDLI"))})),basic:Pv("basic",(function(){return a("cxDu6")})),batch:Pv("batch",(function(){return a("6zDll")})),bbcode:Pv("bbcode",(function(){return a("bPS87")})),bicep:Pv("bicep",(function(){return a("8dy5f")})),birb:Pv("birb",(function(){return a("3vHrY")})),bison:Pv("bison",(function(){return a("bCjBS")})),bnf:Pv("bnf",(function(){return a("4NqDW")})),brainfuck:Pv("brainfuck",(function(){return a("4s0KX")})),brightscript:Pv("brightscript",(function(){return a("jTsQ4")})),bro:Pv("bro",(function(){return a("5lMc2")})),bsl:Pv("bsl",(function(){return a("jBYxC")})),c:Pv("c",(function(){return Promise.resolve(a("lyZgY"))})),cfscript:Pv("cfscript",(function(){return a("coZDy")})),chaiscript:Pv("chaiscript",(function(){return a("e1zEN")})),cil:Pv("cil",(function(){return a("crKoM")})),clike:Pv("clike",(function(){return a("4kO9t")})),clojure:Pv("clojure",(function(){return a("01SpB")})),cmake:Pv("cmake",(function(){return a("9yG4p")})),cobol:Pv("cobol",(function(){return a("967Hn")})),coffeescript:Pv("coffeescript",(function(){return a("7Yi6H")})),concurnas:Pv("concurnas",(function(){return a("5tXmX")})),coq:Pv("coq",(function(){return a("ektdr")})),cpp:Pv("cpp",(function(){return Promise.resolve(a("lR39A"))})),crystal:Pv("crystal",(function(){return a("8gt4L")})),csharp:Pv("csharp",(function(){return a("7K6eJ")})),cshtml:Pv("cshtml",(function(){return a("cVu4i")})),csp:Pv("csp",(function(){return a("ecKo1")})),cssExtras:Pv("cssExtras",(function(){return a("gnpv8")})),css:Pv("css",(function(){return a("jx0H8")})),csv:Pv("csv",(function(){return a("f9kmW")})),cypher:Pv("cypher",(function(){return a("lojor")})),d:Pv("d",(function(){return a("6Qa0U")})),dart:Pv("dart",(function(){return a("74K1B")})),dataweave:Pv("dataweave",(function(){return a("93H6c")})),dax:Pv("dax",(function(){return a("cf9Y9")})),dhall:Pv("dhall",(function(){return a("f6UWv")})),diff:Pv("diff",(function(){return a("klPVo")})),django:Pv("django",(function(){return a("jfxe9")})),dnsZoneFile:Pv("dnsZoneFile",(function(){return a("5aMz5")})),docker:Pv("docker",(function(){return a("kOauC")})),dot:Pv("dot",(function(){return a("btE6k")})),ebnf:Pv("ebnf",(function(){return a("aT88c")})),editorconfig:Pv("editorconfig",(function(){return a("jWOl8")})),eiffel:Pv("eiffel",(function(){return a("kHJaX")})),ejs:Pv("ejs",(function(){return a("frfnA")})),elixir:Pv("elixir",(function(){return a("hcrJ2")})),elm:Pv("elm",(function(){return a("jd271")})),erb:Pv("erb",(function(){return a("gczXL")})),erlang:Pv("erlang",(function(){return a("FsabW")})),etlua:Pv("etlua",(function(){return a("9DI9l")})),excelFormula:Pv("excelFormula",(function(){return a("3QVue")})),factor:Pv("factor",(function(){return a("ltNCT")})),falselang:Pv("falselang",(function(){return a("g0Q6p")})),firestoreSecurityRules:Pv("firestoreSecurityRules",(function(){return a("ukA2V")})),flow:Pv("flow",(function(){return a("e5prn")})),fortran:Pv("fortran",(function(){return a("gIEL6")})),fsharp:Pv("fsharp",(function(){return a("3wQkt")})),ftl:Pv("ftl",(function(){return a("7ZVWs")})),gap:Pv("gap",(function(){return a("hOFj6")})),gcode:Pv("gcode",(function(){return a("95BzQ")})),gdscript:Pv("gdscript",(function(){return a("iul6t")})),gedcom:Pv("gedcom",(function(){return a("e0qJM")})),gherkin:Pv("gherkin",(function(){return a("2SHak")})),git:Pv("git",(function(){return a("l6VFH")})),glsl:Pv("glsl",(function(){return a("cEMfJ")})),gml:Pv("gml",(function(){return a("8UVTr")})),gn:Pv("gn",(function(){return a("kvibD")})),goModule:Pv("goModule",(function(){return a("icqjF")})),go:Pv("go",(function(){return a("jLkg8")})),graphql:Pv("graphql",(function(){return a("aYGNi")})),groovy:Pv("groovy",(function(){return a("4bTmH")})),haml:Pv("haml",(function(){return a("h2A6V")})),handlebars:Pv("handlebars",(function(){return a("79YVJ")})),haskell:Pv("haskell",(function(){return a("bsiLW")})),haxe:Pv("haxe",(function(){return a("94Kdj")})),hcl:Pv("hcl",(function(){return a("9CheR")})),hlsl:Pv("hlsl",(function(){return a("h3dqW")})),hoon:Pv("hoon",(function(){return a("9WbsW")})),hpkp:Pv("hpkp",(function(){return a("GiPN3")})),hsts:Pv("hsts",(function(){return a("eaSn9")})),http:Pv("http",(function(){return a("1uj7b")})),ichigojam:Pv("ichigojam",(function(){return a("ge562")})),icon:Pv("icon",(function(){return a("lVHUf")})),icuMessageFormat:Pv("icuMessageFormat",(function(){return a("aYoUL")})),idris:Pv("idris",(function(){return a("1RVAE")})),iecst:Pv("iecst",(function(){return a("bi7Dr")})),ignore:Pv("ignore",(function(){return a("cq0Pi")})),inform7:Pv("inform7",(function(){return a("31K4E")})),ini:Pv("ini",(function(){return a("l05OZ")})),io:Pv("io",(function(){return a("6bY1b")})),j:Pv("j",(function(){return a("1ebDS")})),java:Pv("java",(function(){return a("iEZZI")})),javadoc:Pv("javadoc",(function(){return a("aHy5a")})),javadoclike:Pv("javadoclike",(function(){return a("5f3rE")})),javascript:Pv("javascript",(function(){return a("7JDFI")})),javastacktrace:Pv("javastacktrace",(function(){return a("gdCGE")})),jexl:Pv("jexl",(function(){return a("cqMb9")})),jolie:Pv("jolie",(function(){return a("cEDX4")})),jq:Pv("jq",(function(){return a("kEWsh")})),jsExtras:Pv("jsExtras",(function(){return a("74PI8")})),jsTemplates:Pv("jsTemplates",(function(){return a("30TPr")})),jsdoc:Pv("jsdoc",(function(){return a("9DH5c")})),json:Pv("json",(function(){return Promise.resolve(a("l1Rj1"))})),json5:Pv("json5",(function(){return a("920rv")})),jsonp:Pv("jsonp",(function(){return a("9AwS1")})),jsstacktrace:Pv("jsstacktrace",(function(){return a("bYXMr")})),jsx:Pv("jsx",(function(){return Promise.resolve(a("6ho3O"))})),julia:Pv("julia",(function(){return a("g0ibH")})),keepalived:Pv("keepalived",(function(){return a("2hdnH")})),keyman:Pv("keyman",(function(){return a("cIufI")})),kotlin:Pv("kotlin",(function(){return a("c26dU")})),kumir:Pv("kumir",(function(){return a("iYAha")})),kusto:Pv("kusto",(function(){return a("9z1oX")})),latex:Pv("latex",(function(){return a("lCPLU")})),latte:Pv("latte",(function(){return a("c9oN0")})),less:Pv("less",(function(){return a("hA3V9")})),lilypond:Pv("lilypond",(function(){return a("hpHTA")})),liquid:Pv("liquid",(function(){return a("kpZTm")})),lisp:Pv("lisp",(function(){return a("chgK5")})),livescript:Pv("livescript",(function(){return a("2gdiv")})),llvm:Pv("llvm",(function(){return a("jUeFO")})),log:Pv("log",(function(){return a("3BFSQ")})),lolcode:Pv("lolcode",(function(){return a("lG9br")})),lua:Pv("lua",(function(){return a("cVGpd")})),magma:Pv("magma",(function(){return a("4LVzY")})),makefile:Pv("makefile",(function(){return a("2NviD")})),markdown:Pv("markdown",(function(){return a("jUFCF")})),markupTemplating:Pv("markupTemplating",(function(){return Promise.resolve(a("t3W0d"))})),markup:Pv("markup",(function(){return a("5hIXu")})),matlab:Pv("matlab",(function(){return a("kPAC0")})),maxscript:Pv("maxscript",(function(){return a("gHOJy")})),mel:Pv("mel",(function(){return a("9mj6e")})),mermaid:Pv("mermaid",(function(){return a("kozw5")})),mizar:Pv("mizar",(function(){return a("2bN6W")})),mongodb:Pv("mongodb",(function(){return a("eHKWX")})),monkey:Pv("monkey",(function(){return a("7Fh0C")})),moonscript:Pv("moonscript",(function(){return a("hDXwC")})),n1ql:Pv("n1ql",(function(){return a("j9bkC")})),n4js:Pv("n4js",(function(){return a("eTmBF")})),nand2tetrisHdl:Pv("nand2tetrisHdl",(function(){return a("ezjCf")})),naniscript:Pv("naniscript",(function(){return a("VxHk1")})),nasm:Pv("nasm",(function(){return a("ly95T")})),neon:Pv("neon",(function(){return a("7Fk34")})),nevod:Pv("nevod",(function(){return a("3U8Qv")})),nginx:Pv("nginx",(function(){return a("c6qVk")})),nim:Pv("nim",(function(){return a("1JdCk")})),nix:Pv("nix",(function(){return a("jcstS")})),nsis:Pv("nsis",(function(){return a("kEJqW")})),objectivec:Pv("objectivec",(function(){return a("lUP8A")})),ocaml:Pv("ocaml",(function(){return a("lhTAD")})),opencl:Pv("opencl",(function(){return a("8rxKO")})),openqasm:Pv("openqasm",(function(){return a("ib0uL")})),oz:Pv("oz",(function(){return a("csCUS")})),parigp:Pv("parigp",(function(){return a("2DkHE")})),parser:Pv("parser",(function(){return a("2cp75")})),pascal:Pv("pascal",(function(){return a("fViVl")})),pascaligo:Pv("pascaligo",(function(){return a("9Uuxa")})),pcaxis:Pv("pcaxis",(function(){return a("jUdnN")})),peoplecode:Pv("peoplecode",(function(){return a("l8w4e")})),perl:Pv("perl",(function(){return a("aX7dM")})),phpExtras:Pv("phpExtras",(function(){return a("3cMZl")})),php:Pv("php",(function(){return Promise.resolve(a("5li5P"))})),phpdoc:Pv("phpdoc",(function(){return a("bDyJN")})),plsql:Pv("plsql",(function(){return a("cPuMN")})),powerquery:Pv("powerquery",(function(){return a("jE1gU")})),powershell:Pv("powershell",(function(){return a("k7t0j")})),processing:Pv("processing",(function(){return a("jr8hV")})),prolog:Pv("prolog",(function(){return a("hpuat")})),promql:Pv("promql",(function(){return a("ckXC5")})),properties:Pv("properties",(function(){return a("fAh6P")})),protobuf:Pv("protobuf",(function(){return a("R6WqB")})),psl:Pv("psl",(function(){return a("Al65w")})),pug:Pv("pug",(function(){return a("dxbNS")})),puppet:Pv("puppet",(function(){return a("lrSuh")})),pure:Pv("pure",(function(){return a("6DKQK")})),purebasic:Pv("purebasic",(function(){return a("7ZkSb")})),purescript:Pv("purescript",(function(){return a("dBTYx")})),python:Pv("python",(function(){return Promise.resolve(a("kiy5M"))})),q:Pv("q",(function(){return a("4FXyy")})),qml:Pv("qml",(function(){return a("2zZFj")})),qore:Pv("qore",(function(){return a("iCK1Y")})),qsharp:Pv("qsharp",(function(){return a("dvH9H")})),r:Pv("r",(function(){return a("lQqRt")})),racket:Pv("racket",(function(){return a("eHKmq")})),reason:Pv("reason",(function(){return a("kkeLT")})),regex:Pv("regex",(function(){return a("llX50")})),rego:Pv("rego",(function(){return a("9hKdZ")})),renpy:Pv("renpy",(function(){return a("cJgw5")})),rest:Pv("rest",(function(){return a("867DK")})),rip:Pv("rip",(function(){return a("3Odjx")})),roboconf:Pv("roboconf",(function(){return a("gQ0Us")})),robotframework:Pv("robotframework",(function(){return a("bLCgx")})),ruby:Pv("ruby",(function(){return Promise.resolve(a("ch1PX"))})),rust:Pv("rust",(function(){return a("cInT8")})),sas:Pv("sas",(function(){return a("iz7eP")})),sass:Pv("sass",(function(){return a("hrDC3")})),scala:Pv("scala",(function(){return a("ub8Bf")})),scheme:Pv("scheme",(function(){return a("7NAAt")})),scss:Pv("scss",(function(){return Promise.resolve(a("fU6a0"))})),shellSession:Pv("shellSession",(function(){return a("7kKCv")})),smali:Pv("smali",(function(){return a("2lkCb")})),smalltalk:Pv("smalltalk",(function(){return a("4280y")})),smarty:Pv("smarty",(function(){return a("4hXYK")})),sml:Pv("sml",(function(){return a("jh2E8")})),solidity:Pv("solidity",(function(){return a("dTdF2")})),solutionFile:Pv("solutionFile",(function(){return a("iI5tm")})),soy:Pv("soy",(function(){return a("aoU5C")})),sparql:Pv("sparql",(function(){return a("ggrvb")})),splunkSpl:Pv("splunkSpl",(function(){return a("8LhCX")})),sqf:Pv("sqf",(function(){return a("3tDsu")})),sql:Pv("sql",(function(){return Promise.resolve(a("bnDV9"))})),squirrel:Pv("squirrel",(function(){return a("bxaUV")})),stan:Pv("stan",(function(){return a("dBqrq")})),stylus:Pv("stylus",(function(){return a("JlHVK")})),swift:Pv("swift",(function(){return a("c7NBs")})),systemd:Pv("systemd",(function(){return a("jprZl")})),t4Cs:Pv("t4Cs",(function(){return a("edsMI")})),t4Templating:Pv("t4Templating",(function(){return a("bS9Wa")})),t4Vb:Pv("t4Vb",(function(){return a("gYk20")})),tap:Pv("tap",(function(){return a("byv7d")})),tcl:Pv("tcl",(function(){return a("lUAIZ")})),textile:Pv("textile",(function(){return a("7J2LO")})),toml:Pv("toml",(function(){return a("eXtdM")})),tremor:Pv("tremor",(function(){return a("vyajH")})),tsx:Pv("tsx",(function(){return Promise.resolve(a("7cTnl"))})),tt2:Pv("tt2",(function(){return a("8XOOm")})),turtle:Pv("turtle",(function(){return a("1XvLQ")})),twig:Pv("twig",(function(){return a("i9Fpp")})),typescript:Pv("typescript",(function(){return Promise.resolve(a("fzL8k"))})),typoscript:Pv("typoscript",(function(){return a("kKk69")})),unrealscript:Pv("unrealscript",(function(){return a("jgq8Y")})),uorazor:Pv("uorazor",(function(){return a("dsZ00")})),uri:Pv("uri",(function(){return a("fqJRp")})),v:Pv("v",(function(){return a("bgfyB")})),vala:Pv("vala",(function(){return a("68x4q")})),vbnet:Pv("vbnet",(function(){return a("eUhQs")})),velocity:Pv("velocity",(function(){return a("fPNdV")})),verilog:Pv("verilog",(function(){return a("2fM1V")})),vhdl:Pv("vhdl",(function(){return a("hNF6q")})),vim:Pv("vim",(function(){return a("75TCr")})),visualBasic:Pv("visualBasic",(function(){return a("fc93z")})),warpscript:Pv("warpscript",(function(){return a("jgHlG")})),wasm:Pv("wasm",(function(){return a("dVZkI")})),webIdl:Pv("webIdl",(function(){return a("9Jnxv")})),wiki:Pv("wiki",(function(){return a("1Gimo")})),wolfram:Pv("wolfram",(function(){return a("4SyRT")})),wren:Pv("wren",(function(){return a("gaIVs")})),xeora:Pv("xeora",(function(){return a("lagad")})),xmlDoc:Pv("xmlDoc",(function(){return a("9DNYE")})),xojo:Pv("xojo",(function(){return a("ksF4f")})),xquery:Pv("xquery",(function(){return a("gXxHJ")})),yaml:Pv("yaml",(function(){return a("6rk3j")})),yang:Pv("yang",(function(){return a("kTyrQ")})),zig:Pv("zig",(function(){return a("d3mFC")}))},Lv=(Cv=(Ev={loader:function(){return a("bB2YF").then((function(e){return e.default||e}))},isLanguageRegistered:function(e,t){return e.registered(t)},languageLoaders:Nv,registerLanguage:function(e,t,n){return e.register(n)}}).loader,kv=Ev.isLanguageRegistered,Tv=Ev.registerLanguage,Iv=Ev.languageLoaders,Ov=Ev.noAsyncLoadingLanguages,Rv=function(e){r(Ug)(i,e);var t,n=Av(i);function i(){return r(Pg)(this,i),n.apply(this,arguments)}return r(Ng)(i,[{key:"componentDidUpdate",value:function(){!i.isRegistered(this.props.language)&&Iv&&this.loadLanguage()}},{key:"componentDidMount",value:function(){var e=this;i.astGeneratorPromise||i.loadAstGenerator(),i.astGenerator||i.astGeneratorPromise.then((function(){e.forceUpdate()})),!i.isRegistered(this.props.language)&&Iv&&this.loadLanguage()}},{key:"loadLanguage",value:function(){var e=this,t=this.props.language;"text"!==t&&i.loadLanguage(t).then((function(){return e.forceUpdate()})).catch((function(){}))}},{key:"normalizeLanguage",value:function(e){return i.isSupportedLanguage(e)?e:"text"}},{key:"render",value:function(){return r(u).createElement(i.highlightInstance,r(Og)({},this.props,{language:this.normalizeLanguage(this.props.language),astGenerator:i.astGenerator}))}}],[{key:"preload",value:function(){return i.loadAstGenerator()}},{key:"loadLanguage",value:(t=r(Tg)(r(Jg).mark((function e(t){var n;return r(Jg).wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof(n=Iv[t])){e.next=5;break}return e.abrupt("return",n(i.registerLanguage));case 5:throw new Error("Language ".concat(t," not supported"));case 6:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"isSupportedLanguage",value:function(e){return i.isRegistered(e)||"function"==typeof Iv[e]}},{key:"loadAstGenerator",value:function(){return i.astGeneratorPromise=Cv().then((function(e){i.astGenerator=e,Tv&&i.languages.forEach((function(t,n){return Tv(e,n,t)}))})),i.astGeneratorPromise}}]),i}(r(u).PureComponent),r(Yg)(Rv,"astGenerator",null),r(Yg)(Rv,"highlightInstance",_v(null,{})),r(Yg)(Rv,"astGeneratorPromise",null),r(Yg)(Rv,"languages",new Map),r(Yg)(Rv,"supportedLanguages",Ev.supportedLanguages||Object.keys(Iv||{})),r(Yg)(Rv,"isRegistered",(function(e){if(Ov)return!0;if(!Tv)throw new Error("Current syntax highlighter doesn't support registration of languages");return Rv.astGenerator?kv(Rv.astGenerator,e):Rv.languages.has(e)})),r(Yg)(Rv,"registerLanguage",(function(e,t){if(!Tv)throw new Error("Current syntax highlighter doesn't support registration of languages");if(Rv.astGenerator)return Tv(Rv.astGenerator,e,t);Rv.languages.set(e,t)})),Rv),Dv={},Bv={};(Bv=function(e){return e&&e.__esModule?e:{default:e}}).__esModule=!0,Bv.default=Bv,Object.defineProperty(Dv,"__esModule",{value:!0}),Object.defineProperty(Dv,"a11yDark",{enumerable:!0,get:function(){return qv.default}}),Object.defineProperty(Dv,"atomDark",{enumerable:!0,get:function(){return Kv.default}}),Object.defineProperty(Dv,"base16AteliersulphurpoolLight",{enumerable:!0,get:function(){return Yv.default}}),Object.defineProperty(Dv,"cb",{enumerable:!0,get:function(){return Jv.default}}),Object.defineProperty(Dv,"coldarkCold",{enumerable:!0,get:function(){return Qv.default}}),Object.defineProperty(Dv,"coldarkDark",{enumerable:!0,get:function(){return Xv.default}}),Object.defineProperty(Dv,"coy",{enumerable:!0,get:function(){return jv.default}}),Object.defineProperty(Dv,"coyWithoutShadows",{enumerable:!0,get:function(){return Zv.default}}),Object.defineProperty(Dv,"darcula",{enumerable:!0,get:function(){return $v.default}}),Object.defineProperty(Dv,"dark",{enumerable:!0,get:function(){return Fv.default}}),Object.defineProperty(Dv,"dracula",{enumerable:!0,get:function(){return ey.default}}),Object.defineProperty(Dv,"duotoneDark",{enumerable:!0,get:function(){return ty.default}}),Object.defineProperty(Dv,"duotoneEarth",{enumerable:!0,get:function(){return ny.default}}),Object.defineProperty(Dv,"duotoneForest",{enumerable:!0,get:function(){return ry.default}}),Object.defineProperty(Dv,"duotoneLight",{enumerable:!0,get:function(){return iy.default}}),Object.defineProperty(Dv,"duotoneSea",{enumerable:!0,get:function(){return oy.default}}),Object.defineProperty(Dv,"duotoneSpace",{enumerable:!0,get:function(){return ay.default}}),Object.defineProperty(Dv,"funky",{enumerable:!0,get:function(){return Uv.default}}),Object.defineProperty(Dv,"ghcolors",{enumerable:!0,get:function(){return sy.default}}),Object.defineProperty(Dv,"gruvboxDark",{enumerable:!0,get:function(){return ly.default}}),Object.defineProperty(Dv,"gruvboxLight",{enumerable:!0,get:function(){return cy.default}}),Object.defineProperty(Dv,"holiTheme",{enumerable:!0,get:function(){return uy.default}}),Object.defineProperty(Dv,"hopscotch",{enumerable:!0,get:function(){return dy.default}}),Object.defineProperty(Dv,"lucario",{enumerable:!0,get:function(){return fy.default}}),Object.defineProperty(Dv,"materialDark",{enumerable:!0,get:function(){return hy.default}}),Object.defineProperty(Dv,"materialLight",{enumerable:!0,get:function(){return py.default}}),Object.defineProperty(Dv,"materialOceanic",{enumerable:!0,get:function(){return my.default}}),Object.defineProperty(Dv,"nightOwl",{enumerable:!0,get:function(){return gy.default}}),Object.defineProperty(Dv,"nord",{enumerable:!0,get:function(){return vy.default}}),Object.defineProperty(Dv,"okaidia",{enumerable:!0,get:function(){return zv.default}}),Object.defineProperty(Dv,"oneDark",{enumerable:!0,get:function(){return yy.default}}),Object.defineProperty(Dv,"oneLight",{enumerable:!0,get:function(){return by.default}}),Object.defineProperty(Dv,"pojoaque",{enumerable:!0,get:function(){return wy.default}}),Object.defineProperty(Dv,"prism",{enumerable:!0,get:function(){return Gv.default}}),Object.defineProperty(Dv,"shadesOfPurple",{enumerable:!0,get:function(){return xy.default}}),Object.defineProperty(Dv,"solarizedDarkAtom",{enumerable:!0,get:function(){return Sy.default}}),Object.defineProperty(Dv,"solarizedlight",{enumerable:!0,get:function(){return Hv.default}}),Object.defineProperty(Dv,"synthwave84",{enumerable:!0,get:function(){return My.default}}),Object.defineProperty(Dv,"tomorrow",{enumerable:!0,get:function(){return Vv.default}}),Object.defineProperty(Dv,"twilight",{enumerable:!0,get:function(){return Wv.default}}),Object.defineProperty(Dv,"vs",{enumerable:!0,get:function(){return _y.default}}),Object.defineProperty(Dv,"vscDarkPlus",{enumerable:!0,get:function(){return Ay.default}}),Object.defineProperty(Dv,"xonokai",{enumerable:!0,get:function(){return Ey.default}}),Object.defineProperty(Dv,"zTouch",{enumerable:!0,get:function(){return Cy.default}});var jv=Bv(a("jcF8U")),Fv=Bv(a("3Tppx")),Uv=Bv(a("dBuK7")),zv=Bv(a("eEjWK")),Hv=Bv(a("awG2g")),Vv=Bv(a("2oFzQ")),Wv=Bv(a("4Au6Q")),Gv=Bv(a("dAPqs")),qv=Bv(a("8eAql")),Kv=Bv(a("cv2QE")),Yv=Bv(a("h5I9g")),Jv=Bv(a("i4C5w")),Qv=Bv(a("3kFKo")),Xv=Bv(a("17zK0")),Zv=Bv(a("5Avqr")),$v=Bv(a("1jHMv")),ey=Bv(a("7Q8CE")),ty=Bv(a("jKUos")),ny=Bv(a("Uzm4J")),ry=Bv(a("7yfkN")),iy=Bv(a("lT2l1")),oy=Bv(a("fZ9um")),ay=Bv(a("1MoQL")),sy=Bv(a("4uys7")),ly=Bv(a("kaYsk")),cy=Bv(a("kN6Vu")),uy=Bv(a("2Z6pG")),dy=Bv(a("4jQJK")),fy=Bv(a("bpXw0")),hy=Bv(a("i4S8s")),py=Bv(a("5bNr4")),my=Bv(a("5ZYWT")),gy=Bv(a("ihJCU")),vy=Bv(a("8iIbg")),yy=Bv(a("424u7")),by=Bv(a("jPiNI")),wy=Bv(a("OHVOA")),xy=Bv(a("2OKTL")),Sy=Bv(a("2Mg8H")),My=Bv(a("9Kud0")),_y=Bv(a("eCrmR")),Ay=Bv(a("8UhcQ")),Ey=Bv(a("dtU9z")),Cy=Bv(a("4xtLO")),ky={};Object.defineProperty(ky,"__esModule",{value:!0}),ky.default=void 0;var Ty=Bv(a("7cTnl")).default;ky.default=Ty;var Iy={};Object.defineProperty(Iy,"__esModule",{value:!0}),Iy.default=void 0;var Oy=Bv(a("l1Rj1")).default;Iy.default=Oy;var Ry={};Object.defineProperty(Ry,"__esModule",{value:!0}),Ry.default=void 0;var Py=Bv(a("fU6a0")).default;Ry.default=Py;var Ny={};Object.defineProperty(Ny,"__esModule",{value:!0}),Ny.default=void 0;var Ly=Bv(a("3aDLI")).default;Ny.default=Ly;var Dy={};Object.defineProperty(Dy,"__esModule",{value:!0}),Dy.default=void 0;var By=Bv(a("kiy5M")).default;Dy.default=By;var jy={};Object.defineProperty(jy,"__esModule",{value:!0}),jy.default=void 0;var Fy=Bv(a("lR39A")).default;jy.default=Fy;var Uy={};Object.defineProperty(Uy,"__esModule",{value:!0}),Uy.default=void 0;var zy=Bv(a("5li5P")).default;Uy.default=zy;var Hy={};Object.defineProperty(Hy,"__esModule",{value:!0}),Hy.default=void 0;var Vy=Bv(a("ch1PX")).default;Hy.default=Vy;var Wy={};Object.defineProperty(Wy,"__esModule",{value:!0}),Wy.default=void 0;var Gy=Bv(a("bnDV9")).default;Wy.default=Gy,Lv.registerLanguage("tsx",r(ky)),Lv.registerLanguage("json",r(Iy)),Lv.registerLanguage("scss",r(Ry)),Lv.registerLanguage("bash",r(Ny)),Lv.registerLanguage("python",r(Dy)),Lv.registerLanguage("cpp",r(jy)),Lv.registerLanguage("php",r(Uy)),Lv.registerLanguage("ruby",r(Hy)),Lv.registerLanguage("sql",r(Wy));var qy=({medium:e,className:t,preview:n=!1})=>{var r,i,o,a;const{t:l}=Te();return(0,s.jsxs)("div",{className:"memori-snippet",children:[(0,s.jsxs)("div",{className:"memori-snippet--content",children:[(0,s.jsx)(Lv,{"aria-labelledby":`#snippet-${e.mediumID}`,className:t,style:Dv.atomDark,showLineNumbers:!0,language:null!==(i=null===(r=Eg.find((t=>e.mimeType===t.mimeType)))||void 0===r?void 0:r.lang)&&void 0!==i?i:"text",children:(null===(o=e.content)||void 0===o?void 0:o.length)&&e.content.length>200&&n?`${e.content.slice(0,200)}\n...`:`${e.content}`}),(0,s.jsx)(Zd,{padded:!1,ghost:!0,className:"memori-snippet--copy-button",title:l("copy")||"Copy",icon:(0,s.jsx)(kg,{}),onClick:()=>{var t;return navigator.clipboard.writeText(null!==(t=e.content)&&void 0!==t?t:"")}})]}),!!(null===(a=e.title)||void 0===a?void 0:a.length)&&(0,s.jsx)("p",{id:`snippet-${e.mediumID}`,className:"memori-snippet--caption",children:e.title})]})};var Ky=({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:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"})});var Yy=({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:"M531.3 574.4l.3-1.4c5.8-23.9 13.1-53.7 7.4-80.7-3.8-21.3-19.5-29.6-32.9-30.2-15.8-.7-29.9 8.3-33.4 21.4-6.6 24-.7 56.8 10.1 98.6-13.6 32.4-35.3 79.5-51.2 107.5-29.6 15.3-69.3 38.9-75.2 68.7-1.2 5.5.2 12.5 3.5 18.8 3.7 7 9.6 12.4 16.5 15 3 1.1 6.6 2 10.8 2 17.6 0 46.1-14.2 84.1-79.4 5.8-1.9 11.8-3.9 17.6-5.9 27.2-9.2 55.4-18.8 80.9-23.1 28.2 15.1 60.3 24.8 82.1 24.8 21.6 0 30.1-12.8 33.3-20.5 5.6-13.5 2.9-30.5-6.2-39.6-13.2-13-45.3-16.4-95.3-10.2-24.6-15-40.7-35.4-52.4-65.8zM421.6 726.3c-13.9 20.2-24.4 30.3-30.1 34.7 6.7-12.3 19.8-25.3 30.1-34.7zm87.6-235.5c5.2 8.9 4.5 35.8.5 49.4-4.9-19.9-5.6-48.1-2.7-51.4.8.1 1.5.7 2.2 2zm-1.6 120.5c10.7 18.5 24.2 34.4 39.1 46.2-21.6 4.9-41.3 13-58.9 20.2-4.2 1.7-8.3 3.4-12.3 5 13.3-24.1 24.4-51.4 32.1-71.4zm155.6 65.5c.1.2.2.5-.4.9h-.2l-.2.3c-.8.5-9 5.3-44.3-8.6 40.6-1.9 45 7.3 45.1 7.4zm191.4-388.2L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"})});var Jy=({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:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0 0 10.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 0 0-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"})});var Qy=({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:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 0 0-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 0 0-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"})});const Xy=({isChild:e=!1,item:t,sessionID:n,tenantID:r,preview:i=!1,baseURL:o,apiURL:a,onClick:l})=>{const c=jm({resourceURI:t.url,sessionID:n,tenantID:r,baseURL:o,apiURL:a});switch(t.mimeType){case"image/jpeg":case"image/png":case"image/jpg":case"image/gif":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,onClick:n=>{e&&n.preventDefault(),l&&(n.preventDefault(),l(t.mediumID))},target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,className:"memori-media-item--card memori-media-item--image",cover:(0,s.jsxs)("picture",{className:"memori-media-item--figure",children:[!i&&(0,s.jsx)("source",{srcSet:[c,t.url,t.content].join(", "),type:t.mimeType}),(0,s.jsx)("img",{alt:t.title,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="}),t.title&&(0,s.jsx)("figcaption",{className:"memori-media-item--figure-caption",children:t.title})]})})});case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)(Qy,{className:"memori-media-item--icon"}),title:t.title})});case"application/vnd.ms-excel":case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)(Jy,{className:"memori-media-item--icon"}),title:t.title})});case"application/pdf":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)(Yy,{className:"memori-media-item--icon"}),title:t.title})});case"video/mp4":case"video/avi":case"video/mpeg":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,onClick:n=>{e&&n.preventDefault(),l&&(n.preventDefault(),l(t.mediumID))},target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)("video",{style:{width:"100%",height:"100%"},controls:!0,src:c,title:t.title}),title:t.title})});case"audio/mpeg3":case"audio/wav":case"audio/mpeg":return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)("audio",{style:{width:"100%",height:"100%"},controls:!0,src:c}),title:t.title})});case"model/gltf-binary":return(0,s.jsx)(Cg,{src:c,alt:"",poster:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="});default:return(0,s.jsx)("a",{className:"memori-media-item--link",href:c,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(yg,{hoverable:!0,cover:(0,s.jsx)(Ky,{className:"memori-media-item--icon"}),title:t.title})})}};var Zy=({items:e,sessionID:t,tenantID:n,translateTo:r,baseURL:i,apiURL:o})=>{const[a,l]=(0,u.useState)(e),[c,d]=(0,u.useState)(),f=(0,u.useCallback)((async()=>{if(!r)return;const t=await Promise.all((null!=e?e:[]).map((async e=>{var t;if(!e.title)return e;try{const n=await Sg(e.title,r);return{...e,title:null!==(t=n.text)&&void 0!==t?t:e.title}}catch(t){return console.error(t),e}})));l(t)}),[r,e]);return(0,u.useEffect)((()=>{r&&f()}),[r,f]),(0,u.useEffect)((()=>{e.filter((e=>{var t;return"text/javascript"===e.mimeType&&!!(null===(t=e.properties)||void 0===t?void 0:t.executable)})).forEach((e=>{var t;try{new Function(null!==(t=e.content)&&void 0!==t?t:"")()}catch(e){console.error(e)}}))}),[]),(0,s.jsxs)(Jf,{appear:!0,show:!0,as:"div",className:"memori-media-items",children:[(0,s.jsx)("div",{className:"memori-media-items--grid",children:a.filter((e=>{var t;return!(null===(t=e.properties)||void 0===t?void 0:t.executable)&&!Eg.map((e=>e.mimeType)).includes(e.mimeType)})).sort(((e,t)=>e.creationTimestamp>t.creationTimestamp?1:e.creationTimestamp<t.creationTimestamp?-1:0)).map(((e,r)=>(0,s.jsx)(Jf.Child,{as:"div",className:"memori-media-item",enter:"ease-out duration-500 delay-"+100*r,enterFrom:"opacity-0 scale-95",enterTo:"opacity-1 scale-100",leave:"ease-in duration-300",leaveFrom:"opacity-1 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsx)(Xy,{isChild:!0,sessionID:t,tenantID:n,baseURL:i,apiURL:o,onClick:e=>{d(a.find((t=>t.mediumID===e)))},item:{...e,title:e.title,url:e.url,content:e.content}})},e.url+"&index="+r)))}),a.filter((e=>{var t;return!(null===(t=e.properties)||void 0===t?void 0:t.executable)&&Eg.map((e=>e.mimeType)).includes(e.mimeType)})).map((e=>(0,s.jsx)(Jf.Child,{as:"div",className:"memori-media-item--snippet",enter:"ease-out duration-500",enterFrom:"opacity-0 translate-y-1",enterTo:"opacity-1 translate-y-0",leave:"ease-in duration-300",leaveFrom:"opacity-1",leaveTo:"opacity-0",children:(0,s.jsx)(qy,{medium:e},e.mediumID)},e.mediumID))),a.filter((e=>{var t;return"text/css"===e.mimeType&&!!(null===(t=e.properties)||void 0===t?void 0:t.executable)})).map((e=>(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:e.content||""}},e.mediumID))),(null==c?void 0:c.mediumID)&&(0,s.jsx)(hp,{width:"100%",widthMd:"100%",className:"memori-media-item--modal",open:!!c,onClose:()=>d(void 0),footer:null,children:(0,s.jsx)(Xy,{isChild:!0,sessionID:t,tenantID:n,baseURL:i,apiURL:o,item:{...c,title:c.title,url:c.url,content:c.content}})})]})};Jd=a("4IUwl");var $y=({hints:e=[],links:t=[],media:n=[],simulateUserPrompt:i=(()=>{}),sessionID:o,baseUrl:a,apiUrl:l,translateTo:c})=>{const{t:d}=Te(),[f,h]=(0,u.useState)(!0),[p,m]=(0,u.useState)(6);return(0,u.useEffect)((()=>{h(!0)}),[e]),(0,s.jsxs)("div",{className:"memori-media-widget",children:[(null==n?void 0:n.length)>0&&(0,s.jsx)(Zy,{items:n,sessionID:o,translateTo:c,baseURL:a,apiURL:l}),(null==t?void 0:t.length)>0&&(0,s.jsx)(wg,{items:t,baseUrl:a}),(null==e?void 0:e.length)>0&&f&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Jf,{appear:!0,show:!0,as:"ul",className:"memori-media--hints",children:e.slice(0,p).map(((e,t)=>(0,s.jsx)(Jf.Child,{as:"li",enter:"ease-out duration-500",enterFrom:"opacity-0 translate-y-1",enterTo:"opacity-1 translate-y-0",leave:"ease-in duration-300",leaveFrom:"opacity-1",leaveTo:"opacity-0",children:(0,s.jsx)(Zd,{className:r(Jd)("memori-media--hint"),primary:!0,onClick:()=>{i(e.originalText,e.text),h(!1)},onTouchEnd:()=>{i(e.originalText,e.text),h(!1)},children:e.text},e.text+t)},e.text+t)))}),e.length>p&&(0,s.jsx)("div",{className:"memori-hints--show-more",children:(0,s.jsx)(Zd,{className:"memori-hints--show-more-button",id:"showMoreHints",onClick:()=>m(p+6),children:d("expand")||"Expand"})})]})]})};Jd=a("4IUwl");var eb=({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:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2zM304 456a88 88 0 1 0 0-176 88 88 0 0 0 0 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z"})});var tb=({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:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0 0 12.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0 0 12.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 0 0 174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"})});var nb=({attachmentsMenuOpen:e,setAttachmentsMenuOpen:t,disabled:n=!1,authToken:i})=>(0,s.jsxs)(lg,{as:"div",className:"memori-upload-menu",children:[(0,s.jsx)(lg.Button,{disabled:n,className:r(Jd)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button","memori--conversation-button"),children:(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)(tb,{})})}),(0,s.jsxs)(lg.Items,{as:"ul",className:"memori-menu--overlay",children:[(0,s.jsx)(lg.Item,{as:"li",className:"memori-menu--li",children:(0,s.jsx)(Zd,{className:"memori-menu--button",ghost:!0,icon:(0,s.jsx)(gg,{}),outlined:"link"===e,onClick:()=>t("link"),children:"Link"})}),!!(null==i?void 0:i.length)&&(0,s.jsx)(lg.Item,{children:(0,s.jsx)(Zd,{className:"memori-menu--button",ghost:!0,icon:(0,s.jsx)(eb,{}),outlined:"media"===e,onClick:()=>t("media"),children:"Media"})})]})]});u=a("85Hg2"),u=a("85Hg2");function rb(e=0){let[t,n]=(0,u.useState)(e),r=(0,u.useCallback)((e=>n((t=>t|e))),[t]),i=(0,u.useCallback)((e=>Boolean(t&e)),[t]),o=(0,u.useCallback)((e=>n((t=>t&~e))),[n]),a=(0,u.useCallback)((e=>n((t=>t^e))),[n]);return{addFlag:r,hasFlag:i,removeFlag:o,toggleFlag:a}}let ib=(0,(u=a("85Hg2")).createContext)(null);function ob(){let e=(0,u.useContext)(ib);if(null===e){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,ob),e}return e}function ab(){let[e,t]=(0,u.useState)([]);return[e.length>0?e.join(" "):void 0,(0,u.useMemo)((()=>function(e){let n=xf((e=>(t((t=>[...t,e])),()=>t((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),i=(0,u.useMemo)((()=>({register:n,slot:e.slot,name:e.name,props:e.props})),[n,e.slot,e.name,e.props]);return r(u).createElement(ib.Provider,{value:i},e.children)}),[t])]}let sb=lf((function(e,t){let{passive:n=!1,...r}=e,i=ob(),o=`headlessui-label-${nh()}`,a=_f(t);gf((()=>i.register(o)),[o,i.register]);let s={ref:a,...i.props,id:o};return n&&("onClick"in s&&delete s.onClick,"onClick"in r&&delete r.onClick),of({ourProps:s,theirProps:r,slot:i.slot||{},defaultTag:"label",name:i.name||"Label"})}));function lb(e={},t=null,n=[]){for(let[r,i]of Object.entries(e))ub(n,cb(t,r),i);return n}function cb(e,t){return e?e+"["+t+"]":t}function ub(e,t,n){if(Array.isArray(n))for(let[r,i]of n.entries())ub(e,cb(t,r.toString()),i);else n instanceof Date?e.push([t,n.toISOString()]):"boolean"==typeof n?e.push([t,n?"1":"0"]):"string"==typeof n?e.push([t,n]):"number"==typeof n?e.push([t,`${n}`]):null==n?e.push([t,""]):lb(n,t,e)}function db(e){var t;let n=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(n)for(let e of n.elements)if("INPUT"===e.tagName&&"submit"===e.type||"BUTTON"===e.tagName&&"submit"===e.type||"INPUT"===e.nodeName&&"image"===e.type)return void e.click()}u=a("85Hg2");function fb(e,t,n){let[r,i]=(0,u.useState)(n),o=void 0!==e,a=(0,u.useRef)(o),s=(0,u.useRef)(!1),l=(0,u.useRef)(!1);return!o||a.current||s.current?!o&&a.current&&!l.current&&(l.current=!0,a.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(s.current=!0,a.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[o?e:r,xf((e=>(o||i(e),null==t?void 0:t(e))))]}var hb,pb=((hb=pb||{})[hb.RegisterOption=0]="RegisterOption",hb[hb.UnregisterOption=1]="UnregisterOption",hb);let mb={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:vh(n,(e=>e.element.current))}},1(e,t){let n=e.options.slice(),r=e.options.findIndex((e=>e.id===t.id));return-1===r?e:(n.splice(r,1),{...e,options:n})}},gb=(0,u.createContext)(null);function vb(e){let t=(0,u.useContext)(gb);if(null===t){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,vb),t}return t}function yb(e,t){return $d(t.type,mb,e,t)}gb.displayName="RadioGroupContext";let bb=lf((function(e,t){let{value:n,defaultValue:i,name:o,onChange:a,by:s=((e,t)=>e===t),disabled:l=!1,...c}=e,d=xf("string"==typeof s?(e,t)=>{let n=s;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:s),[f,h]=(0,u.useReducer)(yb,{options:[]}),p=f.options,[m,g]=ab(),[v,y]=Wh(),b=`headlessui-radiogroup-${nh()}`,w=(0,u.useRef)(null),x=_f(w,t),[S,M]=fb(n,a,i),_=(0,u.useMemo)((()=>p.find((e=>!e.propsRef.current.disabled))),[p]),A=(0,u.useMemo)((()=>p.some((e=>d(e.propsRef.current.value,S)))),[p,S]),E=xf((e=>{var t;if(l||d(e,S))return!1;let n=null==(t=p.find((t=>d(t.propsRef.current.value,e))))?void 0:t.propsRef.current;return(null==n||!n.disabled)&&(null==M||M(e),!0)}));Wm({container:w.current,accept:e=>"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let C=xf((e=>{let t=w.current;if(!t)return;let n=oh(t),r=p.filter((e=>!1===e.propsRef.current.disabled)).map((e=>e.element.current));switch(e.key){case Xf.Enter:db(e.currentTarget);break;case Xf.ArrowLeft:case Xf.ArrowUp:if(e.preventDefault(),e.stopPropagation(),bh(r,lh.Previous|lh.WrapAround)===ch.Success){let e=p.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&E(e.propsRef.current.value)}break;case Xf.ArrowRight:case Xf.ArrowDown:if(e.preventDefault(),e.stopPropagation(),bh(r,lh.Next|lh.WrapAround)===ch.Success){let e=p.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&E(e.propsRef.current.value)}break;case Xf.Space:{e.preventDefault(),e.stopPropagation();let t=p.find((e=>e.element.current===(null==n?void 0:n.activeElement)));t&&E(t.propsRef.current.value)}}})),k=xf((e=>(h({type:0,...e}),()=>h({type:1,id:e.id})))),T=(0,u.useMemo)((()=>({registerOption:k,firstOption:_,containsCheckedOption:A,change:E,disabled:l,value:S,compare:d})),[k,_,A,E,l,S,d]),I={ref:x,id:b,role:"radiogroup","aria-labelledby":m,"aria-describedby":v,onKeyDown:C},O=(0,u.useMemo)((()=>({value:S})),[S]);return r(u).createElement(y,{name:"RadioGroup.Description"},r(u).createElement(g,{name:"RadioGroup.Label"},r(u).createElement(gb.Provider,{value:T},null!=o&&null!=S&&lb({[o]:S}).map((([e,t])=>r(u).createElement(ih,{features:rh.Hidden,...cf({key:e,as:"input",type:"radio",checked:null!=t,hidden:!0,readOnly:!0,name:e,value:t})}))),of({ourProps:I,theirProps:c,slot:O,defaultTag:"div",name:"RadioGroup"}))))}));var wb=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(wb||{});let xb=lf((function(e,t){let n=(0,u.useRef)(null),i=_f(n,t),o=`headlessui-radiogroup-option-${nh()}`,[a,s]=ab(),[l,c]=Wh(),{addFlag:d,removeFlag:f,hasFlag:h}=rb(1),{value:p,disabled:m=!1,...g}=e,v=(0,u.useRef)({value:p,disabled:m});gf((()=>{v.current.value=p}),[p,v]),gf((()=>{v.current.disabled=m}),[m,v]);let{registerOption:y,disabled:b,change:w,firstOption:x,containsCheckedOption:S,value:M,compare:_}=vb("RadioGroup.Option");gf((()=>y({id:o,element:n,propsRef:v})),[o,y,n,e]);let A=xf((e=>{var t;if(Zf(e.currentTarget))return e.preventDefault();!w(p)||(d(2),null==(t=n.current)||t.focus())})),E=xf((e=>{if(Zf(e.currentTarget))return e.preventDefault();d(2)})),C=xf((()=>f(2))),k=(null==x?void 0:x.id)===o,T=b||m,I=_(M,p),O={ref:i,id:o,role:"radio","aria-checked":I?"true":"false","aria-labelledby":a,"aria-describedby":l,"aria-disabled":!!T||void 0,tabIndex:T?-1:I||!S&&k?0:-1,onClick:T?void 0:A,onFocus:T?void 0:E,onBlur:T?void 0:C},R=(0,u.useMemo)((()=>({checked:I,disabled:T,active:h(2)})),[I,T,h]);return r(u).createElement(c,{name:"RadioGroup.Description"},r(u).createElement(s,{name:"RadioGroup.Label"},of({ourProps:O,theirProps:g,slot:R,defaultTag:"div",name:"RadioGroup.Option"})))})),Sb=Object.assign(bb,{Option:xb,Label:sb,Description:Gh});Jd=a("4IUwl");var Mb=({sendOnEnter:e,setSendOnEnter:t})=>{const{t:n}=Te();return(0,s.jsxs)(lg,{as:"div",className:"memori-send-on-enter-menu",children:[(0,s.jsx)(lg.Button,{className:r(Jd)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button","memori--conversation-button"),children:(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)("span",{style:{display:"block",width:"1rem",height:"1rem"},children:"…"})})}),(0,s.jsx)(lg.Items,{className:"memori-menu--overlay",children:(0,s.jsxs)(Sb,{value:e,onChange:t,children:[(0,s.jsx)(Sb.Option,{value:"keypress",className:"memori-menu--option",children:({checked:e})=>(0,s.jsx)(lg.Item,{children:(0,s.jsx)(Zd,{className:"memori-menu--button",ghost:!0,outlined:e,icon:(0,s.jsx)("span",{className:"memori-menu--icon",children:e?"✓":""}),children:n("widget.sendOnKeypress")})})}),(0,s.jsx)(Sb.Option,{value:"click",className:"memori-menu--option",children:({checked:e})=>(0,s.jsx)(lg.Item,{children:(0,s.jsx)(Zd,{className:"memori-menu--button",ghost:!0,outlined:e,icon:(0,s.jsx)("span",{className:"memori-menu--icon",children:e?"✓":""}),children:n("widget.sendOnClick")})})})]})})]})};u=a("85Hg2"),Jd=a("4IUwl");var _b=({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:"M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 0 0 0 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0 0 13.5-4.7L863.9 169a7.9 7.9 0 0 0-8.9-8.9zM416.6 562.3a8.03 8.03 0 0 0-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 0 0-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"})});var Ab=({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:"M391 240.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L200 146.3a8.03 8.03 0 0 0-11.3 0l-42.4 42.3a8.03 8.03 0 0 0 0 11.3L280 333.6l-43.9 43.9a8.01 8.01 0 0 0 4.7 13.6L401 410c5.1.6 9.5-3.7 8.9-8.9L391 240.9zm10.1 373.2L240.8 633c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L146.3 824a8.03 8.03 0 0 0 0 11.3l42.4 42.3c3.1 3.1 8.2 3.1 11.3 0L333.7 744l43.7 43.7A8.01 8.01 0 0 0 391 783l18.9-160.1c.6-5.1-3.7-9.4-8.8-8.8zm221.8-204.2L783.2 391c6.6-.8 9.4-8.9 4.7-13.6L744 333.6 877.7 200c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.3a8.03 8.03 0 0 0-11.3 0L690.3 279.9l-43.7-43.7a8.01 8.01 0 0 0-13.6 4.7L614.1 401c-.6 5.2 3.7 9.5 8.8 8.9zM744 690.4l43.9-43.9a8.01 8.01 0 0 0-4.7-13.6L623 614c-5.1-.6-9.5 3.7-8.9 8.9L633 783.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L824 877.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L744 690.4z"})});var Eb=({disabled:e=!1,value:t,onChange:n,onPressEnter:i,onFocus:o,onBlur:a})=>{const[l,c]=(0,u.useState)(!1);return(0,s.jsx)("div",{"data-testid":"chat-textarea",className:r(Jd)("memori-chat-textarea",{"memori-chat-textarea--expanded":l,"memori-chat-textarea--disabled":e}),children:(0,s.jsxs)("div",{className:"memori-chat-textarea--inner",children:[(0,s.jsx)("textarea",{className:"memori-chat-textarea--input",disabled:e,value:t,onChange:e=>{n(e.target.value)},onKeyDownCapture:e=>{"Enter"===e.key&&!e.shiftKey&&i&&i(e)},onFocus:o,onBlur:a}),(0,s.jsx)("div",{className:"memori-chat-textarea--expand",children:(0,s.jsx)(Zd,{className:r(Jd)("memori-chat-textarea--expand-button"),onClick:()=>c(!l),padded:!1,ghost:!0,icon:l?(0,s.jsx)(Ab,{}):(0,s.jsx)(_b,{})})})]})})};var Cb=({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:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2-8.5 2.1-13.8 10.7-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})});u=a("85Hg2");var kb=({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:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"})});Jd=a("4IUwl");var Tb=({listening:e,stopAudio:t,startListening:n,stopListening:i})=>{const{t:o}=Te(),[a,l]=(0,u.useState)(),c=(0,u.useRef)(null),d=e=>{e.preventDefault(),l(o("write_and_speak.holdToSpeak")||"Hold to record"),c.current||(c.current=setTimeout((()=>{t(),l(o("write_and_speak.releaseToEndListening")||"Release to end listening"),n()}),300))},f=()=>{c.current&&(clearTimeout(c.current),c.current=null),i(),l(void 0)};return(0,u.useEffect)((()=>()=>f()),[]),(0,s.jsx)(zm,{visible:!!a,content:(0,s.jsx)("span",{children:a||o("write_and_speak.pressAndHoldToSpeak")||"Press and hold to speak"}),align:"topLeft",className:"memori-mic-btn-tooltip",children:(0,s.jsx)(Zd,{primary:!0,className:r(Jd)("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":e}),title:e?o("write_and_speak.micButtonPopoverListening")||"Listening":o("write_and_speak.micButtonPopover")||"Start listening",onMouseDown:d,onTouchStart:d,onMouseUp:f,onMouseLeave:f,onTouchEnd:f,shape:"circle",icon:(0,s.jsx)(kb,{})})})};Jd=a("4IUwl");var Ib=({dialogState:e,instruct:t=!1,sendOnEnter:n="click",setSendOnEnter:i,attachmentsMenuOpen:o,setAttachmentsMenuOpen:a,userMessage:l="",onChangeUserMessage:c,sendMessage:u,onTextareaFocus:d,onTextareaBlur:f,onTextareaPressEnter:h,showMicrophone:p=!1,microphoneMode:m="HOLD_TO_TALK",listening:g=!1,stopAudio:v,startListening:y,stopListening:b,authToken:w})=>{const{t:x}=Te();return(0,s.jsxs)("fieldset",{id:"chat-fieldset",className:"memori-chat-inputs",disabled:"X2a"===(null==e?void 0:e.state)||"X3"===(null==e?void 0:e.state),children:[(t||(null==e?void 0:e.acceptsMedia))&&(0,s.jsx)(nb,{attachmentsMenuOpen:o,setAttachmentsMenuOpen:a,authToken:w,disabled:!(null==e?void 0:e.acceptsMedia)}),(0,s.jsx)(Mb,{sendOnEnter:n,setSendOnEnter:i}),(0,s.jsx)(Eb,{value:l,onChange:c,onPressEnter:h,onFocus:d,onBlur:f,disabled:["R2","R3","R4","G3","X3"].includes((null==e?void 0:e.state)||"")}),(0,s.jsx)(Zd,{shape:"circle",primary:!!(null==l?void 0:l.length),disabled:!l||0===l.length,className:"memori-chat-inputs--send",onClick:()=>{u(l),v(),speechSynthesis.speak(new SpeechSynthesisUtterance(""))},title:x("send")||"Send",icon:(0,s.jsx)(Cb,{})}),p&&"HOLD_TO_TALK"===m&&(0,s.jsx)(Tb,{listening:g,startListening:y,stopListening:()=>{b(),(null==l?void 0:l.length)&&u(l)},stopAudio:v}),p&&"CONTINUOUS"===m&&(0,s.jsx)(Zd,{primary:!0,className:r(Jd)("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":g}),title:g?x("write_and_speak.micButtonPopoverListening")||"Listening":x("write_and_speak.micButtonPopover")||"Start listening",onClick:()=>{g?b():(v(),y())},shape:"circle",icon:(0,s.jsx)(kb,{})})]})};var Ob=({memori:e,tenant:t,sessionID:n,baseUrl:i,apiUrl:o,translateTo:a,memoriTyping:l,history:c=[],authToken:d,dialogState:f,simulateUserPrompt:h,showDates:p=!1,showContextPerLine:m=!1,showAIicon:g=!0,selectReceiverTag:v,preview:y=!1,instruct:b=!1,showInputs:w=!0,showMicrophone:x=!1,microphoneMode:S="HOLD_TO_TALK",sendOnEnter:M,setSendOnEnter:_,attachmentsMenuOpen:A,setAttachmentsMenuOpen:E,userMessage:C="",onChangeUserMessage:k,sendMessage:T,listening:I,isPlayingAudio:O,stopAudio:R,startListening:P,stopListening:N,resetTranscript:L})=>{var D,B,j,F,U;const z=()=>{setTimeout((()=>{var e,t,n,r,i;document.body.classList.contains("chat-focused")?(null===(e=document.querySelector(".ant-tabs-nav"))||void 0===e||e.scrollIntoView(),null===(t=document.querySelector(".memori-chat--content"))||void 0===t||t.scrollTo(0,null!==(r=null===(n=document.querySelector(".memori-chat--content"))||void 0===n?void 0:n.scrollHeight)&&void 0!==r?r:0)):null===(i=document.querySelector("#end-messages-ref"))||void 0===i||i.scrollIntoView({behavior:"smooth"})}),200)};(0,u.useEffect)((()=>{!y&&z()}),[c,y]);return(0,s.jsxs)("div",{className:r(Jd)("memori-chat--wrapper",{"memori-chat-wrapper--translate":a}),id:"chat-wrapper",lang:null==a?void 0:a.toUpperCase(),"data-memori-lang":null!==(F=null===(j=null===(B=null===(D=e.culture)||void 0===D?void 0:D.split("-"))||void 0===B?void 0:B[0])||void 0===j?void 0:j.toUpperCase())&&void 0!==F?F:"EN",children:[(0,s.jsx)("div",{className:r(Jd)("memori-chat--history",{"memori-chat--history-touch":Dm()}),children:(0,s.jsxs)("div",{className:r(Jd)("memori-chat--content",{"memori-chat--content-touch":Dm()}),children:[(0,s.jsx)("div",{className:r(Jd)("memori-chat--cover"),style:{backgroundImage:`url("${jm({type:"cover",tenantID:null==t?void 0:t.id,resourceURI:e.coverURL,baseURL:i,apiURL:o})}"), url("${jm({type:"cover",tenantID:null==t?void 0:t.id,baseURL:i||"https://app.twincreator.com",apiURL:o})}")`}}),c.map(((l,d)=>{var v,y,b,w;return(0,s.jsxs)(r(u).Fragment,{children:[(0,s.jsx)(pg,{message:l,memori:e,tenant:t,baseUrl:i,apiUrl:o,simulateUserPrompt:h,showAIicon:g,showFeedback:d===c.length-1&&!l.fromUser&&(null==f?void 0:f.acceptsFeedback)}),p&&!!l.timestamp&&(0,s.jsx)("small",{className:"memori-chat--timestamp "+(l.fromUser?"text-right":"text-left"),children:new Intl.DateTimeFormat("it",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(l.timestamp.endsWith("Z")?l.timestamp:`${l.timestamp}Z`))}),m&&!!Object.keys(null!==(v=l.contextVars)&&void 0!==v?v:{}).length&&(0,s.jsx)("div",{className:"memori-chat--context-vars",children:Object.keys(null!==(y=l.contextVars)&&void 0!==y?y:{}).map((e=>{var t,n,r;return"-"===(null===(t=l.contextVars)||void 0===t?void 0:t[e])?(0,s.jsx)("div",{className:"memori-chat--context-tag memori-chat--context-tag-canceled",children:(0,s.jsx)("span",{className:"memori-chat--context-tag-text",children:e})},e):"✔️"===(null===(n=l.contextVars)||void 0===n?void 0:n[e])?(0,s.jsx)("div",{className:"memori-chat--context-tag",children:(0,s.jsx)("span",{className:"memori-chat--context-tag-text",children:e})},e):(0,s.jsx)("div",{className:"memori-chat--context-tag",children:(0,s.jsxs)("span",{className:"memori-chat--context-tag-text",children:[e,": ",null===(r=l.contextVars)||void 0===r?void 0:r[e]]})},e)}))}),(0,s.jsx)($y,{simulateUserPrompt:h,media:null===(b=null==l?void 0:l.media)||void 0===b?void 0:b.filter((e=>"text/html"!==e.mimeType&&"text/plain"!==e.mimeType)),links:null===(w=null==l?void 0:l.media)||void 0===w?void 0:w.filter((e=>"text/html"===e.mimeType)),sessionID:n,baseUrl:i,apiUrl:o,translateTo:a})]},d)})),l&&(0,s.jsx)("div",{className:"memori-chat--bubble",children:(0,s.jsxs)("div",{id:"wave",children:[(0,s.jsx)("span",{className:"dot"}),(0,s.jsx)("span",{className:"dot"}),(0,s.jsx)("span",{className:"dot"})]})}),(null==f?void 0:f.hints)&&f.hints.length>0&&(0,s.jsx)($y,{simulateUserPrompt:h,hints:f.translatedHints?f.translatedHints:f.hints.map((e=>({text:e,originalText:e})))}),(0,s.jsx)("div",{id:"end-messages-ref"})]})}),"X3"===(null==f?void 0:f.state)&&n&&(0,s.jsx)("div",{className:"memori-chat--known-tags",children:Object.keys(null!==(U=f.knownTags)&&void 0!==U?U:{}).filter((t=>t!==e.giverTag)).map((e=>{var t;return(0,s.jsx)(Zd,{icon:(0,s.jsx)("span",{className:"memori-chat--known-tag-icon",children:e}),className:"memori-chat--known-tag",onClick:()=>v(e),children:null===(t=f.knownTags)||void 0===t?void 0:t[e]},e)}))}),w&&(0,s.jsx)(Ib,{userMessage:C,onChangeUserMessage:k,dialogState:f,instruct:b,authToken:d,sendMessage:T,microphoneMode:S,sendOnEnter:M,setSendOnEnter:_,attachmentsMenuOpen:A,setAttachmentsMenuOpen:E,onTextareaPressEnter:()=>{"keypress"===M&&(null==C?void 0:C.length)>0&&(N(),T(C),k(""),L())},onTextareaFocus:()=>{var e,t;N(),Dm()&&window.innerWidth<=768&&(null===(t=null===(e=document.getElementById("chat-wrapper"))||void 0===e?void 0:e.classList)||void 0===t||t.add("chat-focused"),setTimeout((()=>{z()}),300))},onTextareaBlur:()=>{var e,t,n;(null===(t=null===(e=document.getElementById("chat-wrapper"))||void 0===e?void 0:e.classList)||void 0===t?void 0:t.contains("chat-focused"))&&(null===(n=document.getElementById("chat-wrapper"))||void 0===n||n.classList.remove("chat-focused"),z())},startListening:P,stopListening:N,stopAudio:R,listening:I,isPlayingAudio:O,showMicrophone:x})]})};u=a("85Hg2");var Rb=({className:e,title:t})=>(0,s.jsxs)("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:"M140 188h584v164h76V144c0-17.7-14.3-32-32-32H96c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h544v-76H140V188z"}),(0,s.jsx)("path",{d:"M414.3 256h-60.6c-3.4 0-6.4 2.2-7.6 5.4L219 629.4c-.3.8-.4 1.7-.4 2.6 0 4.4 3.6 8 8 8h55.1c3.4 0 6.4-2.2 7.6-5.4L322 540h196.2L422 261.4c-1.3-3.2-4.3-5.4-7.7-5.4zm12.4 228h-85.5L384 360.2 426.7 484zM936 528H800v-93c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v93H592c-13.3 0-24 10.7-24 24v176c0 13.3 10.7 24 24 24h136v152c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V752h136c13.3 0 24-10.7 24-24V552c0-13.3-10.7-24-24-24zM728 680h-88v-80h88v80zm160 0h-88v-80h88v80z"})]});var Pb=({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:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"})});var Nb=({memoriName:e,blockedUntil:t,showGiverInfo:n=!1,showTitle:r=!1,marginLeft:i=!1})=>{const{t:o}=Te(),a=new Date(t);return a>new Date?(0,s.jsx)(zm,{className:"blocked-memori-badge--tooltip",content:(0,s.jsxs)(s.Fragment,{children:[!n&&o("memoriBlockedAnon",{name:e,date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(a)}),n&&o("memoriBlockedUntil",{date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(a)}),n&&` ${o("memoriBlockedReasonExceedChats")}`,n&&(0,s.jsx)("br",{}),n&&`\n${o("memoriBlockedGiverHelper")}`]}),children:(0,s.jsxs)("div",{className:"blocked-memori-badge--wrapper",children:[(0,s.jsx)("div",{className:"blocked-memori-badge "+(i?" margin-left":""),children:(0,s.jsx)(Pb,{className:"blocked-memori-badge--icon"})}),r&&(0,s.jsx)("span",{className:"blocked-memori-badge--title",children:o("memoriBlockedTitle")})]})}):null};u=a("85Hg2"),Jd=a("4IUwl"),u=a("85Hg2"),u=a("85Hg2");function Lb(e,t){let[n,r]=(0,u.useState)(e),i=yf(e);return gf((()=>r(i.current)),[i,r,...t]),n}var Db=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Db||{}),Bb=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Bb||{}),jb=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(jb||{}),Fb=(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))(Fb||{});function Ub(e,t=(e=>e)){let n=null!==e.activeOptionIndex?e.options[e.activeOptionIndex]:null,r=vh(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 zb={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 $d(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=Ub(e),i=Vm(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=Ub(e,(e=>[...e,n]));if(null===e.activeOptionIndex){let{value:i,mode:o,compare:a}=e.propsRef.current,s=t.dataRef.current.value;$d(o,{1:()=>i.some((e=>a(e,s))),0:()=>a(i,s)})&&(r.activeOptionIndex=r.options.indexOf(n))}return{...e,...r}},8:(e,t)=>{let n=Ub(e,(e=>{let n=e.findIndex((e=>e.id===t.id));return-1!==n&&e.splice(n,1),e}));return{...e,...n,activationTrigger:1}}},Hb=(0,u.createContext)(null);function Vb(e){let t=(0,u.useContext)(Hb);if(null===t){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Vb),t}return t}function Wb(e,t){return $d(t.type,zb,e,t)}Hb.displayName="ListboxContext";let Gb=u.Fragment,qb=lf((function(e,t){let{value:n,defaultValue:i,name:o,onChange:a,by:s=((e,t)=>e===t),disabled:l=!1,horizontal:c=!1,multiple:d=!1,...f}=e;const h=c?"horizontal":"vertical";let p=_f(t),[m,g]=fb(n,a,i),v=(0,u.useReducer)(Wb,{listboxState:1,propsRef:{current:{value:m,onChange:g,mode:d?1:0,compare:xf("string"==typeof s?(e,t)=>{let n=s;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:s)}},labelRef:(0,u.createRef)(),buttonRef:(0,u.createRef)(),optionsRef:(0,u.createRef)(),disabled:l,orientation:h,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1}),[{listboxState:y,propsRef:b,optionsRef:w,buttonRef:x},S]=v;b.current.value=m,b.current.mode=d?1:0,gf((()=>{b.current.onChange=e=>$d(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]),gf((()=>S({type:2,disabled:l})),[l]),gf((()=>S({type:3,orientation:h})),[h]),Qh([x,w],((e,t)=>{var n;S({type:1}),hh(t,fh.Loose)||(e.preventDefault(),null==(n=x.current)||n.focus())}),0===y);let M=(0,u.useMemo)((()=>({open:0===y,disabled:l,value:m})),[y,l,m]),_={ref:p};return r(u).createElement(Hb.Provider,{value:v},r(u).createElement(pf,{value:$d(y,{0:ff.Open,1:ff.Closed})},null!=o&&null!=m&&lb({[o]:m}).map((([e,t])=>r(u).createElement(ih,{features:rh.Hidden,...cf({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:e,value:t})}))),of({ourProps:_,theirProps:f,slot:M,defaultTag:Gb,name:"Listbox"})))})),Kb=lf((function(e,t){var n;let[r,i]=Vb("Listbox.Button"),o=_f(r.buttonRef,t),a=`headlessui-listbox-button-${nh()}`,s=Pf(),l=xf((e=>{switch(e.key){case Xf.Space:case Xf.Enter:case Xf.ArrowDown:e.preventDefault(),i({type:0}),s.nextFrame((()=>{r.propsRef.current.value||i({type:4,focus:Hm.First})}));break;case Xf.ArrowUp:e.preventDefault(),i({type:0}),s.nextFrame((()=>{r.propsRef.current.value||i({type:4,focus:Hm.Last})}))}})),c=xf((e=>{if(e.key===Xf.Space)e.preventDefault()})),d=xf((e=>{if(Zf(e.currentTarget))return e.preventDefault();0===r.listboxState?(i({type:1}),s.nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),i({type:0}))})),f=Lb((()=>{if(r.labelRef.current)return[r.labelRef.current.id,a].join(" ")}),[r.labelRef.current,a]),h=(0,u.useMemo)((()=>({open:0===r.listboxState,disabled:r.disabled,value:r.propsRef.current.value})),[r]),p=e;return of({ourProps:{ref:o,id:a,type:qm(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":f,disabled:r.disabled,onKeyDown:l,onKeyUp:c,onClick:d},theirProps:p,slot:h,defaultTag:"button",name:"Listbox.Button"})})),Yb=lf((function(e,t){let[n]=Vb("Listbox.Label"),r=`headlessui-listbox-label-${nh()}`;return of({ourProps:{ref:_f(n.labelRef,t),id:r,onClick:xf((()=>{var e;return null==(e=n.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))},theirProps:e,slot:(0,u.useMemo)((()=>({open:0===n.listboxState,disabled:n.disabled})),[n]),defaultTag:"label",name:"Listbox.Label"})})),Jb=nf.RenderStrategy|nf.Static,Qb=lf((function(e,t){var n;let[r,i]=Vb("Listbox.Options"),o=_f(r.optionsRef,t),a=`headlessui-listbox-options-${nh()}`,s=Pf(),l=Pf(),c=hf(),d=null!==c?c===ff.Open:0===r.listboxState;(0,u.useEffect)((()=>{var e;let t=r.optionsRef.current;!t||0===r.listboxState&&t!==(null==(e=oh(t))?void 0:e.activeElement)&&t.focus({preventScroll:!0})}),[r.listboxState,r.optionsRef]);let f=xf((e=>{switch(l.dispose(),e.key){case Xf.Space:if(""!==r.searchQuery)return e.preventDefault(),e.stopPropagation(),i({type:5,value:e.key});case Xf.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}),Cf().nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})})));break;case $d(r.orientation,{vertical:Xf.ArrowDown,horizontal:Xf.ArrowRight}):return e.preventDefault(),e.stopPropagation(),i({type:4,focus:Hm.Next});case $d(r.orientation,{vertical:Xf.ArrowUp,horizontal:Xf.ArrowLeft}):return e.preventDefault(),e.stopPropagation(),i({type:4,focus:Hm.Previous});case Xf.Home:case Xf.PageUp:return e.preventDefault(),e.stopPropagation(),i({type:4,focus:Hm.First});case Xf.End:case Xf.PageDown:return e.preventDefault(),e.stopPropagation(),i({type:4,focus:Hm.Last});case Xf.Escape:return e.preventDefault(),e.stopPropagation(),i({type:1}),s.nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case Xf.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(i({type:5,value:e.key}),l.setTimeout((()=>i({type:6})),350))}})),h=Lb((()=>{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]),p=(0,u.useMemo)((()=>({open:0===r.listboxState})),[r]),m=e;return of({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":h,"aria-orientation":r.orientation,id:a,onKeyDown:f,role:"listbox",tabIndex:0,ref:o},theirProps:m,slot:p,defaultTag:"ul",features:Jb,visible:d,name:"Listbox.Options"})})),Xb=lf((function(e,t){let{disabled:n=!1,value:r,...i}=e,[o,a]=Vb("Listbox.Option"),s=`headlessui-listbox-option-${nh()}`,l=null!==o.activeOptionIndex&&o.options[o.activeOptionIndex].id===s,{value:c,compare:d}=o.propsRef.current,f=$d(o.propsRef.current.mode,{1:()=>c.some((e=>d(e,r))),0:()=>d(c,r)}),h=(0,u.useRef)(null),p=_f(t,h);gf((()=>{if(0!==o.listboxState||!l||0===o.activationTrigger)return;let e=Cf();return e.requestAnimationFrame((()=>{var e,t;null==(t=null==(e=h.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})),e.dispose}),[h,l,o.listboxState,o.activationTrigger,o.activeOptionIndex]);let m=(0,u.useRef)({disabled:n,value:r,domRef:h});gf((()=>{m.current.disabled=n}),[m,n]),gf((()=>{m.current.value=r}),[m,r]),gf((()=>{var e,t;m.current.textValue=null==(t=null==(e=h.current)?void 0:e.textContent)?void 0:t.toLowerCase()}),[m,h]);let g=xf((()=>o.propsRef.current.onChange(r)));gf((()=>(a({type:7,id:s,dataRef:m}),()=>a({type:8,id:s}))),[m,s]);let v=xf((e=>{if(n)return e.preventDefault();g(),0===o.propsRef.current.mode&&(a({type:1}),Cf().nextFrame((()=>{var e;return null==(e=o.buttonRef.current)?void 0:e.focus({preventScroll:!0})})))})),y=xf((()=>{if(n)return a({type:4,focus:Hm.Nothing});a({type:4,focus:Hm.Specific,id:s})})),b=xf((()=>{n||l||a({type:4,focus:Hm.Specific,id:s,trigger:0})})),w=xf((()=>{n||!l||a({type:4,focus:Hm.Nothing})})),x=(0,u.useMemo)((()=>({active:l,selected:f,disabled:n})),[l,f,n]);return of({ourProps:{id:s,ref:p,role:"option",tabIndex:!0===n?void 0:-1,"aria-disabled":!0===n||void 0,"aria-selected":f,disabled:void 0,onClick:v,onFocus:y,onPointerMove:b,onMouseMove:b,onPointerLeave:w,onMouseLeave:w},theirProps:i,slot:x,defaultTag:"li",name:"Listbox.Option"})})),Zb=Object.assign(qb,{Button:Kb,Label:Yb,Options:Qb,Option:Xb});var $b=({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"})});var ew=({className:e,value:t,displayValue:n,options:i,onChange:o,disabled:a=!1,label:l,placeholder:c})=>(0,s.jsx)("div",{className:r(Jd)("memori-select",e),children:(0,s.jsxs)(Zb,{value:t,onChange:e=>{o(e)},disabled:a,name:"day",children:[(0,s.jsxs)(Zb.Label,{className:"memori-select--label",children:[l,":"]}),(0,s.jsxs)(Zb.Button,{"aria-label":l,className:"memori-select--button",children:[(0,s.jsx)("span",{className:r(Jd)("memori-select--value",{"memori-select--value-placeholder":!t}),children:t?n||t:c}),(0,s.jsx)("span",{className:"memori-select--icon",children:(0,s.jsx)($b,{})})]}),(0,s.jsx)(Jf,{as:u.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(Zb.Options,{className:"memori-select--options",children:i.map((e=>(0,s.jsx)(Zb.Option,{value:e.value,className:"memori-select--option",children:e.label},e.value)))})})]})});var tw=({memori:e,tenant:t,gamificationLevel:n,language:r,userLang:i,setUserLang:o,baseUrl:a,apiUrl:l,position:c,openPositionDrawer:d,integrationConfig:f,instruct:h=!1,clickedStart:p,onClickStart:m,initializeTTS:g})=>{var v,y,b;const{t:w,i18n:x}=Te(),[S,M]=(0,u.useState)(e.description),[_,A]=(0,u.useState)(!0);return(0,u.useEffect)((()=>{var t,n,i,o,s,l;(null!==(n=null===(t=x.language)||void 0===t?void 0:t.toUpperCase())&&void 0!==n?n:"IT")!==(null!==(i=null==r?void 0:r.toUpperCase())&&void 0!==i?i:"IT")&&(null===(o=e.description)||void 0===o?void 0:o.length)&&Sg(e.description,null!==(l=null===(s=x.language)||void 0===s?void 0:s.toUpperCase())&&void 0!==l?l:"IT",r,a).then((e=>{M(e.text)})).catch(console.error)}),[x.language,r,e.description,a]),(0,s.jsxs)("div",{className:"memori--start-panel",children:[(0,s.jsxs)("div",{className:"memori--cover",style:{backgroundImage:`url("${jm({type:"cover",tenantID:null==t?void 0:t.id,resourceURI:e.coverURL,baseURL:a,apiURL:l})}"), url("${jm({type:"cover",tenantID:null==t?void 0:t.id,baseURL:a,apiURL:l})}")`},children:[!!(null===(v=null==n?void 0:n.badge)||void 0===v?void 0:v.length)&&(0,s.jsx)("div",{className:"memori--gamification-badge",children:(0,s.jsx)(zm,{align:"left",content:`${w("gamification.level")} ${n.badge}, ${n.points} ${w("gamification.points")}`,children:(0,s.jsx)("span",{"aria-label":`${w("gamification.level")} ${n.badge}, ${n.points} ${w("gamification.points")}`,children:n.badge})})}),!!e.enableCompletions&&(0,s.jsx)("div",{className:"memori--completions-enabled",children:(0,s.jsx)(zm,{align:"left",content:w("completionsEnabled"),children:(0,s.jsx)("span",{"aria-label":w("completionsEnabled")||"Completions",children:(0,s.jsx)(Um,{})})})}),!!e.nsfw&&(0,s.jsx)("div",{className:"memori--nsfw",children:(0,s.jsx)(zm,{align:"left",content:w("nsfw"),children:(0,s.jsx)("span",{title:w("nsfw")||"NSFW",children:"🔞"})})})]}),(0,s.jsxs)("picture",{className:"memori--avatar",children:[(0,s.jsx)("source",{src:null!==(y=e.avatarURL)&&void 0!==y?y:jm({type:"avatar",tenantID:null==t?void 0:t.id,resourceURI:e.avatarURL,baseURL:a,apiURL:l})}),(0,s.jsx)("img",{alt:e.name,src:e.avatarURL&&e.avatarURL.length>0?jm({type:"avatar",tenantID:null==t?void 0:t.id,resourceURI:e.avatarURL,baseURL:a,apiURL:l}):jm({type:"avatar",tenantID:null==t?void 0:t.id,baseURL:a,apiURL:l})})]}),(0,s.jsx)("h2",{className:"memori--title",children:e.name}),e.needsPosition&&!c&&(0,s.jsxs)("div",{className:"memori--needsPosition",children:[(0,s.jsx)("p",{children:w("write_and_speak.requirePosition")}),(0,s.jsx)(Zd,{primary:!0,onClick:()=>d(),className:"memori--start-button",children:w("widget.position")})]}),(e.needsPosition&&c||!e.needsPosition)&&(0,s.jsxs)("div",{className:"memori--description",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"memori--description-text",children:S&&_?S:e.description}),S!==e.description&&(0,s.jsx)(Zd,{ghost:!0,className:"memori--translation-toggle",icon:(0,s.jsx)(Rb,{}),onClick:()=>{A((e=>!e))},children:w(_?"showOriginalText":"showTranslatedText")})]}),(null==f?void 0:f.multilanguage)&&!h&&(0,s.jsx)("div",{className:"memori--language-chooser",children:(0,s.jsx)(ew,{label:w("write_and_speak.iWantToTalkToIn",{name:e.name})||void 0,value:(null!=i?i:x.language).toUpperCase(),displayValue:null===(b=Mg.find((e=>e.value.toUpperCase()===(null!=i?i:x.language).toUpperCase())))||void 0===b?void 0:b.label,onChange:o,options:Mg.map((e=>({label:e.label,value:e.value.toUpperCase()})))})}),(0,s.jsx)(Zd,{primary:!0,disabled:!!e.blockedUntil&&!e.isGiver,loading:p,onClick:e=>{speechSynthesis.speak(new SpeechSynthesisUtterance("")),g&&g(),m&&m()},className:"memori--start-button",children:w("write_and_speak."+(h?"instructButton":"tryMeButton"))}),(0,s.jsx)("p",{className:"memori--start-description",children:w(h?"write_and_speak.pageInstructExplanation":"write_and_speak.pageTryMeExplanation")}),!!e.blockedUntil&&(0,s.jsx)(Nb,{memoriName:e.name,blockedUntil:e.blockedUntil,showGiverInfo:e.isGiver,showTitle:!0,marginLeft:!0})]})]})},nw=(u=a("85Hg2"),u=a("85Hg2"),{}),rw={};(rw=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}).__esModule=!0,rw.default=rw,(nw=function(e,t){if(null==e)return{};var n,r,i=rw(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}).__esModule=!0,nw.default=nw;u=a("85Hg2");var iw=["forwardedRef"];function ow(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 aw(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ow(Object(n),!0).forEach((function(t){r(X)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ow(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}class sw extends u.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){console.error("Uncaught error:",e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,s.jsxs)("div",{style:{background:"rgba(255, 255, 255, 0.4)",color:"#000",padding:"2rem",borderRadius:"10px"},children:[(0,s.jsx)("h2",{children:this.props.t("error.generic")}),(0,s.jsx)(Zd,{primary:!0,onClick:()=>this.setState({hasError:!1}),children:this.props.t("error.tryAgain")||"Try again"})]}):this.props.children}}var lw=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){function i(i){var o=i.forwardedRef,a=r(nw)(i,iw),s=Te(e,aw(aw({},a),{},{keyPrefix:t.keyPrefix})),l=r(G)(s,3),c=l[0],d=l[1],f=l[2],h=aw(aw({},a),{},{t:c,i18n:d,tReady:f});return t.withRef&&o?h.ref=o:!t.withRef&&o&&(h.forwardedRef=o),(0,u.createElement)(n,h)}i.displayName="withI18nextTranslation(".concat(Ae(n),")"),i.WrappedComponent=n;return t.withRef?(0,u.forwardRef)((function(e,t){return(0,u.createElement)(i,Object.assign({},e,{forwardedRef:t}))})):i}}(["common"])(sw),cw=(u=a("85Hg2"),u=a("85Hg2"),{});e(cw,"REVISION",(()=>uw)),e(cw,"MOUSE",(()=>dw)),e(cw,"TOUCH",(()=>fw)),e(cw,"CullFaceNone",(()=>hw)),e(cw,"CullFaceBack",(()=>pw)),e(cw,"CullFaceFront",(()=>mw)),e(cw,"CullFaceFrontBack",(()=>gw)),e(cw,"BasicShadowMap",(()=>vw)),e(cw,"PCFShadowMap",(()=>yw)),e(cw,"PCFSoftShadowMap",(()=>bw)),e(cw,"VSMShadowMap",(()=>ww)),e(cw,"FrontSide",(()=>xw)),e(cw,"BackSide",(()=>Sw)),e(cw,"DoubleSide",(()=>Mw)),e(cw,"NoBlending",(()=>_w)),e(cw,"NormalBlending",(()=>Aw)),e(cw,"AdditiveBlending",(()=>Ew)),e(cw,"SubtractiveBlending",(()=>Cw)),e(cw,"MultiplyBlending",(()=>kw)),e(cw,"CustomBlending",(()=>Tw)),e(cw,"AddEquation",(()=>Iw)),e(cw,"SubtractEquation",(()=>Ow)),e(cw,"ReverseSubtractEquation",(()=>Rw)),e(cw,"MinEquation",(()=>Pw)),e(cw,"MaxEquation",(()=>Nw)),e(cw,"ZeroFactor",(()=>Lw)),e(cw,"OneFactor",(()=>Dw)),e(cw,"SrcColorFactor",(()=>Bw)),e(cw,"OneMinusSrcColorFactor",(()=>jw)),e(cw,"SrcAlphaFactor",(()=>Fw)),e(cw,"OneMinusSrcAlphaFactor",(()=>Uw)),e(cw,"DstAlphaFactor",(()=>zw)),e(cw,"OneMinusDstAlphaFactor",(()=>Hw)),e(cw,"DstColorFactor",(()=>Vw)),e(cw,"OneMinusDstColorFactor",(()=>Ww)),e(cw,"SrcAlphaSaturateFactor",(()=>Gw)),e(cw,"NeverDepth",(()=>qw)),e(cw,"AlwaysDepth",(()=>Kw)),e(cw,"LessDepth",(()=>Yw)),e(cw,"LessEqualDepth",(()=>Jw)),e(cw,"EqualDepth",(()=>Qw)),e(cw,"GreaterEqualDepth",(()=>Xw)),e(cw,"GreaterDepth",(()=>Zw)),e(cw,"NotEqualDepth",(()=>$w)),e(cw,"MultiplyOperation",(()=>ex)),e(cw,"MixOperation",(()=>tx)),e(cw,"AddOperation",(()=>nx)),e(cw,"NoToneMapping",(()=>rx)),e(cw,"LinearToneMapping",(()=>ix)),e(cw,"ReinhardToneMapping",(()=>ox)),e(cw,"CineonToneMapping",(()=>ax)),e(cw,"ACESFilmicToneMapping",(()=>sx)),e(cw,"CustomToneMapping",(()=>lx)),e(cw,"UVMapping",(()=>cx)),e(cw,"CubeReflectionMapping",(()=>ux)),e(cw,"CubeRefractionMapping",(()=>dx)),e(cw,"EquirectangularReflectionMapping",(()=>fx)),e(cw,"EquirectangularRefractionMapping",(()=>hx)),e(cw,"CubeUVReflectionMapping",(()=>px)),e(cw,"RepeatWrapping",(()=>mx)),e(cw,"ClampToEdgeWrapping",(()=>gx)),e(cw,"MirroredRepeatWrapping",(()=>vx)),e(cw,"NearestFilter",(()=>yx)),e(cw,"NearestMipmapNearestFilter",(()=>bx)),e(cw,"NearestMipMapNearestFilter",(()=>wx)),e(cw,"NearestMipmapLinearFilter",(()=>xx)),e(cw,"NearestMipMapLinearFilter",(()=>Sx)),e(cw,"LinearFilter",(()=>Mx)),e(cw,"LinearMipmapNearestFilter",(()=>_x)),e(cw,"LinearMipMapNearestFilter",(()=>Ax)),e(cw,"LinearMipmapLinearFilter",(()=>Ex)),e(cw,"LinearMipMapLinearFilter",(()=>Cx)),e(cw,"UnsignedByteType",(()=>kx)),e(cw,"ByteType",(()=>Tx)),e(cw,"ShortType",(()=>Ix)),e(cw,"UnsignedShortType",(()=>Ox)),e(cw,"IntType",(()=>Rx)),e(cw,"UnsignedIntType",(()=>Px)),e(cw,"FloatType",(()=>Nx)),e(cw,"HalfFloatType",(()=>Lx)),e(cw,"UnsignedShort4444Type",(()=>Dx)),e(cw,"UnsignedShort5551Type",(()=>Bx)),e(cw,"UnsignedInt248Type",(()=>jx)),e(cw,"AlphaFormat",(()=>Fx)),e(cw,"RGBFormat",(()=>Ux)),e(cw,"RGBAFormat",(()=>zx)),e(cw,"LuminanceFormat",(()=>Hx)),e(cw,"LuminanceAlphaFormat",(()=>Vx)),e(cw,"DepthFormat",(()=>Wx)),e(cw,"DepthStencilFormat",(()=>Gx)),e(cw,"RedFormat",(()=>qx)),e(cw,"RedIntegerFormat",(()=>Kx)),e(cw,"RGFormat",(()=>Yx)),e(cw,"RGIntegerFormat",(()=>Jx)),e(cw,"RGBAIntegerFormat",(()=>Qx)),e(cw,"RGB_S3TC_DXT1_Format",(()=>Xx)),e(cw,"RGBA_S3TC_DXT1_Format",(()=>Zx)),e(cw,"RGBA_S3TC_DXT3_Format",(()=>$x)),e(cw,"RGBA_S3TC_DXT5_Format",(()=>eS)),e(cw,"RGB_PVRTC_4BPPV1_Format",(()=>tS)),e(cw,"RGB_PVRTC_2BPPV1_Format",(()=>nS)),e(cw,"RGBA_PVRTC_4BPPV1_Format",(()=>rS)),e(cw,"RGBA_PVRTC_2BPPV1_Format",(()=>iS)),e(cw,"RGB_ETC1_Format",(()=>oS)),e(cw,"RGB_ETC2_Format",(()=>aS)),e(cw,"RGBA_ETC2_EAC_Format",(()=>sS)),e(cw,"RGBA_ASTC_4x4_Format",(()=>lS)),e(cw,"RGBA_ASTC_5x4_Format",(()=>cS)),e(cw,"RGBA_ASTC_5x5_Format",(()=>uS)),e(cw,"RGBA_ASTC_6x5_Format",(()=>dS)),e(cw,"RGBA_ASTC_6x6_Format",(()=>fS)),e(cw,"RGBA_ASTC_8x5_Format",(()=>hS)),e(cw,"RGBA_ASTC_8x6_Format",(()=>pS)),e(cw,"RGBA_ASTC_8x8_Format",(()=>mS)),e(cw,"RGBA_ASTC_10x5_Format",(()=>gS)),e(cw,"RGBA_ASTC_10x6_Format",(()=>vS)),e(cw,"RGBA_ASTC_10x8_Format",(()=>yS)),e(cw,"RGBA_ASTC_10x10_Format",(()=>bS)),e(cw,"RGBA_ASTC_12x10_Format",(()=>wS)),e(cw,"RGBA_ASTC_12x12_Format",(()=>xS)),e(cw,"RGBA_BPTC_Format",(()=>SS)),e(cw,"LoopOnce",(()=>MS)),e(cw,"LoopRepeat",(()=>_S)),e(cw,"LoopPingPong",(()=>AS)),e(cw,"InterpolateDiscrete",(()=>ES)),e(cw,"InterpolateLinear",(()=>CS)),e(cw,"InterpolateSmooth",(()=>kS)),e(cw,"ZeroCurvatureEnding",(()=>TS)),e(cw,"ZeroSlopeEnding",(()=>IS)),e(cw,"WrapAroundEnding",(()=>OS)),e(cw,"NormalAnimationBlendMode",(()=>RS)),e(cw,"AdditiveAnimationBlendMode",(()=>PS)),e(cw,"TrianglesDrawMode",(()=>NS)),e(cw,"TriangleStripDrawMode",(()=>LS)),e(cw,"TriangleFanDrawMode",(()=>DS)),e(cw,"LinearEncoding",(()=>BS)),e(cw,"sRGBEncoding",(()=>jS)),e(cw,"BasicDepthPacking",(()=>FS)),e(cw,"RGBADepthPacking",(()=>US)),e(cw,"TangentSpaceNormalMap",(()=>zS)),e(cw,"ObjectSpaceNormalMap",(()=>HS)),e(cw,"NoColorSpace",(()=>VS)),e(cw,"SRGBColorSpace",(()=>WS)),e(cw,"LinearSRGBColorSpace",(()=>GS)),e(cw,"ZeroStencilOp",(()=>qS)),e(cw,"KeepStencilOp",(()=>KS)),e(cw,"ReplaceStencilOp",(()=>YS)),e(cw,"IncrementStencilOp",(()=>JS)),e(cw,"DecrementStencilOp",(()=>QS)),e(cw,"IncrementWrapStencilOp",(()=>XS)),e(cw,"DecrementWrapStencilOp",(()=>ZS)),e(cw,"InvertStencilOp",(()=>$S)),e(cw,"NeverStencilFunc",(()=>eM)),e(cw,"LessStencilFunc",(()=>tM)),e(cw,"EqualStencilFunc",(()=>nM)),e(cw,"LessEqualStencilFunc",(()=>rM)),e(cw,"GreaterStencilFunc",(()=>iM)),e(cw,"NotEqualStencilFunc",(()=>oM)),e(cw,"GreaterEqualStencilFunc",(()=>aM)),e(cw,"AlwaysStencilFunc",(()=>sM)),e(cw,"StaticDrawUsage",(()=>lM)),e(cw,"DynamicDrawUsage",(()=>cM)),e(cw,"StreamDrawUsage",(()=>uM)),e(cw,"StaticReadUsage",(()=>dM)),e(cw,"DynamicReadUsage",(()=>fM)),e(cw,"StreamReadUsage",(()=>hM)),e(cw,"StaticCopyUsage",(()=>pM)),e(cw,"DynamicCopyUsage",(()=>mM)),e(cw,"StreamCopyUsage",(()=>gM)),e(cw,"GLSL1",(()=>vM)),e(cw,"GLSL3",(()=>yM)),e(cw,"_SRGBAFormat",(()=>bM)),e(cw,"EventDispatcher",(()=>wM)),e(cw,"MathUtils",(()=>NM)),e(cw,"Vector2",(()=>LM)),e(cw,"Matrix3",(()=>DM)),e(cw,"ColorManagement",(()=>WM)),e(cw,"Color",(()=>XM)),e(cw,"ImageUtils",(()=>$M)),e(cw,"Source",(()=>e_)),e(cw,"Texture",(()=>r_)),e(cw,"Vector4",(()=>i_)),e(cw,"WebGLRenderTarget",(()=>o_)),e(cw,"DataArrayTexture",(()=>a_)),e(cw,"WebGLArrayRenderTarget",(()=>s_)),e(cw,"Data3DTexture",(()=>l_)),e(cw,"WebGL3DRenderTarget",(()=>c_)),e(cw,"WebGLMultipleRenderTargets",(()=>u_)),e(cw,"Quaternion",(()=>d_)),e(cw,"Vector3",(()=>f_)),e(cw,"Box3",(()=>m_)),e(cw,"Sphere",(()=>N_)),e(cw,"Ray",(()=>H_)),e(cw,"Matrix4",(()=>V_)),e(cw,"Euler",(()=>$_)),e(cw,"Layers",(()=>eA)),e(cw,"Object3D",(()=>pA)),e(cw,"Triangle",(()=>AA)),e(cw,"Material",(()=>CA)),e(cw,"MeshBasicMaterial",(()=>kA)),e(cw,"BufferAttribute",(()=>OA)),e(cw,"Int8BufferAttribute",(()=>RA)),e(cw,"Uint8BufferAttribute",(()=>PA)),e(cw,"Uint8ClampedBufferAttribute",(()=>NA)),e(cw,"Int16BufferAttribute",(()=>LA)),e(cw,"Uint16BufferAttribute",(()=>DA)),e(cw,"Int32BufferAttribute",(()=>BA)),e(cw,"Uint32BufferAttribute",(()=>jA)),e(cw,"Float16BufferAttribute",(()=>FA)),e(cw,"Float32BufferAttribute",(()=>UA)),e(cw,"Float64BufferAttribute",(()=>zA)),e(cw,"BufferGeometry",(()=>JA)),e(cw,"Mesh",(()=>hE)),e(cw,"BoxGeometry",(()=>mE)),e(cw,"UniformsUtils",(()=>yE)),e(cw,"ShaderMaterial",(()=>bE)),e(cw,"Camera",(()=>wE)),e(cw,"PerspectiveCamera",(()=>xE)),e(cw,"CubeCamera",(()=>ME)),e(cw,"CubeTexture",(()=>_E)),e(cw,"WebGLCubeRenderTarget",(()=>AE)),e(cw,"Plane",(()=>TE)),e(cw,"Frustum",(()=>RE)),e(cw,"PlaneGeometry",(()=>LE)),e(cw,"ShaderChunk",(()=>DE)),e(cw,"UniformsLib",(()=>BE)),e(cw,"ShaderLib",(()=>jE)),e(cw,"OrthographicCamera",(()=>GE)),e(cw,"PMREMGenerator",(()=>eC)),e(cw,"MeshDepthMaterial",(()=>Qk)),e(cw,"MeshDistanceMaterial",(()=>Xk)),e(cw,"WebGLUtils",(()=>tT)),e(cw,"ArrayCamera",(()=>nT)),e(cw,"Group",(()=>rT)),e(cw,"DepthTexture",(()=>aT)),e(cw,"WebGLRenderer",(()=>uT)),e(cw,"WebGL1Renderer",(()=>dT)),e(cw,"FogExp2",(()=>fT)),e(cw,"Fog",(()=>hT)),e(cw,"Scene",(()=>pT)),e(cw,"InterleavedBuffer",(()=>mT)),e(cw,"InterleavedBufferAttribute",(()=>vT)),e(cw,"SpriteMaterial",(()=>yT)),e(cw,"Sprite",(()=>RT)),e(cw,"LOD",(()=>DT)),e(cw,"SkinnedMesh",(()=>HT)),e(cw,"Bone",(()=>VT)),e(cw,"DataTexture",(()=>WT)),e(cw,"Skeleton",(()=>KT)),e(cw,"InstancedBufferAttribute",(()=>YT)),e(cw,"InstancedMesh",(()=>$T)),e(cw,"LineBasicMaterial",(()=>eI)),e(cw,"Line",(()=>aI)),e(cw,"LineSegments",(()=>cI)),e(cw,"LineLoop",(()=>uI)),e(cw,"PointsMaterial",(()=>dI)),e(cw,"Points",(()=>gI)),e(cw,"VideoTexture",(()=>yI)),e(cw,"FramebufferTexture",(()=>bI)),e(cw,"CompressedTexture",(()=>wI)),e(cw,"CanvasTexture",(()=>xI)),e(cw,"Curve",(()=>SI)),e(cw,"EllipseCurve",(()=>MI)),e(cw,"ArcCurve",(()=>_I)),e(cw,"CatmullRomCurve3",(()=>II)),e(cw,"CubicBezierCurve",(()=>NI)),e(cw,"CubicBezierCurve3",(()=>LI)),e(cw,"LineCurve",(()=>DI)),e(cw,"LineCurve3",(()=>BI)),e(cw,"QuadraticBezierCurve",(()=>jI)),e(cw,"QuadraticBezierCurve3",(()=>FI)),e(cw,"SplineCurve",(()=>UI)),e(cw,"CurvePath",(()=>HI)),e(cw,"Path",(()=>VI)),e(cw,"LatheGeometry",(()=>WI)),e(cw,"CapsuleGeometry",(()=>GI)),e(cw,"CircleGeometry",(()=>qI)),e(cw,"CylinderGeometry",(()=>KI)),e(cw,"ConeGeometry",(()=>YI)),e(cw,"PolyhedronGeometry",(()=>JI)),e(cw,"DodecahedronGeometry",(()=>QI)),e(cw,"EdgesGeometry",(()=>tO)),e(cw,"Shape",(()=>nO)),e(cw,"ShapeUtils",(()=>kO)),e(cw,"ExtrudeGeometry",(()=>OO)),e(cw,"IcosahedronGeometry",(()=>PO)),e(cw,"OctahedronGeometry",(()=>NO)),e(cw,"RingGeometry",(()=>LO)),e(cw,"ShapeGeometry",(()=>DO)),e(cw,"SphereGeometry",(()=>BO)),e(cw,"TetrahedronGeometry",(()=>jO)),e(cw,"TorusGeometry",(()=>FO)),e(cw,"TorusKnotGeometry",(()=>UO)),e(cw,"TubeGeometry",(()=>zO)),e(cw,"WireframeGeometry",(()=>HO)),e(cw,"ShadowMaterial",(()=>GO)),e(cw,"RawShaderMaterial",(()=>qO)),e(cw,"MeshStandardMaterial",(()=>KO)),e(cw,"MeshPhysicalMaterial",(()=>YO)),e(cw,"MeshPhongMaterial",(()=>JO)),e(cw,"MeshToonMaterial",(()=>QO)),e(cw,"MeshNormalMaterial",(()=>XO)),e(cw,"MeshLambertMaterial",(()=>ZO)),e(cw,"MeshMatcapMaterial",(()=>$O)),e(cw,"LineDashedMaterial",(()=>eR)),e(cw,"AnimationUtils",(()=>sR)),e(cw,"Interpolant",(()=>lR)),e(cw,"CubicInterpolant",(()=>cR)),e(cw,"LinearInterpolant",(()=>uR)),e(cw,"DiscreteInterpolant",(()=>dR)),e(cw,"KeyframeTrack",(()=>fR)),e(cw,"BooleanKeyframeTrack",(()=>hR)),e(cw,"ColorKeyframeTrack",(()=>pR)),e(cw,"NumberKeyframeTrack",(()=>mR)),e(cw,"QuaternionLinearInterpolant",(()=>gR)),e(cw,"QuaternionKeyframeTrack",(()=>vR)),e(cw,"StringKeyframeTrack",(()=>yR)),e(cw,"VectorKeyframeTrack",(()=>bR)),e(cw,"AnimationClip",(()=>wR)),e(cw,"Cache",(()=>SR)),e(cw,"LoadingManager",(()=>MR)),e(cw,"DefaultLoadingManager",(()=>_R)),e(cw,"Loader",(()=>AR)),e(cw,"FileLoader",(()=>kR)),e(cw,"AnimationLoader",(()=>TR)),e(cw,"CompressedTextureLoader",(()=>IR)),e(cw,"ImageLoader",(()=>OR)),e(cw,"CubeTextureLoader",(()=>RR)),e(cw,"DataTextureLoader",(()=>PR)),e(cw,"TextureLoader",(()=>NR)),e(cw,"Light",(()=>LR)),e(cw,"HemisphereLight",(()=>DR)),e(cw,"SpotLight",(()=>HR)),e(cw,"PointLight",(()=>KR)),e(cw,"DirectionalLight",(()=>JR)),e(cw,"AmbientLight",(()=>QR)),e(cw,"RectAreaLight",(()=>XR)),e(cw,"SphericalHarmonics3",(()=>ZR)),e(cw,"LightProbe",(()=>$R)),e(cw,"MaterialLoader",(()=>eP)),e(cw,"LoaderUtils",(()=>tP)),e(cw,"InstancedBufferGeometry",(()=>nP)),e(cw,"BufferGeometryLoader",(()=>rP)),e(cw,"ObjectLoader",(()=>iP)),e(cw,"ImageBitmapLoader",(()=>lP)),e(cw,"AudioContext",(()=>uP)),e(cw,"AudioLoader",(()=>dP)),e(cw,"HemisphereLightProbe",(()=>fP)),e(cw,"AmbientLightProbe",(()=>hP)),e(cw,"StereoCamera",(()=>vP)),e(cw,"Clock",(()=>yP)),e(cw,"AudioListener",(()=>_P)),e(cw,"Audio",(()=>AP)),e(cw,"PositionalAudio",(()=>IP)),e(cw,"AudioAnalyser",(()=>OP)),e(cw,"PropertyMixer",(()=>RP)),e(cw,"PropertyBinding",(()=>FP)),e(cw,"AnimationObjectGroup",(()=>UP)),e(cw,"AnimationMixer",(()=>VP)),e(cw,"Uniform",(()=>WP)),e(cw,"UniformsGroup",(()=>qP)),e(cw,"InstancedInterleavedBuffer",(()=>KP)),e(cw,"GLBufferAttribute",(()=>YP)),e(cw,"Raycaster",(()=>JP)),e(cw,"Spherical",(()=>ZP)),e(cw,"Cylindrical",(()=>$P)),e(cw,"Box2",(()=>tN)),e(cw,"Line3",(()=>iN)),e(cw,"SpotLightHelper",(()=>aN)),e(cw,"SkeletonHelper",(()=>uN)),e(cw,"PointLightHelper",(()=>fN)),e(cw,"HemisphereLightHelper",(()=>gN)),e(cw,"GridHelper",(()=>vN)),e(cw,"PolarGridHelper",(()=>yN)),e(cw,"DirectionalLightHelper",(()=>SN)),e(cw,"CameraHelper",(()=>AN)),e(cw,"BoxHelper",(()=>kN)),e(cw,"Box3Helper",(()=>TN)),e(cw,"PlaneHelper",(()=>IN)),e(cw,"ArrowHelper",(()=>NN)),e(cw,"AxesHelper",(()=>LN)),e(cw,"ShapePath",(()=>DN)),e(cw,"DataUtils",(()=>FN)),e(cw,"ImmediateRenderObject",(()=>UN)),e(cw,"WebGLMultisampleRenderTarget",(()=>zN)),e(cw,"DataTexture2DArray",(()=>HN)),e(cw,"DataTexture3D",(()=>VN)),e(cw,"BoxBufferGeometry",(()=>WN)),e(cw,"CapsuleBufferGeometry",(()=>GN)),e(cw,"CircleBufferGeometry",(()=>qN)),e(cw,"ConeBufferGeometry",(()=>KN)),e(cw,"CylinderBufferGeometry",(()=>YN)),e(cw,"DodecahedronBufferGeometry",(()=>JN)),e(cw,"ExtrudeBufferGeometry",(()=>QN)),e(cw,"IcosahedronBufferGeometry",(()=>XN)),e(cw,"LatheBufferGeometry",(()=>ZN)),e(cw,"OctahedronBufferGeometry",(()=>$N)),e(cw,"PlaneBufferGeometry",(()=>eL)),e(cw,"PolyhedronBufferGeometry",(()=>tL)),e(cw,"RingBufferGeometry",(()=>nL)),e(cw,"ShapeBufferGeometry",(()=>rL)),e(cw,"SphereBufferGeometry",(()=>iL)),e(cw,"TetrahedronBufferGeometry",(()=>oL)),e(cw,"TorusBufferGeometry",(()=>aL)),e(cw,"TorusKnotBufferGeometry",(()=>sL)),e(cw,"TubeBufferGeometry",(()=>lL));
98
98
  /**
99
99
  * @license
100
100
  * Copyright 2010-2022 Three.js Authors
@@ -119,4 +119,4 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
119
119
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
120
120
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
121
121
  PERFORMANCE OF THIS SOFTWARE.
122
- ***************************************************************************** */function $K(e,t){function n(){this.constructor=e}ZK(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var eY=function(){return eY=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},eY.apply(this,arguments)};Object.create;Object.create;var tY;u=a("85Hg2");function nY(e,t,n,r,i,o){void 0===o&&(o=0);var a=hY(e,t,o),s=a.width,l=a.height,c=Math.min(s,n),u=Math.min(l,r);return c>u*i?{width:u*i,height:u}:{width:c,height:c/i}}function rY(e,t,n,r,i){void 0===i&&(i=0);var o=hY(t.width,t.height,i),a=o.width,s=o.height;return{x:iY(e.x,a,n.width,r),y:iY(e.y,s,n.height,r)}}function iY(e,t,n,r){var i=t*r/2-n/2;return pY(e,-i,i)}function oY(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function aY(e,t){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI}function sY(e,t,n,r,i,o,a){void 0===o&&(o=0),void 0===a&&(a=!0);var s=a?lY:cY,l=hY(t.width,t.height,o),c=hY(t.naturalWidth,t.naturalHeight,o),u={x:s(100,((l.width-n.width/i)/2-e.x/i)/l.width*100),y:s(100,((l.height-n.height/i)/2-e.y/i)/l.height*100),width:s(100,n.width/l.width*100/i),height:s(100,n.height/l.height*100/i)},d=Math.round(s(c.width,u.width*c.width/100)),f=Math.round(s(c.height,u.height*c.height/100)),h=c.width>=c.height*r?{width:Math.round(f*r),height:f}:{width:d,height:Math.round(d/r)};return{croppedAreaPercentages:u,croppedAreaPixels:eY(eY({},h),{x:Math.round(s(c.width-h.width,u.x*c.width/100)),y:Math.round(s(c.height-h.height,u.y*c.height/100))})}}function lY(e,t){return Math.min(e,Math.max(0,t))}function cY(e,t){return t}function uY(e,t,n,r,i,o){var a=hY(t.width,t.height,n),s=pY(r.width/a.width*(100/e.width),i,o);return{crop:{x:s*a.width/2-r.width/2-a.width*s*(e.x/100),y:s*a.height/2-r.height/2-a.height*s*(e.y/100)},zoom:s}}function dY(e,t,n,r,i,o){void 0===n&&(n=0);var a=hY(t.naturalWidth,t.naturalHeight,n),s=pY(function(e,t,n){var r=function(e){return e.width>e.height?e.width/e.naturalWidth:e.height/e.naturalHeight}(t);return n.height>n.width?n.height/(e.height*r):n.width/(e.width*r)}(e,t,r),i,o),l=r.height>r.width?r.height/e.height:r.width/e.width;return{crop:{x:((a.width-e.width)/2-e.x)*l,y:((a.height-e.height)/2-e.y)*l},zoom:s}}function fY(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function hY(e,t,n){var r=n*Math.PI/180;return{width:Math.abs(Math.cos(r)*e)+Math.abs(Math.sin(r)*t),height:Math.abs(Math.sin(r)*e)+Math.abs(Math.cos(r)*t)}}function pY(e,t,n){return Math.min(Math.max(e,t),n)}function mY(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter((function(e){return"string"==typeof e&&e.length>0})).join(" ").trim()}tY=a("lmpx0");var gY=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.imageRef=r(u).createRef(),n.videoRef=r(u).createRef(),n.containerRef=null,n.styleRef=null,n.containerRect=null,n.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},n.dragStartPosition={x:0,y:0},n.dragStartCrop={x:0,y:0},n.gestureZoomStart=0,n.gestureRotationStart=0,n.isTouching=!1,n.lastPinchDistance=0,n.lastPinchRotation=0,n.rafDragTimeout=null,n.rafPinchTimeout=null,n.wheelTimer=null,n.currentDoc="undefined"!=typeof document?document:null,n.currentWindow="undefined"!=typeof window?window:null,n.resizeObserver=null,n.state={cropSize:null,hasWheelJustStarted:!1},n.initResizeObserver=function(){if(void 0!==window.ResizeObserver&&n.containerRef){var e=!0;n.resizeObserver=new window.ResizeObserver((function(t){e?e=!1:n.computeSizes()})),n.resizeObserver.observe(n.containerRef)}},n.preventZoomSafari=function(e){return e.preventDefault()},n.cleanEvents=function(){n.currentDoc&&(n.currentDoc.removeEventListener("mousemove",n.onMouseMove),n.currentDoc.removeEventListener("mouseup",n.onDragStopped),n.currentDoc.removeEventListener("touchmove",n.onTouchMove),n.currentDoc.removeEventListener("touchend",n.onDragStopped),n.currentDoc.removeEventListener("gesturemove",n.onGestureMove),n.currentDoc.removeEventListener("gestureend",n.onGestureEnd))},n.clearScrollEvent=function(){n.containerRef&&n.containerRef.removeEventListener("wheel",n.onWheel),n.wheelTimer&&clearTimeout(n.wheelTimer)},n.onMediaLoad=function(){var e=n.computeSizes();e&&(n.emitCropData(),n.setInitialCrop(e)),n.props.onMediaLoaded&&n.props.onMediaLoaded(n.mediaSize)},n.setInitialCrop=function(e){if(n.props.initialCroppedAreaPercentages){var t=uY(n.props.initialCroppedAreaPercentages,n.mediaSize,n.props.rotation,e,n.props.minZoom,n.props.maxZoom),r=t.crop,i=t.zoom;n.props.onCropChange(r),n.props.onZoomChange&&n.props.onZoomChange(i)}else if(n.props.initialCroppedAreaPixels){var o=dY(n.props.initialCroppedAreaPixels,n.mediaSize,n.props.rotation,e,n.props.minZoom,n.props.maxZoom);r=o.crop,i=o.zoom;n.props.onCropChange(r),n.props.onZoomChange&&n.props.onZoomChange(i)}},n.computeSizes=function(){var e,t,r,i,o,a,s=n.imageRef.current||n.videoRef.current;if(s&&n.containerRef){n.containerRect=n.containerRef.getBoundingClientRect();var l=n.containerRect.width/n.containerRect.height,c=(null===(e=n.imageRef.current)||void 0===e?void 0:e.naturalWidth)||(null===(t=n.videoRef.current)||void 0===t?void 0:t.videoWidth)||0,u=(null===(r=n.imageRef.current)||void 0===r?void 0:r.naturalHeight)||(null===(i=n.videoRef.current)||void 0===i?void 0:i.videoHeight)||0,d=c/u,f=void 0;if(s.offsetWidth<c||s.offsetHeight<u)switch(n.props.objectFit){default:case"contain":f=l>d?{width:n.containerRect.height*d,height:n.containerRect.height}:{width:n.containerRect.width,height:n.containerRect.width/d};break;case"horizontal-cover":f={width:n.containerRect.width,height:n.containerRect.width/d};break;case"vertical-cover":f={width:n.containerRect.height*d,height:n.containerRect.height};break;case"auto-cover":f=c>u?{width:n.containerRect.width,height:n.containerRect.width/d}:{width:n.containerRect.height*d,height:n.containerRect.height}}else f={width:s.offsetWidth,height:s.offsetHeight};n.mediaSize=eY(eY({},f),{naturalWidth:c,naturalHeight:u}),n.props.setMediaSize&&n.props.setMediaSize(n.mediaSize);var h=n.props.cropSize?n.props.cropSize:nY(n.mediaSize.width,n.mediaSize.height,n.containerRect.width,n.containerRect.height,n.props.aspect,n.props.rotation);return(null===(o=n.state.cropSize)||void 0===o?void 0:o.height)===h.height&&(null===(a=n.state.cropSize)||void 0===a?void 0:a.width)===h.width||n.props.onCropSizeChange&&n.props.onCropSizeChange(h),n.setState({cropSize:h},n.recomputeCropPosition),n.props.setCropSize&&n.props.setCropSize(h),h}},n.onMouseDown=function(e){n.currentDoc&&(e.preventDefault(),n.currentDoc.addEventListener("mousemove",n.onMouseMove),n.currentDoc.addEventListener("mouseup",n.onDragStopped),n.onDragStart(t.getMousePoint(e)))},n.onMouseMove=function(e){return n.onDrag(t.getMousePoint(e))},n.onTouchStart=function(e){n.currentDoc&&(n.isTouching=!0,n.props.onTouchRequest&&!n.props.onTouchRequest(e)||(n.currentDoc.addEventListener("touchmove",n.onTouchMove,{passive:!1}),n.currentDoc.addEventListener("touchend",n.onDragStopped),2===e.touches.length?n.onPinchStart(e):1===e.touches.length&&n.onDragStart(t.getTouchPoint(e.touches[0]))))},n.onTouchMove=function(e){e.preventDefault(),2===e.touches.length?n.onPinchMove(e):1===e.touches.length&&n.onDrag(t.getTouchPoint(e.touches[0]))},n.onGestureStart=function(e){n.currentDoc&&(e.preventDefault(),n.currentDoc.addEventListener("gesturechange",n.onGestureMove),n.currentDoc.addEventListener("gestureend",n.onGestureEnd),n.gestureZoomStart=n.props.zoom,n.gestureRotationStart=n.props.rotation)},n.onGestureMove=function(e){if(e.preventDefault(),!n.isTouching){var r=t.getMousePoint(e),i=n.gestureZoomStart-1+e.scale;if(n.setNewZoom(i,r,{shouldUpdatePosition:!0}),n.props.onRotationChange){var o=n.gestureRotationStart+e.rotation;n.props.onRotationChange(o)}}},n.onGestureEnd=function(e){n.cleanEvents()},n.onDragStart=function(e){var t,r,i=e.x,o=e.y;n.dragStartPosition={x:i,y:o},n.dragStartCrop=eY({},n.props.crop),null===(r=(t=n.props).onInteractionStart)||void 0===r||r.call(t)},n.onDrag=function(e){var t=e.x,r=e.y;n.currentWindow&&(n.rafDragTimeout&&n.currentWindow.cancelAnimationFrame(n.rafDragTimeout),n.rafDragTimeout=n.currentWindow.requestAnimationFrame((function(){if(n.state.cropSize&&void 0!==t&&void 0!==r){var e=t-n.dragStartPosition.x,i=r-n.dragStartPosition.y,o={x:n.dragStartCrop.x+e,y:n.dragStartCrop.y+i},a=n.props.restrictPosition?rY(o,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):o;n.props.onCropChange(a)}})))},n.onDragStopped=function(){var e,t;n.isTouching=!1,n.cleanEvents(),n.emitCropData(),null===(t=(e=n.props).onInteractionEnd)||void 0===t||t.call(e)},n.onWheel=function(e){if(n.currentWindow&&(!n.props.onWheelRequest||n.props.onWheelRequest(e))){e.preventDefault();var i=t.getMousePoint(e),o=r(tY)(e).pixelY,a=n.props.zoom-o*n.props.zoomSpeed/200;n.setNewZoom(a,i,{shouldUpdatePosition:!0}),n.state.hasWheelJustStarted||n.setState({hasWheelJustStarted:!0},(function(){var e,t;return null===(t=(e=n.props).onInteractionStart)||void 0===t?void 0:t.call(e)})),n.wheelTimer&&clearTimeout(n.wheelTimer),n.wheelTimer=n.currentWindow.setTimeout((function(){return n.setState({hasWheelJustStarted:!1},(function(){var e,t;return null===(t=(e=n.props).onInteractionEnd)||void 0===t?void 0:t.call(e)}))}),250)}},n.getPointOnContainer=function(e){var t=e.x,r=e.y;if(!n.containerRect)throw new Error("The Cropper is not mounted");return{x:n.containerRect.width/2-(t-n.containerRect.left),y:n.containerRect.height/2-(r-n.containerRect.top)}},n.getPointOnMedia=function(e){var t=e.x,r=e.y,i=n.props,o=i.crop,a=i.zoom;return{x:(t+o.x)/a,y:(r+o.y)/a}},n.setNewZoom=function(e,t,r){var i=(void 0===r?{}:r).shouldUpdatePosition,o=void 0===i||i;if(n.state.cropSize&&n.props.onZoomChange){var a=pY(e,n.props.minZoom,n.props.maxZoom);if(o){var s=n.getPointOnContainer(t),l=n.getPointOnMedia(s),c={x:l.x*a-s.x,y:l.y*a-s.y},u=n.props.restrictPosition?rY(c,n.mediaSize,n.state.cropSize,a,n.props.rotation):c;n.props.onCropChange(u)}n.props.onZoomChange(a)}},n.getCropData=function(){return n.state.cropSize?sY(n.props.restrictPosition?rY(n.props.crop,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):n.props.crop,n.mediaSize,n.state.cropSize,n.getAspect(),n.props.zoom,n.props.rotation,n.props.restrictPosition):null},n.emitCropData=function(){var e=n.getCropData();if(e){var t=e.croppedAreaPercentages,r=e.croppedAreaPixels;n.props.onCropComplete&&n.props.onCropComplete(t,r),n.props.onCropAreaChange&&n.props.onCropAreaChange(t,r)}},n.emitCropAreaChange=function(){var e=n.getCropData();if(e){var t=e.croppedAreaPercentages,r=e.croppedAreaPixels;n.props.onCropAreaChange&&n.props.onCropAreaChange(t,r)}},n.recomputeCropPosition=function(){if(n.state.cropSize){var e=n.props.restrictPosition?rY(n.props.crop,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):n.props.crop;n.props.onCropChange(e),n.emitCropData()}},n}return $K(t,e),t.prototype.componentDidMount=function(){this.currentDoc&&this.currentWindow&&(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),void 0===window.ResizeObserver&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n",this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef))},t.prototype.componentWillUnmount=function(){var e,t;this.currentDoc&&this.currentWindow&&(void 0===window.ResizeObserver&&this.currentWindow.removeEventListener("resize",this.computeSizes),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&(null===(t=this.styleRef.parentNode)||void 0===t||t.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},t.prototype.componentDidUpdate=function(e){var t,n,r,i,o,a,s,l,c;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():(null===(t=e.cropSize)||void 0===t?void 0:t.height)!==(null===(n=this.props.cropSize)||void 0===n?void 0:n.height)||(null===(r=e.cropSize)||void 0===r?void 0:r.width)!==(null===(i=this.props.cropSize)||void 0===i?void 0:i.width)?this.computeSizes():(null===(o=e.crop)||void 0===o?void 0:o.x)===(null===(a=this.props.crop)||void 0===a?void 0:a.x)&&(null===(s=e.crop)||void 0===s?void 0:s.y)===(null===(l=this.props.crop)||void 0===l?void 0:l.y)||this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&(null===(c=this.videoRef.current)||void 0===c||c.load())},t.prototype.getAspect=function(){var e=this.props,t=e.cropSize,n=e.aspect;return t?t.width/t.height:n},t.prototype.onPinchStart=function(e){var n=t.getTouchPoint(e.touches[0]),r=t.getTouchPoint(e.touches[1]);this.lastPinchDistance=oY(n,r),this.lastPinchRotation=aY(n,r),this.onDragStart(fY(n,r))},t.prototype.onPinchMove=function(e){var n=this;if(this.currentDoc&&this.currentWindow){var r=t.getTouchPoint(e.touches[0]),i=t.getTouchPoint(e.touches[1]),o=fY(r,i);this.onDrag(o),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame((function(){var e=oY(r,i),t=n.props.zoom*(e/n.lastPinchDistance);n.setNewZoom(t,o,{shouldUpdatePosition:!1}),n.lastPinchDistance=e;var a=aY(r,i),s=n.props.rotation+(a-n.lastPinchRotation);n.props.onRotationChange&&n.props.onRotationChange(s),n.lastPinchRotation=a}))}},t.prototype.render=function(){var e=this,t=this.props,n=t.image,i=t.video,o=t.mediaProps,a=t.transform,s=t.crop,l=s.x,c=s.y,d=t.rotation,f=t.zoom,h=t.cropShape,p=t.showGrid,m=t.style,g=m.containerStyle,v=m.cropAreaStyle,y=m.mediaStyle,b=t.classes,w=b.containerClassName,x=b.cropAreaClassName,S=b.mediaClassName,M=t.objectFit;return r(u).createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(t){return e.containerRef=t},"data-testid":"container",style:g,className:mY("reactEasyCrop_Container",w)},n?r(u).createElement("img",eY({alt:"",className:mY("reactEasyCrop_Image","contain"===M&&"reactEasyCrop_Contain","horizontal-cover"===M&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===M&&"reactEasyCrop_Cover_Vertical","auto-cover"===M&&(this.mediaSize.naturalWidth>this.mediaSize.naturalHeight?"reactEasyCrop_Cover_Horizontal":"reactEasyCrop_Cover_Vertical"),S)},o,{src:n,ref:this.imageRef,style:eY(eY({},y),{transform:a||"translate(".concat(l,"px, ").concat(c,"px) rotate(").concat(d,"deg) scale(").concat(f,")")}),onLoad:this.onMediaLoad})):i&&r(u).createElement("video",eY({autoPlay:!0,loop:!0,muted:!0,className:mY("reactEasyCrop_Video","contain"===M&&"reactEasyCrop_Contain","horizontal-cover"===M&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===M&&"reactEasyCrop_Cover_Vertical","auto-cover"===M&&(this.mediaSize.naturalWidth>this.mediaSize.naturalHeight?"reactEasyCrop_Cover_Horizontal":"reactEasyCrop_Cover_Vertical"),S)},o,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:eY(eY({},y),{transform:a||"translate(".concat(l,"px, ").concat(c,"px) rotate(").concat(d,"deg) scale(").concat(f,")")}),controls:!1}),(Array.isArray(i)?i:[{src:i}]).map((function(e){return r(u).createElement("source",eY({key:e.src},e))}))),this.state.cropSize&&r(u).createElement("div",{style:eY(eY({},v),{width:this.state.cropSize.width,height:this.state.cropSize.height}),"data-testid":"cropper",className:mY("reactEasyCrop_CropArea","round"===h&&"reactEasyCrop_CropAreaRound",p&&"reactEasyCrop_CropAreaGrid",x)}))},t.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:3,minZoom:1,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0},t.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t}(r(u).Component);var vY=function(){return vY=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},vY.apply(this,arguments)};function yY(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function bY(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var wY="img-crop",xY=.1,SY=(0,u.forwardRef)((function(e,t){var n=e.cropperRef,i=e.image,o=e.aspect,a=e.shape,s=e.grid,l=e.zoom,c=e.rotate,d=e.minZoom,f=e.maxZoom,h=e.cropperProps,p=(0,u.useState)({x:0,y:0}),m=p[0],g=p[1],v=(0,u.useState)({width:0,height:0}),y=v[0],b=v[1],w=(0,u.useState)(1),x=w[0],S=w[1],M=(0,u.useState)(0),_=M[0],A=M[1],E=(0,u.useRef)({width:0,height:0,x:0,y:0}),C=(0,u.useCallback)((function(e){var t=e.width,n=e.height,r=n*o;b(t>r?{width:r,height:n}:{width:t,height:t/o})}),[o]),k=(0,u.useCallback)((function(e,t){E.current=t}),[]);return(0,u.useImperativeHandle)(t,(function(){return{rotateVal:_,setZoomVal:S,setRotateVal:A,cropPixelsRef:E}}),[_]),r(u).createElement(r(u).Fragment,null,r(u).createElement(gY,vY({},h,{ref:n,image:i,crop:m,cropSize:y,onCropChange:g,aspect:o,cropShape:a,showGrid:s,zoomWithScroll:l,zoom:x,rotation:_,onZoomChange:S,onRotationChange:A,minZoom:d,maxZoom:f,onMediaLoaded:C,onCropComplete:k,classes:{containerClassName:"".concat(wY,"-container"),mediaClassName:"".concat(wY,"-media")}})),l&&r(u).createElement("section",{className:"".concat(wY,"-control ").concat(wY,"-control-zoom")},r(u).createElement("button",{onClick:function(){return S(x-xY)},disabled:x-xY<d},"-"),r(u).createElement(Zq.default,{min:d,max:f,step:xY,value:x,onChange:S}),r(u).createElement("button",{onClick:function(){return S(x+xY)},disabled:x+xY>f},"+")),c&&r(u).createElement("section",{className:"".concat(wY,"-control ").concat(wY,"-control-rotate")},r(u).createElement("button",{onClick:function(){return A(_-1)},disabled:-180===_},"↺"),r(u).createElement(Zq.default,{min:-180,max:180,step:1,value:_,onChange:A}),r(u).createElement("button",{onClick:function(){return A(_+1)},disabled:180===_},"↻")))})),MY=(0,u.memo)(SY);!function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");t.setAttribute("media","screen"),t.innerHTML=e,document.head.appendChild(t)}}(".img-crop-modal .img-crop-container {\n position: relative;\n width: 100%;\n height: 40vh;\n}\n.img-crop-modal .img-crop-control {\n display: flex;\n align-items: center;\n width: 60%;\n margin-left: auto;\n margin-right: auto;\n}\n.img-crop-modal .img-crop-control:first-of-type {\n margin-top: 16px;\n}\n.img-crop-modal .img-crop-control:last-of-type {\n margin-bottom: -8px;\n}\n.img-crop-modal .img-crop-control button {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 34px;\n height: 34px;\n padding: 0;\n font-style: normal;\n background: transparent;\n border: 0;\n outline: 0;\n cursor: pointer;\n}\n.img-crop-modal .img-crop-control button[disabled] {\n cursor: default;\n}\n.img-crop-modal .img-crop-control button + div:only-of-type {\n flex: 1;\n margin: 0 8px;\n}\n.img-crop-modal .img-crop-control-zoom button {\n font-size: 18px;\n}\n.img-crop-modal .img-crop-control-rotate button {\n font-size: 16px;\n}\n.img-crop-modal .img-crop-control-rotate button:first-of-type {\n transform: rotate(-20deg);\n}\n.img-crop-modal .img-crop-control-rotate button:last-of-type {\n transform: rotate(20deg);\n}\n");var _Y=(0,u.forwardRef)((function(e,t){var n=e.aspect,i=void 0===n?1:n,o=e.shape,a=void 0===o?"rect":o,s=e.grid,l=void 0!==s&&s,c=e.quality,d=void 0===c?.4:c,f=e.fillColor,h=void 0===f?"white":f,p=e.zoom,m=void 0===p||p,g=e.rotate,v=void 0!==g&&g,y=e.minZoom,b=void 0===y?1:y,w=e.maxZoom,x=void 0===w?3:w,S=e.modalTitle,M=e.modalWidth,_=e.modalOk,A=e.modalCancel,E=e.modalMaskTransitionName,C=e.modalTransitionName,k=e.onModalOk,T=e.onModalCancel,I=e.beforeCrop,O=e.onUploadFail,R=e.cropperProps,P=e.children,N=(0,u.useRef)({});N.current.onModalOk=k,N.current.onModalCancel=T,N.current.beforeCrop=I,N.current.onUploadFail=O;var L=(0,u.useState)(""),D=L[0],B=L[1],j=(0,u.useRef)(),F=(0,u.useRef)(),U=(0,u.useRef)(),z=(0,u.useRef)(),H=(0,u.useMemo)((function(){var e=Array.isArray(P)?P[0]:P,t=e.props,n=t.beforeUpload,r=t.accept,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["beforeUpload","accept"]);return F.current=n,vY(vY({},e),{props:vY(vY({},i),{accept:r||"image/*",beforeUpload:function(e,t){return new Promise((function(n,r){return yY(void 0,void 0,void 0,(function(){var i;return bY(this,(function(o){switch(o.label){case 0:return N.current.beforeCrop?[4,N.current.beforeCrop(e,t)]:[3,2];case 1:if(!o.sent())return[2,r()];o.label=2;case 2:return j.current=e,U.current=function(e){var t,r;null===(r=(t=N.current).onModalOk)||void 0===r||r.call(t,e),n(e)},z.current=function(e){var t,n;null===(n=(t=N.current).onUploadFail)||void 0===n||n.call(t,e),r()},(i=new FileReader).addEventListener("load",(function(){"string"==typeof i.result&&B(i.result)})),i.readAsDataURL(e),[2]}}))}))}))}})})}),[P]),V=(0,u.useRef)({}),W=(0,u.useMemo)((function(){var e={width:M,okText:_,cancelText:A,maskTransitionName:E,transitionName:C};return Object.keys(e).forEach((function(t){e[t]||delete e[t]})),e}),[A,E,_,C,M]),G=function(){B(""),V.current.setZoomVal(1),V.current.setRotateVal(0)},q=(0,u.useCallback)((function(){var e,t;null===(t=(e=N.current).onModalCancel)||void 0===t||t.call(e),G()}),[]),K=(0,u.useCallback)((function(){return yY(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,a,s,l,c,u,f,p,m,g,y,b,w,x,S,M,_,A,E;return bY(this,(function(C){return G(),e=document.createElement("canvas"),t=e.getContext("2d"),n=document.querySelector(".".concat(wY,"-media")),r=V.current.cropPixelsRef.current,i=r.width,o=r.height,a=r.x,s=r.y,v&&0!==V.current.rotateVal?(l=n.naturalWidth,c=n.naturalHeight,u=V.current.rotateVal*(Math.PI/180),f=Math.abs(Math.sin(u)),p=Math.abs(Math.cos(u)),m=l*p+c*f,g=c*p+l*f,e.width=m,e.height=g,t.fillStyle=h,t.fillRect(0,0,m,g),y=m/2,b=g/2,t.translate(y,b),t.rotate(u),t.translate(-y,-b),w=(m-l)/2,x=(g-c)/2,t.drawImage(n,0,0,l,c,w,x,l,c),S=t.getImageData(0,0,m,g),e.width=i,e.height=o,t.putImageData(S,-a,-s)):(e.width=i,e.height=o,t.fillStyle=h,t.fillRect(0,0,i,o),t.drawImage(n,a,s,i,o,0,0,i,o)),M=j.current,_=M.type,A=M.name,E=M.uid,e.toBlob((function(e){return yY(void 0,void 0,void 0,(function(){var t,n;return bY(this,(function(r){switch(r.label){case 0:return t=Object.assign(new File([e],A,{type:_}),{uid:E}),F.current?[4,F.current(t,[t])]:[2,U.current(t)];case 1:return!0===(n=r.sent())?[2,U.current(t)]:!1===n?[2,z.current(new Error("beforeUpload return false"))]:(delete t[Xq.LIST_IGNORE],n===Xq.LIST_IGNORE?(Object.defineProperty(t,Xq.LIST_IGNORE,{value:!0,configurable:!0}),[2,z.current(new Error("beforeUpload return LIST_IGNORE"))]):"object"==typeof n&&null!==n?[2,U.current(n)]:[2])}}))}))}),_,d),[2]}))}))}),[h,d,v]),Y=function(e){return r(u).createElement(r(u).Fragment,null,H,D&&r(u).createElement(MG,vY({visible:!0,wrapClassName:"".concat(wY,"-modal"),title:e,onOk:K,onCancel:q,maskClosable:!1,destroyOnClose:!0},W),r(u).createElement(MY,{ref:V,cropperRef:t,image:D,aspect:i,shape:a,grid:l,zoom:m,rotate:v,minZoom:b,maxZoom:x,cropperProps:R})))};return S?Y(S):r(u).createElement(lH,null,(function(e,t){return Y("zh-cn"===t?"编辑图片":"Edit image")}))}));var AY=({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"})});const EY=["image/jpeg","image/png","image/jpg","image/gif"],CY=({originNode:e,file:t,tenantID:n,apiUrl:r,actions:i,resourceType:o})=>{var a,l,c,u;const{t:d}=Te();return(0,s.jsxs)("div",{className:"memori--list-item-wrapper"+("uploading"===t.status?" listItemUploading":""),children:[(0,s.jsx)(dp,{spinning:"uploading"===t.status,children:"error"===t.status?(0,s.jsx)(zm,{content:d("media.uploadError"),children:e.props.children}):(0,s.jsx)(Xy,{item:{mediumID:t.uid,mimeType:"uploading"===t.status?"image/png":(null===(a=t.name)||void 0===a?void 0:a.endsWith(".glb"))?"model/gltf-binary":t.type||"image/png",title:null!==(l=t.name)&&void 0!==l?l:"",url:"uploading"===t.status?"":(null===(u=null===(c=t.response)||void 0===c?void 0:c.asset)||void 0===u?void 0:u.assetURL)?t.response.asset.assetURL:jm({type:o,resourceURI:t.thumbUrl,tenantID:n,apiURL:r}),content:`${jm({resourceURI:t.thumbUrl,type:o,apiURL:r})}`},preview:!1})}),("success"===t.status||"done"===t.status)&&(0,s.jsxs)("div",{className:"list-item-actions",children:[(0,s.jsx)(Zd,{outlined:!0,shape:"circle",icon:(0,s.jsx)(Gj,{}),className:"action-button",title:d("edit")||"Edit",onClick:()=>null==i?void 0:i.download(t)}),(0,s.jsx)(Zd,{outlined:!0,shape:"circle",icon:(0,s.jsx)(AY,{}),className:"action-button",title:d("delete")||"Delete",onClick:()=>null==i?void 0:i.remove(t)})]})]})};var kY=({uploadMultipleImages:e,maxNumberOfVisualizedUploads:t,uploadUrl:n,apiUrl:i,tenantID:o,fileList:a,maxFileSizeInMB:l=2,fileResolution:c,useImageCrop:d,uploadMessage:f,imageProportions:h=1,imageProportionsHelper:p,allowedMimeTypes:m,onRemove:g,onFileChanged:v,onUploadFinished:y,onFileNotValid:b,disabled:w,showHelper:x,additionalHelper:S,resourceType:M})=>{var _;const{t:A}=Te(),[E,C]=(0,u.useState)(null!=a?a:[]),[k,T]=(0,u.useState)(),I=(0,s.jsx)(r(eU),{className:"memori--upload",disabled:null!=w&&w,accept:(null===(_=null!=m?m:EY)||void 0===_?void 0:_.join(","))+";capture=camera,camcorder",action:n,listType:"picture-card",showUploadList:{showPreviewIcon:!0,showRemoveIcon:!0,showDownloadIcon:!0,downloadIcon:(0,s.jsx)(Gj,{title:A("edit")||"Edit"})},beforeUpload:e=>{if(!(null!=m?m:EY).find((t=>t===e.type))&&e.type)return console.debug("File not allowed",e,null!=m?m:EY),Qd.error(A("media.uploadMimeTypeNotAllowed")),b&&b(),Promise.reject(A("media.uploadMimeTypeNotAllowed"));if(!(e.size/1024/1024<(null!=l?l:2)))return Qd.error(A("media.uploadSizeLimitMessage",{size:l})),b&&b(),Promise.reject(A("media.uploadSizeLimitMessage",{size:l}));if(c&&c.length){const t=new FileReader;return t.readAsDataURL(e),new Promise(((n,r)=>{t.addEventListener("load",(t=>{var i,o,a,s=new Image;s.style.padding="0px",s.style.margin="0px",s.onload=()=>{s.width===c[0]&&s.height===c[1]?n(e):(Qd.error(A("media.uploadWrongResolutionMessage",{width:c[0],height:c[1]})),r(),b&&b())},s.src=null!==(a=null===(o=null===(i=t.target)||void 0===i?void 0:i.result)||void 0===o?void 0:o.toString())&&void 0!==a?a:""}))}))}return Promise.resolve(e)},supportServerRender:!0,fileList:E,multiple:e,maxCount:t||(e?100:1),onChange:e=>{C(e.fileList.map((e=>{var t;return{...e,status:null!==(t=e.status)&&void 0!==t?t:"error"}}))),"done"===e.file.status&&y&&y(e.file)},onRemove:g,onDownload:e=>{var t,n;let r=null===(t=e.response)||void 0===t?void 0:t.asset;if(r){let t=r.originalFileName&&e.name.includes(r.originalFileName)?r.originalFileName:e.name;T({...r,title:null!=t?t:r.title})}else T({assetID:e.uid,title:null!==(n=e.name)&&void 0!==n?n:e.fileName})},itemRender:(e,t,n,r)=>(0,s.jsx)(CY,{resourceType:M,originNode:e,file:t,fileList:E||n,actions:r,tenantID:o,apiUrl:i}),children:f});return(0,s.jsxs)("div",{"aria-live":"polite",children:[d?(0,s.jsx)(_Y,{rotate:!0,aspect:h,fillColor:"transparent",modalCancel:A("cancel")||"Cancel",modalMaskTransitionName:"none",modalTransitionName:"none",children:I}):I,(0,s.jsxs)(hp,{open:!!k,title:A("media.editAttributes"),onClose:()=>{T(void 0)},footer:(0,s.jsx)(s.Fragment,{}),width:"100%",children:[(0,s.jsx)("label",{htmlFor:"media-title-input",className:"media-title-label",children:A("media.title")}),(0,s.jsx)("input",{id:"media-title-input",className:"media-title-input",type:"text",name:"title",defaultValue:(null==k?void 0:k.title)||"",onChange:e=>{T({...k,title:e.target.value})}}),(0,s.jsxs)("div",{className:"memori-modal--footer",children:[(0,s.jsx)(Zd,{onClick:()=>{T(void 0)},children:A("cancel")}),(0,s.jsx)(Zd,{primary:!0,onClick:()=>{v&&(null==k?void 0:k.assetID)&&v(k.assetID,{...k}),C((e=>e.map((e=>{var t,n;return e.uid===(null==k?void 0:k.assetID)||(null===(n=null===(t=e.response)||void 0===t?void 0:t.asset)||void 0===n?void 0:n.assetID)===(null==k?void 0:k.assetID)?{...e,title:null==k?void 0:k.title,name:null==k?void 0:k.title}:e})))),T(void 0)},children:A("confirm")})]})]}),x&&(0,s.jsxs)("legend",{className:"helper",children:[(0,s.jsx)("p",{children:A(m?"media.uploadHelper":"media.uploadHelperImages").replace("@size@",(null!=l?l:2).toString())}),p&&d&&(0,s.jsxs)("p",{children:[A("media.scaleRatio"),": ",p]}),S&&(0,s.jsx)("p",{children:S})]})]})};var TY=({visible:e,authToken:t,sessionID:n,tenantID:r,uploadAssetURL:i,deleteAsset:o,onCancel:a,onOk:l,apiURL:c})=>{const{t:d}=Te(),[f,h]=(0,u.useState)();return(0,s.jsx)(hp,{open:e,title:d("media.addMediaLabel"),className:"attachment-media-modal",closable:!0,width:"100%",widthMd:"100%",onClose:()=>{a&&a()},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Zd,{onClick:a,children:d("cancel")}),(0,s.jsx)(Zd,{primary:!0,onClick:()=>{f&&l(f),h(void 0)},disabled:!f,children:d("confirm")})]}),children:(0,s.jsx)(kY,{tenantID:r,apiUrl:c,uploadMultipleImages:!1,maxNumberOfVisualizedUploads:1,maxFileSizeInMB:100,uploadUrl:i,useImageCrop:!1,allowedMimeTypes:_g,fileList:f?[{uid:"-1",name:f.assetID,status:"done",thumbUrl:jm({resourceURI:f.assetURL,tenantID:r,apiURL:c,sessionID:n})}]:[],uploadMessage:d("media.mediaUploadMessage"),imageProportions:1,onUploadFinished:e=>{let t=e.response.asset,n=e.response;0===n.resultCode?h(t):(console.error(n,e),Qd.error(d($F(n.resultCode))))},onFileChanged:(e,t)=>{h((e=>({...e||{},...t})))},onRemove:async e=>{const n=await o(t,e.thumbUrl);return 0===n.resultCode?h(void 0):(console.error(n,e),Qd.error(d($F(n.resultCode)))),0===n.resultCode}})})};u=a("85Hg2");var IY=({visible:e,onCancel:t,onOk:n})=>{var r,i,o;const{t:a}=Te(),[l,c]=(0,u.useState)({url:"",title:""}),d=e=>{if("Enter"===e.key){if(0===(null==l?void 0:l.url.length)||0===(null==l?void 0:l.title.length))return;let e=document.getElementById("save-link-button");e&&e.click()}};return(0,s.jsx)(hp,{open:e,title:a("media.addLinkLabel"),className:"attachment-link-modal",closable:!0,width:"100%",widthMd:"80%",onClose:()=>{t&&t()},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Zd,{onClick:t,children:a("cancel")}),(0,s.jsx)(Zd,{id:"save-link-button",primary:!0,onClick:()=>{0!==(null==l?void 0:l.url.length)&&0!==(null==l?void 0:l.title.length)&&(n(l),c({url:"",title:""}))},disabled:0===(null==l?void 0:l.url.length)||0===(null==l?void 0:l.title.length),children:a("confirm")})]}),children:(0,s.jsxs)("div",{className:"attachment-link-modal--row",children:[(0,s.jsxs)("div",{className:"attachment-link-modal--column",children:[(0,s.jsxs)("label",{htmlFor:"new-link-url",className:"attachment-link-modal--label",children:[a("media.linkKey"),":"]}),(0,s.jsx)("input",{type:"url",className:"attachment-link-modal--input ",onChange:e=>{let t=e.target.value.startsWith("http")||0===e.target.value.length?e.target.value:`https://${e.target.value}`;c((e=>{var n;return{title:null!==(n=null==e?void 0:e.title)&&void 0!==n?n:"",url:t}}))},placeholder:"https://memori.ai/...",value:null==l?void 0:l.url,name:"url",onKeyDown:d}),(0,s.jsxs)("label",{htmlFor:"new-link-title",className:"attachment-link-modal--label",children:[a("media.linkValue"),":"]}),(0,s.jsx)("input",{type:"text",className:"attachment-link-modal--input ",onChange:e=>c((t=>{var n;return{url:null!==(n=null==t?void 0:t.url)&&void 0!==n?n:"",title:e.target.value}})),value:null==l?void 0:l.title,name:"title",onKeyDown:d})]}),(0,s.jsx)("div",{className:"attachment-link-modal--column",children:(0,s.jsx)("div",{className:"attachment-link-modal--centered",children:(0,s.jsx)(bg,{item:{title:null!==(r=null==l?void 0:l.title)&&void 0!==r?r:"",url:null!==(i=null==l?void 0:l.url)&&void 0!==i?i:"",mediumID:"",mimeType:"text/html"},onLinkPreviewInfo:e=>{var t;(null===(t=null==l?void 0:l.title)||void 0===t?void 0:t.length)||c((t=>{var n;return{...t,title:null!==(n=null==e?void 0:e.title)&&void 0!==n?n:""}}))}},null!==(o=null==l?void 0:l.url)&&void 0!==o?o:"")})})]})})};var OY=({tenant:e,userLang:t="en"})=>{const n="memorytwin"===(null==e?void 0:e.theme)?"memorytwin":"twincreator";return(0,s.jsxs)("div",{className:"memori--powered-by",children:[(0,s.jsx)("img",{src:`https://app.twincreator.com/images/${n}/logo.png`,alt:""}),(0,s.jsxs)("p",{children:["Powered by"," ",(0,s.jsx)("a",{href:`https://app.${n}.com/${t?t.toLowerCase():""}`,target:"_blank",rel:"noopener noreferrer",children:"memorytwin"===n?"MemoryTwin":"TwinCreator"})]})]})};var RY=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,ChangeMode:d,changeModeProps:f,sessionId:h,hasUserActivatedSpeak:p,showInstruct:m=!1,loading:g=!1,poweredBy:v})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(dp,{spinning:g,children:[m&&d&&f&&(0,s.jsx)(d,{...f}),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:h&&p&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null}),v]})]})]});var PY=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,ChangeMode:d,changeModeProps:f,sessionId:h,hasUserActivatedSpeak:p,showInstruct:m=!1,loading:g=!1,poweredBy:v})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(dp,{spinning:g,className:"memori-totem-layout",children:[v,m&&d&&f&&(0,s.jsx)(d,{...f}),(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:h&&p&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null})]})]});var NY=({Header:e,headerProps:t,Chat:n,chatProps:r,StartPanel:i,startPanelProps:o,integrationStyle:a,integrationBackground:l,ChangeMode:c,changeModeProps:u,sessionId:d,hasUserActivatedSpeak:f,showInstruct:h=!1,loading:p=!1,poweredBy:m})=>(0,s.jsxs)(s.Fragment,{children:[a,l,(0,s.jsxs)(dp,{spinning:p,className:"memori-chat-layout",children:[m,h&&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&&f&&n&&r?(0,s.jsx)(n,{...r}):o?(0,s.jsx)(i,{...o}):null})]})]});const LY={muteSpeaker:"@memori:muteSpeaker",microphoneMode:"@memori:microphoneMode",continuousSpeechTimeout:"@memori:continuousSpeechTimeout",sendOnEnter:"@memori:sendOnEnter",birthDate:"@memori:birthDate",controlsPosition:"@memori:controlsPosition",hideEmissions:"@memori:hideEmissions"},DY=(e,t)=>{var n;const r=window.localStorage.getItem(null!==(n=LY[e])&&void 0!==n?n:e);if(!r)return t;try{return JSON.parse(r)}catch(e){return r}},BY=(e,t)=>{var n;window.localStorage.setItem(null!==(n=LY[e])&&void 0!==n?n:e,t.toString())},{deleteSession:jY,getStatistics:FY,initSession:UY}=W(),zY=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,"🧠"]]),HY=e=>{const t=Array.from(zY.keys()).filter((t=>t<=e));if(t.length>0){const e=t[t.length-1];return zY.get(e)}return""},VY=e=>{if("🆕"===e)return{points:10,badge:"🐹"};let t,n,r=!1;for(const[i,o]of zY){if(r){t=i,n=o;break}o===e&&(r=!0)}return n&&t?{points:t,badge:n}:void 0},WY=e=>{let t=0;for(const[n,r]of zY)if(r===e){t=n;break}return t},GY=e=>{const t=Math.round(e),n=HY(t);return{points:t,badge:n,pointsForCurrentBadge:WY(n),nextBadge:VY(n)}};var qY=a("agy8n");u=a("85Hg2"),qY=a("agy8n");const KY={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"]},YY=(0,u.memo)((({defaultDate:e,onChange:t,disabled:n=!1})=>{const{t:i,i18n:o}=Te(),[a,l]=(0,u.useState)(r(qY)(e||Date.now()));return(0,u.useEffect)((()=>{t(a)}),[a,t]),r(qY).locale(o.language),(0,s.jsxs)("div",{className:"memori--date-selector",children:[(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(Zb,{value:a,onChange:e=>{l(e)},disabled:n,name:"day",children:[(0,s.jsxs)(Zb.Label,{className:"memori--date-selector__select-label",children:[i("day"),":"]}),(0,s.jsxs)(Zb.Button,{"aria-label":i("day"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:a.date()}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)($b,{})})]}),(0,s.jsx)(Jf,{as:u.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(Zb.Options,{className:"memori--date-selector__select-options",children:[...Array(31).keys()].map((e=>(0,s.jsx)(Zb.Option,{value:a.clone().date(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)(Zb,{value:a,onChange:e=>{l(e)},disabled:n,name:"month",children:[(0,s.jsxs)(Zb.Label,{className:"memori--date-selector__select-label",children:[i("month"),":"]}),(0,s.jsxs)(Zb.Button,{"aria-label":i("month"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:KY["it"===o.language?"it":"en"][a.month()]}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)($b,{})})]}),(0,s.jsx)(Jf,{as:u.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(Zb.Options,{className:"memori--date-selector__select-options",children:KY["it"===o.language?"it":"en"].map((e=>(0,s.jsx)(Zb.Option,{className:"memori--date-selector__select-option",value:a.clone().month(KY["it"===o.language?"it":"en"].findIndex((t=>t===e))),children:e},e)))})})]})}),(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(Zb,{value:a,onChange:e=>{l(e)},disabled:n,name:"year",children:[(0,s.jsxs)(Zb.Label,{className:"memori--date-selector__select-label",children:[i("year"),":"]}),(0,s.jsxs)(Zb.Button,{"aria-label":i("year"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:a.year()}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)($b,{})})]}),(0,s.jsx)(Jf,{as:u.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(Zb.Options,{className:"memori--date-selector__select-options",children:[...Array(r(qY)().year()-1899).keys()].sort(((e,t)=>t-e)).map((e=>(0,s.jsx)(Zb.Option,{value:a.clone().year(e+1900),className:"memori--date-selector__select-option",children:e+1900},e)))})})]})})]})}));YY.displayName="DateSelector";var JY=YY;u=a("85Hg2");var QY=({visible:e=!1,onClose:t,minAge:n})=>{const{t:i}=Te(),[o,a]=(0,u.useState)(),[l,c]=(0,u.useState)(),d=(0,u.useCallback)((()=>{if(!o)return Qd.error(i("requiredField")),void c(i("requiredField")||"Required field");if(r(qY)().diff(o,"years")<n)return Qd.error(i("underageTwinSession",{age:n})),void c(i("underageTwinSession",{age:n})||`You must be at least ${n} years old to interact with this Twin`);t(o.toISOString())}),[o,n,t,i]);return(0,s.jsxs)(hp,{open:e,title:i("ageVerification"),className:"age-verification-modal",closable:!0,onClose:()=>t(),children:[(0,s.jsx)("p",{children:i("ageVerificationText",{minAge:n})}),(0,s.jsxs)("form",{className:"age-verification-form",onSubmit:e=>{e.preventDefault(),d()},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)(JY,{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)(Zd,{primary:!0,htmlType:"submit",className:"age-verification-submit",disabled:!o,children:i("confirm")})})]})]})};u=a("85Hg2"),Jd=a("4IUwl");var XY=({open:e=!1,onClose:t,className:n,title:i,description:o,children:a,footer:l,loading:c=!1,side:d="right",closable:f=!0,width:h="100%",widthMd:p="80%",widthLg:m="60%"})=>(0,s.jsx)(Jf,{appear:!0,show:e,as:r(u).Fragment,children:(0,s.jsxs)(up,{open:e,onClose:t,className:r(Jd)("memori-drawer",n),children:[(0,s.jsx)(Jf.Child,{as:r(u).Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,s.jsx)("div",{className:"memori-drawer--container",children:(0,s.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,s.jsx)(Jf.Child,{as:r(u).Fragment,enter:"ease-out duration-300",enterFrom:"max-w-0 opacity-0",enterTo:"max-w-100 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-100 opacity-100",leaveTo:"max-w-0 opacity-0",children:(0,s.jsxs)(up.Panel,{className:r(Jd)("memori-drawer--panel",{"memori-drawer--panel-left":"left"===d,"memori-drawer--with-footer":!!l}),children:[(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${h};\n --memori-drawer--width-lg: ${m};\n --memori-drawer--width-md: ${p};\n }\n `}}),f&&(0,s.jsx)("div",{className:"memori-drawer--close",children:(0,s.jsx)(Zd,{shape:"circle",outlined:!0,icon:(0,s.jsx)(fp,{}),onClick:()=>t(!1)})}),(0,s.jsxs)(dp,{spinning:c,children:[i&&(0,s.jsx)(up.Title,{className:"memori-drawer--title",children:i}),o&&(0,s.jsx)(up.Description,{className:"memori-drawer--description",children:o}),a,l&&(0,s.jsx)("div",{className:"memori-drawer--footer",children:l})]})]})})})})]})});Jd=a("4IUwl");var ZY=({label:e,className:t,disabled:n=!1,checked:i,children:o,onChange:a,name:l,...c})=>(0,s.jsxs)("label",{className:r(Jd)("memori-checkbox",t,{"memori-checkbox--disabled":n}),children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",...c,name:l,disabled:n,defaultChecked:i,className:"memori-checkbox--input",onChange:a}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsx)("span",{className:"memori-checkbox--text",children:e})]});const $Y=[2,3,5,10,15,20,30,60];var eJ=({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})=>{const{t:f}=Te();return(0,s.jsxs)(XY,{className:"memori-settings-drawer",open:e,onClose:n,title:f("widget.settings")||"Settings",description:f("write_and_speak.settingsHeaderLabel"),children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"#microphoneMode",children:[f("write_and_speak.microphoneMode")||"Microphone mode",":"]}),(0,s.jsxs)(Sb,{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),BY("microphoneMode",t)},children:[(0,s.jsx)(Sb.Option,{value:"HOLD_TO_TALK",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked:e})=>(0,s.jsx)(Zd,{primary:e,children:f("write_and_speak.holdToSpeak")||"Hold to speak"})}),(0,s.jsx)(Sb.Option,{value:"CONTINUOUS",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked:e})=>(0,s.jsx)(Zd,{primary:e,children:f("write_and_speak.continuousSpeechLabel")||"Continuous speech"})})]})]}),"CONTINUOUS"===r&&(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(ew,{label:f("write_and_speak.secondsLabel")||"Seconds",placeholder:f("write_and_speak.secondsLabel")||"Seconds",options:$Y.map((e=>({value:e,label:e}))),value:i,onChange:e=>{a(e),BY("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:[f("write_and_speak.controlsPosition")||"Controls",":"]}),(0,s.jsxs)(Sb,{id:"controlsPosition",name:"controlsPosition",value:l,defaultValue:l,className:"memori-settings-drawer--controlsposition-radio",onChange:e=>{c(e),BY("controlsPosition",e)},children:[(0,s.jsx)(Sb.Option,{value:"center",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(Zd,{primary:e,children:f("center")||"Center"})}),(0,s.jsx)(Sb.Option,{value:"bottom",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(Zd,{primary:e,children:f("bottom")||"Bottom"})})]})]}),(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(ZY,{label:f("write_and_speak.hideEmissionsLabel"),name:"hideControls",checked:u,onChange:e=>{d(e.target.checked),BY("hideEmissions",e.target.checked)}})})]})]})};let tJ,nJ,rJ,iJ,oJ;window.getMemoriState=e=>{var t,n,r,i,o;let a=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(!a)return null;let s=null===(o=a.dataset)||void 0===o?void 0:o.memoriEngineState;return s?JSON.parse(s):null},window.typeMessage=e=>{var t,n;let r=document.querySelector("fieldset#chat-fieldset textarea")||(null===(n=null===(t=document.querySelector("memori-client"))||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector("fieldset#chat-fieldset textarea"));r&&(!function(e,t){var n,r,i,o;const a=null===(r=null===(n=null==Object?void 0:Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,"value"))||void 0===r?void 0:r.set,s=Object.getPrototypeOf(e),l=null===(o=null===(i=null==Object?void 0:Object.getOwnPropertyDescriptor)||void 0===i?void 0:i.call(Object,s,"value"))||void 0===o?void 0:o.set;l&&a&&a!==l?l.call(e,t):a&&a.call(e,t)}(r,e),r.dispatchEvent(new Event("input",{bubbles:!0})),setTimeout((()=>{var e,t;let n=document.querySelector("button.memori-chat-inputs--send")||(null===(t=null===(e=document.querySelector("memori-client"))||void 0===e?void 0:e.shadowRoot)||void 0===t?void 0:t.querySelector("button.memori-chat-inputs--send"));n&&n.click()}),100))};var aJ=({memori:e,memoriConfigs:t,memoriLang:n,multilingual:i=!1,integration:o,layout:a="DEFAULT",customLayout:l,showInstruct:c=!1,showShare:d,preview:f=!1,embed:h=!1,showInputs:p=!0,showDates:m=!1,showContextPerLine:g=!1,showSettings:v=!0,height:y="100vh",secret:b,baseUrl:w="https://app.twincreator.com",apiUrl:x="https://backend.memori.ai",initialContextVars:S,initialQuestion:M,ogImage:_,sessionID:A,tenant:E,personification:C,authToken:k,AZURE_COGNITIVE_SERVICES_TTS_KEY:T,onStateChange:I})=>{var O,R,P,N,L,D,B,j,F,U,z,H,V,G,q,K,Y,J,Q,X,Z;const{t:$,i18n:ee}=Te(),[te,ne]=(0,u.useState)(!1);(0,u.useEffect)((()=>{ne(!0)}),[]);const re=W(x),{initSession:ie,postTextEnteredEvent:oe,postPlaceChangedEvent:ae,postTimeoutEvent:se,postTagChangedEvent:le,getSession:ce,getContentQualityIndexes:ue}=re,[de,fe]=(0,u.useState)(!1),[he,pe]=(0,u.useState)(!1),[me,ge]=(0,u.useState)(!1),ve=null===(N=null===(P=null===(R=null===(O=null==t?void 0:t.find((t=>t.memoriConfigID===e.memoriConfigurationID)))||void 0===O?void 0:O.culture)||void 0===R?void 0:R.split("-"))||void 0===P?void 0:P[0])||void 0===N?void 0:N.toUpperCase(),ye=(null==o?void 0:o.customData)?JSON.parse(o.customData):null,be=null!=i?i:!!(null==ye?void 0:ye.multilanguage),[we,xe]=(0,u.useState)(null!==(z=null!==(U=null!==(F=null!==(j=null!==(L=null!=n?n:null==ye?void 0:ye.lang)&&void 0!==L?L:null===(B=null===(D=null==e?void 0:e.culture)||void 0===D?void 0:D.split("-"))||void 0===B?void 0:B[0])&&void 0!==j?j:ve)&&void 0!==F?F:null==ye?void 0:ye.uiLang)&&void 0!==U?U:ee.language)&&void 0!==z?z:"IT"),[Se,Me]=(0,u.useState)(!1),[_e,Ae]=(0,u.useState)(!1),Ee=a||(null==ye?void 0:ye.layout)||"DEFAULT",[Ce,ke]=(0,u.useState)(!1),[Ie,Oe]=(0,u.useState)(!1),[Re,Pe]=(0,u.useState)(!1),[Ne,Le]=(0,u.useState)(!1),[De,Be]=(0,u.useState)(!1),[je,Fe]=(0,u.useState)(!1),[Ue,ze]=(0,u.useState)(2),[He,Ve]=(0,u.useState)(!1),[We,Ge]=(0,u.useState)("center"),[qe,Ke]=(0,u.useState)(!1);(0,u.useEffect)((()=>{Ve(!!rJ)}),[rJ]),(0,u.useEffect)((()=>{let e="bottom",t=DY("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",Be(DY("muteSpeaker",!1)),Fe("CONTINUOUS"===t),ze(DY("continuousSpeechTimeout",2)),Ge(DY("controlsPosition",e)),Ke(DY("hideEmissions",!1))}),[]);const[Ye,Je]=(0,u.useState)(b),[Qe,Xe]=(0,u.useState)(),[Ze,$e]=(0,u.useState)(null),[et,tt]=(0,u.useState)(),nt=async(e,t)=>{var n;const r=null!=t?t:vt;if(e&&r){const{currentState:t,...i}=await ae({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&&xt({...bt,...t})}},[rt,it]=(0,u.useState)(""),[ot,at]=(0,u.useState)(!1),[st,lt]=(0,u.useState)([]),ct=e=>{lt((t=>[...t,{...e}]))},ut=async(t,n,r,i=!0,o)=>{var a,s,l,c,u;if(!vt||!(null==t?void 0:t.length))return;ct({text:t,translatedText:o,fromUser:!0,media:null!=n?n:[],initial:!!r}),Ae(!0);const d=null!==(c=null!==(l=null===(s=null===(a=e.culture)||void 0===a?void 0:a.split("-"))||void 0===s?void 0:s[0])&&void 0!==l?l:ee.language)&&void 0!==c?c:"IT";let f=t;if(i&&!de&&be&&we.toUpperCase()!==d.toUpperCase()){f=(await Sg(t,d,we,w)).text}const{currentState:h,...p}=await oe({sessionId:null!=r?r:vt,text:f});if(0===p.resultCode&&h){const t=null!==(u=h.emission)&&void 0!==u?u:null==bt?void 0:bt.emission;if("X4"===h.state&&e.giverTag){const{currentState:t,...n}=await le(vt,e.giverTag);0===n.resultCode?(xt(t),t.emission&&(ct({text:t.emission,media:t.media,fromUser:!1}),Dt(t.emission))):(console.error(p,n),Qd.error($($F(n.resultCode))))}else if("X2d"===h.state&&e.giverTag){const{currentState:t,...n}=await oe({sessionId:null!=r?r:vt,text:Math.random().toString().substring(2,8)});if(0===n.resultCode){const{currentState:t,...n}=await le(vt,e.giverTag);0===n.resultCode?(xt(t),t.emission&&(ct({text:t.emission,media:t.media,fromUser:!1}),Dt(t.emission))):(console.error(p,n),Qd.error($($F(n.resultCode))))}else console.error(p,n),Qd.error($($F(n.resultCode)))}else we.toLowerCase()!==d.toLowerCase()&&t&&!de&&be?dt(h,we).then((e=>{e.emission&&Dt(e.emission)})):(xt({...h,emission:t}),t&&(ct({text:t,media:h.media,fromUser:!1,generatedByAI:!!h.completion}),Dt(t)))}else 404===p.resultCode&&(lt((e=>[...e.slice(0,e.length-1)])),Mt(!1,Ye||e.secretToken,Qe,de&&e.giverTag?e.giverTag:void 0,de&&e.giverPIN?e.giverPIN:void 0,S,M).then((e=>{console.info("session timeout"),(null==e?void 0:e.sessionID)&&setTimeout((()=>{ut(t,n,null==e?void 0:e.sessionID)}),500)})));Ae(!1)},dt=async(t,n)=>{var r,i,o,a,s,l,c;const u=null!==(a=null!==(o=null===(i=null===(r=e.culture)||void 0===r?void 0:r.split("-"))||void 0===i?void 0:i[0])&&void 0!==o?o:ee.language)&&void 0!==a?a:"IT",d=null!==(s=t.emission)&&void 0!==s?s:null==bt?void 0:bt.emission;let f={...t},h=null;if(d&&!de&&u.toUpperCase()!==n.toUpperCase()&&be){const e=await Sg(d,n,u,w);if(t.hints&&t.hints.length>0){const r=await Promise.all((null!==(l=t.hints)&&void 0!==l?l:[]).map((async e=>{var t;const r=await Sg(e,n,u,w);return{text:null!==(t=null==r?void 0:r.text)&&void 0!==t?t:e,originalText:e}})));f={...t,emission:e.text,translatedHints:r}}else f={...t,emission:e.text,hints:null!==(c=t.hints)&&void 0!==c?c:"G1"===t.state?null==bt?void 0:bt.hints:[]};e.text.length>0&&(h={text:e.text,media:t.media,fromUser:!1,generatedByAI:!!t.completion})}else f={...t,emission:d},d&&(h={text:d,media:t.media,fromUser:!1});return xt(f),h&&ct(h),f},ft=e.ageRestriction?e.ageRestriction:e.nsfw?18:e.enableCompletions?14:0,[ht,pt]=(0,u.useState)(),[mt,gt]=(0,u.useState)(!1),[vt,yt]=(0,u.useState)(A),[bt,wt]=(0,u.useState)(),xt=e=>{wt(e),I&&I(e)},St=async t=>{var n;if("PUBLIC"!==e.privacyType&&!e.secretToken&&!Ye&&!Qe)return void $e("password");let r=DY("birthDate",void 0);if(ht||r||!ft){Me(!0);try{if(!e.giverTag&&(null===(n=e.receivedInvitations)||void 0===n?void 0:n.length)){let t=e.receivedInvitations.find((e=>"GIVER"===e.type&&"ACCEPTED"===e.state));t&&(e.giverTag=t.tag,e.giverPIN=t.pin)}const r=await ie(t);if((null==r?void 0:r.sessionID)&&(null==r?void 0:r.currentState)&&0===r.resultCode)return yt(r.sessionID),et&&nt(et,r.sessionID),Me(!1),{dialogState:r.currentState,sessionID:r.sessionID};(null==r?void 0:r.resultMessage.startsWith("This Memori is aged restricted"))?(console.error(r),Qd.error($("underageTwinSession",{age:ft})),ge(!0)):(console.error(r),Qd.error($($F(null==r?void 0:r.resultCode))),ge(!0))}catch(e){console.error(e),new Error("Error fetching session")}}else gt(!0)},Mt=async(t=!1,n,r,i,o,a,s,l)=>{var c;Me(!0);try{let u=DY("birthDate",void 0);const{sessionID:d,currentState:f,...h}=await ie({memoriID:null!==(c=e.engineMemoriID)&&void 0!==c?c:"",password:n,recoveryTokens:r,tag:i,pin:o,initialContextVars:a,initialQuestion:s,birthDate:l||u||void 0});if(d&&f&&0===h.resultCode)return yt(d),t&&(xt(f),f.emission&&(st.length<=1?lt([{text:f.emission,media:f.media,fromUser:!1}]):ct({text:f.emission,media:f.media,fromUser:!1}))),et&&nt(et,d),Me(!1),{dialogState:f,sessionID:d};(null==h?void 0:h.resultMessage.startsWith("This Memori is aged restricted"))?(console.error(h),Qd.error($("underageTwinSession",{age:ft})),ge(!0)):(console.error(h),Qd.error($($F(h.resultCode))),ge(!0))}catch(e){console.error(e)}return Me(!1),null},_t=async(t,n,r,i)=>{var o;if(!t||!n)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState:t,resultCode:a}=await le(n,null!=r?r:Ag);if(0===a){let s=0;if(r!==Ag&&i&&("X1a"===t.state||"X1b"===t.state)){const{resultCode:e}=await oe({sessionId:n,text:null!=i?i:""});s=e}if(0===s){const{currentState:e,...t}=await ce(n);if(0===t.resultCode&&e)return{currentState:e,sessionId:n,...t}}else if([400,401,403,404,500].includes(a)){console.warn("[APPCONTEXT/CHANGETAG]",a);let t=DY("birthDate",void 0);St({memoriID:null!==(o=e.engineMemoriID)&&void 0!==o?o:"",password:b||e.secretToken,tag:e.giverTag,pin:e.giverPIN,initialContextVars:S,initialQuestion:M,birthDate:ht||t||void 0})}else if(t)return{currentState:t,sessionId:n,resultCode:a}}}catch(e){let t=e;return console.error("[APPCONTEXT/CHANGETAG]",t),Promise.reject(t)}return null};(0,u.useEffect)((()=>()=>{bt&&(null==bt?void 0:bt.currentTag)===e.giverTag||(async()=>{vt&&e.giverTag&&e.giverPIN&&(lt([]),await _t(e.engineMemoriID,vt,e.giverTag,e.giverPIN))})()}),[]);const[At,Et]=(0,u.useState)(),Ct=(0,u.useRef)(),kt=()=>{At&&(clearTimeout(At),Et(void 0)),(null==Ct?void 0:Ct.current)&&(clearTimeout(Ct.current),Ct.current=void 0)},Tt=()=>{kt(),!(null==bt?void 0:bt.acceptsTimeout)||rJ||He||rt.length||ot||Ot()},It=async()=>{var e;if(rJ||He||rt.length||ot)Tt();else if(vt&&Ce&&(null==bt?void 0:bt.acceptsTimeout)){const{currentState:t,...n}=await se(vt);if(0===n.resultCode&&t){const n=t.emission;!de&&be&&we!==(null==ee?void 0:ee.language)&&n&&n.length>0?dt({...t,emission:n},we).then((e=>{e.emission&&Dt(e.emission)})):n&&n.length>0&&(ct({text:n,media:t.media,fromUser:!1,generatedByAI:!!t.completion}),Dt(n),xt({...t,hints:null!==(e=t.hints)&&void 0!==e?e:"G1"===t.state?null==bt?void 0:bt.hints:[]}))}}},Ot=()=>{let t=null==bt?void 0:bt.timeout;if(!t){let e=40,n=25;if(t=Math.floor(Math.random()*(e-n))+n,null==bt?void 0:bt.emission){t+=bt.emission.length/26.5}}e.enableCompletions&&(t+=60);let n=setTimeout(It,1e3*t);Et(n),Ct.current=n};(0,u.useEffect)((()=>{(rt.length||He)&&kt(),vt&&!rt.length&&Tt()}),[null==bt?void 0:bt.acceptsTimeout,null==bt?void 0:bt.timeout,null==bt?void 0:bt.state,He,vt,st,rt]),(0,u.useEffect)((()=>()=>{ke(!1),pe(!1),kt(),Ct.current=void 0}),[]);const Rt=(0,u.useCallback)((t=>{var n,r,i,o;let a="";switch((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:ee.language)&&void 0!==o?o:"IT").toUpperCase()){case"IT":a=""+("MALE"===e.voiceType?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":a=""+("MALE"===e.voiceType?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":a=""+("MALE"===e.voiceType?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":a=""+("MALE"===e.voiceType?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":a=""+("MALE"===e.voiceType?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":a=""+("MALE"===e.voiceType?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":a=""+("MALE"===e.voiceType?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":a=""+("MALE"===e.voiceType?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;default:a=""+("MALE"===e.voiceType?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return a}),[e.voiceType,ee.language,e.culture]),Pt=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])||ee.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"}return i},[Nt,Lt]=(0,u.useState)();(0,u.useEffect)((()=>{(async()=>{try{const e=await fetch(`${w||"https://app.twincreator.com"}/api/lexiconmap`);return await e.json()}catch(e){console.error(e)}})().then((e=>{Lt(e)}))}),[]);const Dt=e=>{if(!T)return;if(qt(),f)return;if(De)return void(je&&Vt());iJ&&iJ.pause();let t=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome"),n=/iPad|iPhone|iPod/.test(navigator.userAgent);if("interrupted"===oJ.state)return void oJ.resume().then((()=>Dt(e)));if(n&&t&&(oJ.suspend(),He))try{rJ&&(rJ.close(),rJ=null),iJ&&(iJ.pause(),iJ.close()),oJ&&oJ.destination.disconnect()}catch(e){console.error("stopAudio error: ",e)}if("closed"===oJ.state){oJ=new ra;let e=oJ.createBuffer(1,1e4,22050),t=oJ.createBufferSource();t.buffer=e,t.connect(oJ.destination)}else if("suspended"===oJ.state){Bt(),oJ=new ra;let e=oJ.createBuffer(1,1e4,22050),t=oJ.createBufferSource();t.buffer=e,t.connect(oJ.destination)}if(!rJ){iJ=new _d.SpeakerAudioDestination;let e=Id.fromSpeakerOutput(iJ);rJ=new Vd.SpeechSynthesizer(nJ,e)}const r=oJ.createBufferSource();r.addEventListener("ended",(()=>{Ve(!1)})),iJ.onAudioEnd=()=>{Ve(!1),r.disconnect(),Qt()},rJ.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="${Pt(we)}"><voice name="${Rt(we)}"><s>${((e,t)=>{var n;if(!Nt)return e;const r={...null!==(n=Nt.common)&&void 0!==n?n:{},...(null==E?void 0:E.id)&&Nt[E.id]?Nt[E.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})(e),we.toLowerCase())}</s></voice></speak>`,(i=>{if(i){Ve(!0);try{oJ.decodeAudioData(i.audioData,(function(e){r.buffer=e,r.connect(oJ.destination),(st.length<1||t&&n)&&r.start(0)})),oJ.onstatechange=()=>{"suspended"===oJ.state||"closed"===oJ.state?(r.disconnect(),Ve(!1)):"interrupted"===oJ.state&&oJ.resume()},oJ.resume(),rJ&&(rJ.close(),rJ=null)}catch(t){console.error("speak error: ",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),Ve(!1),rJ&&(rJ.close(),rJ=null)}}else oJ.resume(),Ve(!1)}),(t=>{console.error("speak:",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),Ve(!1)})),Ae(!1)},Bt=()=>{Ve(!1);try{rJ&&(rJ.close(),rJ=null),"closed"!==oJ.state&&oJ.close(),iJ&&(iJ.pause(),iJ.close())}catch(e){console.error("stopAudio error: ",e)}};(0,u.useEffect)((()=>{let e=document.querySelector("#chat-fieldset textarea");e&&e.focus()}),[null==bt?void 0:bt.emission]);const[jt,Ft]=(0,u.useState)(""),Ut=()=>Ft(""),[zt,Ht]=(0,u.useState)(null),Vt=()=>{let e=setTimeout((async()=>{Kt();const e=Bm(jt);e.length>0?(ut(e),Ut(),it("")):ot&&Tt()}),1e3*Ue);Ht(e)},Wt=()=>{zt&&(clearTimeout(zt),Ht(null))};(0,u.useEffect)((()=>{Wt(),je&&Vt(),Tt()}),[jt]);const Gt=()=>{if(T){Kt(),Ft(""),Ut();try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(e){Oe(!0),nJ||(nJ=Cc.fromSubscription(T,"eastus"),nJ.speechRecognitionLanguage=Pt(we),nJ.speechSynthesisLanguage=Pt(we),nJ.speechSynthesisVoiceName=Rt(we));const t=Id.fromDefaultMicrophoneInput();tJ=new Pd.SpeechRecognizer(nJ,t),at(!0),tJ.recognized=(e,t)=>{if(t.result.text)if(t.result.reason===Pl.RecognizedSpeech){let e=t.result.text;if(Ft(e||""),(null==e?void 0:e.length)>0){const t=Bm(e);t.length>0&&it((e=>`${e} ${t}`))}}else t.result.reason===Pl.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},tJ.canceled=(e,t)=>{t.reason===ol.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?")),qt()},tJ.sessionStopped=(e,t)=>{qt()},Ut(),tJ.startContinuousRecognitionAsync()})).catch(console.error)}catch(e){console.error(e)}}},qt=()=>{tJ&&(tJ.stopContinuousRecognitionAsync(),tJ.close(),tJ=null),at(!1)},Kt=()=>{Oe(!1),qt(),Wt()};(0,u.useEffect)((()=>()=>Kt()),[]),(0,u.useEffect)((()=>{"Z0"===(null==bt?void 0:bt.state)&&Kt()}),[null==bt?void 0:bt.state]);const[Yt,Jt]=(0,u.useState)(!1),Qt=(0,u.useCallback)((e=>{He&&rJ&&(rJ.close(),rJ=null),!je||!Ie&&Yt||(Jt(!0),Gt())}),[je,Ie]);(0,u.useEffect)((()=>{st.length>1&&!He&&je&&(Ie||!Yt)?Gt():He&&ot&&qt()}),[He]),(0,u.useEffect)((()=>(document.addEventListener("endSpeakStartListen",Qt),()=>{document.removeEventListener("endSpeakStartListen",Qt)})),[Qt]),(0,u.useEffect)((()=>{ot&&(Kt(),Ut(),it(""),Gt())}),[ve]);const[Xt,Zt]=(0,u.useState)("keypress");(0,u.useEffect)((()=>{const e=DY("sendOnEnter","keypress");window.innerWidth<=768?Zt("click"):Zt(e)}),[]),(0,u.useEffect)((()=>{BY("sendOnEnter",Xt)}),[Xt]);const[$t,en]=(0,u.useState)(),tn=null==ye?void 0:ye.globalBackground,nn=tn?`url(${tn})`:null,rn=o?{"--memori-chat-bubble-bg":"#fff",...ye&&!c?{"--memori-text-color":null!==(H=ye.textColor)&&void 0!==H?H:"#000"}:{},...(null==ye?void 0:ye.buttonBgColor)?{"--memori-button-bg":ye.buttonBgColor,"--memori-primary":ye.buttonBgColor}:{},...(null==ye?void 0:ye.buttonTextColor)?{"--memori-button-text":ye.buttonTextColor}:{},...(null==ye?void 0:ye.blurBackground)?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...(null==ye?void 0:ye.innerBgColor)?{"--memori-inner-bg":`rgba(${"dark"===ye.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(V=ye.innerBgAlpha)&&void 0!==V?V:.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===ye.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(G=null==ye?void 0:ye.innerBgAlpha)&&void 0!==G?G:.4})`}:{"--memori-inner-content-pad":"0px"}}:{},on=`\n ${f?"#preview":":root"}, .memori-widget {\n ${Object.entries(rn).map((([e,t])=>`${e}: ${t};`)).join("\n")}\n }\n `,an=void 0===(null==ye?void 0:ye.showAIicon)||(null==ye?void 0:ye.showAIicon),[sn,ln]=(0,u.useState)(!1);(0,u.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===Ee||"FULLPAGE"!==Ee)&&ln(!0)}),[]);const[cn,un]=(0,u.useState)();(0,u.useEffect)((()=>{e.engineMemoriID&&(async e=>{let t,n;try{const{contentQualityIndex:r,answerQualityIndex:i,unansweredQuestions:o,...a}=await ue(e);0===a.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=>{un(GY(e.points))})).catch(console.error)}),[e.engineMemoriID]),(0,u.useEffect)((()=>{if(null==ye?void 0:ye.seoTitle){let e=document.createElement("meta");e.setAttribute("property","og:title"),e.setAttribute("content",ye.seoTitle),document.head.append(e)}if(null==ye?void 0:ye.seoDescription){let e=document.createElement("meta");e.setAttribute("property","og:description"),e.setAttribute("content",ye.seoDescription),document.head.append(e)}if(null==ye?void 0:ye.seoUrl){let e=document.createElement("meta");e.setAttribute("property","og:url"),e.setAttribute("content",ye.seoUrl),document.head.append(e)}let t=_||e.avatarURL;if((null==ye?void 0:ye.seoImageShowAvatar)&&t){let e=document.createElement("meta");e.setAttribute("property","og:image"),e.setAttribute("content",t),document.head.append(e)}}),[ye,e.avatarURL,_]);const dn=async t=>{const n=(null==t?void 0:t.sessionID)||vt,r=(null==t?void 0:t.dialogState)||bt;pe(!0);let i=document.getElementById("memori-audio"),o=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome");i&&o&&(i.muted=!1,i.play().catch((e=>{console.error("error playing intro audio",e)})));let a=DY("birthDate",void 0),s=ht||a||void 0;if(!n&&"PUBLIC"!==e.privacyType&&!e.secretToken&&!Ye&&!Qe||!n&&me)return $e("password"),void pe(!1);if(n||!ft||s){if(!n){pe(!1),ge(!1);const t=await St({memoriID:e.engineMemoriID,password:b||e.secretToken,tag:null==C?void 0:C.tag,pin:null==C?void 0:C.pin,initialContextVars:S,initialQuestion:M,birthDate:s});return void((null==t?void 0:t.dialogState)?(lt([]),dt(t.dialogState,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}))):await dn(t||void 0))}if(A){const{currentState:t,...r}=await ce(n);if(0!==r.resultCode||!t)return console.debug("session expired, opening new session"),ge(!0),yt(void 0),pe(!1),void await dn();if(lt([]),de&&e.giverTag&&(null==bt?void 0:bt.currentTag)!==e.giverTag)try{console.debug("change tag #0"),await _t(e.engineMemoriID,n,"-");const t=await _t(e.engineMemoriID,n,e.giverTag,e.giverPIN);if(!t||0!==t.resultCode)throw console.error("session #1",t),new Error("No session");dt(t.currentState,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}))}catch(t){console.error("session #2",t),Mt(!0,null==e?void 0:e.secretToken,void 0,null==e?void 0:e.giverTag,null==e?void 0:e.giverPIN,S,M,s).then((()=>{ke(!0)}))}else if(!de&&C&&(null==bt?void 0:bt.currentTag)!==C.tag)try{console.debug("change tag #3"),await _t(e.engineMemoriID,n,"-");const t=await _t(e.engineMemoriID,n,C.tag,C.pin);if(!t||0!==t.resultCode)throw console.error("session #4",t),new Error("No session");dt(t.currentState,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}))}catch(t){console.error("session #5",t),Mt(!0,null==e?void 0:e.secretToken,void 0,C.tag,C.pin,S,M,s).then((()=>{ke(!0)}))}else if(de||C||(null==bt?void 0:bt.currentTag)===Ag)dt(t,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}));else try{console.debug("change tag #6"),await _t(e.engineMemoriID,n,"-");const t=await _t(e.engineMemoriID,n,Ag);if(!t||0!==t.resultCode)throw console.error("session #7",t),new Error("No session");dt(t.currentState,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}))}catch(t){console.error("session #8",t),Mt(!0,null==e?void 0:e.secretToken,void 0,void 0,void 0,S,M,s).then((()=>{ke(!0)}))}}else lt([]),dt(r,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}))}else gt(!0),pe(!1)},[fn,hn]=(0,u.useState)(k);(0,u.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?hn(t.target.getAttribute("authtoken")||void 0):hn((null===(i=null===(r=t.target)||void 0===r?void 0:r.parentElement)||void 0===i?void 0:i.getAttribute("authtoken"))||void 0))}));return n.observe(t,{attributes:!0,childList:!1,subtree:!1}),()=>{n.disconnect()}}),[]);const pn={memori:e,history:st,showShare:null===(q=null!=d?d:null==ye?void 0:ye.showShare)||void 0===q||q,position:et,setShowPositionDrawer:Pe,setShowSettingsDrawer:Le,showSpeaker:!!T,speakerMuted:De,setSpeakerMuted:e=>{if(Be(e),BY("muteSpeaker",!!e),e)Bt();else{oJ=new ra;let e=oJ.createBuffer(1,1e4,22050),t=oJ.createBufferSource();t.buffer=e,t.connect(oJ.destination)}},showSettings:v,hasUserActivatedSpeak:Ce,showReload:"TOTEM"===Ee},mn={memori:e,integration:o,integrationConfig:ye,tenant:E,instruct:de,avatar3dVisible:sn,setAvatar3dVisible:ln,hasUserActivatedSpeak:Ce,isPlayingAudio:He,loading:_e,baseUrl:w,apiUrl:x},gn={memori:e,tenant:E,gamificationLevel:cn,language:ve,userLang:we,setUserLang:xe,baseUrl:w,apiUrl:x,position:et,openPositionDrawer:()=>Pe(!0),integrationConfig:ye,instruct:de,sessionId:vt,clickedStart:he,onClickStart:dn,initializeTTS:()=>{if(!T)return;nJ=Cc.fromSubscription(T,"eastus"),nJ.speechSynthesisLanguage=Pt(we),nJ.speechSynthesisVoiceName=Rt(we),nJ.speechRecognitionLanguage=Pt(we),Dm()&&(nJ.speechSynthesisOutputFormat=hc.Audio16Khz32KBitRateMonoMp3),oJ=new ra;let e=oJ.createBuffer(1,1e4,22050),t=oJ.createBufferSource();t.buffer=e,t.connect(oJ.destination),iJ=new _d.SpeakerAudioDestination;let n=Id.fromSpeakerOutput(iJ);rJ=new Vd.SpeechSynthesizer(nJ,n)}},vn={memori:e,sessionID:vt||"",tenant:E,translateTo:be&&we.toUpperCase()!==(null===(X=null!==(Q=null!==(J=null===(Y=null===(K=e.culture)||void 0===K?void 0:K.split("-"))||void 0===Y?void 0:Y[0])&&void 0!==J?J:ee.language)&&void 0!==Q?Q:"IT")||void 0===X?void 0:X.toUpperCase())?we:void 0,baseUrl:w,apiUrl:x,memoriTyping:_e,history:"TOTEM"===a?st.slice(-2):st,authToken:fn,dialogState:bt,setDialogState:xt,pushMessage:ct,simulateUserPrompt:(e,t)=>{qt(),Bt(),ut(e,void 0,void 0,!1,t)},showDates:m,showContextPerLine:g,showAIicon:an,client:re,selectReceiverTag:async t=>{var n;if(vt)try{const{currentState:r,...i}=await le(vt,t);if(0===i.resultCode)if(ct({text:t,fromUser:!0}),"X4"===r.state&&e.giverTag){const{currentState:t,...n}=await re.postTagChangedEvent(vt,e.giverTag);0===n.resultCode?(xt(t),t.emission&&ct({text:t.emission,media:t.media,fromUser:!1})):(console.error(n),Qd.error($($F(n.resultCode))))}else xt(r),r.emission&&ct({text:r.emission,media:r.media,fromUser:!1});else console.error(i,t,null===(n=null==bt?void 0:bt.knownTags)||void 0===n?void 0:n[t]),Qd.error($($F(i.resultCode)))}catch(e){let t=e;console.error(t),Qd.error(t.message)}},preview:f,sendOnEnter:Xt,setSendOnEnter:Zt,microphoneMode:je?"CONTINUOUS":"HOLD_TO_TALK",attachmentsMenuOpen:$t,setAttachmentsMenuOpen:en,instruct:de,showInputs:p,showMicrophone:!!T,userMessage:rt,onChangeUserMessage:e=>{if(!e||"\n"===e||""===e.trim())return it(""),void Tt();it(e),kt()},sendMessage:e=>{Bt(),qt(),ut(e),it(""),Ut()},stopListening:Kt,startListening:Gt,stopAudio:Bt,resetTranscript:Ut,listening:ot,isPlayingAudio:He},yn=o&&nn?(0,s.jsx)("div",{className:"memori--global-background",children:(0,s.jsx)("div",{className:"memori--global-background-image",style:{backgroundImage:nn}})}):(0,s.jsx)("div",{className:"memori--global-background no-background-image"}),bn=o?(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:on}}):null,wn={canInstruct:!!e.giverTag,instruct:!!de,onChangeMode:e=>{fe("instruct"===e),ke(!1),pe(!1)}},xn=(0,s.jsx)(OY,{tenant:E,userLang:we}),Sn=l||("TOTEM"===Ee?PY:"CHAT"===Ee?NY:RY);return(0,s.jsxs)("div",{className:r(Jd)("memori","memori-widget",`memori-layout-${a.toLowerCase()}`,`memori-controls-${We.toLowerCase()}`,{"memori--preview":f,"memori--embed":h,"memori--with-integration":o,"memori--with-speechkey":!!T,"memori--active":Ce,"memori--hide-emissions":qe}),"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({...bt,sessionID:vt}),style:{height:y},children:[(0,s.jsx)(Sn,{Header:XF,headerProps:pn,Avatar:qj,avatarProps:mn,Chat:Ob,chatProps:vn,StartPanel:tw,startPanelProps:gn,integrationStyle:bn,integrationBackground:yn,ChangeMode:Kj,changeModeProps:wn,poweredBy:xn,sessionId:vt,hasUserActivatedSpeak:Ce,showInstruct:c,loading:Se}),(0,s.jsx)("audio",{id:"memori-audio",style:{display:"none"},src:"https://app.twincreator.com/intro.mp3"}),te&&(0,s.jsx)(Lm,{withModal:!0,pwdOrTokens:Ze,openModal:!!Ze,setPwdOrTokens:$e,showTokens:"SECRET"===e.privacyType,onFinish:async t=>{t.password&&Je(t.password),t.tokens&&Xe(t.tokens),Mt(!vt,t.password,t.tokens,de?e.giverTag:void 0,de?e.giverPIN:void 0,S,M,ht).then((e=>{$e(null),dn(e||void 0)})).catch((()=>{$e(null),ge(!0)}))},minimumNumberOfRecoveryTokens:null!==(Z=null==e?void 0:e.minimumNumberOfRecoveryTokens)&&void 0!==Z?Z:1}),te&&(0,s.jsx)(QY,{visible:mt,minAge:ft,onClose:t=>{t?(pt(t),BY("birthDate",t),Mt(!vt,null==e?void 0:e.secretToken,void 0,de?e.giverTag:void 0,de?e.giverPIN:void 0,S,M,t).then((e=>{gt(!1),dn(e||void 0)})).catch((()=>{gt(!1),ge(!0)}))):(gt(!1),pe(!1))}}),Ne&&(0,s.jsx)(eJ,{layout:Ee,open:!!Ne,onClose:()=>Le(!1),microphoneMode:je?"CONTINUOUS":"HOLD_TO_TALK",continuousSpeechTimeout:Ue,setMicrophoneMode:e=>Fe("CONTINUOUS"===e),setContinuousSpeechTimeout:ze,controlsPosition:We,setControlsPosition:Ge,hideEmissions:qe,setHideEmissions:Ke}),vt&&(0,s.jsx)(IY,{apiURL:x,visible:"link"===$t,onCancel:()=>en(void 0),onOk:async e=>{if(!vt)return;let t={mediumID:"",mimeType:"text/html",url:e.url,title:e.title};ct({text:$("media.insertThisLink",{url:t.url,title:t.title}),fromUser:!0,media:[t]});try{const{currentState:e,...n}=await re.postMediumSelectedEvent(vt,t);e&&0===n.resultCode?(xt(e),e.emission&&(ct({text:e.emission,media:e.media,fromUser:!1}),Dt(e.emission))):(console.error(n,e,t),Qd.error($($F(n.resultCode),{ns:"common"})))}catch(e){let t=e;console.error(t),Qd.error(t.message)}en(void 0)}}),fn&&vt&&(null==E?void 0:E.id)&&(0,s.jsx)(TY,{apiURL:x,visible:"media"===$t,authToken:fn,tenantID:null==E?void 0:E.id,sessionID:vt,uploadAssetURL:re.backend.getUploadAssetURL(fn,e.memoriID),deleteAsset:re.backend.deleteAsset,onCancel:()=>en(void 0),onOk:async e=>{if(!vt)return;let t={mediumID:"",mimeType:e.mimeType,url:e.assetURL,title:e.title||e.assetID};ct({text:$("media.insertThisMediaMsg"),fromUser:!0,media:[t]});try{const{currentState:e,...n}=await re.postMediumSelectedEvent(vt,t);e&&0===n.resultCode?(xt(e),e.emission&&(ct({text:e.emission,media:e.media,fromUser:!1}),Dt(e.emission))):(console.error(n,e,t),Qd.error($($F(n.resultCode),{ns:"common"})))}catch(e){let t=e;console.error(t),Qd.error(t.message)}en(void 0)}})]})};function sJ(e){return sJ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sJ(e)}function lJ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cJ(e,t){if("object"!==sJ(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==sJ(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function uJ(e){var t=cJ(e,"string");return"symbol"===sJ(t)?t:String(t)}function dJ(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,uJ(r.key),r)}}function fJ(e,t,n){return t&&dJ(e.prototype,t),n&&dJ(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function hJ(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pJ(e,t){return pJ=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pJ(e,t)}function mJ(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&&pJ(e,t)}function gJ(e,t){if(t&&("object"===sJ(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return hJ(e)}function vJ(e){return vJ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vJ(e)}function yJ(e,t,n){return(t=uJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bJ(e){if(Array.isArray(e))return e}function wJ(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function xJ(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 SJ(e,t){if(e){if("string"==typeof e)return xJ(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)?xJ(e,t):void 0}}function MJ(){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 _J(e){return bJ(e)||wJ(e)||SJ(e)||MJ()}function AJ(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 EJ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?AJ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AJ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var CJ={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)}},kJ=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lJ(this,e),this.init(t,n)}return fJ(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||CJ,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,EJ(EJ({},{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}(),TJ=new kJ,IJ=function(){function e(){lJ(this,e),this.observers={}}return fJ(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 OJ(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function RJ(e){return null==e?"":""+e}function PJ(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e])}))}function NJ(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 a=r(o.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function LJ(e,t,n){var r=NJ(e,t,Object);r.obj[r.k]=n}function DJ(e,t){var n=NJ(e,t),r=n.obj,i=n.k;if(r)return r[i]}function BJ(e,t,n){var r=DJ(e,n);return void 0!==r?r:DJ(t,n)}function jJ(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]):jJ(e[r],t[r],n):e[r]=t[r]);return e}function FJ(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var UJ={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function zJ(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return UJ[e]})):e}var HJ="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,VJ=[" ",",","?","!",";"];function WJ(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 GJ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?WJ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WJ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function qJ(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=vJ(e);if(t){var i=vJ(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gJ(this,n)}}function KJ(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 a=2,s=r.slice(o,o+a).join(n),l=i[s];void 0===l&&r.length>o+a;)a++,l=i[s=r.slice(o,o+a).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(s)){if("string"==typeof l)return l;if(s&&"string"==typeof l[s])return l[s]}var c=r.slice(o+a).join(n);return c?KJ(l,c,n):void 0}i=i[r[o]]}return i}}var YJ=function(e){mJ(n,e);var t=qJ(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return lJ(this,n),r=t.call(this),HJ&&IJ.call(hJ(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 fJ(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,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=DJ(this.data,a);return s||!o||"string"!=typeof n?s:KJ(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 a=[e,t];n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),LJ(this.data,a,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},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=DJ(this.data,a)||{};r?jJ(s,n,i):s=GJ(GJ({},s),n),LJ(this.data,a,s),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?GJ(GJ({},{}),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}(IJ),JJ={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 QJ(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 XJ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?QJ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QJ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ZJ(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=vJ(e);if(t){var i=vJ(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gJ(this,n)}}var $J={},eQ=function(e){mJ(n,e);var t=ZJ(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return lJ(this,n),r=t.call(this),HJ&&IJ.call(hJ(r)),PJ(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,hJ(r)),r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=TJ.create("translator"),r}return fJ(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,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=VJ.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 a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}(e,n,r));if(o&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.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"!==sJ(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,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),l=s.key,c=s.namespaces,u=c[c.length-1],d=t.lng||this.language,f=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(f){var h=t.nsSeparator||this.options.nsSeparator;return o?(p.res="".concat(u).concat(h).concat(l),p):"".concat(u).concat(h).concat(l)}return o?(p.res=l,p):l}var p=this.resolve(e,t),m=p&&p.res,g=p&&p.usedKey||l,v=p&&p.exactUsedKey||l,y=Object.prototype.toString.apply(m),b=["[object Number]","[object Function]","[object RegExp]"],w=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,x=!this.i18nFormat||this.i18nFormat.handleAsObject,S="string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m;if(x&&m&&S&&b.indexOf(y)<0&&("string"!=typeof w||"[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 M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,XJ(XJ({},t),{},{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return o?(p.res=M,p):M}if(a){var _="[object Array]"===y,A=_?[]:{},E=_?v:g;for(var C in m)if(Object.prototype.hasOwnProperty.call(m,C)){var k="".concat(E).concat(a).concat(C);A[C]=this.translate(k,XJ(XJ({},t),{joinArrays:!1,ns:c})),A[C]===k&&(A[C]=m[C])}m=A}}else if(x&&"string"==typeof w&&"[object Array]"===y)(m=m.join(w))&&(m=this.extendTranslation(m,e,t,r));else{var T=!1,I=!1,O=void 0!==t.count&&"string"!=typeof t.count,R=n.hasDefaultValue(t),P=O?this.pluralResolver.getSuffix(d,t.count,t):"",N=t["defaultValue".concat(P)]||t.defaultValue;!this.isValidLookup(m)&&R&&(T=!0,m=N),this.isValidLookup(m)||(I=!0,m=l);var L=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,D=L&&I?void 0:m,B=R&&N!==m&&this.options.updateMissing;if(I||T||B){if(this.logger.log(B?"updateKey":"missingKey",d,u,l,B?N:m),a){var j=this.resolve(l,XJ(XJ({},t),{},{keySeparator:!1}));j&&j.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 z=0;z<U.length;z++)F.push(U[z]);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=R&&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&&O?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,p,r),I&&m===l&&this.options.appendNamespaceToMissingKey&&(m="".concat(u,":").concat(l)),(I||T)&&this.options.parseMissingKeyHandler&&(m="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(u,":").concat(l):l,T?m:void 0):this.options.parseMissingKeyHandler(m))}return o?(p.res=m,p):m}},{key:"extendTranslation",value:function(e,t,n,r,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,XJ(XJ({},this.options.interpolation.defaultVariables),n),r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(XJ(XJ({},n),{interpolation:XJ(XJ({},this.options.interpolation),n.interpolation)}));var a,s="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(s){var l=e.match(this.interpolator.nestingRegexp);a=l&&l.length}var c=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(c=XJ(XJ({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,n.lng||this.language,n),s){var u=e.match(this.interpolator.nestingRegexp);a<(u&&u.length)&&(n.nest=!1)}!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];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,f="string"==typeof d?[d]:d;return null!=e&&f&&f.length&&!1!==n.applyPostProcessor&&(e=JJ.handle(f,e,t,this.options&&this.options.postProcessPassResolved?XJ({i18nResolved:r},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,r,i,o,a=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,s),c=l.key;n=c;var u=l.namespaces;a.options.fallbackNS&&(u=u.concat(a.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,f=d&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),h=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);u.forEach((function(e){a.isValidLookup(t)||(o=e,!$J["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(o)&&($J["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.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!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){i=n;var o,l=[c];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(l,c,n,e,s);else{var u;d&&(u=a.pluralResolver.getSuffix(n,s.count,s));var p="".concat(a.options.pluralSeparator,"zero");if(d&&(l.push(c+u),f&&l.push(c+p)),h){var m="".concat(c).concat(a.options.contextSeparator).concat(s.context);l.push(m),d&&(l.push(m+u),f&&l.push(m+p))}}for(;o=l.pop();)a.isValidLookup(t)||(r=o,t=a.getResource(n,e,o,s))}})))}))}})),{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}(IJ);function tQ(e){return e.charAt(0).toUpperCase()+e.slice(1)}var nQ=function(){function e(t){lJ(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=TJ.create("languageUtils")}return fJ(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]=tQ(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]=tQ(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=tQ(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}(),rQ=[{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}],iQ={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)}},oQ=["v1","v2","v3"],aQ={zero:0,one:1,two:2,few:3,many:4,other:5};function sQ(){var e={};return rQ.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:iQ[t.fc]}}))})),e}var lQ=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lJ(this,e),this.languageUtils=t,this.options=n,this.logger=TJ.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=sQ()}return fJ(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 aQ[e]-aQ[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!oQ.includes(this.options.compatibilityJSON)}}]),e}();function cQ(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 uQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cQ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cQ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var dQ=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};lJ(this,e),this.logger=TJ.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return fJ(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:zJ,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?FJ(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?FJ(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?FJ(t.nestingPrefix):t.nestingPrefixEscaped||FJ("$t("),this.nestingSuffix=t.nestingSuffix?FJ(t.nestingSuffix):t.nestingSuffixEscaped||FJ(")"),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,a,s=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(s.formatSeparator)<0){var i=BJ(t,l,e);return s.alwaysFormat?s.format(i,void 0,n,uQ(uQ(uQ({},r),t),{},{interpolationkey:e})):i}var o=e.split(s.formatSeparator),a=o.shift().trim(),c=o.join(s.formatSeparator).trim();return s.format(BJ(t,l,a),c,n,uQ(uQ(uQ({},r),t),{},{interpolationkey:a}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=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 s.escapeValue?c(s.escape(e)):c(e)}}].forEach((function(t){for(a=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(f){o=i[0];continue}s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}else"string"==typeof o||s.useRawValueToEscape||(o=RJ(o));var c=t.safeValue(o);if(e=e.replace(i[0],c),f?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=uQ({},o);function s(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,a)).match(/'/g),s=i.match(/"/g);(o&&o.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{a=JSON.parse(i),t&&(a=uQ(uQ({},t),a))}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 a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.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(s.call(this,n[1].trim(),a),a))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=RJ(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,uQ(uQ({},o),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function fQ(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 hQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fQ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fQ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pQ(e){var t={};return function(n,r,i){var o=r+JSON.stringify(i),a=t[o];return a||(a=e(r,i),t[o]=a),a(n)}}var mQ=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};lJ(this,e),this.logger=TJ.create("formatter"),this.options=t,this.formats={number:pQ((function(e,t){var n=new Intl.NumberFormat(e,t);return function(e){return n.format(e)}})),currency:pQ((function(e,t){var n=new Intl.NumberFormat(e,hQ(hQ({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:pQ((function(e,t){var n=new Intl.DateTimeFormat(e,hQ({},t));return function(e){return n.format(e)}})),relativetime:pQ((function(e,t){var n=new Intl.RelativeTimeFormat(e,hQ({},t));return function(e){return n.format(e,t.range||"day")}})),list:pQ((function(e,t){var n=new Intl.ListFormat(e,hQ({},t));return function(e){return n.format(e)}}))},this.init(t)}return fJ(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()]=pQ(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=_J(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),a=o.formatName,s=o.formatOptions;if(i.formats[a]){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[a](e,u,hQ(hQ(hQ({},s),r),c))}catch(e){i.logger.warn(e)}return l}return i.logger.warn("there was no format function for ".concat(a)),e}),e);return o}}]),e}();function gQ(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 vQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gQ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gQ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yQ(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=vJ(e);if(t){var i=vJ(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gJ(this,n)}}var bQ=function(e){mJ(n,e);var t=yQ(n);function n(e,r,i){var o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return lJ(this,n),o=t.call(this),HJ&&IJ.call(hJ(o)),o.backend=e,o.store=r,o.services=i,o.languageUtils=i.languageUtils,o.options=a,o.logger=TJ.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,a.backend,a),o}return fJ(n,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},a={},s={},l={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[s]=2:i.state[s]<0||(1===i.state[s]?void 0===a[s]&&(a[s]=!0):(i.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===l[t]&&(l[t]=!0)))})),r||(s[e]=!0)})),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),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 a={};this.queue.forEach((function(n){var r,s,l,c,u,d;r=n.loaded,s=o,c=NJ(r,[i],Object),u=c.obj,d=c.k,u[d]=u[d]||[],l&&(u[d]=u[d].concat(s)),l||u[d].push(s),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){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),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,a=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:a}):(this.readingCalls++,this.backend[n](e,t,(function(s,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)}s&&l&&i<r.maxRetries?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,a)}),o):a(s,l)}))):a(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,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),a),t.loaded(e,r,a)}))}},{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,vQ(vQ({},o),{},{isUpdate:i})),e&&e[0]&&this.store.addResource(e[0],t,n,r))}}]),n}(IJ);function wQ(){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"===sJ(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===sJ(e[2])||"object"===sJ(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 xQ(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 SQ(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 MQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?SQ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SQ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _Q(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=vJ(e);if(t){var i=vJ(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gJ(this,n)}}function AQ(){}function EQ(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var CQ=function(e){mJ(n,e);var t=_Q(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(lJ(this,n),e=t.call(this),HJ&&IJ.call(hJ(e)),e.options=xQ(r),e.services={},e.logger=TJ,e.modules={external:[]},EQ(hJ(e)),i&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,i),gJ(e,hJ(e));setTimeout((function(){e.init(r,i)}),0)}return e}return fJ(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=wQ();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=MQ(MQ(MQ({},r),this.options),xQ(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=MQ(MQ({},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?TJ.init(i(this.modules.logger),this.options):TJ.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=mQ);var a=new nQ(this.options);this.store=new YJ(this.options.resources,this.options);var s=this.services;s.logger=TJ,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new lQ(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(s.formatter=i(o),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new dQ(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new bQ(i(this.modules.backend),s.resourceStore,s,this.options),s.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&&(s.languageDetector=i(this.modules.languageDetector),s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=i(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new eQ(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=AQ),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=OJ(),f=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?f():setTimeout(f,0),d}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:AQ,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=[],a=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){o.indexOf(e)<0&&o.push(e)}))};if(i)a(i);else{var s=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);s.forEach((function(e){return a(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return a(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=OJ();return e||(e=this.languages),t||(t=this.options.ns),n||(n=AQ),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&&JJ.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=OJ();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 a="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);a&&(n.language||i(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,(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,a)}))};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"!==sJ(i)){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l<a;l++)s[l-2]=arguments[l];o=r.options.overloadTranslationOptionHandler([t,i].concat(s))}else o=MQ({},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 a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(r,e)||i&&!a(o,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=OJ();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=OJ();"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]:AQ,i=MQ(MQ(MQ({},this.options),t),{isClone:!0}),o=new n(i);void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t));var a=["store","services","language"];return a.forEach((function(t){o[t]=e[t]})),o.services=MQ({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new eQ(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}(IJ);yJ(CQ,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new CQ(e,t)}));var kQ=CQ.createInstance();kQ.createInstance=CQ.createInstance;kQ.createInstance,kQ.init,kQ.loadResources,kQ.reloadResources,kQ.use,kQ.changeLanguage,kQ.getFixedT,kQ.t,kQ.exists,kQ.setDefaultNamespace,kQ.hasLoadedNamespace,kQ.loadNamespaces,kQ.loadLanguages;var TQ,IQ=kQ;TQ=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","fullscreenEnter":"Passa a schermo intero","fullscreenExit":"Esci da schermo intero","center":"Centro","bottom":"In basso","hidden":"Nascosto","day":"Giorno","month":"Mese","year":"Anno","copy":"Copia","copyToClipboard":"Copia negli appunti","showOriginalText":"Mostra originale","showTranslatedText":"Mostra traduzione","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","completionsEnabled":"IA evoluta, può rispondere con risposte generate automaticamente che talvolta potrebbero contenere informazioni non corrette","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","auth":{"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":"Posizione","settings":"Impostazioni","share":"Condividi","sendOnKeypress":"Premi Invio per inviare","sendOnClick":"Clicca sul bottone di invio","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!","requirePosition":"Inserisci la posizione prima di iniziare","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"},"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","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_CANT_EDIT_INTEGRATIONS":"Utente non abilitato a gestire integrazioni","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","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_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","INTEGRATION_NOT_FOUND":"Integrazione non trovata","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","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"}}');const OQ={en:{translation:r(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","fullscreenEnter":"Enter fullscreen","fullscreenExit":"Exit fullscreen","center":"Center","bottom":"Bottom","hidden":"Hidden","day":"Day","month":"Month","year":"Year","copy":"Copy","copyToClipboard":"Copy to clipboard","showOriginalText":"Show original","showTranslatedText":"Show translation","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","completionsEnabled":"Advanced AI, can respond with automatically generated answers that may sometimes contain incorrect information","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","auth":{"useRecoveryTokens":"Use recovery tokens","tokens":"Tokens","addToken":"Add token","usePassword":"Use password","atLeast":"At least"},"widget":{"instruct":"Instruct","test":"Test","sound":"Sound","position":"Position","settings":"Settings","share":"Share","sendOnKeypress":"Hit Enter to send","sendOnClick":"Click on Submit","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","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"},"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","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_CANT_EDIT_INTEGRATIONS":"User not allowed to manage integrations","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","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_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","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"}}'))},it:{translation:r(TQ)}};IQ.use(ye).init({resources:OQ,lng:"en",fallbackLng:"it",supportedLngs:["en","it"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1}});var RQ=IQ;const PQ=({ownerUserName:e,ownerUserID:t,memoriName:n,memoriID:r,integrationID:i,tenantID:o,secretToken:a,sessionID:l,layout:c="DEFAULT",customLayout:d,showShare:f=!0,showSettings:h=!0,showInstruct:p=!1,height:m="100%",baseURL:g,apiURL:v="https://backend.memori.ai",tag:y,pin:b,context:w,initialQuestion:x,uiLang:S,spokenLang:M,multilingual:_=!1,authToken:A,AZURE_COGNITIVE_SERVICES_TTS_KEY:E,onStateChange:C})=>{var k,T,I;const[O,R]=(0,u.useState)(),[P,N]=(0,u.useState)(E),{t:L}=Te();if(!(r&&t||n&&e))throw new Error("Identifier pair required: please provide either memoriID and ownerUserID or memoriName and ownerUserName");const D=W(v),B=(0,u.useCallback)((async()=>{const e=g||(o.startsWith("https://")?o:`https://${o}`),t=await fetch(`${e}/api/speechkey`),n=await t.json();n.AZURE_COGNITIVE_SERVICES_TTS_KEY&&N(n.AZURE_COGNITIVE_SERVICES_TTS_KEY)}),[]);(0,u.useEffect)((()=>{E||B()}),[E]);const j=(0,u.useCallback)((async()=>{if(r&&t){const{memori:e,...n}=await D.backend.getMemoriByUserAndId(o,t,r);0===n.resultCode&&e?R(e):console.error("[MEMORI]",n,e)}else if(n&&e){const{memori:t,...r}=await D.backend.getMemori(o,e,n);0===r.resultCode&&t?R(t):console.error("[MEMORI]",r,t)}}),[r,t,n,e,o]);return(0,u.useEffect)((()=>{j()}),[j,o]),(0,u.useEffect)((()=>{if(S)RQ.changeLanguage(S.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"}})();RQ.changeLanguage(e).catch((()=>{RQ.changeLanguage(t)}))}}),[S]),O?(0,s.jsx)(aJ,{layout:c,customLayout:d,height:m,baseUrl:g||(o.startsWith("https://")?o:`https://${o}`),apiUrl:v,memori:{...O,secretToken:a},memoriLang:null!=M?M:null===(T=null===(k=O.culture)||void 0===k?void 0:k.split("-"))||void 0===T?void 0:T[0],multilingual:_,tenant:{id:o,theme:"twincreator",config:{name:o,showNewUser:!1,requirePosition:!!O.needsPosition}},secret:a,sessionID:l,showShare:f,showSettings:h,showInstruct:p,integration:null===(I=null==O?void 0:O.integrations)||void 0===I?void 0:I.find((e=>i?e.integrationID===i:!!e.publish&&"LANDING_EXPERIENCE"===e.type)),initialContextVars:w,initialQuestion:x,authToken:A,AZURE_COGNITIVE_SERVICES_TTS_KEY:P||E,onStateChange:C,...y&&b?{personification:{tag:y,pin:b}}:{}}):(0,s.jsx)("div",{children:(0,s.jsxs)("p",{style:{textAlign:"center",margin:"2rem auto"},children:[L("loading"),"..."]})})};PQ.propTypes={memoriName:r(l).string,memoriID:r(l).string,ownerUserName:r(l).string,ownerUserID:r(l).string,integrationID:r(l).string,tenantID:r(l).string.isRequired,secretToken:r(l).string,sessionID:r(l).string,showShare:r(l).bool,showSettings:r(l).bool,showInstruct:r(l).bool,layout:r(l).oneOf(["DEFAULT","FULLPAGE","TOTEM"]),height:r(l).oneOfType([r(l).string,r(l).number]),baseURL:r(l).string,apiURL:r(l).string,tag:r(l).string,pin:r(l).string,context:r(l).objectOf(r(l).any),initialQuestion:r(l).string,uiLang:r(l).oneOf(["en","it"]),spokenLang:r(l).string,authToken:r(l).string,AZURE_COGNITIVE_SERVICES_TTS_KEY:r(l).string,onStateChange:r(l).func};var NQ=PQ;class LQ extends HTMLElement{connectedCallback(){const e=document.createElement("div"),t=document.createElement("div");t.setAttribute("id","memori-root"),e.appendChild(t),this.appendChild(e);const n=Object.keys(NQ.propTypes).reduce(((e,t)=>(this.hasAttribute(t)&&(e[t]=this.getAttribute(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}}),{});i?r(c).render((0,s.jsx)(NQ,{...n,context:o,tenantID:i}),t):console.error("No tenantId attribute found")}}customElements.define("memori-client",LQ)})();
122
+ ***************************************************************************** */function $K(e,t){function n(){this.constructor=e}ZK(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var eY=function(){return eY=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},eY.apply(this,arguments)};Object.create;Object.create;var tY;u=a("85Hg2");function nY(e,t,n,r,i,o){void 0===o&&(o=0);var a=hY(e,t,o),s=a.width,l=a.height,c=Math.min(s,n),u=Math.min(l,r);return c>u*i?{width:u*i,height:u}:{width:c,height:c/i}}function rY(e,t,n,r,i){void 0===i&&(i=0);var o=hY(t.width,t.height,i),a=o.width,s=o.height;return{x:iY(e.x,a,n.width,r),y:iY(e.y,s,n.height,r)}}function iY(e,t,n,r){var i=t*r/2-n/2;return pY(e,-i,i)}function oY(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function aY(e,t){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI}function sY(e,t,n,r,i,o,a){void 0===o&&(o=0),void 0===a&&(a=!0);var s=a?lY:cY,l=hY(t.width,t.height,o),c=hY(t.naturalWidth,t.naturalHeight,o),u={x:s(100,((l.width-n.width/i)/2-e.x/i)/l.width*100),y:s(100,((l.height-n.height/i)/2-e.y/i)/l.height*100),width:s(100,n.width/l.width*100/i),height:s(100,n.height/l.height*100/i)},d=Math.round(s(c.width,u.width*c.width/100)),f=Math.round(s(c.height,u.height*c.height/100)),h=c.width>=c.height*r?{width:Math.round(f*r),height:f}:{width:d,height:Math.round(d/r)};return{croppedAreaPercentages:u,croppedAreaPixels:eY(eY({},h),{x:Math.round(s(c.width-h.width,u.x*c.width/100)),y:Math.round(s(c.height-h.height,u.y*c.height/100))})}}function lY(e,t){return Math.min(e,Math.max(0,t))}function cY(e,t){return t}function uY(e,t,n,r,i,o){var a=hY(t.width,t.height,n),s=pY(r.width/a.width*(100/e.width),i,o);return{crop:{x:s*a.width/2-r.width/2-a.width*s*(e.x/100),y:s*a.height/2-r.height/2-a.height*s*(e.y/100)},zoom:s}}function dY(e,t,n,r,i,o){void 0===n&&(n=0);var a=hY(t.naturalWidth,t.naturalHeight,n),s=pY(function(e,t,n){var r=function(e){return e.width>e.height?e.width/e.naturalWidth:e.height/e.naturalHeight}(t);return n.height>n.width?n.height/(e.height*r):n.width/(e.width*r)}(e,t,r),i,o),l=r.height>r.width?r.height/e.height:r.width/e.width;return{crop:{x:((a.width-e.width)/2-e.x)*l,y:((a.height-e.height)/2-e.y)*l},zoom:s}}function fY(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function hY(e,t,n){var r=n*Math.PI/180;return{width:Math.abs(Math.cos(r)*e)+Math.abs(Math.sin(r)*t),height:Math.abs(Math.sin(r)*e)+Math.abs(Math.cos(r)*t)}}function pY(e,t,n){return Math.min(Math.max(e,t),n)}function mY(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter((function(e){return"string"==typeof e&&e.length>0})).join(" ").trim()}tY=a("lmpx0");var gY=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.imageRef=r(u).createRef(),n.videoRef=r(u).createRef(),n.containerRef=null,n.styleRef=null,n.containerRect=null,n.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},n.dragStartPosition={x:0,y:0},n.dragStartCrop={x:0,y:0},n.gestureZoomStart=0,n.gestureRotationStart=0,n.isTouching=!1,n.lastPinchDistance=0,n.lastPinchRotation=0,n.rafDragTimeout=null,n.rafPinchTimeout=null,n.wheelTimer=null,n.currentDoc="undefined"!=typeof document?document:null,n.currentWindow="undefined"!=typeof window?window:null,n.resizeObserver=null,n.state={cropSize:null,hasWheelJustStarted:!1},n.initResizeObserver=function(){if(void 0!==window.ResizeObserver&&n.containerRef){var e=!0;n.resizeObserver=new window.ResizeObserver((function(t){e?e=!1:n.computeSizes()})),n.resizeObserver.observe(n.containerRef)}},n.preventZoomSafari=function(e){return e.preventDefault()},n.cleanEvents=function(){n.currentDoc&&(n.currentDoc.removeEventListener("mousemove",n.onMouseMove),n.currentDoc.removeEventListener("mouseup",n.onDragStopped),n.currentDoc.removeEventListener("touchmove",n.onTouchMove),n.currentDoc.removeEventListener("touchend",n.onDragStopped),n.currentDoc.removeEventListener("gesturemove",n.onGestureMove),n.currentDoc.removeEventListener("gestureend",n.onGestureEnd))},n.clearScrollEvent=function(){n.containerRef&&n.containerRef.removeEventListener("wheel",n.onWheel),n.wheelTimer&&clearTimeout(n.wheelTimer)},n.onMediaLoad=function(){var e=n.computeSizes();e&&(n.emitCropData(),n.setInitialCrop(e)),n.props.onMediaLoaded&&n.props.onMediaLoaded(n.mediaSize)},n.setInitialCrop=function(e){if(n.props.initialCroppedAreaPercentages){var t=uY(n.props.initialCroppedAreaPercentages,n.mediaSize,n.props.rotation,e,n.props.minZoom,n.props.maxZoom),r=t.crop,i=t.zoom;n.props.onCropChange(r),n.props.onZoomChange&&n.props.onZoomChange(i)}else if(n.props.initialCroppedAreaPixels){var o=dY(n.props.initialCroppedAreaPixels,n.mediaSize,n.props.rotation,e,n.props.minZoom,n.props.maxZoom);r=o.crop,i=o.zoom;n.props.onCropChange(r),n.props.onZoomChange&&n.props.onZoomChange(i)}},n.computeSizes=function(){var e,t,r,i,o,a,s=n.imageRef.current||n.videoRef.current;if(s&&n.containerRef){n.containerRect=n.containerRef.getBoundingClientRect();var l=n.containerRect.width/n.containerRect.height,c=(null===(e=n.imageRef.current)||void 0===e?void 0:e.naturalWidth)||(null===(t=n.videoRef.current)||void 0===t?void 0:t.videoWidth)||0,u=(null===(r=n.imageRef.current)||void 0===r?void 0:r.naturalHeight)||(null===(i=n.videoRef.current)||void 0===i?void 0:i.videoHeight)||0,d=c/u,f=void 0;if(s.offsetWidth<c||s.offsetHeight<u)switch(n.props.objectFit){default:case"contain":f=l>d?{width:n.containerRect.height*d,height:n.containerRect.height}:{width:n.containerRect.width,height:n.containerRect.width/d};break;case"horizontal-cover":f={width:n.containerRect.width,height:n.containerRect.width/d};break;case"vertical-cover":f={width:n.containerRect.height*d,height:n.containerRect.height};break;case"auto-cover":f=c>u?{width:n.containerRect.width,height:n.containerRect.width/d}:{width:n.containerRect.height*d,height:n.containerRect.height}}else f={width:s.offsetWidth,height:s.offsetHeight};n.mediaSize=eY(eY({},f),{naturalWidth:c,naturalHeight:u}),n.props.setMediaSize&&n.props.setMediaSize(n.mediaSize);var h=n.props.cropSize?n.props.cropSize:nY(n.mediaSize.width,n.mediaSize.height,n.containerRect.width,n.containerRect.height,n.props.aspect,n.props.rotation);return(null===(o=n.state.cropSize)||void 0===o?void 0:o.height)===h.height&&(null===(a=n.state.cropSize)||void 0===a?void 0:a.width)===h.width||n.props.onCropSizeChange&&n.props.onCropSizeChange(h),n.setState({cropSize:h},n.recomputeCropPosition),n.props.setCropSize&&n.props.setCropSize(h),h}},n.onMouseDown=function(e){n.currentDoc&&(e.preventDefault(),n.currentDoc.addEventListener("mousemove",n.onMouseMove),n.currentDoc.addEventListener("mouseup",n.onDragStopped),n.onDragStart(t.getMousePoint(e)))},n.onMouseMove=function(e){return n.onDrag(t.getMousePoint(e))},n.onTouchStart=function(e){n.currentDoc&&(n.isTouching=!0,n.props.onTouchRequest&&!n.props.onTouchRequest(e)||(n.currentDoc.addEventListener("touchmove",n.onTouchMove,{passive:!1}),n.currentDoc.addEventListener("touchend",n.onDragStopped),2===e.touches.length?n.onPinchStart(e):1===e.touches.length&&n.onDragStart(t.getTouchPoint(e.touches[0]))))},n.onTouchMove=function(e){e.preventDefault(),2===e.touches.length?n.onPinchMove(e):1===e.touches.length&&n.onDrag(t.getTouchPoint(e.touches[0]))},n.onGestureStart=function(e){n.currentDoc&&(e.preventDefault(),n.currentDoc.addEventListener("gesturechange",n.onGestureMove),n.currentDoc.addEventListener("gestureend",n.onGestureEnd),n.gestureZoomStart=n.props.zoom,n.gestureRotationStart=n.props.rotation)},n.onGestureMove=function(e){if(e.preventDefault(),!n.isTouching){var r=t.getMousePoint(e),i=n.gestureZoomStart-1+e.scale;if(n.setNewZoom(i,r,{shouldUpdatePosition:!0}),n.props.onRotationChange){var o=n.gestureRotationStart+e.rotation;n.props.onRotationChange(o)}}},n.onGestureEnd=function(e){n.cleanEvents()},n.onDragStart=function(e){var t,r,i=e.x,o=e.y;n.dragStartPosition={x:i,y:o},n.dragStartCrop=eY({},n.props.crop),null===(r=(t=n.props).onInteractionStart)||void 0===r||r.call(t)},n.onDrag=function(e){var t=e.x,r=e.y;n.currentWindow&&(n.rafDragTimeout&&n.currentWindow.cancelAnimationFrame(n.rafDragTimeout),n.rafDragTimeout=n.currentWindow.requestAnimationFrame((function(){if(n.state.cropSize&&void 0!==t&&void 0!==r){var e=t-n.dragStartPosition.x,i=r-n.dragStartPosition.y,o={x:n.dragStartCrop.x+e,y:n.dragStartCrop.y+i},a=n.props.restrictPosition?rY(o,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):o;n.props.onCropChange(a)}})))},n.onDragStopped=function(){var e,t;n.isTouching=!1,n.cleanEvents(),n.emitCropData(),null===(t=(e=n.props).onInteractionEnd)||void 0===t||t.call(e)},n.onWheel=function(e){if(n.currentWindow&&(!n.props.onWheelRequest||n.props.onWheelRequest(e))){e.preventDefault();var i=t.getMousePoint(e),o=r(tY)(e).pixelY,a=n.props.zoom-o*n.props.zoomSpeed/200;n.setNewZoom(a,i,{shouldUpdatePosition:!0}),n.state.hasWheelJustStarted||n.setState({hasWheelJustStarted:!0},(function(){var e,t;return null===(t=(e=n.props).onInteractionStart)||void 0===t?void 0:t.call(e)})),n.wheelTimer&&clearTimeout(n.wheelTimer),n.wheelTimer=n.currentWindow.setTimeout((function(){return n.setState({hasWheelJustStarted:!1},(function(){var e,t;return null===(t=(e=n.props).onInteractionEnd)||void 0===t?void 0:t.call(e)}))}),250)}},n.getPointOnContainer=function(e){var t=e.x,r=e.y;if(!n.containerRect)throw new Error("The Cropper is not mounted");return{x:n.containerRect.width/2-(t-n.containerRect.left),y:n.containerRect.height/2-(r-n.containerRect.top)}},n.getPointOnMedia=function(e){var t=e.x,r=e.y,i=n.props,o=i.crop,a=i.zoom;return{x:(t+o.x)/a,y:(r+o.y)/a}},n.setNewZoom=function(e,t,r){var i=(void 0===r?{}:r).shouldUpdatePosition,o=void 0===i||i;if(n.state.cropSize&&n.props.onZoomChange){var a=pY(e,n.props.minZoom,n.props.maxZoom);if(o){var s=n.getPointOnContainer(t),l=n.getPointOnMedia(s),c={x:l.x*a-s.x,y:l.y*a-s.y},u=n.props.restrictPosition?rY(c,n.mediaSize,n.state.cropSize,a,n.props.rotation):c;n.props.onCropChange(u)}n.props.onZoomChange(a)}},n.getCropData=function(){return n.state.cropSize?sY(n.props.restrictPosition?rY(n.props.crop,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):n.props.crop,n.mediaSize,n.state.cropSize,n.getAspect(),n.props.zoom,n.props.rotation,n.props.restrictPosition):null},n.emitCropData=function(){var e=n.getCropData();if(e){var t=e.croppedAreaPercentages,r=e.croppedAreaPixels;n.props.onCropComplete&&n.props.onCropComplete(t,r),n.props.onCropAreaChange&&n.props.onCropAreaChange(t,r)}},n.emitCropAreaChange=function(){var e=n.getCropData();if(e){var t=e.croppedAreaPercentages,r=e.croppedAreaPixels;n.props.onCropAreaChange&&n.props.onCropAreaChange(t,r)}},n.recomputeCropPosition=function(){if(n.state.cropSize){var e=n.props.restrictPosition?rY(n.props.crop,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):n.props.crop;n.props.onCropChange(e),n.emitCropData()}},n}return $K(t,e),t.prototype.componentDidMount=function(){this.currentDoc&&this.currentWindow&&(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),void 0===window.ResizeObserver&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n",this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef))},t.prototype.componentWillUnmount=function(){var e,t;this.currentDoc&&this.currentWindow&&(void 0===window.ResizeObserver&&this.currentWindow.removeEventListener("resize",this.computeSizes),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&(null===(t=this.styleRef.parentNode)||void 0===t||t.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},t.prototype.componentDidUpdate=function(e){var t,n,r,i,o,a,s,l,c;e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():(null===(t=e.cropSize)||void 0===t?void 0:t.height)!==(null===(n=this.props.cropSize)||void 0===n?void 0:n.height)||(null===(r=e.cropSize)||void 0===r?void 0:r.width)!==(null===(i=this.props.cropSize)||void 0===i?void 0:i.width)?this.computeSizes():(null===(o=e.crop)||void 0===o?void 0:o.x)===(null===(a=this.props.crop)||void 0===a?void 0:a.x)&&(null===(s=e.crop)||void 0===s?void 0:s.y)===(null===(l=this.props.crop)||void 0===l?void 0:l.y)||this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&(null===(c=this.videoRef.current)||void 0===c||c.load())},t.prototype.getAspect=function(){var e=this.props,t=e.cropSize,n=e.aspect;return t?t.width/t.height:n},t.prototype.onPinchStart=function(e){var n=t.getTouchPoint(e.touches[0]),r=t.getTouchPoint(e.touches[1]);this.lastPinchDistance=oY(n,r),this.lastPinchRotation=aY(n,r),this.onDragStart(fY(n,r))},t.prototype.onPinchMove=function(e){var n=this;if(this.currentDoc&&this.currentWindow){var r=t.getTouchPoint(e.touches[0]),i=t.getTouchPoint(e.touches[1]),o=fY(r,i);this.onDrag(o),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame((function(){var e=oY(r,i),t=n.props.zoom*(e/n.lastPinchDistance);n.setNewZoom(t,o,{shouldUpdatePosition:!1}),n.lastPinchDistance=e;var a=aY(r,i),s=n.props.rotation+(a-n.lastPinchRotation);n.props.onRotationChange&&n.props.onRotationChange(s),n.lastPinchRotation=a}))}},t.prototype.render=function(){var e=this,t=this.props,n=t.image,i=t.video,o=t.mediaProps,a=t.transform,s=t.crop,l=s.x,c=s.y,d=t.rotation,f=t.zoom,h=t.cropShape,p=t.showGrid,m=t.style,g=m.containerStyle,v=m.cropAreaStyle,y=m.mediaStyle,b=t.classes,w=b.containerClassName,x=b.cropAreaClassName,S=b.mediaClassName,M=t.objectFit;return r(u).createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(t){return e.containerRef=t},"data-testid":"container",style:g,className:mY("reactEasyCrop_Container",w)},n?r(u).createElement("img",eY({alt:"",className:mY("reactEasyCrop_Image","contain"===M&&"reactEasyCrop_Contain","horizontal-cover"===M&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===M&&"reactEasyCrop_Cover_Vertical","auto-cover"===M&&(this.mediaSize.naturalWidth>this.mediaSize.naturalHeight?"reactEasyCrop_Cover_Horizontal":"reactEasyCrop_Cover_Vertical"),S)},o,{src:n,ref:this.imageRef,style:eY(eY({},y),{transform:a||"translate(".concat(l,"px, ").concat(c,"px) rotate(").concat(d,"deg) scale(").concat(f,")")}),onLoad:this.onMediaLoad})):i&&r(u).createElement("video",eY({autoPlay:!0,loop:!0,muted:!0,className:mY("reactEasyCrop_Video","contain"===M&&"reactEasyCrop_Contain","horizontal-cover"===M&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===M&&"reactEasyCrop_Cover_Vertical","auto-cover"===M&&(this.mediaSize.naturalWidth>this.mediaSize.naturalHeight?"reactEasyCrop_Cover_Horizontal":"reactEasyCrop_Cover_Vertical"),S)},o,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:eY(eY({},y),{transform:a||"translate(".concat(l,"px, ").concat(c,"px) rotate(").concat(d,"deg) scale(").concat(f,")")}),controls:!1}),(Array.isArray(i)?i:[{src:i}]).map((function(e){return r(u).createElement("source",eY({key:e.src},e))}))),this.state.cropSize&&r(u).createElement("div",{style:eY(eY({},v),{width:this.state.cropSize.width,height:this.state.cropSize.height}),"data-testid":"cropper",className:mY("reactEasyCrop_CropArea","round"===h&&"reactEasyCrop_CropAreaRound",p&&"reactEasyCrop_CropAreaGrid",x)}))},t.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:3,minZoom:1,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0},t.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t}(r(u).Component);var vY=function(){return vY=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},vY.apply(this,arguments)};function yY(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function bY(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var wY="img-crop",xY=.1,SY=(0,u.forwardRef)((function(e,t){var n=e.cropperRef,i=e.image,o=e.aspect,a=e.shape,s=e.grid,l=e.zoom,c=e.rotate,d=e.minZoom,f=e.maxZoom,h=e.cropperProps,p=(0,u.useState)({x:0,y:0}),m=p[0],g=p[1],v=(0,u.useState)({width:0,height:0}),y=v[0],b=v[1],w=(0,u.useState)(1),x=w[0],S=w[1],M=(0,u.useState)(0),_=M[0],A=M[1],E=(0,u.useRef)({width:0,height:0,x:0,y:0}),C=(0,u.useCallback)((function(e){var t=e.width,n=e.height,r=n*o;b(t>r?{width:r,height:n}:{width:t,height:t/o})}),[o]),k=(0,u.useCallback)((function(e,t){E.current=t}),[]);return(0,u.useImperativeHandle)(t,(function(){return{rotateVal:_,setZoomVal:S,setRotateVal:A,cropPixelsRef:E}}),[_]),r(u).createElement(r(u).Fragment,null,r(u).createElement(gY,vY({},h,{ref:n,image:i,crop:m,cropSize:y,onCropChange:g,aspect:o,cropShape:a,showGrid:s,zoomWithScroll:l,zoom:x,rotation:_,onZoomChange:S,onRotationChange:A,minZoom:d,maxZoom:f,onMediaLoaded:C,onCropComplete:k,classes:{containerClassName:"".concat(wY,"-container"),mediaClassName:"".concat(wY,"-media")}})),l&&r(u).createElement("section",{className:"".concat(wY,"-control ").concat(wY,"-control-zoom")},r(u).createElement("button",{onClick:function(){return S(x-xY)},disabled:x-xY<d},"-"),r(u).createElement(Zq.default,{min:d,max:f,step:xY,value:x,onChange:S}),r(u).createElement("button",{onClick:function(){return S(x+xY)},disabled:x+xY>f},"+")),c&&r(u).createElement("section",{className:"".concat(wY,"-control ").concat(wY,"-control-rotate")},r(u).createElement("button",{onClick:function(){return A(_-1)},disabled:-180===_},"↺"),r(u).createElement(Zq.default,{min:-180,max:180,step:1,value:_,onChange:A}),r(u).createElement("button",{onClick:function(){return A(_+1)},disabled:180===_},"↻")))})),MY=(0,u.memo)(SY);!function(e){if(e&&"undefined"!=typeof window){var t=document.createElement("style");t.setAttribute("media","screen"),t.innerHTML=e,document.head.appendChild(t)}}(".img-crop-modal .img-crop-container {\n position: relative;\n width: 100%;\n height: 40vh;\n}\n.img-crop-modal .img-crop-control {\n display: flex;\n align-items: center;\n width: 60%;\n margin-left: auto;\n margin-right: auto;\n}\n.img-crop-modal .img-crop-control:first-of-type {\n margin-top: 16px;\n}\n.img-crop-modal .img-crop-control:last-of-type {\n margin-bottom: -8px;\n}\n.img-crop-modal .img-crop-control button {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 34px;\n height: 34px;\n padding: 0;\n font-style: normal;\n background: transparent;\n border: 0;\n outline: 0;\n cursor: pointer;\n}\n.img-crop-modal .img-crop-control button[disabled] {\n cursor: default;\n}\n.img-crop-modal .img-crop-control button + div:only-of-type {\n flex: 1;\n margin: 0 8px;\n}\n.img-crop-modal .img-crop-control-zoom button {\n font-size: 18px;\n}\n.img-crop-modal .img-crop-control-rotate button {\n font-size: 16px;\n}\n.img-crop-modal .img-crop-control-rotate button:first-of-type {\n transform: rotate(-20deg);\n}\n.img-crop-modal .img-crop-control-rotate button:last-of-type {\n transform: rotate(20deg);\n}\n");var _Y=(0,u.forwardRef)((function(e,t){var n=e.aspect,i=void 0===n?1:n,o=e.shape,a=void 0===o?"rect":o,s=e.grid,l=void 0!==s&&s,c=e.quality,d=void 0===c?.4:c,f=e.fillColor,h=void 0===f?"white":f,p=e.zoom,m=void 0===p||p,g=e.rotate,v=void 0!==g&&g,y=e.minZoom,b=void 0===y?1:y,w=e.maxZoom,x=void 0===w?3:w,S=e.modalTitle,M=e.modalWidth,_=e.modalOk,A=e.modalCancel,E=e.modalMaskTransitionName,C=e.modalTransitionName,k=e.onModalOk,T=e.onModalCancel,I=e.beforeCrop,O=e.onUploadFail,R=e.cropperProps,P=e.children,N=(0,u.useRef)({});N.current.onModalOk=k,N.current.onModalCancel=T,N.current.beforeCrop=I,N.current.onUploadFail=O;var L=(0,u.useState)(""),D=L[0],B=L[1],j=(0,u.useRef)(),F=(0,u.useRef)(),U=(0,u.useRef)(),z=(0,u.useRef)(),H=(0,u.useMemo)((function(){var e=Array.isArray(P)?P[0]:P,t=e.props,n=t.beforeUpload,r=t.accept,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["beforeUpload","accept"]);return F.current=n,vY(vY({},e),{props:vY(vY({},i),{accept:r||"image/*",beforeUpload:function(e,t){return new Promise((function(n,r){return yY(void 0,void 0,void 0,(function(){var i;return bY(this,(function(o){switch(o.label){case 0:return N.current.beforeCrop?[4,N.current.beforeCrop(e,t)]:[3,2];case 1:if(!o.sent())return[2,r()];o.label=2;case 2:return j.current=e,U.current=function(e){var t,r;null===(r=(t=N.current).onModalOk)||void 0===r||r.call(t,e),n(e)},z.current=function(e){var t,n;null===(n=(t=N.current).onUploadFail)||void 0===n||n.call(t,e),r()},(i=new FileReader).addEventListener("load",(function(){"string"==typeof i.result&&B(i.result)})),i.readAsDataURL(e),[2]}}))}))}))}})})}),[P]),V=(0,u.useRef)({}),W=(0,u.useMemo)((function(){var e={width:M,okText:_,cancelText:A,maskTransitionName:E,transitionName:C};return Object.keys(e).forEach((function(t){e[t]||delete e[t]})),e}),[A,E,_,C,M]),G=function(){B(""),V.current.setZoomVal(1),V.current.setRotateVal(0)},q=(0,u.useCallback)((function(){var e,t;null===(t=(e=N.current).onModalCancel)||void 0===t||t.call(e),G()}),[]),K=(0,u.useCallback)((function(){return yY(void 0,void 0,void 0,(function(){var e,t,n,r,i,o,a,s,l,c,u,f,p,m,g,y,b,w,x,S,M,_,A,E;return bY(this,(function(C){return G(),e=document.createElement("canvas"),t=e.getContext("2d"),n=document.querySelector(".".concat(wY,"-media")),r=V.current.cropPixelsRef.current,i=r.width,o=r.height,a=r.x,s=r.y,v&&0!==V.current.rotateVal?(l=n.naturalWidth,c=n.naturalHeight,u=V.current.rotateVal*(Math.PI/180),f=Math.abs(Math.sin(u)),p=Math.abs(Math.cos(u)),m=l*p+c*f,g=c*p+l*f,e.width=m,e.height=g,t.fillStyle=h,t.fillRect(0,0,m,g),y=m/2,b=g/2,t.translate(y,b),t.rotate(u),t.translate(-y,-b),w=(m-l)/2,x=(g-c)/2,t.drawImage(n,0,0,l,c,w,x,l,c),S=t.getImageData(0,0,m,g),e.width=i,e.height=o,t.putImageData(S,-a,-s)):(e.width=i,e.height=o,t.fillStyle=h,t.fillRect(0,0,i,o),t.drawImage(n,a,s,i,o,0,0,i,o)),M=j.current,_=M.type,A=M.name,E=M.uid,e.toBlob((function(e){return yY(void 0,void 0,void 0,(function(){var t,n;return bY(this,(function(r){switch(r.label){case 0:return t=Object.assign(new File([e],A,{type:_}),{uid:E}),F.current?[4,F.current(t,[t])]:[2,U.current(t)];case 1:return!0===(n=r.sent())?[2,U.current(t)]:!1===n?[2,z.current(new Error("beforeUpload return false"))]:(delete t[Xq.LIST_IGNORE],n===Xq.LIST_IGNORE?(Object.defineProperty(t,Xq.LIST_IGNORE,{value:!0,configurable:!0}),[2,z.current(new Error("beforeUpload return LIST_IGNORE"))]):"object"==typeof n&&null!==n?[2,U.current(n)]:[2])}}))}))}),_,d),[2]}))}))}),[h,d,v]),Y=function(e){return r(u).createElement(r(u).Fragment,null,H,D&&r(u).createElement(MG,vY({visible:!0,wrapClassName:"".concat(wY,"-modal"),title:e,onOk:K,onCancel:q,maskClosable:!1,destroyOnClose:!0},W),r(u).createElement(MY,{ref:V,cropperRef:t,image:D,aspect:i,shape:a,grid:l,zoom:m,rotate:v,minZoom:b,maxZoom:x,cropperProps:R})))};return S?Y(S):r(u).createElement(lH,null,(function(e,t){return Y("zh-cn"===t?"编辑图片":"Edit image")}))}));var AY=({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"})});const EY=["image/jpeg","image/png","image/jpg","image/gif"],CY=({originNode:e,file:t,tenantID:n,apiUrl:r,actions:i,resourceType:o})=>{var a,l,c,u;const{t:d}=Te();return(0,s.jsxs)("div",{className:"memori--list-item-wrapper"+("uploading"===t.status?" listItemUploading":""),children:[(0,s.jsx)(dp,{spinning:"uploading"===t.status,children:"error"===t.status?(0,s.jsx)(zm,{content:d("media.uploadError"),children:e.props.children}):(0,s.jsx)(Xy,{item:{mediumID:t.uid,mimeType:"uploading"===t.status?"image/png":(null===(a=t.name)||void 0===a?void 0:a.endsWith(".glb"))?"model/gltf-binary":t.type||"image/png",title:null!==(l=t.name)&&void 0!==l?l:"",url:"uploading"===t.status?"":(null===(u=null===(c=t.response)||void 0===c?void 0:c.asset)||void 0===u?void 0:u.assetURL)?t.response.asset.assetURL:jm({type:o,resourceURI:t.thumbUrl,tenantID:n,apiURL:r}),content:`${jm({resourceURI:t.thumbUrl,type:o,apiURL:r})}`},preview:!1})}),("success"===t.status||"done"===t.status)&&(0,s.jsxs)("div",{className:"list-item-actions",children:[(0,s.jsx)(Zd,{outlined:!0,shape:"circle",icon:(0,s.jsx)(Gj,{}),className:"action-button",title:d("edit")||"Edit",onClick:()=>null==i?void 0:i.download(t)}),(0,s.jsx)(Zd,{outlined:!0,shape:"circle",icon:(0,s.jsx)(AY,{}),className:"action-button",title:d("delete")||"Delete",onClick:()=>null==i?void 0:i.remove(t)})]})]})};var kY=({uploadMultipleImages:e,maxNumberOfVisualizedUploads:t,uploadUrl:n,apiUrl:i,tenantID:o,fileList:a,maxFileSizeInMB:l=2,fileResolution:c,useImageCrop:d,uploadMessage:f,imageProportions:h=1,imageProportionsHelper:p,allowedMimeTypes:m,onRemove:g,onFileChanged:v,onUploadFinished:y,onFileNotValid:b,disabled:w,showHelper:x,additionalHelper:S,resourceType:M})=>{var _;const{t:A}=Te(),[E,C]=(0,u.useState)(null!=a?a:[]),[k,T]=(0,u.useState)(),I=(0,s.jsx)(r(eU),{className:"memori--upload",disabled:null!=w&&w,accept:(null===(_=null!=m?m:EY)||void 0===_?void 0:_.join(","))+";capture=camera,camcorder",action:n,listType:"picture-card",showUploadList:{showPreviewIcon:!0,showRemoveIcon:!0,showDownloadIcon:!0,downloadIcon:(0,s.jsx)(Gj,{title:A("edit")||"Edit"})},beforeUpload:e=>{if(!(null!=m?m:EY).find((t=>t===e.type))&&e.type)return console.debug("File not allowed",e,null!=m?m:EY),Qd.error(A("media.uploadMimeTypeNotAllowed")),b&&b(),Promise.reject(A("media.uploadMimeTypeNotAllowed"));if(!(e.size/1024/1024<(null!=l?l:2)))return Qd.error(A("media.uploadSizeLimitMessage",{size:l})),b&&b(),Promise.reject(A("media.uploadSizeLimitMessage",{size:l}));if(c&&c.length){const t=new FileReader;return t.readAsDataURL(e),new Promise(((n,r)=>{t.addEventListener("load",(t=>{var i,o,a,s=new Image;s.style.padding="0px",s.style.margin="0px",s.onload=()=>{s.width===c[0]&&s.height===c[1]?n(e):(Qd.error(A("media.uploadWrongResolutionMessage",{width:c[0],height:c[1]})),r(),b&&b())},s.src=null!==(a=null===(o=null===(i=t.target)||void 0===i?void 0:i.result)||void 0===o?void 0:o.toString())&&void 0!==a?a:""}))}))}return Promise.resolve(e)},supportServerRender:!0,fileList:E,multiple:e,maxCount:t||(e?100:1),onChange:e=>{C(e.fileList.map((e=>{var t;return{...e,status:null!==(t=e.status)&&void 0!==t?t:"error"}}))),"done"===e.file.status&&y&&y(e.file)},onRemove:g,onDownload:e=>{var t,n;let r=null===(t=e.response)||void 0===t?void 0:t.asset;if(r){let t=r.originalFileName&&e.name.includes(r.originalFileName)?r.originalFileName:e.name;T({...r,title:null!=t?t:r.title})}else T({assetID:e.uid,title:null!==(n=e.name)&&void 0!==n?n:e.fileName})},itemRender:(e,t,n,r)=>(0,s.jsx)(CY,{resourceType:M,originNode:e,file:t,fileList:E||n,actions:r,tenantID:o,apiUrl:i}),children:f});return(0,s.jsxs)("div",{"aria-live":"polite",children:[d?(0,s.jsx)(_Y,{rotate:!0,aspect:h,fillColor:"transparent",modalCancel:A("cancel")||"Cancel",modalMaskTransitionName:"none",modalTransitionName:"none",children:I}):I,(0,s.jsxs)(hp,{open:!!k,title:A("media.editAttributes"),onClose:()=>{T(void 0)},footer:(0,s.jsx)(s.Fragment,{}),width:"100%",children:[(0,s.jsx)("label",{htmlFor:"media-title-input",className:"media-title-label",children:A("media.title")}),(0,s.jsx)("input",{id:"media-title-input",className:"media-title-input",type:"text",name:"title",defaultValue:(null==k?void 0:k.title)||"",onChange:e=>{T({...k,title:e.target.value})}}),(0,s.jsxs)("div",{className:"memori-modal--footer",children:[(0,s.jsx)(Zd,{onClick:()=>{T(void 0)},children:A("cancel")}),(0,s.jsx)(Zd,{primary:!0,onClick:()=>{v&&(null==k?void 0:k.assetID)&&v(k.assetID,{...k}),C((e=>e.map((e=>{var t,n;return e.uid===(null==k?void 0:k.assetID)||(null===(n=null===(t=e.response)||void 0===t?void 0:t.asset)||void 0===n?void 0:n.assetID)===(null==k?void 0:k.assetID)?{...e,title:null==k?void 0:k.title,name:null==k?void 0:k.title}:e})))),T(void 0)},children:A("confirm")})]})]}),x&&(0,s.jsxs)("legend",{className:"helper",children:[(0,s.jsx)("p",{children:A(m?"media.uploadHelper":"media.uploadHelperImages").replace("@size@",(null!=l?l:2).toString())}),p&&d&&(0,s.jsxs)("p",{children:[A("media.scaleRatio"),": ",p]}),S&&(0,s.jsx)("p",{children:S})]})]})};var TY=({visible:e,authToken:t,sessionID:n,tenantID:r,uploadAssetURL:i,deleteAsset:o,onCancel:a,onOk:l,apiURL:c})=>{const{t:d}=Te(),[f,h]=(0,u.useState)();return(0,s.jsx)(hp,{open:e,title:d("media.addMediaLabel"),className:"attachment-media-modal",closable:!0,width:"100%",widthMd:"100%",onClose:()=>{a&&a()},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Zd,{onClick:a,children:d("cancel")}),(0,s.jsx)(Zd,{primary:!0,onClick:()=>{f&&l(f),h(void 0)},disabled:!f,children:d("confirm")})]}),children:(0,s.jsx)(kY,{tenantID:r,apiUrl:c,uploadMultipleImages:!1,maxNumberOfVisualizedUploads:1,maxFileSizeInMB:100,uploadUrl:i,useImageCrop:!1,allowedMimeTypes:_g,fileList:f?[{uid:"-1",name:f.assetID,status:"done",thumbUrl:jm({resourceURI:f.assetURL,tenantID:r,apiURL:c,sessionID:n})}]:[],uploadMessage:d("media.mediaUploadMessage"),imageProportions:1,onUploadFinished:e=>{let t=e.response.asset,n=e.response;0===n.resultCode?h(t):(console.error(n,e),Qd.error(d($F(n.resultCode))))},onFileChanged:(e,t)=>{h((e=>({...e||{},...t})))},onRemove:async e=>{const n=await o(t,e.thumbUrl);return 0===n.resultCode?h(void 0):(console.error(n,e),Qd.error(d($F(n.resultCode)))),0===n.resultCode}})})};u=a("85Hg2");var IY=({visible:e,onCancel:t,onOk:n})=>{var r,i,o;const{t:a}=Te(),[l,c]=(0,u.useState)({url:"",title:""}),d=e=>{if("Enter"===e.key){if(0===(null==l?void 0:l.url.length)||0===(null==l?void 0:l.title.length))return;let e=document.getElementById("save-link-button");e&&e.click()}};return(0,s.jsx)(hp,{open:e,title:a("media.addLinkLabel"),className:"attachment-link-modal",closable:!0,width:"100%",widthMd:"80%",onClose:()=>{t&&t()},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Zd,{onClick:t,children:a("cancel")}),(0,s.jsx)(Zd,{id:"save-link-button",primary:!0,onClick:()=>{0!==(null==l?void 0:l.url.length)&&0!==(null==l?void 0:l.title.length)&&(n(l),c({url:"",title:""}))},disabled:0===(null==l?void 0:l.url.length)||0===(null==l?void 0:l.title.length),children:a("confirm")})]}),children:(0,s.jsxs)("div",{className:"attachment-link-modal--row",children:[(0,s.jsxs)("div",{className:"attachment-link-modal--column",children:[(0,s.jsxs)("label",{htmlFor:"new-link-url",className:"attachment-link-modal--label",children:[a("media.linkKey"),":"]}),(0,s.jsx)("input",{type:"url",className:"attachment-link-modal--input ",onChange:e=>{let t=e.target.value.startsWith("http")||0===e.target.value.length?e.target.value:`https://${e.target.value}`;c((e=>{var n;return{title:null!==(n=null==e?void 0:e.title)&&void 0!==n?n:"",url:t}}))},placeholder:"https://memori.ai/...",value:null==l?void 0:l.url,name:"url",onKeyDown:d}),(0,s.jsxs)("label",{htmlFor:"new-link-title",className:"attachment-link-modal--label",children:[a("media.linkValue"),":"]}),(0,s.jsx)("input",{type:"text",className:"attachment-link-modal--input ",onChange:e=>c((t=>{var n;return{url:null!==(n=null==t?void 0:t.url)&&void 0!==n?n:"",title:e.target.value}})),value:null==l?void 0:l.title,name:"title",onKeyDown:d})]}),(0,s.jsx)("div",{className:"attachment-link-modal--column",children:(0,s.jsx)("div",{className:"attachment-link-modal--centered",children:(0,s.jsx)(bg,{item:{title:null!==(r=null==l?void 0:l.title)&&void 0!==r?r:"",url:null!==(i=null==l?void 0:l.url)&&void 0!==i?i:"",mediumID:"",mimeType:"text/html"},onLinkPreviewInfo:e=>{var t;(null===(t=null==l?void 0:l.title)||void 0===t?void 0:t.length)||c((t=>{var n;return{...t,title:null!==(n=null==e?void 0:e.title)&&void 0!==n?n:""}}))}},null!==(o=null==l?void 0:l.url)&&void 0!==o?o:"")})})]})})};var OY=({tenant:e,userLang:t="en"})=>{const n="memorytwin"===(null==e?void 0:e.theme)?"memorytwin":"twincreator";return(0,s.jsxs)("div",{className:"memori--powered-by",children:[(0,s.jsx)("img",{src:`https://app.twincreator.com/images/${n}/logo.png`,alt:""}),(0,s.jsxs)("p",{children:["Powered by"," ",(0,s.jsx)("a",{href:`https://app.${n}.com/${t?t.toLowerCase():""}`,target:"_blank",rel:"noopener noreferrer",children:"memorytwin"===n?"MemoryTwin":"TwinCreator"})]})]})};var RY=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,ChangeMode:d,changeModeProps:f,sessionId:h,hasUserActivatedSpeak:p,showInstruct:m=!1,loading:g=!1,poweredBy:v})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(dp,{spinning:g,children:[m&&d&&f&&(0,s.jsx)(d,{...f}),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:h&&p&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null}),v]})]})]});var PY=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,ChangeMode:d,changeModeProps:f,sessionId:h,hasUserActivatedSpeak:p,showInstruct:m=!1,loading:g=!1,poweredBy:v})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(dp,{spinning:g,className:"memori-totem-layout",children:[v,m&&d&&f&&(0,s.jsx)(d,{...f}),(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:h&&p&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null})]})]});var NY=({Header:e,headerProps:t,Chat:n,chatProps:r,StartPanel:i,startPanelProps:o,integrationStyle:a,integrationBackground:l,ChangeMode:c,changeModeProps:u,sessionId:d,hasUserActivatedSpeak:f,showInstruct:h=!1,loading:p=!1,poweredBy:m})=>(0,s.jsxs)(s.Fragment,{children:[a,l,(0,s.jsxs)(dp,{spinning:p,className:"memori-chat-layout",children:[m,h&&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&&f&&n&&r?(0,s.jsx)(n,{...r}):o?(0,s.jsx)(i,{...o}):null})]})]});const LY={muteSpeaker:"@memori:muteSpeaker",microphoneMode:"@memori:microphoneMode",continuousSpeechTimeout:"@memori:continuousSpeechTimeout",sendOnEnter:"@memori:sendOnEnter",birthDate:"@memori:birthDate",controlsPosition:"@memori:controlsPosition",hideEmissions:"@memori:hideEmissions"},DY=(e,t)=>{var n;const r=window.localStorage.getItem(null!==(n=LY[e])&&void 0!==n?n:e);if(!r)return t;try{return JSON.parse(r)}catch(e){return r}},BY=(e,t)=>{var n;window.localStorage.setItem(null!==(n=LY[e])&&void 0!==n?n:e,t.toString())},{deleteSession:jY,getStatistics:FY,initSession:UY}=W(),zY=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,"🧠"]]),HY=e=>{const t=Array.from(zY.keys()).filter((t=>t<=e));if(t.length>0){const e=t[t.length-1];return zY.get(e)}return""},VY=e=>{if("🆕"===e)return{points:10,badge:"🐹"};let t,n,r=!1;for(const[i,o]of zY){if(r){t=i,n=o;break}o===e&&(r=!0)}return n&&t?{points:t,badge:n}:void 0},WY=e=>{let t=0;for(const[n,r]of zY)if(r===e){t=n;break}return t},GY=e=>{const t=Math.round(e),n=HY(t);return{points:t,badge:n,pointsForCurrentBadge:WY(n),nextBadge:VY(n)}};var qY=a("agy8n");u=a("85Hg2"),qY=a("agy8n");const KY={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"]},YY=(0,u.memo)((({defaultDate:e,onChange:t,disabled:n=!1})=>{const{t:i,i18n:o}=Te(),[a,l]=(0,u.useState)(r(qY)(e||Date.now()));return(0,u.useEffect)((()=>{t(a)}),[a,t]),r(qY).locale(o.language),(0,s.jsxs)("div",{className:"memori--date-selector",children:[(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(Zb,{value:a,onChange:e=>{l(e)},disabled:n,name:"day",children:[(0,s.jsxs)(Zb.Label,{className:"memori--date-selector__select-label",children:[i("day"),":"]}),(0,s.jsxs)(Zb.Button,{"aria-label":i("day"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:a.date()}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)($b,{})})]}),(0,s.jsx)(Jf,{as:u.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(Zb.Options,{className:"memori--date-selector__select-options",children:[...Array(31).keys()].map((e=>(0,s.jsx)(Zb.Option,{value:a.clone().date(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)(Zb,{value:a,onChange:e=>{l(e)},disabled:n,name:"month",children:[(0,s.jsxs)(Zb.Label,{className:"memori--date-selector__select-label",children:[i("month"),":"]}),(0,s.jsxs)(Zb.Button,{"aria-label":i("month"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:KY["it"===o.language?"it":"en"][a.month()]}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)($b,{})})]}),(0,s.jsx)(Jf,{as:u.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(Zb.Options,{className:"memori--date-selector__select-options",children:KY["it"===o.language?"it":"en"].map((e=>(0,s.jsx)(Zb.Option,{className:"memori--date-selector__select-option",value:a.clone().month(KY["it"===o.language?"it":"en"].findIndex((t=>t===e))),children:e},e)))})})]})}),(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(Zb,{value:a,onChange:e=>{l(e)},disabled:n,name:"year",children:[(0,s.jsxs)(Zb.Label,{className:"memori--date-selector__select-label",children:[i("year"),":"]}),(0,s.jsxs)(Zb.Button,{"aria-label":i("year"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:a.year()}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)($b,{})})]}),(0,s.jsx)(Jf,{as:u.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(Zb.Options,{className:"memori--date-selector__select-options",children:[...Array(r(qY)().year()-1899).keys()].sort(((e,t)=>t-e)).map((e=>(0,s.jsx)(Zb.Option,{value:a.clone().year(e+1900),className:"memori--date-selector__select-option",children:e+1900},e)))})})]})})]})}));YY.displayName="DateSelector";var JY=YY;u=a("85Hg2");var QY=({visible:e=!1,onClose:t,minAge:n})=>{const{t:i}=Te(),[o,a]=(0,u.useState)(),[l,c]=(0,u.useState)(),d=(0,u.useCallback)((()=>{if(!o)return Qd.error(i("requiredField")),void c(i("requiredField")||"Required field");if(r(qY)().diff(o,"years")<n)return Qd.error(i("underageTwinSession",{age:n})),void c(i("underageTwinSession",{age:n})||`You must be at least ${n} years old to interact with this Twin`);t(o.toISOString())}),[o,n,t,i]);return(0,s.jsxs)(hp,{open:e,title:i("ageVerification"),className:"age-verification-modal",closable:!0,onClose:()=>t(),children:[(0,s.jsx)("p",{children:i("ageVerificationText",{minAge:n})}),(0,s.jsxs)("form",{className:"age-verification-form",onSubmit:e=>{e.preventDefault(),d()},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)(JY,{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)(Zd,{primary:!0,htmlType:"submit",className:"age-verification-submit",disabled:!o,children:i("confirm")})})]})]})};u=a("85Hg2"),Jd=a("4IUwl");var XY=({open:e=!1,onClose:t,className:n,title:i,description:o,children:a,footer:l,loading:c=!1,side:d="right",closable:f=!0,width:h="100%",widthMd:p="80%",widthLg:m="60%"})=>(0,s.jsx)(Jf,{appear:!0,show:e,as:r(u).Fragment,children:(0,s.jsxs)(up,{open:e,onClose:t,className:r(Jd)("memori-drawer",n),children:[(0,s.jsx)(Jf.Child,{as:r(u).Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)("div",{className:"memori-drawer--backdrop"})}),(0,s.jsx)("div",{className:"memori-drawer--container",children:(0,s.jsx)("div",{className:"memori-drawer--container-scrollable",children:(0,s.jsx)(Jf.Child,{as:r(u).Fragment,enter:"ease-out duration-300",enterFrom:"max-w-0 opacity-0",enterTo:"max-w-100 opacity-100",leave:"ease-in duration-200",leaveFrom:"max-w-100 opacity-100",leaveTo:"max-w-0 opacity-0",children:(0,s.jsxs)(up.Panel,{className:r(Jd)("memori-drawer--panel",{"memori-drawer--panel-left":"left"===d,"memori-drawer--with-footer":!!l}),children:[(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-drawer--panel {\n --memori-drawer--width: ${h};\n --memori-drawer--width-lg: ${m};\n --memori-drawer--width-md: ${p};\n }\n `}}),f&&(0,s.jsx)("div",{className:"memori-drawer--close",children:(0,s.jsx)(Zd,{shape:"circle",outlined:!0,icon:(0,s.jsx)(fp,{}),onClick:()=>t(!1)})}),(0,s.jsxs)(dp,{spinning:c,children:[i&&(0,s.jsx)(up.Title,{className:"memori-drawer--title",children:i}),o&&(0,s.jsx)(up.Description,{className:"memori-drawer--description",children:o}),a,l&&(0,s.jsx)("div",{className:"memori-drawer--footer",children:l})]})]})})})})]})});Jd=a("4IUwl");var ZY=({label:e,className:t,disabled:n=!1,checked:i,children:o,onChange:a,name:l,...c})=>(0,s.jsxs)("label",{className:r(Jd)("memori-checkbox",t,{"memori-checkbox--disabled":n}),children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",...c,name:l,disabled:n,defaultChecked:i,className:"memori-checkbox--input",onChange:a}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsx)("span",{className:"memori-checkbox--text",children:e})]});const $Y=[2,3,5,10,15,20,30,60];var eJ=({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})=>{const{t:f}=Te();return(0,s.jsxs)(XY,{className:"memori-settings-drawer",open:e,onClose:n,title:f("widget.settings")||"Settings",description:f("write_and_speak.settingsHeaderLabel"),children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"#microphoneMode",children:[f("write_and_speak.microphoneMode")||"Microphone mode",":"]}),(0,s.jsxs)(Sb,{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),BY("microphoneMode",t)},children:[(0,s.jsx)(Sb.Option,{value:"HOLD_TO_TALK",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked:e})=>(0,s.jsx)(Zd,{primary:e,children:f("write_and_speak.holdToSpeak")||"Hold to speak"})}),(0,s.jsx)(Sb.Option,{value:"CONTINUOUS",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked:e})=>(0,s.jsx)(Zd,{primary:e,children:f("write_and_speak.continuousSpeechLabel")||"Continuous speech"})})]})]}),"CONTINUOUS"===r&&(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(ew,{label:f("write_and_speak.secondsLabel")||"Seconds",placeholder:f("write_and_speak.secondsLabel")||"Seconds",options:$Y.map((e=>({value:e,label:e}))),value:i,onChange:e=>{a(e),BY("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:[f("write_and_speak.controlsPosition")||"Controls",":"]}),(0,s.jsxs)(Sb,{id:"controlsPosition",name:"controlsPosition",value:l,defaultValue:l,className:"memori-settings-drawer--controlsposition-radio",onChange:e=>{c(e),BY("controlsPosition",e)},children:[(0,s.jsx)(Sb.Option,{value:"center",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(Zd,{primary:e,children:f("center")||"Center"})}),(0,s.jsx)(Sb.Option,{value:"bottom",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(Zd,{primary:e,children:f("bottom")||"Bottom"})})]})]}),(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(ZY,{label:f("write_and_speak.hideEmissionsLabel"),name:"hideControls",checked:u,onChange:e=>{d(e.target.checked),BY("hideEmissions",e.target.checked)}})})]})]})};let tJ,nJ,rJ,iJ,oJ;window.getMemoriState=e=>{var t,n,r,i,o;let a=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(!a)return null;let s=null===(o=a.dataset)||void 0===o?void 0:o.memoriEngineState;return s?JSON.parse(s):null},window.typeMessage=e=>{var t,n;let r=document.querySelector("fieldset#chat-fieldset textarea")||(null===(n=null===(t=document.querySelector("memori-client"))||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector("fieldset#chat-fieldset textarea"));r&&(!function(e,t){var n,r,i,o;const a=null===(r=null===(n=null==Object?void 0:Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,"value"))||void 0===r?void 0:r.set,s=Object.getPrototypeOf(e),l=null===(o=null===(i=null==Object?void 0:Object.getOwnPropertyDescriptor)||void 0===i?void 0:i.call(Object,s,"value"))||void 0===o?void 0:o.set;l&&a&&a!==l?l.call(e,t):a&&a.call(e,t)}(r,e),r.dispatchEvent(new Event("input",{bubbles:!0})),setTimeout((()=>{var e,t;let n=document.querySelector("button.memori-chat-inputs--send")||(null===(t=null===(e=document.querySelector("memori-client"))||void 0===e?void 0:e.shadowRoot)||void 0===t?void 0:t.querySelector("button.memori-chat-inputs--send"));n&&n.click()}),100))};var aJ=({memori:e,memoriConfigs:t,memoriLang:n,multilingual:i,integration:o,layout:a="DEFAULT",customLayout:l,showInstruct:c=!1,showShare:d,preview:f=!1,embed:h=!1,showInputs:p=!0,showDates:m=!1,showContextPerLine:g=!1,showSettings:v=!0,height:y="100vh",secret:b,baseUrl:w="https://app.twincreator.com",apiUrl:x="https://backend.memori.ai",initialContextVars:S,initialQuestion:M,ogImage:_,sessionID:A,tenant:E,personification:C,authToken:k,AZURE_COGNITIVE_SERVICES_TTS_KEY:T,onStateChange:I})=>{var O,R,P,N,L,D,B,j,F,U,z,H,V,G,q,K,Y,J,Q,X,Z;const{t:$,i18n:ee}=Te(),[te,ne]=(0,u.useState)(!1);(0,u.useEffect)((()=>{ne(!0)}),[]);const re=W(x),{initSession:ie,postTextEnteredEvent:oe,postPlaceChangedEvent:ae,postTimeoutEvent:se,postTagChangedEvent:le,getSession:ce,getContentQualityIndexes:ue}=re,[de,fe]=(0,u.useState)(!1),[he,pe]=(0,u.useState)(!1),[me,ge]=(0,u.useState)(!1),ve=null===(N=null===(P=null===(R=null===(O=null==t?void 0:t.find((t=>t.memoriConfigID===e.memoriConfigurationID)))||void 0===O?void 0:O.culture)||void 0===R?void 0:R.split("-"))||void 0===P?void 0:P[0])||void 0===N?void 0:N.toUpperCase(),ye=(null==o?void 0:o.customData)?JSON.parse(o.customData):null,be=void 0!==i?i:!!(null==ye?void 0:ye.multilanguage),[we,xe]=(0,u.useState)(null!==(z=null!==(U=null!==(F=null!==(j=null!==(L=null!=n?n:null==ye?void 0:ye.lang)&&void 0!==L?L:null===(B=null===(D=null==e?void 0:e.culture)||void 0===D?void 0:D.split("-"))||void 0===B?void 0:B[0])&&void 0!==j?j:ve)&&void 0!==F?F:null==ye?void 0:ye.uiLang)&&void 0!==U?U:ee.language)&&void 0!==z?z:"IT"),[Se,Me]=(0,u.useState)(!1),[_e,Ae]=(0,u.useState)(!1),Ee=a||(null==ye?void 0:ye.layout)||"DEFAULT",[Ce,ke]=(0,u.useState)(!1),[Ie,Oe]=(0,u.useState)(!1),[Re,Pe]=(0,u.useState)(!1),[Ne,Le]=(0,u.useState)(!1),[De,Be]=(0,u.useState)(!1),[je,Fe]=(0,u.useState)(!1),[Ue,ze]=(0,u.useState)(2),[He,Ve]=(0,u.useState)(!1),[We,Ge]=(0,u.useState)("center"),[qe,Ke]=(0,u.useState)(!1);(0,u.useEffect)((()=>{Ve(!!rJ)}),[rJ]),(0,u.useEffect)((()=>{let e="bottom",t=DY("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",Be(DY("muteSpeaker",!1)),Fe("CONTINUOUS"===t),ze(DY("continuousSpeechTimeout",2)),Ge(DY("controlsPosition",e)),Ke(DY("hideEmissions",!1))}),[]);const[Ye,Je]=(0,u.useState)(b),[Qe,Xe]=(0,u.useState)(),[Ze,$e]=(0,u.useState)(null),[et,tt]=(0,u.useState)(),nt=async(e,t)=>{var n;const r=null!=t?t:vt;if(e&&r){const{currentState:t,...i}=await ae({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&&xt({...bt,...t})}},[rt,it]=(0,u.useState)(""),[ot,at]=(0,u.useState)(!1),[st,lt]=(0,u.useState)([]),ct=e=>{lt((t=>[...t,{...e}]))},ut=async(t,n,r,i=!0,o)=>{var a,s,l,c,u;if(!vt||!(null==t?void 0:t.length))return;ct({text:t,translatedText:o,fromUser:!0,media:null!=n?n:[],initial:!!r}),Ae(!0);const d=null!==(c=null!==(l=null===(s=null===(a=e.culture)||void 0===a?void 0:a.split("-"))||void 0===s?void 0:s[0])&&void 0!==l?l:ee.language)&&void 0!==c?c:"IT";let f=t;if(i&&!de&&be&&we.toUpperCase()!==d.toUpperCase()){f=(await Sg(t,d,we,w)).text}const{currentState:h,...p}=await oe({sessionId:null!=r?r:vt,text:f});if(0===p.resultCode&&h){const t=null!==(u=h.emission)&&void 0!==u?u:null==bt?void 0:bt.emission;if("X4"===h.state&&e.giverTag){const{currentState:t,...n}=await le(vt,e.giverTag);0===n.resultCode?(xt(t),t.emission&&(ct({text:t.emission,media:t.media,fromUser:!1}),Dt(t.emission))):(console.error(p,n),Qd.error($($F(n.resultCode))))}else if("X2d"===h.state&&e.giverTag){const{currentState:t,...n}=await oe({sessionId:null!=r?r:vt,text:Math.random().toString().substring(2,8)});if(0===n.resultCode){const{currentState:t,...n}=await le(vt,e.giverTag);0===n.resultCode?(xt(t),t.emission&&(ct({text:t.emission,media:t.media,fromUser:!1}),Dt(t.emission))):(console.error(p,n),Qd.error($($F(n.resultCode))))}else console.error(p,n),Qd.error($($F(n.resultCode)))}else we.toLowerCase()!==d.toLowerCase()&&t&&!de&&be?dt(h,we).then((e=>{e.emission&&Dt(e.emission)})):(xt({...h,emission:t}),t&&(ct({text:t,media:h.media,fromUser:!1,generatedByAI:!!h.completion}),Dt(t)))}else 404===p.resultCode&&(lt((e=>[...e.slice(0,e.length-1)])),Mt(!1,Ye||e.secretToken,Qe,de&&e.giverTag?e.giverTag:void 0,de&&e.giverPIN?e.giverPIN:void 0,S,M).then((e=>{console.info("session timeout"),(null==e?void 0:e.sessionID)&&setTimeout((()=>{ut(t,n,null==e?void 0:e.sessionID)}),500)})));Ae(!1)},dt=async(t,n)=>{var r,i,o,a,s,l,c;const u=null!==(a=null!==(o=null===(i=null===(r=e.culture)||void 0===r?void 0:r.split("-"))||void 0===i?void 0:i[0])&&void 0!==o?o:ee.language)&&void 0!==a?a:"IT",d=null!==(s=t.emission)&&void 0!==s?s:null==bt?void 0:bt.emission;let f={...t},h=null;if(d&&!de&&u.toUpperCase()!==n.toUpperCase()&&be){const e=await Sg(d,n,u,w);if(t.hints&&t.hints.length>0){const r=await Promise.all((null!==(l=t.hints)&&void 0!==l?l:[]).map((async e=>{var t;const r=await Sg(e,n,u,w);return{text:null!==(t=null==r?void 0:r.text)&&void 0!==t?t:e,originalText:e}})));f={...t,emission:e.text,translatedHints:r}}else f={...t,emission:e.text,hints:null!==(c=t.hints)&&void 0!==c?c:"G1"===t.state?null==bt?void 0:bt.hints:[]};e.text.length>0&&(h={text:e.text,media:t.media,fromUser:!1,generatedByAI:!!t.completion})}else f={...t,emission:d},d&&(h={text:d,media:t.media,fromUser:!1});return xt(f),h&&ct(h),f},ft=e.ageRestriction?e.ageRestriction:e.nsfw?18:e.enableCompletions?14:0,[ht,pt]=(0,u.useState)(),[mt,gt]=(0,u.useState)(!1),[vt,yt]=(0,u.useState)(A),[bt,wt]=(0,u.useState)(),xt=e=>{wt(e),I&&I(e)},St=async t=>{var n;if("PUBLIC"!==e.privacyType&&!e.secretToken&&!Ye&&!Qe)return void $e("password");let r=DY("birthDate",void 0);if(ht||r||!ft){Me(!0);try{if(!e.giverTag&&(null===(n=e.receivedInvitations)||void 0===n?void 0:n.length)){let t=e.receivedInvitations.find((e=>"GIVER"===e.type&&"ACCEPTED"===e.state));t&&(e.giverTag=t.tag,e.giverPIN=t.pin)}const r=await ie(t);if((null==r?void 0:r.sessionID)&&(null==r?void 0:r.currentState)&&0===r.resultCode)return yt(r.sessionID),et&&nt(et,r.sessionID),Me(!1),{dialogState:r.currentState,sessionID:r.sessionID};(null==r?void 0:r.resultMessage.startsWith("This Memori is aged restricted"))?(console.error(r),Qd.error($("underageTwinSession",{age:ft})),ge(!0)):(console.error(r),Qd.error($($F(null==r?void 0:r.resultCode))),ge(!0))}catch(e){console.error(e),new Error("Error fetching session")}}else gt(!0)},Mt=async(t=!1,n,r,i,o,a,s,l)=>{var c;Me(!0);try{let u=DY("birthDate",void 0);const{sessionID:d,currentState:f,...h}=await ie({memoriID:null!==(c=e.engineMemoriID)&&void 0!==c?c:"",password:n,recoveryTokens:r,tag:i,pin:o,initialContextVars:a,initialQuestion:s,birthDate:l||u||void 0});if(d&&f&&0===h.resultCode)return yt(d),t&&(xt(f),f.emission&&(st.length<=1?lt([{text:f.emission,media:f.media,fromUser:!1}]):ct({text:f.emission,media:f.media,fromUser:!1}))),et&&nt(et,d),Me(!1),{dialogState:f,sessionID:d};(null==h?void 0:h.resultMessage.startsWith("This Memori is aged restricted"))?(console.error(h),Qd.error($("underageTwinSession",{age:ft})),ge(!0)):(console.error(h),Qd.error($($F(h.resultCode))),ge(!0))}catch(e){console.error(e)}return Me(!1),null},_t=async(t,n,r,i)=>{var o;if(!t||!n)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState:t,resultCode:a}=await le(n,null!=r?r:Ag);if(0===a){let s=0;if(r!==Ag&&i&&("X1a"===t.state||"X1b"===t.state)){const{resultCode:e}=await oe({sessionId:n,text:null!=i?i:""});s=e}if(0===s){const{currentState:e,...t}=await ce(n);if(0===t.resultCode&&e)return{currentState:e,sessionId:n,...t}}else if([400,401,403,404,500].includes(a)){console.warn("[APPCONTEXT/CHANGETAG]",a);let t=DY("birthDate",void 0);St({memoriID:null!==(o=e.engineMemoriID)&&void 0!==o?o:"",password:b||e.secretToken,tag:e.giverTag,pin:e.giverPIN,initialContextVars:S,initialQuestion:M,birthDate:ht||t||void 0})}else if(t)return{currentState:t,sessionId:n,resultCode:a}}}catch(e){let t=e;return console.error("[APPCONTEXT/CHANGETAG]",t),Promise.reject(t)}return null};(0,u.useEffect)((()=>()=>{bt&&(null==bt?void 0:bt.currentTag)===e.giverTag||(async()=>{vt&&e.giverTag&&e.giverPIN&&(lt([]),await _t(e.engineMemoriID,vt,e.giverTag,e.giverPIN))})()}),[]);const[At,Et]=(0,u.useState)(),Ct=(0,u.useRef)(),kt=()=>{At&&(clearTimeout(At),Et(void 0)),(null==Ct?void 0:Ct.current)&&(clearTimeout(Ct.current),Ct.current=void 0)},Tt=()=>{kt(),!(null==bt?void 0:bt.acceptsTimeout)||rJ||He||rt.length||ot||Ot()},It=async()=>{var e;if(rJ||He||rt.length||ot)Tt();else if(vt&&Ce&&(null==bt?void 0:bt.acceptsTimeout)){const{currentState:t,...n}=await se(vt);if(0===n.resultCode&&t){const n=t.emission;!de&&be&&we!==(null==ee?void 0:ee.language)&&n&&n.length>0?dt({...t,emission:n},we).then((e=>{e.emission&&Dt(e.emission)})):n&&n.length>0&&(ct({text:n,media:t.media,fromUser:!1,generatedByAI:!!t.completion}),Dt(n),xt({...t,hints:null!==(e=t.hints)&&void 0!==e?e:"G1"===t.state?null==bt?void 0:bt.hints:[]}))}}},Ot=()=>{let t=null==bt?void 0:bt.timeout;if(!t){let e=40,n=25;if(t=Math.floor(Math.random()*(e-n))+n,null==bt?void 0:bt.emission){t+=bt.emission.length/26.5}}e.enableCompletions&&(t+=60);let n=setTimeout(It,1e3*t);Et(n),Ct.current=n};(0,u.useEffect)((()=>{(rt.length||He)&&kt(),vt&&!rt.length&&Tt()}),[null==bt?void 0:bt.acceptsTimeout,null==bt?void 0:bt.timeout,null==bt?void 0:bt.state,He,vt,st,rt]),(0,u.useEffect)((()=>()=>{ke(!1),pe(!1),kt(),Ct.current=void 0}),[]);const Rt=(0,u.useCallback)((t=>{var n,r,i,o;let a="";switch((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:ee.language)&&void 0!==o?o:"IT").toUpperCase()){case"IT":a=""+("MALE"===e.voiceType?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":a=""+("MALE"===e.voiceType?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":a=""+("MALE"===e.voiceType?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":a=""+("MALE"===e.voiceType?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":a=""+("MALE"===e.voiceType?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":a=""+("MALE"===e.voiceType?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":a=""+("MALE"===e.voiceType?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":a=""+("MALE"===e.voiceType?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;default:a=""+("MALE"===e.voiceType?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return a}),[e.voiceType,ee.language,e.culture]),Pt=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])||ee.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"}return i},[Nt,Lt]=(0,u.useState)();(0,u.useEffect)((()=>{(async()=>{try{const e=await fetch(`${w||"https://app.twincreator.com"}/api/lexiconmap`);return await e.json()}catch(e){console.error(e)}})().then((e=>{Lt(e)}))}),[]);const Dt=e=>{if(!T)return;if(qt(),f)return;if(De)return void(je&&Vt());iJ&&iJ.pause();let t=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome"),n=/iPad|iPhone|iPod/.test(navigator.userAgent);if("interrupted"===oJ.state)return void oJ.resume().then((()=>Dt(e)));if(n&&t&&(oJ.suspend(),He))try{rJ&&(rJ.close(),rJ=null),iJ&&(iJ.pause(),iJ.close()),oJ&&oJ.destination.disconnect()}catch(e){console.error("stopAudio error: ",e)}if("closed"===oJ.state){oJ=new ra;let e=oJ.createBuffer(1,1e4,22050),t=oJ.createBufferSource();t.buffer=e,t.connect(oJ.destination)}else if("suspended"===oJ.state){Bt(),oJ=new ra;let e=oJ.createBuffer(1,1e4,22050),t=oJ.createBufferSource();t.buffer=e,t.connect(oJ.destination)}if(!rJ){iJ=new _d.SpeakerAudioDestination;let e=Id.fromSpeakerOutput(iJ);rJ=new Vd.SpeechSynthesizer(nJ,e)}const r=oJ.createBufferSource();r.addEventListener("ended",(()=>{Ve(!1)})),iJ.onAudioEnd=()=>{Ve(!1),r.disconnect(),Qt()},rJ.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="${Pt(we)}"><voice name="${Rt(we)}"><s>${((e,t)=>{var n;if(!Nt)return e;const r={...null!==(n=Nt.common)&&void 0!==n?n:{},...(null==E?void 0:E.id)&&Nt[E.id]?Nt[E.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})(e),we.toLowerCase())}</s></voice></speak>`,(i=>{if(i){Ve(!0);try{oJ.decodeAudioData(i.audioData,(function(e){r.buffer=e,r.connect(oJ.destination),(st.length<1||t&&n)&&r.start(0)})),oJ.onstatechange=()=>{"suspended"===oJ.state||"closed"===oJ.state?(r.disconnect(),Ve(!1)):"interrupted"===oJ.state&&oJ.resume()},oJ.resume(),rJ&&(rJ.close(),rJ=null)}catch(t){console.error("speak error: ",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),Ve(!1),rJ&&(rJ.close(),rJ=null)}}else oJ.resume(),Ve(!1)}),(t=>{console.error("speak:",t),window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),Ve(!1)})),Ae(!1)},Bt=()=>{Ve(!1);try{rJ&&(rJ.close(),rJ=null),"closed"!==oJ.state&&oJ.close(),iJ&&(iJ.pause(),iJ.close())}catch(e){console.error("stopAudio error: ",e)}};(0,u.useEffect)((()=>{let e=document.querySelector("#chat-fieldset textarea");e&&e.focus()}),[null==bt?void 0:bt.emission]);const[jt,Ft]=(0,u.useState)(""),Ut=()=>Ft(""),[zt,Ht]=(0,u.useState)(null),Vt=()=>{let e=setTimeout((async()=>{Kt();const e=Bm(jt);e.length>0?(ut(e),Ut(),it("")):ot&&Tt()}),1e3*Ue);Ht(e)},Wt=()=>{zt&&(clearTimeout(zt),Ht(null))};(0,u.useEffect)((()=>{Wt(),je&&Vt(),Tt()}),[jt]);const Gt=()=>{if(T){Kt(),Ft(""),Ut();try{navigator.mediaDevices.getUserMedia({audio:!0}).then((function(e){Oe(!0),nJ||(nJ=Cc.fromSubscription(T,"eastus"),nJ.speechRecognitionLanguage=Pt(we),nJ.speechSynthesisLanguage=Pt(we),nJ.speechSynthesisVoiceName=Rt(we));const t=Id.fromDefaultMicrophoneInput();tJ=new Pd.SpeechRecognizer(nJ,t),at(!0),tJ.recognized=(e,t)=>{if(t.result.text)if(t.result.reason===Pl.RecognizedSpeech){let e=t.result.text;if(Ft(e||""),(null==e?void 0:e.length)>0){const t=Bm(e);t.length>0&&it((e=>`${e} ${t}`))}}else t.result.reason===Pl.NoMatch&&console.debug("NOMATCH: Speech could not be recognized.")},tJ.canceled=(e,t)=>{t.reason===ol.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?")),qt()},tJ.sessionStopped=(e,t)=>{qt()},Ut(),tJ.startContinuousRecognitionAsync()})).catch(console.error)}catch(e){console.error(e)}}},qt=()=>{tJ&&(tJ.stopContinuousRecognitionAsync(),tJ.close(),tJ=null),at(!1)},Kt=()=>{Oe(!1),qt(),Wt()};(0,u.useEffect)((()=>()=>Kt()),[]),(0,u.useEffect)((()=>{"Z0"===(null==bt?void 0:bt.state)&&Kt()}),[null==bt?void 0:bt.state]);const[Yt,Jt]=(0,u.useState)(!1),Qt=(0,u.useCallback)((e=>{He&&rJ&&(rJ.close(),rJ=null),!je||!Ie&&Yt||(Jt(!0),Gt())}),[je,Ie]);(0,u.useEffect)((()=>{st.length>1&&!He&&je&&(Ie||!Yt)?Gt():He&&ot&&qt()}),[He]),(0,u.useEffect)((()=>(document.addEventListener("endSpeakStartListen",Qt),()=>{document.removeEventListener("endSpeakStartListen",Qt)})),[Qt]),(0,u.useEffect)((()=>{ot&&(Kt(),Ut(),it(""),Gt())}),[ve]);const[Xt,Zt]=(0,u.useState)("keypress");(0,u.useEffect)((()=>{const e=DY("sendOnEnter","keypress");window.innerWidth<=768?Zt("click"):Zt(e)}),[]),(0,u.useEffect)((()=>{BY("sendOnEnter",Xt)}),[Xt]);const[$t,en]=(0,u.useState)(),tn=null==ye?void 0:ye.globalBackground,nn=tn?`url(${tn})`:null,rn=o?{"--memori-chat-bubble-bg":"#fff",...ye&&!c?{"--memori-text-color":null!==(H=ye.textColor)&&void 0!==H?H:"#000"}:{},...(null==ye?void 0:ye.buttonBgColor)?{"--memori-button-bg":ye.buttonBgColor,"--memori-primary":ye.buttonBgColor}:{},...(null==ye?void 0:ye.buttonTextColor)?{"--memori-button-text":ye.buttonTextColor}:{},...(null==ye?void 0:ye.blurBackground)?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...(null==ye?void 0:ye.innerBgColor)?{"--memori-inner-bg":`rgba(${"dark"===ye.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(V=ye.innerBgAlpha)&&void 0!==V?V:.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===ye.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(G=null==ye?void 0:ye.innerBgAlpha)&&void 0!==G?G:.4})`}:{"--memori-inner-content-pad":"0px"}}:{},on=`\n ${f?"#preview":":root"}, .memori-widget {\n ${Object.entries(rn).map((([e,t])=>`${e}: ${t};`)).join("\n")}\n }\n `,an=void 0===(null==ye?void 0:ye.showAIicon)||(null==ye?void 0:ye.showAIicon),[sn,ln]=(0,u.useState)(!1);(0,u.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===Ee||"FULLPAGE"!==Ee)&&ln(!0)}),[]);const[cn,un]=(0,u.useState)();(0,u.useEffect)((()=>{e.engineMemoriID&&(async e=>{let t,n;try{const{contentQualityIndex:r,answerQualityIndex:i,unansweredQuestions:o,...a}=await ue(e);0===a.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=>{un(GY(e.points))})).catch(console.error)}),[e.engineMemoriID]),(0,u.useEffect)((()=>{if(null==ye?void 0:ye.seoTitle){let e=document.createElement("meta");e.setAttribute("property","og:title"),e.setAttribute("content",ye.seoTitle),document.head.append(e)}if(null==ye?void 0:ye.seoDescription){let e=document.createElement("meta");e.setAttribute("property","og:description"),e.setAttribute("content",ye.seoDescription),document.head.append(e)}if(null==ye?void 0:ye.seoUrl){let e=document.createElement("meta");e.setAttribute("property","og:url"),e.setAttribute("content",ye.seoUrl),document.head.append(e)}let t=_||e.avatarURL;if((null==ye?void 0:ye.seoImageShowAvatar)&&t){let e=document.createElement("meta");e.setAttribute("property","og:image"),e.setAttribute("content",t),document.head.append(e)}}),[ye,e.avatarURL,_]);const dn=async t=>{const n=(null==t?void 0:t.sessionID)||vt,r=(null==t?void 0:t.dialogState)||bt;pe(!0);let i=document.getElementById("memori-audio"),o=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome");i&&o&&(i.muted=!1,i.play().catch((e=>{console.error("error playing intro audio",e)})));let a=DY("birthDate",void 0),s=ht||a||void 0;if(!n&&"PUBLIC"!==e.privacyType&&!e.secretToken&&!Ye&&!Qe||!n&&me)return $e("password"),void pe(!1);if(n||!ft||s){if(!n){pe(!1),ge(!1);const t=await St({memoriID:e.engineMemoriID,password:b||e.secretToken,tag:null==C?void 0:C.tag,pin:null==C?void 0:C.pin,initialContextVars:S,initialQuestion:M,birthDate:s});return void((null==t?void 0:t.dialogState)?(lt([]),dt(t.dialogState,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}))):await dn(t||void 0))}if(A){const{currentState:t,...r}=await ce(n);if(0!==r.resultCode||!t)return console.debug("session expired, opening new session"),ge(!0),yt(void 0),pe(!1),void await dn();if(lt([]),de&&e.giverTag&&(null==bt?void 0:bt.currentTag)!==e.giverTag)try{console.debug("change tag #0"),await _t(e.engineMemoriID,n,"-");const t=await _t(e.engineMemoriID,n,e.giverTag,e.giverPIN);if(!t||0!==t.resultCode)throw console.error("session #1",t),new Error("No session");dt(t.currentState,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}))}catch(t){console.error("session #2",t),Mt(!0,null==e?void 0:e.secretToken,void 0,null==e?void 0:e.giverTag,null==e?void 0:e.giverPIN,S,M,s).then((()=>{ke(!0)}))}else if(!de&&C&&(null==bt?void 0:bt.currentTag)!==C.tag)try{console.debug("change tag #3"),await _t(e.engineMemoriID,n,"-");const t=await _t(e.engineMemoriID,n,C.tag,C.pin);if(!t||0!==t.resultCode)throw console.error("session #4",t),new Error("No session");dt(t.currentState,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}))}catch(t){console.error("session #5",t),Mt(!0,null==e?void 0:e.secretToken,void 0,C.tag,C.pin,S,M,s).then((()=>{ke(!0)}))}else if(de||C||(null==bt?void 0:bt.currentTag)===Ag)dt(t,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}));else try{console.debug("change tag #6"),await _t(e.engineMemoriID,n,"-");const t=await _t(e.engineMemoriID,n,Ag);if(!t||0!==t.resultCode)throw console.error("session #7",t),new Error("No session");dt(t.currentState,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}))}catch(t){console.error("session #8",t),Mt(!0,null==e?void 0:e.secretToken,void 0,void 0,void 0,S,M,s).then((()=>{ke(!0)}))}}else lt([]),dt(r,we).then((e=>{e.emission&&Dt(e.emission)})).finally((()=>{ke(!0)}))}else gt(!0),pe(!1)},[fn,hn]=(0,u.useState)(k);(0,u.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?hn(t.target.getAttribute("authtoken")||void 0):hn((null===(i=null===(r=t.target)||void 0===r?void 0:r.parentElement)||void 0===i?void 0:i.getAttribute("authtoken"))||void 0))}));return n.observe(t,{attributes:!0,childList:!1,subtree:!1}),()=>{n.disconnect()}}),[]);const pn={memori:e,history:st,showShare:null===(q=null!=d?d:null==ye?void 0:ye.showShare)||void 0===q||q,position:et,setShowPositionDrawer:Pe,setShowSettingsDrawer:Le,showSpeaker:!!T,speakerMuted:De,setSpeakerMuted:e=>{if(Be(e),BY("muteSpeaker",!!e),e)Bt();else{oJ=new ra;let e=oJ.createBuffer(1,1e4,22050),t=oJ.createBufferSource();t.buffer=e,t.connect(oJ.destination)}},showSettings:v,hasUserActivatedSpeak:Ce,showReload:"TOTEM"===Ee},mn={memori:e,integration:o,integrationConfig:ye,tenant:E,instruct:de,avatar3dVisible:sn,setAvatar3dVisible:ln,hasUserActivatedSpeak:Ce,isPlayingAudio:He,loading:_e,baseUrl:w,apiUrl:x},gn={memori:e,tenant:E,gamificationLevel:cn,language:ve,userLang:we,setUserLang:xe,baseUrl:w,apiUrl:x,position:et,openPositionDrawer:()=>Pe(!0),integrationConfig:ye,instruct:de,sessionId:vt,clickedStart:he,onClickStart:dn,initializeTTS:()=>{if(!T)return;nJ=Cc.fromSubscription(T,"eastus"),nJ.speechSynthesisLanguage=Pt(we),nJ.speechSynthesisVoiceName=Rt(we),nJ.speechRecognitionLanguage=Pt(we),Dm()&&(nJ.speechSynthesisOutputFormat=hc.Audio16Khz32KBitRateMonoMp3),oJ=new ra;let e=oJ.createBuffer(1,1e4,22050),t=oJ.createBufferSource();t.buffer=e,t.connect(oJ.destination),iJ=new _d.SpeakerAudioDestination;let n=Id.fromSpeakerOutput(iJ);rJ=new Vd.SpeechSynthesizer(nJ,n)}},vn={memori:e,sessionID:vt||"",tenant:E,translateTo:be&&we.toUpperCase()!==(null===(X=null!==(Q=null!==(J=null===(Y=null===(K=e.culture)||void 0===K?void 0:K.split("-"))||void 0===Y?void 0:Y[0])&&void 0!==J?J:ee.language)&&void 0!==Q?Q:"IT")||void 0===X?void 0:X.toUpperCase())?we:void 0,baseUrl:w,apiUrl:x,memoriTyping:_e,history:"TOTEM"===a?st.slice(-2):st,authToken:fn,dialogState:bt,setDialogState:xt,pushMessage:ct,simulateUserPrompt:(e,t)=>{qt(),Bt(),ut(e,void 0,void 0,!1,t)},showDates:m,showContextPerLine:g,showAIicon:an,client:re,selectReceiverTag:async t=>{var n;if(vt)try{const{currentState:r,...i}=await le(vt,t);if(0===i.resultCode)if(ct({text:t,fromUser:!0}),"X4"===r.state&&e.giverTag){const{currentState:t,...n}=await re.postTagChangedEvent(vt,e.giverTag);0===n.resultCode?(xt(t),t.emission&&ct({text:t.emission,media:t.media,fromUser:!1})):(console.error(n),Qd.error($($F(n.resultCode))))}else xt(r),r.emission&&ct({text:r.emission,media:r.media,fromUser:!1});else console.error(i,t,null===(n=null==bt?void 0:bt.knownTags)||void 0===n?void 0:n[t]),Qd.error($($F(i.resultCode)))}catch(e){let t=e;console.error(t),Qd.error(t.message)}},preview:f,sendOnEnter:Xt,setSendOnEnter:Zt,microphoneMode:je?"CONTINUOUS":"HOLD_TO_TALK",attachmentsMenuOpen:$t,setAttachmentsMenuOpen:en,instruct:de,showInputs:p,showMicrophone:!!T,userMessage:rt,onChangeUserMessage:e=>{if(!e||"\n"===e||""===e.trim())return it(""),void Tt();it(e),kt()},sendMessage:e=>{Bt(),qt(),ut(e),it(""),Ut()},stopListening:Kt,startListening:Gt,stopAudio:Bt,resetTranscript:Ut,listening:ot,isPlayingAudio:He},yn=o&&nn?(0,s.jsx)("div",{className:"memori--global-background",children:(0,s.jsx)("div",{className:"memori--global-background-image",style:{backgroundImage:nn}})}):(0,s.jsx)("div",{className:"memori--global-background no-background-image"}),bn=o?(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:on}}):null,wn={canInstruct:!!e.giverTag,instruct:!!de,onChangeMode:e=>{fe("instruct"===e),ke(!1),pe(!1)}},xn=(0,s.jsx)(OY,{tenant:E,userLang:we}),Sn=l||("TOTEM"===Ee?PY:"CHAT"===Ee?NY:RY);return(0,s.jsxs)("div",{className:r(Jd)("memori","memori-widget",`memori-layout-${a.toLowerCase()}`,`memori-controls-${We.toLowerCase()}`,{"memori--preview":f,"memori--embed":h,"memori--with-integration":o,"memori--with-speechkey":!!T,"memori--active":Ce,"memori--hide-emissions":qe}),"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({...bt,sessionID:vt}),style:{height:y},children:[(0,s.jsx)(Sn,{Header:XF,headerProps:pn,Avatar:qj,avatarProps:mn,Chat:Ob,chatProps:vn,StartPanel:tw,startPanelProps:gn,integrationStyle:bn,integrationBackground:yn,ChangeMode:Kj,changeModeProps:wn,poweredBy:xn,sessionId:vt,hasUserActivatedSpeak:Ce,showInstruct:c,loading:Se}),(0,s.jsx)("audio",{id:"memori-audio",style:{display:"none"},src:"https://app.twincreator.com/intro.mp3"}),te&&(0,s.jsx)(Lm,{withModal:!0,pwdOrTokens:Ze,openModal:!!Ze,setPwdOrTokens:$e,showTokens:"SECRET"===e.privacyType,onFinish:async t=>{t.password&&Je(t.password),t.tokens&&Xe(t.tokens),Mt(!vt,t.password,t.tokens,de?e.giverTag:void 0,de?e.giverPIN:void 0,S,M,ht).then((e=>{$e(null),dn(e||void 0)})).catch((()=>{$e(null),ge(!0)}))},minimumNumberOfRecoveryTokens:null!==(Z=null==e?void 0:e.minimumNumberOfRecoveryTokens)&&void 0!==Z?Z:1}),te&&(0,s.jsx)(QY,{visible:mt,minAge:ft,onClose:t=>{t?(pt(t),BY("birthDate",t),Mt(!vt,null==e?void 0:e.secretToken,void 0,de?e.giverTag:void 0,de?e.giverPIN:void 0,S,M,t).then((e=>{gt(!1),dn(e||void 0)})).catch((()=>{gt(!1),ge(!0)}))):(gt(!1),pe(!1))}}),Ne&&(0,s.jsx)(eJ,{layout:Ee,open:!!Ne,onClose:()=>Le(!1),microphoneMode:je?"CONTINUOUS":"HOLD_TO_TALK",continuousSpeechTimeout:Ue,setMicrophoneMode:e=>Fe("CONTINUOUS"===e),setContinuousSpeechTimeout:ze,controlsPosition:We,setControlsPosition:Ge,hideEmissions:qe,setHideEmissions:Ke}),vt&&(0,s.jsx)(IY,{apiURL:x,visible:"link"===$t,onCancel:()=>en(void 0),onOk:async e=>{if(!vt)return;let t={mediumID:"",mimeType:"text/html",url:e.url,title:e.title};ct({text:$("media.insertThisLink",{url:t.url,title:t.title}),fromUser:!0,media:[t]});try{const{currentState:e,...n}=await re.postMediumSelectedEvent(vt,t);e&&0===n.resultCode?(xt(e),e.emission&&(ct({text:e.emission,media:e.media,fromUser:!1}),Dt(e.emission))):(console.error(n,e,t),Qd.error($($F(n.resultCode),{ns:"common"})))}catch(e){let t=e;console.error(t),Qd.error(t.message)}en(void 0)}}),fn&&vt&&(null==E?void 0:E.id)&&(0,s.jsx)(TY,{apiURL:x,visible:"media"===$t,authToken:fn,tenantID:null==E?void 0:E.id,sessionID:vt,uploadAssetURL:re.backend.getUploadAssetURL(fn,e.memoriID),deleteAsset:re.backend.deleteAsset,onCancel:()=>en(void 0),onOk:async e=>{if(!vt)return;let t={mediumID:"",mimeType:e.mimeType,url:e.assetURL,title:e.title||e.assetID};ct({text:$("media.insertThisMediaMsg"),fromUser:!0,media:[t]});try{const{currentState:e,...n}=await re.postMediumSelectedEvent(vt,t);e&&0===n.resultCode?(xt(e),e.emission&&(ct({text:e.emission,media:e.media,fromUser:!1}),Dt(e.emission))):(console.error(n,e,t),Qd.error($($F(n.resultCode),{ns:"common"})))}catch(e){let t=e;console.error(t),Qd.error(t.message)}en(void 0)}})]})};function sJ(e){return sJ="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sJ(e)}function lJ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cJ(e,t){if("object"!==sJ(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==sJ(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function uJ(e){var t=cJ(e,"string");return"symbol"===sJ(t)?t:String(t)}function dJ(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,uJ(r.key),r)}}function fJ(e,t,n){return t&&dJ(e.prototype,t),n&&dJ(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function hJ(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pJ(e,t){return pJ=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pJ(e,t)}function mJ(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&&pJ(e,t)}function gJ(e,t){if(t&&("object"===sJ(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return hJ(e)}function vJ(e){return vJ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vJ(e)}function yJ(e,t,n){return(t=uJ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bJ(e){if(Array.isArray(e))return e}function wJ(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function xJ(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 SJ(e,t){if(e){if("string"==typeof e)return xJ(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)?xJ(e,t):void 0}}function MJ(){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 _J(e){return bJ(e)||wJ(e)||SJ(e)||MJ()}function AJ(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 EJ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?AJ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AJ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var CJ={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)}},kJ=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lJ(this,e),this.init(t,n)}return fJ(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||CJ,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,EJ(EJ({},{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}(),TJ=new kJ,IJ=function(){function e(){lJ(this,e),this.observers={}}return fJ(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 OJ(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function RJ(e){return null==e?"":""+e}function PJ(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e])}))}function NJ(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 a=r(o.shift());!e[a]&&n&&(e[a]=new n),e=Object.prototype.hasOwnProperty.call(e,a)?e[a]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function LJ(e,t,n){var r=NJ(e,t,Object);r.obj[r.k]=n}function DJ(e,t){var n=NJ(e,t),r=n.obj,i=n.k;if(r)return r[i]}function BJ(e,t,n){var r=DJ(e,n);return void 0!==r?r:DJ(t,n)}function jJ(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]):jJ(e[r],t[r],n):e[r]=t[r]);return e}function FJ(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var UJ={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function zJ(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return UJ[e]})):e}var HJ="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,VJ=[" ",",","?","!",";"];function WJ(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 GJ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?WJ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WJ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function qJ(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=vJ(e);if(t){var i=vJ(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gJ(this,n)}}function KJ(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 a=2,s=r.slice(o,o+a).join(n),l=i[s];void 0===l&&r.length>o+a;)a++,l=i[s=r.slice(o,o+a).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(s)){if("string"==typeof l)return l;if(s&&"string"==typeof l[s])return l[s]}var c=r.slice(o+a).join(n);return c?KJ(l,c,n):void 0}i=i[r[o]]}return i}}var YJ=function(e){mJ(n,e);var t=qJ(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return lJ(this,n),r=t.call(this),HJ&&IJ.call(hJ(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 fJ(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,a=[e,t];n&&"string"!=typeof n&&(a=a.concat(n)),n&&"string"==typeof n&&(a=a.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(a=e.split("."));var s=DJ(this.data,a);return s||!o||"string"!=typeof n?s:KJ(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 a=[e,t];n&&(a=a.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(a=e.split("."))[1]),this.addNamespaces(t),LJ(this.data,a,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},a=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(a=e.split("."))[1]),this.addNamespaces(t);var s=DJ(this.data,a)||{};r?jJ(s,n,i):s=GJ(GJ({},s),n),LJ(this.data,a,s),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?GJ(GJ({},{}),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}(IJ),JJ={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 QJ(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 XJ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?QJ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QJ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ZJ(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=vJ(e);if(t){var i=vJ(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gJ(this,n)}}var $J={},eQ=function(e){mJ(n,e);var t=ZJ(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return lJ(this,n),r=t.call(this),HJ&&IJ.call(hJ(r)),PJ(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,hJ(r)),r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=TJ.create("translator"),r}return fJ(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,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=VJ.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 a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}(e,n,r));if(o&&!a){var s=e.match(this.interpolator.nestingRegexp);if(s&&s.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"!==sJ(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,a=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,s=this.extractFromKey(e[e.length-1],t),l=s.key,c=s.namespaces,u=c[c.length-1],d=t.lng||this.language,f=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(f){var h=t.nsSeparator||this.options.nsSeparator;return o?(p.res="".concat(u).concat(h).concat(l),p):"".concat(u).concat(h).concat(l)}return o?(p.res=l,p):l}var p=this.resolve(e,t),m=p&&p.res,g=p&&p.usedKey||l,v=p&&p.exactUsedKey||l,y=Object.prototype.toString.apply(m),b=["[object Number]","[object Function]","[object RegExp]"],w=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,x=!this.i18nFormat||this.i18nFormat.handleAsObject,S="string"!=typeof m&&"boolean"!=typeof m&&"number"!=typeof m;if(x&&m&&S&&b.indexOf(y)<0&&("string"!=typeof w||"[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 M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,m,XJ(XJ({},t),{},{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return o?(p.res=M,p):M}if(a){var _="[object Array]"===y,A=_?[]:{},E=_?v:g;for(var C in m)if(Object.prototype.hasOwnProperty.call(m,C)){var k="".concat(E).concat(a).concat(C);A[C]=this.translate(k,XJ(XJ({},t),{joinArrays:!1,ns:c})),A[C]===k&&(A[C]=m[C])}m=A}}else if(x&&"string"==typeof w&&"[object Array]"===y)(m=m.join(w))&&(m=this.extendTranslation(m,e,t,r));else{var T=!1,I=!1,O=void 0!==t.count&&"string"!=typeof t.count,R=n.hasDefaultValue(t),P=O?this.pluralResolver.getSuffix(d,t.count,t):"",N=t["defaultValue".concat(P)]||t.defaultValue;!this.isValidLookup(m)&&R&&(T=!0,m=N),this.isValidLookup(m)||(I=!0,m=l);var L=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,D=L&&I?void 0:m,B=R&&N!==m&&this.options.updateMissing;if(I||T||B){if(this.logger.log(B?"updateKey":"missingKey",d,u,l,B?N:m),a){var j=this.resolve(l,XJ(XJ({},t),{},{keySeparator:!1}));j&&j.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 z=0;z<U.length;z++)F.push(U[z]);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=R&&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&&O?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,p,r),I&&m===l&&this.options.appendNamespaceToMissingKey&&(m="".concat(u,":").concat(l)),(I||T)&&this.options.parseMissingKeyHandler&&(m="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(u,":").concat(l):l,T?m:void 0):this.options.parseMissingKeyHandler(m))}return o?(p.res=m,p):m}},{key:"extendTranslation",value:function(e,t,n,r,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,XJ(XJ({},this.options.interpolation.defaultVariables),n),r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(XJ(XJ({},n),{interpolation:XJ(XJ({},this.options.interpolation),n.interpolation)}));var a,s="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(s){var l=e.match(this.interpolator.nestingRegexp);a=l&&l.length}var c=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(c=XJ(XJ({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,n.lng||this.language,n),s){var u=e.match(this.interpolator.nestingRegexp);a<(u&&u.length)&&(n.nest=!1)}!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];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,f="string"==typeof d?[d]:d;return null!=e&&f&&f.length&&!1!==n.applyPostProcessor&&(e=JJ.handle(f,e,t,this.options&&this.options.postProcessPassResolved?XJ({i18nResolved:r},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,r,i,o,a=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!a.isValidLookup(t)){var l=a.extractFromKey(e,s),c=l.key;n=c;var u=l.namespaces;a.options.fallbackNS&&(u=u.concat(a.options.fallbackNS));var d=void 0!==s.count&&"string"!=typeof s.count,f=d&&!s.ordinal&&0===s.count&&a.pluralResolver.shouldUseIntlApi(),h=void 0!==s.context&&("string"==typeof s.context||"number"==typeof s.context)&&""!==s.context,p=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);u.forEach((function(e){a.isValidLookup(t)||(o=e,!$J["".concat(p[0],"-").concat(e)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(o)&&($J["".concat(p[0],"-").concat(e)]=!0,a.logger.warn('key "'.concat(n,'" for languages "').concat(p.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!!!")),p.forEach((function(n){if(!a.isValidLookup(t)){i=n;var o,l=[c];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(l,c,n,e,s);else{var u;d&&(u=a.pluralResolver.getSuffix(n,s.count,s));var p="".concat(a.options.pluralSeparator,"zero");if(d&&(l.push(c+u),f&&l.push(c+p)),h){var m="".concat(c).concat(a.options.contextSeparator).concat(s.context);l.push(m),d&&(l.push(m+u),f&&l.push(m+p))}}for(;o=l.pop();)a.isValidLookup(t)||(r=o,t=a.getResource(n,e,o,s))}})))}))}})),{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}(IJ);function tQ(e){return e.charAt(0).toUpperCase()+e.slice(1)}var nQ=function(){function e(t){lJ(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=TJ.create("languageUtils")}return fJ(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]=tQ(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]=tQ(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=tQ(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}(),rQ=[{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}],iQ={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)}},oQ=["v1","v2","v3"],aQ={zero:0,one:1,two:2,few:3,many:4,other:5};function sQ(){var e={};return rQ.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:iQ[t.fc]}}))})),e}var lQ=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lJ(this,e),this.languageUtils=t,this.options=n,this.logger=TJ.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=sQ()}return fJ(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 aQ[e]-aQ[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!oQ.includes(this.options.compatibilityJSON)}}]),e}();function cQ(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 uQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cQ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cQ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var dQ=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};lJ(this,e),this.logger=TJ.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return fJ(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:zJ,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?FJ(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?FJ(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?FJ(t.nestingPrefix):t.nestingPrefixEscaped||FJ("$t("),this.nestingSuffix=t.nestingSuffix?FJ(t.nestingSuffix):t.nestingSuffixEscaped||FJ(")"),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,a,s=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(s.formatSeparator)<0){var i=BJ(t,l,e);return s.alwaysFormat?s.format(i,void 0,n,uQ(uQ(uQ({},r),t),{},{interpolationkey:e})):i}var o=e.split(s.formatSeparator),a=o.shift().trim(),c=o.join(s.formatSeparator).trim();return s.format(BJ(t,l,a),c,n,uQ(uQ(uQ({},r),t),{},{interpolationkey:a}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,f=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 s.escapeValue?c(s.escape(e)):c(e)}}].forEach((function(t){for(a=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(f){o=i[0];continue}s.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}else"string"==typeof o||s.useRawValueToEscape||(o=RJ(o));var c=t.safeValue(o);if(e=e.replace(i[0],c),f?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++a>=s.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=uQ({},o);function s(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,a)).match(/'/g),s=i.match(/"/g);(o&&o.length%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{a=JSON.parse(i),t&&(a=uQ(uQ({},t),a))}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 a.defaultValue,e}for(a.applyPostProcessor=!1,delete a.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(s.call(this,n[1].trim(),a),a))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=RJ(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,uQ(uQ({},o),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function fQ(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 hQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fQ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fQ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pQ(e){var t={};return function(n,r,i){var o=r+JSON.stringify(i),a=t[o];return a||(a=e(r,i),t[o]=a),a(n)}}var mQ=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};lJ(this,e),this.logger=TJ.create("formatter"),this.options=t,this.formats={number:pQ((function(e,t){var n=new Intl.NumberFormat(e,t);return function(e){return n.format(e)}})),currency:pQ((function(e,t){var n=new Intl.NumberFormat(e,hQ(hQ({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:pQ((function(e,t){var n=new Intl.DateTimeFormat(e,hQ({},t));return function(e){return n.format(e)}})),relativetime:pQ((function(e,t){var n=new Intl.RelativeTimeFormat(e,hQ({},t));return function(e){return n.format(e,t.range||"day")}})),list:pQ((function(e,t){var n=new Intl.ListFormat(e,hQ({},t));return function(e){return n.format(e)}}))},this.init(t)}return fJ(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()]=pQ(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=_J(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),a=o.formatName,s=o.formatOptions;if(i.formats[a]){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[a](e,u,hQ(hQ(hQ({},s),r),c))}catch(e){i.logger.warn(e)}return l}return i.logger.warn("there was no format function for ".concat(a)),e}),e);return o}}]),e}();function gQ(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 vQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gQ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gQ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function yQ(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=vJ(e);if(t){var i=vJ(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gJ(this,n)}}var bQ=function(e){mJ(n,e);var t=yQ(n);function n(e,r,i){var o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return lJ(this,n),o=t.call(this),HJ&&IJ.call(hJ(o)),o.backend=e,o.store=r,o.services=i,o.languageUtils=i.languageUtils,o.options=a,o.logger=TJ.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,a.backend,a),o}return fJ(n,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},a={},s={},l={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var s="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[s]=2:i.state[s]<0||(1===i.state[s]?void 0===a[s]&&(a[s]=!0):(i.state[s]=1,r=!1,void 0===a[s]&&(a[s]=!0),void 0===o[s]&&(o[s]=!0),void 0===l[t]&&(l[t]=!0)))})),r||(s[e]=!0)})),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),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 a={};this.queue.forEach((function(n){var r,s,l,c,u,d;r=n.loaded,s=o,c=NJ(r,[i],Object),u=c.obj,d=c.k,u[d]=u[d]||[],l&&(u[d]=u[d].concat(s)),l||u[d].push(s),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){a[e]||(a[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===a[e][t]&&(a[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",a),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,a=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:a}):(this.readingCalls++,this.backend[n](e,t,(function(s,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)}s&&l&&i<r.maxRetries?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,a)}),o):a(s,l)}))):a(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,a){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&a&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),a),t.loaded(e,r,a)}))}},{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,vQ(vQ({},o),{},{isUpdate:i})),e&&e[0]&&this.store.addResource(e[0],t,n,r))}}]),n}(IJ);function wQ(){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"===sJ(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===sJ(e[2])||"object"===sJ(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 xQ(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 SQ(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 MQ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?SQ(Object(n),!0).forEach((function(t){yJ(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SQ(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _Q(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=vJ(e);if(t){var i=vJ(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return gJ(this,n)}}function AQ(){}function EQ(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var CQ=function(e){mJ(n,e);var t=_Q(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(lJ(this,n),e=t.call(this),HJ&&IJ.call(hJ(e)),e.options=xQ(r),e.services={},e.logger=TJ,e.modules={external:[]},EQ(hJ(e)),i&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,i),gJ(e,hJ(e));setTimeout((function(){e.init(r,i)}),0)}return e}return fJ(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=wQ();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=MQ(MQ(MQ({},r),this.options),xQ(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=MQ(MQ({},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?TJ.init(i(this.modules.logger),this.options):TJ.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=mQ);var a=new nQ(this.options);this.store=new YJ(this.options.resources,this.options);var s=this.services;s.logger=TJ,s.resourceStore=this.store,s.languageUtils=a,s.pluralResolver=new lQ(a,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(s.formatter=i(o),s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new dQ(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new bQ(i(this.modules.backend),s.resourceStore,s,this.options),s.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&&(s.languageDetector=i(this.modules.languageDetector),s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=i(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new eQ(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=AQ),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=OJ(),f=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?f():setTimeout(f,0),d}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:AQ,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=[],a=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){o.indexOf(e)<0&&o.push(e)}))};if(i)a(i);else{var s=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);s.forEach((function(e){return a(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return a(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=OJ();return e||(e=this.languages),t||(t=this.options.ns),n||(n=AQ),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&&JJ.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=OJ();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 a="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);a&&(n.language||i(a),n.translator.language||n.translator.changeLanguage(a),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(a)),n.loadResources(a,(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,a)}))};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"!==sJ(i)){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l<a;l++)s[l-2]=arguments[l];o=r.options.overloadTranslationOptionHandler([t,i].concat(s))}else o=MQ({},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 a=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var s=n.precheck(this,a);if(void 0!==s)return s}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!a(r,e)||i&&!a(o,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=OJ();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=OJ();"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]:AQ,i=MQ(MQ(MQ({},this.options),t),{isClone:!0}),o=new n(i);void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t));var a=["store","services","language"];return a.forEach((function(t){o[t]=e[t]})),o.services=MQ({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new eQ(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}(IJ);yJ(CQ,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new CQ(e,t)}));var kQ=CQ.createInstance();kQ.createInstance=CQ.createInstance;kQ.createInstance,kQ.init,kQ.loadResources,kQ.reloadResources,kQ.use,kQ.changeLanguage,kQ.getFixedT,kQ.t,kQ.exists,kQ.setDefaultNamespace,kQ.hasLoadedNamespace,kQ.loadNamespaces,kQ.loadLanguages;var TQ,IQ=kQ;TQ=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","fullscreenEnter":"Passa a schermo intero","fullscreenExit":"Esci da schermo intero","center":"Centro","bottom":"In basso","hidden":"Nascosto","day":"Giorno","month":"Mese","year":"Anno","copy":"Copia","copyToClipboard":"Copia negli appunti","showOriginalText":"Mostra originale","showTranslatedText":"Mostra traduzione","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","completionsEnabled":"IA evoluta, può rispondere con risposte generate automaticamente che talvolta potrebbero contenere informazioni non corrette","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","auth":{"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":"Posizione","settings":"Impostazioni","share":"Condividi","sendOnKeypress":"Premi Invio per inviare","sendOnClick":"Clicca sul bottone di invio","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!","requirePosition":"Inserisci la posizione prima di iniziare","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"},"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","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_CANT_EDIT_INTEGRATIONS":"Utente non abilitato a gestire integrazioni","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","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_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","INTEGRATION_NOT_FOUND":"Integrazione non trovata","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","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"}}');const OQ={en:{translation:r(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","fullscreenEnter":"Enter fullscreen","fullscreenExit":"Exit fullscreen","center":"Center","bottom":"Bottom","hidden":"Hidden","day":"Day","month":"Month","year":"Year","copy":"Copy","copyToClipboard":"Copy to clipboard","showOriginalText":"Show original","showTranslatedText":"Show translation","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","completionsEnabled":"Advanced AI, can respond with automatically generated answers that may sometimes contain incorrect information","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","auth":{"useRecoveryTokens":"Use recovery tokens","tokens":"Tokens","addToken":"Add token","usePassword":"Use password","atLeast":"At least"},"widget":{"instruct":"Instruct","test":"Test","sound":"Sound","position":"Position","settings":"Settings","share":"Share","sendOnKeypress":"Hit Enter to send","sendOnClick":"Click on Submit","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","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"},"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","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_CANT_EDIT_INTEGRATIONS":"User not allowed to manage integrations","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","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_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","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"}}'))},it:{translation:r(TQ)}};IQ.use(ye).init({resources:OQ,lng:"en",fallbackLng:"it",supportedLngs:["en","it"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1}});var RQ=IQ;const PQ=({ownerUserName:e,ownerUserID:t,memoriName:n,memoriID:r,integrationID:i,tenantID:o,secretToken:a,sessionID:l,layout:c="DEFAULT",customLayout:d,showShare:f=!0,showSettings:h=!0,showInstruct:p=!1,height:m="100%",baseURL:g,apiURL:v="https://backend.memori.ai",tag:y,pin:b,context:w,initialQuestion:x,uiLang:S,spokenLang:M,multilingual:_,authToken:A,AZURE_COGNITIVE_SERVICES_TTS_KEY:E,onStateChange:C})=>{var k,T,I;const[O,R]=(0,u.useState)(),[P,N]=(0,u.useState)(E),{t:L}=Te();if(!(r&&t||n&&e))throw new Error("Identifier pair required: please provide either memoriID and ownerUserID or memoriName and ownerUserName");const D=W(v),B=(0,u.useCallback)((async()=>{const e=g||(o.startsWith("https://")?o:`https://${o}`),t=await fetch(`${e}/api/speechkey`),n=await t.json();n.AZURE_COGNITIVE_SERVICES_TTS_KEY&&N(n.AZURE_COGNITIVE_SERVICES_TTS_KEY)}),[]);(0,u.useEffect)((()=>{E||B()}),[E]);const j=(0,u.useCallback)((async()=>{if(r&&t){const{memori:e,...n}=await D.backend.getMemoriByUserAndId(o,t,r);0===n.resultCode&&e?R(e):console.error("[MEMORI]",n,e)}else if(n&&e){const{memori:t,...r}=await D.backend.getMemori(o,e,n);0===r.resultCode&&t?R(t):console.error("[MEMORI]",r,t)}}),[r,t,n,e,o]);return(0,u.useEffect)((()=>{j()}),[j,o]),(0,u.useEffect)((()=>{if(S)RQ.changeLanguage(S.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"}})();RQ.changeLanguage(e).catch((()=>{RQ.changeLanguage(t)}))}}),[S]),O?(0,s.jsx)(aJ,{layout:c,customLayout:d,height:m,baseUrl:g||(o.startsWith("https://")?o:`https://${o}`),apiUrl:v,memori:{...O,secretToken:a},memoriLang:null!=M?M:null===(T=null===(k=O.culture)||void 0===k?void 0:k.split("-"))||void 0===T?void 0:T[0],multilingual:_,tenant:{id:o,theme:"twincreator",config:{name:o,showNewUser:!1,requirePosition:!!O.needsPosition}},secret:a,sessionID:l,showShare:f,showSettings:h,showInstruct:p,integration:null===(I=null==O?void 0:O.integrations)||void 0===I?void 0:I.find((e=>i?e.integrationID===i:!!e.publish&&"LANDING_EXPERIENCE"===e.type)),initialContextVars:w,initialQuestion:x,authToken:A,AZURE_COGNITIVE_SERVICES_TTS_KEY:P||E,onStateChange:C,...y&&b?{personification:{tag:y,pin:b}}:{}}):(0,s.jsx)("div",{children:(0,s.jsxs)("p",{style:{textAlign:"center",margin:"2rem auto"},children:[L("loading"),"..."]})})};PQ.propTypes={memoriName:r(l).string,memoriID:r(l).string,ownerUserName:r(l).string,ownerUserID:r(l).string,integrationID:r(l).string,tenantID:r(l).string.isRequired,secretToken:r(l).string,sessionID:r(l).string,showShare:r(l).bool,showSettings:r(l).bool,showInstruct:r(l).bool,layout:r(l).oneOf(["DEFAULT","FULLPAGE","TOTEM"]),height:r(l).oneOfType([r(l).string,r(l).number]),baseURL:r(l).string,apiURL:r(l).string,tag:r(l).string,pin:r(l).string,context:r(l).objectOf(r(l).any),initialQuestion:r(l).string,uiLang:r(l).oneOf(["en","it"]),spokenLang:r(l).string,authToken:r(l).string,AZURE_COGNITIVE_SERVICES_TTS_KEY:r(l).string,onStateChange:r(l).func};var NQ=PQ;class LQ extends HTMLElement{connectedCallback(){const e=document.createElement("div"),t=document.createElement("div");t.setAttribute("id","memori-root"),e.appendChild(t),this.appendChild(e);const n=Object.keys(NQ.propTypes).reduce(((e,t)=>(this.hasAttribute(t)&&(e[t]=this.getAttribute(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}}),{});i?r(c).render((0,s.jsx)(NQ,{...n,context:o,tenantID:i}),t):console.error("No tenantId attribute found")}}customElements.define("memori-client",LQ)})();