PageSourceSearch

https://jetpack.com/_static/??-eJyNj0sOwjAMRC9EMD9BWSCOgkxqFZfEiWq…/DHscUlEK99mvs+b2cTffNNtVM98sm/4Ke+qOhQ==

js jetpack.com collected 2026-09-24 06:57:08 UTC 566,128 bytes, 860 lines download raw bytes

1(()=>{"use strict";function t(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var r,n,i,s,a,o,u,l,c,f,h,p,d,g,_,m,v,y={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},x={duration:.5,overwrite:!1,delay:0},b=1e8,w=1e-8,T=2*Math.PI,k=T/4,M=0,O=Math.sqrt,C=Math.cos,E=Math.sin,A=function(t){return"string"==typeof t},S=function(t){return"function"==typeof t},P=function(t){return"number"==typeof t},D=function(t){return void 0===t},R=function(t){return"object"==typeof t},z=function(t){return!1!==t},F=function(){return"undefined"!=typeof window},I=function(t){return S(t)||A(t)},Y="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},B=Array.isArray,L=/random\([^)]+\)/g,N=/,\s*/g,X=/(?:-?\.?\d|\.)+/gi,q=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,U=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,j=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,H=/[+-]=-?[.\d]+/,W=/[^,'"\[\]\s]+/gi,V=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,G={},Q={},Z=function(t){return(Q=Ot(t,G))&&Mr},$=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},K=function(t,e){return!e&&console.warn(t)},J=function(t,e){return t&&(G[t]=e)&&Q&&(Q[t]=e)||G},tt=function(){return 0},et={suppressEvents:!0,isStart:!0,kill:!1},rt={suppressEvents:!0,kill:!1},nt={suppressEvents:!0},it={},st=[],at={},ot={},ut={},lt=30,ct=[],ft="",ht=function(t){var e,r,n=t[0];if(R(n)||S(n)||(t=[t]),!(e=(n._gsap||{}).harness)){for(r=ct.length;r--&&!ct[r].targetTest(n););e=ct[r]}for(r=t.length;r--;)t[r]&&(t[r]._gsap||(t[r]._gsap=new Le(t[r],e)))||t.splice(r,1);return t},pt=function(t){return t._gsap||ht(ne(t))[0]._gsap},dt=function(t,e,r){return(r=t[e])&&S(r)?t[e]():D(r)&&t.getAttribute&&t.getAttribute(e)||r},gt=function(t,e){return(t=t.split(",")).forEach(e)||t},_t=function(t){return Math.round(1e5*t)/1e5||0},mt=function(t){return Math.round(1e7*t)/1e7||0},vt=function(t,e){var r=e.charAt(0),n=parseFloat(e.substr(2));return t=parseFloat(t),"+"===r?t+n:"-"===r?t-n:"*"===r?t*n:t/n},yt=function(t,e){for(var r=e.length,n=0;t.indexOf(e[n])<0&&++n<r;);return n<r},xt=function(){var t,e,r=st.length,n=st.slice(0);for(at={},st.length=0,t=0;t<r;t++)(e=n[t])&&e._lazy&&(e.render(e._lazy[0],e._lazy[1],!0)._lazy=0)},bt=function(t){return!!(t._initted||t._startAt||t.add)},wt=function(t,e,r,i){st.length&&!n&&xt(),t.render(e,r,i||!!(n&&e<0&&bt(t))),st.length&&!n&&xt()},Tt=function(t){var e=parseFloat(t);return(e||0===e)&&(t+"").match(W).length<2?e:A(t)?t.trim():t},kt=function(t){return t},Mt=function(t,e){for(var r in e)r in t||(t[r]=e[r]);return t},Ot=function(t,e){for(var r in e)t[r]=e[r];return t},Ct=function t(e,r){for(var n in r)"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(e[n]=R(r[n])?t(e[n]||(e[n]={}),r[n]):r[n]);return e},Et=function(t,e){var r,n={};for(r in t)r in e||(n[r]=t[r]);return n},At=function(t){var e,r=t.parent||s,n=t.keyframes?(e=B(t.keyframes),function(t,r){for(var n in r)n in t||"duration"===n&&e||"ease"===n||(t[n]=r[n])}):Mt;if(z(t.inherit))for(;r;)n(t,r.vars.defaults),r=r.parent||r._dp;return t},St=function(t,e,r,n,i){void 0===r&&(r="_first"),void 0===n&&(n="_last");var s,a=t[n];if(i)for(s=e[i];a&&a[i]>s;)a=a._prev;return a?(e._next=a._next,a._next=e):(e._next=t[r],t[r]=e),e._next?e._next._prev=e:t[n]=e,e._prev=a,e.parent=e._dp=t,e},Pt=function(t,e,r,n){void 0===r&&(r="_first"),void 0===n&&(n="_last");var i=e._prev,s=e._next;i?i._next=s:t[r]===e&&(t[r]=s),s?s._prev=i:t[n]===e&&(t[n]=i),e._next=e._prev=e.parent=null},Dt=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Rt=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var r=t;r;)r._dirty=1,r=r.parent;return t},zt=function(t,e,r,i){return t._startAt&&(n?t._startAt.revert(rt):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))},Ft=function t(e){return!e||e._ts&&t(e.parent)},It=function(t){return t._repeat?Yt(t._tTime,t=t.duration()+t._rDelay)*t:0},Yt=function(t,e){var r=Math.floor(t=mt(t/e));return t&&r===t?r-1:r},Bt=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},Lt=function(t){return t._end=mt(t._start+(t._tDur/Math.abs(t._ts||t._rts||w)||0))},Nt=function(t,e){var r=t._dp;return r&&r.smoothChildTiming&&t._ts&&(t._start=mt(r._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),Lt(t),r._dirty||Rt(r,t)),t},Xt=function(t,e){var r;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(r=Bt(t.rawTime(),e),(!e._dur||Jt(0,e.totalDuration(),r)-e._tTime>w)&&e.render(r,!0)),Rt(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(r=t;r._dp;)r.rawTime()>=0&&r.totalTime(r._tTime),r=r._dp;t._zTime=-1e-8}},qt=function(t,e,r,n){return e.parent&&Dt(e),e._start=mt((P(r)?r:r||t!==s?Zt(t,r,e):t._time)+e._delay),e._end=mt(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),St(t,e,"_first","_last",t._sort?"_start":0),Wt(e)||(t._recent=e),n||Xt(t,e),t._ts<0&&Nt(t,t._tTime),t},Ut=function(t,e){return(G.ScrollTrigger||$("scrollTrigger",e))&&G.ScrollTrigger.create(e,t)},jt=function(t,e,r,i,s){return Ve(t,e,s),t._initted?!r&&t._pt&&!n&&(t._dur&&!1!==t.vars.lazy||!t._dur&&t.vars.lazy)&&c!==Ce.frame?(st.push(t),t._lazy=[s,i],1):void 0:1},Ht=function t(e){var r=e.parent;return r&&r._ts&&r._initted&&!r._lock&&(r.rawTime()<0||t(r))},Wt=function(t){var e=t.data;return"isFromStart"===e||"isStart"===e},Vt=function(t,e,r,n){var i=t._repeat,s=mt(e)||0,a=t._tTime/t._tDur;return a&&!n&&(t._time*=s/t._dur),t._dur=s,t._tDur=i?i<0?1e10:mt(s*(i+1)+t._rDelay*i):s,a>0&&!n&&Nt(t,t._tTime=t._tDur*a),t.parent&&Lt(t),r||Rt(t.parent,t),t},Gt=function(t){return t instanceof Xe?Rt(t):Vt(t,t._dur)},Qt={_start:0,endTime:tt,totalDuration:tt},Zt=function t(e,r,n){var i,s,a,o=e.labels,u=e._recent||Qt,l=e.duration()>=b?u.endTime(!1):e._dur;return A(r)&&(isNaN(r)||r in o)?(s=r.charAt(0),a="%"===r.substr(-1),i=r.indexOf("="),"<"===s||">"===s?(i>=0&&(r=r.replace(/=/,"")),("<"===s?u._start:u.endTime(u._repeat>=0))+(parseFloat(r.substr(1))||0)*(a?(i<0?u:n).totalDuration()/100:1)):i<0?(r in o||(o[r]=l),o[r]):(s=parseFloat(r.charAt(i-1)+r.substr(i+1)),a&&n&&(s=s/100*(B(n)?n[0]:n).totalDuration()),i>1?t(e,r.substr(0,i-1),n)+s:l+s)):null==r?l:+r},$t=function(t,e,r){var n,i,s=P(e[1]),a=(s?2:1)+(t<2?0:1),o=e[a];if(s&&(o.duration=e[1]),o.parent=r,t){for(n=o,i=r;i&&!("immediateRender"in n);)n=i.vars.defaults||{},i=z(i.vars.inherit)&&i.parent;o.immediateRender=z(n.immediateRender),t<2?o.runBackwards=1:o.startAt=e[a-1]}return new Ke(e[0],o,e[a+1])},Kt=function(t,e){return t||0===t?e(t):e},Jt=function(t,e,r){return r<t?t:r>e?e:r},te=function(t,e){return A(t)&&(e=V.exec(t))?e[1]:""},ee=[].slice,re=function(t,e){return t&&R(t)&&"length"in t&&(!e&&!t.length||t.length-1 
1in t&&R(t[0]))&&!t.nodeType&&t!==a},ne=function(t,e,r){return i&&!e&&i.selector?i.selector(t):!A(t)||r||!o&&Ee()?B(t)?function(t,e,r){return void 0===r&&(r=[]),t.forEach(function(t){var n;return A(t)&&!e||re(t,1)?(n=r).push.apply(n,ne(t)):r.push(t)})||r}(t,r):re(t)?ee.call(t,0):t?[t]:[]:ee.call((e||u).querySelectorAll(t),0)},ie=function(t){return t=ne(t)[0]||K("Invalid scope")||{},function(e){var r=t.current||t.nativeElement||t;return ne(e,r.querySelectorAll?r:r===t?K("Invalid scope")||u.createElement("div"):t)}},se=function(t){return t.sort(function(){return.5-Math.random()})},ae=function(t){if(S(t))return t;var e=R(t)?t:{each:t},r=ze(e.ease),n=e.from||0,i=parseFloat(e.base)||0,s={},a=n>0&&n<1,o=isNaN(n)||a,u=e.axis,l=n,c=n;return A(n)?l=c={center:.5,edges:.5,end:1}[n]||0:!a&&o&&(l=n[0],c=n[1]),function(t,a,f){var h,p,d,g,_,m,v,y,x,w=(f||e).length,T=s[w];if(!T){if(!(x="auto"===e.grid?0:(e.grid||[1,b])[1])){for(v=-b;v<(v=f[x++].getBoundingClientRect().left)&&x<w;);x<w&&x--}for(T=s[w]=[],h=o?Math.min(x,w)*l-.5:n%x,p=x===b?0:o?w*c/x-.5:n/x|0,v=0,y=b,m=0;m<w;m++)d=m%x-h,g=p-(m/x|0),T[m]=_=u?Math.abs("y"===u?g:d):O(d*d+g*g),_>v&&(v=_),_<y&&(y=_);"random"===n&&se(T),T.max=v-y,T.min=y,T.v=w=(parseFloat(e.amount)||parseFloat(e.each)*(x>w?w-1:u?"y"===u?w/x:x:Math.max(x,w/x))||0)*("edges"===n?-1:1),T.b=w<0?i-w:i,T.u=te(e.amount||e.each)||0,r=r&&w<0?Re(r):r}return w=(T[t]-T.min)/T.max||0,mt(T.b+(r?r(w):w)*T.v)+T.u}},oe=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(r){var n=mt(Math.round(parseFloat(r)/t)*t*e);return(n-n%1)/e+(P(r)?0:te(r))}},ue=function(t,e){var r,n,i=B(t);return!i&&R(t)&&(r=i=t.radius||b,t.values?(t=ne(t.values),(n=!P(t[0]))&&(r*=r)):t=oe(t.increment)),Kt(e,i?S(t)?function(e){return n=t(e),Math.abs(n-e)<=r?n:e}:function(e){for(var i,s,a=parseFloat(n?e.x:e),o=parseFloat(n?e.y:0),u=b,l=0,c=t.length;c--;)(i=n?(i=t[c].x-a)*i+(s=t[c].y-o)*s:Math.abs(t[c]-a))<u&&(u=i,l=c);return l=!r||u<=r?t[l]:e,n||l===e||P(e)?l:l+te(e)}:oe(t))},le=function(t,e,r,n){return Kt(B(t)?!e:!0===r?!!(r=0):!n,function(){return B(t)?t[~~(Math.random()*t.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((t-r/2+Math.random()*(e-t+.99*r))/r)*r*n)/n})},ce=function(t,e,r){return Kt(r,function(r){return t[~~e(r)]})},fe=function(t){return t.replace(L,function(t){var e=t.indexOf("[")+1,r=t.substring(e||7,e?t.indexOf("]"):t.length-1).split(N);return le(e?r:+r[0],e?0:+r[1],+r[2]||1e-5)})},he=function(t,e,r,n,i){var s=e-t,a=n-r;return Kt(i,function(e){return r+((e-t)/s*a||0)})},pe=function(t,e,r){var n,i,s,a=t.labels,o=b;for(n in a)(i=a[n]-e)<0==!!r&&i&&o>(i=Math.abs(i))&&(s=n,o=i);return s},de=function(t,e,r){var n,s,a,o=t.vars,u=o[e],l=i,c=t._ctx;if(u)return n=o[e+"Params"],s=o.callbackScope||t,r&&st.length&&xt(),c&&(i=c),a=n?u.apply(s,n):u.call(s),i=l,a},ge=function(t){return Dt(t),t.scrollTrigger&&t.scrollTrigger.kill(!!n),t.progress()<1&&de(t,"onInterrupt"),t},_e=[],me=function(t){if(t)if(t=!t.name&&t.default||t,F()||t.headless){var e=t.name,r=S(t),n=e&&!r&&t.init?function(){this._props=[]}:t,i={init:tt,render:or,add:He,kill:lr,modifier:ur,rawVars:0},s={targetTest:0,get:0,getSetter:nr,aliases:{},register:0};if(Ee(),t!==n){if(ot[e])return;Mt(n,Mt(Et(t,i),s)),Ot(n.prototype,Ot(i,Et(t,s))),ot[n.prop=e]=n,t.targetTest&&(ct.push(n),it[e]=1),e=("css"===e?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}J(e,n),t.register&&t.register(Mr,n,hr)}else _e.push(t)},ve=255,ye={aqua:[0,ve,ve],lime:[0,ve,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,ve],navy:[0,0,128],white:[ve,ve,ve],olive:[128,128,0],yellow:[ve,ve,0],orange:[ve,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[ve,0,0],pink:[ve,192,203],cyan:[0,ve,ve],transparent:[ve,ve,ve,0]},xe=function(t,e,r){return(6*(t+=t<0?1:t>1?-1:0)<1?e+(r-e)*t*6:t<.5?r:3*t<2?e+(r-e)*(2/3-t)*6:e)*ve+.5|0},be=function(t,e,r){var n,i,s,a,o,u,l,c,f,h,p=t?P(t)?[t>>16,t>>8&ve,t&ve]:0:ye.black;if(!p){if(","===t.substr(-1)&&(t=t.substr(0,t.length-1)),ye[t])p=ye[t];else if("#"===t.charAt(0)){if(t.length<6&&(n=t.charAt(1),i=t.charAt(2),s=t.charAt(3),t="#"+n+n+i+i+s+s+(5===t.length?t.charAt(4)+t.charAt(4):"")),9===t.length)return[(p=parseInt(t.substr(1,6),16))>>16,p>>8&ve,p&ve,parseInt(t.substr(7),16)/255];p=[(t=parseInt(t.substr(1),16))>>16,t>>8&ve,t&ve]}else if("hsl"===t.substr(0,3))if(p=h=t.match(X),e){if(~t.indexOf("="))return p=t.match(q),r&&p.length<4&&(p[3]=1),p}else a=+p[0]%360/360,o=+p[1]/100,n=2*(u=+p[2]/100)-(i=u<=.5?u*(o+1):u+o-u*o),p.length>3&&(p[3]*=1),p[0]=xe(a+1/3,n,i),p[1]=xe(a,n,i),p[2]=xe(a-1/3,n,i);else p=t.match(X)||ye.transparent;p=p.map(Number)}
1return e&&!h&&(n=p[0]/ve,i=p[1]/ve,s=p[2]/ve,u=((l=Math.max(n,i,s))+(c=Math.min(n,i,s)))/2,l===c?a=o=0:(f=l-c,o=u>.5?f/(2-l-c):f/(l+c),a=l===n?(i-s)/f+(i<s?6:0):l===i?(s-n)/f+2:(n-i)/f+4,a*=60),p[0]=~~(a+.5),p[1]=~~(100*o+.5),p[2]=~~(100*u+.5)),r&&p.length<4&&(p[3]=1),p},we=function(t){var e=[],r=[],n=-1;return t.split(ke).forEach(function(t){var i=t.match(U)||[];e.push.apply(e,i),r.push(n+=i.length+1)}),e.c=r,e},Te=function(t,e,r){var n,i,s,a,o="",u=(t+o).match(ke),l=e?"hsla(":"rgba(",c=0;if(!u)return t;if(u=u.map(function(t){return(t=be(t,e,1))&&l+(e?t[0]+","+t[1]+"%,"+t[2]+"%,"+t[3]:t.join(","))+")"}),r&&(s=we(t),(n=r.c).join(o)!==s.c.join(o)))for(a=(i=t.replace(ke,"1").split(U)).length-1;c<a;c++)o+=i[c]+(~n.indexOf(c)?u.shift()||l+"0,0,0,0)":(s.length?s:u.length?u:r).shift());if(!i)for(a=(i=t.split(ke)).length-1;c<a;c++)o+=i[c]+u[c];return o+i[a]},ke=function(){var t,e="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(t in ye)e+="|"+t+"\\b";return new RegExp(e+")","gi")}(),Me=/hsl[a]?\(/,Oe=function(t){var e,r=t.join(" ");if(ke.lastIndex=0,ke.test(r))return e=Me.test(r),t[1]=Te(t[1],e),t[0]=Te(t[0],e,we(t[1])),!0},Ce=function(){var t,e,r,n,i,s,c=Date.now,f=500,p=33,d=c(),g=d,_=1e3/240,m=_,v=[],y=function r(a){var o,u,l,h,y=c()-g,x=!0===a;if((y>f||y<0)&&(d+=y-p),((o=(l=(g+=y)-d)-m)>0||x)&&(h=++n.frame,i=l-1e3*n.time,n.time=l/=1e3,m+=o+(o>=_?4:_-o),u=1),x||(t=e(r)),u)for(s=0;s<v.length;s++)v[s](l,i,h,a)};return n={time:0,frame:0,tick:function(){y(!0)},deltaRatio:function(t){return i/(1e3/(t||60))},wake:function(){l&&(!o&&F()&&(a=o=window,u=a.document||{},G.gsap=Mr,(a.gsapVersions||(a.gsapVersions=[])).push(Mr.version),Z(Q||a.GreenSockGlobals||!a.gsap&&a||{}),_e.forEach(me)),r="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame,t&&n.sleep(),e=r||function(t){return setTimeout(t,m-1e3*n.time+1|0)},h=1,y(2))},sleep:function(){(r?cancelAnimationFrame:clearTimeout)(t),h=0,e=tt},lagSmoothing:function(t,e){f=t||1/0,p=Math.min(e||33,f)},fps:function(t){_=1e3/(t||240),m=1e3*n.time+_},add:function(t,e,r){var i=e?function(e,r,s,a){t(e,r,s,a),n.remove(i)}:t;return n.remove(t),v[r?"unshift":"push"](i),Ee(),i},remove:function(t,e){~(e=v.indexOf(t))&&v.splice(e,1)&&s>=e&&s--},_listeners:v}}(),Ee=function(){return!h&&Ce.wake()},Ae={},Se=/^[\d.\-M][\d.\-,\s]/,Pe=/["']/g,De=function(t){for(var e,r,n,i={},s=t.substr(1,t.length-3).split(":"),a=s[0],o=1,u=s.length;o<u;o++)r=s[o],e=o!==u-1?r.lastIndexOf(","):r.length,n=r.substr(0,e),i[a]=isNaN(n)?n.replace(Pe,"").trim():+n,a=r.substr(e+1).trim();return i},Re=function(t){return function(e){return 1-t(1-e)}},ze=function(t,e){return t&&(S(t)?t:Ae[t]||function(t){var e,r,n,i,s=(t+"").split("("),a=Ae[s[0]];return a&&s.length>1&&a.config?a.config.apply(null,~t.indexOf("{")?[De(s[1])]:(e=t,r=e.indexOf("(")+1,n=e.indexOf(")"),i=e.indexOf("(",r),e.substring(r,~i&&i<n?e.indexOf(")",n+1):n)).split(",").map(Tt)):Ae._CE&&Se.test(t)?Ae._CE("",t):a}(t))||e},Fe=function(t,e,r,n){void 0===r&&(r=function(t){return 1-e(1-t)}),void 0===n&&(n=function(t){return t<.5?e(2*t)/2:1-e(2*(1-t))/2});var i,s={easeIn:e,easeOut:r,easeInOut:n};return gt(t,function(t){for(var e in Ae[t]=G[t]=s,Ae[i=t.toLowerCase()]=r,s)Ae[i+("easeIn"===e?".in":"easeOut"===e?".out":".inOut")]=Ae[t+"."+e]=s[e]}),s},Ie=function(t){return function(e){return e<.5?(1-t(1-2*e))/2:.5+t(2*(e-.5))/2}},Ye=function t(e,r,n){var i=r>=1?r:1,s=(n||(e?.3:.45))/(r<1?r:1),a=s/T*(Math.asin(1/i)||0),o=function(t){return 1===t?1:i*Math.pow(2,-10*t)*E((t-a)*s)+1},u="out"===e?o:"in"===e?function(t){return 1-o(1-t)}:Ie(o);return s=T/s,u.config=function(r,n){return t(e,r,n)},u},Be=function t(e,r){void 0===r&&(r=1.70158);var n=function(t){return t?--t*t*((r+1)*t+r)+1:0},i="out"===e?n:"in"===e?function(t){return 1-n(1-t)}:Ie(n);return i.config=function(r){return t(e,r)},i};gt("Linear,Quad,Cubic,Quart,Quint,Strong",function(t,e){var r=e<5?e+1:e;Fe(t+",Power"+(r-1),e?function(t){return Math.pow(t,r)}:function(t){return t},function(t){return 1-Math.pow(1-t,r)},function(t){return t<.5?Math.pow(2*t,r)/2:1-Math.pow(2*(1-t),r)/2})}),Ae.Linear.easeNone=Ae.none=Ae.Linear.easeIn,Fe("Elastic",Ye("in"),Ye("out"),Ye()),p=7.5625,_=2*(g=1/(d=2.75)),m=2.5*g,Fe("Bounce",function(t){return 1-v(1-t)},v=function(t){return t<g?p*t*t:t<_?p*Math.pow(t-1.5/d,2)+.75:t<m?p*(t-=2.25/d)*t+.9375:p*Math.pow(t-2.625/d,2)+.984375}),Fe("Expo",function(t){return Math.pow(2,10*(t-1))*t+t*t*t*t*t*t*(1-t)}),Fe("Circ",function(t){return-(O(1-t*t)-1)}),Fe("Sine",function(t){return 1===t?1:1-C(t*k)}),Fe("Back",Be("in"),Be("out"),Be()),Ae.SteppedEase=Ae.steps=G.SteppedEase={config:function(t,e){void 0===t&&(t=1);var r=1/t,n=t+(e?0:1),i=e?1:0;return function(t){return((n*Jt(0,.99999999,t)|0)+i)*r}}},x.ease=Ae["quad.out"],gt("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(t){return ft+=t
vendor: 28,285 bytes, line 1
1+","+t+"Params,"});var Le=function(t,e){this.id=M++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:dt,this.set=e?e.getSetter:nr},Ne=function(){function t(t){this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,Vt(this,+t.duration,1,1),this.data=t.data,i&&(this._ctx=i,i.data.push(this)),h||Ce.wake()}var e=t.prototype;return e.delay=function(t){return t||0===t?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+t-this._delay),this._delay=t,this):this._delay},e.duration=function(t){return arguments.length?this.totalDuration(this._repeat>0?t+(t+this._rDelay)*this._repeat:t):this.totalDuration()&&this._dur},e.totalDuration=function(t){return arguments.length?(this._dirty=0,Vt(this,this._repeat<0?t:(t-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(t,e){if(Ee(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(Nt(this,t),!r._dp||r.parent||Xt(r,this);r&&r.parent;)r.parent._time!==r._start+(r._ts>=0?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&t<this._tDur||this._ts<0&&t>0||!this._tDur&&!t)&&qt(this._dp,this,this._start-this._delay)}return(this._tTime!==t||!this._dur&&!e||this._initted&&Math.abs(this._zTime)===w||!this._initted&&this._dur&&t||!t&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=t),wt(this,t,e)),this},e.time=function(t,e){return arguments.length?this.totalTime(Math.min(this.totalDuration(),t+It(this))%(this._dur+this._rDelay)||(t?this._dur:0),e):this._time},e.totalProgress=function(t,e){return arguments.length?this.totalTime(this.totalDuration()*t,e):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},e.progress=function(t,e){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?t:1-t)+It(this),e):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(t,e){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(t-1)*r,e):this._repeat?Yt(this._tTime,r)+1:1},e.timeScale=function(t,e){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===t)return this;var r=this.parent&&this._ts?Bt(this.parent._time,this):this._tTime;return this._rts=+t||0,this._ts=this._ps||-1e-8===t?0:this._rts,this.totalTime(Jt(-Math.abs(this._delay),this.totalDuration(),r),!1!==e),Lt(this),function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t}(this)},e.paused=function(t){return arguments.length?(this._ps!==t&&(this._ps=t,t?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Ee(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==w&&(this._tTime-=w)))),this):this._ps},e.startTime=function(t){if(arguments.length){this._start=mt(t);var e=this.parent||this._dp;return e&&(e._sort||!this.parent)&&qt(e,this,this._start-this._delay),this}return this._start},e.endTime=function(t){return this._start+(z(t)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(t){var e=this.parent||this._dp;return e?t&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?Bt(e.rawTime(t),this):this._tTime:this._tTime},e.revert=function(t){void 0===t&&(t=nt);var e=n;return n=t,bt(this)&&(this.timeline&&this.timeline.revert(t),this.totalTime(-.01,t.suppressEvents)),"nested"!==this.data&&!1!==t.kill&&this.kill(),n=e,this},e.globalTime=function(t){for(var e=this,r=arguments.length?t:e.rawTime();e;)r=e._start+r/(Math.abs(e._ts)||1),e=e._dp;return!this.parent&&this._sat?this._sat.globalTime(t):r},e.repeat=function(t){return arguments.length?(this._repeat=t===1/0?-2:t,Gt(this)):-2===this._repeat?1/0:this._repeat},e.repeatDelay=function(t){if(arguments.length){var e=this._time;return this._rDelay=t,Gt(this),e?this.time(e):this}return this._rDelay},e.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},e.seek=function(t,e){return this.totalTime(Zt(this,t),z(e))},e.restart=function(t,e){return this.play().totalTime(t?-this._delay:0,z(e)),this._dur||(this._zTime=-1e-8),this},e.play=function(t,e){return null!=t&&this.seek(t,e),this.reversed(!1).paused(!1)},e.reverse=function(t,e){return null!=t&&this.seek(t||this.totalDuration(),e),this.reversed(!0).paused(!1)},e.pause=function(t,e){return null!=t&&this.seek(t,e),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(t){return arguments.length?(!!t!==this.reversed()&&this.timeScale(-this._rts||(t?-1e-8:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},e.isActive=function(){var t,e=this.parent||this._dp,r=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(t=e.rawTime(!0))>=r&&t<this.endTime(!0)-w))},e.eventCallback=function(t,e,r){var n=this.vars;return arguments.length>1?(e?(n[t]=e,r&&(n[t+"Params"]=r),"onUpdate"===t&&(this._onUpdate=e)):delete n[t],this):n[t]},e.then=function(t){var e=this,r=e._prom;return new Promise(function(n){var i=S(t)?t:kt,s=function(){var t=e.then;e.then=null,r&&r(),S(i)&&(i=i(e))&&(i.then||i===e)&&(e.then=t),n(i),e.then=t};e._initted&&1===e.totalProgress()&&e._ts>=0||!e._tTime&&e._ts<0?s():e._prom=s})},e.kill=function(){ge(this)},t}();Mt(Ne.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-1e-8,_prom:0,_ps:!1,_rts:1});var Xe=function(r){function i(e,n){var i;return void 0===e&&(e={}),(i=r.call(this,e)||this).labels={},i.smoothChildTiming=!!e.smoothChildTiming,i.autoRemoveChildren=!!e.autoRemoveChildren,i._sort=z(e.sortChildren),s&&qt(e.parent||s,t(i),n),e.reversed&&i.reverse(),e.paused&&i.paused(!0),e.scrollTrigger&&Ut(t(i),e.scrollTrigger),i}e(i,r);var a=i.prototype;return a.to=function(t,e,r){return $t(0,arguments,this),this},a.from=function(t,e,r){return $t(1,arguments,this),this},a.fromTo=function(t,e,r,n){return $t(2,arguments,this),this},a.set=function(t,e,r){return e.duration=0,e.parent=this,At(e).repeatDelay||(e.repeat=0),e.immediateRender=!!e.immediateRender,new Ke(t,e,Zt(this,r),1),this},a.call=function(t,e,r){return qt(this,Ke.delayedCall(0,t,e),r)},a.staggerTo=function(t,e,r,n,i,s,a){return r.duration=e,r.stagger=r.stagger||n,r.onComplete=s,r.onCompleteParams=a,r.parent=this,new Ke(t,r,Zt(this,i)),this},a.staggerFrom=function(t,e,r,n,i,s,a){return r.runBackwards=1,At(r).immediateRender=z(r.immediateRender),this.staggerTo(t,e,r,n,i,s,a)},a.staggerFromTo=function(t,e,r,n,i,s,a,o){return n.startAt=r,At(n).immediateRender=z(n.immediateRender),this.staggerTo(t,e,n,i,s,a,o)},a.render=function(t,e,r){var i,a,o,u,l,c,f,h,p,d,g,_,m=this._time,v=this._dirty?this.totalDuration():this._tDur,y=this._dur,x=t<=0?0:mt(t),b=this._zTime<0!=t<0&&(this._initted||!y);if(this!==s&&x>v&&t>=0&&(x=v),x!==this._tTime||r||b){if(m!==this._time&&y&&(x+=this._time-m,t+=this._time-m),i=x,p=this._start,c=!(h=this._ts),b&&(y||(m=this._zTime),(t||!e)&&(this._zTime=t)),this._repeat){if(g=this._yoyo,l=y+this._rDelay,this._repeat<-1&&t<0)return this.totalTime(100*l+t,e,r);if(i=mt(x%l),x===v?(u=this._repeat,i=y):((u=~~(d=mt(x/l)))&&u===d&&(i=y,u--),i>y&&(i=y)),d=Yt(this._tTime,l),!m&&this._tTime&&d!==u&&this._tTime-d*l-this._dur<=0&&(d=u),g&&1&u&&(i=y-i,_=1),u!==d&&!this._lock){var T=g&&1&d,k=T===(g&&1&u);if(u<d&&(T=!T),m=T?0:x%y?y:x,this._lock=1,this.render(m||(_?0:mt(u*l)),e,!y)._lock=0,this._tTime=x,!e&&this.parent&&de(this,"onRepeat"),this.vars.repeatRefresh&&!_&&(this.invalidate()._lock=1,d=u),m&&m!==this._time||c!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(y=this._dur,v=this._tDur,k&&(this._lock=2,m=T?y:-1e-4,this.render(m,!0),this.vars.repeatRefresh&&!_&&this.invalidate()),this._lock=0,!this._ts&&!c)return this}}if(this._hasPause&&!this._forcing&&this._lock<2&&(f=function(t,e,r){var n;if(r>e)for(n=t._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>e)return n;n=n._next}else for(n=t._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<e)return n;n=n._prev}}(this,mt(m),mt(i)),f&&(x-=i-(i=f._start))),this._tTime=x,this._time=i,this._act=!!h,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=t,m=0),!m&&x&&y&&!e&&!d&&(de(this,"onStart"),this._tTime!==x))return this;if(i>=m&&t>=0)for(a=this._first;a;){if(o=a._next,(a._act||i>=a._start)&&a._ts&&f!==a){if(a.parent!==this)return this.render(t,e,r);if(a.render(a._ts>0?(i-a._start)*a._ts:(a._dirty?a.totalDuration():a._tDur)+(i-a._start)*a._ts,e,r),i!==this._time||!this._ts&&!c){f=0,o&&(x+=this._zTime=-1e-8);break}}a=o}else{a=this._last;for(var M=t<0?t:i;a;){if(o=a._prev,(a._act||M<=a._end)&&a._ts&&f!==a){if(a.parent!==this)return this.render(t,e,r);if(a.render(a._ts>0?(M-a._start)*a._ts:(a._dirty?a.totalDuration():a._tDur)+(M-a._start)*a._ts,e,r||n&&bt(a)),i!==this._time||!this._ts&&!c){f=0,o&&(x+=this._zTime=M?-1e-8:w);break}}a=o}}if(f&&!e&&(this.pause(),f.render(i>=m?0:-1e-8)._zTime=i>=m?1:-1,this._ts))return this._start=p,Lt(this),this.render(t,e,r);this._onUpdate&&!e&&de(this,"onUpdate",!0),(x===v&&this._tTime>=this.totalDuration()||!x&&m)&&(p!==this._start&&Math.abs(h)===Math.abs(this._ts)||this._lock||((t||!y)&&(x===v&&this._ts>0||!x&&this._ts<0)&&Dt(this,1),e||t<0&&!m||!x&&!m&&v||(de(this,x===v&&t>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(x<v&&this.timeScale()>0)&&this._prom())))}return this},a.add=function(t,e){var r=this;if(P(e)||(e=Zt(this,e,t)),!(t instanceof Ne)){if(B(t))return t.forEach(function(t){return r.add(t,e)}),this;if(A(t))return this.addLabel(t,e);if(!S(t))return this;t=Ke.delayedCall(0,t)}return this!==t?qt(this,t,e):this},a.getChildren=function(t,e,r,n){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===r&&(r=!0),void 0===n&&(n=-b);for(var i=[],s=this._first;s;)s._start>=n&&(s instanceof Ke?e&&i.push(s):(r&&i.push(s),t&&i.push.apply(i,s.getChildren(!0,e,r)))),s=s._next;return i},a.getById=function(t){for(var e=this.getChildren(1,1,1),r=e.length;r--;)if(e[r].vars.id===t)return e[r]},a.remove=function(t){return A(t)?this.removeLabel(t):S(t)?this.killTweensOf(t):(t.parent===this&&Pt(this,t),t===this._recent&&(this._recent=this._last),Rt(this))},a.totalTime=function(t,e){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=mt(Ce.time-(this._ts>0?t/this._ts:(this.totalDuration()-t)/-this._ts))),r.prototype.totalTime.call(this,t,e),this._forcing=0,this):this._tTime},a.addLabel=function(t,e){return this.labels[t]=Zt(this,e),this},a.removeLabel=function(t){return delete this.labels[t],this},a.addPause=function(t,e,r){var n=Ke.delayedCall(0,e||tt,r);return n.data="isPause",this._hasPause=1,qt(this,n,Zt(this,t))},a.removePause=function(t){var e=this._first;for(t=Zt(this,t);e;)e._start===t&&"isPause"===e.data&&Dt(e),e=e._next},a.killTweensOf=function(t,e,r){for(var n=this.getTweensOf(t,r),i=n.length;i--;)qe!==n[i]&&n[i].kill(t,e);return this},a.getTweensOf=function(t,e){for(var r,n=[],i=ne(t),s=this._first,a=P(e);s;)s instanceof Ke?yt(s._targets,i)&&(a?(!qe||s._initted&&s._ts)&&s.globalTime(0)<=e&&s.globalTime(s.totalDuration())>e:!e||s.isActive())&&n.push(s):(r=s.getTweensOf(i,e)).length&&n.push.apply(n,r),s=s._next;return n},a.tweenTo=function(t,e){e=e||{};var r,n=this,i=Zt(n,t),s=e,a=s.startAt,o=s.onStart,u=s.onStartParams,l=s.immediateRender,c=Ke.to(n,Mt({ease:e.ease||"none",lazy:!1,immediateRender:!1,time:i,overwrite:"auto",duration:e.duration||Math.abs((i-(a&&"time"in a?a.time:n._time))/n.timeScale())||w,onStart:function(){if(n.pause(),!r){var t=e.duration||Math.abs((i-(a&&"time"in a?a.time:n._time))/n.timeScale());c._dur!==t&&Vt(c,t,0,1).render(c._time,!0,!0),r=1}o&&o.apply(c,u||[])}},e));return l?c.render(0):c},a.tweenFromTo=function(t,e,r){return this.tweenTo(e,Mt({startAt:{time:Zt(this,t)}},r))},a.recent=function(){return this._recent},a.nextLabel=function(t){return void 0===t&&(t=this._time),pe(this,Zt(this,t))},a.previousLabel=function(t){return void 0===t&&(t=this._time),pe(this,Zt(this,t),1)},a.currentLabel=function(t){return arguments.length?this.seek(t,!0):this.previousLabel(this._time+w)},a.shiftChildren=function(t,e,r){void 0===r&&(r=0);var n,i=this._first,s=this.labels;for(t=mt(t);i;)i._start>=r&&(i._start+=t,i._end+=t),i=i._next;if(e)for(n in s)s[n]>=r&&(s[n]+=t);return Rt(this)},a.invalidate=function(t){var e=this._first;for(this._lock=0;e;)e.invalidate(t),e=e._next;return r.prototype.invalidate.call(this,t)},a.clear=function(t){void 0===t&&(t=!0);for(var e,r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),Rt(this)},a.totalDuration=function(t){var e,r,n,i=0,a=this,o=a._last,u=b;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-t:t));if(a._dirty){for(n=a.parent;o;)e=o._prev,o._dirty&&o.totalDuration(),(r=o._start)>u&&a._sort&&o._ts&&!a._lock?(a._lock=1,qt(a,o,r-o._delay,1)._lock=0):u=r,r<0&&o._ts&&(i-=r,(!n&&!a._dp||n&&n.smoothChildTiming)&&(a._start+=mt(r/a._ts),a._time-=r,a._tTime-=r),a.shiftChildren(-r,!1,-1/0),u=0),o._end>i&&o._ts&&(i=o._end),o=e;Vt(a,a===s&&a._time>i?a._time:i,1,1),a._dirty=0}return a._tDur},i.updateRoot=function(t){if(s._ts&&(wt(s,Bt(t,s)),c=Ce.frame),Ce.frame>=lt){lt+=y.autoSleep||120;var e=s._first;if((!e||!e._ts)&&y.autoSleep&&Ce._listeners.length<2){for(;e&&!e._ts;)e=e._next;e||Ce.sleep()}}},i}(Ne);Mt(Xe.prototype,{_lock:0,_hasPause:0,_forcing:0});var qe,Ue,je=function(t,e,r,n,i,s,a){var o,u,l,c,f,h,p,d,g=new hr(this._pt,t,e,0,1,ar,null,i),_=0,m=0;for(g.b=r,g.e=n,r+="",(p=~(n+="").indexOf("random("))&&(n=fe(n)),s&&(s(d=[r,n],t,e),r=d[0],n=d[1]),u=r.match(j)||[];o=j.exec(n);)c=o[0],f=n.substring(_,o.index),l?l=(l+1)%5:"rgba("===f.substr(-5)&&(l=1),c!==u[m++]&&(h=parseFloat(u[m-1])||0,g._pt={_next:g._pt,p:f||1===m?f:",",s:h,c:"="===c.charAt(1)?vt(h,c)-h:parseFloat(c)-h,m:l&&l<4?Math.round:0},_=j.lastIndex);return g.c=_<n.length?n.substring(_,n.length):"",g.fp=a,(H.test(n)||p)&&(g.e=0),this._pt=g,g},He=function(t,e,r,n,i,s,a,o,u,l){S(n)&&(n=n(i||0,t,s));var c,f=t[e],h="get"!==r?r:S(f)?u?t[e.indexOf("set")||!S(t["get"+e.substr(3)])?e:"get"+e.substr(3)](u):t[e]():f,p=S(f)?u?er:tr:Je;if(A(n)&&(~n.indexOf("random(")&&(n=fe(n)),"="===n.charAt(1)&&((c=vt(h,n)+(te(h)||0))||0===c)&&(n=c)),!l||h!==n||Ue)return isNaN(h*n)||""===n?(!f&&!(e in t)&&$(e,n),je.call(this,t,e,h,n,p,o||y.stringFilter,u)):(c=new hr(this._pt,t,e,+h||0,n-(h||0),"boolean"==typeof f?sr:ir,0,p),u&&(c.fp=u),a&&c.modifier(a,this,t),this._pt=c)},We=function(t,e,r,n,i,s){var a,o,u,l;if(ot[t]&&!1!==(a=new ot[t]).init(i,a.rawVars?e[t]:function(t,e,r,n,i){if(S(t)&&(t=Qe(t,i,e,r,n)),!R(t)||t.style&&t.nodeType||B(t)||Y(t))return A(t)?Qe(t,i,e,r,n):t;var s,a={};for(s in t)a[s]=Qe(t[s],i,e,r,n);return a}(e[t],n,i,s,r),r,n,s)&&(r._pt=o=new hr(r._pt,i,t,0,1,a.render,a,0,a.priority),r!==f))for(u=r._ptLookup[r._targets.indexOf(i)],l=a._props.length;l--;)u[a._props[l]]=o;return a},Ve=function t(e,i,a){var o,u,l,c,f,h,p,d,g,_,m,v,y,T=e.vars,k=T.ease,M=T.startAt,O=T.immediateRender,C=T.lazy,E=T.onUpdate,A=T.runBackwards,S=T.yoyoEase,P=T.keyframes,D=T.autoRevert,R=e._dur,F=e._startAt,I=e._targets,Y=e.parent,B=Y&&"nested"===Y.data?Y.vars.targets:I,L="auto"===e._overwrite&&!r,N=e.timeline,X=T.easeReverse||S;if(N&&(!P||!k)&&(k="none"),e._ease=ze(k,x.ease),e._rEase=X&&(ze(X)||e._ease),e._from=!N&&!!T.runBackwards,e._from&&(e.ratio=1),!N||P&&!T.stagger){if(v=(d=I[0]?pt(I[0]).harness:0)&&T[d.prop],o=Et(T,it),F&&(F._zTime<0&&F.progress(1),i<0&&A&&O&&!D?F.render(-1,!0):F.revert(A&&R?rt:et),F._lazy=0),M){if(Dt(e._startAt=Ke.set(I,Mt({data:"isStart",overwrite:!1,parent:Y,immediateRender:!0,lazy:!F&&z(C),startAt:null,delay:0,onUpdate:E&&function(){return de(e,"onUpdate")},stagger:0},M))),e._startAt._dp=0,e._startAt._sat=e,i<0&&(n||!O&&!D)&&e._startAt.revert(rt),O&&R&&i<=0&&a<=0)return void(i&&(e._zTime=i))}else if(A&&R&&!F)if(i&&(O=!1),l=Mt({overwrite:!1,data:"isFromStart",lazy:O&&!F&&z(C),immediateRender:O,stagger:0,parent:Y},o),v&&(l[d.prop]=v),Dt(e._startAt=Ke.set(I,l)),e._startAt._dp=0,e._startAt._sat=e,i<0&&(n?e._startAt.revert(rt):e._startAt.render(-1,!0)),e._zTime=i,O){if(!i)return}else t(e._startAt,w,w);for(e._pt=e._ptCache=0,C=R&&z(C)||C&&!R,u=0;u<I.length;u++){if(p=(f=I[u])._gsap||ht(I)[u]._gsap,e._ptLookup[u]=_={},at[p.id]&&st.length&&xt(),m=B===I?u:B.indexOf(f),d&&!1!==(g=new d).init(f,v||o,e,m,B)&&(e._pt=c=new hr(e._pt,f,g.name,0,1,g.render,g,0,g.priority),g._props.forEach(function(t){_[t]=c}),g.priority&&(h=1)),!d||v)for(l in o)ot[l]&&(g=We(l,o,e,m,f,B))?g.priority&&(h=1):_[l]=c=He.call(e,f,l,"get",o[l],m,B,0,T.stringFilter);e._op&&e._op[u]&&e.kill(f,e._op[u]),L&&e._pt&&(qe=e,s.killTweensOf(f,_,e.globalTime(i)),y=!e.parent,qe=0),e._pt&&C&&(at[p.id]=1)}h&&fr(e),e._onInit&&e._onInit(e)}e._onUpdate=E,e._initted=(!e._op||e._pt)&&!y,P&&i<=0&&N.render(b,!0,!0)},Ge=function(t,e,r,n){var i,s,a=e.ease||n||"power1.inOut";if(B(e))s=r[t]||(r[t]=[]),e.forEach(function(t,r){return s.push({t:r/(e.length-1)*100,v:t,e:a})});else for(i in e)s=r[i]||(r[i]=[]),"ease"===i||s.push({t:parseFloat(t),v:e[i],e:a})},Qe=function(t,e,r,n,i){return S(t)?t.call(e,r,n,i):A(t)&&~t.indexOf("random(")?fe(t):t},Ze=ft+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,easeReverse,autoRevert",$e={};gt(Ze+",id,stagger,delay,duration,paused,scrollTrigger",function(t){return $e[t]=1});var Ke=function(i){function a(e,n,a,o){var u;"number"==typeof n&&(a.duration=n,n=a,a=null);var l,c,f,h,p,d,g,_,m=(u=i.call(this,o?n:At(n))||this).vars,v=m.duration,x=m.delay,b=m.immediateRender,w=m.stagger,T=m.overwrite,k=m.keyframes,M=m.defaults,O=m.scrollTrigger,C=n.parent||s,E=(B(e)||Y(e)?P(e[0]):"length"in n)?[e]:ne(e);if(u._targets=E.length?ht(E):K("GSAP target "+e+" not found. https://gsap.com",!y.nullTargetWarn)||[],u._ptLookup=[],u._overwrite=T,k||w||I(v)||I(x)){var A=(n=u.vars).easeReverse||n.yoyoEase;if((l=u.timeline=new Xe({data:"nested",defaults:M||{},targets:C&&"nested"===C.data?C.vars.targets:E})).kill(),l.parent=l._dp=t(u),l._start=0,w||I(v)||I(x)){if(h=E.length,g=w&&ae(w),R(w))for(p in w)~Ze.indexOf(p)&&(_||(_={}),_[p]=w[p]);for(c=0;c<h;c++)(f=Et(n,$e)).stagger=0,A&&(f.easeReverse=A),_&&Ot(f,_),d=E[c],f.duration=+Qe(v,t(u),c,d,E),f.delay=(+Qe(x,t(u),c,d,E)||0)-u._delay,!w&&1===h&&f.delay&&(u._delay=x=f.delay,u._start+=x,f.delay=0),l.to(d,f,g?g(c,d,E):0),l._ease=Ae.none;l.duration()?v=x=0:u.timeline=0}else if(k){At(Mt(l.vars.defaults,{ease:"none"})),l._ease=ze(k.ease||n.ease||"none");var S,D,F,L=0;if(B(k))k.forEach(function(t){return l.to(E,t,">")}),l.duration();else{for(p in f={},k)"ease"===p||"easeEach"===p||Ge(p,k[p],f,k.easeEach);for(p in f)for(S=f[p].sort(function(t,e){return t.t-e.t}),L=0,c=0;c<S.length;c++)(F={ease:(D=S[c]).e,duration:(D.t-(c?S[c-1].t:0))/100*v})[p]=D.v,l.to(E,F,L),L+=F.duration;l.duration()<v&&l.to({},{duration:v-l.duration()})}}v||u.duration(v=l.duration())}else u.timeline=0;return!0!==T||r||(qe=t(u),s.killTweensOf(E),qe=0),qt(C,t(u),a),n.reversed&&u.reverse(),n.paused&&u.paused(!0),(b||!v&&!k&&u._start===mt(C._time)&&z(b)&&Ft(t(u))&&"nested"!==C.data)&&(u._tTime=-1e-8,u.render(Math.max(0,-x)||0)),O&&Ut(t(u),O),u}e(a,i);var o=a.prototype;return o.render=function(t,e,r){var i,s,a,o,u,l,c,f,h=this._time,p=this._tDur,d=this._dur,g=t<0,_=t>p-w&&!g?p:t<w?0:t;if(d){if(_!==this._tTime||!t||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==g||this._lazy){if(i=_,f=this.timeline,this._repeat){if(o=d+this._rDelay,this._repeat<-1&&g)return this.totalTime(100*o+t,e,r);if(i=mt(_%o),_===p?(a=this._repeat,i=d):(a=~~(u=mt(_/o)))&&a===u?(i=d,a--):i>d&&(i=d),(l=this._yoyo&&1&a)&&(i=d-i),u=Yt(this._tTime,o),i===h&&!r&&this._initted&&a===u)return this._tTime=_,this;a!==u&&this.vars.repeatRefresh&&!l&&!this._lock&&i!==o&&this._initted&&(this._lock=r=1,this.render(mt(o*a),!0).invalidate()._lock=0)}if(!this._initted){if(jt(this,g?t:i,r,e,_))return this._tTime=0,this;if(!(h===this._time||r&&this.vars.repeatRefresh&&a!==u))return this;if(d!==this._dur)return this.render(t,e,r)}if(this._rEase){var m=i<h;if(m!==this._inv){var v=m?h:d-h;this._inv=m,this._from&&(this.ratio=1-this.ratio),this._invRatio=this.ratio,this._invTime=h,this._invRecip=v?(m?-1:1)/v:0,this._invScale=m?-this.ratio:1-this.ratio,this._invEase=m?this._rEase:this._ease}this.ratio=c=this._invRatio+this._invScale*this._invEase((i-this._invTime)*this._invRecip)}else this.ratio=c=this._ease(i/d);if(this._from&&(this.ratio=c=1-c),this._tTime=_,this._time=i,!this._act&&this._ts&&(this._act=1,this._lazy=0),!h&&_&&!e&&!u&&(de(this,"onStart"),this._tTime!==_))return this;for(s=this._pt;s;)s.r(c,s.d),s=s._next;f&&f.render(t<0?t:f._dur*f._ease(i/this._dur),e,r)||this._startAt&&(this._zTime=t),this._onUpdate&&!e&&(g&&zt(this,t,0,r),de(this,"onUpdate")),this._repeat&&a!==u&&this.vars.onRepeat&&!e&&this.parent&&de(this,"onRepeat"),_!==this._tDur&&_||this._tTime!==_||(g&&!this._onUpdate&&zt(this,t,0,!0),(t||!d)&&(_===this._tDur&&this._ts>0||!_&&this._ts<0)&&Dt(this,1),e||g&&!h||!(_||h||l)||(de(this,_===p?"onComplete":"onReverseComplete",!0),this._prom&&!(_<p&&this.timeScale()>0)&&this._prom()))}}else!function(t,e,r,i){var s,a,o,u=t.ratio,l=e<0||!e&&(!t._start&&Ht(t)&&(t._initted||!Wt(t))||(t._ts<0||t._dp._ts<0)&&!Wt(t))?0:1,c=t._rDelay,f=0;if(c&&t._repeat&&(f=Jt(0,t._tDur,e),a=Yt(f,c),t._yoyo&&1&a&&(l=1-l),a!==Yt(t._tTime,c)&&(u=1-l,t.vars.repeatRefresh&&t._initted&&t.invalidate())),l!==u||n||i||t._zTime===w||!e&&t._zTime){if(!t._initted&&jt(t,e,i,r,f))return;for(o=t._zTime,t._zTime=e||(r?w:0),r||(r=e&&!o),t.ratio=l,t._from&&(l=1-l),t._time=0,t._tTime=f,s=t._pt;s;)s.r(l,s.d),s=s._next;e<0&&zt(t,e,0,!0),t._onUpdate&&!r&&de(t,"onUpdate"),f&&t._repeat&&!r&&t.parent&&de(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===l&&(l&&Dt(t,1),r||n||(de(t,l?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)}(this,t,e,r);return this},o.targets=function(){return this._targets},o.invalidate=function(t){return(!t||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(t),i.prototype.invalidate.call(this,t)},o.resetTo=function(t,e,r,n,i){h||Ce.wake(),this._ts||this.play();var s=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Ve(this,s),function(t,e,r,n,i,s,a,o){var u,l,c,f,h=(t._pt&&t._ptCache||(t._ptCache={}))[e];if(!h)for(h=t._ptCache[e]=[],c=t._ptLookup,f=t._targets.length;f--;){if((u=c[f][e])&&u.d&&u.d._pt)for(u=u.d._pt;u&&u.p!==e&&u.fp!==e;)u=u._next;if(!u)return Ue=1,t.vars[e]="+=0",Ve(t,a),Ue=0,o?K(e+" not eligible for reset. Try splitting into individual properties"):1;h.push(u)}for(f=h.length;f--;)(u=(l=h[f])._pt||l).s=!n&&0!==n||i?u.s+(n||0)+s*u.c:n,u.c=r-u.s,l.e&&(l.e=_t(r)+te(l.e)),l.b&&(l.b=u.s+te(l.b))}(this,t,e,r,n,this._ease(s/this._dur),s,i)?this.resetTo(t,e,r,n,1):(Nt(this,0),this.parent||St(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},o.kill=function(t,e){if(void 0===e&&(e="all"),!(t||e&&"all"!==e))return this._lazy=this._pt=0,this.parent?ge(this):this.scrollTrigger&&this.scrollTrigger.kill(!!n),this;if(this.timeline){var r=this.timeline.totalDuration();return this.timeline.killTweensOf(t,e,qe&&!0!==qe.vars.overwrite)._first||ge(this),this.parent&&r!==this.timeline.totalDuration()&&Vt(this,this._dur*this.timeline._tDur/r,0,1),this}var i,s,a,o,u,l,c,f=this._targets,h=t?ne(t):f,p=this._ptLookup,d=this._pt;if((!e||"all"===e)&&function(t,e){for(var r=t.length,n=r===e.length;n&&r--&&t[r]===e[r];);return r<0}(f,h))return"all"===e&&(this._pt=0),ge(this);for(i=this._op=this._op||[],"all"!==e&&(A(e)&&(u={},gt(e,function(t){return u[t]=1}),e=u),e=function(t,e){var r,n,i,s,a=t[0]?pt(t[0]).harness:0,o=a&&a.aliases;if(!o)return e;for(n in r=Ot({},e),o)if(n in r)for(i=(s=o[n].split(",")).length;i--;)r[s[i]]=r[n];return r}(f,e)),c=f.length;c--;)if(~h.indexOf(f[c]))for(u in s=p[c],"all"===e?(i[c]=e,o=s,a={}):(a=i[c]=i[c]||{},o=e),o)(l=s&&s[u])&&("kill"in l.d&&!0!==l.d.kill(u)||Pt(this,l,"_pt"),delete s[u]),"all"!==a&&(a[u]=1);return this._initted&&!this._pt&&d&&ge(this),this},a.to=function(t,e){return new a(t,e,arguments[2])},a.from=function(t,e){return $t(1,arguments)},a.delayedCall=function(t,e,r,n){return new a(e,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:t,onComplete:e,onReverseComplete:e,onCompleteParams:r,onReverseCompleteParams:r,callbackScope:n})},a.fromTo=function(t,e,r){return $t(2,arguments)},a.set=function(t,e){return e.duration=0,e.repeatDelay||(e.repeat=0),new a(t,e)},a.killTweensOf=function(t,e,r){return s.killTweensOf(t,e,r)},a}(Ne);Mt(Ke.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),gt("staggerTo,staggerFrom,staggerFromTo",function(t){Ke[t]=function(){var e=new Xe,r=ee.call(arguments,0);return r.splice("staggerFromTo"===t?5:4,0,0),e[t].apply(e,r)}});var Je=function(t,e,r){return t[e]=r},tr=function(t,e,r){return t[e](r)},er=function(t,e,r,n){return t[e](n.fp,r)},rr=function(t,e,r){return t.setAttribute(e,r)},nr=function(t,e){return S(t[e])?tr:D(t[e])&&t.setAttribute?rr:Je},ir=function(t,e){return e.set(e.t,e.p,Math.round(1e6*(e.s+e.c*t))/1e6,e)},sr=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},ar=function(t,e){var r=e._pt,n="";if(!t&&e.b)n=e.b;else if(1===t&&e.e)n=e.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*t):Math.round(1e4*(r.s+r.c*t))/1e4)+n,r=r._next;n+=e.c}e.set(e.t,e.p,n,e)},or=function(t,e){for(var r=e._pt;r;)r.r(t,r.d),r=r._next},ur=function(t,e,r,n){for(var i,s=this._pt;s;)i=s._next,s.p===n&&s.modifier(t,e,r),s=i},lr=function(t){for(var e,r,n=this._pt;n;)r=n._next,n.p===t&&!n.op||n.op===t?Pt(this,n,"_pt"):n.dep||(e=1),n=r;return!e},cr=function(t,e,r,n){n.mSet(t,e,n.m.call(n.tween,r,n.mt),n)},fr=function(t){for(var e,r,n,i,s=t._pt;s;){for(e=s._next,r=n;r&&r.pr>s.pr;)r=r._next;(s._prev=r?r._prev:i)?s._prev._next=s:n=s,(s._next=r)?r._prev=s:i=s,s=e}t._pt=n},hr=function(){function t(t,e,r,n,i,s,a,o,u){this.t=e,this.s=n,this.c=i,this.p=r,this.r=s||ir,this.d=a||this,this.set=o||Je,this.pr=u||0,this._next=t,t&&(t._prev=this)}return t.prototype.modifier=function(t,e,r){this.mSet=this.mSet||this.set,this.set=cr,this.m=t,this.mt=r,this.tween=e},t}();gt(ft+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger,easeReverse",function(t){return it[t]=1}),G.TweenMax=G.TweenLite=Ke,G.TimelineLite=G.TimelineMax=Xe,s=new Xe({sortChildren:!1,defaults:x,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),y.stringFilter=Oe;var pr=[],dr={},gr=[],_r=0,mr=0,vr=function(t){return(dr[t]||gr).map(function(t){return t()})},yr=function(){var t=Date.now(),e=[];t-_r>2&&(vr("matchMediaInit"),pr.forEach(function(t){var r,n,i,s,o=t.queries,u=t.conditions;for(n in o)(r=a.matchMedia(o[n]).matches)&&(i=1),r!==u[n]&&(u[n]=r,s=1);s&&(t.revert(),i&&e.push(t))}),vr("matchMediaRevert"),e.forEach(function(t){return t.onMatch(t,function(e){return t.add(null,e)})}),_r=t,vr("matchMedia"))},xr=function(){function t(t,e){this.selector=e&&ie(e),this.data=[],this._r=[],this.isReverted=!1,this.id=mr++,t&&this.add(t)}var e=t.prototype;return e.add=function(t,e,r){S(t)&&(r=e,e=t,t=S);var n=this,s=function(){var t,s=i,a=n.selector;return s&&s!==n&&s.data.push(n),r&&(n.selector=ie(r)),i=n,t=e.apply(n,arguments),S(t)&&n._r.push(t),i=s,n.selector=a,n.isReverted=!1,t};return n.last=s,t===S?s(n,function(t){return n.add(null,t)}):t?n[t]=s:s},e.ignore=function(t){var e=i;i=null,t(this),i=e},e.getTweens=function(){var e=[];return this.data.forEach(function(r){return r instanceof t?e.push.apply(e,r.getTweens()):r instanceof Ke&&!(r.parent&&"nested"===r.parent.data)&&e.push(r)}),e},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(t,e){var r=this;if(t?function(){for(var e,n=r.getTweens(),i=r.data.length;i--;)"isFlip"===(e=r.data[i]).data&&(e.revert(),e.getChildren(!0,!0,!1).forEac
1h(function(t){return n.splice(n.indexOf(t),1)}));for(n.map(function(t){return{g:t._dur||t._delay||t._sat&&!t._sat.vars.immediateRender?t.globalTime(0):-1/0,t}}).sort(function(t,e){return e.g-t.g||-1/0}).forEach(function(e){return e.t.revert(t)}),i=r.data.length;i--;)(e=r.data[i])instanceof Xe?"nested"!==e.data&&(e.scrollTrigger&&e.scrollTrigger.revert(),e.kill()):!(e instanceof Ke)&&e.revert&&e.revert(t);r._r.forEach(function(e){return e(t,r)}),r.isReverted=!0}():this.data.forEach(function(t){return t.kill&&t.kill()}),this.clear(),e)for(var n=pr.length;n--;)pr[n].id===this.id&&pr.splice(n,1)},e.revert=function(t){this.kill(t||{})},t}(),br=function(){function t(t){this.contexts=[],this.scope=t,i&&i.data.push(this)}var e=t.prototype;return e.add=function(t,e,r){R(t)||(t={matches:t});var n,s,o,u=new xr(0,r||this.scope),l=u.conditions={};for(s in i&&!u.selector&&(u.selector=i.selector),this.contexts.push(u),e=u.add("onMatch",e),u.queries=t,t)"all"===s?o=1:(n=a.matchMedia(t[s]))&&(pr.indexOf(u)<0&&pr.push(u),(l[s]=n.matches)&&(o=1),n.addListener?n.addListener(yr):n.addEventListener("change",yr));return o&&e(u,function(t){return u.add(null,t)}),this},e.revert=function(t){this.kill(t||{})}
vendor: 22,402 bytes, line 1
1,e.kill=function(t){this.contexts.forEach(function(e){return e.kill(t,!0)})},t}(),wr={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];e.forEach(function(t){return me(t)})},timeline:function(t){return new Xe(t)},getTweensOf:function(t,e){return s.getTweensOf(t,e)},getProperty:function(t,e,r,n){A(t)&&(t=ne(t)[0]);var i=pt(t||{}).get,s=r?kt:Tt;return"native"===r&&(r=""),t?e?s((ot[e]&&ot[e].get||i)(t,e,r,n)):function(e,r,n){return s((ot[e]&&ot[e].get||i)(t,e,r,n))}:t},quickSetter:function(t,e,r){if((t=ne(t)).length>1){var n=t.map(function(t){return Mr.quickSetter(t,e,r)}),i=n.length;return function(t){for(var e=i;e--;)n[e](t)}}t=t[0]||{};var s=ot[e],a=pt(t),o=a.harness&&(a.harness.aliases||{})[e]||e,u=s?function(e){var n=new s;f._pt=0,n.init(t,r?e+r:e,f,0,[t]),n.render(1,n),f._pt&&or(1,f)}:a.set(t,o);return s?u:function(e){return u(t,o,r?e+r:e,a,1)}},quickTo:function(t,e,r){var n,i=Mr.to(t,Mt(((n={})[e]="+=0.1",n.paused=!0,n.stagger=0,n),r||{})),s=function(t,r,n){return i.resetTo(e,t,r,n)};return s.tween=i,s},isTweening:function(t){return s.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=ze(t.ease,x.ease)),Ct(x,t||{})},config:function(t){return Ct(y,t||{})},registerEffect:function(t){var e=t.name,r=t.effect,n=t.plugins,i=t.defaults,s=t.extendTimeline;(n||"").split(",").forEach(function(t){return t&&!ot[t]&&!G[t]&&K(e+" effect requires "+t+" plugin.")}),ut[e]=function(t,e,n){return r(ne(t),Mt(e||{},i),n)},s&&(Xe.prototype[e]=function(t,r,n){return this.add(ut[e](t,R(r)?r:(n=r)&&{},this),n)})},registerEase:function(t,e){Ae[t]=ze(e)},parseEase:function(t,e){return arguments.length?ze(t,e):Ae},getById:function(t){return s.getById(t)},exportRoot:function(t,e){void 0===t&&(t={});var r,n,i=new Xe(t);for(i.smoothChildTiming=z(t.smoothChildTiming),s.remove(i),i._dp=0,i._time=i._tTime=s._time,r=s._first;r;)n=r._next,!e&&!r._dur&&r instanceof Ke&&r.vars.onComplete===r._targets[0]||qt(i,r,r._start-r._delay),r=n;return qt(s,i,0),i},context:function(t,e){return t?new xr(t,e):i},matchMedia:function(t){return new br(t)},matchMediaRefresh:function(){return pr.forEach(function(t){var e,r,n=t.conditions;for(r in n)n[r]&&(n[r]=!1,e=1);e&&t.revert()})||yr()},addEventListener:function(t,e){var r=dr[t]||(dr[t]=[]);~r.indexOf(e)||r.push(e)},removeEventListener:function(t,e){var r=dr[t],n=r&&r.indexOf(e);n>=0&&r.splice(n,1)},utils:{wrap:function t(e,r,n){var i=r-e;return B(e)?ce(e,t(0,e.length),r):Kt(n,function(t){return(i+(t-e)%i)%i+e})},wrapYoyo:function t(e,r,n){var i=r-e,s=2*i;return B(e)?ce(e,t(0,e.length-1),r):Kt(n,function(t){return e+((t=(s+(t-e)%s)%s||0)>i?s-t:t)})},distribute:ae,random:le,snap:ue,normalize:function(t,e,r){return he(t,e,0,1,r)},getUnit:te,clamp:function(t,e,r){return Kt(r,function(r){return Jt(t,e,r)})},splitColor:be,toArray:ne,selector:ie,mapRange:he,pipe:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t){return e.reduce(function(t,e){return e(t)},t)}},unitize:function(t,e){return function(r){return t(parseFloat(r))+(e||te(r))}},interpolate:function t(e,r,n,i){var s=isNaN(e+r)?0:function(t){return(1-t)*e+t*r};if(!s){var a,o,u,l,c,f=A(e),h={};if(!0===n&&(i=1)&&(n=null),f)e={p:e},r={p:r};else if(B(e)&&!B(r)){for(u=[],l=e.length,c=l-2,o=1;o<l;o++)u.push(t(e[o-1],e[o]));l--,s=function(t){t*=l;var e=Math.min(c,~~t);return u[e](t-e)},n=r}else i||(e=Ot(B(e)?[]:{},e));if(!u){for(a in r)He.call(h,e,a,"get",r[a]);s=function(t){return or(t,h)||(f?e.p:e)}}}return Kt(n,s)},shuffle:se},install:Z,effects:ut,ticker:Ce,updateRoot:Xe.updateRoot,plugins:ot,globalTimeline:s,core:{PropTween:hr,globals:J,Tween:Ke,Timeline:Xe,Animation:Ne,getCache:pt,_removeLinkedListItem:Pt,reverting:function(){return n},context:function(t){return t&&i&&(i.data.push(t),t._ctx=i),i},suppressOverwrites:function(t){return r=t}}};gt("to,from,fromTo,delayedCall,set,killTweensOf",function(t){return wr[t]=Ke[t]}),Ce.add(Xe.updateRoot),f=wr.to({},{duration:0});var Tr=function(t,e){for(var r=t._pt;r&&r.p!==e&&r.op!==e&&r.fp!==e;)r=r._next;return r},kr=function(t,e){return{name:t,headless:1,rawVars:1,init:function(t,r,n){n._onInit=function(t){var n,i;if(A(r)&&(n={},gt(r,function(t){return n[t]=1}),r=n),e){for(i in n={},r)n[i]=e(r[i]);r=n}!function(t,e){var r,n,i,s=t._targets;for(r in e)for(n=s.length;n--;)(i=t._ptLookup[n][r])&&(i=i.d)&&(i._pt&&(i=Tr(i,r)),i&&i.modifier&&i.modifier(e[r],t,s[n],r))}(t,r)}}}},Mr=wr.registerPlugin({name:"attr",init:function(t,e,r,n,i){var s,a,o;for(s in this.tween=r,e)o=t.getAttribute(s)||"",(a=this.add(t,"setAttribute",(o||0)+"",e[s],n,i,0,0,s)).op=s,a.b=o,this._props.push(s)},render:function(t,e){for(var r=e._pt;r;)n?r.set(r.t,r.p,r.b,r):r.r(t,r.d),r=r._next}},{name:"endArray",headless:1,init:function(t,e){for(var r=e.length;r--;)this.add(t,r,t[r]||0,e[r],0,0,0,0,0,1)}},kr("roundProps",oe),kr("modifiers"),kr("snap",ue))||wr;Ke.version=Xe.version=Mr.version="3.15.0",l=1,F()&&Ee(),Ae.Power0,Ae.Power1,Ae.Power2,Ae.Power3,Ae.Power4,Ae.Linear,Ae.Quad,Ae.Cubic,Ae.Quart,Ae.Quint,Ae.Strong,Ae.Elastic,Ae.Back,Ae.SteppedEase,Ae.Bounce,Ae.Sine,Ae.Expo,Ae.Circ;var Or,Cr,Er,Ar,Sr,Pr,Dr,Rr,zr={},Fr=180/Math.PI,Ir=Math.PI/180,Yr=Math.atan2,Br=/([A-Z])/g,Lr=/(left|right|width|margin|padding|x)/i,Nr=/[\s,\(]\S/,Xr={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},qr=function(t,e){return e.set(e.t,e.p,Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},Ur=function(t,e){return e.set(e.t,e.p,1===t?e.e:Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},jr=function(t,e){return e.set(e.t,e.p,t?Math.round(1e4*(e.s+e.c*t))/1e4+e.u:e.b,e)},Hr=function(t,e){return e.set(e.t,e.p,1===t?e.e:t?Math.round(1e4*(e.s+e.c*t))/1e4+e.u:e.b,e)},Wr=function(t,e){var r=e.s+e.c*t;e.set(e.t,e.p,~~(r+(r<0?-.5:.5))+e.u,e)},Vr=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Gr=function(t,e){return e.set(e.t,e.p,1!==t?e.b:e.e,e)},Qr=function(t,e,r){return t.style[e]=r},Zr=function(t,e,r){return t.style.setProperty(e,r)},$r=function(t,e,r){return t._gsap[e]=r},Kr=function(t,e,r){return t._gsap.scaleX=t._gsap.scaleY=r},Jr=function(t,e,r,n,i){var s=t._gsap;s.scaleX=s.scaleY=r,s.renderTransform(i,s)},tn=function(t,e,r,n,i){var s=t._gsap;s[e]=r,s.renderTransform(i,s)},en="transform",rn=en+"Origin",nn=function t(e,r){var n=this,i=this.target,s=i.style,a=i._gsap;if(e in zr&&s){if(this.tfm=this.tfm||{},"transform"===e)return Xr.transform.split(",").forEach(function(e){return t.call(n,e,r)});if(~(e=Xr[e]||e).indexOf(",")?e.split(",").forEach(function(t){return n.tfm[t]=Tn(i,t)}):this.tfm[e]=a.x?a[e]:Tn(i,e),e===rn&&(this.tfm.zOrigin=a.zOrigin),this.props.indexOf(en)>=0)return;a.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(rn,r,"")),e=en}(s||r)&&this.props.push(e,r,s[e])},sn=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},an=function(){var t,e,r=this.props,n=this.target,i=n.style,s=n._gsap;for(t=0;t<r.length;t+=3)r[t+1]?2===r[t+1]?n[r[t]](r[t+2]):n[r[t]]=r[t+2]:r[t+2]?i[r[t]]=r[t+2]:i.removeProperty("--"===r[t].substr(0,2)?r[t]:r[t].replace(Br,"-$1").toLowerCase());if(this.tfm){for(e in this.tfm)s[e]=this.tfm[e];s.svg&&(s.renderTransform(),n.setAttribute("data-svg-origin",this.svgo||"")),(t=Dr())&&t.isStart||i[en]||(sn(i),s.zOrigin&&i[rn]&&(i[rn]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},on=function(t,e){var r={target:t,props:[],revert:an,save:nn};return t._gsap||Mr.core.getCache(t),e&&t.style&&t.nodeType&&e.split(",").forEach(function(t){return r.save(t)}),r},un=function(t,e){var r=Cr.createElementNS?Cr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Cr.createElement(t);return r&&r.style?r:Cr.createElement(t)},ln=function t(e,r,n){var i=getComputedStyle(e);return i[r]||i.getPropertyValue(r.replace(Br,"-$1").toLowerCase())||i.getPropertyValue(r)||!n&&t(e,fn(r)||r,1)||""},cn="O,Moz,ms,Ms,Webkit".split(","),fn=function(t,e,r){var n=(e||Sr).style,i=5;if(t in n&&!r)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);i--&&!(cn[i]+t in n););return i<0?null:(3===i?"ms":i>=0?cn[i]:"")+t},hn=function(){"undefined"!=typeof window&&window.document&&(Or=window,Cr=Or.document,Er=Cr.documentElement,Sr=un("div")||{style:{}},un("div"),en=fn(en),rn=en+"Origin",Sr.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Rr=!!fn("perspective"),Dr=Mr.core.reverting,Ar=1)},pn=function(t){var e,r=t.ownerSVGElement,n=un("svg",r&&r.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=t.cloneNode(!0);i.style.display="block",n.appendChild(i),Er.appendChild(n);try{e=i.getBBox()}catch(t){}return n.removeChild(i),Er.removeChild(n),e},dn=function(t,e){for(var r=e.length;r--;)if(t.hasAttribute(e[r]))return t.getAttribute(e[r])},gn=function(t){var e,r;try{e=t.getBBox()}catch(n){e=pn(t),r=1}return e&&(e.width||e.height)||r||(e=pn(t)),!e||e.width||e.x||e.y?e:{x:+dn(t,["x","cx","x1"])||0,y:+dn(t,["y","cy","y1"])||0,width:0,height:0}},mn=function(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!gn(t))},vn=function(t,e){if(e){var r,n=t.style;e in zr&&e!==rn&&(e=en),n.removeProperty?("ms"!==(r=e.substr(0,2))&&"webkit"!==e.substr(0,6)||(e="-"+e),n.removeProperty("--"===r?e:e.replace(Br,"-$1").toLowerCase())):n.removeAttribute(e)}},yn=function(t,e,r,n,i,s){var a=new hr(t._pt,e,r,0,1,s?Gr:Vr);return t._pt=a,a.b=n,a.e=i,t._props.push(r),a},xn={deg:1,rad:1,turn:1},bn={grid:1,flex:1},wn=function t(e,r,n,i){var s,a,o,u,l=parseFloat(n)||0,c=(n+"").trim().substr((l+"").length)||"px",f=Sr.style,h=Lr.test(r),p="svg"===e.tagName.toLowerCase(),d=(p?"client":"offset")+(h?"Width":"Height"),g=100,_="px"===i,m="%"===i;if(i===c||!l||xn[i]||xn[c])return l;if("px"!==c&&!_&&(l=t(e,r,n,"px")),u=e.getCTM&&mn(e),(m||"%"===c)&&(zr[r]||~r.indexOf("adius")))return s=u?e.getBBox()[h?"width":"height"]:e[d],_t(m?l/s*g:l/100*s);if(f[h?"width":"height"]=g+(_?c:i),a="rem"!==i&&~r.indexOf("adius")||"em"===i&&e.appendChild&&!p?e:e.parentNode,u&&(a=(e.ownerSVGElement||{}).parentNode),a&&a!==Cr&&a.appendChild||(a=Cr.body),(o=a._gsap)&&m&&o.width&&h&&o.time===Ce.time&&!o.uncache)return _t(l/o.width*g);if(!m||"height"!==r&&"width"!==r)(m||"%"===c)&&!bn[ln(a,"display")]&&(f.position=ln(e,"position")),a===e&&(f.position="static"),a.appendChild(Sr),s=Sr[d],a.removeChild(Sr),f.position="absolute";else{var v=e.style[r];e.style[r]=g+i,s=e[d],v?e.style[r]=v:vn(e,r)}return h&&m&&((o=pt(a)).time=Ce.time,o.width=a[d]),_t(_?s*l/g:s&&l?g/s*l:0)},Tn=function(t,e,r,n){var i;return Ar||hn(),e in Xr&&"transform"!==e&&~(e=Xr[e]).indexOf(",")&&(e=e.split(",")[0]),zr[e]&&"transform"!==e?(i=Fn(t,n),i="transformOrigin"!==e?i[e]:i.svg?i.origin:In(ln(t,rn))+" "+i.zOrigin+"px"):(!(i=t.style[e])||"auto"===i||n||~(i+"").indexOf("calc("))&&(i=En[e]&&En[e](t,e,r)||ln(t,e)||dt(t,e)||("opacity"===e?1:0)),r&&!~(i+"").trim().indexOf(" ")?wn(t,e,i,r)+r:i},kn=function(t,e,r,n){if(!r||"none"===r){var i=fn(e,t,1),s=i&&ln(t,i,1);s&&s!==r?(e=i,r=s):"borderColor"===e&&(r=ln(t,"borderTopColor"))}var a,o,u,l,c,f,h,p,d,g,_,m=new hr(this._pt,t.style,e,0,1,ar),v=0,x=0;if(m.b=r,m.e=n,r+="","var(--"===(n+="").substring(0,6)&&(n=ln(t,n.substring(4,n.indexOf(")")))),"auto"===n&&(f=t.style[e],t.style[e]=n,n=ln(t,e)||n,f?t.style[e]=f:vn(t,e)),Oe(a=[r,n]),n=a[1],u=(r=a[0]).match(U)||[],(n.match(U)||[]).length){for(;o=U.exec(n);)h=o[0],d=n.substring(v,o.index),c?c=(c+1)%5:"rgba("!==d.substr(-5)&&"hsla("!==d.substr(-5)||(c=1),h!==(f=u[x++]||"")&&(l=parseFloat(f)||0,_=f.substr((l+"").length),"="===h.charAt(1)&&(h=vt(l,h)+_),p=parseFloat(h),g=h.substr((p+"").length),v=U.lastIndex-g.length,g||(g=g||y.units[e]||_,v===n.length&&(n+=g,m.e+=g)),_!==g&&(l=wn(t,e,f,g)||0),m._pt={_next:m._pt,p:d||1===x?d:",",s:l,c:p-l,m:c&&c<4||"zIndex"===e?Math.round:0});m.c=v<n.length?n.substring(v,n.length):""}else m.r="display"===e&&"none"===n?Gr:Vr;return H.test(n)&&(m.e=0),this._pt=m,m},Mn={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},On=function(t){var e=t.split(" "),r=e[0],n=e[1]||"50%";return"top"!==r&&"bottom"!==r&&"left"!==n&&"right"!==n||(t=r,r=n,n=t),e[0]=Mn[r]||r,e[1]=Mn[n]||n,e.join(" ")},Cn=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var r,n,i,s=e.t,a=s.style,o=e.u,u=s._gsap;if("all"===o||!0===o)a.cssText="",n=1;else for(i=(o=o.split(",")).length;--i>-1;)r=o[i],zr[r]&&(n=1,r="transformOrigin"===r?rn:en),vn(s,r);n&&(vn(s,en),u&&(u.svg&&s.removeAttribute("transform"),a.scale=a.rotate=a.translate="none",Fn(s,1),u.uncache=1,sn(a)))}},En={clearProps:function(t,e,r,n,i){if("isFromStart"!==i.data){var s=t._pt=new hr(t._pt,e,r,0,0,Cn);return s.u=n,s.pr=-10,s.tween=i,t._props.push(r),1}}},An=[1,0,0,1,0,0],Sn={},Pn=function(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t},Dn=function(t){var e=ln(t,en);return Pn(e)?An:e.substr(7).match(q).map(_t)},Rn=function(t,e){var r,n,i,s,a=t._gsap||pt(t),o=t.style,u=Dn(t);return a.svg&&t.getAttribute("transform")?"1,0,0,1,0,0"===(u=[(i=t.transform.baseVal.consolidate().matrix).a,i.b,i.c,i.d,i.e,i.f]).join(",")?An:u:(u!==An||t.offsetParent||t===Er||a.svg||(i=o.display,o.display="block",(r=t.parentNode)&&(t.offsetParent||t.getBoundingClientRect().width)||(s=1,n=t.nextElementSibling,Er.appendChild(t)),u=Dn(t),i?o.display=i:vn(t,"display"),s&&(n?r.insertBefore(t,n):r?r.appendChild(t):Er.removeChild(t))),e&&u.length>6?[u[0],u[1],u[4],u[5],u[12],u[13]]:u)},zn=function(t,e,r,n,i,s){var a,o,u,l=t._gsap,c=i||Rn(t,!0),f=l.xOrigin||0,h=l.yOrigin||0,p=l.xOffset||0,d=l.yOffset||0,g=c[0],_=c[1],m=c[2],v=c[3],y=c[4],x=c[5],b=e.split(" "),w=parseFloat(b[0])||0,T=parseFloat(b[1])||0;r?c!==An&&(o=g*v-_*m)&&(u=w*(-_/o)+T*(g/o)-(g*x-_*y)/o,w=w*(v/o)+T*(-m/o)+(m*x-v*y)/o,T=u):(w=(a=gn(t)).x+(~b[0].indexOf("%")?w/100*a.width:w),T=a.y+(~(b[1]||b[0]).indexOf("%")?T/100*a.height:T)),n||!1!==n&&l.smooth?(y=w-f,x=T-h,l.xOffset=p+(y*g+x*m)-y,l.yOffset=d+(y*_+x*v)-x):l.xOffset=l.yOffset=0,l.xOrigin=w,l.yOrigin=T,l.smooth=!!n,l.origin=e,l.originIsAbsolute=!!r,t.style[rn]="0px 0px",s&&(yn(s,l,"xOrigin",f,w),yn(s,l,"yOrigin",h,T),yn(s,l,"xOffset",p,l.xOffset),yn(s,l,"yOffset",d,l.yOffset)),t.setAttribute("data-svg-origin",w+" "+T)},Fn=function(t,e){var r=t._gsap||new Le(t);if("x"in r&&!e&&!r.uncache)return r;var n,i,s,a,o,u,l,c,f,h,p,d,g,_,m,v,x,b,w,T,k,M,O,C,E,A,S,P,D,R,z,F,I=t.style,Y=r.scaleX<0,B="px",L="deg",N=getComputedStyle(t),X=ln(t,rn)||"0";return n=i=s=u=l=c=f=h=p=0,a=o=1,r.svg=!(!t.getCTM||!mn(t)),N.translate&&("none"===N.translate&&"none"===N.scale&&"none"===N.rotate||(I[en]=("none"!==N.translate?"translate3d("+(N.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==N.rotate?"rotate("+N.rotate+") ":"")+("none"!==N.scale?"scale("+N.scale.split(" ").join(",")+") ":"")+("none"!==N[en]?N[en]:"")),I.scale=I.rotate=I.translate="none"),_=Rn(t,r.svg),r.svg&&(r.uncache?(E=t.getBBox(),X=r.xOrigin-E.x+"px "+(r.yOrigin-E.y)+"px",C=""):C=!e&&t.getAttribute("data-svg-origin"),zn(t,C||X,!!C||r.originIsAbsolute,!1!==r.smooth,_)),d=r.xOrigin||0,g=r.yOrigin||0,_!==An&&(b=_[0],w=_[1],T=_[2],k=_[3],n=M=_[4],i=O=_[5],6===_.length?(a=Math.sqrt(b*b+w*w),o=Math.sqrt(k*k+T*T),u=b||w?Yr(w,b)*Fr:0,(f=T||k?Yr(T,k)*Fr+u:0)&&(o*=Math.abs(Math.cos(f*Ir))),r.svg&&(n-=d-(d*b+g*T),i-=g-(d*w+g*k))):(F=_[6],R=_[7],S=_[8],P=_[9],D=_[10],z=_[11],n=_[12],i=_[13],s=_[14],l=(m=Yr(F,D))*Fr,m&&(C=M*(v=Math.cos(-m))+S*(x=Math.sin(-m)),E=O*v+P*x,A=F*v+D*x,S=M*-x+S*v,P=O*-x+P*v,D=F*-x+D*v,z=R*-x+z*v,M=C,O=E,F=A),c=(m=Yr(-T,D))*Fr,m&&(v=Math.cos(-m),z=k*(x=Math.sin(-m))+z*v,b=C=b*v-S*x,w=E=w*v-P*x,T=A=T*v-D*x),u=(m=Yr(w,b))*Fr,m&&(C=b*(v=Math.cos(m))+w*(x=Math.sin(m)),E=M*v+O*x,w=w*v-b*x,O=O*v-M*x,b=C,M=E),l&&Math.abs(l)+Math.abs(u)>359.9&&(l=u=0,c=180-c),a=_t(Math.sqrt(b*b+w*w+T*T)),o=_t(Math.sqrt(O*O+F*F)),m=Yr(M,O),f=Math.abs(m)>2e-4?m*Fr:0,p=z?1/(z<0?-z:z):0),r.svg&&(C=t.getAttribute("transform"),r.forceCSS=t.setAttribute("transform","")||!Pn(ln(t,en)),C&&t.setAttribute("transform",C))),Math.abs(f)>90&&Math.abs(f)<270&&(Y?(a*=-1,f+=u<=0?180:-180,u+=u<=0?180:-180):(o*=-1,f+=f<=0?180:-180)),e=e||r.uncache,r.x=n-((r.xPercent=n&&(!e&&r.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-n)?-50:0)))?t.offsetWidth*r.xPercent/100:0)+B,r.y=i-((r.yPercent=i&&(!e&&r.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-i)?-50:0)))?t.offsetHeight*r.yPercent/100:0)+B,r.z=s+B,r.scaleX=_t(a),r.scaleY=_t(o),r.rotation=_t(u)+L,r.rotationX=_t(l)+L,r.rotationY=_t(c)+L,r.skewX=f+L,r.skewY=h+L,r.transformPerspective=p+B,(r.zOrigin=parseFloat(X.split(" ")[2])||!e&&r.zOrigin||0)&&(I[rn]=In(X)),r.xOffset=r.yOffset=0,r.force3D=y.force3D,r.renderTransform=r.svg?Un:Rr?qn:Bn,r.uncache=0,r},In=function(t){return(t=t.split(" "))[0]+" "+t[1]},Yn=function(t,e,r){var n=te(e);return _t(parseFloat(e)+parseFloat(wn(t,"x",r+"px",n)))+n},Bn=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,qn(t,e)},Ln="0deg",Nn="0px",Xn=") ",qn=function(t,e){var r=e||this,n=r.xPercent,i=r.yPercent,s=r.x,a=r.y,o=r.z,u=r.rotation,l=r.rotationY,c=r.rotationX,f=r.skewX,h=r.skewY,p=r.scaleX,d=r.scaleY,g=r.transformPerspective,_=r.force3D,m=r.target,v=r.zOrigin,y="",x="auto"===_&&t&&1!==t||!0===_;if(v&&(c!==Ln||l!==Ln)){var b,w=parseFloat(l)*Ir,T=Math.sin(w),k=Math.cos(w);w=parseFloat(c)*Ir,b=Math.cos(w),s=Yn(m,s,T*b*-v),a=Yn(m,a,-Math.sin(w)*-v),o=Yn(m,o,k*b*-v+v)}g!==Nn&&(y+="perspective("+g+Xn),(n||i)&&(y+="translate("+n+"%, "+i+"%) "),(x||s!==Nn||a!==Nn||o!==Nn)&&(y+=o!==Nn||x?"translate3d("+s+", "+a+", "+o+") ":"translate("+s+", "+a+Xn),u!==Ln&&(y+="rotate("+u+Xn),l!==Ln&&(y+="rotateY("+l+Xn),c!==Ln&&(y+="rotateX("+c+Xn),f===Ln&&h===Ln||(y+="skew("+f+", "+h+Xn),1===p&&1===d||(y+="scale("+p+", "+d+Xn),m.style[en]=y||"translate(0, 0)"},Un=function(t,e){var r,n,i,s,a,o=e||this,u=o.xPercent,l=o.yPercent,c=o.x,f=o.y,h=o.rotation,p=o.skewX,d=o.skewY,g=o.scaleX,_=o.scaleY,m=o.target,v=o.xOrigin,y=o.yOrigin,x=o.xOffset,b=o.yOffset,w=o.forceCSS,T=parseFloat(c),k=parseFloat(f);h=parseFloat(h),p=parseFloat(p),(d=parseFloat(d))&&(p+=d=parseFloat(d),h+=d),h||p?(h*=Ir,p*=Ir,r=Math.cos(h)*g,n=Math.sin(h)*g,i=Math.sin(h-p)*-_,s=Math.cos(h-p)*_,p&&(d*=Ir,a=Math.tan(p-d),i*=a=Math.sqrt(1+a*a),s*=a,d&&(a=Math.tan(d),r*=a=Math.sqrt(1+a*a),n*=a)),r=_t(r),n=_t(n),i=_t(i),s=_t(s)):(r=g,s=_,n=i=0),(T&&!~(c+"").indexOf("px")||k&&!~(f+"").indexOf("px"))&&(T=wn(m,"x",c,"px"),k=wn(m,"y",f,"px")),(v||y||x||b)&&(T=_t(T+v-(v*r+y*i)+x),k=_t(k+y-(v*n+y*s)+b)),(u||l)&&(a=m.getBBox(),T=_t(T+u/100*a.width),k=_t(k+l/100*a.height)),a="matrix("+r+","+n+","+i+","+s+","+T+","+k+")",m.setAttribute("transform",a),w&&(m.style[en]=a)},jn=function(t,e,r,n,i){var s,a,o=360,u=A(i),l=parseFloat(i)*(u&&~i.indexOf("rad")?Fr:1)-n,c=n+l+"deg";return u&&("short"===(s=i.split("_")[1])&&(l%=o)!==l%180&&(l+=l<0?o:-360),"cw"===s&&l<0?l=(l+36e9)%o-~~(l/o)*o:"ccw"===s&&l>0&&(l=(l-36e9)%o-~~(l/o)*o)),t._pt=a=new hr(t._pt,e,r,n,l,Ur),a.e=c,a.u="deg",t._props.push(r),a},Hn=function(t,e){for(var r in e)t[r]=e[r];return t},Wn=function(t,e,r){var n,i,s,a,o,u,l,c=Hn({},r._gsap),f=r.style;for(i in c.svg?(s=r.getAttribute("transform"),r.setAttribute("transform",""),f[en]=e,n=Fn(r,1),vn(r,en),r.setAttribute("transform",s)):(s=getComputedStyle(r)[en],f[en]=e,n=Fn(r,1),f[en]=s),zr)(s=c[i])!==(a=n[i])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(i)<0&&(o=te(s)!==(l=te(a))?wn(r,i,s,l):parseFloat(s),u=parseFloat(a),t._pt=new hr(t._pt,n,i,o,u-o,qr),t._pt.u=l||0,t._props.push(i));Hn(n,c)};gt("padding,margin,Width,Radius",function(t,e){var r="Top",n="Right",i="Bottom",s="Left",a=(e<3?[r,n,i,s]:[r+s,r+n,i+n,i+s]).map(function(r){return e<2?t+r:"border"+r+t});En[e>1?"border"+t:t]=function(t,e,r,n,i){var s,o;if(arguments.length<4)return s=a.map(function(e){return Tn(t,e,r)}),5===(o=s.join(" ")).split(s[0]).length?s[0]:o;s=(n+"").split(" "),o={},a.forEach(function(t,e){return o[t]=s[e]=s[e]||s[(e-1)/2|0]}),t.init(e,o,i)}});var Vn,Gn,Qn={name:"css",register:hn,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,r,n,i){var s,a,o,u,l,c,f,h,p,d,g,_,m,v,x,b,w,T=this._props,k=t.style,M=r.vars.startAt;for(f in Ar||hn(),this.styles=this.styles||on(t),b=this.styles.props,this.tween=r,e)if("autoRound"!==f&&(a=e[f],!ot[f]||!We(f,e,r,n,t,i)))if(l=typeof a,c=En[f],"function"===l&&(l=typeof(a=a.call(r,n,t,i))),"string"===l&&~a.indexOf("random(")&&(a=fe(a)),c)c(this,t,f,a,r)&&(x=1);else if("--"===f.substr(0,2))s=(getComputedStyle(t).getPropertyValue(f)+"").trim(),a+="",ke.lastIndex=0,ke.test(s)||(h=te(s),(p=te(a))?h!==p&&(s=wn(t,f,s,p)+p):h&&(a+=h)),this.add(k,"setProperty",s,a,n,i,0,0,f),T.push(f),b.push(f,0,k[f]);else if("undefined"!==l){if(M&&f in M?(s="function"==typeof M[f]?M[f].call(r,n,t,i):M[f],A(s)&&~s.indexOf("random(")&&(s=fe(s)),te(s+"")||"auto"===s||(s+=y.units[f]||te(Tn(t,f))||""),"="===(s+"").charAt(1)&&(s=Tn(t,f))):s=Tn(t,f),u=parseFloat(s),(d="string"===l&&"="===a.charAt(1)&&a.substr(0,2))&&(a=a.substr(2)),o=parseFloat(a),f in Xr&&("autoAlpha"===f&&(1===u&&"hidden"===Tn(t,"visibility")&&o&&(u=0),b.push("visibility",0,k.visibility),yn(this,k,"visibility",u?"inherit":"hidden",o?"inherit":"hidden",!o)),"scale"!==f&&"transform"!==f&&~(f=Xr[f]).indexOf(",")&&(f=f.split(",")[0])),g=f in zr){if(this.styles.save(f),w=a,"string"===l&&"var(--"===a.substring(0,6)){if("calc("===(a=ln(t,a.substring(4,a.indexOf(")")))).substring(0,5)){var O=t.style.perspective;t.style.perspective=a,a=ln(t,"perspective"),O?t.style.perspective=O:vn(t,"perspective")}o=parseFloat(a)}if(_||((m=t._gsap).renderTransform&&!e.parseTransform||Fn(t,e.parseTransform),v=!1!==e.smoothOrigin&&m.smooth,(_=this._pt=new hr(this._pt,k,en,0,1,m.renderTransform,m,0,-1)).dep=1),"scale"===f)this._pt=new hr(this._pt,m,"scaleY",m.scaleY,(d?vt(m.scaleY,d+o):o)-m.scaleY||0,qr),this._pt.u=0,T.push("scaleY",f),f+="X";else{if("transformOrigin"===f){b.push(rn,0,k[rn]),a=On(a),m.svg?zn(t,a,0,v,0,this):((p=parseFloat(a.split(" ")[2])||0)!==m.zOrigin&&yn(this,m,"zOrigin",m.zOrigin,p),yn(this,k,f,In(s),In(a)));continue}if("svgOrigin"===f){zn(t,a,1,v,0,this);continue}if(f in Sn){jn(this,m,f,u,d?vt(u,d+a):a);continue}if("smoothOrigin"===f){yn(this,m,"smooth",m.smooth,a);continue}if("force3D"===f){m[f]=a;continue}if("transform"===f){Wn(this,a,t);continue}}}else f in k||(f=fn(f)||f);if(g||(o||0===o)&&(u||0===u)&&!Nr.test(a)&&f in k)o||(o=0),(h=(s+"").substr((u+"").length))!==(p=te(a)||(f in y.units?y.units[f]:h))&&(u=wn(t,f,s,p)),this._pt=new hr(this._pt,g?m:k,f,u,(d?vt(u,d+o):o)-u,g||"px"!==p&&"zIndex"!==f||!1===e.autoRound?qr
1:Wr),this._pt.u=p||0,g&&w!==a?(this._pt.b=s,this._pt.e=w,this._pt.r=Hr):h!==p&&"%"!==p&&(this._pt.b=s,this._pt.r=jr);else if(f in k)kn.call(this,t,f,s,d?d+a:a);else if(f in t)this.add(t,f,s||t[f],d?d+a:a,n,i);else if("parseTransform"!==f){$(f,a);continue}g||(f in k?b.push(f,0,k[f]):"function"==typeof t[f]?b.push(f,2,t[f]()):b.push(f,1,s||t[f])),T.push(f)}x&&fr(this)},render:function(t,e){if(e.tween._time||!Dr())for(var r=e._pt;r;)r.r(t,r.d),r=r._next;else e.styles.revert()},get:Tn,aliases:Xr,getSetter:function(t,e,r){var n=Xr[e];return n&&n.indexOf(",")<0&&(e=n),e in zr&&e!==rn&&(t._gsap.x||Tn(t,"x"))?r&&Pr===r?"scale"===e?Kr:$r:(Pr=r||{})&&("scale"===e?Jr:tn):t.style&&!D(t.style[e])?Qr:~e.indexOf("-")?Zr:nr(t,e)},core:{_removeProperty:vn,_getMatrix:Rn}};Mr.utils.checkPrefix=fn,Mr.core.getStyleSaver=on,Gn=gt("x,y,z,scale,scaleX,scaleY,xPercent,yPercent"+","+(Vn="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",function(t){zr[t]=1}),gt(Vn,function(t){y.units[t]="deg",Sn[t]=1}),Xr[Gn[13]]="x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+Vn,gt("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",function(t){var e=t.split(":");Xr[e[1]]=Gn[e[0]]}),gt("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(t){y.units[t]="px"}),Mr.registerPlugin(Qn);var Zn=Mr.registerPlugin(Qn)||Mr;function $n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}Zn.core.Tween;var Kn,Jn,ti,ei,ri,ni,ii,si,ai,oi,ui,li,ci,fi=function(){return Kn||"undefined"!=typeof window&&(Kn=window.gsap)&&Kn.registerPlugin&&Kn},hi=1,pi=[],di=[],gi=[],_i=Date.now,mi=function(t,e){return e},vi=function(t,e){return~gi.indexOf(t)&&gi[gi.indexOf(t)+1][e]},yi=function(t){return!!~oi.indexOf(t)},xi=function(t,e,r,n,i){return t.addEventListener(e,r,{passive:!1!==n,capture:!!i})},bi=function(t,e,r,n){return t.removeEventListener(e,r,!!n)},wi="scrollLeft",Ti="scrollTop",ki=function(){return ui&&ui.isPressed||di.cache++},Mi=function(t,e){var r=function r(n){if(n||0===n){hi&&(ti.history.scrollRestoration="manual");var i=ui&&ui.isPressed;n=r.v=Math.round(n)||(ui&&ui.iOS?1:0),t(n),r.cacheID=di.cache,i&&mi("ss",n)}else(e||di.cache!==r.cacheID||mi("ref"))&&(r.cacheID=di.cache,r.v=t());return r.v+r.offset};return r.offset=0,t&&r},Oi={s:wi,p:"left",p2:"Left",os:"right",os2:"Right",d:"width",d2:"Width",a:"x",sc:Mi(function(t){return arguments.length?ti.scrollTo(t,Ci.sc()):ti.pageXOffset||ei[wi]||ri[wi]||ni[wi]||0})},Ci={s:Ti,p:"top",p2:"Top",os:"bottom",os2:"Bottom",d:"height",d2:"Height",a:"y",op:Oi,sc:Mi(function(t){return arguments.length?ti.scrollTo(Oi.sc(),t):ti.pageYOffset||ei[Ti]||ri[Ti]||ni[Ti]||0})},Ei=function(t,e){return(e&&e._ctx&&e._ctx.selector||Kn.utils.toArray)(t)[0]||("string"==typeof t&&!1!==Kn.config().nullTargetWarn?console.warn("Element not found:",t):null)},Ai=function(t,e){var r=e.s,n=e.sc;yi(t)&&(t=ei.scrollingElement||ri);var i=di.indexOf(t),s=n===Ci.sc?1:2;!~i&&(i=di.push(t)-1),di[i+s]||xi(t,"scroll",ki);var a=di[i+s],o=a||(di[i+s]=Mi(vi(t,r),!0)||(yi(t)?n:Mi(function(e){return arguments.length?t[r]=e:t[r]})));return o.target=t,a||(o.smooth="smooth"===Kn.getProperty(t,"scrollBehavior")),o},Si=function(t,e,r){var n=t,i=t,s=_i(),a=s,o=e||50,u=Math.max(500,3*o),l=function(t,e){var u=_i();e||u-s>o?(i=n,n=t,a=s,s=u):r?n+=t:n=i+(t-i)/(u-a)*(s-a)};return{update:l,reset:function(){i=n=r?0:n,a=s=0},getVelocity:function(t){var e=a,o=i,c=_i();return(t||0===t)&&t!==n&&l(t),s===a||c-a>u?0:(n+(r?o:-o))/((r?c:s)-e)*1e3}}},Pi=function(t,e){return e&&!t._gsapAllow&&!1!==t.cancelable&&t.preventDefault(),t.changedTouches?t.changedTouches[0]:t},Di=function(t){var e=Math.max.apply(Math,t),r=Math.min.apply(Math,t);return Math.abs(e)>=Math.abs(r)?e:r},Ri=function(){var t,e,r,n;(ai=Kn.core.globals().ScrollTrigger)&&ai.core&&(t=ai.core,e=t.bridge||{},r=t._scrollers,n=t._proxies,r.push.apply(r,di),n.push.apply(n,gi),di=r,gi=n,mi=function(t,r){return e[t](r)})},zi=function(t){return Kn=t||fi(),!Jn&&Kn&&"undefined"!=typeof document&&document.body&&(ti=window,ei=document,ri=ei.documentElement,ni=ei.body,oi=[ti,ei,ri,ni],Kn.utils.clamp,ci=Kn.core.context||function(){},si="onpointerenter"in ni?"pointer":"mouse",ii=Fi.isTouch=ti.matchMedia&&ti.matchMedia("(hover: none), (pointer: coarse)").matches?1:"ontouchstart"in ti||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?2:0,li=Fi.eventTypes=("ontouchstart"in ri?"touchstart,touchmove,touchcancel,touchend":"onpointerdown"in ri?"pointerdown,pointermove,pointercancel,pointerup":"mousedown,mousemove,mouseup,mouseup").split(","),setTimeout(function(){return hi=0},500),Jn=1),ai||Ri(),Jn};Oi.op=Ci,di.cache=0;var Fi=function(){function t(t){this.init(t)}var e,r;return t.prototype.init=function(t){Jn||zi(Kn)||console.warn("Please gsap.registerPlugin(Observer)"),ai||Ri();var e=t.tolerance,r=t.dragMinimum,n=t.type,i=t.target,s=t.lineHeight,a=t.debounce,o=t.preventDefault,u=t.onStop,l=t.onStopDelay,c=t.ignore,f=t.wheelSpeed,h=t.event,p=t.onDragStart,d=t.onDragEnd,g=t.onDrag,_=t.onPress,m=t.onRelease,v=t.onRight,y=t.onLeft,x=t.onUp,b=t.onDown,w=t.onChangeX,T=t.onChangeY,k=t.onChange,M=t.onToggleX,O=t.onToggleY,C=t.onHover,E=t.onHoverEnd,A=t.onMove,S=t.ignoreCheck,P=t.isNormalizer,D=t.onGestureStart,R=t.onGestureEnd,z=t.onWheel,F=t.onEnable,I=t.onDisable,Y=t.onClick,B=t.scrollSpeed,L=t.capture,N=t.allowClicks,X=t.lockAxis,q=t.onLockAxis;this.target=i=Ei(i)||ri,this.vars=t,c&&(c=Kn.utils.toArray(c)),e=e||1e-9,r=r||0,f=f||1,B=B||1,n=n||"wheel,touch,pointer",a=!1!==a,s||(s=parseFloat(ti.getComputedStyle(ni).lineHeight)||22);var U,j,H,W,V,G,Q,Z=this,$=0,K=0,J=t.passive||!o&&!1!==t.passive,tt=Ai(i,Oi),et=Ai(i,Ci),rt=tt(),nt=et(),it=~n.indexOf("touch")&&!~n.indexOf("pointer")&&"pointerdown"===li[0],st=yi(i),at=i.ownerDocument||ei,ot=[0,0,0],ut=[0,0,0],lt=0,ct=function(){return lt=_i()},ft=function(t,e){return(Z.event=t)&&c&&function(t,e){for(var r=e.length;r--;)if(e[r]===t||e[r].contains(t))return!0;return!1}(t.target,c)||e&&it&&"touch"!==t.pointerType||S&&S(t,e)},ht=function(){var t=Z.deltaX=Di(ot),r=Z.deltaY=Di(ut),n=Math.abs(t)>=e,i=Math.abs(r)>=e;k&&(n||i)&&k(Z,t,r,ot,ut),n&&(v&&Z.deltaX>0&&v(Z),y&&Z.deltaX<0&&y(Z),w&&w(Z),M&&Z.deltaX<0!=$<0&&M(Z),$=Z.deltaX,ot[0]=ot[1]=ot[2]=0),i&&(b&&Z.deltaY>0&&b(Z),x&&Z.deltaY<0&&x(Z),T&&T(Z),O&&Z.deltaY<0!=K<0&&O(Z),K=Z.deltaY,ut[0]=ut[1]=ut[2]=0),(W||H)&&(A&&A(Z),H&&(p&&1===H&&p(Z),g&&g(Z),H=0),W=!1),G&&!(G=!1)&&q&&q(Z),V&&(z(Z),V=!1),U=0},pt=function(t,e,r){ot[r]+=t,ut[r]+=e,Z._vx.update(t),Z._vy.update(e),a?U||(U=requestAnimationFrame(ht)):ht()},dt=function(t,e){X&&!Q&&(Z.axis=Q=Math.abs(t)>Math.abs(e)?"x":"y",G=!0),"y"!==Q&&(ot[2]+=t,Z._vx.update(t,!0)),"x"!==Q&&(ut[2]+=e,Z._vy.update(e,!0)),a?U||(U=requestAnimationFrame(ht)):ht()},gt=function(t){if(!ft(t,1)){var e=(t=Pi(t,o)).clientX,n=t.clientY,i=e-Z.x,s=n-Z.y,a=Z.isDragging;Z.x=e,Z.y=n,(a||(i||s)&&(Math.abs(Z.startX-e)>=r||Math.abs(Z.startY-n)>=r))&&(H||(H=a?2:1),a||(Z.isDragging=!0),dt(i,s))}},_t=Z.onPress=function(t){ft(t,1)||t&&t.button||(Z.axis=Q=null,j.pause(),Z.isPressed=!0,t=Pi(t),$=K=0,Z.startX=Z.x=t.clientX,Z.startY=Z.y=t.clientY,Z._vx.reset(),Z._vy.reset(),xi(P?i:at,li[1],gt,J,!0),Z.deltaX=Z.deltaY=0,_&&_(Z))},mt=Z.onRelease=function(t){if(!ft(t,1)){bi(P?i:at,li[1],gt,!0);var e=!isNaN(Z.y-Z.startY),r=Z.isDragging,n=r&&(Math.abs(Z.x-Z.startX)>3||Math.abs(Z.y-Z.startY)>3),s=Pi(t);!n&&e&&(Z._vx.reset(),Z._vy.reset(),o&&N&&Kn.delayedCall(.08,function(){if(_i()-lt>300&&!t.defaultPrevented)if(t.target.click)t.target.click();else if(at.createEvent){var e=at.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,ti,1,s.screenX,s.screenY,s.clientX,s.clientY,!1,!1,!1,!1,0,null),t.target.dispatchEvent(e)}})),Z.isDragging=Z.isGesturing=Z.isPressed=!1,u&&r&&!P&&j.restart(!0),H&&ht(),d&&r&&d(Z),m&&m(Z,n)}},vt=function(t){return t.touches&&t.touches.length>1&&(Z.isGesturing=!0)&&D(t,Z.isDragging)},yt=function(){return(Z.isGesturing=!1)||R(Z)}
1,xt=function(t){if(!ft(t)){var e=tt(),r=et();pt((e-rt)*B,(r-nt)*B,1),rt=e,nt=r,u&&j.restart(!0)}},bt=function(t){if(!ft(t)){t=Pi(t,o),z&&(V=!0);var e=(1===t.deltaMode?s:2===t.deltaMode?ti.innerHeight:1)*f;pt(t.deltaX*e,t.deltaY*e,0),u&&!P&&j.restart(!0)}},wt=function(t){if(!ft(t)){var e=t.clientX,r=t.clientY,n=e-Z.x,i=r-Z.y;Z.x=e,Z.y=r,W=!0,u&&j.restart(!0),(n||i)&&dt(n,i)}},Tt=function(t){Z.event=t,C(Z)},kt=function(t){Z.event=t,E(Z)},Mt=function(t){return ft(t)||Pi(t,o)&&Y(Z)};j=Z._dc=Kn.delayedCall(l||.25,function(){Z._vx.reset(),Z._vy.reset(),j.pause(),u&&u(Z)}).pause(),Z.deltaX=Z.deltaY=0,Z._vx=Si(0,50,!0),Z._vy=Si(0,50,!0),Z.scrollX=tt,Z.scrollY=et,Z.isDragging=Z.isGesturing=Z.isPressed=!1,ci(this),Z.enable=function(t){return Z.isEnabled||(xi(st?at:i,"scroll",ki),n.indexOf("scroll")>=0&&xi(st?at:i,"scroll",xt,J,L),n.indexOf("wheel")>=0&&xi(i,"wheel",bt,J,L),(n.indexOf("touch")>=0&&ii||n.indexOf("pointer")>=0)&&(xi(i,li[0],_t,J,L),xi(at,li[2],mt),xi(at,li[3],mt),N&&xi(i,"click",ct,!0,!0),Y&&xi(i,"click",Mt),D&&xi(at,"gesturestart",vt),R&&xi(at,"gestureend",yt),C&&xi(i,si+"enter",Tt),E&&xi(i,si+"leave",kt),A&&xi(i,si+"move",wt)),Z.isEnabled=!0,Z.isDragging=Z.isGesturing=Z.isPressed=W=H=!1,Z._vx.reset(),Z._vy.reset(),rt=tt(),nt=et(),t&&t.type&&_t(t),F&&F(Z)),Z},Z.disable=function(){Z.isEnabled&&(pi.filter(function(t){return t!==Z&&yi(t.target)}).length||bi(st?at:i,"scroll",ki),Z.isPressed&&(Z._vx.reset(),Z._vy.reset(),bi(P?i:at,li[1],gt,!0)),bi(st?at:i,"scroll",xt,L),bi(i,"wheel",bt,L),bi(i,li[0],_t,L),bi(at,li[2],mt),bi(at,li[3],mt),bi(i,"click",ct,!0),bi(i,"click",Mt),bi(at,"gesturestart",vt),bi(at,"gestureend",yt),bi(i,si+"enter",Tt),bi(i,si+"leave",kt),bi(i,si+"move",wt),Z.isEnabled=Z.isPressed=Z.isDragging=!1,I&&I(Z))},Z.kill=Z.revert=function(){Z.disable();var t=pi.indexOf(Z);t>=0&&pi.splice(t,1),ui===Z&&(ui=0)},pi.push(Z),P&&yi(i)&&(ui=Z),Z.enable(h)},e=t,(r=[{key:"velocityX",get:function(){return this._vx.getVelocity()}},{key:"velocityY",get:function(){return this._vy.getVelocity()}}])&&$n(e.prototype,r),t}();Fi.version="3.15.0",Fi.create=function(t){return new Fi(t)},Fi.register=zi,Fi.getAll=function(){return pi.slice()},Fi.getById=function(t){return pi.filter(function(e){return e.vars.id===t})[0]},fi()&&Kn.registerPlugin(Fi);var Ii,Yi,Bi,Li,Ni,Xi,qi,Ui,ji,Hi,Wi,Vi,Gi,Qi,Zi,$i,Ki,Ji,ts,es,rs,ns,is,ss,as,os,us,ls,cs,fs,hs,ps,ds,gs,_s,ms,vs,ys,xs=1,bs=Date.now,ws=bs(),Ts=0,ks=0,Ms=function(t,e,r){var n=Ls(t)&&("clamp("===t.substr(0,6)||t.indexOf("max")>-1);return r["_"+e+"Clamp"]=n,n?t.substr(6,t.length-7):t},Os=function(t,e){return!e||Ls(t)&&"clamp("===t.substr(0,6)?t:"clamp("+t+")"},Cs=function t(){return ks&&requestAnimationFrame(t)},Es=function(){return Qi=1},As=function(){return Qi=0},Ss=function(t){return t},Ps=function(t){return Math.round(1e5*t)/1e5||0},Ds=function(){return"undefined"!=typeof window},Rs=function(){return Ii||Ds()&&(Ii=window.gsap)&&Ii.registerPlugin&&Ii},zs=function(t){return!!~qi.indexOf(t)},Fs=function(t){return("Height"===t?hs:Bi["inner"+t])||Ni["client"+t]||Xi["client"+t]},Is=function(t){return vi(t,"getBoundingClientRect")||(zs(t)?function(){return Za.width=Bi.innerWidth,Za.height=hs,Za}:function(){return ua(t)})},Ys=function(t,e){var r=e.s,n=e.d2,i=e.d,s=e.a;return Math.max(0,(r="scroll"+n)&&(s=vi(t,r))?s()-Is(t)()[i]:zs(t)?(Ni[r]||Xi[r])-Fs(n):t[r]-t["offset"+n])},Bs=function(t,e){for(var r=0;r<ts.length;r+=3)(!e||~e.indexOf(ts[r+1]))&&t(ts[r],ts[r+1],ts[r+2])},Ls=function(t){return"string"==typeof t},Ns=function(t){return"function"==typeof t},Xs=function(t){return"number"==typeof t},qs=function(t){return"object"==typeof t},Us=function(t,e,r){return t&&t.progress(e?0:1)&&r&&t.pause()},js=function(t,e,r){if(t.enabled){var n=t._ctx?t._ctx.add(function(){return e(t,r)}):e(t,r);n&&n.totalTime&&(t.callbackAnimation=n)}},Hs=Math.abs,Ws="left",Vs="right",Gs="bottom",Qs="width",Zs="height",$s="Right",Ks="Left",Js="Top",ta="Bottom",ea="padding",ra="margin",na="Width",ia="Height",sa="px",aa=function(t){return Bi.getComputedStyle(t.nodeType===Node.DOCUMENT_NODE?t.scrollingElement:t)},oa=function(t,e){for(var r in e)r in t||(t[r]=e[r]);return t},ua=function(t,e){var r=e&&"matrix(1, 0, 0, 1, 0, 0)"!==aa(t)[Zi]&&Ii.to(t,{x:0,y:0,xPercent:0,yPercent:0,rotation:0,rotationX:0,rotationY:0,scale:1,skewX:0,skewY:0}).progress(1),n=t.getBoundingClientRect?t.getBoundingClientRect():t.scrollingElement.getBoundingClientRect();return r&&r.progress(0).kill(),n},la=function(t,e){var r=e.d2;return t["offset"+r]||t["client"+r]||0},ca=function(t){var e,r=[],n=t.labels,i=t.duration();for(e in n)r.push(n[e]/i);return r},fa=function(t){var e=Ii.utils.snap(t),r=Array.isArray(t)&&t.slice(0).sort(function(t,e){return t-e});return r?function(t,n,i){var s;if(void 0===i&&(i=.001),!n)return e(t);if(n>0){for(t-=i,s=0;s<r.length;s++)if(r[s]>=t)return r[s];return r[s-1]}for(s=r.length,t+=i;s--;)if(r[s]<=t)return r[s];return r[0]}:function(r,n,i){void 0===i&&(i=.001);var s=e(r);return!n||Math.abs(s-r)<i||s-r<0==n<0?s:e(n<0?r-t:r+t)}},ha=function(t,e,r,n){return r.split(",").forEach(function(r){return t(e,r,n)})},pa=function(t,e,r,n,i){return t.addEventListener(e,r,{passive:!n,capture:!!i})},da=function(t,e,r,n){return t.removeEventListener(e,r,!!n)},ga=function(t,e,r){(r=r&&r.wheelHandler)&&(t(e,"wheel",r),t(e,"touchmove",r))},_a={startColor:"green",endColor:"red",indent:0,fontSize:"16px",fontWeight:"normal"},ma={toggleActions:"play",anticipatePin:0},va={top:0,left:0,center:.5,bottom:1,right:1},ya=function(t,e){if(Ls(t)){var r=t.indexOf("="),n=~r?+(t.charAt(r-1)+1)*parseFloat(t.substr(r+1)):0;~r&&(t.indexOf("%")>r&&(n*=e/100),t=t.substr(0,r-1)),t=n+(t in va?va[t]*e:~t.indexOf("%")?parseFloat(t)*e/100:parseFloat(t)||0)}return t},xa=function(t,e,r,n,i,s,a,o){var u=i.startColor,l=i.endColor,c=i.fontSize,f=i.indent,h=i.fontWeight,p=Li.createElement("div"),d=zs(r)||"fixed"===vi(r,"pinType"),g=-1!==t.indexOf("scroller"),_=d?Xi:"IFRAME"===r.tagName?r.contentDocument.body:r,m=-1!==t.indexOf("start"),v=m?u:l,y="border-color:"+v+";font-size:"+c+";color:"+v+";font-weight:"+h+";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;";return y+="position:"+((g||o)&&d?"fixed;":"absolute;
1"),(g||o||!d)&&(y+=(n===Ci?Vs:Gs)+":"+(s+parseFloat(f))+"px;"),a&&(y+="box-sizing:border-box;text-align:left;width:"+a.offsetWidth+"px;"),p._isStart=m,p.setAttribute("class","gsap-marker-"+t+(e?" marker-"+e:"")),p.style.cssText=y,p.innerText=e||0===e?t+"-"+e:t,_.children[0]?_.insertBefore(p,_.children[0]):_.appendChild(p),p._offset=p["offset"+n.op.d2],ba(p,0,n,m),p},ba=function(t,e,r,n){var i={display:"block"},s=r[n?"os2":"p2"],a=r[n?"p2":"os2"];t._isFlipped=n,i[r.a+"Percent"]=n?-100:0,i[r.a]=n?"1px":0,i["border"+s+na]=1,i["border"+a+na]=0,i[r.p]=e+"px",Ii.set(t,i)},wa=[],Ta={},ka=function(){return bs()-Ts>34&&(_s||(_s=requestAnimationFrame(Ua)))},Ma=function(){(!is||!is.isPressed||is.startX>Xi.clientWidth)&&(di.cache++,is?_s||(_s=requestAnimationFrame(Ua)):Ua(),Ts||Pa("scrollStart"),Ts=bs())},Oa=function(){os=Bi.innerWidth,as=Bi.innerHeight},Ca=function(t){di.cache++,(!0===t||!Gi&&!ns&&!Li.fullscreenElement&&!Li.webkitFullscreenElement&&(!ss||os!==Bi.innerWidth||Math.abs(Bi.innerHeight-as)>.25*Bi.innerHeight))&&Ui.restart(!0)},Ea={},Aa=[],Sa=function t(){return da(no,"scrollEnd",t)||Na(!0)},Pa=function(t){return Ea[t]&&Ea[t].map(function(t){return t()})||Aa},Da=[],Ra=function(t){for(var e=0;e<Da.length;e+=5)(!t||Da[e+4]&&Da[e+4].query===t)&&(Da[e].style.cssText=Da[e+1],Da[e].getBBox&&Da[e].setAttribute("transform",Da[e+2]||""),Da[e+3].uncache=1)},za=function(){return di.forEach(function(t){return Ns(t)&&++t.cacheID&&(t.rec=t())})},Fa=function(t,e){var r;for($i=0;$i<wa.length;$i++)!(r=wa[$i])||e&&r._ctx!==e||(t?r.kill(1):r.revert(!0,!0));ps=!0,e&&Ra(e),e||Pa("revert")},Ia=function(t,e){di.cache++,(e||!ms)&&di.forEach(function(t){return Ns(t)&&t.cacheID++&&(t.rec=0)}),Ls(t)&&(Bi.history.scrollRestoration=cs=t)},Ya=0,Ba=function(){Xi.appendChild(fs),hs=!is&&fs.offsetHeight||Bi.innerHeight,Xi.removeChild(fs)},La=function(t){return ji(".gsap-marker-start, .gsap-marker-end, .gsap-marker-scroller-start, .gsap-marker-scroller-end").forEach(function(e){return e.style.display=t?"none":"block"})},Na=function(t,e){if(Ni=Li.documentElement,Xi=Li.body,qi=[Bi,Li,Ni,Xi],!Ts||t||ps){Ba(),ms=no.isRefreshing=!0,ps||za();var r=Pa("refreshInit");es&&no.sort(),e||Fa(),di.forEach(function(t){Ns(t)&&(t.smooth&&(t.target.style.scrollBehavior="auto"),t(0))}),wa.slice(0).forEach(function(t){return t.refresh()}),ps=!1,wa.forEach(function(t){if(t._subPinOffset&&t.pin){var e=t.vars.horizontal?"offsetWidth":"offsetHeight",r=t.pin[e];t.revert(!0,1),t.adjustPinSpacing(t.pin[e]-r),t.refresh()}}),ds=1,La(!0),wa.forEach(function(t){var e=Ys(t.scroller,t._dir),r="max"===t.vars.end||t._endClamp&&t.end>e,n=t._startClamp&&t.start>=e;(r||n)&&t.setPositions(n?e-1:t.start,r?Math.max(n?e:t.start+1,e):t.end,!0)}),La(!1),ds=0,r.forEach(function(t){return t&&t.render&&t.render(-1)}),di.forEach(function(t){Ns(t)&&(t.smooth&&requestAnimationFrame(function(){return t.target.style.scrollBehavior="smooth"}),t.rec&&t(t.rec))}),Ia(cs,1),Ui.pause(),Ya++,ms=2,Ua(2),wa.forEach(function(t){return Ns(t.vars.onRefresh)&&t.vars.onRefresh(t)}),ms=no.isRefreshing=!1,Pa("refresh")}else pa(no,"scrollEnd",Sa)},Xa=0,qa=1,Ua=function(t){if(2===t||!ms&&!ps){no.isUpdating=!0,ys&&ys.update(0);var e=wa.length,r=bs(),n=r-ws>=50,i=e&&wa[0].scroll();if(qa=Xa>i?-1:1,ms||(Xa=i),n&&(Ts&&!Qi&&r-Ts>200&&(Ts=0,Pa("scrollEnd")),Wi=ws,ws=r),qa<0){for($i=e;$i-- >0;)wa[$i]&&wa[$i].update(0,n);qa=1}else for($i=0;$i<e;$i++)wa[$i]&&wa[$i].update(0,n);no.isUpdating=!1}_s=0},ja=[Ws,"top",Gs,Vs,ra+ta,ra+$s,ra+Js,ra+Ks,"display","flexShrink","float","zIndex","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","gridArea","justifySelf","alignSelf","placeSelf","order"],Ha=ja.concat([Qs,Zs,"boxSizing","max"+na,"max"+ia,"position",ra,ea,ea+Js,ea+$s,ea+ta,ea+Ks]),Wa=function(t,e,r,n){if(!t._gsap.swappedIn){for(var i,s=ja.length,a=e.style,o=t.style;s--;)a[i=ja[s]]=r[i];a.position="absolute"===r.position?"absolute":"relative","inline"===r.display&&(a.display="inline-block"),o[Gs]=o[Vs]="auto",a.flexBasis=r.flexBasis||"auto",a.overflow="visible",a.boxSizing="border-box",a[Qs]=la(t,Oi)+sa,a[Zs]=la(t,Ci)+sa,a[ea]=o[ra]=o.top=o[Ws]="0",Ga(n),o[Qs]=o["max"+na]=r[Qs],o[Zs]=o["max"+ia]=r[Zs],o[ea]=r[ea],t.parentNode!==e&&(t.parentNode.insertBefore(e,t),e.appendChild(t)),t._gsap.swappedIn=!0}},Va=/([A-Z])/g,Ga=function(t){if(t){var e,r,n=t.t.style,i=t.length,s=0;for((t.t._gsap||Ii.core.getCache(t.t)).uncache=1;s<i;
1s+=2)r=t[s+1],e=t[s],r?n[e]=r:n[e]&&n.removeProperty(e.replace(Va,"-$1").toLowerCase())}},Qa=function(t){for(var e=Ha.length,r=t.style,n=[],i=0;i<e;i++)n.push(Ha[i],r[Ha[i]]);return n.t=t,n},Za={left:0,top:0},$a=function(t,e,r,n,i,s,a,o,u,l,c,f,h,p){Ns(t)&&(t=t(o)),Ls(t)&&"max"===t.substr(0,3)&&(t=f+("="===t.charAt(4)?ya("0"+t.substr(3),r):0));var d,g,_,m=h?h.time():0;if(h&&h.seek(0),isNaN(t)||(t=+t),Xs(t))h&&(t=Ii.utils.mapRange(h.scrollTrigger.start,h.scrollTrigger.end,0,f,t)),a&&ba(a,r,n,!0);else{Ns(e)&&(e=e(o));var v,y,x,b,w=(t||"0").split(" ");_=Ei(e,o)||Xi,(v=ua(_)||{})&&(v.left||v.top)||"none"!==aa(_).display||(b=_.style.display,_.style.display="block",v=ua(_),b?_.style.display=b:_.style.removeProperty("display")),y=ya(w[0],v[n.d]),x=ya(w[1]||"0",r),t=v[n.p]-u[n.p]-l+y+i-x,a&&ba(a,x,n,r-x<20||a._isStart&&x>20),r-=r-x}if(p&&(o[p]=t||-.001,t<0&&(t=0)),s){var T=t+r,k=s._isStart;d="scroll"+n.d2,ba(s,T,n,k&&T>20||!k&&(c?Math.max(Xi[d],Ni[d]):s.parentNode[d])<=T+1),c&&(u=ua(a),c&&(s.style[n.op.p]=u[n.op.p]-n.op.m-s._offset+sa))}return h&&_&&(d=ua(_),h.seek(f),g=ua(_),h._caScrollDist=d[n.p]-g[n.p],t=t/h._caScrollDist*f),h&&h.seek(m),h?t:Math.round(t)},Ka=/(webkit|moz|length|cssText|inset)/i,Ja=function(t,e,r,n){if(t.parentNode!==e){var i,s,a=t.style;if(e===Xi){for(i in t._stOrig=a.cssText,s=aa(t))+i||Ka.test(i)||!s[i]||"string"!=typeof a[i]||"0"===i||(a[i]=s[i]);a.top=r,a.left=n}else a.cssText=t._stOrig;Ii.core.getCache(t).uncache=1,e.appendChild(t)}},to=function(t,e,r){var n=e,i=n;return function(e){var s=Math.round(t());return s!==n&&s!==i&&Math.abs(s-n)>3&&Math.abs(s-i)>3&&(e=s,r&&r()),i=n,n=Math.round(e)}},eo=function(t,e,r){var n={};n[e.p]="+="+r,Ii.set(t,n)},ro=function(t,e){var r=Ai(t,e),n="_scroll"+e.p2,i=function e(i,s,a,o,u){var l=e.tween,c=s.onComplete,f={};a=a||r();var h=to(r,a,function(){l.kill(),e.tween=0});return u=o&&u||0,o=o||i-a,l&&l.kill(),s[n]=i,s.inherit=!1,s.modifiers=f,f[n]=function(){return h(a+o*l.ratio+u*l.ratio*l.ratio)},s.onUpdate=function(){di.cache++,e.tween&&Ua()},s.onComplete=function(){e.tween=0,c&&c.call(l)},l=e.tween=Ii.to(t,s)};return t[n]=r,r.wheelHandler=function(){return i.tween&&i.tween.kill()&&(i.tween=0)},pa(t,"wheel",r.wheelHandler),no.isTouch&&pa(t,"touchmove",r.wheelHandler),i},no=function(){function t(e,r){Yi||t.register(Ii)||console.warn("Please gsap.registerPlugin(ScrollTrigger)"),ls(this),this.init(e,r)}return t.prototype.init=function(e,r){if(this.progress=this.start=0,this.vars&&this.kill(!0,!0),ks){var n,i,s,a,o,u,l,c,f,h,p,d,g,_,m,v,y,x,b,w,T,k,M,O,C,E,A,S,P,D,R,z,F,I,Y,B,L,N,X,q,U,j,H=e=oa(Ls(e)||Xs(e)||e.nodeType?{trigger:e}:e,ma),W=H.onUpdate,V=H.toggleClass,G=H.id,Q=H.onToggle,Z=H.onRefresh,$=H.scrub,K=H.trigger,J=H.pin,tt=H.pinSpacing,et=H.invalidateOnRefresh,rt=H.anticipatePin,nt=H.onScrubComplete,it=H.onSnapComplete,st=H.once,at=H.snap,ot=H.pinReparent,ut=H.pinSpacer,lt=H.containerAnimation,ct=H.fastScrollEnd,ft=H.preventOverlaps,ht=e.horizontal||e.containerAnimation&&!1!==e.horizontal?Oi:Ci,pt=!$&&0!==$,dt=Ei(e.scroller||Bi),gt=Ii.core.getCache(dt),_t=zs(dt),mt="fixed"===("pinType"in e?e.pinType:vi(dt,"pinType")||_t&&"fixed"),vt=[e.onEnter,e.onLeave,e.onEnterBack,e.onLeaveBack],yt=pt&&e.toggleActions.split(" "),xt="markers"in e?e.markers:ma.markers,bt=_t?0:parseFloat(aa(dt)["border"+ht.p2+na])||0,wt=this,Tt=e.onRefreshInit&&function(){return e.onRefreshInit(wt)},kt=function(t,e,r){var n=r.d,i=r.d2,s=r.a;return(s=vi(t,"getBoundingClientRect"))?function(){return s()[n]}:function(){return(e?Fs(i):t["client"+i])||0}}(dt,_t,ht),Mt=function(t,e){return!e||~gi.indexOf(t)?Is(t):function(){return Za}}(dt,_t),Ot=0,Ct=0,Et=0,At=Ai(dt,ht);if(wt._startClamp=wt._endClamp=!1,wt._dir=ht,rt*=45,wt.scroller=dt,wt.scroll=lt?lt.time.bind(lt):At,a=At(),wt.vars=e,r=r||e.animation,"refreshPriority"in e&&(es=1,-9999===e.refreshPriority&&(ys=wt)),gt.tweenScroll=gt.tweenScroll||{top:ro(dt,Ci),left:ro(dt,Oi)},wt.tweenTo=n=gt.tweenScroll[ht.p],wt.scrubDuration=function(t){(F=Xs(t)&&t)?z?z.duration(t):z=Ii.to(r,{ease:"expo",totalProgress:"+=0",inherit:!1,duration:F,paused:!0,onComplete:function(){return nt&&nt(wt)}}):(z&&z.progress(1).kill(),z=0)},r&&(r.vars.lazy=!1,r._initted&&!wt.isReverted||!1!==r.vars.immediateRender&&!1!==e.immediateRender&&r.duration()&&r.render(0,!0,!0),wt.animation=r.pause(),r.scrollTrigger=wt,wt.scrubDuration($),D=0,G||(G=r.vars.id)),at&&(qs(at)&&!at.push||(at={snapTo:at}),"scrollBehavior"in Xi.style&&Ii.set(_t?[Xi,Ni]:dt,{scrollBehavior:"auto"}),di.forEach(function(t){return Ns(t)&&t.target===(_t?Li.scrollingElement||Ni:dt)&&(t.smooth=!1)}),s=Ns(at.snapTo)?at.snapTo:"labels"===at.snapTo?function(t){return function(e){return Ii.utils.snap(ca(t),e)}}(r):"labelsDirectional"===at.snapTo?(q=r,function(t,e){return fa(ca(q))(t,e.direction)}):!1!==at.directional?function(t,e){return fa(at.snapTo)(t,bs()-Ct<500?0:e.direction)}:Ii.utils.snap(at.snapTo),I=at.duration||{min:.1,max:2},I=qs(I)?Hi(I.min,I.max):Hi(I,I),Y=Ii.delayedCall(at.delay||F/2||.1,function(){var t=At(),e=bs()-Ct<500,i=n.tween;if(!(e||Math.abs(wt.getVelocity())<10)||i||Qi||Ot===t)wt.isActive&&Ot!==t&&Y.restart(!0);else{var a,o,c=(t-u)/_,f=r&&!pt?r.totalProgress():c,h=e?0:(f-R)/(bs()-Wi)*1e3||0,p=Ii.utils.clamp(-c,1-c,Hs(h/2)*h/.185),d=c+(!1===at.inertia?0:p),g=at,m=g.onStart,v=g.onInterrupt,y=g.onComplete;
vendor: 4,541 bytes, line 1
1if(a=s(d,wt),Xs(a)||(a=d),o=Math.max(0,Math.round(u+a*_)),t<=l&&t>=u&&o!==t){if(i&&!i._initted&&i.data<=Hs(o-t))return;!1===at.inertia&&(p=a-c),n(o,{duration:I(Hs(.185*Math.max(Hs(d-f),Hs(a-f))/h/.05||0)),ease:at.ease||"power3",data:Hs(o-t),onInterrupt:function(){return Y.restart(!0)&&v&&js(wt,v)},onComplete:function(){wt.update(),Ot=At(),r&&!pt&&(z?z.resetTo("totalProgress",a,r._tTime/r._tDur):r.progress(a)),D=R=r&&!pt?r.totalProgress():wt.progress,it&&it(wt),y&&js(wt,y)}},t,p*_,o-t-p*_),m&&js(wt,m,n.tween)}}}).pause()),G&&(Ta[G]=wt),(X=(K=wt.trigger=Ei(K||!0!==J&&J))&&K._gsap&&K._gsap.stRevert)&&(X=X(wt)),J=!0===J?K:Ei(J),Ls(V)&&(V={targets:K,className:V}),J&&(!1===tt||tt===ra||(tt=!(!tt&&J.parentNode&&J.parentNode.style&&"flex"===aa(J.parentNode).display)&&ea),wt.pin=J,(i=Ii.core.getCache(J)).spacer?m=i.pinState:(ut&&((ut=Ei(ut))&&!ut.nodeType&&(ut=ut.current||ut.nativeElement),i.spacerIsNative=!!ut,ut&&(i.spacerState=Qa(ut))),i.spacer=x=ut||Li.createElement("div"),x.classList.add("pin-spacer"),G&&x.classList.add("pin-spacer-"+G),i.pinState=m=Qa(J)),!1!==e.force3D&&Ii.set(J,{force3D:!0}),wt.spacer=x=i.spacer,P=aa(J),O=P[tt+ht.os2],w=Ii.getProperty(J),T=Ii.quickSetter(J,ht.a,sa),Wa(J,x,P),y=Qa(J)),xt){d=qs(xt)?oa(xt,_a):_a,h=xa("scroller-start",G,dt,ht,d,0),p=xa("scroller-end",G,dt,ht,d,0,h),b=h["offset"+ht.op.d2];var St=Ei(vi(dt,"content")||dt);c=this.markerStart=xa("start",G,St,ht,d,b,0,lt),f=this.markerEnd=xa("end",G,St,ht,d,b,0,lt),lt&&(N=Ii.quickSetter([c,f],ht.a,sa)),mt||gi.length&&!0===vi(dt,"fixedMarkers")||(j=aa(U=_t?Xi:dt).position,U.style.position="absolute"===j||"fixed"===j?j:"relative",Ii.set([h,p],{force3D:!0}),E=Ii.quickSetter(h,ht.a,sa),S=Ii.quickSetter(p,ht.a,sa))}if(lt){var Pt=lt.vars.onUpdate,Dt=lt.vars.onUpdateParams;lt.eventCallback("onUpdate",function(){wt.update(0,0,1),Pt&&Pt.apply(lt,Dt||[])})}if(wt.previous=function(){return wa[wa.indexOf(wt)-1]},wt.next=function(){return wa[wa.indexOf(wt)+1]},wt.revert=function(t,e){if(!e)return wt.kill(!0);var n=!1!==t||!wt.enabled,i=Gi;n!==wt.isReverted&&(n&&(B=Math.max(At(),wt.scroll.rec||0),Et=wt.progress,L=r&&r.progress()),c&&[c,f,h,p].forEach(function(t){return t.style.display=n?"none":"block"}),n&&(Gi=wt,wt.update(n)),!J||ot&&wt.isActive||(n?function(t,e,r){Ga(r);var n=t._gsap;if(n.spacerIsNative)Ga(n.spacerState);else if(t._gsap.swappedIn){var i=e.parentNode;i&&(i.insertBefore(t,e),i.removeChild(e))}t._gsap.swappedIn=!1}(J,x,m):Wa(J,x,aa(J),C)),n||wt.update(n),Gi=i,wt.isReverted=n)},wt.refresh=function(i,s,d,b){if(!Gi&&wt.enabled||s)if(J&&i&&Ts)pa(t,"scrollEnd",Sa);else{!ms&&Tt&&Tt(wt),Gi=wt,n.tween&&!d&&(n.tween.kill(),n.tween=0),z&&z.pause(),et&&r&&(r.revert({kill:!1}).invalidate(),r.getChildren?r.getChildren(!0,!0,!1).forEach(function(t){return t.vars.immediateRender&&t.render(0,!0,!0)}):r.vars.immediateRender&&r.render(0,!0,!0)),wt.isReverted||wt.revert(!0,!0),wt._subPinOffset=!1;var T,O,E,S,P,D,R,F,I,N,X,q,U,j=kt(),H=Mt(),W=lt?lt.duration():Ys(dt,ht),V=_<=.01||!_,G=0,Q=b||0,$=qs(d)?d.end:e.end,rt=e.endTrigger||K,nt=qs(d)?d.start:e.start||(0!==e.start&&K?J?"0 0":"0 100%":0),it=wt.pinnedContainer=e.pinnedContainer&&Ei(e.pinnedContainer,wt),st=K&&Math.max(0,wa.indexOf(wt))||0,at=st;for(xt&&qs(d)&&(q=Ii.getProperty(h,ht.p),U=Ii.getProperty(p,ht.p));at-- >0;)(D=wa[at]).end||D.refresh(0,1)||(Gi=wt),!(R=D.pin)||R!==K&&R!==J&&R!==it||D.isReverted||(N||(N=[]),N.unshift(D),D.revert(!0,!0)),D!==wa[at]&&(st--,at--);for(Ns(nt)&&(nt=nt(wt)),nt=Ms(nt,"start",wt),u=$a(nt,K,j,ht,At(),c,h,wt,H,bt,mt,W,lt,wt._startClamp&&"_startClamp")||(J?-.001:0),Ns($)&&($=$(wt)),Ls($)&&!$.indexOf("+=")&&(~$.indexOf(" ")?$=(Ls(nt)?nt.split(" ")[0]:"")+$:(G=ya($.substr(2),j),$=Ls(nt)?nt:(lt?Ii.utils.mapRange(0,lt.duration(),lt.scrollTrigger.start,lt.scrollTrigger.end,u):u)+G,rt=K)),$=Ms($,"end",wt),l=Math.max(u,$a($||(rt?"100% 0":W),rt,j,ht,At()+G,f,p,wt,H,bt,mt,W,lt,wt._endClamp&&"_endClamp"))||-.001,G=0,at=st;at--;)(R=(D=wa[at]||{}).pin)&&D.start-D._pinPush<=u&&!lt&&D.end>0&&(T=D.end-(wt._startClamp?Math.max(0,D.start):D.start),(R===K&&D.start-D._pinPush<u||R===it)&&isNaN(nt)&&(G+=T*(1-D.progress)),R===J&&(Q+=T));if(u+=G,l+=G,wt._startClamp&&(wt._startClamp+=G),wt._endClamp&&!ms&&(wt._endClamp=l||-.001,l=Math.min(l,Ys(dt,ht))),_=l-u||(u-=.01)&&.001,V&&(Et=Ii.utils.clamp(0,1,Ii.utils.normalize(u,l,B))),wt._pinPush=Q,c&&G&&((T={})[ht.a]="+="+G,it&&(T[ht.p]="-="+At()),Ii.set([c,f],T)),!J||ds&&wt.end>=Ys(dt,ht)){if(K&&At()&&!lt)for(O=K.parentNode;O&&O!==Xi;)O._pinOffset&&(u-=O._pinOffset,l-=O._pinOffset),O=O.parentNode}
1else T=aa(J),S=ht===Ci,E=At(),k=parseFloat(w(ht.a))+Q,!W&&l>1&&(X={style:X=(_t?Li.scrollingElement||Ni:dt).style,value:X["overflow"+ht.a.toUpperCase()]},_t&&"scroll"!==aa(Xi)["overflow"+ht.a.toUpperCase()]&&(X.style["overflow"+ht.a.toUpperCase()]="scroll")),Wa(J,x,T),y=Qa(J),O=ua(J,!0),F=mt&&Ai(dt,S?Oi:Ci)(),tt?((C=[tt+ht.os2,_+Q+sa]).t=x,(at=tt===ea?la(J,ht)+_+Q:0)&&(C.push(ht.d,at+sa),"auto"!==x.style.flexBasis&&(x.style.flexBasis=at+sa)),Ga(C),it&&wa.forEach(function(t){t.pin===it&&!1!==t.vars.pinSpacing&&(t._subPinOffset=!0)}),mt&&At(B)):(at=la(J,ht))&&"auto"!==x.style.flexBasis&&(x.style.flexBasis=at+sa),mt&&((P={top:O.top+(S?E-u:F)+sa,left:O.left+(S?F:E-u)+sa,boxSizing:"border-box",position:"fixed"})[Qs]=P["max"+na]=Math.ceil(O.width)+sa,P[Zs]=P["max"+ia]=Math.ceil(O.height)+sa,P[ra]=P[ra+Js]=P[ra+$s]=P[ra+ta]=P[ra+Ks]="0",P[ea]=T[ea],P[ea+Js]=T[ea+Js],P[ea+$s]=T[ea+$s],P[ea+ta]=T[ea+ta],P[ea+Ks]=T[ea+Ks],v=function(t,e,r){for(var n,i=[],s=t.length,a=r?8:0;a<s;a+=2)n=t[a],i.push(n,n in e?e[n]:t[a+1]);return i.t=t.t,i}(m,P,ot),ms&&At(0)),r?(I=r._initted,rs(1),r.render(r.duration(),!0,!0),M=w(ht.a)-k+_+Q,A=Math.abs(_-M)>1,mt&&A&&v.splice(v.length-2,2),r.render(0,!0,!0),I||r.invalidate(!0),r.parent||r.totalTime(r.totalTime()),rs(0)):M=_,X&&(X.value?X.style["overflow"+ht.a.toUpperCase()]=X.value:X.style.removeProperty("overflow-"+ht.a));
vendor: 8,380 bytes, line 1
1N&&N.forEach(function(t){return t.revert(!1,!0)}),wt.start=u,wt.end=l,a=o=ms?B:At(),lt||ms||(a<B&&At(B),wt.scroll.rec=0),wt.revert(!1,!0),Ct=bs(),Y&&(Ot=-1,Y.restart(!0)),Gi=0,r&&pt&&(r._initted||L)&&r.progress()!==L&&r.progress(L||0,!0).render(r.time(),!0,!0),(V||Et!==wt.progress||lt||et||r&&!r._initted)&&(r&&!pt&&(r._initted||Et||!1!==r.vars.immediateRender)&&r.totalProgress(lt&&u<-.001&&!Et?Ii.utils.normalize(u,l,0):Et,!0),wt.progress=V||(a-u)/_===Et?0:Et),J&&tt&&(x._pinOffset=Math.round(wt.progress*M)),z&&z.invalidate(),isNaN(q)||(q-=Ii.getProperty(h,ht.p),U-=Ii.getProperty(p,ht.p),eo(h,ht,q),eo(c,ht,q-(b||0)),eo(p,ht,U),eo(f,ht,U-(b||0))),V&&!ms&&wt.update(),!Z||ms||g||(g=!0,Z(wt),g=!1)}},wt.getVelocity=function(){return(At()-o)/(bs()-Wi)*1e3||0},wt.endAnimation=function(){Us(wt.callbackAnimation),r&&(z?z.progress(1):r.paused()?pt||Us(r,wt.direction<0,1):Us(r,r.reversed()))},wt.labelToScroll=function(t){return r&&r.labels&&(u||wt.refresh()||u)+r.labels[t]/r.duration()*_||0},wt.getTrailing=function(t){var e=wa.indexOf(wt),r=wt.direction>0?wa.slice(0,e).reverse():wa.slice(e+1);return(Ls(t)?r.filter(function(e){return e.vars.preventOverlaps===t}):r).filter(function(t){return wt.direction>0?t.end<=u:t.start>=l})},wt.update=function(t,e,i){if(!lt||i||t){var s,c,f,p,d,g,m,b=!0===ms?B:wt.scroll(),w=t?0:(b-u)/_,C=w<0?0:w>1?1:w||0,P=wt.progress;if(e&&(o=a,a=lt?At():b,at&&(R=D,D=r&&!pt?r.totalProgress():C)),rt&&J&&!Gi&&!xs&&Ts&&(!C&&u<b+(b-o)/(bs()-Wi)*rt?C=1e-4:1===C&&l>b+(b-o)/(bs()-Wi)*rt&&(C=.9999)),C!==P&&wt.enabled){if(p=(d=(s=wt.isActive=!!C&&C<1)!=(!!P&&P<1))||!!C!=!!P,wt.direction=C>P?1:-1,wt.progress=C,p&&!Gi&&(c=C&&!P?0:1===C?1:1===P?2:3,pt&&(f=!d&&"none"!==yt[c+1]&&yt[c+1]||yt[c],m=r&&("complete"===f||"reset"===f||f in r))),ft&&(d||m)&&(m||$||!r)&&(Ns(ft)?ft(wt):wt.getTrailing(ft).forEach(function(t){return t.endAnimation()})),pt||(!z||Gi||xs?r&&r.totalProgress(C,!(!Gi||!Ct&&!t)):(z._dp._time-z._start!==z._time&&z.render(z._dp._time-z._start),z.resetTo?z.resetTo("totalProgress",C,r._tTime/r._tDur):(z.vars.totalProgress=C,z.invalidate().restart()))),J)if(t&&tt&&(x.style[tt+ht.os2]=O),mt){if(p){if(g=!t&&C>P&&l+1>b&&b+1>=Ys(dt,ht),ot)if(t||!s&&!g)Ja(J,x);else{var F=ua(J,!0),I=b-u;Ja(J,Xi,F.top+(ht===Ci?I:0)+sa,F.left+(ht===Ci?0:I)+sa)}Ga(s||g?v:y),A&&C<1&&s||T(k+(1!==C||g?0:M))}}else T(Ps(k+M*C));at&&!n.tween&&!Gi&&!xs&&Y.restart(!0),V&&(d||st&&C&&(C<1||!gs))&&ji(V.targets).forEach(function(t){return t.classList[s||st?"add":"remove"](V.className)}),W&&!pt&&!t&&W(wt),p&&!Gi?(pt&&(m&&("complete"===f?r.pause().totalProgress(1):"reset"===f?r.restart(!0).pause():"restart"===f?r.restart(!0):r[f]()),W&&W(wt)),!d&&gs||(Q&&d&&js(wt,Q),vt[c]&&js(wt,vt[c]),st&&(1===C?wt.kill(!1,1):vt[c]=0),d||vt[c=1===C?1:3]&&js(wt,vt[c])),ct&&!s&&Math.abs(wt.getVelocity())>(Xs(ct)?ct:2500)&&(Us(wt.callbackAnimation),z?z.progress(1):Us(r,"reverse"===f?1:!C,1))):pt&&W&&!Gi&&W(wt)}if(S){var L=lt?b/lt.duration()*(lt._caScrollDist||0):b;E(L+(h._isFlipped?1:0)),S(L)}N&&N(-b/lt.duration()*(lt._caScrollDist||0))}},wt.enable=function(e,r){wt.enabled||(wt.enabled=!0,pa(dt,"resize",Ca),_t||pa(dt,"scroll",Ma),Tt&&pa(t,"refreshInit",Tt),!1!==e&&(wt.progress=Et=0,a=o=Ot=At()),!1!==r&&wt.refresh())},wt.getTween=function(t){return t&&n?n.tween:z},wt.setPositions=function(t,e,r,n){if(lt){var i=lt.scrollTrigger,s=lt.duration(),a=i.end-i.start;t=i.start+a*t/s,e=i.start+a*e/s}wt.refresh(!1,!1,{start:Os(t,r&&!!wt._startClamp),end:Os(e,r&&!!wt._endClamp)},n),wt.update()},wt.adjustPinSpacing=function(t){if(C&&t){var e=C.indexOf(ht.d)+1;C[e]=parseFloat(C[e])+t+sa,C[1]=parseFloat(C[1])+t+sa,Ga(C)}},wt.disable=function(e,r){if(!1!==e&&wt.revert(!0,!0),wt.enabled&&(wt.enabled=wt.isActive=!1,r||z&&z.pause(),B=0,i&&(i.uncache=1),Tt&&da(t,"refreshInit",Tt),Y&&(Y.pause(),n.tween&&n.tween.kill()&&(n.tween=0)),!_t)){for(var s=wa.length;s--;)if(wa[s].scroller===dt&&wa[s]!==wt)return;da(dt,"resize",Ca),_t||da(dt,"scroll",Ma)}},wt.kill=function(t,n){wt.disable(t,n),z&&!n&&z.kill(),G&&delete Ta[G];var s=wa.indexOf(wt);s>=0&&wa.splice(s,1),s===$i&&qa>0&&$i--,s=0,wa.forEach(function(t){return t.scroller===wt.scroller&&(s=1)}),s||ms||(wt.scroll.rec=0),r&&(r.scrollTrigger=null,t&&r.revert({kill:!1}),n||r.kill()),c&&[c,f,h,p].forEach(function(t){return t.parentNode&&t.parentNode.removeChild(t)}),ys===wt&&(ys=0),J&&(i&&(i.uncache=1),s=0,wa.forEach(function(t){return t.pin===J&&s++}),s||(i.spacer=0)),e.onKill&&e.onKill(wt)},wa.push(wt),wt.enable(!1,!1),X&&X(wt),r&&r.add&&!_){var Rt=wt.update;wt.update=function(){wt.update=Rt,di.cache++,u||l||wt.refresh()},Ii.delayedCall(.01,wt.update),_=.01,u=l=0}else wt.refresh();J&&function(){if(vs!==Ya){var t=vs=Ya;requestAnimationFrame(function(){return t===Ya&&Na(!0)})}}()}else this.update=this.refresh=this.kill=Ss},t.register=function(e){return Yi||(Ii=e||Rs(),Ds()&&window.document&&t.enable(),Yi=ks),Yi},t.defaults=function(t){if(t)for(var e in t)ma[e]=t[e];return ma},t.disable=function(t,e){ks=0,wa.forEach(function(r){return r[e?"kill":"disable"](t)}),da(Bi,"wheel",Ma),da(Li,"scroll",Ma),clearInterval(Vi),da(Li,"touchcancel",Ss),da(Xi,"touchstart",Ss),ha(da,Li,"pointerdown,touchstart,mousedown",Es),ha(da,Li,"pointerup,touchend,mouseup",As),Ui.kill(),Bs(da);for(var r=0;r<di.length;r+=3)ga(da,di[r],di[r+1]),ga(da,di[r],di[r+2])},t.enable=function(){if(Bi=window,Li=document,Ni=Li.documentElement,Xi=Li.body,Ii)if(ji=Ii.utils.toArray,Hi=Ii.utils.clamp,ls=Ii.core.context||Ss,rs=Ii.core.suppressOverwrites||Ss,cs=Bi.history.scrollRestoration||"auto",Xa=Bi.pageYOffset||0,Ii.core.globals("ScrollTrigger",t),Xi){ks=1,(fs=document.createElement("div")).style.height="100vh",fs.style.position="absolute",Ba(),Cs(),Fi.register(Ii),t.isTouch=Fi.isTouch,us=Fi.isTouch&&/(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent),ss=1===Fi.isTouch,pa(Bi,"wheel",Ma),qi=[Bi,Li,Ni,Xi],Ii.matchMedia?(t.matchMedia=function(t){var e,r=Ii.matchMedia();for(e in t)r.add(e,t[e]);return r},Ii.addEventListener("matchMediaInit",function(){za(),Fa()}),Ii.addEventListener("matchMediaRevert",function(){return Ra()}),Ii.addEventListener("matchMedia",function(){Na(0,1),Pa("matchMedia")}),Ii.matchMedia().add("(orientation: portrait)",function(){return Oa(),Oa})):console.warn("Requires GSAP 3.11.0 or later"),Oa(),pa(Li,"scroll",Ma);var e,r,n=Xi.hasAttribute("style"),i=Xi.style,s=i.borderTopStyle,a=Ii.core.Animation.prototype;for(a.revert||Object.defineProperty(a,"revert",{value:function(){return this.time(-.01,!0)}}),i.borderTopStyle="solid",e=ua(Xi),Ci.m=Math.round(e.top+Ci.sc())||0,Oi.m=Math.round(e.left+Oi.sc())||0,s?i.borderTopStyle=s:i.removeProperty("border-top-style"),n||(Xi.setAttribute("style",""),Xi.removeAttribute("style")),Vi=setInterval(ka,250),Ii.delayedCall(.5,function(){return xs=0}),pa(Li,"touchcancel",Ss),pa(Xi,"touchstart",Ss),ha(pa,Li,"pointerdown,touchstart,mousedown",Es),ha(pa,Li,"pointerup,touchend,mouseup",As),Zi=Ii.utils.checkPrefix("transform"),Ha.push(Zi),Yi=bs(),Ui=Ii.delayedCall(.2,Na).pause(),ts=[Li,"visibilitychange",function(){var t=Bi.innerWidth,e=Bi.innerHeight;Li.hidden?(Ki=t,Ji=e):Ki===t&&Ji===e||Ca()},Li,"DOMContentLoaded",Na,Bi,"load",Na,Bi,"resize",Ca],Bs(pa),wa.forEach(function(t){return t.enable(0,1)}),r=0;r<di.length;r+=3)ga(da,di[r],di[r+1]),ga(da,di[r],di[r+2])}else Li&&Li.addEventListener("DOMContentLoaded",function e(){t.enable(),Li.removeEventListener("DOMContentLoaded",e)})},t.config=function(e){"limitCallbacks"in e&&(gs=!!e.limitCallbacks);var r=e.syncInterval;r&&clearInterval(Vi)||(Vi=r)&&setInterval(ka,r),"ignoreMobileResize"in e&&(ss=1===t.isTouch&&e.ignoreMobileResize),"autoRefreshEvents"in e&&(Bs(da)||Bs(pa,e.autoRefreshEvents||"none"),ns=-1===(e.autoRefreshEvents+"").indexOf("resize"))},t.scrollerProxy=function(t,e){var r=Ei(t),n=di.indexOf(r),i=zs(r);~n&&di.splice(n,i?6:2),e&&(i?gi.unshift(Bi,e,Xi,e,Ni,e):gi.unshift(r,e))},t.clearMatchMedia=function(t){wa.forEach(function(e){return e._ctx&&e._ctx.query===t&&e._ctx.kill(!0,!0)})},t.isInViewport=function(t,e,r){var n=(Ls(t)?Ei(t):t).getBoundingClientRect(),i=n[r?Qs:Zs]*e||0;return r?n.right-i>0&&n.left+i<Bi.innerWidth:n.bottom-i>0&&n.top+i<Bi.innerHeight},t.positionInViewport=function(t,e,r){Ls(t)&&(t=Ei(t));var n=t.getBoundingClientRect(),i=n[r?Qs:Zs],s=null==e?i/2:e in va?va[e]*i:~e.indexOf("%")?parseFloat(e)*i/100:parseFloat(e)||0;return r?(n.left+s)/Bi.innerWidth:(n.top+s)/Bi.innerHeight}
1,t.killAll=function(t){if(wa.slice(0).forEach(function(t){return"ScrollSmoother"!==t.vars.id&&t.kill()}),!0!==t){var e=Ea.killAll||[];Ea={},e.forEach(function(t){return t()})}},t}();no.version="3.15.0",no.saveStyles=function(t){return t?ji(t).forEach(function(t){if(t&&t.style){var e=Da.indexOf(t);e>=0&&Da.splice(e,5),Da.push(t,t.style.cssText,t.getBBox&&t.getAttribute("transform"),Ii.core.getCache(t),ls())}}):Da},no.revert=function(t,e){return Fa(!t,e)},no.create=function(t,e){return new no(t,e)},no.refresh=function(t){return t?Ca(!0):(Yi||no.register())&&Na(!0)},no.update=function(t){return++di.cache&&Ua(!0===t?2:0)},no.clearScrollMemory=Ia,no.maxScroll=function(t,e){return Ys(t,e?Oi:Ci)},no.getScrollFunc=function(t,e){return Ai(Ei(t),e?Oi:Ci)},no.getById=function(t){return Ta[t]},no.getAll=function(){return wa.filter(function(t){return"ScrollSmoother"!==t.vars.id})},no.isScrolling=function(){return!!Ts},no.snapDirectional=fa,no.addEventListener=function(t,e){var r=Ea[t]||(Ea[t]=[]);~r.indexOf(e)||r.push(e)},no.removeEventListener=function(t,e){var r=Ea[t],n=r&&r.indexOf(e);n>=0&&r.splice(n,1)},no.batch=function(t,e){var r,n=[],i={},s=e.interval||.016,a=e.batchMax||1e9,o=function(t,e){var r=[],n=[],i=Ii.delayedCall(s,function(){e(r,n),r=[],n=[]}).pause();return function(t){r.length||i.restart(!0),r.push(t.trigger),n.push(t),a<=r.length&&i.progress(1)}};for(r in e)i[r]="on"===r.substr(0,2)&&Ns(e[r])&&"onRefreshInit"!==r?o(0,e[r]):e[r];return Ns(a)&&(a=a(),pa(no,"refresh",function(){return a=e.batchMax()})),ji(t).forEach(function(t){var e={};for(r in i)e[r]=i[r];e.trigger=t,n.push(no.create(e))}),n};var io,so=function(t,e,r,n){return e>n?t(n):e<0&&t(0),r>n?(n-e)/(r-e):r<0?e/(e-r):1},ao=function t(e,r){!0===r?e.style.removeProperty("touch-action"):e.style.touchAction=!0===r?"auto":r?"pan-"+r+(Fi.isTouch?" pinch-zoom":""):"none",e===Ni&&t(Xi,r)},oo={auto:1,scroll:1},uo=function(t){var e,r=t.event,n=t.target,i=t.axis,s=(r.changedTouches?r.changedTouches[0]:r).target,a=s._gsap||Ii.core.getCache(s),o=bs();if(!a._isScrollT||o-a._isScrollT>2e3){for(;s&&s!==Xi&&(s.scrollHeight<=s.clientHeight&&s.scrollWidth<=s.clientWidth||!oo[(e=aa(s)).overflowY]&&!oo[e.overflowX]);)s=s.parentNode;a._isScroll=s&&s!==n&&!zs(s)&&(oo[(e=aa(s)).overflowY]||oo[e.overflowX]),a._isScrollT=o}(a._isScroll||"x"===i)&&(r.stopPropagation(),r._gsapAllow=!0)},lo=function(t,e,r,n){return Fi.create({target:t,capture:!0,debounce:!1,lockAxis:!0,type:e,onWheel:n=n&&uo,onPress:n,onDrag:n,onScroll:n,onEnable:function(){return r&&pa(Li,Fi.eventTypes[0],fo,!1,!0)},onDisable:function(){return da(Li,Fi.eventTypes[0],fo,!0)}})},co=/(input|label|select|textarea)/i,fo=function(t){var e=co.test(t.target.tagName);(e||io)&&(t._gsapAllow=!0,io=e)};if(no.sort=function(t){if(Ns(t))return wa.sort(t);var e=Bi.pageYOffset||0;return no.getAll().forEach(function(t){return t._sortY=t.trigger?e+t.trigger.getBoundingClientRect().top:t.start+Bi.innerHeight}),wa.sort(t||function(t,e){return-1e6*(t.vars.refreshPriority||0)+(t.vars.containerAnimation?1e6:t._sortY)-((e.vars.containerAnimation?1e6:e._sortY)+-1e6*(e.vars.refreshPriority||0))})},no.observe=function(t){return new Fi(t)},no.normalizeScroll=function(t){if(void 0===t)return is;if(!0===t&&is)return is.enable();if(!1===t)return is&&is.kill(),void(is=t);var e=t instanceof Fi?t:function(t){qs(t)||(t={}),t.preventDefault=t.isNormalizer=t.allowClicks=!0,t.type||(t.type="wheel,touch"),t.debounce=!!t.debounce,t.id=t.id||"normalizer";var e,r,n,i,s,a,o,u,l=t,c=l.normalizeScrollX,f=l.momentum,h=l.allowNestedScroll,p=l.onRelease,d=Ei(t.target)||Ni,g=Ii.core.globals().ScrollSmoother,_=g&&g.get(),m=us&&(t.content&&Ei(t.content)||_&&!1!==t.content&&!_.smooth()&&_.content()),v=Ai(d,Ci),y=Ai(d,Oi),x=1,b=(Fi.isTouch&&Bi.visualViewport?Bi.visualViewport.scale*Bi.visualViewport.width:Bi.outerWidth)/Bi.innerWidth,w=0,T=Ns(f)?function(){return f(e)}:function(){return f||2.8},k=lo(d,t.type,!0,h),M=function(){return i=!1},O=Ss,C=Ss,E=function(){r=Ys(d,Ci),C=Hi(us?1:0,r),c&&(O=Hi(0,Ys(d,Oi))),n=Ya},A=function(){m._gsap.y=Ps(parseFloat(m._gsap.y)+v.offset)+"px",m.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+parseFloat(m._gsap.y)+", 0, 1)",v.offset=v.cac
1heID=0},S=function(){E(),s.isActive()&&s.vars.scrollY>r&&(v()>r?s.progress(1)&&v(r):s.resetTo("scrollY",r))};return m&&Ii.set(m,{y:"+=0"}),t.ignoreCheck=function(t){return us&&"touchmove"===t.type&&function(){if(i){requestAnimationFrame(M);var t=Ps(e.deltaY/2),r=C(v.v-t);if(m&&r!==v.v+v.offset){v.offset=r-v.v;var n=Ps((parseFloat(m&&m._gsap.y)||0)-v.offset);m.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+n+", 0, 1)",m._gsap.y=n+"px",v.cacheID=di.cache,Ua()}return!0}v.offset&&A(),i=!0}()||x>1.05&&"touchstart"!==t.type||e.isGesturing||t.touches&&t.touches.length>1},t.onPress=function(){i=!1;var t=x;x=Ps((Bi.visualViewport&&Bi.visualViewport.scale||1)/b),s.pause(),t!==x&&ao(d,x>1.01||!c&&"x"),a=y(),o=v(),E(),n=Ya},t.onRelease=t.onGestureStart=function(t,e){if(v.offset&&A(),e){di.cache++;var n,i,a=T();c&&(i=(n=y())+.05*a*-t.velocityX/.227,a*=so(y,n,i,Ys(d,Oi)),s.vars.scrollX=O(i)),i=(n=v())+.05*a*-t.velocityY/.227,a*=so(v,n,i,Ys(d,Ci)),s.vars.scrollY=C(i),s.invalidate().duration(a).play(.01),(us&&s.vars.scrollY>=r||n>=r-1)&&Ii.to({},{onUpdate:S,duration:a})}else u.restart(!0);p&&p(t)},t.onWheel=function(){s._ts&&s.pause(),bs()-w>1e3&&(n=0,w=bs())},t.onChange=function(t,e,r,i,s){if(Ya!==n&&E(),e&&c&&y(O(i[2]===e?a+(t.startX-t.x):y()+e-i[1])),r){v.offset&&A();var u=s[2]===r,l=u?o+t.startY-t.y:v()+r-s[1],f=C(l);u&&l!==f&&(o+=f-l),v(f)}(r||e)&&Ua()},t.onEnable=function(){ao(d,!c&&"x"),no.addEventListener("refresh",S),pa(Bi,"resize",S),v.smooth&&(v.target.style.scrollBehavior="auto",v.smooth=y.smooth=!1),k.enable()},t.onDisable=function(){ao(d,!0),da(Bi,"resize",S),no.removeEventListener("refresh",S),k.kill()},t.lockAxis=!1!==t.lockAxis,(e=new Fi(t)).iOS=us,us&&!v()&&v(1),us&&Ii.ticker.add(Ss),u=e._dc,s=Ii.to(e,{ease:"power4",paused:!0,inherit:!1,scrollX:c?"+=0.1":"+=0",scrollY:"+=0.1",modifiers:{scrollY:to(v,v(),function(){return s.pause()})},onUpdate:Ua,onComplete:u.vars.onComplete}),e}(t);return is&&is.target===e.target&&is.kill(),zs(e.target)&&(is=e),e},no.core={_getVelocityProp:Si,_inputObserver:lo,_scrollers:di,_proxies:gi,bridge:{ss:function(){Ts||Pa("scrollStart"),Ts=bs()},ref:function(){return Gi}}},Rs()&&Ii.registerPlugin(no),Zn.registerPlugin(no),window.matchMedia("(prefers-reduced-motion: reduce)").matches)document.querySelectorAll(".jetpack-reveal, .jetpack-bento-card, .jetpack-pricing-card, .jetpack-fh-section, .hero-with-icon .wp-block-media-text, .jetpack-blog-page .jetpack-post-grid__items > .wp-block-post").forEach(t=>{t.style.opacity="1",t.style.transform="none"});else{Zn.utils.toArray(".jetpack-bento-card").forEach((t,e)=>{Zn.fromTo(t,{opacity:0,y:40},{opacity:1,y:0,duration:.8,ease:"power3.out",delay:.1*e,scrollTrigger:{trigger:t,start:"top 90%",once:!0}})}),Zn.utils.toArray(".jetpack-reveal").forEach(t=>{Zn.fromTo(t,{opacity:0,y:20},{opacity:1,y:0,duration:.6,ease:"power3.out",scrollTrigger:{trigger:t,start:"top 88%",once:!0}})}),Zn.utils.toArray(".jetpack-pricing-card").forEach((t,e)=>{Zn.fromTo(t,{opacity:0,y:20},{opacity:1,y:0,duration:.6,ease:"power3.out",delay:.1*e,scrollTrigger:{trigger:t,start:"top 88%",once:!0}})}),Zn.utils.toArray(".jetpack-fh-section").forEach((t,e)=>{Zn.fromTo(t,{opacity:0,y:40},{opacity:1,y:0,duration:.8,ease:"power3.out",delay:.15*e,scrollTrigger:{trigger:t,start:"top 88%",once:!0}})});const t=document.querySelector(".jetpack-testimonials h2");t&&Zn.to(t,{opacity:1,duration:.6,ease:"power2.out",scrollTrigger:{trigger:t,start:"top 85%",once:!0}}),Zn.utils.toArray(".jetpack-blog-page .jetpack-post-grid__items > .wp-block-post").forEach((t,e)=>{Zn.fromTo(t,{opacity:0,y:24},{opacity:1,y:0,duration:.6,ease:"power3.out",delay:e%3*.1,scrollTrigger:{trigger:t,start:"top 90%",once:!0}})}),Zn.utils.toArray(".hero-with-icon .wp-block-media-text").forEach(t=>{Zn.fromTo(t,{opacity:0,y:40},{opacity:1,y:0,duration:.8,ease:"power3.out",scrollTrigger:{trigger:t,start:"top 88%",once:!0}})})}})();;
2(()=>{"use strict";const t=/^[a-z][a-z0-9_]*$/,e=/email|token|secret|oauth|password|cookie/i,n=new Set(["url","_dl","ref","referrer"]),o=/[\u0000-\u001F\u007F]/,a=[".wp-block-button__link",".wp-element-button",".wp-button",".primary-button",".secondary-button",".cta-button",".button.km-jp-download","[data-jp-track-cta]"].join(","),r=!0===window.jetpackComTrackingData?.enabled,c=window.jetpackComTrackingData?.eventNamespace??"",i=window.jetpackComTrackingData?.pageKey??"",s=window.jetpackComTrackingData?.locale??"",u=window.jetpackComTrackingData?.landingPage??"";let p=null;function d(){return window._tkq=window._tkq||[],window._tkq}function m(t){return t.replace(/-/g,"_").replace(/[^a-zA-Z0-9_]/g,"").toLowerCase()}function f(t={}){const a={};return Object.entries(t).forEach(([t,r])=>{const c=m(t);if(""!==c&&null!=r&&!e.test(c)&&("string"==typeof r||"number"==typeof r||"boolean"==typeof r)){if("string"==typeof r&&n.has(c)){const t=function(t){const e=t.trim();if(""!==e&&!function(t){if(o.test(t))return!0;try{return o.test(decodeURIComponent(t))}catch{return!1}}(e))try{const t=new URL(e,window.location.origin);if(""===t.username&&""===t.password||(t.username="",t.password=""),e.startsWith("//"))return;if(e.startsWith("/"))return t.pathname||"/";if("http:"!==t.protocol&&"https:"!==t.protocol)return;if(!/^[a-z][a-z0-9+.-]*:/i.test(e))return;return`${t.protocol}//${t.host}${t.pathname||"/"}`}catch{return}}(r);if(void 0===t)return;r=t}a[c]=r}}),a}function l(t){if(""===c)return t;const e=t.indexOf("_");return 0>e?`${t}_${c}`:t.slice(0,e+1)+c+t.slice(e)}function w(e,n={}){r&&t.test(e)&&d().push(["recordEvent",l(e),f(h(n))])}function h(t){const e={page_key:i||void 0,locale:s||void 0},n=new Set(Object.keys(e)),o={};for(const e of Object.keys(t))n.has(m(e))||(o[e]=t[e]);return{...o,...e}}function g(){const t=window.location.pathname.split("/").filter(
2Boolean);return 0===t.length?"home":t.join("_").replace(/-/g,"_")}function _(){const t=new URLSearchParams(window.location.search);return f({page:g(),path:window.location.pathname,url:window.location.href,ref:document.referrer||void 0,utm_source:t.get("utm_source"),utm_campaign:t.get("utm_campaign"),utm_term:t.get("utm_term"),utm_medium:t.get("utm_medium"),utm_content:t.get("utm_content")})}function k(){return document.body.classList.contains("single-post")}function j(){return window.location.pathname.split("/").filter(Boolean).pop()||""}function y(t){return f({href:t.href,text:t.textContent?.trim()||"",from:p?.page||g(),product:t.dataset.product,location:t.dataset.location})}function v(t){const e=t.getAttribute("data-jp-track-props");if(!e)return{};try{const t=JSON.parse(e);return!t||"object"!=typeof t||Array.isArray(t)?{}:t}catch{return{}}}function b(t){const e=t.target instanceof Element?t.target:null;if(!e)return;const n=e.closest("a[href]"),o=e.closest("[data-jp-track-event]");n&&(function(t){if(t.href)try{const e=new URL(t.href);let n=!1;if(r&&function(t){return"wordpress.com"===t.hostname&&t.pathname.startsWith("/jetpack/connect")||"jetpack.com"===t.hostname&&t.pathname.startsWith("/install/")}(e)){const o=t.id||t.dataset.jpTrackId||"";o&&e.searchParams.set("cta_id",o),e.searchParams.set("cta_from",function(){const t=p||_(),e=String(t.page||"unknown"),n=t.utm_source,o=t.utm_campaign,a=t.utm_medium;return"string"==typeof n&&"string"==typeof o&&"string"==typeof a?`${e}-${n}-${o}-${a}`:e}()),n=!0}(function(t){return"wordpress.com"===t.hostname&&t.pathname.startsWith("/jetpack/connect")||"wordpress.com"===t.hostname&&t.pathname.startsWith("/checkout/")||"wordpress.com"===t.hostname&&["/purchase-product/jetpack_search","/purchase-product/wpcom_search"].includes(t.pathname)})(e)&&(e.searchParams.set("checkoutBackUrl",window.location.href),n=!0),n&&(t.href=e.href)}catch{}}(n),function(t,e){const n=y(t);w("jetpack_com_click",n),e.closest(a)&&w("jetpack_com_cta_click",n),k()&&w("jetpack_com_blog_click",{...n,from:j()})}(n,e)),o&&function(t,e){const n=t.dataset.jpTrackEvent;n&&w(n,{...e?y(e):{},...v(t)})}(o,n)}function C(t){const e=t.target instanceof Element?t.target:null,n=e?.closest("[data-jp-pricing-term]"),o=n?.dataset.jpPricingTerm;o&&w("jetpack_com_pricing_toggle",{term:o,pathname:window.location.pathname})}function L(){window.jetpackComTrack=w,r&&(d(),document.addEventListener("click",b,!0),document.addEventListener("change",C,!0),window.addEventListener("message",t=>{if(!t.data||"object"!=typeof t.data||"videopress_ready"!==t.data.event)return;const e=window.VideoPressIframeApi,n=Array.from(document.getElementsByTagName("iframe")).find(e=>t.source===e.contentWindow);e&&n&&e(n,t=>{let e=!1,n="",o="";t.info.onInfoUpdated(()=>{t.info.title().then(t=>{n=t}),t.info.guid().then(t=>{o=t})}),t.status.onPlayerStatusChanged((t,a)=>{"playing"!==a||e||(w("jetpack_com_videopress_video_played",{title:n,id:o,url:window.location.href,page:p?.page||g()}),e=!0)})})}),function(){if(p=_(),!window.jetpackComTrackingData?.serverViews){if(w("jetpack_com_page_view",p),document.body.classList.contains("post-type-archive-jetpack_support")&&w("jetpack_supporthomepage_visit",p),k()){const t={...p,post:j()};delete t.page,w("jetpack_com_blog_post_view",t)}u&&w("jetpack_landing_page_view",{...p,page:u})}}())}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",L):L()})();;
3var la=Object.defineProperty;var ua=(e,i,t)=>i in e?la(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var $=(e,i,t)=>(ua(e,typeof i!="symbol"?i+"":i,t),t);var gt;function si(e){return gt=gt||document.createElement("textarea"),gt.innerHTML="&"+e+";",gt.value}function ca(e){return Object.prototype.toString.call(e)}function da(e){return ca(e)==="[object String]"}var ha=Object.prototype.hasOwnProperty;function li(e,i){return e?ha.call(e,i):!1}function Pn(e){var i=[].slice.call(arguments,1);return i.forEach(function(t){if(t){if(typeof t!="object")throw new TypeError(t+"must be object");Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}var pa=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function Ye(e){return e.indexOf("\\")<0?e:e.replace(pa,"$1")}function Nn(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function Ct(e){if(e>65535){e-=65536;var i=55296+(e>>10),t=56320+(e&1023);return String.fromCharCode(i,t)}return String.fromCharCode(e)}var fa=/&([a-z#][a-z0-9]{1,31});/gi,ma=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;function va(e,i){var t=0,n=si(i);return i!==n?n:i.charCodeAt(0)===35&&ma.test(i)&&(t=i[1].toLowerCase()==="x"?parseInt(i.slice(2),16):parseInt(i.slice(1),10),Nn(t))?Ct(t):e}function xe(e){return e.indexOf("&")<0?e:e.replace(fa,va)}var ga=/[&<>"]/,ya=/[&<>"]/g,ba={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function ka(e){return ba[e]}function se(e){return ga.test(e)?e.replace(ya,ka):e}var Dn=Object.freeze({isString:da,has:li,assign:Pn,unescapeMd:Ye,isValidEntityCode:Nn,fromCodePoint:Ct,replaceEntities:xe,escapeHtml:se}),A={};A.blockquote_open=function(){return`<blockquote>
4`};A.blockquote_close=function(e,i){return"</blockquote>"+De(e,i)};A.code=function(e,i){return e[i].block?"<pre><code>"+se(e[i].content)+"</code></pre>"+De(e,i):"<code>"+se(e[i].content)+"</code>"};A.fence=function(e,i,t,n,r){var a=e[i],o="",s=t.langPrefix,l="",u,c,d;if(a.params){if(u=a.params.split(/\s+/g),c=u.join(" "),li(r.rules.fence_custom,u[0]))return r.rules.fence_custom[u[0]](e,i,t,n,r);l=se(xe(Ye(c))),o=' class="'+s+l+'"'}return t.highlight?d=t.highlight.apply(t.highlight,[a.content].concat(u))||se(a.content):d=se(a.content),"<pre><code"+o+">"+d+"</code></pre>"+De(e,i)};A.fence_custom={};A.heading_open=function(e,i){return"<h"+e[i].hLevel+">"};A.heading_close=function(e,i){return"</h"+e[i].hLevel+`>
5`};A.hr=function(e,i,t){return(t.xhtmlOut?"<hr />":"<hr>")+De(e,i)};A.bullet_list_open=function(){return`<ul>
6`};A.bullet_list_close=function(e,i){return"</ul>"+De(e,i)};A.list_item_open=function(){return"<li>"};A.list_item_close=function(){return`</li>
7`};A.ordered_list_open=function(e,i){var t=e[i],n=t.order>1?' start="'+t.order+'"':"";return"<ol"+n+`>
8`};A.ordered_list_close=function(e,i){return"</ol>"+De(e,i)};A.paragraph_open=function(e,i){return e[i].tight?"":"<p>"};A.paragraph_close=function(e,i){var t=!(e[i].tight&&i&&e[i-1].type==="inline"&&!e[i-1].content);return(e[i].tight?"":"</p>
8")+(t?De(e,i):"")};A.link_open=function(e,i,t){var n=e[i].title?' title="'+se(xe(e[i].title))+'"':"",r=t.linkTarget?' target="'+t.linkTarget+'"':"";return'<a href="'+se(e[i].href)+'"'+n+r+">"};A.link_close=function(){return"</a>"};A.image=function(e,i,t){var n=' src="'+se(e[i].src)+'"',r=e[i].title?' title="'+se(xe(e[i].title))+'"':"",a=' alt="'+(e[i].alt?se(xe(Ye(e[i].alt))):"")+'"',o=t.xhtmlOut?" /":"";return"<img"+n+a+r+o+">"};A.table_open=function(){return`<table>
9`};A.table_close=function(){return`</table>
10`};A.thead_open=function(){return`<thead>
11`};A.thead_close=function(){return`</thead>
12`};A.tbody_open=function(){return`<tbody>
13`};A.tbody_close=function(){return`</tbody>
14`};A.tr_open=function(){return"<tr>"};A.tr_close=function(){return`</tr>
15`};A.th_open=function(e,i){var t=e[i];return"<th"+(t.align?' style="text-align:'+t.align+'"':"")+">"};A.th_close=function(){return"</th>"};A.td_open=function(e,i){var t=e[i];return"<td"+(t.align?' style="text-align:'+t.align+'"':"")+">"};A.td_close=function(){return"</td>"};A.strong_open=function(){return"<strong>"};A.strong_close=function(){return"</strong>"};A.em_open=function(){return"<em>"};A.em_close=function(){return"</em>"};A.del_open=function(){return"<del>"};A.del_close=function(){return"</del>"};A.ins_open=function(){return"<ins>"};A.ins_close=function(){return"</ins>"};A.mark_open=function(){return"<mark>"};A.mark_close=function(){return"</mark>"};A.sub=function(e,i){return"<sub>"+se(e[i].content)+"</sub>"};A.sup=function(e,i){return"<sup>"+se(e[i].content)+"</sup>"};A.hardbreak=function(e,i,t){return t.xhtmlOut?`<br />
16`:`<br>
17`};A.softbreak=function(e,i,t){return t.breaks?t.xhtmlOut?`<br />
18`:`<br>
19`:`
20`};A.text=function(e,i){return se(e[i].content)};A.htmlblock=function(e,i){return e[i].content};A.htmltag=function(e,i){return e[i].content};A.abbr_open=function(e,i){return'<abbr title="'+se(xe(e[i].title))+'">'};A.abbr_close=function(){return"</abbr>"};A.footnote_ref=function(e,i){var t=Number(e[i].id+1).toString(),n="fnref"+t;return e[i].subId>0&&(n+=":"+e[i].subId),'<sup class="footnote-ref"><a href="#fn'+t+'" id="'+n+'">['+t+"]</a></sup>"};A.footnote_block_open=function(e,i,t){var n=t.xhtmlOut?`<hr class="footnotes-sep" />
21`:`<hr class="footnotes-sep">
22`;return n+`<section class="footnotes">
23<ol class="footnotes-list">
24`};A.footnote_block_close=function(){return`</ol>
25</section>
26`};A.footnote_open=function(e,i){var t=Number(e[i].id+1).toString();return'<li id="fn'+t+'"  class="footnote-item">'};A.footnote_close=function(){return`</li>
27`};A.footnote_anchor=function(e,i){var t=Number(e[i].id+1).toString(),n="fnref"+t;return e[i].subId>0&&(n+=":"+e[i].subId),' <a href="#'+n+'" class="footnote-backref">↩</a>'};A.dl_open=function(){return`<dl>
28`};A.dt_open=function(){return"<dt>"};A.dd_open=function(){return"<dd>"};A.dl_close=function(){return`</dl>
29`};A.dt_close=function(){return`</dt>
30`};A.dd_close=function(){return`</dd>
31`};function ui(e,i){return++i>=e.length-2?i:e[i].type==="paragraph_open"&&e[i].tight&&e[i+1].type==="inline"&&e[i+1].content.length===0&&e[i+2].type==="paragraph_close"&&e[i+2].tight?ui(e,i+2):i}var De=A.getBreak=function(i,t){return t=ui(i,t),t<i.length&&i[t].type==="list_item_close"?"":`
32`};function Fn(){this.rules=Pn({},A),this.getBreak=A.getBreak}Fn.prototype.renderInline=function(e,i,t){for(var n=this.rules,r=e.length,a=0,o="";r--;)o+=n[e[a].type](e,a++,i,t,this);return o};Fn.prototype.render=function(e,i,t){for(var n=this.rules,r=e.length,a=-1,o="";++a<r;)e[a].type==="inline"?o+=this.renderInline(e[a].children,i,t):o+=n[e[a].type](e,a,i,t,this);return o};function fe(){this.__rules__=[],this.__cache__=null}fe.prototype.__find__=function(e){for(var i=this.__rules__.length,t=-1;i--;)if(this.__rules__[++t].name===e)return t;return-1};fe.prototype.__compile__=function(){var e=this,i=[""];e.__rules__.forEach(function(t){t.enabled&&t.alt.forEach(function(n){i.indexOf(n)<0&&i.push(n)})}),e.__cache__={},i.forEach(function(t){e.__cache__[t]=[],e.__rules__.forEach(function(n){n.enabled&&(t&&n.alt.indexOf(t)<0||e.__cache__[t].push(n.fn))})})};fe.prototype.at=function(e,i,t){var n=this.__find__(e),r=t||{};if(n===-1)throw new Error("Parser rule not found: "+e);this.__rules__[n].fn=i,this.__rules__[n].alt=r.alt||[],this.__cache__=null};fe.prototype.before=function(e,i,t,n){var r=this.__find__(e),a=n||{};if(r===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(r,0,{name:i,enabled:!0,fn:t,alt:a.alt||[]}),this.__cache__=null};fe.prototype.after=function(e,i,t,n){var r=this.__find__(e),a=n||{};if(r===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(r+1,0,{name:i,enabled:!0,fn:t,alt:a.alt||[]}),this.__cache__=null};fe.prototype.push=function(e,i,t){var n=t||{};this.__rules__.push({name:e,enabled:!0,fn:i,alt:n.alt||[]}),this.__cache__=null};fe.prototype.enable=function(e,i){e=Array.isArray(e)?e:[e],i&&this.__rules__.forEach(function(t){t.enabled=!1}),e.forEach(function(t){var n=this.__find__(t);if(n<0)throw new Error("Rules manager: invalid rule name "+t);this.__rules__[n].enabled=!0},this),this.__cache__=null};fe.prototype.disable=function(e){e=Array.isArray(e)?e:[e],e.forEach(function(i){var t=this.__find__(i);if(t<0)throw new Error("Rules manager: invalid rule name "+i);this.__rules__[t].enabled=!1},this),this.__cache__=null};fe.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function _a(e){e.inlineMode?e.tokens.push({type:"inline",content:e.src.replace(/\n/g," ").trim(),level:0,lines:[0,1],children:[]}):e.block.parse(e.src,e.options,e.env,e.tokens)}function Fe(e,i,t,n,r){this.src=e,this.env=n,this.options=t,this.parser=i,this.tokens=r,this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache=[],this.isInLabel=!1,this.linkLevel=0,this.linkContent="",this.labelUnmatchedScopes=0}Fe.prototype.pushPending=function(){this.tokens.push({type:"text",content:this.pending,level:this.pendingLevel}),this.pending=""};Fe.prototype.push=function(e){this.pending&&this.pushPending(),this.tokens.push(e),this.pendingLevel=this.level};Fe.prototype.cacheSet=function(e,i){for(var t=this.cache.length;t<=e;t++)this.cache.push(0);this.cache[e]=i};Fe.prototype.cacheGet=function(e){return e<this.cache.length?this.cache[e]:0};function nt(e,i){var t,n,r,a=-1,o=e.posMax,s=e.pos,l=e.isInLabel;if(e.isInLabel)return-1;if(e.labelUnmatchedScopes)return e.labelUnmatchedScopes--,-1;for(e.pos=i+1,e.isInLabel=!0,t=1;e.pos<o;
32){if(r=e.src.charCodeAt(e.pos),r===91)t++;else if(r===93&&(t--,t===0)){n=!0;break}e.parser.skipToken(e)}return n?(a=e.pos,e.labelUnmatchedScopes=0):e.labelUnmatchedScopes=t-1,e.pos=s,e.isInLabel=l,a}function wa(e,i,t,n){var r,a,o,s,l,u;if(e.charCodeAt(0)!==42||e.charCodeAt(1)!==91||e.indexOf("]:")===-1||(r=new Fe(e,i,t,n,[]),a=nt(r,1),a<0||e.charCodeAt(a+1)!==58))return-1;for(s=r.posMax,o=a+2;o<s&&r.src.charCodeAt(o)!==10;o++);return l=e.slice(2,a),u=e.slice(a+2,o).trim(),u.length===0?-1:(n.abbreviations||(n.abbreviations={}),typeof n.abbreviations[":"+l]>"u"&&(n.abbreviations[":"+l]=u),o)}function Sa(e){var i=e.tokens,t,n,r,a;if(!e.inlineMode){for(t=1,n=i.length-1;t<n;t++)if(i[t-1].type==="paragraph_open"&&i[t].type==="inline"&&i[t+1].type==="paragraph_close"){for(r=i[t].content;r.length&&(a=wa(r,e.inline,e.options,e.env),!(a<0));)r=r.slice(a).trim();i[t].content=r,r.length||(i[t-1].tight=!0,i[t+1].tight=!0)}}}function Sn(e){var i=xe(e);try{i=decodeURI(i)}catch{}return encodeURI(i)}function ci(e,i){var t,n,r,a=i,o=e.posMax;if(e.src.charCodeAt(i)===60){for(i++;i<o;){if(t=e.src.charCodeAt(i),t===10)return!1;if(t===62)return r=Sn(Ye(e.src.slice(a+1,i))),e.parser.validateLink(r)?(e.pos=i+1,e.linkContent=r,!0):!1;if(t===92&&i+1<o){i+=2;continue}i++}return!1}for(n=0;i<o&&(t=e.src.charCodeAt(i),!(t===32||t<32||t===127));){if(t===92&&i+1<o){i+=2;continue}if(t===40&&(n++,n>1)||t===41&&(n--,n<0))break;i++}return a===i||(r=Ye(e.src.slice(a,i)),!e.parser.validateLink(r))?!1:(e.linkContent=r,e.pos=i,!0)}function di(e,i){var t,n=i,r=e.posMax,a=e.src.charCodeAt(i);if(a!==34&&a!==39&&a!==40)return!1;for(i++,a===40&&(a=41);i<r;){if(t=e.src.charCodeAt(i),t===a)return e.pos=i+1,e.linkContent=Ye(e.src.slice(n+1,i)),!0;if(t===92&&i+1<r){i+=2;continue}i++}return!1}function hi(e){return e.trim().replace(/\s+/g," ").toUpperCase()}function xa(e,i,t,n){var r,a,o,s,l,u,c,d,h;if(e.charCodeAt(0)!==91||e.indexOf("]:")===-1||(r=new Fe(e,i,t,n,[]),a=nt(r,0),a<0||e.charCodeAt(a+1)!==58))return-1;for(s=r.posMax,o=a+2;o<s&&(l=r.src.charCodeAt(o),!(l!==32&&l!==10));o++);if(!ci(r,o))return-1;for(c=r.linkContent,o=r.pos,u=o,o=o+1;o<s&&(l=r.src.charCodeAt(o),!(l!==32&&l!==10));o++);for(o<s&&u!==o&&di(r,o)?(d=r.linkContent,o=r.pos):(d="",o=u);o<s&&r.src.charCodeAt(o)===32;)o++;return o<s&&r.src.charCodeAt(o)!==10?-1:(h=hi(e.slice(1,a)),typeof n.references[h]>"u"&&(n.references[h]={title:d,href:c}),o)}function Ea(e){var i=e.tokens,t,n,r,a;if(e.env.references=e.env.references||{},!e.inlineMode){for(t=1,n=i.length-1;t<n;t++)if(i[t].type==="inline"&&i[t-1].type==="paragraph_open"&&i[t+1].type==="paragraph_close"){for(r=i[t].content;r.length&&(a=xa(r,e.inline,e.options,e.env),!(a<0));)r=r.slice(a).trim();i[t].content=r,r.length||(i[t-1].tight=!0,i[t+1].tight=!0)}}}function Ca(e){var i=e.tokens,t,n,r;for(n=0,r=i.length;n<r;n++)t=i[n],t.type==="inline"&&e.inline.parse(t.content,e.options,e.env,t.children)}function Ma(e){var i,t,n,r,a,o,s,l,u,c=0,d=!1,h={};if(e.env.footnotes&&(e.tokens=e.tokens.filter(function(p){return p.type==="footnote_reference_open"?(d=!0,l=[],u=p.label,!1):p.type==="footnote_reference_close"?(d=!1,h[":"+u]=l,!1):(d&&l.push(p),!d)}),!!e.env.footnotes.list)){for(o=e.env.footnotes.list,e.tokens.push({type:"footnote_block_open",level:c++}),i=0,t=o.length;i<t;i++){for(e.tokens.push({type:"footnote_open",id:i,level:c++}),o[i].tokens?(s=[],s.push({type:"paragraph_open",tight:!1,level:c++}),s.push({type:"inline",content:"",level:c,children:o[i].tokens}),s.push({type:"paragraph_close",tight:!1,level:--c})):o[i].label&&(s=h[":"+o[i].label]),e.tokens=e.tokens.concat(s),e.tokens[e.tokens.length-1].type==="paragraph_close"?a=e.tokens.pop():a=null,r=o[i].count>0?o[i].count:1,n=0;n<r;n++)e.tokens.push({type:"footnote_anchor",id:i,subId:n,level:c});a&&e.tokens.push(a),e.tokens.push({type:"footnote_close",level:--c})}e.tokens.push({type:"footnote_block_close",level:--c})}}var ar=` 
33()[]'".,!?-`;function on(e){return e.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1")}function Aa(e){var i,t,n,r,a,o,s,l,u,c,d,h,p=e.tokens;if(e.env.abbreviations){for(e.env.abbrRegExp||(h="(^|["+ar.split("").map(on).join("")+"])("+Object.keys(e.env.abbreviations).map(function(m){return m.substr(1)}).sort(function(m,v){return v.length-m.length}).map(on).join("|")+")($|["+ar.split("").map(on).join("")+"])",e.env.abbrRegExp=new RegExp(h,"g")),c=e.env.abbrRegExp,t=0,n=p.length;t<n;t++)if(p[t].type==="inline"){for(r=p[t].children,i=r.length-1;i>=0;i--)if(a=r[i],a.type==="text"){for(l=0,o=a.content,c.lastIndex=0,u=a.level,s=[];d=c.exec(o);)c.lastIndex>l&&s.push({type:"text",content:o.slice(l,d.index+d[1].length),level:u}),s.push({type:"abbr_open",title:e.env.abbreviations[":"+d[2]],level:u++}),s.push({type:"text",content:d[2],level:u}),s.push({type:"abbr_close",level:--u}),l=c.lastIndex-d[3].length;s.length&&(l<o.length&&s.push({type:"text",content:o.slice(l),level:u}),p[t].children=r=[].concat(r.slice(0,i),s,r.slice(i+1)))}}}}var Ta=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Ia=/\((c|tm|r|p)\)/ig,La={c:"©",r:"®",p:"§",tm:"™"};function Ra(e){return e.indexOf("(")<0?e:e.replace(Ia,function(i,t){return La[t.toLowerCase()]})}function Oa(e){var i,t,n,r,a;if(e.options.typographer){for(a=e.tokens.length-1;a>=0;a--)if(e.tokens[a].type==="inline")for(r=e.tokens[a].children,i=r.length-1;i>=0;i--)t=r[i],t.type==="text"&&(n=t.content,n=Ra(n),Ta.test(n)&&(n=n.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/mg,"$1—$2").replace(/(^|\s)--(\s|$)/mg,"$1–$2").replace(/(^|[^-\s])--([^-\s]|$)/mg,"$1–$2")),t.content=n)}}var Pa=/['"]/,or=/['"]/g,Na=/[-\s()\[\]]/,sr="’";function lr(e,i){return i<0||i>=e.length?!1:!Na.test(e[i])}function Ge(e,i,t){return e.substr(0,i)+t+e.substr(i+1)}function Da(e){var i,t,n,r,a,o,s,l,u,c,d,h,p,m,v,b,w;if(e.options.typographer){for(w=[],v=e.tokens.length-1;v>=0;v--)if(e.tokens[v].type==="inline"){for(b=e.tokens[v].children,w.length=0,i=0;i<b.length;i++)if(t=b[i],!(t.type!=="text"||Pa.test(t.text))){for(s=b[i].level,p=w.length-1;p>=0&&!(w[p].level<=s);p--);w.length=p+1,n=t.content,a=0,o=n.length;e:for(;a<o&&(or.lastIndex=a,r=or.exec(n),!!r);){if(l=!lr(n,r.index-1),a=r.index+1,m=r[0]==="'",u=!lr(n,a),!u&&!l){m&&(t.content=Ge(t.content,r.index,sr));continue}if(d=!u,h=!l,h){for(p=w.length-1;p>=0&&(c=w[p],!(w[p].level<s));p--)if(c.single===m&&w[p].level===s){c=w[p],m?(b[c.token].content=Ge(b[c.token].content,c.pos,e.options.quotes[2]),t.content=Ge(t.content,r.index,e.options.quotes[3])):(b[c.token].content=Ge(b[c.token].content,c.pos,e.options.quotes[0]),t.content=Ge(t.content,r.index,e.options.quotes[1])),w.length=p;continue e}}d?w.push({token:i,pos:r.index,single:m,level:s}):h&&m&&(t.content=Ge(t.content,r.index,sr))}}}}}var sn=[["block",_a],["abbr",Sa],["references",Ea],["inline",Ca],["footnote_tail",Ma],["abbr2",Aa],["replacements",Oa],["smartquotes",Da]];function pi(){this.options={},this.ruler=new fe;for(var e=0;e<sn.length;e++)this.ruler.push(sn[e][0],sn[e][1])}pi.prototype.process=function(e){var i,t,n;for(n=this.ruler.getRules(""),i=0,t=n.length;i<t;i++)n[i](e)};function je(e,i,t,n,r){var a,o,s,l,u,c,d;for(this.src=e,this.parser=i,this.options=t,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.parentType="root",this.ddIndent=-1,this.level=0,this.result="",o=this.src,c=0,d=!1,s=l=c=0,u=o.length;l<u;
33l++){if(a=o.charCodeAt(l),!d)if(a===32){c++;continue}else d=!0;(a===10||l===u-1)&&(a!==10&&l++,this.bMarks.push(s),this.eMarks.push(l),this.tShift.push(c),d=!1,c=0,s=l+1)}this.bMarks.push(o.length),this.eMarks.push(o.length),this.tShift.push(0),this.lineMax=this.bMarks.length-1}je.prototype.isEmpty=function(i){return this.bMarks[i]+this.tShift[i]>=this.eMarks[i]};je.prototype.skipEmptyLines=function(i){for(var t=this.lineMax;i<t&&!(this.bMarks[i]+this.tShift[i]<this.eMarks[i]);i++);return i};je.prototype.skipSpaces=function(i){for(var t=this.src.length;i<t&&this.src.charCodeAt(i)===32;i++);return i};je.prototype.skipChars=function(i,t){for(var n=this.src.length;i<n&&this.src.charCodeAt(i)===t;i++);return i};je.prototype.skipCharsBack=function(i,t,n){if(i<=n)return i;for(;i>n;)if(t!==this.src.charCodeAt(--i))return i+1;return i};je.prototype.getLines=function(i,t,n,r){var a,o,s,l,u,c=i;if(i>=t)return"";if(c+1===t)return o=this.bMarks[c]+Math.min(this.tShift[c],n),s=r?this.eMarks[c]+1:this.eMarks[c],this.src.slice(o,s);for(l=new Array(t-i),a=0;c<t;c++,a++)u=this.tShift[c],u>n&&(u=n),u<0&&(u=0),o=this.bMarks[c]+u,c+1<t||r?s=this.eMarks[c]+1:s=this.eMarks[c],l[a]=this.src.slice(o,s);return l.join("")};function Fa(e,i,t){var n,r;if(e.tShift[i]-e.blkIndent<4)return!1;for(r=n=i+1;n<t;){if(e.isEmpty(n)){n++;continue}if(e.tShift[n]-e.blkIndent>=4){n++,r=n;continue}break}return e.line=n,e.tokens.push({type:"code",content:e.getLines(i,r,4+e.blkIndent,!0),block:!0,lines:[i,e.line],level:e.level}),!0}function ja(e,i,t,n){var r,a,o,s,l,u=!1,c=e.bMarks[i]+e.tShift[i],d=e.eMarks[i];if(c+3>d||(r=e.src.charCodeAt(c),r!==126&&r!==96)||(l=c,c=e.skipChars(c,r),a=c-l,a<3)||(o=e.src.slice(c,d).trim(),o.indexOf("`")>=0))return!1;if(n)return!0;for(s=i;s++,!(s>=t||(c=l=e.bMarks[s]+e.tShift[s],d=e.eMarks[s],c<d&&e.tShift[s]<e.blkIndent));)if(e.src.charCodeAt(c)===r&&!(e.tShift[s]-e.blkIndent>=4)&&(c=e.skipChars(c,r),!(c-l<a)&&(c=e.skipSpaces(c),!(c<d)))){u=!0;break}return a=e.tShift[i],e.line=s+(u?1:0),e.tokens.push({type:"fence",params:o,content:e.getLines(i+1,s,a,!0),lines:[i,e.line],level:e.level}),!0}function Ba(e,i,t,n){var r,a,o,s,l,u,c,d,h,p,m,v=e.bMarks[i]+e.tShift[i],b=e.eMarks[i];if(v>b||e.src.charCodeAt(v++)!==62||e.level>=e.options.maxNesting)return!1;if(n)return!0;for(e.src.charCodeAt(v)===32&&v++,l=e.blkIndent,e.blkIndent=0,s=[e.bMarks[i]],e.bMarks[i]=v,v=v<b?e.skipSpaces(v):v,a=v>=b,o=[e.tShift[i]],e.tShift[i]=v-e.bMarks[i],d=e.parser.ruler.getRules("blockquote"),r=i+1;r<t&&(v=e.bMarks[r]+e.tShift[r],b=e.eMarks[r],!(v>=b));r++){if(e.src.charCodeAt(v++)===62){e.src.charCodeAt(v)===32&&v++,s.push(e.bMarks[r]),e.bMarks[r]=v,v=v<b?e.skipSpaces(v):v,a=v>=b,o.push(e.tShift[r]),e.tShift[r]=v-e.bMarks[r];continue}if(a)break;for(m=!1,h=0,p=d.length;h<p;h++)if(d[h](e,r,t,!0)){m=!0;break}if(m)break;s.push(e.bMarks[r]),o.push(e.tShift[r]),e.tShift[r]=-1337}for(u=e.parentType,e.parentType="blockquote",e.tokens.push({type:"blockquote_open",lines:c=[i,0],level:e.level++}),e.parser.tokenize(e,i,r),e.tokens.push({type:"blockquote_close",level:--e.level}),e.parentType=u,c[1]=e.line,h=0;h<o.length;h++)e.bMarks[h+i]=s[h],e.tShift[h+i]=o[h];return e.blkIndent=l,!0}function qa(e,i,t,n){var r,a,o,s=e.bMarks[i],l=e.eMarks[i];if(s+=e.tShift[i],s>l||(r=e.src.charCodeAt(s++),r!==42&&r!==45&&r!==95))return!1;for(a=1;s<l;){if(o=e.src.charCodeAt(s++),o!==r&&o!==32)return!1;o===r&&a++}return a<3?!1:(n||(e.line=i+1,e.tokens.push({type:"hr",lines:[i,e.line],level:e.level})),!0)}function ur(e,i){var t,n,r;return n=e.bMarks[i]+e.tShift[i],r=e.eMarks[i],n>=r||(t=e.src.charCodeAt(n++),t!==42&&t!==45&&t!==43)||n<r&&e.src.charCodeAt(n)!==32?-1:n}function cr(e,i){var t,n=e.bMarks[i]+e.tShift[i],r=e.eMarks[i];if(n+1>=r||(t=e.src.charCodeAt(n++),t<48||t>57))return-1;for(;;){if(n>=r)return-1;if(t=e.src.charCodeAt(n++),!(t>=48&&t<=57)){if(t===41||t===46)break;return-1}}return n<r&&e.src.charCodeAt(n)!==32?-1:n}function Ua(e,i){var t,n,r=e.level+2;for(t=i+2,n=e.tokens.length-2;t<n;t++)e.tokens[t].level===r&&e.tokens[t].type==="paragraph_open"&&(e.tokens[t+2].tight=!0,e.tokens[t].tight=!0,t+=2)}function za(e,i,t,n){var r,a,o,s,l,u,c,d,h,p,m,v,b,w,_,x,N,M,j=!0,W,H,Z,te;if((d=cr(e,i))>=0)b=!0;else if((d=ur(e,i))>=0)b=!1;else return!1;if(e.level>=e.options.maxNesting)return!1;
33if(v=e.src.charCodeAt(d-1),n)return!0;for(_=e.tokens.length,b?(c=e.bMarks[i]+e.tShift[i],m=Number(e.src.substr(c,d-c-1)),e.tokens.push({type:"ordered_list_open",order:m,lines:N=[i,0],level:e.level++})):e.tokens.push({type:"bullet_list_open",lines:N=[i,0],level:e.level++}),r=i,x=!1,W=e.parser.ruler.getRules("list");r<t&&(w=e.skipSpaces(d),h=e.eMarks[r],w>=h?p=1:p=w-d,p>4&&(p=1),p<1&&(p=1),a=d-e.bMarks[r]+p,e.tokens.push({type:"list_item_open",lines:M=[i,0],level:e.level++}),s=e.blkIndent,l=e.tight,o=e.tShift[i],u=e.parentType,e.tShift[i]=w-e.bMarks[i],e.blkIndent=a,e.tight=!0,e.parentType="list",e.parser.tokenize(e,i,t,!0),(!e.tight||x)&&(j=!1),x=e.line-i>1&&e.isEmpty(e.line-1),e.blkIndent=s,e.tShift[i]=o,e.tight=l,e.parentType=u,e.tokens.push({type:"list_item_close",level:--e.level}),r=i=e.line,M[1]=r,w=e.bMarks[i],!(r>=t||e.isEmpty(r)||e.tShift[r]<e.blkIndent));){for(te=!1,H=0,Z=W.length;H<Z;H++)if(W[H](e,r,t,!0)){te=!0;break}if(te)break;if(b){if(d=cr(e,r),d<0)break}else if(d=ur(e,r),d<0)break;if(v!==e.src.charCodeAt(d-1))break}return e.tokens.push({type:b?"ordered_list_close":"bullet_list_close",level:--e.level}),N[1]=r,e.line=r,j&&Ua(e,_),!0}function Ha(e,i,t,n){var r,a,o,s,l,u=e.bMarks[i]+e.tShift[i],c=e.eMarks[i];if(u+4>c||e.src.charCodeAt(u)!==91||e.src.charCodeAt(u+1)!==94||e.level>=e.options.maxNesting)return!1;for(s=u+2;s<c;s++){if(e.src.charCodeAt(s)===32)return!1;if(e.src.charCodeAt(s)===93)break}return s===u+2||s+1>=c||e.src.charCodeAt(++s)!==58?!1:(n||(s++,e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.refs||(e.env.footnotes.refs={}),l=e.src.slice(u+2,s-2),e.env.footnotes.refs[":"+l]=-1,e.tokens.push({type:"footnote_reference_open",label:l,level:e.level++}),r=e.bMarks[i],a=e.tShift[i],o=e.parentType,e.tShift[i]=e.skipSpaces(s)-s,e.bMarks[i]=s,e.blkIndent+=4,e.parentType="footnote",e.tShift[i]<e.blkIndent&&(e.tShift[i]+=e.blkIndent,e.bMarks[i]-=e.blkIndent),e.parser.tokenize(e,i,t,!0),e.parentType=o,e.blkIndent-=4,e.tShift[i]=a,e.bMarks[i]=r,e.tokens.push({type:"footnote_reference_close",level:--e.level})),!0)}function $a(e,i,t,n){var r,a,o,s=e.bMarks[i]+e.tShift[i],l=e.eMarks[i];if(s>=l||(r=e.src.charCodeAt(s),r!==35||s>=l))return!1;for(a=1,r=e.src.charCodeAt(++s);r===35&&s<l&&a<=6;)a++,r=e.src.charCodeAt(++s);return a>6||s<l&&r!==32?!1:(n||(l=e.skipCharsBack(l,32,s),o=e.skipCharsBack(l,35,s),o>s&&e.src.charCodeAt(o-1)===32&&(l=o),e.line=i+1,e.tokens.push({type:"heading_open",hLevel:a,lines:[i,e.line],level:e.level}),s<l&&e.tokens.push({type:"inline",content:e.src.slice(s,l).trim(),level:e.level+1,lines:[i,e.line],children:[]}),e.tokens.push({type:"heading_close",hLevel:a,level:e.level})),!0)}function Va(e,i,t){var n,r,a,o=i+1;return o>=t||e.tShift[o]<e.blkIndent||e.tShift[o]-e.blkIndent>3||(r=e.bMarks[o]+e.tShift[o],a=e.eMarks[o],r>=a)||(n=e.src.charCodeAt(r),n!==45&&n!==61)||(r=e.skipChars(r,n),r=e.skipSpaces(r),r<a)?!1:(r=e.bMarks[i]+e.tShift[i],e.line=o+1,e.tokens.push({type:"heading_open",hLevel:n===61?1:2,lines:[i,e.line],level:e.level}),e.tokens.push({type:"inline",content:e.src.slice(r,e.eMarks[i]).trim(),level:e.level+1,lines:[i,e.line-1],children:[]}),e.tokens.push({type:"heading_close",hLevel:n===61?1:2,level:e.level}),!0)}var fi={};["article","aside","button","blockquote","body","canvas","caption","col","colgroup","dd","div","dl","dt","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","iframe","li","map","object","ol","output","p","pre","progress","script","section","style","table","tbody","td","textarea","tfoot","th","tr","thead","ul","video"].forEach(function(e){fi[e]=!0});var Ga=/^<([a-zA-Z]{1,15})[\s\/>]/,Wa=/^<\/([a-zA-Z]{1,15})[\s>]/;function Ka(e){var i=e|32;return i>=97&&i<=122}function Ya(e,i,t,n){var r,a,o,s=e.bMarks[i],l=e.eMarks[i],u=e.tShift[i];if(s+=u,!e.options.html||u>3||s+2>=l||e.src.charCodeAt(s)!==60)return!1;if(r=e.src.charCodeAt(s+1),r===33||r===63){if(n)return!0}else if(r===47||Ka(r)){if(r===47){if(a=e.src.slice(s,l).match(Wa),!a)return!1}else if(a=e.src.slice(s,l).match(Ga),!a)return!1;if(fi[a[1].toLowerCase()]!==!0)return!1;if(n)return!0}else return!1;for(o=i+1;o<e.lineMax&&!e.isEmpty(o);)o++;return e.line=o,e.tokens.push({type:"htmlblock",level:e.level,lines:[i,e.line],content:e.getLines(i,o,
330,!0)}),!0}function ln(e,i){var t=e.bMarks[i]+e.blkIndent,n=e.eMarks[i];return e.src.substr(t,n-t)}function Ja(e,i,t,n){var r,a,o,s,l,u,c,d,h,p,m;if(i+2>t||(l=i+1,e.tShift[l]<e.blkIndent)||(o=e.bMarks[l]+e.tShift[l],o>=e.eMarks[l])||(r=e.src.charCodeAt(o),r!==124&&r!==45&&r!==58)||(a=ln(e,i+1),!/^[-:| ]+$/.test(a))||(u=a.split("|"),u<=2))return!1;for(d=[],s=0;s<u.length;s++){if(h=u[s].trim(),!h){if(s===0||s===u.length-1)continue;return!1}if(!/^:?-+:?$/.test(h))return!1;h.charCodeAt(h.length-1)===58?d.push(h.charCodeAt(0)===58?"center":"right"):h.charCodeAt(0)===58?d.push("left"):d.push("")}if(a=ln(e,i).trim(),a.indexOf("|")===-1||(u=a.replace(/^\||\|$/g,"").split("|"),d.length!==u.length))return!1;if(n)return!0;for(e.tokens.push({type:"table_open",lines:p=[i,0],level:e.level++}),e.tokens.push({type:"thead_open",lines:[i,i+1],level:e.level++}),e.tokens.push({type:"tr_open",lines:[i,i+1],level:e.level++}),s=0;s<u.length;s++)e.tokens.push({type:"th_open",align:d[s],lines:[i,i+1],level:e.level++}),e.tokens.push({type:"inline",content:u[s].trim(),lines:[i,i+1],level:e.level,children:[]}),e.tokens.push({type:"th_close",level:--e.level});for(e.tokens.push({type:"tr_close",level:--e.level}),e.tokens.push({type:"thead_close",level:--e.level}),e.tokens.push({type:"tbody_open",lines:m=[i+2,0],level:e.level++}),l=i+2;l<t&&!(e.tShift[l]<e.blkIndent||(a=ln(e,l).trim(),a.indexOf("|")===-1));l++){for(u=a.replace(/^\||\|$/g,"").split("|"),e.tokens.push({type:"tr_open",level:e.level++}),s=0;s<u.length;s++)e.tokens.push({type:"td_open",align:d[s],level:e.level++}),c=u[s].substring(u[s].charCodeAt(0)===124?1:0,u[s].charCodeAt(u[s].length-1)===124?u[s].length-1:u[s].length).trim(),e.tokens.push({type:"inline",content:c,level:e.level,children:[]}),e.tokens.push({type:"td_close",level:--e.level});e.tokens.push({type:"tr_close",level:--e.level})}return e.tokens.push({type:"tbody_close",level:--e.level}),e.tokens.push({type:"table_close",level:--e.level}),p[1]=m[1]=l,e.line=l,!0}function yt(e,i){var t,n,r=e.bMarks[i]+e.tShift[i],a=e.eMarks[i];return r>=a||(n=e.src.charCodeAt(r++),n!==126&&n!==58)||(t=e.skipSpaces(r),r===t)||t>=a?-1:t}function Za(e,i){var t,n,r=e.level+2;for(t=i+2,n=e.tokens.length-2;t<n;t++)e.tokens[t].level===r&&e.tokens[t].type==="paragraph_open"&&(e.tokens[t+2].tight=!0,e.tokens[t].tight=!0,t+=2)}function Xa(e,i,t,n){var r,a,o,s,l,u,c,d,h,p,m,v,b,w;if(n)return e.ddIndent<0?!1:yt(e,i)>=0;if(c=i+1,e.isEmpty(c)&&++c>t||e.tShift[c]<e.blkIndent||(r=yt(e,c),r<0)||e.level>=e.options.maxNesting)return!1;u=e.tokens.length,e.tokens.push({type:"dl_open",lines:l=[i,0],level:e.level++}),o=i,a=c;e:for(;;){for(w=!0,b=!1,e.tokens.push({type:"dt_open",lines:[o,o],level:e.level++}),e.tokens.push({type:"inline",content:e.getLines(o,o+1,e.blkIndent,!1).trim(),level:e.level+1,lines:[o,o],children:[]}),e.tokens.push({type:"dt_close",level:--e.level});;){if(e.tokens.push({type:"dd_open",lines:s=[c,0],level:e.level++}),v=e.tight,h=e.ddIndent,d=e.blkIndent,m=e.tShift[a],p=e.parentType,e.blkIndent=e.ddIndent=e.tShift[a]+2,e.tShift[a]=r-e.bMarks[a],e.tight=!0,e.parentType="deflist",e.parser.tokenize(e,a,t,!0),(!e.tight||b)&&(w=!1),b=e.line-a>1&&e.isEmpty(e.line-1),e.tShift[a]=m,e.tight=v,e.parentType=p,e.blkIndent=d,e.ddIndent=h,e.tokens.push({type:"dd_close",level:--e.level}),s[1]=c=e.line,c>=t||e.tShift[c]<e.blkIndent)break e;if(r=yt(e,c),r<0)break;a=c}if(c>=t||(o=c,e.isEmpty(o))||e.tShift[o]<e.blkIndent||(a=o+1,a>=t)||(e.isEmpty(a)&&a++,a>=t)||e.tShift[a]<e.blkIndent||(r=yt(e,a),r<0))break}return e.tokens.push({type:"dl_close",level:--e.level}),l[1]=c,e.line=c,w&&Za(e,u),!0}function Qa(e,i){var t,n,r,a,o,s=i+1,l;if(t=e.lineMax,s<t&&!e.isEmpty(s)){for(l=e.parser.ruler.getRules("paragraph");s<t&&!e.isEmpty(s);s++)if(!(e.tShift[s]-e.blkIndent>3)){for(r=!1,a=0,o=l.length;a<o;a++)if(l[a](e,s,t,!0)){r=!0;break}if(r)break}}return n=e.getLines(i,s,e.blkIndent,!1).trim(),e.line=s,n.length&&(e.tokens.push({type:"paragraph_open",tight:!1,lines:[i,e.line],level:e.level}),e.tokens.push({type:"inline",content:n,level:e.level+1,lines:[i,e.line],children:[]}),e.tokens.push({type:"paragraph_close",tight:!1,level:e.level})),!0}var bt=[["code",Fa],["fences",ja,["paragraph","blockquote","list"]],["blockquote",Ba,["paragraph","blockquote","list"]],["hr",qa,["paragraph","blockquote","list"]],["list",za,["paragraph","blockquote"]],["footnote",Ha,["paragraph"]],["heading",$a,["paragraph","blockquote"]],["lheading",Va],["htmlblock",Ya,["paragraph","blockquote"]],["table",Ja,["paragraph"]],["deflist",Xa,["paragraph"]],["paragraph",Qa]];function jn(){this.ruler=new fe;for(var e=0;e<bt.length;e++)this.ruler.push(bt[e][0],bt[e][1],{alt:(bt[e][2]||[]).slice()})}jn.prototype.tokenize=function(e,i,t){for(var n=this.ruler.getRules(""),r=n.length,a=i,o=!1,s,l;
33a<t&&(e.line=a=e.skipEmptyLines(a),!(a>=t||e.tShift[a]<e.blkIndent));){for(l=0;l<r&&(s=n[l](e,a,t,!1),!s);l++);if(e.tight=!o,e.isEmpty(e.line-1)&&(o=!0),a=e.line,a<t&&e.isEmpty(a)){if(o=!0,a++,a<t&&e.parentType==="list"&&e.isEmpty(a))break;e.line=a}}};var eo=/[\n\t]/g,to=/\r[\n\u0085]|[\u2424\u2028\u0085]/g,no=/\u00a0/g;jn.prototype.parse=function(e,i,t,n){var r,a=0,o=0;if(!e)return[];e=e.replace(no," "),e=e.replace(to,`
34`),e.indexOf("	")>=0&&(e=e.replace(eo,function(s,l){var u;return e.charCodeAt(l)===10?(a=l+1,o=0,s):(u="    ".slice((l-a-o)%4),o=l-a+1,u)})),r=new je(e,this,i,t,n),this.tokenize(r,r.line,r.lineMax)};function ro(e){switch(e){case 10:case 92:case 96:case 42:case 95:case 94:case 91:case 93:case 33:case 38:case 60:case 62:case 123:case 125:case 36:case 37:case 64:case 126:case 43:case 61:case 58:return!0;default:return!1}}function io(e,i){for(var t=e.pos;t<e.posMax&&!ro(e.src.charCodeAt(t));)t++;return t===e.pos?!1:(i||(e.pending+=e.src.slice(e.pos,t)),e.pos=t,!0)}function ao(e,i){var t,n,r=e.pos;if(e.src.charCodeAt(r)!==10)return!1;if(t=e.pending.length-1,n=e.posMax,!i)if(t>=0&&e.pending.charCodeAt(t)===32)if(t>=1&&e.pending.charCodeAt(t-1)===32){for(var a=t-2;a>=0;a--)if(e.pending.charCodeAt(a)!==32){e.pending=e.pending.substring(0,a+1);break}e.push({type:"hardbreak",level:e.level})}else e.pending=e.pending.slice(0,-1),e.push({type:"softbreak",level:e.level});else e.push({type:"softbreak",level:e.level});for(r++;r<n&&e.src.charCodeAt(r)===32;)r++;return e.pos=r,!0}var Bn=[];for(var dr=0;dr<256;dr++)Bn.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){Bn[e.charCodeAt(0)]=1});function oo(e,i){var t,n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92)return!1;if(n++,n<r){if(t=e.src.charCodeAt(n),t<256&&Bn[t]!==0)return i||(e.pending+=e.src[n]),e.pos+=2,!0;if(t===10){for(i||e.push({type:"hardbreak",level:e.level}),n++;n<r&&e.src.charCodeAt(n)===32;)n++;return e.pos=n,!0}}return i||(e.pending+="\\"),e.pos++,!0}function so(e,i){var t,n,r,a,o,s=e.pos,l=e.src.charCodeAt(s);if(l!==96)return!1;for(t=s,s++,n=e.posMax;s<n&&e.src.charCodeAt(s)===96;)s++;for(r=e.src.slice(t,s),a=o=s;(a=e.src.indexOf("`",o))!==-1;){for(o=a+1;o<n&&e.src.charCodeAt(o)===96;)o++;if(o-a===r.length)return i||e.push({type:"code",content:e.src.slice(s,a).replace(/[ \n]+/g," ").trim(),block:!1,level:e.level}),e.pos=o,!0}return i||(e.pending+=r),e.pos+=r.length,!0}function lo(e,i){var t,n,r,a=e.posMax,o=e.pos,s,l;if(e.src.charCodeAt(o)!==126||i||o+4>=a||e.src.charCodeAt(o+1)!==126||e.level>=e.options.maxNesting||(s=o>0?e.src.charCodeAt(o-1):-1,l=e.src.charCodeAt(o+2),s===126)||l===126||l===32||l===10)return!1;for(n=o+2;n<a&&e.src.charCodeAt(n)===126;)n++;if(n>o+3)return e.pos+=n-o,i||(e.pending+=e.src.slice(o,n)),!0;for(e.pos=o+2,r=1;e.pos+1<a;){if(e.src.charCodeAt(e.pos)===126&&e.src.charCodeAt(e.pos+1)===126&&(s=e.src.charCodeAt(e.pos-1),l=e.pos+2<a?e.src.charCodeAt(e.pos+2):-1,l!==126&&s!==126&&(s!==32&&s!==10?r--:l!==32&&l!==10&&r++,r<=0))){t=!0;break}e.parser.skipToken(e)}return t?(e.posMax=e.pos,e.pos=o+2,i||(e.push({type:"del_open",level:e.level++}),e.parser.tokenize(e),e.push({type:"del_close",level:--e.level})),e.pos=e.posMax+2,e.posMax=a,!0):(e.pos=o,!1)}function uo(e,i){var t,n,r,a=e.posMax,o=e.pos,s,l;if(e.src.charCodeAt(o)!==43||i||o+4>=a||e.src.charCodeAt(o+1)!==43||e.level>=e.options.maxNesting||(s=o>0?e.src.charCodeAt(o-1):-1,l=e.src.charCodeAt(o+2),s===43)||l===43||l===32||l===10)return!1;for(n=o+2;n<a&&e.src.charCodeAt(n)===43;)n++;if(n!==o+2)return e.pos+=n-o,i||(e.pending+=e.src.slice(o,n)),!0;for(e.pos=o+2,r=1;e.pos+1<a;){if(e.src.charCodeAt(e.pos)===43&&e.src.charCodeAt(e.pos+1)===43&&(s=e.src.charCodeAt(e.pos-1),l=e.pos+2<a?e.src.charCodeAt(e.pos+2):-1,l!==43&&s!==43&&(s!==32&&s!==10?r--:l!==32&&l!==10&&r++,r<=0))){t=!0;break}e.parser.skipToken(e)}return t?(e.posMax=e.pos,e.pos=o+2,i||(e.push({type:"ins_open",level:e.level++}),e.parser.tokenize(e),e.push({type:"ins_close",level:--e.level})),e.pos=e.posMax+2,e.posMax=a,!0):(e.pos=o,!1)}function co(e,i){var t,n,r,a=e.posMax,o=e.pos,s,l;if(e.src.charCodeAt(o)!==61||i||o+4>
34=a||e.src.charCodeAt(o+1)!==61||e.level>=e.options.maxNesting||(s=o>0?e.src.charCodeAt(o-1):-1,l=e.src.charCodeAt(o+2),s===61)||l===61||l===32||l===10)return!1;for(n=o+2;n<a&&e.src.charCodeAt(n)===61;)n++;if(n!==o+2)return e.pos+=n-o,i||(e.pending+=e.src.slice(o,n)),!0;for(e.pos=o+2,r=1;e.pos+1<a;){if(e.src.charCodeAt(e.pos)===61&&e.src.charCodeAt(e.pos+1)===61&&(s=e.src.charCodeAt(e.pos-1),l=e.pos+2<a?e.src.charCodeAt(e.pos+2):-1,l!==61&&s!==61&&(s!==32&&s!==10?r--:l!==32&&l!==10&&r++,r<=0))){t=!0;break}e.parser.skipToken(e)}return t?(e.posMax=e.pos,e.pos=o+2,i||(e.push({type:"mark_open",level:e.level++}),e.parser.tokenize(e),e.push({type:"mark_close",level:--e.level})),e.pos=e.posMax+2,e.posMax=a,!0):(e.pos=o,!1)}function hr(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122}function pr(e,i){var t=i,n,r,a,o=!0,s=!0,l=e.posMax,u=e.src.charCodeAt(i);for(n=i>0?e.src.charCodeAt(i-1):-1;t<l&&e.src.charCodeAt(t)===u;)t++;return t>=l&&(o=!1),a=t-i,a>=4?o=s=!1:(r=t<l?e.src.charCodeAt(t):-1,(r===32||r===10)&&(o=!1),(n===32||n===10)&&(s=!1),u===95&&(hr(n)&&(o=!1),hr(r)&&(s=!1))),{can_open:o,can_close:s,delims:a}}function ho(e,i){var t,n,r,a,o,s,l,u=e.posMax,c=e.pos,d=e.src.charCodeAt(c);if(d!==95&&d!==42||i)return!1;if(l=pr(e,c),t=l.delims,!l.can_open)return e.pos+=t,i||(e.pending+=e.src.slice(c,e.pos)),!0;if(e.level>=e.options.maxNesting)return!1;for(e.pos=c+t,s=[t];e.pos<u;){if(e.src.charCodeAt(e.pos)===d){if(l=pr(e,e.pos),n=l.delims,l.can_close){for(a=s.pop(),o=n;a!==o;){if(o<a){s.push(a-o);break}if(o-=a,s.length===0)break;e.pos+=a,a=s.pop()}if(s.length===0){t=a,r=!0;break}e.pos+=n;continue}l.can_open&&s.push(n),e.pos+=n;continue}e.parser.skipToken(e)}return r?(e.posMax=e.pos,e.pos=c+t,i||((t===2||t===3)&&e.push({type:"strong_open",level:e.level++}),(t===1||t===3)&&e.push({type:"em_open",level:e.level++}),e.parser.tokenize(e),(t===1||t===3)&&e.push({type:"em_close",level:--e.level}),(t===2||t===3)&&e.push({type:"strong_close",level:--e.level})),e.pos=e.posMax+t,e.posMax=u,!0):(e.pos=c,!1)}var po=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function fo(e,i){var t,n,r=e.posMax,a=e.pos;if(e.src.charCodeAt(a)!==126||i||a+2>=r||e.level>=e.options.maxNesting)return!1;for(e.pos=a+1;e.pos<r;){if(e.src.charCodeAt(e.pos)===126){t=!0;break}e.parser.skipToken(e)}return!t||a+1===e.pos||(n=e.src.slice(a+1,e.pos),n.match(/(^|[^\\])(\\\\)*\s/))?(e.pos=a,!1):(e.posMax=e.pos,e.pos=a+1,i||e.push({type:"sub",level:e.level,content:n.replace(po,"$1")}),e.pos=e.posMax+1,e.posMax=r,!0)}var mo=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function vo(e,i){var t,n,r=e.posMax,a=e.pos;if(e.src.charCodeAt(a)!==94||i||a+2>=r||e.level>=e.options.maxNesting)return!1;for(e.pos=a+1;e.pos<r;){if(e.src.charCodeAt(e.pos)===94){t=!0;break}e.parser.skipToken(e)}return!t||a+1===e.pos||(n=e.src.slice(a+1,e.pos),n.match(/(^|[^\\])(\\\\)*\s/))?(e.pos=a,!1):(e.posMax=e.pos,e.pos=a+1,i||e.push({type:"sup",level:e.level,content:n.replace(mo,"$1")}),e.pos=e.posMax+1,e.posMax=r,!0)}function go(e,i){var t,n,r,a,o,s,l,u,c=!1,d=e.pos,h=e.posMax,p=e.pos,m=e.src.charCodeAt(p);if(m===33&&(c=!0,m=e.src.charCodeAt(++p)),m!==91||e.level>=e.options.maxNesting||(t=p+1,n=nt(e,p),n<0))return!1;if(s=n+1,s<h&&e.src.charCodeAt(s)===40){for(s++;s<h&&(u=e.src.charCodeAt(s),!(u!==32&&u!==10));s++);if(s>=h)return!1;for(p=s,ci(e,s)?(a=e.linkContent,s=e.pos):a="",p=s;s<h&&(u=e.src.charCodeAt(s),!(u!==32&&u!==10));s++);if(s<h&&p!==s&&di(e,s))for(o=e.linkContent,s=e.pos;s<h&&(u=e.src.charCodeAt(s),!(u!==32&&u!==10));s++);else o="";if(s>=h||e.src.charCodeAt(s)!==41)return e.pos=d,!1;s++}else{if(e.linkLevel>0)return!1;for(;s<h&&(u=e.src.charCodeAt(s),!(u!==32&&u!==10));s++);if(s<h&&e.src.charCodeAt(s)===91&&(p=s+1,s=nt(e,s),s>=0?r=e.src.slice(p,s++):s=p-1),r||(typeof r>"u"&&(s=n+1),r=e.src.slice(t,n)),l=e.env.references[hi(r)],!l)return e.pos=d,!1;a=l.href,o=l.title}return i||(e.pos=t,e.posMax=n,c?e.push({type:"image",src:a,title:o,alt:e.src.substr(t,n-t),level:e.level}):(e.push({type:"link_open",href:a,title:o,level:e.level++}),e.linkLevel++,e.parser.tokenize(e),e.linkLevel--,e.push({type:"link_close",level:--e.level}))),e.pos=s,e.posMax=h,!0}function yo(e,i){var t,n,r,a,o=e.posMax,s=e.pos;return s+2>
34=o||e.src.charCodeAt(s)!==94||e.src.charCodeAt(s+1)!==91||e.level>=e.options.maxNesting||(t=s+2,n=nt(e,s+1),n<0)?!1:(i||(e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.list||(e.env.footnotes.list=[]),r=e.env.footnotes.list.length,e.pos=t,e.posMax=n,e.push({type:"footnote_ref",id:r,level:e.level}),e.linkLevel++,a=e.tokens.length,e.parser.tokenize(e),e.env.footnotes.list[r]={tokens:e.tokens.splice(a)},e.linkLevel--),e.pos=n+1,e.posMax=o,!0)}function bo(e,i){var t,n,r,a,o=e.posMax,s=e.pos;if(s+3>o||!e.env.footnotes||!e.env.footnotes.refs||e.src.charCodeAt(s)!==91||e.src.charCodeAt(s+1)!==94||e.level>=e.options.maxNesting)return!1;for(n=s+2;n<o;n++){if(e.src.charCodeAt(n)===32||e.src.charCodeAt(n)===10)return!1;if(e.src.charCodeAt(n)===93)break}return n===s+2||n>=o||(n++,t=e.src.slice(s+2,n-1),typeof e.env.footnotes.refs[":"+t]>"u")?!1:(i||(e.env.footnotes.list||(e.env.footnotes.list=[]),e.env.footnotes.refs[":"+t]<0?(r=e.env.footnotes.list.length,e.env.footnotes.list[r]={label:t,count:0},e.env.footnotes.refs[":"+t]=r):r=e.env.footnotes.refs[":"+t],a=e.env.footnotes.list[r].count,e.env.footnotes.list[r].count++,e.push({type:"footnote_ref",id:r,subId:a,level:e.level})),e.pos=n,e.posMax=o,!0)}var ko=["coap","doi","javascript","aaa","aaas","about","acap","cap","cid","crid","data","dav","dict","dns","file","ftp","geo","go","gopher","h323","http","https","iax","icap","im","imap","info","ipp","iris","iris.beep","iris.xpc","iris.xpcs","iris.lwz","ldap","mailto","mid","msrp","msrps","mtqp","mupdate","news","nfs","ni","nih","nntp","opaquelocktoken","pop","pres","rtsp","service","session","shttp","sieve","sip","sips","sms","snmp","soap.beep","soap.beeps","tag","tel","telnet","tftp","thismessage","tn3270","tip","tv","urn","vemmi","ws","wss","xcon","xcon-userid","xmlrpc.beep","xmlrpc.beeps","xmpp","z39.50r","z39.50s","adiumxtra","afp","afs","aim","apt","attachment","aw","beshare","bitcoin","bolo","callto","chrome","chrome-extension","com-eventbrite-attendee","content","cvs","dlna-playsingle","dlna-playcontainer","dtn","dvb","ed2k","facetime","feed","finger","fish","gg","git","gizmoproject","gtalk","hcp","icon","ipn","irc","irc6","ircs","itms","jar","jms","keyparc","lastfm","ldaps","magnet","maps","market","message","mms","ms-help","msnim","mumble","mvn","notes","oid","palm","paparazzi","platform","proxy","psyc","query","res","resource","rmi","rsync","rtmp","secondlife","sftp","sgn","skype","smb","soldat","spotify","ssh","steam","svn","teamspeak","things","udp","unreal","ut2004","ventrilo","view-source","webcal","wtai","wyciwyg","xfire","xri","ymsgr"],_o=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,wo=/^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;function So(e,i){var t,n,r,a,o,s=e.pos;return e.src.charCodeAt(s)!==60||(t=e.src.slice(s),t.indexOf(">")<0)?!1:(n=t.match(wo),n?ko.indexOf(n[1].toLowerCase())<0||(a=n[0].slice(1,-1),o=Sn(a),!e.parser.validateLink(a))?!1:(i||(e.push({type:"link_open",href:o,level:e.level}),e.push({type:"text",content:a,level:e.level+1}),e.push({type:"link_close",level:e.level})),e.pos+=n[0].length,!0):(r=t.match(_o),r?(a=r[0].slice(1,-1),o=Sn("mailto:"+a),e.parser.validateLink(o)?(i||(e.push({type:"link_open",href:o,level:e.level}),e.push({type:"text",content:a,level:e.level+1}),e.push({type:"link_close",level:e.level})),e.pos+=r[0].length,!0):!1):!1))}function Nt(e,i){return e=e.source,i=i||"",function t(n,r){return n?(r=r.source||r,e=e.replace(n,r),t):new RegExp(e,i)}}var xo=/[a-zA-Z_:][a-zA-Z0-9:._-]*/,Eo=/[^"'=<>`\x00-\x20]+/,Co=/'[^']*'/,Mo=/"[^"]*"/,Ao=Nt(/(?:unquoted|single_quoted|double_quoted)/)("unquoted",Eo)("single_quoted",Co)("double_quoted",Mo)(),To=Nt(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name",xo)("attr_value",Ao)(),Io=Nt(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute",To)(),Lo=/<\/[A-Za-z][A-Za-z0-9]*\s*>/,Ro=/<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,Oo=/<[?].*?[?]>/,Po=/<![A-Z]+\s+[^>]*>/,No=/<!\[CDATA\[[\s\S]*?\]\]>/,Do=Nt(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/
34)("open_tag",Io)("close_tag",Lo)("comment",Ro)("processing",Oo)("declaration",Po)("cdata",No)();function Fo(e){var i=e|32;return i>=97&&i<=122}function jo(e,i){var t,n,r,a=e.pos;return!e.options.html||(r=e.posMax,e.src.charCodeAt(a)!==60||a+2>=r)||(t=e.src.charCodeAt(a+1),t!==33&&t!==63&&t!==47&&!Fo(t))||(n=e.src.slice(a).match(Do),!n)?!1:(i||e.push({type:"htmltag",content:e.src.slice(a,a+n[0].length),level:e.level}),e.pos+=n[0].length,!0)}var Bo=/^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,qo=/^&([a-z][a-z0-9]{1,31});/i;function Uo(e,i){var t,n,r,a=e.pos,o=e.posMax;if(e.src.charCodeAt(a)!==38)return!1;if(a+1<o){if(t=e.src.charCodeAt(a+1),t===35){if(r=e.src.slice(a).match(Bo),r)return i||(n=r[1][0].toLowerCase()==="x"?parseInt(r[1].slice(1),16):parseInt(r[1],10),e.pending+=Nn(n)?Ct(n):Ct(65533)),e.pos+=r[0].length,!0}else if(r=e.src.slice(a).match(qo),r){var s=si(r[1]);if(r[1]!==s)return i||(e.pending+=s),e.pos+=r[0].length,!0}}return i||(e.pending+="&"),e.pos++,!0}var un=[["text",io],["newline",ao],["escape",oo],["backticks",so],["del",lo],["ins",uo],["mark",co],["emphasis",ho],["sub",fo],["sup",vo],["links",go],["footnote_inline",yo],["footnote_ref",bo],["autolink",So],["htmltag",jo],["entity",Uo]];function Dt(){this.ruler=new fe;for(var e=0;e<un.length;e++)this.ruler.push(un[e][0],un[e][1]);this.validateLink=zo}Dt.prototype.skipToken=function(e){var i=this.ruler.getRules(""),t=i.length,n=e.pos,r,a;if((a=e.cacheGet(n))>0){e.pos=a;return}for(r=0;r<t;r++)if(i[r](e,!0)){e.cacheSet(n,e.pos);return}e.pos++,e.cacheSet(n,e.pos)};Dt.prototype.tokenize=function(e){for(var i=this.ruler.getRules(""),t=i.length,n=e.posMax,r,a;e.pos<n;){for(a=0;a<t&&(r=i[a](e,!1),!r);a++);if(r){if(e.pos>=n)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};Dt.prototype.parse=function(e,i,t,n){var r=new Fe(e,this,i,t,n);this.tokenize(r)};function zo(e){var i=["vbscript","javascript","file","data"],t=e.trim().toLowerCase();return t=xe(t),!(t.indexOf(":")!==-1&&i.indexOf(t.split(":")[0])!==-1)}var Ho={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","replacements","smartquotes","references","abbr2","footnote_tail"]},block:{rules:["blockquote","code","fences","footnote","heading","hr","htmlblock","lheading","list","paragraph","table"]},inline:{rules:["autolink","backticks","del","emphasis","entity","escape","footnote_ref","htmltag","links","newline","text"]}}},$o={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{},block:{},inline:{}}},Vo={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","abbr2"]},block:{rules:["blockquote","code","fences","heading","hr","htmlblock","lheading","list","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","htmltag","links","newline","text"]}}},Go={default:Ho,full:$o,commonmark:Vo};function mi(e,i,t){this.src=i,this.env=t,this.options=e.options,this.tokens=[],this.inlineMode=!1,this.inline=e.inline,this.block=e.block,this.renderer=e.renderer,this.typographer=e.typographer}function Ce(e,i){typeof e!="string"&&(i=e,e="default"),i&&i.linkify!=null&&console.warn(`linkify option is removed. Use linkify plugin instead:
35
36import Remarkable from 'remarkable';
37import linkify from 'remarkable/linkify';
38new Remarkable().use(linkify)
39`),this.inline=new Dt,this.block=new jn,this.core=new pi,this.renderer=new Fn,this.ruler=new fe,this.options={},this.configure(Go[e]),this.set(i||{})}Ce.prototype.set=function(e){Pn(this.options,e)};Ce.prototype.configure=function(e){var i=this;if(!e)throw new Error("Wrong `remarkable` preset, check name/content");e.options&&i.set(e.options),e.components&&Object.keys(e.components).forEach(function(t){e.components[t].rules&&i[t].ruler.enable(e.components[t].rules,!0)})};Ce.prototype.use=function(e,i){return e(this,i),this};Ce.prototype.parse=function(e,i){var t=new mi(this,e,i);return this.core.process(t),t.tokens}
39;Ce.prototype.render=function(e,i){return i=i||{},this.renderer.render(this.parse(e,i),this.options,i)};Ce.prototype.parseInline=function(e,i){var t=new mi(this,e,i);return t.inlineMode=!0,this.core.process(t),t.tokens};Ce.prototype.renderInline=function(e,i){return i=i||{},this.renderer.render(this.parseInline(e,i),this.options,i)};let qn={};function vi(e){qn={...e}}function Wo(e,i){if(!i)return!1;try{if(!e.startsWith("http://")&&!e.startsWith("https://"))return!1;const n=new URL(e).hostname.toLowerCase(),r=i.toLowerCase();return n===r||n===`www.${r}`||n.endsWith(`.${r}`)}catch{return!1}}function Ko(e){const i=qn;return!i.utm_source||!i.utm_medium||!i.utm_campaign?null:{utm_source:i.utm_source,utm_medium:i.utm_medium,utm_campaign:i.utm_campaign,utm_content:e}}function Yo(e,i){try{if(!e.startsWith("http://")&&!e.startsWith("https://"))return e;const t=new URL(e),n=t.searchParams,r=["utm_source","utm_medium","utm_campaign","utm_content"];for(const a of r){const o=i[a];o&&!n.has(a)&&n.set(a,o)}return t.toString()}catch(t){return console.warn("Failed to append UTM parameters to URL:",e,t),e}}function Un(e,i){const t=qn;if(!t.utm_target_domain||!Wo(e,t.utm_target_domain))return e;const n=Ko(i);return n?Yo(e,n):e}const zn=new Ce({html:!0});zn.renderer.rules.image=function(e,i){const t=e[i];return`<img src="${t.src}" alt="${t.alt}" title="${t.title||""}" style="max-width: 100%; height: auto; display: block; margin: 1em auto;">`};zn.renderer.rules.link_open=function(e,i,t){const{escapeHtml:n,replaceEntities:r}=Dn,a=e[i],o=Un(a.href,"response-link"),s=a.title?' title="'+n(r(a.title))+'"':"";var l=t!=null&&t.linkTarget?' target="'+t.linkTarget+'"':"";return'<a href="'+n(o)+'"'+s+l+' class="response-a">'};const gi=`
40    :host {
41        --main-color: #0087be;
42        --text-color: #FFFFFF;
43        --text-size: 1em;
44        --font-family: 'Inter', sans-serif, 'Avenir', 'Helvetica', 'Arial';
45        --bubble-color: #0087be;
46        --reply-color: #23282d;
47        --reply-bubble-color: #f1f1f1;
48        --ai-bubble-color: #b3d6ec;
49        --ai-text-color: #000000;
50        --ai-sources-color: #0087be;
51
52        --avatar-size: 1.5em;
53        --ai-avatar-border: none;
54        --ai-avatar-border-radius: 0;
55        --ai-bubble-border: 0.5px solid rgb(197, 206, 214);
56        --ai-bubble-border-radius: 0 10px 10px;
57        --reply-bubble-border: 0.5px solid rgb(197, 206, 214);
58        --reply-bubble-border-radius: 10px;
59
60        --bubble-max-width: calc(97.5% - 24px);
61        --bubble-padding: .6em .75em .6em 1.3em;
62
63        --header-background-color: var(--main-color);
64        --header-text-color: var(--text-color);
65        --header-padding: 10px;
66        --header-border: none;
67
68        --support-link-background-color: #f8f8f8;
69        --support-link-color: inherit;
70
71        --chat-element-border: none;
72
73        --input-area-background-color: #ffffff;
74        --input-area-border: 1px solid rgba(0, 0, 0, 0.1);
75        --input-area-border-radius: 5px;
76        --input-area-box-shadow: rgba(149, 157, 165, 0.2) 0px 1px 12px 0px;
77        --input-text-color: inherit;
78        --input-placeholder-color: rgba(0, 0, 0, 0.4);
79        --input-focus-border: 1px solid rgba(0, 0, 0, 0.1);
80
81        --submit-button-color: transparent;
82        --submit-button-text-color: currentColor;
83        --submit-button-border-radius: 4px;
84        --submit-button-hover-color: transparent;
85
86        --scrollbar-width: 8px;
87        --scrollbar-thumb-color: rgba(0, 0, 0, 0.2);
88        --scrollbar-thumb-hover-color: rgba(0, 0, 0, 0.4);
89        --scrollbar-track-color: transparent;
90
91        --notice-link-color: #0087be;
92        --notice-link-color-hover: #0087be;
93
94        --response-link-color: #0087be;
95        --response-link-color-hover: #0087be;
96
97        --feedback-default-color: currentColor;
98        --feedback-positive-color: green;
99        --feedback-negative-color: red;
100        --feedback-positive-hover-color: green;
101        --feedback-negative-hover-color: red;
102    }
103
104    #chat-content {
105        width: 100%;
106        height: 100%;
107        overflow: auto;
108        display: none;
109        background-color: var(--background-color, transparent);
110    }
111
112    #chat-content::-webkit-scrollbar {
113        width: var(--scrollbar-width);
114    }
115
116    #chat-content::-webkit-scrollbar-track {
117        background: var(--scrollbar-track-color);
118    }
119
120    #chat-content::-webkit-scrollbar-thumb {
121        background: var(--scrollbar-thumb-color);
122        border-radius: 10px;
123    }
124
125    #chat-content::-webkit-scrollbar-thumb:hover {
126        background: var(--scrollbar-thumb-hover-color);
127    }
128
129    .error {
130        display: flex;
131        justify-content: center;
132        width: 100%;
133    }
134
135    .error-content {
136        display: flex;
137        align-items: center;
138        gap: 8px;
139        color: #dc3545;
140        font-family: var(--font-family);
141    }
142`,Jo=`
143    ${gi}
144
145    @keyframes fadeIn {
146        0% { opacity: 0; transform: scale(0.5); }
147        100% { opacity: 1; transform: scale(1); }
148    }
149
150    @keyframes slideInUp {
151        0% {
152          transform: translateY(20%);
153          opacity: 0;
154        }
155        100% {
156          transform: translateY(0);
157          opacity: 1;
158        }
159    }
160
161    @keyframes fadeOutDown {
162        0% {
163          transform: translateY(0);
164          opacity: 1;
165        }
166        100% {
167          transform: translateY(20%);
168          opacity: 0;
169        }
170    }
171
172    @keyframes fadeInAndMove {
173        0% {
174            top: initial;
175            right: initial;
176            width: initial;
177            height: initial;
178            border-radius: initial;
179            opacity: 0;
180        }
181        100% {
182            top: 0;
183            right: 0;
184            width: 50px;
185            height: 50px;
186            border-radius: 0;
187            opacity: 1;
188            z-index: 1000;
189        }
190    }
191
192    @keyframes fadeOut {
193        from { opacity: 1; }
194        to { opacity: 0; }
195    }
196
197    #chat-widget {
198        display: none;
199        font-family: var(--font-family);
200        font-size: 0.9rem;
201        box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
202        border-radius: 10px;
203    }
204
205    #chat-widget.loaded {
206        display: flex;
207    }
208
209    #chat-icon {
210        display: flex;
211        fill: var(--text-color);
212        position: fixed;
213        bottom: 20px;
214        right: 20px;
215        width: 60px;
216        height: 60px;
217        background-color: var(--main-color);
218        color: var(--text-color);
219        border-radius: 50%;
220        justify-content: center;
221        align-items: center;
222        cursor: pointer;
223        transition: background-color 0.3s ease;
224    }
225
226    #chat-icon:hover {
227        filter: brightness(115%);
228    }
229
230    #chat-icon .icon {
231        width: 50%;
232        height: 50%;
233    }
234
235    #chat-widget.open #open-icon {
236        display: none;
237    }
238
239    #chat-widget.open #close-icon {
240        display: inline-block;
241    }
242
243    #chat-widget:not(.open) #open-icon {
244        display: inline-block;
245    }
246
247    #chat-widget:not(.open) #close-icon {
248        display: none;
249    }
250
251    #chat-content {
252        position: fixed;
253        bottom: 90px;
254        right: 20px;
255        width: 400px;
256        height: 700px;
257        border-radius: 10px;
258        background-color: var(--background-color, white);
259        box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
260        transition: transform 0.3s ease, opacity 0.3s ease;
261    }
262
263    #chat-widget.open #chat-content {
264        display: flex;
265        flex-direction: column;
266        animation: slideInUp 0.5s ease-out;
267    }
268
269    #chat-widget.closing #chat-content {
270        animation: fadeOutDown 0.5s ease-in forwards;
271    }
272
273    #chat-header {
274        background-color: var(--header-background-color);
275        padding: var(--header-padding);
276        color: var(--header-text-color);
277        border-top-left-radius: 10px;
278        border-top-right-radius: 10px;
279        border-bottom: var(--header-border);
280        text-align: center;
281        font-family: var(--font-family);
282    }
283
284    #chat-close {
285        position: absolute;
286        right: 10px;
287        top: 10px;
288        cursor: pointer;
289        display: none;
290        fill: var(--text-color);
291        width: 20px;
292    }
293
294    #chat-clear {
295        position: absolute;
296        left: 10px;
297        top: 10px;
298        cursor: pointer;
299        fill: var(--text-color);
300        width: 12px;
301    }
302
303    .header-title {
304        margin: 0;
305        font-size: 1rem;
306    }
307
308    .header-subtitle {
309        margin: 0;
310        font-size: 0.8rem;
311    }
312
313    #support-link {
314        padding: 10px;
315        background-color: var(--support-link-background-color);
316        color: var(--support-link-color);
317        text-align: center;
318        overflow: hidden;
319        text-overflow: ellipsis;
320        max-height: 20px;
321        font-family: var(--font-family);
322    }
323
324    ::slotted(*) {
325        margin: 0;
326        font-size: 0.7rem;
327    }
328
329    @media screen and (max-width: 768px) {
330        #chat-content {
331            bottom: 0;
332            right: 0;
333            width: 100%;
334            height: 100%;
335            border-radius: 0;
336        }
337
338        #chat-header {
339            border-top-left-radius: 0;
340            border-top-right-radius: 0;
341        }
342
343        #chat-widget.open #chat-icon {
344            display: none;
345        }
346
347        #chat-widget.open #chat-close {
348            display: block;
349        }
350    }
351`,Zo=`
352    ${gi}
353
354    #chat-embed {
355        width: 100%;
356        height: 100%;
357        position: relative;
358        display: flex;
359        justify-content: center;
360        align-items: center;
361        background-color: transparent;
362    }
363
364    #chat-embed.loaded .loader {
365        display: none;
366    }
367
368    #chat-embed.loaded #chat-content {
369        display: flex;
370    }
371
372    #chat-clear {
373        display: none;
374    }
375
376    .loader {
377        border: 4px solid #f3f3f3;
378        border-radius: 50%;
379        border-top: 4px solid var(--main-color);
380        width: 40px;
381        height: 40px;
382        animation: spin 2s linear infinite;
383        align-self: center;
384    }
385
386    @keyframes spin {
387        0% { transform: rotate(0deg); }
388        100% { transform: rotate(360deg); }
389    }
390`,Xo='<svg id="open-icon" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="0" fill="none" width="24" height="24"/><g><path d="M3 12c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h8c1.1 0 2 .9 2 2v5c0 1.1-.9 2-2 2H9v3l-3-3H3zM21 18c1.1 0 2-.9 2-2v-5c0-1.1-.9-2-2-2h-6v1c0 2.2-1.8 4-4 4v2c0 1.1.9 2 2 2h2v3l3-3h3z"/></g></svg>',fr='<svg id="close-icon" class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="0" fill="none" width="24" height="24"/><g><path d="M17.705 7.705l-1.41-1.41L12 10.59 7.705 6.295l-1.41 1.41L10.59 12l-4.295 4.295 1.41 1.41L12 13.41l4.295 4.295 1.41-1.41L13.41 12l4.295-4.295z"/></g></svg>',yi='<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M105.1 202.6c7.7-21.8 20.2-42.3 37.8-59.8c62.5-62.5 163.8-62.5 226.3 0L386.3 160H336c-17.7 0-32 14.3-32 32s14.3 32 32 32H463.5c0 0 0 0 0 0h.4c17.7 0 32-14.3 32-32V64c0-17.7-14.3-32-32-32s-32 14.3-32 32v51.2L414.4 97.6c-87.5-87.5-229.3-87.5-316.8 0C73.2 122 55.6 150.7 44.8 181.4c-5.9 16.7 2.9 34.9 19.5 40.8s34.9-2.9 40.8-19.5zM39 289.3c-5 1.5-9.8 4.2-13.7 8.2c-4 4-6.7 8.8-8.1 14c-.3 1.2-.6 2.5-.8 3.8c-.3 1.7-.4 3.4-.4 5.1V448c0 17.7 14.3 32 32 32s32-14.3 32-32V396.9l17.6 17.5 0 0c87.5 87.4 229.3 87.4 316.7 0c24.4-24.4 42.1-53.1 52.9-83.7c5.9-16.7-2.9-34.9-19.5-40.8s-34.9 2.9-40.8 19.5c-7.7 21.8-20.2 42.3-37.8 59.8c-62.5 62.5-163.8 62.5-226.3 0l-.1-.1L125.6 352H176c17.7 0 32-14.3 32-32s-14.3-32-32-32H48.4c-1.6 0-3.2 .1-4.8 .3s-3.1 .5-4.6 1z"></path></svg>',Qo=`
391    <style>${Jo}</style>
392    <div id="chat-widget" part="widget">
393        <div id="chat-icon">
394            ${Xo}
395            ${fr}
396        </div>
397        <div id="chat-content" part="chat-content">
398            <div id="chat-header" part="header">
399                <h1 class="header-title" part="title"></h1>
400                <p class="header-subtitle" part="subtitle"></p>
401                <div id="chat-close" part="close-button">
402                    ${fr}
403                </div>
404                <div id="chat-clear" part="clear-button">
405                    ${yi}
406                </div>
407            </div>
408        </div>
409    </div>
410`,es=`
411    <style>${Zo}</style>
412    <div id="chat-embed" part="widget">
413        <div class="loader"></div>
414        <div id="chat-clear" part="clear-button">
415            ${yi}
416        </div>
417        <div id="chat-content" part="chat-content" />
418    </div>
419`;function ts(e){return e?`
420        <div class="feedback">
421            <svg class="feedback-icon feedback-icon-positive" fill="var(--feedback-default-color)" data-message-id=${e} viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20.22 9.55C19.79 9.04 19.17 8.75 18.5 8.75H14.47V6C14.47 4.48 13.24 3.25 11.64 3.25C10.94 3.25 10.31 3.67 10.03 4.32L7.49 10.25H5.62C4.31 10.25 3.25 11.31 3.25 12.62V18.39C3.25 19.69 4.32 20.75 5.62 20.75H17.18C18.27 20.75 19.2 19.97 19.39 18.89L20.71 11.39C20.82 10.73 20.64 10.06 20.21 9.55H20.22ZM5.62 19.25C5.14 19.25 4.75 18.86 4.75 18.39V12.62C4.75 12.14 5.14 11.75 5.62 11.75H7.23V19.25H5.62ZM17.92 18.63C17.86 18.99 17.55 19.25 17.18 19.25H8.74V11.15L11.41 4.9C11.45 4.81 11.54 4.74 11.73 4.74C12.42 4.74 12.97 5.3 12.97 5.99V10.24H18.5C18.73 10.24 18.93 10.33 19.07 10.5C19.21 10.67 19.27 10.89 19.23 11.12L17.91 18.62L17.92 18.63Z"/></svg>
422            <svg class="feedback-icon feedback-icon-negative" fill="var(--feedback-default-color)" data-message-id=${e} viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20.22 9.55C19.79 9.04 19.17 8.75 18.5 8.75H14.47V6C14.47 4.48 13.24 3.25 11.64 3.25C10.94 3.25 10.31 3.67 10.03 4.32L7.49 10.25H5.62C4.31 10.25 3.25 11.31 3.25 12.62V18.39C3.25 19.69 4.32 20.75 5.62 20.75H17.18C18.27 20.75 19.2 19.97 19.39 18.89L20.71 11.39C20.82 10.73 20.64 10.06 20.21 9.55H20.22ZM5.62 19.25C5.14 19.25 4.75 18.86 4.75 18.39V12.62C4.75 12.14 5.14 11.75 5.62 11.75H7.23V19.25H5.62ZM17.92 18.63C17.86 18.99 17.55 19.25 17.18 19.25H8.74V11.15L11.41 4.9C11.45 4.81 11.54 4.74 11.73 4.74C12.42 4.74 12.97 5.3 12.97 5.99V10.24H18.5C18.73 10.24 18.93 10.33 19.07 10.5C19.21 10.67 19.27 10.89 19.23 11.12L17.91 18.62L17.92 18.63Z"/></svg>
423        </div>
424    `:""}function ns(e){const{escapeHtml:i}=Dn;return!e||e.length===0?`
425        <div class="sources"></div>
426    `:`
427      <details class="sources">
428        <summary class="sources-summary">Sources</summary>
429        <ul class="sources-ul">
430          ${e.map(n=>{const r=Un(n.url,"source-link");return`
431        <li class="sources-li">
432          <a class="sources-a" href="${i(r)}" target="_blank">
433            <svg class="sources-icons" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="link" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512">
434              <path fill="currentColor" d="M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"></path>
435            </svg>
436            ${n.title}
437          </a>
438        </li>
439      `}).join("")}
440        </ul>
441      </details>
442    `}function rs(e){const{escapeHtml:i}=Dn;if(e===null)return"";e===""&&(e="{}");let t;try{t=JSON.parse(e)}catch{return""}let n=t.text??"Powered by Support AI. Some responses may be inaccurate.";if(t.link){const r=t.linkText??"Learn More.",a=Un(t.link,"notice-link");n+=` <a href="${i(a)}" target="_blank" class="notice-link">${r}</a>`}return`
443    <hr>
444    <div class="notice">
445      ${n}
446    </div>
447  `}function mr(e,i,t,n){return`
448    <div>
449        <div class="response">
450            ${zn.render(e)}
451        </div>
452        <div class="footer">
453            ${ts(t)}
454            ${ns(i)}
455            ${rs(n)}
456        </div>
457    </div>
458  `}function is(e){return`
459    <div style="display: flex; justify-content: center; width: 100%;">
460      <div style="display: flex; align-items: center; gap: 8px; color: #dc3545;">
461        <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
462          <path d="M12 4c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm1 13h-2v-2h2v2zm0-4h-2V7h2v6z"/>
463        </svg>
464        ${e}
465      </div>
466    </div>
467  `}function bi(e){return ss(e)||os(e)||ki(e)||as()}function as(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
468In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function os(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ss(e){if(Array.isArray(e))return xn(e)}function ls(e,i){var t=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=ki(e))||i){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
469In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){t=t.call(e)},n:function(){var u=t.next();return a=u.done,u},e:function(u){o=!0,s=u},f:function(){try{!a&&t.return!=null&&t.return()}finally{if(o)throw s}}}}function ki(e,i){if(e){if(typeof e=="string")return xn(e,i);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return xn(e,i)}}function xn(e,i){(i==null||i>e.length)&&(i=e.length);for(var t=0,n=new Array(i);t<i;t++)n[t]=e[t];return n}function En(e){var i=typeof Map=="function"?new Map:void 0;return En=function(n){if(n===null||!cs(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i<"u"){if(i.has(n))return i.get(n);i.set(n,r)}function r(){return us(n,arguments,rt(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),it(r,n)},En(e)}function us(e,i,t){if(Hn())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,i);var r=new(e.bind.apply(e,n));return t&&it(r,t.prototype),r}function cs(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function O(e,i,t){return i=rt(i),ds(e,Hn()?Reflect.construct(i,t||[],rt(e).constructor):i.apply(e,t))}
469function ds(e,i){if(i&&(R(i)==="object"||typeof i=="function"))return i;if(i!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return de(e)}function de(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hn(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hn=function(){return!!e})()}function rt(e){return rt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rt(e)}function P(e,i){if(typeof i!="function"&&i!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(i&&i.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),i&&it(e,i)}function it(e,i){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},it(e,i)}function f(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */f=function(){return i};var e,i={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(C,S,E){C[S]=E.value},a=typeof Symbol=="function"?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(C,S,E){return Object.defineProperty(C,S,{value:E,enumerable:!0,configurable:!0,writable:!0}),C[S]}try{u({},"")}catch{u=function(E,L,D){return E[L]=D}}function c(C,S,E,L){var D=S&&S.prototype instanceof w?S:w,I=Object.create(D.prototype),K=new Y(L||[]);return r(I,"_invoke",{value:te(C,E,K)}),I}function d(C,S,E){try{return{type:"normal",arg:C.call(S,E)}}catch(L){return{type:"throw",arg:L}}}i.wrap=c;var h="suspendedStart",p="suspendedYield",m="executing",v="completed",b={};function w(){}function _(){}function x(){}var N={};u(N,o,function(){return this});var M=Object.getPrototypeOf,j=M&&M(M(Me([])));j&&j!==t&&n.call(j,o)&&(N=j);var W=x.prototype=w.prototype=Object.create(N);function H(C){["next","throw","return"].forEach(function(S){u(C,S,function(E){return this._invoke(S,E)})})}function Z(C,S){function E(D,I,K,oe){var le=d(C[D],C,I);if(le.type!=="throw"){var Ae=le.arg,ke=Ae.value;return ke&&R(ke)=="object"&&n.call(ke,"__await")?S.resolve(ke.__await).then(function(Te){E("next",Te,K,oe)},function(Te){E("throw",Te,K,oe)}):S.resolve(ke).then(function(Te){Ae.value=Te,K(Ae)},function(Te){return E("throw",Te,K,oe)})}oe(le.arg)}var L;r(this,"_invoke",{value:function(I,K){function oe(){return new S(function(le,Ae){E(I,K,le,Ae)})}return L=L?L.then(oe,oe):oe()}})}function te(C,S,E){var L=h;return function(D,I){if(L===m)throw new Error("Generator is already running");if(L===v){if(D==="throw")throw I;return{value:e,done:!0}}for(E.method=D,E.arg=I;;){var K=E.delegate;if(K){var oe=X(K,E);if(oe){if(oe===b)continue;return oe}}if(E.method==="next")E.sent=E._sent=E.arg;else if(E.method==="throw"){if(L===h)throw L=v,E.arg;E.dispatchException(E.arg)}else E.method==="return"&&E.abrupt("return",E.arg);L=m;var le=d(C,S,E);if(le.type==="normal"){if(L=E.done?v:p,le.arg===b)continue;return{value:le.arg,done:E.done}}le.type==="throw"&&(L=v,E.method="throw",E.arg=le.arg)}}}function X(C,S){var E=S.method,L=C.iterator[E];if(L===e)return S.delegate=null,E==="throw"&&C.iterator.return&&(S.method="return",S.arg=e,X(C,S),S.method==="throw")||E!=="return"&&(S.method="throw",S.arg=new TypeError("The iterator does not provide a '"+E+"' method")),b;var D=d(L,C.iterator,S.arg);if(D.type==="throw")return S.method="throw",S.arg=D.arg,S.delegate=null,b;var I=D.arg;return I?I.done?(S[C.resultName]=I.value,S.next=C.nextLoc,S.method!=="return"&&(S.method="next",S.arg=e),S.delegate=null,b):I:(S.method="throw",S.arg=new TypeError("iterator result is not an object"),S.delegate=null,b)}function G(C){var S={tryLoc:C[0]};1 in C&&(S.catchLoc=C[1]),2 in C&&(S.finallyLoc=C[2],S.afterLoc=C[3]),this.tryEntries.push(S)}function Q(C){var S=C.completion||{};S.type="normal",delete S.arg,C.completion=S}function Y(C){this.tryEntries=[{tryLoc:"root"}
469],C.forEach(G,this),this.reset(!0)}function Me(C){if(C||C===""){var S=C[o];if(S)return S.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var E=-1,L=function D(){for(;++E<C.length;)if(n.call(C,E))return D.value=C[E],D.done=!1,D;return D.value=e,D.done=!0,D};return L.next=L}}throw new TypeError(R(C)+" is not iterable")}return _.prototype=x,r(W,"constructor",{value:x,configurable:!0}),r(x,"constructor",{value:_,configurable:!0}),_.displayName=u(x,l,"GeneratorFunction"),i.isGeneratorFunction=function(C){var S=typeof C=="function"&&C.constructor;return!!S&&(S===_||(S.displayName||S.name)==="GeneratorFunction")},i.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,x):(C.__proto__=x,u(C,l,"GeneratorFunction")),C.prototype=Object.create(W),C},i.awrap=function(C){return{__await:C}},H(Z.prototype),u(Z.prototype,s,function(){return this}),i.AsyncIterator=Z,i.async=function(C,S,E,L,D){D===void 0&&(D=Promise);var I=new Z(c(C,S,E,L),D);return i.isGeneratorFunction(S)?I:I.next().then(function(K){return K.done?K.value:I.next()})},H(W),u(W,l,"Generator"),u(W,o,function(){return this}),u(W,"toString",function(){return"[object Generator]"}),i.keys=function(C){var S=Object(C),E=[];for(var L in S)E.push(L);return E.reverse(),function D(){for(;E.length;){var I=E.pop();if(I in S)return D.value=I,D.done=!1,D}return D.done=!0,D}},i.values=Me,Y.prototype={constructor:Y,reset:function(S){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(Q),!S)for(var E in this)E.charAt(0)==="t"&&n.call(this,E)&&!isNaN(+E.slice(1))&&(this[E]=e)},stop:function(){this.done=!0;var S=this.tryEntries[0].completion;if(S.type==="throw")throw S.arg;return this.rval},dispatchException:function(S){if(this.done)throw S;var E=this;function L(Ae,ke){return K.type="throw",K.arg=S,E.next=Ae,ke&&(E.method="next",E.arg=e),!!ke}for(var D=this.tryEntries.length-1;D>=0;--D){var I=this.tryEntries[D],K=I.completion;if(I.tryLoc==="root")return L("end");if(I.tryLoc<=this.prev){var oe=n.call(I,"catchLoc"),le=n.call(I,"finallyLoc");if(oe&&le){if(this.prev<I.catchLoc)return L(I.catchLoc,!0);if(this.prev<I.finallyLoc)return L(I.finallyLoc)}else if(oe){if(this.prev<I.catchLoc)return L(I.catchLoc,!0)}else{if(!le)throw new Error("try statement without catch or finally");if(this.prev<I.finallyLoc)return L(I.finallyLoc)}}}},abrupt:function(S,E){for(var L=this.tryEntries.length-1;L>=0;--L){var D=this.tryEntries[L];if(D.tryLoc<=this.prev&&n.call(D,"finallyLoc")&&this.prev<D.finallyLoc){var I=D;break}}I&&(S==="break"||S==="continue")&&I.tryLoc<=E&&E<=I.finallyLoc&&(I=null);var K=I?I.completion:{};return K.type=S,K.arg=E,I?(this.method="next",this.next=I.finallyLoc,b):this.complete(K)},complete:function(S,E){if(S.type==="throw")throw S.arg;return S.type==="break"||S.type==="continue"?this.next=S.arg:S.type==="return"?(this.rval=this.arg=S.arg,this.method="return",this.next="end"):S.type==="normal"&&E&&(this.next=E),b},finish:function(S){for(var E=this.tryEntries.length-1;E>=0;--E){var L=this.tryEntries[E];if(L.finallyLoc===S)return this.complete(L.completion,L.afterLoc),Q(L),b}},catch:function(S){for(var E=this.tryEntries.length-1;E>=0;--E){var L=this.tryEntries[E];if(L.tryLoc===S){var D=L.completion;if(D.type==="throw"){var I=D.arg;Q(L)}return I}}throw new Error("illegal catch attempt")},delegateYield:function(S,E,L){return this.delegate={iterator:Me(S),resultName:E,nextLoc:L},this.method==="next"&&(this.arg=e),b}},i}function vr(e,i,t,n,r,a,o){try{var s=e[a](o),l=s.value}catch(u){t(u);return}s.done?i(l):Promise.resolve(l).then(n,r)}function k(e){return function(){var i=this,t=arguments;return new Promise(function(n,r){var a=e.apply(i,t);function o(l){vr(a,n,r,o,s,"next",l)}function s(l){vr(a,n,r,o,s,"throw",l)}o(void 0)})}}function gr(e,i){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);i&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function V(e){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};
469i%2?gr(Object(t),!0).forEach(function(n){_i(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):gr(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function _i(e,i,t){return i=wi(i),i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function R(e){"@babel/helpers - typeof";return R=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},R(e)}function g(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}function yr(e,i){for(var t=0;t<i.length;t++){var n=i[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,wi(n.key),n)}}function y(e,i,t){return i&&yr(e.prototype,i),t&&yr(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function wi(e){var i=hs(e,"string");return R(i)=="symbol"?i:String(i)}function hs(e,i){if(R(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,i);if(R(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ps=function(){function e(){g(this,e)}return y(e,null,[{key:"render",value:function(t,n){var r=document.createElement("div");r.id="error-view",r.innerText=n,t.replaceChildren(r)}}]),e}(),fs=function(){function e(){g(this,e)}return y(e,null,[{key:"onLoad",value:function(t){t.innerHTML='<div id="large-loading-ring"></div>'}},{key:"createElements",value:function(){var t=document.createElement("div");return t.id="validate-property-key-view",t}},{key:"render",value:function(t,n,r){var a=e.createElements(),o={onSuccess:n,onFail:ps.render.bind(this,t,"Your 'key' has failed authentication"),onLoad:e.onLoad.bind(this,a)};r.key&&r.verifyKey(r.key,o),t.replaceChildren(a)}}]),e}(),ie=function(){function e(){g(this,e)}return y(e,null,[{key:"unsetStyle",value:function(t,n){var r=Object.keys(n).reduce(function(a,o){return a[o]="",a},{});Object.assign(t.style,r)}},{key:"unsetActivityCSSMouseStates",value:function(t,n){n.click&&e.unsetStyle(t,n.click),n.hover&&e.unsetStyle(t,n.hover)}},{key:"unsetAllCSSMouseStates",value:function(t,n){e.unsetActivityCSSMouseStates(t,n),n.default&&e.unsetStyle(t,n.default)}},{key:"processStateful",value:function(t,n,r){var a=t.default||{},o=Object.assign(JSON.parse(JSON.stringify(V(V({},a),n))),t==null?void 0:t.hover),s=Object.assign(JSON.parse(JSON.stringify(V(V({},o),r))),t==null?void 0:t.click);return{default:a,hover:o,click:s}}},{key:"mergeStatefulStyles",value:function(t){var n={default:{},hover:{},click:{}};return t.forEach(function(r){n.default=Object.assign(n.default,r.default),n.hover=Object.assign(n.hover,r.hover),n.click=Object.assign(n.click,r.click)}),n}},{key:"overwriteDefaultWithAlreadyApplied",value:function(t,n){Object.keys(t.default||[]).forEach(function(r){var a,o=r;n.style[o]&&(a=t.default)!=null&&a[o]&&(t.default[r]=n.style[o])})}},{key:"applyToStyleIfNotDefined",value:function(t,n){for(var r in n){var a=n[r];t[r]===""&&a&&(t[r]=a)}}}]),e}(),Si=function(){function e(){g(this,e)}return y(e,null,[{key:"apply",value:function(t,n){if(n)try{e.applyStyleSheet(t,n)}catch{e.addStyleElement(t,n)}}},{key:"applyStyleSheet",value:function(t,n){var r=new CSSStyleSheet;r.replaceSync(t),n.adoptedStyleSheets.push(r)}},{key:"addStyleElement",value:function(t,n){var r=document.createElement("style");r.innerHTML=t,n.appendChild(r)}},{key:"applyDefaultStyleToComponent",value:function(t,n){n&&ie.applyToStyleIfNotDefined(t,n),ie.applyToStyleIfNotDefined(t,e.DEFAULT_COMPONENT_STYLE)}}]),e}();Si.DEFAULT_COMPONENT_STYLE={height:"350px",width:"320px",border:"1px solid #cacaca",fontFamily:"'Inter', sans-serif, Avenir, Helvetica, Arial",fontSize:"0.9rem",backgroundColor:"white",position:"relative",overflow:"hidden"};var cn=Si,ne=function(e){return e.ESCAPE="Escape",e.ENTER="Enter",e.TAB="Tab",e.ARROW_UP="ArrowUp",e.ARROW_DOWN="ArrowDown",e.ARROW_RIGHT="ArrowRight",e.ARROW_LEFT="ArrowLeft",e.BACKSPACE="Backspace",e.DELETE="Delete",e.META="Meta",e.CONTROL="Control",e}(ne||{}),we=y(function e(){g(this,e)});we.IS_SAFARI=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);we.IS_CHROMIUM=window.chrome;var xi=function(){function e(){g(this,e)}return y(e,null,[{key:"add",value:function(t,n,r){n!==void 0&&t.addEventListener("keydown",e.onKeyDown.bind(this,n)),t.oninput=e.onInput.bind(this,n,r)}},{key:"onKeyDown",value:function(t,n){var r=n.target.textContent;r&&r.length>=t&&!e.PERMITTED_KEYS.has(n.key)&&!e.isKeyCombinationPermitted(n)&&n.preventDefault()}},{key:"isKeyCombinationPermitted",value:function(t){return t.key==="a"?t.ctrlKey||t.metaKey:!1}},{key:"onInput",value:function(t,n,r){var a=r.target,o=a.textContent||"";t!==void 0&&o.length>t&&(a.textContent=o.substring(0,t),Ci.focusEndOfInput(a)),n==null||n()}}]),e}();xi.PERMITTED_KEYS=new Set([ne.BACKSPACE,ne.DELETE,ne.ARROW_RIGHT,ne.ARROW_LEFT,ne.ARROW_DOWN,ne.ARROW_UP,ne.META,ne.CONTROL,ne.ENTER]);var ms=xi,vs=function(){function e(){g(this,e)}return y(e,null,[{key:"sanitizePastedTextContent",value:function(t){var n,r;t.preventDefault();var a=(n=t.clipboardData)==null?void 0:n.getData("text/plain");(r=document.execCommand)==null||r.call(document,"insertText",!1,a)}}]),e}(),Ei=function(){function e(i,t){var n=this;g(this,e);var r,a=e.processConfig(t,i.textInput);this.elementRef=e.createContainerElement((r=a==null?void 0:a.styles)==null?void 0:r.container),this.inputElementRef=this.createInputElement(a),this._config=a,this.elementRef.appendChild(this.inputElementRef),setTimeout(function(){var o;ms.add(n.inputElementRef,(o=i.textInput)==null?void 0:o.characterLimit,i._validationHandler)})}return y(e,[{key:"createInputElement",value:function(t){var n,r,a,o=document.createElement("div");return o.id=e.TEXT_INPUT_ID,o.classList.add("text-input-styling","text-input-placeholder"),o.innerText=((n=t==null?void 0:t.placeholder)==null?void 0:n.text)||"Ask me anything!",we.IS_CHROMIUM&&e.preventAutomaticScrollUpOnNewLine(o),typeof(t==null?void 0:t.disabled)=="boolean"&&t.disabled===!0?(o.contentEditable="false",o.classList.add("text-input-disabled")):(o.contentEditable="true",this.addEventListeners(o,t)),Object.assign(o.style,(r=t==null?void 0:t.styles)==null?void 0:r.text),Object.assign(o.style,(a=t==null?void 0:t.placeholder)==null?void 0:a.style),o}},{key:"removeTextIfPlaceholder",value:function(){var t,n,r,a;this.inputElementRef.classList.contains("text-input-placeholder")&&!this.inputElementRef.classList.contains("text-input-disabled")&&((t=this._config.placeholder)!=null&&t.style&&(ie.unsetStyle(this.inputElementRef,(n=this._config.placeholder)==null?void 0:n.style),Object.assign(this.inputElementRef.style,(a=(r=this._config)==null?void 0:r.styles)==null?void 0:a.text)),e.clear(this.inputElementRef),this.inputElementRef.classList.remove("text-input-placeholder"))}},{key:"addEventListeners",value:function(t,n){var r,a,o;t.onfocus=this.onFocus.bind(this,(r=n==null?void 0:n.styles)==null?void 0:r.focus),(a=n==null?void 0:n.styles)!=null&&a.focus&&(t.onblur=this.onBlur.bind(this,n.styles.focus,(o=n==null?void 0:n.styles)==null?void 0:o.container)),t.addEventListener("keydown",this.onKeydown.bind(this)),t.onpaste=vs.sanitizePastedTextContent}},{key:"onFocus",value:function(t){var n=this;we.IS_SAFARI?setTimeout(function(){n.removeTextIfPlaceholder()}):this.removeTextIfPlaceholder(),Object.assign(this.elementRef.style,t)}},{key:"onBlur",value:function(t,n){ie.unsetStyle(this.elementRef,t),n&&Object.assign(this.elementRef.style,n)}},{key:"onKeydown",value:function(t){var n;
469t.key===ne.ENTER&&!t.ctrlKey&&!t.shiftKey&&(t.preventDefault(),(n=this.submit)==null||n.call(this))}}],[{key:"processConfig",value:function(t,n){var r,a,o,s,l;return(r=n)!==null&&r!==void 0||(n={}),(a=n.disabled)!==null&&a!==void 0||(n.disabled=t.isTextInputDisabled),(o=n.placeholder)!==null&&o!==void 0||(n.placeholder={}),(s=(l=n.placeholder).text)!==null&&s!==void 0||(l.text=t.textInputPlaceholderText),n}},{key:"preventAutomaticScrollUpOnNewLine",value:function(t){var n;t.addEventListener("keydown",function(){n=window.scrollY}),t.addEventListener("input",function(){n!==window.scrollY&&window.scrollTo({top:n})})}},{key:"clear",value:function(t){var n=window.scrollY;t.classList.contains("text-input-disabled")||(t.textContent=""),we.IS_CHROMIUM&&window.scrollTo({top:n})}},{key:"toggleEditability",value:function(t,n){t.contentEditable=n?"true":"false"}},{key:"createContainerElement",value:function(t){var n=document.createElement("div");return n.id="text-input-container",Object.assign(n.style,t),n}}]),e}();Ei.TEXT_INPUT_ID="text-input";var $n=Ei,Ci=function(){function e(){g(this,e)}return y(e,null,[{key:"focusEndOfInput",value:function(t){var n=document.createRange();n.selectNodeContents(t),n.collapse(!1);var r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(n)}},{key:"focusFromParentElement",value:function(t){var n=t.querySelector("#".concat($n.TEXT_INPUT_ID));n&&e.focusEndOfInput(n)}}]),e}();function br(e){return e.charAt(0).toUpperCase()+e.slice(1)}function gs(e){return e&&JSON.stringify(e)}function Vn(e,i,t,n){var r=`
470`.concat(br(i)," message: ").concat(JSON.stringify(e),` 
471`),a=t?"".concat(br(i)," message after interceptor: ").concat(gs(n),` 
472`):"";return r+a}function ys(e,i,t,n){return"".concat(Vn(e,i,t,n),"Make sure the ").concat(i,` message is using the Response format: https://deepchat.dev/docs/connect/#Response 
473You can also augment it using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor`)}function bs(e,i,t){var n="response";return"".concat(Vn(e,n,i,t),"Make sure the ").concat(n,' message is using the {text: string} format, e.g: {text: "Model Response"}')}function ks(e,i){var t="request";return"".concat(Vn(e,t,i),"Make sure the ").concat(t,' message is using the {body: {text: string}} format, e.g: {body: {text: "Model Response"}}')}var kr=`Make sure the events are using {text: string} or {html: string} format.
474You can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor`,ee={INVALID_KEY:"Invalid API Key",CONNECTION_FAILED:"Failed to connect",INVALID_RESPONSE:ys,INVALID_MODEL_REQUEST:ks,INVALID_MODEL_RESPONSE:bs,INVALID_STREAM_EVENT:kr,INVALID_STREAM_EVENT_MIX:"Cannot mix {text: string} and {html: string} responses.",NO_VALID_STREAM_EVENTS_SENT:`No valid stream events were sent.
475`.concat(kr)},Mi=function(){function e(){g(this,e)}return y(e,null,[{key:"addElements",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];r.forEach(function(o){return t.appendChild(o)})}},{key:"isScrollbarAtBottomOfElement",value:function(t){var n=t.scrollHeight,r=t.clientHeight,a=t.scrollTop,o=n-r;return a>=o-e.CODE_SNIPPET_GENERATION_JUMP}},{key:"cloneElement",value:function(t){var n=t.cloneNode(!0);return t.parentNode.replaceChild(n,t),n}},{key:"scrollToBottom",value:function(t){t.scrollTop=t.scrollHeight}},{key:"scrollToTop",value:function(t){t.scrollTop=0}}]),e}();Mi.CODE_SNIPPET_GENERATION_JUMP=.5;var he=Mi,Ai=function(){function e(){g(this,e)}return y(e,null,[{key:"speak",value:function(t,n){if(window.SpeechSynthesisUtterance){var r=new SpeechSynthesisUtterance(t);Object.assign(r,n),speechSynthesis.speak(r)}}},{key:"processConfig",value:function(t,n){var r={};setTimeout(function(){if(R(t)=="object"&&(t.lang&&(r.lang=t.lang),t.pitch&&(r.pitch=t.pitch),t.rate&&(r.rate=t.rate),t.volume&&(r.volume=t.volume),t.voiceName)){var a=window.speechSynthesis.getVoices().find(function(o){var s;return o.name.toLocaleLowerCase()===((s=t.voiceName)==null?void 0:s.toLocaleLowerCase())});a&&(r.voice=a)}n(r)},e.LOAD_VOICES_MS)}}]),e}();Ai.LOAD_VOICES_MS=200;var xt=Ai,Re=function(){function e(){g(this,e)}return y(e,null,[{key:"checkForContainerStyles",value:function(t,n){var r=t.containerStyle;r&&(Object.assign(n.style,r),console.error("The containerStyle property is deprecated since version 1.3.14."),console.error("Please change to using the style property instead: https://deepchat.dev/docs/styles#style"))}},{key:"handleResponseProperty",value:function(t){return console.error("The {result: ....} response object type is deprecated since version 1.3.0."),console.error("Please change to using the new response object: https://deepchat.dev/docs/connect#Response"),t.result}},{key:"processInitialMessageFile",value:function(t){var n=t.file;n&&(console.error("The file property in MessageContent is deprecated since version 1.3.17."),console.error("Please change to using the files array property: https://deepchat.dev/docs/messages/#MessageContent"),t.files=[n])}},{key:"processValidateInput",value:function(t){var n=t.validateMessageBeforeSending;if(n)return console.error("The validateMessageBeforeSending property is deprecated since version 1.3.24."),console.error("Please change to using validateInput: https://deepchat.dev/docs/interceptors#validateInput"),n}},{key:"processSubmitUserMessage",value:function(t){return console.error("The submitUserMessage(text: string) argument string type is deprecated since version 1.4.4."),console.error("Please change to using the new argument type: https://deepchat.dev/docs/methods#submitUserMessage"),{text:t}}},{key:"flagHTMLUpdateClass",value:function(t){var n;(n=t.children[0])!=null&&n.classList.contains("deep-chat-update-message")&&(console.error('The "deep-chat-update-message" html class is deprecated since version 1.4.4.'),console.error("Please change to using {..., overwrite: true} object: https://deepchat.dev/docs/connect#Response"))}}]),e}(),_s="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8c3ZnIGZpbGw9IiMwMDAwMDAiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIAoJCXZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+Cgk8cGF0aCBkPSJNMjMsMzAuMzZIOWMtMi40MDQsMC00LjM2LTEuOTU2LTQuMzYtNC4z
475NlYxNWMwLTIuNDA0LDEuOTU2LTQuMzYsNC4zNi00LjM2aDMuNjU5CgkJYzAuMTY3LTEuNTY2LDEuNDE1LTIuODEzLDIuOTgxLTIuOTgxVjUuMzMzYy0xLjEzMS0wLjE3NC0yLTEuMTU0LTItMi4zMzNjMC0xLjMwMSwxLjA1OS0yLjM2LDIuMzYtMi4zNgoJCWMxLjMwMiwwLDIuMzYsMS4wNTksMi4zNiwyLjM2YzAsMS4xNzktMC44NjksMi4xNTktMiwyLjMzM1Y3LjY2YzEuNTY2LDAuMTY3LDIuODE0LDEuNDE1LDIuOTgxLDIuOTgxSDIzCgkJYzIuNDA0LDAsNC4zNiwxLjk1Niw0LjM2LDQuMzZ2MTFDMjcuMzYsMjguNDA0LDI1LjQwNCwzMC4zNiwyMywzMC4zNnogTTksMTEuMzZjLTIuMDA3LDAtMy42NCwxLjYzMy0zLjY0LDMuNjR2MTEKCQljMCwyLjAwNywxLjYzMywzLjY0LDMuNjQsMy42NGgxNGMyLjAwNywwLDMuNjQtMS42MzMsMy42NC0zLjY0VjE1YzAtMi4wMDctMS42MzMtMy42NC0zLjY0LTMuNjRIOXogTTEzLjM4NCwxMC42NGg1LjIzMQoJCUMxOC40MzksOS4zNTQsMTcuMzM0LDguMzYsMTYsOC4zNkMxNC42NjcsOC4zNiwxMy41NjEsOS4zNTQsMTMuMzg0LDEwLjY0eiBNMTYsMS4zNmMtMC45MDQsMC0xLjY0LDAuNzM2LTEuNjQsMS42NAoJCVMxNS4wOTYsNC42NCwxNiw0LjY0YzAuOTA0LDAsMS42NC0wLjczNiwxLjY0LTEuNjRTMTYuOTA0LDEuMzYsMTYsMS4zNnogTTIwLDI3LjM2aC04Yy0xLjMwMSwwLTIuMzYtMS4wNTktMi4zNi0yLjM2CgkJczEuMDU5LTIuMzYsMi4zNi0yLjM2aDhjMS4zMDIsMCwyLjM2LDEuMDU5LDIuMzYsMi4zNlMyMS4zMDIsMjcuMzYsMjAsMjcuMzZ6IE0xMiwyMy4zNmMtMC45MDQsMC0xLjY0LDAuNzM1LTEuNjQsMS42NAoJCXMwLjczNiwxLjY0LDEuNjQsMS42NGg4YzAuOTA0LDAsMS42NC0wLjczNSwxLjY0LTEuNjRzLTAuNzM1LTEuNjQtMS42NC0xLjY0SDEyeiBNMzEsMjMuODZoLTJjLTAuMTk5LDAtMC4zNi0wLjE2MS0wLjM2LTAuMzZWMTUKCQljMC0wLjE5OSwwLjE2MS0wLjM2LDAuMzYtMC4zNmgyYzAuMTk5LDAsMC4zNiwwLjE2MSwwLjM2LDAuMzZ2OC41QzMxLjM2LDIzLjY5OSwzMS4xOTksMjMuODYsMzEsMjMuODZ6IE0yOS4zNiwyMy4xNGgxLjI3OXYtNy43OAoJCUgyOS4zNlYyMy4xNHogTTMsMjMuODZIMWMtMC4xOTksMC0wLjM2LTAuMTYxLTAuMzYtMC4zNlYxNWMwLTAuMTk5LDAuMTYxLTAuMzYsMC4zNi0wLjM2aDJjMC4xOTksMCwwLjM2LDAuMTYxLDAuMzYsMC4zNnY4LjUKCQlDMy4zNiwyMy42OTksMy4xOTksMjMuODYsMywyMy44NnogTTEuMzYsMjMuMTRoMS4yOHYtNy43OEgxLjM2VjIzLjE0eiBNMjAsMjAuMzZjLTEuMzAyLDAtMi4zNi0xLjA1OS0yLjM2LTIuMzYKCQlzMS4wNTktMi4zNiwyLjM2LTIuMzZzMi4zNiwxLjA1OSwyLjM2LDIuMzZDMjIuMzYsMTkuMzAyLDIxLjMwMiwyMC4zNiwyMCwyMC4zNnogTTIwLDE2LjM2Yy0wLjkwNCwwLTEuNjQsMC43MzYtMS42NCwxLjY0CgkJczAuNzM1LDEuNjQsMS42NCwxLjY0czEuNjQtMC43MzUsMS42NC0xLjY0UzIwLjkwNCwxNi4zNiwyMCwxNi4zNnogTTEyLDIwLjM2Yy0xLjMwMSwwLTIuMzYtMS4wNTktMi4zNi0yLjM2czEuMDU5LTIuMzYsMi4zNi0yLjM2CgkJczIuMzYsMS4wNTksMi4zNiwyLjM2QzE0LjM2LDE5LjMwMiwxMy4zMDEsMjAuMzYsMTIsMjAuMzZ6IE0xMiwxNi4zNmMtMC45MDQsMC0xLjY0LDAuNzM2LTEuNjQsMS42NHMwLjczNiwxLjY0LDEuNjQsMS42NAoJCXMxLjY0LTAuNzM1LDEuNjQtMS42NFMxMi45MDQsMTYuMzYsMTIsMTYuMzZ6Ii8+Cgk8cmVjdCBzdHlsZT0iZmlsbDpub25lOyIgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIi8+Cjwvc3ZnPg==",ws="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAMAAAC/MqoPAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////9vX18vLy/Pz86enp4+Li2tnZ1tbWzczM+fn57Ozs4N/f09LS0M/P5uXl7+/v3dzcwtncCAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAEgAAABIAEbJaz4AAAZNSURBVHja7d3bdtsqEABQYABZSLH9/3+ZpnUsIcF5iOM6PfElNoMHMfPQdq3GmL0GkLhEUqLaUExnOtOZznSmM53pTGc605nOdKYznelMZzrTmV4LXSqllKyJDkob26xWq8Zae/iH0QoWTm9d1xur4WuypQJtTd+5dqn0VjcxzNO5/57mEBvdLo8Oron6aseWOjYOFkVvjQs3DmgyONMuht52EfztP+4hdu0i6LCO808/M8c1lE/fuPGej41uUzgdtoO/75N+2ELJ9I3b3//hPXbiMenm3pR/Jt4USgcLBIp4Bh10gqKVhvLo0klCxeSky96nKcj3siw6pJIL4XsoiQ7apyvMY/V3HHrSRioLopvEhSpTCn2TPEuwKYMOIX0tAxRBf/Hpa+lfSqBv9gi1FPsNfTrMAiVmIE/vJhz61FGnQxRIEYE4vfNYdN8Rp6MlHaHotHTn8ejekaZPAjEmyvQWdZFTtYTpXqCGJ0zvcek9Yfoel76nS0ffv1NMp1ca+pkgyfRCGind4L7OWWc605l+cxjsyhqy9AGbPpClc1/nvl5VX0c/3Alk6RU3+Am7shNZ+h6bvidLr7jBB+zKBrL0irOOudmIUDzTmf5gIP+iEuXtRuTVaEmY/oZLfyNMrzjryPc0gerMTdpVg0tvjJUU6bLPcGOoUv46SLL6Wi8yhLf06C7TUyekI0efRaaYqdFltkeNpPumRPSMDxgBYvSM035FrKAmH72hRW99PrpvSdEHkTEGUvSsK3yKVDkuJ92RohcZaehzzirPpOg+J92Tolfc4Cumx5xVXpGiZ34+ICX6W84qv5GiR5NPbiIpOv6BCoSvSkTX+eiaGP092zINvBOj4x8mSf9FqejvNo/cvpOji19ZbmviL0GPLsYMFzgzCor0+Bv/ePDvSJKOb9dJ5UlnbnEHiHgzv6cdTpJOWuc/u3FEucLDOL75xGtBiefrcwgoC9NDSH/jkH6pAuXmBqPQ9HSUPVdZBH1GGOrMXAQdYxcKZfxAoK+KKBKFLosoEoX+u4giUehz8jlcnAuhp78I46yDYNAd+QLR6K+pr+yvxdBTHyVDubQh0UfSxaHSd0lbvNkVRE87JGOtc+PQd2QLQ6fHhJkKsSh6yg13tO08JPprsgrrXWH0dJd2vH1MLPprot4eXoujpzrdhngiD40ek2y92lggPcnWa8qN1Yz0BFuvZhRl0uOfR0v4Ewuli/Bg4Qr3lArqGdndQ3UPO1EunXYwnelMZzrTmc50pjOd6UxnOtOZznSmM53pTGf6kuj6oedFKV0s3fX6sX1S3bsi6a4PD7+/YAqYeBw6pIB/4qEgOqxdSPbGiim4NRRCbzs3Jj0L4UfXtQXQVRfn5IdA/Bw7RZzurEV6EtdsLeGXkIPuA+K1UoVeA0l62zmN/LqfSSft9KkepmoRuvi3nd5uKNFB9zbbXEANqdr941XO0NJx2v2jdJenpf+/3bvn0ts16ph+sd6hX7dPo2+2cZzE02Ia43bzDHqr+2Evnhz74ZHU30ffbKOeng1/NPV30Ns1gYQnSP2P6e65Pfxc6h02XZqXQCjhJ6kPL6bFo4NrGvAU4UII4SE2P1vQuZkuOxckVfehisF1MjUddN/MZBN+kvq5uf0O/xa66gyNS9ktMWlz44rO1Z8C19i5FPdHzPamXn+F3hryPfxMr78+4F+kq22kO6Rf6fUQt+puuustyWv4rbG3l/duztFB96GYoe1cTBdXMr+nw9qVM6ZfxOvzezff0nXi/ZOndvrR6Zvpm0c3h6nhdb+5iS7tsIim/qXZD9+97/Jf+rpZ5BET1ayv0GUzLhEuhBBjIy/RdVPgndutIRt9nt7p5cKFEEJ3Z+jQFDZL+XnMDXxHB73gxn5s9Kc3d3/pFciFkN/QTSXHJpX5l66gDrkQoP6hL3xsPw39la4qOiV8tH78XeSbue6N9mvWa6J/ybpc1CT1Wnh5Qq9meP8IOKH3ddH7E/ri1iYux/SXDrXR4UiPdck/wUpU+FtPf6/orja6O9KL3l56LOvVxe5Ib2qjN0d6Vbex4ghWlU3bPqI90If66MNng680FNpbJijH6kCvaF3uMzQ3+IrpFerV4Y9dffQdN3im10ivbuImhD3Qq5u4HdZkua8znelMZ/pS4z9CPVKkxowNxgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMy0yN1QxNTo0NToxNSswMDowMN1xSg4AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDMtMjdUMTU6NDU6MTUrMDA6MDCsLPKyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAABJRU5ErkJggg==",Ti=function(){function e(){g(this,e)}return y(e,null,[{key:"hide",value:function(t){t.getElementsByClassName(e.CONTAINER_CLASS)[0].style.visibility="hidden"}},{key:"applyCustomStylesToElements",value:function(t,n,r){Object.assign(t.style,r.container),Object.assign(n.style,r.avatar)}},{key:"applyCustomStyles",value:function(t,n,r,a){var o,s,l,u;if((o=r.default)!=null&&o.styles&&e.applyCustomStylesToElements(t,n,r.default.styles),a===F.USER_ROLE)(s=r.user)!=null&&s.styles&&e.applyCustomStylesToElements(t,n,r.user.styles);else{(l=r.ai)!=null&&l.styles&&e.applyCustomStylesToElements(t,n,r.ai.styles);var c=(u=r[a])==null?void 0:u.styles;c&&e.applyCustomStylesToElements(t,n,c)}}},{key:"createAvatar",value:function(t,n){var r,a,o,s,l,u=document.createElement("img");t===F.USER_ROLE?u.src=((r=n==null?void 0:n.user)==null?void 0:r.src)||((a=n==null?void 0:n.default)==null?void 0:a.src)||ws:u.src=((o=n==null?void 0:n[t])==null?void 0:o.src)||((s=n==null?void 0:n.ai)==null?void 0:s.src)||((l=n==null?void 0:n.default)==null?void 0:l.src)||_s,u.classList.add("avatar");var c=document.createElement("div");return c.classList.add(e.CONTAINER_CLASS),c.appendChild(u),n&&e.applyCustomStyles(c,u,n,t),c}},{key:"getPosition",value:function(t,n){var r,a,o,s,l,u,c,d,h,p=(l=(s=n==null?void 0:n[t])==null?void 0:s.styles)==null?void 0:l.position;return t!==F.USER_ROLE&&((r=p)!==null&&r!==void 0||(p=(c=(u=n==null?void 0:n.ai)==null?void 0:u.styles)==null?void 0:c.position)),(a=p)!==null&&a!==void 0||(p=(h=(d=n==null?void 0:n.default)==null?void 0:d.styles)==null?void 0:h.position),(o=p)!==null&&o!==void 0||(p=t===F.USER_ROLE?"right":"left"),p}},{key:"add",value:function(t,n,r){var a=typeof r=="boolean"?void 0:r,o=e.createAvatar(n,a),s=e.getPosition(n,a);o.classList.add(s==="left"?"left-item-position":"right-item-position"),t.insertAdjacentElement(s==="left"?"beforebegin":"afterend",o)}}]),e}();Ti.CONTAINER_CLASS="avatar-container";var _r=Ti,Ii=function(){function e(){g(this,e)}return y(e,null,[{key:"hide",value:function(t){t.getElementsByClassName(e.NAME_CLASS)[0].style.visibility="hidden"}},{key:"getPosition",value:function(t,n){var r,a,o,s,l,u,c=(s=n==null?void 0:n[t])==null?void 0:s.position;return t!==F.USER_ROLE&&((r=c)!==null&&r!==void 0||(c=(l=n==null?void 0:n.ai)==null?void 0:l.position)),(a=c)!==null&&a!==void 0||(c=(u=n==null?void 0:n.default)==null?void 0:u.position),(o=c)!==null&&o!==void 0||(c=t===F.USER_ROLE?"right":"left"),c}},{key:"applyStyle",value:function(t,n,r){var a,o,s,l;Object.assign(t.style,(a=r.default)==null?void 0:a.style),n===F.USER_ROLE?Object.assign(t.style,(o=r.user)==null?void 0:o.style):(Object.assign(t.style,(s=r.ai)==null?void 0:s.style),Object.assign(t.style,(l=r[n])==null?void 0:l.style))}},{key:"getNameText",value:function(t,n){var r,a,o,s,l,u;return t===F.USER_ROLE?((r=n.user)==null?void 0:r.text)||((a=n.default)==null?void 0:a.text)||"User":t===F.AI_ROLE?((o=n.ai)==null?void 0:o.text)||((s=n.default)==null?void 0:s.text)||"AI":((l=n[t])==null?void 0:l.text)||((u=n.default)==null?void 0:u.text)||t}},{key:"createName",value:function(t,n){var r=document.createElement("div");return r.classList.add(e.NAME_CLASS),r.textContent=e.getNameText(t,n),e.applyStyle(r,t,n),r}},{key:"add",value:function(t,n,r){var a=typeof r=="boolean"?{}:r,o=e.createName(n,a),s=e.getPosition(n,a);o.classList.add(s==="left"?"left-item-position":"right-item-position"),t.insertAdjacentElement(s==="left"?"beforebegin":"afterend",o)}}]),e}();Ii.NAME_CLASS="name";var wr=Ii,Ft=function(){function e(){g(this,e)}return y(e,null,[{key:"getLastElementsByClass",value:function(t,n,r){for(var a=function(){var u=t[s];if(u.bubbleElement.classList.contains(n[0])&&!n.slice(1).find(function(c){return!u.bubbleElement.classList.contains(c)}))if(r){if(!r.find(function(c){return u.bubbleElement.classList.contains(c)}))return{v:u}}else return{v:u}},o,s=t.length-1;s>=0;s-=1)if(o=a(),o)return o.v}},{key:"getLastMessage",value:function(t,n,r){for(var a=t.length-1;a>=0;a-=1)if(t[a].role===n)if(r){if(t[a][r])return t[a]}else return t[a]}},{key:"getLastTextToElement",value:function(t,n){for(var r=t.length-1;r>=0;r-=1)if(t[r][0]===n)return t[r]}}
475,{key:"overwriteMessage",value:function(t,n,r,a,o,s){var l=e.getLastElementsByClass(n,[e.getRoleClass(a),s],["loading-message-text"]),u=e.getLastMessage(t,a,o);return u&&(u[o]=r),l}},{key:"getRoleClass",value:function(t){return"".concat(t,"-message")}},{key:"fillEmptyMessageElement",value:function(t,n){n.trim().length===0&&(t.classList.add(e.EMPTY_MESSAGE_CLASS),t.innerHTML='<div style="color:#00000000">.</div>')}},{key:"unfillEmptyMessageElement",value:function(t,n){t.classList.contains(e.EMPTY_MESSAGE_CLASS)&&n.trim().length>0&&t.replaceChildren()}},{key:"getLastMessageBubbleElement",value:function(t){var n,r,a;return Array.from(((a=(r=(n=e.getLastMessageElement(t))==null?void 0:n.children)==null?void 0:r[0])==null?void 0:a.children)||[]).find(function(o){return o.classList.contains("message-bubble")})}},{key:"getLastMessageElement",value:function(t){return t.children[t.children.length-1]}},{key:"addRoleElements",value:function(t,n,r,a){r&&_r.add(t,n,r),a&&wr.add(t,n,a)}},{key:"hideRoleElements",value:function(t,n,r){var a=t[t.length-1].innerContainer;n&&_r.hide(a),r&&wr.hide(a)}}]),e}();Ft.AI_ROLE="ai";Ft.USER_ROLE="user";Ft.EMPTY_MESSAGE_CLASS="empty-message";var F=Ft,Li=function(){function e(){g(this,e)}return y(e,null,[{key:"mouseUp",value:function(t,n){ie.unsetAllCSSMouseStates(t,n),Object.assign(t.style,n.default),Object.assign(t.style,n.hover)}},{key:"mouseDown",value:function(t,n){Object.assign(t.style,n.click)}},{key:"mouseLeave",value:function(t,n){ie.unsetAllCSSMouseStates(t,n),Object.assign(t.style,n.default)}},{key:"mouseEnter",value:function(t,n){Object.assign(t.style,n.hover)}},{key:"add",value:function(t,n){t.addEventListener("mouseenter",e.mouseEnter.bind(this,t,n)),t.addEventListener("mouseleave",e.mouseLeave.bind(this,t,n)),t.addEventListener("mousedown",e.mouseDown.bind(this,t,n)),t.addEventListener("mouseup",e.mouseUp.bind(this,t,n))}}]),e}(),Ss="deep-chat-temporary-message",xs="deep-chat-suggestion-button",Cn={"deep-chat-button":{styles:{default:{backgroundColor:"white",padding:"5px",paddingLeft:"7px",paddingRight:"7px",border:"1px solid #c2c2c2",borderRadius:"6px",cursor:"pointer"},hover:{backgroundColor:"#fafafa"},click:{backgroundColor:"#f1f1f1"}}}},Sr=Object.keys(Cn),Mt=function(){function e(){g(this,e)}return y(e,null,[{key:"applySuggestionEvent",value:function(t,n){setTimeout(function(){n.addEventListener("click",function(){var r,a;(a=t.submitUserMessage)==null||a.call(t,{text:((r=n.textContent)==null?void 0:r.trim())||""})})})}},{key:"isElementTemporary",value:function(t){var n;return t?(n=t.bubbleElement.children[0])==null?void 0:n.classList.contains(Ss):!1}},{key:"doesElementContainDeepChatClass",value:function(t){return Sr.find(function(n){return t.classList.contains(n)})}},{key:"applyEvents",value:function(t,n){var r=Cn[n].events;
475Object.keys(r||[]).forEach(function(a){t.addEventListener(a,r==null?void 0:r[a])})}},{key:"getProcessedStyles",value:function(t,n,r){var a=Array.from(n.classList).reduce(function(u,c){var d,h=(d=t[c])==null?void 0:d.styles;return h&&t[c].styles&&u.push(h),u},[]),o=Cn[r].styles;if(o){var s=JSON.parse(JSON.stringify(o));s.default&&ie.overwriteDefaultWithAlreadyApplied(s,n),a.unshift(s)}var l=ie.mergeStatefulStyles(a);return ie.processStateful(l,{},{})}},{key:"applyDeepChatUtilities",value:function(t,n,r){Sr.forEach(function(o){var s=r.getElementsByClassName(o);Array.from(s||[]).forEach(function(l){var u=e.getProcessedStyles(n,l,o);at.applyStylesToElement(l,u),e.applyEvents(l,o)})});var a=r.getElementsByClassName(xs);Array.from(a).forEach(function(o){return e.applySuggestionEvent(t,o)})}}]),e}(),at=function(){function e(){g(this,e)}return y(e,null,[{key:"applyStylesToElement",value:function(t,n){var r=ie.processStateful(n,{},{});Li.add(t,r),Object.assign(t.style,r.default)}},{key:"applyEventsToElement",value:function(t,n){Object.keys(n).forEach(function(r){var a=n[r];a&&t.addEventListener(r,a)})}},{key:"applyClassUtilitiesToElement",value:function(t,n){var r=n.events,a=n.styles;r&&e.applyEventsToElement(t,r),a&&!Mt.doesElementContainDeepChatClass(t)&&e.applyStylesToElement(t,a)}},{key:"applyCustomClassUtilities",value:function(t,n){Object.keys(t).forEach(function(r){var a=n.getElementsByClassName(r);Array.from(a).forEach(function(o){t[r]&&e.applyClassUtilitiesToElement(o,t[r])})})}},{key:"apply",value:function(t,n){Mt.applyDeepChatUtilities(t,t.htmlClassUtilities,n),e.applyCustomClassUtilities(t.htmlClassUtilities,n)}}]),e}(),Mn=function(){function e(){g(this,e)}return y(e,null,[{key:"addElement",value:function(t,n){t.elementRef.appendChild(n),t.elementRef.scrollTop=t.elementRef.scrollHeight}},{key:"createElements",value:function(t,n,r){var a=t.createNewMessageElement("",r);return a.bubbleElement.classList.add("html-message"),a.bubbleElement.innerHTML=n,a}},{key:"overwrite",value:function(t,n,r,a){var o=t.messages,s=F.overwriteMessage(o,a,n,r,"html","html-message");return s&&(s.bubbleElement.innerHTML=n,at.apply(t,s.outerContainer),Re.flagHTMLUpdateClass(s.bubbleElement)),s}},{key:"add",value:function(t,n,r,a,o){var s;if(o!=null&&o.status){var l=this.overwrite(t,n,r,a);if(l)return l;o.status=!1}var u=e.createElements(t,n,r);return F.fillEmptyMessageElement(u.bubbleElement,n),at.apply(t,u.outerContainer),Re.flagHTMLUpdateClass(u.bubbleElement),t.applyCustomStyles(u,r,!1,(s=t.messageStyles)==null?void 0:s.html),e.addElement(t,u.outerContainer),u}}]),e}(),kt;function Ri(e){return kt=kt||document.createElement("textarea"),kt.innerHTML="&"+e+";",kt.value}var Es=Object.prototype.hasOwnProperty;function Cs(e,i){return e?Es.call(e,i):!1}function Oi(e){var i=[].slice.call(arguments,1);return i.forEach(function(t){if(t){if(R(t)!="object")throw new TypeError(t+"must be object");Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}var Ms=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function ot(e){return e.indexOf("\\")<0?e:e.replace(Ms,"$1")}function Pi(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function An(e){if(e>65535){e-=65536;var i=55296+(e>>10),t=56320+(e&1023);return String.fromCharCode(i,t)}return String.fromCharCode(e)}var As=/&([a-z#][a-z0-9]{1,31});/gi,Ts=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;function Is(e,i){var t=0,n=Ri(i);return i!==n?n:i.charCodeAt(0)===35&&Ts.test(i)&&(t=i[1].toLowerCase()==="x"?parseInt(i.slice(2),16):parseInt(i.slice(1),10),Pi(t))?An(t):e}function Oe(e){return e.indexOf("&")<0?e:e.replace(As,Is)}var Ls=/[&<>"]/,Rs=/[&<>"]/g,Os={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function Ps(e){return Os[e]}function ue(e){return Ls.test(e)?e.replace(Rs,Ps):e}var T={};T.blockquote_open=function(){return`<blockquote>
476`};T.blockquote_close=function(e,i){return"</blockquote>"+Be(e,i)};T.code=function(e,i){return e[i].block?"<pre><code>"+ue(e[i].content)+"</code></pre>"+Be(e,i):"<code>"+ue(e[i].content)+"</code>"};T.fence=function(e,i,t,n,r){var a=e[i],o="",s=t.langPrefix,l="",u,c,d;if(a.params){if(u=a.params.split(/\s+/g),c=u.join(" "),Cs(r.rules.fence_custom,u[0]))return r.rules.fence_custom[u[0]](e,i,t,n,r);l=ue(Oe(ot(c))),o=' class="'+s+l+'"'}return t.highlight?d=t.highlight.apply(t.highlight,[a.content].concat(u))||ue(a.content):d=ue(a.content),"<pre><code"+o+">"+d+"</code></pre>"+Be(e,i)};T.fence_custom={};T.heading_open=function(e,i){return"<h"+e[i].hLevel+">"};T.heading_close=function(e,i){return"</h"+e[i].hLevel+`>
477`};T.hr=function(e,i,t){return(t.xhtmlOut?"<hr />":"<hr>")+Be(e,i)};T.bullet_list_open=function(){return`<ul>
478`};T.bullet_list_close=function(e,i){return"</ul>"+Be(e,i)};T.list_item_open=function(){return"<li>"};T.list_item_close=function(){return`</li>
479`};T.ordered_list_open=function(e,i){var t=e[i],n=t.order>1?' start="'+t.order+'"':"";return"<ol"+n+`>
480`};T.ordered_list_close=function(e,i){return"</ol>"+Be(e,i)};T.paragraph_open=function(e,i){return e[i].tight?"":"<p>"};T.paragraph_close=function(e,i){var t=!(e[i].tight&&i&&e[i-1].type==="inline"&&!e[i-1].content);return(e[i].tight?"":"</p>
480")+(t?Be(e,i):"")};T.link_open=function(e,i,t){var n=e[i].title?' title="'+ue(Oe(e[i].title))+'"':"",r=t.linkTarget?' target="'+t.linkTarget+'"':"";return'<a href="'+ue(e[i].href)+'"'+n+r+">"};T.link_close=function(){return"</a>"};T.image=function(e,i,t){var n=' src="'+ue(e[i].src)+'"',r=e[i].title?' title="'+ue(Oe(e[i].title))+'"':"",a=' alt="'+(e[i].alt?ue(Oe(ot(e[i].alt))):"")+'"',o=t.xhtmlOut?" /":"";return"<img"+n+a+r+o+">"};T.table_open=function(){return`<table>
481`};T.table_close=function(){return`</table>
482`};T.thead_open=function(){return`<thead>
483`};T.thead_close=function(){return`</thead>
484`};T.tbody_open=function(){return`<tbody>
485`};T.tbody_close=function(){return`</tbody>
486`};T.tr_open=function(){return"<tr>"};T.tr_close=function(){return`</tr>
487`};T.th_open=function(e,i){var t=e[i];return"<th"+(t.align?' style="text-align:'+t.align+'"':"")+">"};T.th_close=function(){return"</th>"};T.td_open=function(e,i){var t=e[i];return"<td"+(t.align?' style="text-align:'+t.align+'"':"")+">"};T.td_close=function(){return"</td>"};T.strong_open=function(){return"<strong>"};T.strong_close=function(){return"</strong>"};T.em_open=function(){return"<em>"};T.em_close=function(){return"</em>"};T.del_open=function(){return"<del>"};T.del_close=function(){return"</del>"};T.ins_open=function(){return"<ins>"};T.ins_close=function(){return"</ins>"};T.mark_open=function(){return"<mark>"};T.mark_close=function(){return"</mark>"};T.sub=function(e,i){return"<sub>"+ue(e[i].content)+"</sub>"};T.sup=function(e,i){return"<sup>"+ue(e[i].content)+"</sup>"};T.hardbreak=function(e,i,t){return t.xhtmlOut?`<br />
488`:`<br>
489`};T.softbreak=function(e,i,t){return t.breaks?t.xhtmlOut?`<br />
490`:`<br>
491`:`
492`};T.text=function(e,i){return ue(e[i].content)};T.htmlblock=function(e,i){return e[i].content};T.htmltag=function(e,i){return e[i].content};T.abbr_open=function(e,i){return'<abbr title="'+ue(Oe(e[i].title))+'">'};T.abbr_close=function(){return"</abbr>"};T.footnote_ref=function(e,i){var t=Number(e[i].id+1).toString(),n="fnref"+t;return e[i].subId>0&&(n+=":"+e[i].subId),'<sup class="footnote-ref"><a href="#fn'+t+'" id="'+n+'">['+t+"]</a></sup>"};T.footnote_block_open=function(e,i,t){var n=t.xhtmlOut?`<hr class="footnotes-sep" />
493`:`<hr class="footnotes-sep">
494`;return n+`<section class="footnotes">
495<ol class="footnotes-list">
496`};T.footnote_block_close=function(){return`</ol>
497</section>
498`};T.footnote_open=function(e,i){var t=Number(e[i].id+1).toString();return'<li id="fn'+t+'"  class="footnote-item">'};T.footnote_close=function(){return`</li>
499`};T.footnote_anchor=function(e,i){var t=Number(e[i].id+1).toString(),n="fnref"+t;return e[i].subId>0&&(n+=":"+e[i].subId),' <a href="#'+n+'" class="footnote-backref">↩</a>'};T.dl_open=function(){return`<dl>
500`};T.dt_open=function(){return"<dt>"};T.dd_open=function(){return"<dd>"};T.dl_close=function(){return`</dl>
501`};T.dt_close=function(){return`</dt>
502`};T.dd_close=function(){return`</dd>
503`};function Ni(e,i){return++i>=e.length-2?i:e[i].type==="paragraph_open"&&e[i].tight&&e[i+1].type==="inline"&&e[i+1].content.length===0&&e[i+2].type==="paragraph_close"&&e[i+2].tight?Ni(e,i+2):i}var Be=T.getBreak=function(e,i){return i=Ni(e,i),i<e.length&&e[i].type==="list_item_close"?"":`
504`};function Gn(){this.rules=Oi({},T),this.getBreak=T.getBreak}Gn.prototype.renderInline=function(e,i,t){for(var n=this.rules,r=e.length,a=0,o="";r--;)o+=n[e[a].type](e,a++,i,t,this);return o};Gn.prototype.render=function(e,i,t){for(var n=this.rules,r=e.length,a=-1,o="";++a<r;)e[a].type==="inline"?o+=this.renderInline(e[a].children,i,t):o+=n[e[a].type](e,a,i,t,this);return o};function me(){this.__rules__=[],this.__cache__=null}me.prototype.__find__=function(e){for(var i=this.__rules__.length,t=-1;i--;)if(this.__rules__[++t].name===e)return t;return-1};me.prototype.__compile__=function(){var e=this,i=[""];e.__rules__.forEach(function(t){t.enabled&&t.alt.forEach(function(n){i.indexOf(n)<0&&i.push(n)})}),e.__cache__={},i.forEach(function(t){e.__cache__[t]=[],e.__rules__.forEach(function(n){n.enabled&&(t&&n.alt.indexOf(t)<0||e.__cache__[t].push(n.fn))})})};me.prototype.at=function(e,i,t){var n=this.__find__(e),r=t||{};if(n===-1)throw new Error("Parser rule not found: "+e);this.__rules__[n].fn=i,this.__rules__[n].alt=r.alt||[],this.__cache__=null};me.prototype.before=function(e,i,t,n){var r=this.__find__(e),a=n||{};if(r===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(r,0,{name:i,enabled:!0,fn:t,alt:a.alt||[]}),this.__cache__=null};me.prototype.after=function(e,i,t,n){var r=this.__find__(e),a=n||{};if(r===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(r+1,0,{name:i,enabled:!0,fn:t,alt:a.alt||[]}),this.__cache__=null};me.prototype.push=function(e,i,t){var n=t||{};this.__rules__.push({name:e,enabled:!0,fn:i,alt:n.alt||[]}),this.__cache__=null};me.prototype.enable=function(e,i){e=Array.isArray(e)?e:[e],i&&this.__rules__.forEach(function(t){t.enabled=!1}),e.forEach(function(t){var n=this.__find__(t);if(n<0)throw new Error("Rules manager: invalid rule name "+t);this.__rules__[n].enabled=!0},this),this.__cache__=null};me.prototype.disable=function(e){e=Array.isArray(e)?e:[e],e.forEach(function(i){var t=this.__find__(i);if(t<0)throw new Error("Rules manager: invalid rule name "+i);this.__rules__[t].enabled=!1},this),this.__cache__=null};me.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function Ns(e){e.inlineMode?e.tokens.push({type:"inline",content:e.src.replace(/\n/g," ").trim(),level:0,lines:[0,1],children:[]}):e.block.parse(e.src,e.options,e.env,e.tokens)}function qe(e,i,t,n,r){this.src=e,this.env=n,this.options=t,this.parser=i,this.tokens=r,this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache=[],this.isInLabel=!1,this.linkLevel=0,this.linkContent="",this.labelUnmatchedScopes=0}qe.prototype.pushPending=function(){this.tokens.push({type:"text",content:this.pending,level:this.pendingLevel}),this.pending=""};qe.prototype.push=function(e){this.pending&&this.pushPending(),this.tokens.push(e),this.pendingLevel=this.level};qe.prototype.cacheSet=function(e,i){for(var t=this.cache.length;t<=e;t++)this.cache.push(0);this.cache[e]=i};qe.prototype.cacheGet=function(e){return e<this.cache.length?this.cache[e]:0};function st(e,i){var t,n,r,a=-1,o=e.posMax,s=e.pos,l=e.isInLabel;if(e.isInLabel)return-1;if(e.labelUnmatchedScopes)return e.labelUnmatchedScopes--,-1;for(e.pos=i+1,e.isInLabel=!0,t=1;e.pos<o;
504){if(r=e.src.charCodeAt(e.pos),r===91)t++;else if(r===93&&(t--,t===0)){n=!0;break}e.parser.skipToken(e)}return n?(a=e.pos,e.labelUnmatchedScopes=0):e.labelUnmatchedScopes=t-1,e.pos=s,e.isInLabel=l,a}function Ds(e,i,t,n){var r,a,o,s,l,u;if(e.charCodeAt(0)!==42||e.charCodeAt(1)!==91||e.indexOf("]:")===-1||(r=new qe(e,i,t,n,[]),a=st(r,1),a<0||e.charCodeAt(a+1)!==58))return-1;for(s=r.posMax,o=a+2;o<s&&r.src.charCodeAt(o)!==10;o++);return l=e.slice(2,a),u=e.slice(a+2,o).trim(),u.length===0?-1:(n.abbreviations||(n.abbreviations={}),R(n.abbreviations[":"+l])>"u"&&(n.abbreviations[":"+l]=u),o)}function Fs(e){var i=e.tokens,t,n,r,a;if(!e.inlineMode){for(t=1,n=i.length-1;t<n;t++)if(i[t-1].type==="paragraph_open"&&i[t].type==="inline"&&i[t+1].type==="paragraph_close"){for(r=i[t].content;r.length&&(a=Ds(r,e.inline,e.options,e.env),!(a<0));)r=r.slice(a).trim();i[t].content=r,r.length||(i[t-1].tight=!0,i[t+1].tight=!0)}}}function Tn(e){var i=Oe(e);try{i=decodeURI(i)}catch{}return encodeURI(i)}function Di(e,i){var t,n,r,a=i,o=e.posMax;if(e.src.charCodeAt(i)===60){for(i++;i<o;){if(t=e.src.charCodeAt(i),t===10)return!1;if(t===62)return r=Tn(ot(e.src.slice(a+1,i))),e.parser.validateLink(r)?(e.pos=i+1,e.linkContent=r,!0):!1;if(t===92&&i+1<o){i+=2;continue}i++}return!1}for(n=0;i<o&&(t=e.src.charCodeAt(i),!(t===32||t<32||t===127));){if(t===92&&i+1<o){i+=2;continue}if(t===40&&(n++,n>1)||t===41&&(n--,n<0))break;i++}return a===i||(r=ot(e.src.slice(a,i)),!e.parser.validateLink(r))?!1:(e.linkContent=r,e.pos=i,!0)}function Fi(e,i){var t,n=i,r=e.posMax,a=e.src.charCodeAt(i);if(a!==34&&a!==39&&a!==40)return!1;for(i++,a===40&&(a=41);i<r;){if(t=e.src.charCodeAt(i),t===a)return e.pos=i+1,e.linkContent=ot(e.src.slice(n+1,i)),!0;if(t===92&&i+1<r){i+=2;continue}i++}return!1}function ji(e){return e.trim().replace(/\s+/g," ").toUpperCase()}function js(e,i,t,n){var r,a,o,s,l,u,c,d,h;if(e.charCodeAt(0)!==91||e.indexOf("]:")===-1||(r=new qe(e,i,t,n,[]),a=st(r,0),a<0||e.charCodeAt(a+1)!==58))return-1;for(s=r.posMax,o=a+2;o<s&&(l=r.src.charCodeAt(o),!(l!==32&&l!==10));o++);if(!Di(r,o))return-1;for(c=r.linkContent,o=r.pos,u=o,o=o+1;o<s&&(l=r.src.charCodeAt(o),!(l!==32&&l!==10));o++);for(o<s&&u!==o&&Fi(r,o)?(d=r.linkContent,o=r.pos):(d="",o=u);o<s&&r.src.charCodeAt(o)===32;)o++;return o<s&&r.src.charCodeAt(o)!==10?-1:(h=ji(e.slice(1,a)),R(n.references[h])>"u"&&(n.references[h]={title:d,href:c}),o)}function Bs(e){var i=e.tokens,t,n,r,a;if(e.env.references=e.env.references||{},!e.inlineMode){for(t=1,n=i.length-1;t<n;t++)if(i[t].type==="inline"&&i[t-1].type==="paragraph_open"&&i[t+1].type==="paragraph_close"){for(r=i[t].content;r.length&&(a=js(r,e.inline,e.options,e.env),!(a<0));)r=r.slice(a).trim();i[t].content=r,r.length||(i[t-1].tight=!0,i[t+1].tight=!0)}}}function qs(e){var i=e.tokens,t,n,r;for(n=0,r=i.length;n<r;n++)t=i[n],t.type==="inline"&&e.inline.parse(t.content,e.options,e.env,t.children)}function Us(e){var i,t,n,r,a,o,s,l,u,c=0,d=!1,h={};if(e.env.footnotes&&(e.tokens=e.tokens.filter(function(p){return p.type==="footnote_reference_open"?(d=!0,l=[],u=p.label,!1):p.type==="footnote_reference_close"?(d=!1,h[":"+u]=l,!1):(d&&l.push(p),!d)}),!!e.env.footnotes.list)){for(o=e.env.footnotes.list,e.tokens.push({type:"footnote_block_open",level:c++}),i=0,t=o.length;i<t;i++){for(e.tokens.push({type:"footnote_open",id:i,level:c++}),o[i].tokens?(s=[],s.push({type:"paragraph_open",tight:!1,level:c++}),s.push({type:"inline",content:"",level:c,children:o[i].tokens}),s.push({type:"paragraph_close",tight:!1,level:--c})):o[i].label&&(s=h[":"+o[i].label]),e.tokens=e.tokens.concat(s),e.tokens[e.tokens.length-1].type==="paragraph_close"?a=e.tokens.pop():a=null,r=o[i].count>0?o[i].count:1,n=0;n<r;n++)e.tokens.push({type:"footnote_anchor",id:i,subId:n,level:c});a&&e.tokens.push(a),e.tokens.push({type:"footnote_close",level:--c})}e.tokens.push({type:"footnote_block_close",level:--c})}}var xr=` 
505()[]'".,!?-`;function dn(e){return e.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1")}function zs(e){var i,t,n,r,a,o,s,l,u,c,d,h,p=e.tokens;if(e.env.abbreviations){for(e.env.abbrRegExp||(h="(^|["+xr.split("").map(dn).join("")+"])("+Object.keys(e.env.abbreviations).map(function(m){return m.substr(1)}).sort(function(m,v){return v.length-m.length}).map(dn).join("|")+")($|["+xr.split("").map(dn).join("")+"])",e.env.abbrRegExp=new RegExp(h,"g")),c=e.env.abbrRegExp,t=0,n=p.length;t<n;t++)if(p[t].type==="inline"){for(r=p[t].children,i=r.length-1;i>=0;i--)if(a=r[i],a.type==="text"){for(l=0,o=a.content,c.lastIndex=0,u=a.level,s=[];d=c.exec(o);)c.lastIndex>l&&s.push({type:"text",content:o.slice(l,d.index+d[1].length),level:u}),s.push({type:"abbr_open",title:e.env.abbreviations[":"+d[2]],level:u++}),s.push({type:"text",content:d[2],level:u}),s.push({type:"abbr_close",level:--u}),l=c.lastIndex-d[3].length;s.length&&(l<o.length&&s.push({type:"text",content:o.slice(l),level:u}),p[t].children=r=[].concat(r.slice(0,i),s,r.slice(i+1)))}}}}var Hs=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,$s=/\((c|tm|r|p)\)/ig,Vs={c:"©",r:"®",p:"§",tm:"™"};function Gs(e){return e.indexOf("(")<0?e:e.replace($s,function(i,t){return Vs[t.toLowerCase()]})}function Ws(e){var i,t,n,r,a;if(e.options.typographer){for(a=e.tokens.length-1;a>=0;a--)if(e.tokens[a].type==="inline")for(r=e.tokens[a].children,i=r.length-1;i>=0;i--)t=r[i],t.type==="text"&&(n=t.content,n=Gs(n),Hs.test(n)&&(n=n.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---([^-]|$)/mg,"$1—$2").replace(/(^|\s)--(\s|$)/mg,"$1–$2").replace(/(^|[^-\s])--([^-\s]|$)/mg,"$1–$2")),t.content=n)}}var Ks=/['"]/,Er=/['"]/g,Ys=/[-\s()\[\]]/,Cr="’";function Mr(e,i){return i<0||i>=e.length?!1:!Ys.test(e[i])}function We(e,i,t){return e.substr(0,i)+t+e.substr(i+1)}function Js(e){var i,t,n,r,a,o,s,l,u,c,d,h,p,m,v,b,w;if(e.options.typographer){for(w=[],v=e.tokens.length-1;v>=0;v--)if(e.tokens[v].type==="inline"){for(b=e.tokens[v].children,w.length=0,i=0;i<b.length;i++)if(t=b[i],!(t.type!=="text"||Ks.test(t.text))){for(s=b[i].level,p=w.length-1;p>=0&&!(w[p].level<=s);p--);w.length=p+1,n=t.content,a=0,o=n.length;e:for(;a<o&&(Er.lastIndex=a,r=Er.exec(n),!!r);){if(l=!Mr(n,r.index-1),a=r.index+1,m=r[0]==="'",u=!Mr(n,a),!u&&!l){m&&(t.content=We(t.content,r.index,Cr));continue}if(d=!u,h=!l,h){for(p=w.length-1;p>=0&&(c=w[p],!(w[p].level<s));p--)if(c.single===m&&w[p].level===s){c=w[p],m?(b[c.token].content=We(b[c.token].content,c.pos,e.options.quotes[2]),t.content=We(t.content,r.index,e.options.quotes[3])):(b[c.token].content=We(b[c.token].content,c.pos,e.options.quotes[0]),t.content=We(t.content,r.index,e.options.quotes[1])),w.length=p;continue e}}d?w.push({token:i,pos:r.index,single:m,level:s}):h&&m&&(t.content=We(t.content,r.index,Cr))}}}}}var hn=[["block",Ns],["abbr",Fs],["references",Bs],["inline",qs],["footnote_tail",Us],["abbr2",zs],["replacements",Ws],["smartquotes",Js]];function Bi(){this.options={},this.ruler=new me;for(var e=0;e<hn.length;e++)this.ruler.push(hn[e][0],hn[e][1])}Bi.prototype.process=function(e){var i,t,n;for(n=this.ruler.getRules(""),i=0,t=n.length;i<t;i++)n[i](e)};function Ue(e,i,t,n,r){var a,o,s,l,u,c,d;for(this.src=e,this.parser=i,this.options=t,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.parentType="root",this.ddIndent=-1,this.level=0,this.result="",o=this.src,c=0,d=!1,s=l=c=0,u=o.length;l<u;
505l++){if(a=o.charCodeAt(l),!d)if(a===32){c++;continue}else d=!0;(a===10||l===u-1)&&(a!==10&&l++,this.bMarks.push(s),this.eMarks.push(l),this.tShift.push(c),d=!1,c=0,s=l+1)}this.bMarks.push(o.length),this.eMarks.push(o.length),this.tShift.push(0),this.lineMax=this.bMarks.length-1}Ue.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};Ue.prototype.skipEmptyLines=function(e){for(var i=this.lineMax;e<i&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e};Ue.prototype.skipSpaces=function(e){for(var i=this.src.length;e<i&&this.src.charCodeAt(e)===32;e++);return e};Ue.prototype.skipChars=function(e,i){for(var t=this.src.length;e<t&&this.src.charCodeAt(e)===i;e++);return e};Ue.prototype.skipCharsBack=function(e,i,t){if(e<=t)return e;for(;e>t;)if(i!==this.src.charCodeAt(--e))return e+1;return e};Ue.prototype.getLines=function(e,i,t,n){var r,a,o,s,l,u=e;if(e>=i)return"";if(u+1===i)return a=this.bMarks[u]+Math.min(this.tShift[u],t),o=n?this.eMarks[u]+1:this.eMarks[u],this.src.slice(a,o);for(s=new Array(i-e),r=0;u<i;u++,r++)l=this.tShift[u],l>t&&(l=t),l<0&&(l=0),a=this.bMarks[u]+l,u+1<i||n?o=this.eMarks[u]+1:o=this.eMarks[u],s[r]=this.src.slice(a,o);return s.join("")};function Zs(e,i,t){var n,r;if(e.tShift[i]-e.blkIndent<4)return!1;for(r=n=i+1;n<t;){if(e.isEmpty(n)){n++;continue}if(e.tShift[n]-e.blkIndent>=4){n++,r=n;continue}break}return e.line=n,e.tokens.push({type:"code",content:e.getLines(i,r,4+e.blkIndent,!0),block:!0,lines:[i,e.line],level:e.level}),!0}function Xs(e,i,t,n){var r,a,o,s,l,u=!1,c=e.bMarks[i]+e.tShift[i],d=e.eMarks[i];if(c+3>d||(r=e.src.charCodeAt(c),r!==126&&r!==96)||(l=c,c=e.skipChars(c,r),a=c-l,a<3)||(o=e.src.slice(c,d).trim(),o.indexOf("`")>=0))return!1;if(n)return!0;for(s=i;s++,!(s>=t||(c=l=e.bMarks[s]+e.tShift[s],d=e.eMarks[s],c<d&&e.tShift[s]<e.blkIndent));)if(e.src.charCodeAt(c)===r&&!(e.tShift[s]-e.blkIndent>=4)&&(c=e.skipChars(c,r),!(c-l<a)&&(c=e.skipSpaces(c),!(c<d)))){u=!0;break}return a=e.tShift[i],e.line=s+(u?1:0),e.tokens.push({type:"fence",params:o,content:e.getLines(i+1,s,a,!0),lines:[i,e.line],level:e.level}),!0}function Qs(e,i,t,n){var r,a,o,s,l,u,c,d,h,p,m,v=e.bMarks[i]+e.tShift[i],b=e.eMarks[i];if(v>b||e.src.charCodeAt(v++)!==62||e.level>=e.options.maxNesting)return!1;if(n)return!0;for(e.src.charCodeAt(v)===32&&v++,l=e.blkIndent,e.blkIndent=0,s=[e.bMarks[i]],e.bMarks[i]=v,v=v<b?e.skipSpaces(v):v,a=v>=b,o=[e.tShift[i]],e.tShift[i]=v-e.bMarks[i],d=e.parser.ruler.getRules("blockquote"),r=i+1;r<t&&(v=e.bMarks[r]+e.tShift[r],b=e.eMarks[r],!(v>=b));r++){if(e.src.charCodeAt(v++)===62){e.src.charCodeAt(v)===32&&v++,s.push(e.bMarks[r]),e.bMarks[r]=v,v=v<b?e.skipSpaces(v):v,a=v>=b,o.push(e.tShift[r]),e.tShift[r]=v-e.bMarks[r];continue}if(a)break;for(m=!1,h=0,p=d.length;h<p;h++)if(d[h](e,r,t,!0)){m=!0;break}if(m)break;s.push(e.bMarks[r]),o.push(e.tShift[r]),e.tShift[r]=-1337}for(u=e.parentType,e.parentType="blockquote",e.tokens.push({type:"blockquote_open",lines:c=[i,0],level:e.level++}),e.parser.tokenize(e,i,r),e.tokens.push({type:"blockquote_close",level:--e.level}),e.parentType=u,c[1]=e.line,h=0;h<o.length;h++)e.bMarks[h+i]=s[h],e.tShift[h+i]=o[h];return e.blkIndent=l,!0}function el(e,i,t,n){var r,a,o,s=e.bMarks[i],l=e.eMarks[i];if(s+=e.tShift[i],s>l||(r=e.src.charCodeAt(s++),r!==42&&r!==45&&r!==95))return!1;for(a=1;s<l;){if(o=e.src.charCodeAt(s++),o!==r&&o!==32)return!1;o===r&&a++}return a<3?!1:(n||(e.line=i+1,e.tokens.push({type:"hr",lines:[i,e.line],level:e.level})),!0)}function Ar(e,i){var t,n,r;return n=e.bMarks[i]+e.tShift[i],r=e.eMarks[i],n>=r||(t=e.src.charCodeAt(n++),t!==42&&t!==45&&t!==43)||n<r&&e.src.charCodeAt(n)!==32?-1:n}function Tr(e,i){var t,n=e.bMarks[i]+e.tShift[i],r=e.eMarks[i];if(n+1>=r||(t=e.src.charCodeAt(n++),t<48||t>57))return-1;for(;;){if(n>=r)return-1;if(t=e.src.charCodeAt(n++),!(t>=48&&t<=57)){if(t===41||t===46)break;return-1}}return n<r&&e.src.charCodeAt(n)!==32?-1:n}function tl(e,i){var t,n,r=e.level+2;for(t=i+2,n=e.tokens.length-2;t<n;t++)e.tokens[t].level===r&&e.tokens[t].type==="paragraph_open"&&(e.tokens[t+2].tight=!0,e.tokens[t].tight=!0,t+=2)}function nl(e,i,t,n){var r,a,o,s,l,u,c,d,h,p,m,v,b,w,_,x,N,M,j=!0,W,H,Z,te;if((d=Tr(e,i))>=0)b=!0;else if((d=Ar(e,i))>=0)b=!1;else return!1;if(e.level>=e.options.maxNesting)return!1;
505if(v=e.src.charCodeAt(d-1),n)return!0;for(_=e.tokens.length,b?(c=e.bMarks[i]+e.tShift[i],m=Number(e.src.substr(c,d-c-1)),e.tokens.push({type:"ordered_list_open",order:m,lines:N=[i,0],level:e.level++})):e.tokens.push({type:"bullet_list_open",lines:N=[i,0],level:e.level++}),r=i,x=!1,W=e.parser.ruler.getRules("list");r<t&&(w=e.skipSpaces(d),h=e.eMarks[r],w>=h?p=1:p=w-d,p>4&&(p=1),p<1&&(p=1),a=d-e.bMarks[r]+p,e.tokens.push({type:"list_item_open",lines:M=[i,0],level:e.level++}),s=e.blkIndent,l=e.tight,o=e.tShift[i],u=e.parentType,e.tShift[i]=w-e.bMarks[i],e.blkIndent=a,e.tight=!0,e.parentType="list",e.parser.tokenize(e,i,t,!0),(!e.tight||x)&&(j=!1),x=e.line-i>1&&e.isEmpty(e.line-1),e.blkIndent=s,e.tShift[i]=o,e.tight=l,e.parentType=u,e.tokens.push({type:"list_item_close",level:--e.level}),r=i=e.line,M[1]=r,w=e.bMarks[i],!(r>=t||e.isEmpty(r)||e.tShift[r]<e.blkIndent));){for(te=!1,H=0,Z=W.length;H<Z;H++)if(W[H](e,r,t,!0)){te=!0;break}if(te)break;if(b){if(d=Tr(e,r),d<0)break}else if(d=Ar(e,r),d<0)break;if(v!==e.src.charCodeAt(d-1))break}return e.tokens.push({type:b?"ordered_list_close":"bullet_list_close",level:--e.level}),N[1]=r,e.line=r,j&&tl(e,_),!0}function rl(e,i,t,n){var r,a,o,s,l,u=e.bMarks[i]+e.tShift[i],c=e.eMarks[i];if(u+4>c||e.src.charCodeAt(u)!==91||e.src.charCodeAt(u+1)!==94||e.level>=e.options.maxNesting)return!1;for(s=u+2;s<c;s++){if(e.src.charCodeAt(s)===32)return!1;if(e.src.charCodeAt(s)===93)break}return s===u+2||s+1>=c||e.src.charCodeAt(++s)!==58?!1:(n||(s++,e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.refs||(e.env.footnotes.refs={}),l=e.src.slice(u+2,s-2),e.env.footnotes.refs[":"+l]=-1,e.tokens.push({type:"footnote_reference_open",label:l,level:e.level++}),r=e.bMarks[i],a=e.tShift[i],o=e.parentType,e.tShift[i]=e.skipSpaces(s)-s,e.bMarks[i]=s,e.blkIndent+=4,e.parentType="footnote",e.tShift[i]<e.blkIndent&&(e.tShift[i]+=e.blkIndent,e.bMarks[i]-=e.blkIndent),e.parser.tokenize(e,i,t,!0),e.parentType=o,e.blkIndent-=4,e.tShift[i]=a,e.bMarks[i]=r,e.tokens.push({type:"footnote_reference_close",level:--e.level})),!0)}function il(e,i,t,n){var r,a,o,s=e.bMarks[i]+e.tShift[i],l=e.eMarks[i];if(s>=l||(r=e.src.charCodeAt(s),r!==35||s>=l))return!1;for(a=1,r=e.src.charCodeAt(++s);r===35&&s<l&&a<=6;)a++,r=e.src.charCodeAt(++s);return a>6||s<l&&r!==32?!1:(n||(l=e.skipCharsBack(l,32,s),o=e.skipCharsBack(l,35,s),o>s&&e.src.charCodeAt(o-1)===32&&(l=o),e.line=i+1,e.tokens.push({type:"heading_open",hLevel:a,lines:[i,e.line],level:e.level}),s<l&&e.tokens.push({type:"inline",content:e.src.slice(s,l).trim(),level:e.level+1,lines:[i,e.line],children:[]}),e.tokens.push({type:"heading_close",hLevel:a,level:e.level})),!0)}function al(e,i,t){var n,r,a,o=i+1;return o>=t||e.tShift[o]<e.blkIndent||e.tShift[o]-e.blkIndent>3||(r=e.bMarks[o]+e.tShift[o],a=e.eMarks[o],r>=a)||(n=e.src.charCodeAt(r),n!==45&&n!==61)||(r=e.skipChars(r,n),r=e.skipSpaces(r),r<a)?!1:(r=e.bMarks[i]+e.tShift[i],e.line=o+1,e.tokens.push({type:"heading_open",hLevel:n===61?1:2,lines:[i,e.line],level:e.level}),e.tokens.push({type:"inline",content:e.src.slice(r,e.eMarks[i]).trim(),level:e.level+1,lines:[i,e.line-1],children:[]}),e.tokens.push({type:"heading_close",hLevel:n===61?1:2,level:e.level}),!0)}var qi={};["article","aside","button","blockquote","body","canvas","caption","col","colgroup","dd","div","dl","dt","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","iframe","li","map","object","ol","output","p","pre","progress","script","section","style","table","tbody","td","textarea","tfoot","th","tr","thead","ul","video"].forEach(function(e){qi[e]=!0});var ol=/^<([a-zA-Z]{1,15})[\s\/>]/,sl=/^<\/([a-zA-Z]{1,15})[\s>]/;function ll(e){var i=e|32;return i>=97&&i<=122}function ul(e,i,t,n){var r,a,o,s=e.bMarks[i],l=e.eMarks[i],u=e.tShift[i];if(s+=u,!e.options.html||u>3||s+2>=l||e.src.charCodeAt(s)!==60)return!1;if(r=e.src.charCodeAt(s+1),r===33||r===63){if(n)return!0}else if(r===47||ll(r)){if(r===47){if(a=e.src.slice(s,l).match(sl),!a)return!1}else if(a=e.src.slice(s,l).match(ol),!a)return!1;if(qi[a[1].toLowerCase()]!==!0)return!1;if(n)return!0}else return!1;for(o=i+1;o<e.lineMax&&!e.isEmpty(o);)o++;return e.line=o,e.tokens.push({type:"htmlblock",level:e.level,lines:[i,e.line],content:e.getLines(i,o,
5050,!0)}),!0}function pn(e,i){var t=e.bMarks[i]+e.blkIndent,n=e.eMarks[i];return e.src.substr(t,n-t)}function cl(e,i,t,n){var r,a,o,s,l,u,c,d,h,p,m;if(i+2>t||(l=i+1,e.tShift[l]<e.blkIndent)||(o=e.bMarks[l]+e.tShift[l],o>=e.eMarks[l])||(r=e.src.charCodeAt(o),r!==124&&r!==45&&r!==58)||(a=pn(e,i+1),!/^[-:| ]+$/.test(a))||(u=a.split("|"),u<=2))return!1;for(d=[],s=0;s<u.length;s++){if(h=u[s].trim(),!h){if(s===0||s===u.length-1)continue;return!1}if(!/^:?-+:?$/.test(h))return!1;h.charCodeAt(h.length-1)===58?d.push(h.charCodeAt(0)===58?"center":"right"):h.charCodeAt(0)===58?d.push("left"):d.push("")}if(a=pn(e,i).trim(),a.indexOf("|")===-1||(u=a.replace(/^\||\|$/g,"").split("|"),d.length!==u.length))return!1;if(n)return!0;for(e.tokens.push({type:"table_open",lines:p=[i,0],level:e.level++}),e.tokens.push({type:"thead_open",lines:[i,i+1],level:e.level++}),e.tokens.push({type:"tr_open",lines:[i,i+1],level:e.level++}),s=0;s<u.length;s++)e.tokens.push({type:"th_open",align:d[s],lines:[i,i+1],level:e.level++}),e.tokens.push({type:"inline",content:u[s].trim(),lines:[i,i+1],level:e.level,children:[]}),e.tokens.push({type:"th_close",level:--e.level});for(e.tokens.push({type:"tr_close",level:--e.level}),e.tokens.push({type:"thead_close",level:--e.level}),e.tokens.push({type:"tbody_open",lines:m=[i+2,0],level:e.level++}),l=i+2;l<t&&!(e.tShift[l]<e.blkIndent||(a=pn(e,l).trim(),a.indexOf("|")===-1));l++){for(u=a.replace(/^\||\|$/g,"").split("|"),e.tokens.push({type:"tr_open",level:e.level++}),s=0;s<u.length;s++)e.tokens.push({type:"td_open",align:d[s],level:e.level++}),c=u[s].substring(u[s].charCodeAt(0)===124?1:0,u[s].charCodeAt(u[s].length-1)===124?u[s].length-1:u[s].length).trim(),e.tokens.push({type:"inline",content:c,level:e.level,children:[]}),e.tokens.push({type:"td_close",level:--e.level});e.tokens.push({type:"tr_close",level:--e.level})}return e.tokens.push({type:"tbody_close",level:--e.level}),e.tokens.push({type:"table_close",level:--e.level}),p[1]=m[1]=l,e.line=l,!0}function _t(e,i){var t,n,r=e.bMarks[i]+e.tShift[i],a=e.eMarks[i];return r>=a||(n=e.src.charCodeAt(r++),n!==126&&n!==58)||(t=e.skipSpaces(r),r===t)||t>=a?-1:t}function dl(e,i){var t,n,r=e.level+2;for(t=i+2,n=e.tokens.length-2;t<n;t++)e.tokens[t].level===r&&e.tokens[t].type==="paragraph_open"&&(e.tokens[t+2].tight=!0,e.tokens[t].tight=!0,t+=2)}function hl(e,i,t,n){var r,a,o,s,l,u,c,d,h,p,m,v,b,w;if(n)return e.ddIndent<0?!1:_t(e,i)>=0;if(c=i+1,e.isEmpty(c)&&++c>t||e.tShift[c]<e.blkIndent||(r=_t(e,c),r<0)||e.level>=e.options.maxNesting)return!1;u=e.tokens.length,e.tokens.push({type:"dl_open",lines:l=[i,0],level:e.level++}),o=i,a=c;e:for(;;){for(w=!0,b=!1,e.tokens.push({type:"dt_open",lines:[o,o],level:e.level++}),e.tokens.push({type:"inline",content:e.getLines(o,o+1,e.blkIndent,!1).trim(),level:e.level+1,lines:[o,o],children:[]}),e.tokens.push({type:"dt_close",level:--e.level});;){if(e.tokens.push({type:"dd_open",lines:s=[c,0],level:e.level++}),v=e.tight,h=e.ddIndent,d=e.blkIndent,m=e.tShift[a],p=e.parentType,e.blkIndent=e.ddIndent=e.tShift[a]+2,e.tShift[a]=r-e.bMarks[a],e.tight=!0,e.parentType="deflist",e.parser.tokenize(e,a,t,!0),(!e.tight||b)&&(w=!1),b=e.line-a>1&&e.isEmpty(e.line-1),e.tShift[a]=m,e.tight=v,e.parentType=p,e.blkIndent=d,e.ddIndent=h,e.tokens.push({type:"dd_close",level:--e.level}),s[1]=c=e.line,c>=t||e.tShift[c]<e.blkIndent)break e;if(r=_t(e,c),r<0)break;a=c}if(c>=t||(o=c,e.isEmpty(o))||e.tShift[o]<e.blkIndent||(a=o+1,a>=t)||(e.isEmpty(a)&&a++,a>=t)||e.tShift[a]<e.blkIndent||(r=_t(e,a),r<0))break}return e.tokens.push({type:"dl_close",level:--e.level}),l[1]=c,e.line=c,w&&dl(e,u),!0}function pl(e,i){var t,n,r,a,o,s=i+1,l;if(t=e.lineMax,s<t&&!e.isEmpty(s)){for(l=e.parser.ruler.getRules("paragraph");s<t&&!e.isEmpty(s);s++)if(!(e.tShift[s]-e.blkIndent>3)){for(r=!1,a=0,o=l.length;a<o;a++)if(l[a](e,s,t,!0)){r=!0;break}if(r)break}}return n=e.getLines(i,s,e.blkIndent,!1).trim(),e.line=s,n.length&&(e.tokens.push({type:"paragraph_open",tight:!1,lines:[i,e.line],level:e.level}),e.tokens.push({type:"inline",content:n,level:e.level+1,lines:[i,e.line],children:[]}),e.tokens.push({type:"paragraph_close",tight:!1,level:e.level})),!0}var wt=[["code",Zs],["fences",Xs,["paragraph","blockquote","list"]],["blockquote",Qs,["paragraph","blockquote","list"]],["hr",el,["paragraph","blockquote","list"]],["list",nl,["paragraph","blockquote"]],["footnote",rl,["paragraph"]],["heading",il,["paragraph","blockquote"]],["lheading",al],["htmlblock",ul,["paragraph","blockquote"]],["table",cl,["paragraph"]],["deflist",hl,["paragraph"]],["paragraph",pl]];function Wn(){this.ruler=new me;for(var e=0;e<wt.length;e++)this.ruler.push(wt[e][0],wt[e][1],{alt:(wt[e][2]||[]).slice()})}Wn.prototype.tokenize=function(e,i,t){for(var n=this.ruler.getRules(""),r=n.length,a=i,o=!1,s,l;
505a<t&&(e.line=a=e.skipEmptyLines(a),!(a>=t||e.tShift[a]<e.blkIndent));){for(l=0;l<r&&(s=n[l](e,a,t,!1),!s);l++);if(e.tight=!o,e.isEmpty(e.line-1)&&(o=!0),a=e.line,a<t&&e.isEmpty(a)){if(o=!0,a++,a<t&&e.parentType==="list"&&e.isEmpty(a))break;e.line=a}}};var fl=/[\n\t]/g,ml=/\r[\n\u0085]|[\u2424\u2028\u0085]/g,vl=/\u00a0/g;Wn.prototype.parse=function(e,i,t,n){var r,a=0,o=0;if(!e)return[];e=e.replace(vl," "),e=e.replace(ml,`
506`),e.indexOf("	")>=0&&(e=e.replace(fl,function(s,l){var u;return e.charCodeAt(l)===10?(a=l+1,o=0,s):(u="    ".slice((l-a-o)%4),o=l-a+1,u)})),r=new Ue(e,this,i,t,n),this.tokenize(r,r.line,r.lineMax)};function gl(e){switch(e){case 10:case 92:case 96:case 42:case 95:case 94:case 91:case 93:case 33:case 38:case 60:case 62:case 123:case 125:case 36:case 37:case 64:case 126:case 43:case 61:case 58:return!0;default:return!1}}function yl(e,i){for(var t=e.pos;t<e.posMax&&!gl(e.src.charCodeAt(t));)t++;return t===e.pos?!1:(i||(e.pending+=e.src.slice(e.pos,t)),e.pos=t,!0)}function bl(e,i){var t,n,r=e.pos;if(e.src.charCodeAt(r)!==10)return!1;if(t=e.pending.length-1,n=e.posMax,!i)if(t>=0&&e.pending.charCodeAt(t)===32)if(t>=1&&e.pending.charCodeAt(t-1)===32){for(var a=t-2;a>=0;a--)if(e.pending.charCodeAt(a)!==32){e.pending=e.pending.substring(0,a+1);break}e.push({type:"hardbreak",level:e.level})}else e.pending=e.pending.slice(0,-1),e.push({type:"softbreak",level:e.level});else e.push({type:"softbreak",level:e.level});for(r++;r<n&&e.src.charCodeAt(r)===32;)r++;return e.pos=r,!0}var Kn=[];for(var Ir=0;Ir<256;Ir++)Kn.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){Kn[e.charCodeAt(0)]=1});function kl(e,i){var t,n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==92)return!1;if(n++,n<r){if(t=e.src.charCodeAt(n),t<256&&Kn[t]!==0)return i||(e.pending+=e.src[n]),e.pos+=2,!0;if(t===10){for(i||e.push({type:"hardbreak",level:e.level}),n++;n<r&&e.src.charCodeAt(n)===32;)n++;return e.pos=n,!0}}return i||(e.pending+="\\"),e.pos++,!0}function _l(e,i){var t,n,r,a,o,s=e.pos,l=e.src.charCodeAt(s);if(l!==96)return!1;for(t=s,s++,n=e.posMax;s<n&&e.src.charCodeAt(s)===96;)s++;for(r=e.src.slice(t,s),a=o=s;(a=e.src.indexOf("`",o))!==-1;){for(o=a+1;o<n&&e.src.charCodeAt(o)===96;)o++;if(o-a===r.length)return i||e.push({type:"code",content:e.src.slice(s,a).replace(/[ \n]+/g," ").trim(),block:!1,level:e.level}),e.pos=o,!0}return i||(e.pending+=r),e.pos+=r.length,!0}function wl(e,i){var t,n,r,a=e.posMax,o=e.pos,s,l;if(e.src.charCodeAt(o)!==126||i||o+4>=a||e.src.charCodeAt(o+1)!==126||e.level>=e.options.maxNesting||(s=o>0?e.src.charCodeAt(o-1):-1,l=e.src.charCodeAt(o+2),s===126)||l===126||l===32||l===10)return!1;for(n=o+2;n<a&&e.src.charCodeAt(n)===126;)n++;if(n>o+3)return e.pos+=n-o,i||(e.pending+=e.src.slice(o,n)),!0;for(e.pos=o+2,r=1;e.pos+1<a;){if(e.src.charCodeAt(e.pos)===126&&e.src.charCodeAt(e.pos+1)===126&&(s=e.src.charCodeAt(e.pos-1),l=e.pos+2<a?e.src.charCodeAt(e.pos+2):-1,l!==126&&s!==126&&(s!==32&&s!==10?r--:l!==32&&l!==10&&r++,r<=0))){t=!0;break}e.parser.skipToken(e)}return t?(e.posMax=e.pos,e.pos=o+2,i||(e.push({type:"del_open",level:e.level++}),e.parser.tokenize(e),e.push({type:"del_close",level:--e.level})),e.pos=e.posMax+2,e.posMax=a,!0):(e.pos=o,!1)}function Sl(e,i){var t,n,r,a=e.posMax,o=e.pos,s,l;if(e.src.charCodeAt(o)!==43||i||o+4>=a||e.src.charCodeAt(o+1)!==43||e.level>=e.options.maxNesting||(s=o>0?e.src.charCodeAt(o-1):-1,l=e.src.charCodeAt(o+2),s===43)||l===43||l===32||l===10)return!1;for(n=o+2;n<a&&e.src.charCodeAt(n)===43;)n++;if(n!==o+2)return e.pos+=n-o,i||(e.pending+=e.src.slice(o,n)),!0;for(e.pos=o+2,r=1;e.pos+1<a;){if(e.src.charCodeAt(e.pos)===43&&e.src.charCodeAt(e.pos+1)===43&&(s=e.src.charCodeAt(e.pos-1),l=e.pos+2<a?e.src.charCodeAt(e.pos+2):-1,l!==43&&s!==43&&(s!==32&&s!==10?r--:l!==32&&l!==10&&r++,r<=0))){t=!0;break}e.parser.skipToken(e)}return t?(e.posMax=e.pos,e.pos=o+2,i||(e.push({type:"ins_open",level:e.level++}),e.parser.tokenize(e),e.push({type:"ins_close",level:--e.level})),e.pos=e.posMax+2,e.posMax=a,!0):(e.pos=o,!1)}function xl(e,i){var t,n,r,a=e.posMax,o=e.pos,s,l;if(e.src.charCodeAt(o)!==61||i||o+4>
506=a||e.src.charCodeAt(o+1)!==61||e.level>=e.options.maxNesting||(s=o>0?e.src.charCodeAt(o-1):-1,l=e.src.charCodeAt(o+2),s===61)||l===61||l===32||l===10)return!1;for(n=o+2;n<a&&e.src.charCodeAt(n)===61;)n++;if(n!==o+2)return e.pos+=n-o,i||(e.pending+=e.src.slice(o,n)),!0;for(e.pos=o+2,r=1;e.pos+1<a;){if(e.src.charCodeAt(e.pos)===61&&e.src.charCodeAt(e.pos+1)===61&&(s=e.src.charCodeAt(e.pos-1),l=e.pos+2<a?e.src.charCodeAt(e.pos+2):-1,l!==61&&s!==61&&(s!==32&&s!==10?r--:l!==32&&l!==10&&r++,r<=0))){t=!0;break}e.parser.skipToken(e)}return t?(e.posMax=e.pos,e.pos=o+2,i||(e.push({type:"mark_open",level:e.level++}),e.parser.tokenize(e),e.push({type:"mark_close",level:--e.level})),e.pos=e.posMax+2,e.posMax=a,!0):(e.pos=o,!1)}function Lr(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122}function Rr(e,i){var t=i,n,r,a,o=!0,s=!0,l=e.posMax,u=e.src.charCodeAt(i);for(n=i>0?e.src.charCodeAt(i-1):-1;t<l&&e.src.charCodeAt(t)===u;)t++;return t>=l&&(o=!1),a=t-i,a>=4?o=s=!1:(r=t<l?e.src.charCodeAt(t):-1,(r===32||r===10)&&(o=!1),(n===32||n===10)&&(s=!1),u===95&&(Lr(n)&&(o=!1),Lr(r)&&(s=!1))),{can_open:o,can_close:s,delims:a}}function El(e,i){var t,n,r,a,o,s,l,u=e.posMax,c=e.pos,d=e.src.charCodeAt(c);if(d!==95&&d!==42||i)return!1;if(l=Rr(e,c),t=l.delims,!l.can_open)return e.pos+=t,i||(e.pending+=e.src.slice(c,e.pos)),!0;if(e.level>=e.options.maxNesting)return!1;for(e.pos=c+t,s=[t];e.pos<u;){if(e.src.charCodeAt(e.pos)===d){if(l=Rr(e,e.pos),n=l.delims,l.can_close){for(a=s.pop(),o=n;a!==o;){if(o<a){s.push(a-o);break}if(o-=a,s.length===0)break;e.pos+=a,a=s.pop()}if(s.length===0){t=a,r=!0;break}e.pos+=n;continue}l.can_open&&s.push(n),e.pos+=n;continue}e.parser.skipToken(e)}return r?(e.posMax=e.pos,e.pos=c+t,i||((t===2||t===3)&&e.push({type:"strong_open",level:e.level++}),(t===1||t===3)&&e.push({type:"em_open",level:e.level++}),e.parser.tokenize(e),(t===1||t===3)&&e.push({type:"em_close",level:--e.level}),(t===2||t===3)&&e.push({type:"strong_close",level:--e.level})),e.pos=e.posMax+t,e.posMax=u,!0):(e.pos=c,!1)}var Cl=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function Ml(e,i){var t,n,r=e.posMax,a=e.pos;if(e.src.charCodeAt(a)!==126||i||a+2>=r||e.level>=e.options.maxNesting)return!1;for(e.pos=a+1;e.pos<r;){if(e.src.charCodeAt(e.pos)===126){t=!0;break}e.parser.skipToken(e)}return!t||a+1===e.pos||(n=e.src.slice(a+1,e.pos),n.match(/(^|[^\\])(\\\\)*\s/))?(e.pos=a,!1):(e.posMax=e.pos,e.pos=a+1,i||e.push({type:"sub",level:e.level,content:n.replace(Cl,"$1")}
506),e.pos=e.posMax+1,e.posMax=r,!0)}var Al=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g;function Tl(e,i){var t,n,r=e.posMax,a=e.pos;if(e.src.charCodeAt(a)!==94||i||a+2>=r||e.level>=e.options.maxNesting)return!1;for(e.pos=a+1;e.pos<r;){if(e.src.charCodeAt(e.pos)===94){t=!0;break}e.parser.skipToken(e)}return!t||a+1===e.pos||(n=e.src.slice(a+1,e.pos),n.match(/(^|[^\\])(\\\\)*\s/))?(e.pos=a,!1):(e.posMax=e.pos,e.pos=a+1,i||e.push({type:"sup",level:e.level,content:n.replace(Al,"$1")}),e.pos=e.posMax+1,e.posMax=r,!0)}function Il(e,i){var t,n,r,a,o,s,l,u,c=!1,d=e.pos,h=e.posMax,p=e.pos,m=e.src.charCodeAt(p);if(m===33&&(c=!0,m=e.src.charCodeAt(++p)),m!==91||e.level>=e.options.maxNesting||(t=p+1,n=st(e,p),n<0))return!1;if(s=n+1,s<h&&e.src.charCodeAt(s)===40){for(s++;s<h&&(u=e.src.charCodeAt(s),!(u!==32&&u!==10));s++);if(s>=h)return!1;for(p=s,Di(e,s)?(a=e.linkContent,s=e.pos):a="",p=s;s<h&&(u=e.src.charCodeAt(s),!(u!==32&&u!==10));s++);if(s<h&&p!==s&&Fi(e,s))for(o=e.linkContent,s=e.pos;s<h&&(u=e.src.charCodeAt(s),!(u!==32&&u!==10));s++);else o="";if(s>=h||e.src.charCodeAt(s)!==41)return e.pos=d,!1;s++}else{if(e.linkLevel>0)return!1;for(;s<h&&(u=e.src.charCodeAt(s),!(u!==32&&u!==10));s++);if(s<h&&e.src.charCodeAt(s)===91&&(p=s+1,s=st(e,s),s>=0?r=e.src.slice(p,s++):s=p-1),r||(R(r)>"u"&&(s=n+1),r=e.src.slice(t,n)),l=e.env.references[ji(r)],!l)return e.pos=d,!1;a=l.href,o=l.title}return i||(e.pos=t,e.posMax=n,c?e.push({type:"image",src:a,title:o,alt:e.src.substr(t,n-t),level:e.level}):(e.push({type:"link_open",href:a,title:o,level:e.level++}),e.linkLevel++,e.parser.tokenize(e),e.linkLevel--,e.push({type:"link_close",level:--e.level}))),e.pos=s,e.posMax=h,!0}function Ll(e,i){var t,n,r,a,o=e.posMax,s=e.pos;return s+2>=o||e.src.charCodeAt(s)!==94||e.src.charCodeAt(s+1)!==91||e.level>=e.options.maxNesting||(t=s+2,n=st(e,s+1),n<0)?!1:(i||(e.env.footnotes||(e.env.footnotes={}),e.env.footnotes.list||(e.env.footnotes.list=[]),r=e.env.footnotes.list.length,e.pos=t,e.posMax=n,e.push({type:"footnote_ref",id:r,level:e.level}),e.linkLevel++,a=e.tokens.length,e.parser.tokenize(e),e.env.footnotes.list[r]={tokens:e.tokens.splice(a)},e.linkLevel--),e.pos=n+1,e.posMax=o,!0)}function Rl(e,i){var t,n,r,a,o=e.posMax,s=e.pos;if(s+3>o||!e.env.footnotes||!e.env.footnotes.refs||e.src.charCodeAt(s)!==91||e.src.charCodeAt(s+1)!==94||e.level>=e.options.maxNesting)return!1;for(n=s+2;n<o;n++){if(e.src.charCodeAt(n)===32||e.src.charCodeAt(n)===10)return!1;if(e.src.charCodeAt(n)===93)break}return n===s+2||n>=o||(n++,t=e.src.slice(s+2,n-1),R(e.env.footnotes.refs[":"+t])>"u")?!1:(i||(e.env.footnotes.list||(e.env.footnotes.list=[]),e.env.footnotes.refs[":"+t]<0?(r=e.env.footnotes.list.length,e.env.footnotes.list[r]={label:t,count:0},e.env.footnotes.refs[":"+t]=r):r=e.env.footnotes.refs[":"+t],a=e.env.footnotes.list[r].count,e.env.footnotes.list[r].count++,e.push({type:"footnote_ref",id:r,subId:a,level:e.level})),e.pos=n,e.posMax=o,!0)}var Ol=["coap","doi","javascript","aaa","aaas","about","acap","cap","cid","crid","data","dav","dict","dns","file","ftp","geo","go","gopher","h323","http","https","iax","icap","im","imap","info","ipp","iris","iris.beep","iris.xpc","iris.xpcs","iris.lwz","ldap","mailto","mid","msrp","msrps","mtqp","mupdate","news","nfs","ni","nih","nntp","opaquelocktoken","pop","pres","rtsp","service","session","shttp","sieve","sip","sips","sms","snmp","soap.beep","soap.beeps","tag","tel","telnet","tftp","thismessage","tn3270","tip","tv","urn","vemmi","ws","wss","xcon","xcon-userid","xmlrpc.beep","xmlrpc.beeps","xmpp","z39.50r","z39.50s","adiumxtra","afp","afs","aim","apt","attachment","aw","beshare","bitcoin","bolo","callto","chrome","chrome-extension","com-eventbrite-attendee","content","cvs","dlna-playsingle","dlna-playcontainer","dtn","dvb","ed2k","facetime","feed","finger","fish","gg","git","gizmoproject","gtalk","hcp","icon","ipn","irc","irc6","ircs","itms","jar","jms","keyparc","lastfm","ldaps","magnet","maps","market","message","mms","ms-help","msnim","mumble","mvn","notes","oid","palm","paparazzi","platform","proxy","psyc","query","res","resource","rmi","rsync","rtmp","secondlife","sftp","sgn","skype","smb","soldat","spotify","ssh","steam","svn","teamspeak","things","udp","unreal","ut2004","ventrilo","view-source","webcal","wtai","wyciwyg","xfire","xri","ymsgr"],Pl=/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/,Nl=/^<([a-zA-Z.\-]{1,25}):([^<>\x00-\x20]*)>/;function Dl(e,i){var t,n,r,a,o,s=e.pos;
506return e.src.charCodeAt(s)!==60||(t=e.src.slice(s),t.indexOf(">")<0)?!1:(n=t.match(Nl),n?Ol.indexOf(n[1].toLowerCase())<0||(a=n[0].slice(1,-1),o=Tn(a),!e.parser.validateLink(a))?!1:(i||(e.push({type:"link_open",href:o,level:e.level}),e.push({type:"text",content:a,level:e.level+1}),e.push({type:"link_close",level:e.level})),e.pos+=n[0].length,!0):(r=t.match(Pl),r?(a=r[0].slice(1,-1),o=Tn("mailto:"+a),e.parser.validateLink(o)?(i||(e.push({type:"link_open",href:o,level:e.level}),e.push({type:"text",content:a,level:e.level+1}),e.push({type:"link_close",level:e.level})),e.pos+=r[0].length,!0):!1):!1))}function jt(e,i){return e=e.source,i=i||"",function t(n,r){return n?(r=r.source||r,e=e.replace(n,r),t):new RegExp(e,i)}}var Fl=/[a-zA-Z_:][a-zA-Z0-9:._-]*/,jl=/[^"'=<>`\x00-\x20]+/,Bl=/'[^']*'/,ql=/"[^"]*"/,Ul=jt(/(?:unquoted|single_quoted|double_quoted)/)("unquoted",jl)("single_quoted",Bl)("double_quoted",ql)(),zl=jt(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name",Fl)("attr_value",Ul)(),Hl=jt(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute",zl)(),$l=/<\/[A-Za-z][A-Za-z0-9]*\s*>/,Vl=/<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->/,Gl=/<[?].*?[?]>/,Wl=/<![A-Z]+\s+[^>]*>/,Kl=/<!\[CDATA\[[\s\S]*?\]\]>/,Yl=jt(/^(?:open_tag|close_tag|comment|processing|declaration|cdata)/)("open_tag",Hl)("close_tag",$l)("comment",Vl)("processing",Gl)("declaration",Wl)("cdata",Kl)();function Jl(e){var i=e|32;return i>=97&&i<=122}function Zl(e,i){var t,n,r,a=e.pos;return!e.options.html||(r=e.posMax,e.src.charCodeAt(a)!==60||a+2>=r)||(t=e.src.charCodeAt(a+1),t!==33&&t!==63&&t!==47&&!Jl(t))||(n=e.src.slice(a).match(Yl),!n)?!1:(i||e.push({type:"htmltag",content:e.src.slice(a,a+n[0].length),level:e.level}),e.pos+=n[0].length,!0)}var Xl=/^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i,Ql=/^&([a-z][a-z0-9]{1,31});/i;function eu(e,i){var t,n,r,a=e.pos,o=e.posMax;if(e.src.charCodeAt(a)!==38)return!1;if(a+1<o){if(t=e.src.charCodeAt(a+1),t===35){if(r=e.src.slice(a).match(Xl),r)return i||(n=r[1][0].toLowerCase()==="x"?parseInt(r[1].slice(1),16):parseInt(r[1],10),e.pending+=Pi(n)?An(n):An(65533)),e.pos+=r[0].length,!0}else if(r=e.src.slice(a).match(Ql),r){var s=Ri(r[1]);if(r[1]!==s)return i||(e.pending+=s),e.pos+=r[0].length,!0}}return i||(e.pending+="&"),e.pos++,!0}var fn=[["text",yl],["newline",bl],["escape",kl],["backticks",_l],["del",wl],["ins",Sl],["mark",xl],["emphasis",El],["sub",Ml],["sup",Tl],["links",Il],["footnote_inline",Ll],["footnote_ref",Rl],["autolink",Dl],["htmltag",Zl],["entity",eu]];function Bt(){this.ruler=new me;for(var e=0;e<fn.length;e++)this.ruler.push(fn[e][0],fn[e][1]);this.validateLink=tu}Bt.prototype.skipToken=function(e){var i=this.ruler.getRules(""),t=i.length,n=e.pos,r,a;if((a=e.cacheGet(n))>0){e.pos=a;return}for(r=0;r<t;r++)if(i[r](e,!0)){e.cacheSet(n,e.pos);return}e.pos++,e.cacheSet(n,e.pos)};Bt.prototype.tokenize=function(e){for(var i=this.ruler.getRules(""),t=i.length,n=e.posMax,r,a;e.pos<n;){for(a=0;a<t&&(r=i[a](e,!1),!r);a++);if(r){if(e.pos>=n)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};Bt.prototype.parse=function(e,i,t,n){var r=new qe(e,this,i,t,n);this.tokenize(r)};function tu(e){var i=["vbscript","javascript","file","data"],t=e.trim().toLowerCase();return t=Oe(t),!(t.indexOf(":")!==-1&&i.indexOf(t.split(":")[0])!==-1)}var nu={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","replacements","smartquotes","references","abbr2","footnote_tail"]},block:{rules:["blockquote","code","fences","footnote","heading","hr","htmlblock","lheading","list","paragraph","table"]},inline:{rules:["autolink","backticks","del","emphasis","entity","escape","footnote_ref","htmltag","links","newline","text"]}}},ru={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{},block:{},inline:{}}},iu={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkTarget:"",typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["block","inline","references","abbr2"]},block:{rules:["blockquote","code","fences","heading","hr","htmlblock","lheading","list","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","htmltag","links","newline","text"]}}}
506,au={default:nu,full:ru,commonmark:iu};function Ui(e,i,t){this.src=i,this.env=t,this.options=e.options,this.tokens=[],this.inlineMode=!1,this.inline=e.inline,this.block=e.block,this.renderer=e.renderer,this.typographer=e.typographer}function be(e,i){typeof e!="string"&&(i=e,e="default"),i&&i.linkify!=null&&console.warn(`linkify option is removed. Use linkify plugin instead:
507
508import Remarkable from 'remarkable';
509import linkify from 'remarkable/linkify';
510new Remarkable().use(linkify)
511`),this.inline=new Bt,this.block=new Wn,this.core=new Bi,this.renderer=new Gn,this.ruler=new me,this.options={},this.configure(au[e]),this.set(i||{})}be.prototype.set=function(e){Oi(this.options,e)};be.prototype.configure=function(e){var i=this;if(!e)throw new Error("Wrong `remarkable` preset, check name/content");e.options&&i.set(e.options),e.components&&Object.keys(e.components).forEach(function(t){e.components[t].rules&&i[t].ruler.enable(e.components[t].rules,!0)})};be.prototype.use=function(e,i){return e(this,i),this};be.prototype.parse=function(e,i){var t=new Ui(this,e,i);return this.core.process(t),t.tokens};be.prototype.render=function(e,i){return i=i||{},this.renderer.render(this.parse(e,i),this.options,i)};be.prototype.parseInline=function(e,i){var t=new Ui(this,e,i);return t.inlineMode=!0,this.core.process(t),t.tokens};be.prototype.renderInline=function(e,i){return i=i||{},this.renderer.render(this.parseInline(e,i),this.options,i)};var In=function(){function e(){g(this,e)}return y(e,null,[{key:"instantiate",value:function(){var t=window.hljs;return t?new be({highlight:function(r,a){if(a&&t.getLanguage(a))try{return t.highlight(a,r).value}catch{console.error("failed to setup the highlight dependency")}try{return t.highlightAuto(r).value}catch{console.error("failed to automatically highlight messages")}return""},html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkTarget:"_blank",typographer:!0}):new be({linkTarget:"_blank"})}},{key:"createNew",value:function(){var t=e.instantiate();return t.inline.validateLink=function(){return!0},t}}]),e}(),zi=function(){function e(){g(this,e)}return y(e,null,[{key:"addMessage",value:function(t,n,r,a){var o;t.elementRef.appendChild(n.outerContainer),t.applyCustomStyles(n,a,!0,(o=t.messageStyles)==null?void 0:o[r]),t.elementRef.scrollTop=t.elementRef.scrollHeight}},{key:"wrapInLink",value:function(t,n,r){var a=document.createElement("a");return a.href=n,a.download=r||e.DEFAULT_FILE_NAME,a.target="_blank",a.appendChild(t),a}},{key:"isNonLinkableDataUrl",value:function(t,n){return!n.startsWith("data")||t==="image"?!1:t==="any"&&n.startsWith("data:text/javascript")||!n.startsWith("data:image")}},{key:"processContent",value:function(t,n,r,a){return!r||e.isNonLinkableDataUrl(t,r)?n:e.wrapInLink(n,r,a)}},{key:"waitToLoadThenScroll",value:function(t){setTimeout(function(){t.scrollTop=t.scrollHeight},60)}},{key:"scrollDownOnImageLoad",value:function(t,n){if(t.startsWith("data"))e.waitToLoadThenScroll(n);else try{fetch(t,{mode:"no-cors"}).catch(function(){}).finally(function(){e.waitToLoadThenScroll(n)})}catch{n.scrollTop=n.scrollHeight}}},{key:"reAddFileRefToObject",value:function(t,n){var r;(r=t.files)==null||r.forEach(function(a,o){var s;a.ref&&(s=n.message.files)!=null&&s[o]&&(n.message.files[o].ref=a.ref)})}},{key:"removeFileRef",value:function(t){var n=V({},t);return delete n.ref,n}}]),e}();zi.DEFAULT_FILE_NAME="file";var ye=zi,At=function(){function e(){g(this,e)}return y(e,null,[{key:"onNewMessage",value:function(t,n,r){var a,o=JSON.parse(JSON.stringify({message:n,isInitial:r}));ye.reAddFileRefToObject(n,o),(a=t.onNewMessage)==null||a.call(t,o),t.dispatchEvent(new CustomEvent("new-message",{detail:o}))}},{key:"onClearMessages",value:function(t){var n;(n=t.onClearMessages)==null||n.call(t),t.dispatchEvent(new CustomEvent("clear-messages"))}},{key:"onRender",value:function(t){var n;(n=t.onComponentRender)==null||n.call(t,t),t.dispatchEvent(new CustomEvent("render",{detail:t}))}},{key:"onError",value:function(t,n){var r;(r=t.onError)==null||r.call(t,n),t.dispatchEvent(new CustomEvent("error",{detail:n}))}}]),e}(),Et=function(){function e(){g(this,e)}return y(e,null,[{key:"applyCustomStylesToElements",value:function(t,n,r){if(r&&(Object.assign(t.outerContainer.style,r.outerContainer),Object.assign(t.innerContainer.style,r.innerContainer),Object.assign(t.bubbleElement.style,r.bubble),n)){var a=t.bubbleElement.children[0],o=a.tagName.toLocaleLowerCase()!=="a"?a:a.children[0];Object.assign(o.style,r.media)}}},{key:"applySideStyles",value:function(t,n,r,a){a&&(e.applyCustomStylesToElements(t,r,a.shared),n===F.USER_ROLE?e.applyCustomStylesToElements(t,r,a.user):(e.applyCustomStylesToElements(t,r,a.ai),e.applyCustomStylesToElements(t,r,a[n])))}},{key:"isMessageSideStyles",value:function(t){return!!(t.ai||t.shared||t.user)}},{key:"applyCustomStyles",value:function(t,n,r,a,o){var s;o&&t.default!==o?e.isMessageSideStyles(o)?(e.applySideStyles(n,r,a,t.default),e.applySideStyles(n,r,a,o)):(e.applyCustomStylesToElements(n,a,(s=t.default)==null?void 0:s.shared),e.applyCustomStylesToElements(n,a,o)):e.applySideStyles(n,r,a,t.default)}},{key:"extractParticularSharedStyles",value:function(t,n){if(n!=null&&n.shared){var r=n.shared,a={outerContainer:{},innerContainer:{},bubble:{},media:{}};return t.forEach(function(o){var s,l,u,c;a.outerContainer[o]=((s=r.outerContainer)==null?void 0:s[o])||"",a.innerContainer[o]=((l=r.innerContainer)==null?void 0:l[o])||"",a.bubble[o]=((u=r.bubble)==null?void 0:u[o])||"",a.media[o]=((c=r.media)==null?void 0:c[o])||""}),a}}}]),e}(),Hi=function(){function e(i){var t=this;g(this,e),this.messageElementRefs=[],this.messages=[],this.htmlClassUtilities={},this.textElementsToText=[],this.elementRef=e.createContainerElement(),this.messageStyles=i.messageStyles,this._remarkable=In.createNew(),this._avatars=i.avatars,this._names=i.names,this._onNewMessage=At.onNewMessage.bind(this,i),i.htmlClassUtilities&&(this.htmlClassUtilities=i.htmlClassUtilities),setTimeout(function(){t.submitUserMessage=i.submitUserMessage})}return y(e,[{key:"addNewTextMessage",value:function(t,n,r){if(r!=null&&r.status){var a=this.overwriteText(n,t,this.messageElementRefs);if(a)return a;r.status=!1}var o=this.createAndAppendNewMessageElement(t,n);return o.bubbleElement.classList.add("text-message"),this.applyCustomStyles(o,n,!1),F.fillEmptyMessageElement(o.bubbleElement,t),this.textElementsToText.push([o,t]),o}}
511,{key:"overwriteText",value:function(t,n,r){var a=F.overwriteMessage(this.messages,r,n,t,"text","text-message");if(a){this.renderText(a.bubbleElement,n);var o=F.getLastTextToElement(this.textElementsToText,a);o&&(o[1]=n)}return a}},{key:"createAndAppendNewMessageElement",value:function(t,n){var r=this,a=this.createNewMessageElement(t,n);return this.elementRef.appendChild(a.outerContainer),setTimeout(function(){return he.scrollToBottom(r.elementRef)}),a}},{key:"createNewMessageElement",value:function(t,n){var r;(r=this._introPanel)==null||r.hide();var a=this.messageElementRefs[this.messageElementRefs.length-1];return e.isTemporaryElement(a)&&(a.outerContainer.remove(),this.messageElementRefs.pop()),this.createMessageElements(t,n)}},{key:"createMessageElements",value:function(t,n){var r=e.createBaseElements(),a=r.outerContainer,o=r.innerContainer,s=r.bubbleElement;return a.appendChild(o),this.addInnerContainerElements(s,t,n),this.messageElementRefs.push(r),r}},{key:"addInnerContainerElements",value:function(t,n,r){var a;return((a=this.messages[this.messages.length-1])==null?void 0:a.role)===r&&!this.isLastMessageError()&&F.hideRoleElements(this.messageElementRefs,!!this._avatars,!!this._names),t.classList.add("message-bubble",F.getRoleClass(r),r===F.USER_ROLE?"user-message-text":"ai-message-text"),this.renderText(t,n),F.addRoleElements(t,r,this._avatars,this._names),{bubbleElement:t}}},{key:"applyCustomStyles",value:function(t,n,r,a){t&&this.messageStyles&&Et.applyCustomStyles(this.messageStyles,t,n,r,a)}},{key:"removeLastMessage",value:function(){this.messageElementRefs[this.messageElementRefs.length-1].outerContainer.remove(),this.messageElementRefs.pop()}},{key:"isLastMessageError",value:function(){var t;return(t=F.getLastMessageBubbleElement(this.elementRef))==null?void 0:t.classList.contains("error-message-text")}},{key:"sendClientUpdate",value:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r;(r=this._onNewMessage)==null||r.call(this,t,n)}},{key:"renderText",value:function(t,n){t.innerHTML=this._remarkable.render(n),t.innerText.trim().length===0&&(t.innerText=n)}},{key:"refreshTextMessages",value:function(){var t=this;this._remarkable=In.createNew(),this.textElementsToText.forEach(function(n){t.renderText(n[0].bubbleElement,n[1])})}}],[{key:"createContainerElement",value:function(){var t=document.createElement("div");return t.id="messages",t}},{key:"isTemporaryElement",value:function(t){return(t==null?void 0:t.bubbleElement.classList.contains("loading-message-text"))||Mt.isElementTemporary(t)}},{key:"createBaseElements",value:function(){var t=document.createElement("div"),n=document.createElement("div");n.classList.add("inner-message-container"),t.appendChild(n),t.classList.add("outer-message-container");var r=document.createElement("div");return r.classList.add("message-bubble"),n.appendChild(r),{outerContainer:t,innerContainer:n,bubbleElement:r}}},{key:"createMessageContent",value:function(t){var n=t.text,r=t.files,a=t.html,o=t._sessionId,s=t.role,l={role:s||F.AI_ROLE};return n&&(l.text=n),r&&(l.files=r),a&&(l.html=a),!n&&!r&&!a&&(l.text=""),o&&(l._sessionId=o),l}}]),e}(),Yn=function(){function e(i){g(this,e),this._fileAdded=!1,this._streamedContent="",this._streamType="",this._hasStreamEnded=!1,this._messages=i}return y(e,[{key:"upsertStreamedMessage",value:function(t){var n;if(!this._hasStreamEnded){if((t==null?void 0:t.text)===void 0&&(t==null?void 0:t.html)===void 0)return console.error(ee.INVALID_STREAM_EVENT);var r=(t==null?void 0:t.text)||(t==null?void 0:t.html)||"",a=he.isScrollbarAtBottomOfElement(this._messages.elementRef),o=(t==null?void 0:t.text)!==void 0?"text":"html";if(!this._elements&&this._streamedContent==="")this.setInitialState(o,r,t==null?void 0:t.role);else{if(this._streamType!==o)return console.error(ee.INVALID_STREAM_EVENT_MIX);this.updateBasedOnType(r,o,(n=this._elements)==null?void 0:n.bubbleElement,t==null?void 0:t.overwrite)}a&&he.scrollToBottom(this._messages.elementRef)}}},{key:"setInitialState",value:function(t,n,r){var a;this._streamType=t,(a=r)!==null&&a!==void 0||(r=F.AI_ROLE),this._elements=t==="text"?this._messages.addNewTextMessage(n,r):Mn.add(this._messages,n,r,this._messages.messageElementRefs),this._elements.bubbleElement.classList.add(e.MESSAGE_CLASS),this._streamedContent=n,this._activeMessageRole=r,this._message=_i({role:this._activeMessageRole},t,this._streamedContent),this._messages.messages.push(this._message)}},{key:"updateBasedOnType",value:function(t,n,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;F.unfillEmptyMessageElement(r,t),(n==="text"?this.updateText:this.updateHTML).bind(this)(t,r,a)}},{key:"updateText",value:function(t,n,r){this._streamedContent=r?t:this._streamedContent+t,this._messages.textElementsToText[this._messages.textElementsToText.length-1][1]=this._streamedContent,this._messages.renderText(n,this._streamedContent)}},{key:"updateHTML",value:function(t,n,r){if(r)this._streamedContent=t,n.innerHTML=t;else{var a=document.createElement("span");a.innerHTML=t,n.appendChild(a),this._streamedContent=e.HTML_CONTENT_PLACEHOLDER}}},{key:"finaliseStreamedMessage",value:function(){var t,n,r=this._messages.textElementsToText;if(!(this._fileAdded&&!this._elements)){if(!this._elements)throw Error(ee.NO_VALID_STREAM_EVENTS_SENT);(t=this._elements.bubbleElement)!=null&&t.classList.contains(e.MESSAGE_CLASS)&&(this._streamType==="text"?(r[r.length-1][1]=this._streamedContent,this._message&&(this._message.text=this._streamedContent),this._messages.textToSpeech&&xt.speak(this._streamedContent,this._messages.textToSpeech)):this._streamType==="html"&&(this._streamedContent===e.HTML_CONTENT_PLACEHOLDER&&(this._streamedContent=((n=this._elements.bubbleElement)==null?void 0:n.innerHTML)||""),this._elements&&at.apply(this._messages,this._elements.outerContainer),this._message&&(this._message.html=this._streamedContent)),this._message&&this._messages.sendClientUpdate(Hi.createMessageContent(this._message),!1),this._hasStreamEnded=!0)}}},{key:"markFileAded",value:function(){this._fileAdded=!0}}]),e}();Yn.MESSAGE_CLASS="streamed-message";Yn.HTML_CONTENT_PLACEHOLDER="htmlplaceholder";
511var Pe=Yn,$i=function(){function e(){g(this,e)}return y(e,null,[{key:"tempRemoveContentHeader",value:function(){var i=k(f().mark(function n(r,a,o){var s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(r!=null&&r.headers){c.next=2;break}throw new Error("Request settings have not been set up");case 2:return s=r.headers[e.CONTENT_TYPE],delete r.headers[e.CONTENT_TYPE],c.prev=4,c.next=7,a(o);case 7:l=c.sent,c.next=13;break;case 10:throw c.prev=10,c.t0=c.catch(4),r.headers[e.CONTENT_TYPE]=s,c.t0;case 13:return c.abrupt("return",(r.headers[e.CONTENT_TYPE]=s,l));case 14:case"end":return c.stop()}},n,null,[[4,10]])}));function t(n,r,a){return i.apply(this,arguments)}return t}()},{key:"displayError",value:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"Service error, please try again.";if(console.error(n),R(n)=="object")return Object.keys(n).length===0?t.addNewErrorMessage("service",r):t.addNewErrorMessage("service",JSON.stringify(n));t.addNewErrorMessage("service",n)}},{key:"fetch",value:function(i){function t(n,r,a,o){return i.apply(this,arguments)}return t.toString=function(){return i.toString()},t}(function(i,t,n,r){var a,o,s={method:((a=i.requestSettings)==null?void 0:a.method)||"POST",headers:t};return s.method!=="GET"&&(s.body=n?JSON.stringify(r):r),i.requestSettings.credentials&&(s.credentials=i.requestSettings.credentials),fetch(((o=i.requestSettings)==null?void 0:o.url)||i.url||"",s)})},{key:"processResponseByType",value:function(t){var n=t.headers.get("content-type");return n!=null&&n.includes("application/json")?t.json():n!=null&&n.includes("text/plain")||!n?t:t.blob()}},{key:"processRequestInterceptor",value:function(){var i=k(f().mark(function n(r,a){var o,s,l,u;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,(o=r.requestInterceptor)==null?void 0:o.call(r,a);case 2:if(d.t0=d.sent,d.t0){d.next=5;break}d.t0=a;case 5:return s=d.t0,l=s,u=s,d.abrupt("return",{body:l.body,headers:l.headers,error:u.error});case 9:case"end":return d.stop()}},n)}));function t(n,r){return i.apply(this,arguments)}return t}()},{key:"validateResponseFormat",value:function(t){return t&&R(t)=="object"&&(typeof t.error=="string"||typeof t.text=="string"||typeof t.html=="string"||Array.isArray(t.files))}},{key:"onInterceptorError",value:function(t,n,r){t.addNewErrorMessage("service",n),r==null||r()}}]),e}();$i.CONTENT_TYPE="Content-Type";var B=$i;function ou(e,i){return Ln.apply(this,arguments)}function Ln(){return Ln=k(f().mark(function e(i,t){var n,r;return f().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:n=i.getReader();case 1:return o.next=3,n.read();case 3:if((r=o.sent).done){o.next=7;break}t(r.value);case 5:o.next=1;break;case 7:case"end":return o.stop()}},e)})),Ln.apply(this,arguments)}function su(e){var i,t,n,r=!1;return function(a){i===void 0?(i=a,t=0,n=-1):i=uu(i,a);for(var o=i.length,s=0;t<o;){r&&(i[t]===10&&(s=++t),r=!1);for(var l=-1;t<o&&l===-1;++t)switch(i[t]){case 58:n===-1&&(n=t-s);break;case 13:r=!0;case 10:l=t;break}if(l===-1)break;e(i.subarray(s,l),n),s=t,n=-1}s===o?i=void 0:s!==0&&(i=i.subarray(s),t-=s)}}function lu(e,i,t){var n=Or(),r=new TextDecoder;return function(a,o){if(a.length===0)t==null||t(n),n=Or();else if(o>0){var s=r.decode(a.subarray(0,o)),l=o+(a[o+1]===32?2:1),u=r.decode(a.subarray(l));switch(s){case"data":n.data=n.data?n.data+`
512`+u:u;break;case"event":n.event=u;break;case"id":e(n.id=u);break;case"retry":var c=parseInt(u,10);isNaN(c)||i(n.retry=c);break}}}}function uu(e,i){var t=new Uint8Array(e.length+i.length);return t.set(e),t.set(i,e.length),t}function Or(){return{data:"",event:"",id:"",retry:void 0}}var cu=globalThis&&globalThis.__rest||function(e,i){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&i.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)i.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]]);return t},Rn="text/event-stream",du=1e3,Pr="last-event-id";
512function hu(e,i){var t=i.signal,n=i.headers,r=i.onopen,a=i.onmessage,o=i.onclose,s=i.onerror,l=i.openWhenHidden,u=i.fetch,c=cu(i,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise(function(d,h){var p=Object.assign({},n);p.accept||(p.accept=Rn);var m;function v(){m.abort(),document.hidden||M()}l||document.addEventListener("visibilitychange",v);var b=du,w=0;function _(){document.removeEventListener("visibilitychange",v),window.clearTimeout(w),m.abort()}t==null||t.addEventListener("abort",function(){_(),d()});var x=u??window.fetch,N=r??pu;function M(){return j.apply(this,arguments)}function j(){return j=k(f().mark(function W(){var H,Z,te;return f().wrap(function(G){for(;;)switch(G.prev=G.next){case 0:return m=new AbortController,G.prev=1,G.next=4,x(e,Object.assign(Object.assign({},c),{headers:p,signal:m.signal}));case 4:return Z=G.sent,G.next=7,N(Z);case 7:return G.next=9,ou(Z.body,su(lu(function(Q){Q?p[Pr]=Q:delete p[Pr]},function(Q){b=Q},a)));case 9:o==null||o(),_(),d(),G.next=17;break;case 14:if(G.prev=14,G.t0=G.catch(1),!m.signal.aborted)try{te=(H=s==null?void 0:s(G.t0))!==null&&H!==void 0?H:b,window.clearTimeout(w),w=window.setTimeout(M,te)}catch(Q){_(),h(Q)}case 17:case"end":return G.stop()}},W,null,[[1,14]])})),j.apply(this,arguments)}M()})}function pu(e){var i=e.headers.get("content-type");if(!(i!=null&&i.startsWith(Rn)))throw new Error("Expected content-type to be ".concat(Rn,", Actual: ").concat(i))}var re=function(){function e(){g(this,e)}return y(e,null,[{key:"request",value:function(){var i=k(f().mark(function n(r,a,o){var s,l,u,c,d,h,p,m,v,b,w,_,x,N,M,j,W,H,Z=arguments;return f().wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return s=Z.length>3&&Z[3]!==void 0?Z[3]:!0,m={body:a,headers:(l=r.requestSettings)==null?void 0:l.headers},X.next=4,B.processRequestInterceptor(r.deepChat,m);case 4:if(v=X.sent,b=v.body,w=v.headers,_=v.error,x=r.streamHandlers,N=x.onOpen,M=x.onClose,j=x.abortStream,!_){X.next=14;break}return X.abrupt("return",B.onInterceptorError(o,_,M));case 14:if(!((u=r.requestSettings)!=null&&u.handler)){X.next=16;break}return X.abrupt("return",Jn.stream(r,b,o));case 16:if(((c=r.requestSettings)==null?void 0:c.url)!==Se.URL){X.next=18;break}return X.abrupt("return",Se.requestStream(o,r.streamHandlers));case 18:W=new Pe(o),H=B.fetch.bind(this,r,w,s),hu(((d=r.requestSettings)==null?void 0:d.url)||r.url||"",{method:((h=r.requestSettings)==null?void 0:h.method)||"POST",headers:w,credentials:(p=r.requestSettings)==null?void 0:p.credentials,body:s?JSON.stringify(b):b,openWhenHidden:!0,onopen:function(Q){return k(f().mark(function Y(){return f().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:if(!Q.ok){C.next=2;break}return C.abrupt("return",N());case 2:return C.next=4,B.processResponseByType(Q);case 4:throw C.sent;case 5:case"end":return C.stop()}},Y)}))()},onmessage:function(Q){return k(f().mark(function Y(){var Me,C,S,E,L;return f().wrap(function(I){for(;;)switch(I.prev=I.next){case 0:if(JSON.stringify(Q.data)===JSON.stringify("[DONE]")){I.next=9;break}try{E=JSON.parse(Q.data)}catch{E={}}return I.next=4,(C=(Me=r.deepChat).responseInterceptor)==null?void 0:C.call(Me,E);case 4:if(I.t0=I.sent,I.t0){I.next=7;break}I.t0=E;case 7:L=I.t0,(S=r.extractResultData)==null||S.call(r,L,H,b).then(function(K){r.asyncCallInProgress&&K&&K.text!==""?(e.simulate(o,r.streamHandlers,K),M(),r.asyncCallInProgress=!1):e.upsertWFiles(o,W.upsertStreamedMessage.bind(W),W,K)}).catch(function(K){return B.displayError(o,K)});case 9:case"end":return I.stop()}},Y)}))()},onerror:function(Q){throw M(),Q},onclose:function(){r.asyncCallInProgress||(W.finaliseStreamedMessage(),M())},signal:j.signal}).catch(function(G){var Q;o.isLastMessageError()||(Q=r.extractResultData)==null||Q.call(r,G).then(function(){B.displayError(o,G)}).catch(function(Y){B.displayError(o,Y)})});case 20:case"end":return X.stop()}},n,this)}));function t(n,r,a){return i.apply(this,arguments)}return t}()},{key:"simulate",value:function(t,n,r){var a=n;if((r.files||r.html)&&t.addNewMessage(V({sendUpdate:!1,ignoreText:!0},r),!1),r.text){n.onOpen();var o=r.text.split("");e.populateMessages(o,new Pe(t),a)}}},{key:"populateMessages",value:function(t,n,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=t[a];if(o){n.upsertStreamedMessage({text:o});
512var s=setTimeout(function(){e.populateMessages(t,n,r,a+1)},r.simulationInterim||6);r.abortStream.abort=function(){e.abort(s,n,r.onClose)}}else n.finaliseStreamedMessage(),r.onClose()}},{key:"isSimulation",value:function(t){return R(t)=="object"&&!!t.simulation}},{key:"isSimulatable",value:function(t,n){return e.isSimulation(t)&&n&&(n.text||n.html)}},{key:"abort",value:function(t,n,r){clearTimeout(t),n.finaliseStreamedMessage(),r()}},{key:"upsertWFiles",value:function(t,n,r,a){if(a!=null&&a.text||a!=null&&a.html){var o,s=n(a);(o=r)!==null&&o!==void 0||(r=s||void 0)}a!=null&&a.files&&(t.addNewMessage({files:a.files}),r==null||r.markFileAded())}}]),e}(),Vi=function(){function e(){g(this,e)}return y(e,null,[{key:"generateResponse",value:function(t){var n=t.messages[t.messages.length-1];if(n.files&&n.files.length>0){if(n.files.length>1)return"These are interesting files!";var r=n.files[0];return r.src&&r.src.startsWith("data:image/gif")?"That is a nice gif!":r.type==="image"?"That is a nice image!":r.type==="audio"?"I like the sound of that!":"That is an interesting file!"}if(n.text){if(n.text.charAt(n.text.length-1)==="?")return"I'm sorry but I can't answer that question...";if(n.text.includes("updog"))return"What's updog?"}return"Hi there! This is a demo response!"}},{key:"getCustomResponse",value:function(t,n){return typeof t=="function"?t(n):t}},{key:"getResponse",value:function(t){return t.customDemoResponse?e.getCustomResponse(t.customDemoResponse,t.messages[t.messages.length-1]):{text:e.generateResponse(t)}}},{key:"request",value:function(t,n){var r=e.getResponse(n);setTimeout(k(f().mark(function a(){var o,s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,(s=(o=t.deepChat).responseInterceptor)==null?void 0:s.call(o,r);case 2:if(c.t0=c.sent,c.t0){c.next=5;break}c.t0=r;case 5:l=c.t0,l.error?(n.addNewErrorMessage("service",l.error),t.completionsHandlers.onFinish()):re.isSimulatable(t.deepChat.stream,l)?re.simulate(n,t.streamHandlers,l):(n.addNewMessage(l),t.completionsHandlers.onFinish());case 7:case"end":return c.stop()}},a)})),400)}},{key:"requestStream",value:function(t,n){setTimeout(function(){var r=e.getResponse(t);re.simulate(t,n,r)},400)}}]),e}();Vi.URL="deep-chat-demo";var Se=Vi,lt=function(){function e(){g(this,e)}return y(e,null,[{key:"setup",value:function(t){t.requestSettings.url!==Se.URL&&(t.permittedErrorPrefixes=["Connection error","Error in server message"],t.websocket="pending")}},{key:"createConnection",value:function(t,n){if(document.body.contains(t.deepChat)){var r=t.requestSettings.websocket;if(r){if(t.requestSettings.handler)return Jn.websocket(t,n);try{var a=typeof r!="boolean"?r:void 0,o=new WebSocket(t.requestSettings.url||"",a);t.websocket=o,t.websocket.onopen=function(){var s,l;n.removeError(),t.websocket&&R(t.websocket)=="object"&&e.assignListeners(t,o,n),(l=(s=t.deepChat)._validationHandler)==null||l.call(s)},t.websocket.onerror=function(s){console.error(s),e.retryConnection(t,n)}}catch(s){console.error(s),e.retryConnection(t,n)}}}}},{key:"retryConnection",value:function(t,n){var r,a;(a=(r=t.deepChat)._validationHandler)==null||a.call(r),document.body.contains(t.deepChat)&&(t.websocket="pending",n.isLastMessageError()||n.addNewErrorMessage("service","Connection error"),setTimeout(function(){e.createConnection(t,n)},5e3))}},{key:"assignListeners",value:function(t,n,r){var a=this,o={};n.onmessage=function(){var s=k(f().mark(function l(u){var c,d,h,p,m,v,b;return f().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:if(!t.extractResultData){_.next=20;break}return _.prev=1,h=JSON.parse(u.data),_.next=5,(d=(c=t.deepChat).responseInterceptor)==null?void 0:d.call(c,h);
512case 5:if(_.t0=_.sent,_.t0){_.next=8;break}_.t0=h;case 8:return p=_.t0,_.next=11,t.extractResultData(p);case 11:if(m=_.sent,!(!m||R(m)!="object")){_.next=14;break}throw Error(ee.INVALID_RESPONSE(h,"server",!!t.deepChat.responseInterceptor,p));case 14:re.isSimulation(t.deepChat.stream)?(v=e.stream.bind(a,t,r,o),b=o[h.role||F.AI_ROLE],re.upsertWFiles(r,v,b,m)):r.addNewMessage(m),_.next=20;break;case 17:_.prev=17,_.t1=_.catch(1),B.displayError(r,_.t1,"Error in server message");case 20:case"end":return _.stop()}},l,null,[[1,17]])}));return function(l){return s.apply(this,arguments)}}(),n.onclose=function(){console.error("Connection closed"),r.isLastMessageError()||r.addNewErrorMessage("service","Connection error"),t.deepChat.stream&&t.streamHandlers.abortStream.abort(),e.createConnection(t,r)}}},{key:"sendWebsocket",value:function(){var i=k(f().mark(function n(r,a,o){var s,l,u,c,d,h,p,m,v,b=arguments;return f().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:if(s=b.length>3&&b[3]!==void 0?b[3]:!0,c=r.websocket,!(!c||c==="pending")){_.next=4;break}return _.abrupt("return");case 4:return d={body:a,headers:(l=r.requestSettings)==null?void 0:l.headers},_.next=7,B.processRequestInterceptor(r.deepChat,d);case 7:if(h=_.sent,p=h.body,m=h.error,!m){_.next=12;break}return _.abrupt("return",o.addNewErrorMessage("service",m));case 12:if(e.isWebSocket(c)){_.next=14;break}return _.abrupt("return",c.newUserMessage.listener(p));case 14:if(v=s?JSON.stringify(p):p,((u=r.requestSettings)==null?void 0:u.url)!==Se.URL){_.next=17;break}return _.abrupt("return",Se.request(r,o));case 17:c.readyState===void 0||c.readyState!==c.OPEN?(console.error("Connection is not open"),o.isLastMessageError()||o.addNewErrorMessage("service","Connection error")):(c.send(JSON.stringify(v)),r.completionsHandlers.onFinish());case 18:case"end":return _.stop()}},n)}));function t(n,r,a){return i.apply(this,arguments)}return t}()},{key:"canSendMessage",value:function(t){return t?t==="pending"?!1:e.isWebSocket(t)?t.readyState!==void 0&&t.readyState===t.OPEN:t.isOpen:!0}},{key:"isWebSocket",value:function(t){return t.send!==void 0}},{key:"stream",value:function(t,n,r,a){if(a){var o=t.deepChat.stream.simulation;if(typeof o=="string"){var s,l=a.role||F.AI_ROLE,u=r[l];a.text===o?(u==null||u.finaliseStreamedMessage(),delete r[l]):((s=r[l])!==null&&s!==void 0||(r[l]=new Pe(n)),r[l].upsertStreamedMessage(a))}else re.simulate(n,t.streamHandlers,a)}}}]),e}(),Jn=function(){function e(){g(this,e)}return y(e,null,[{key:"request",value:function(){var i=k(f().mark(function n(r,a,o){var s,l,u,c,d;return f().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:u=!0,c=function(){var m=k(f().mark(function v(b){var w,_,x;return f().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(u){M.next=2;break}return M.abrupt("return");case 2:return u=!1,M.next=5,(_=(w=r.deepChat).responseInterceptor)==null?void 0:_.call(w,b);case 5:if(M.t0=M.sent,M.t0){M.next=8;break}M.t0=b;case 8:x=M.t0,B.validateResponseFormat(x)?typeof x.error=="string"?(console.error(x.error),o.addNewErrorMessage("service",x.error),r.completionsHandlers.onFinish()):re.isSimulatable(r.deepChat.stream,x)?re.simulate(o,r.streamHandlers,x):(o.addNewMessage(x),r.completionsHandlers.onFinish()):(console.error(ee.INVALID_RESPONSE(b,"server",!!r.deepChat.responseInterceptor,x)),o.addNewErrorMessage("service","Error in server message"),r.completionsHandlers.onFinish());case 10:case"end":return M.stop()}},v)}));return function(b){return m.apply(this,arguments)}}(),d=e.generateOptionalSignals(),(l=(s=r.requestSettings).handler)==null||l.call(s,a,V(V({},d),{},{onResponse:c}));case 3:case"end":return p.stop()}},n)}));function t(n,r,a){return i.apply(this,arguments)}return t}()},{key:"attemptToFinaliseStream",value:function(t,n){try{t.finaliseStreamedMessage()}catch(r){console.error(r),n.addNewErrorMessage("service",r)}}},{key:"stream",value:function(t,n,r){var a,o,s=!0,l=!1,u=new Pe(r),c=function(){l||!s||(t.streamHandlers.onOpen(),l=!0)},d=function(){s&&(e.attemptToFinaliseStream(u,r),t.streamHandlers.onClose(),s=!1)},h=function(){var m=k(f().mark(function v(b){var w,_,x;return f().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(s){M.next=2;break}return M.abrupt("return");case 2:return M.next=4,(_=(w=t.deepChat).responseInterceptor)==null?void 0:_.call(w,b);case 4:if(M.t0=M.sent,M.t0){M.next=7;break}M.t0=b;case 7:x=M.t0,B.validateResponseFormat(x)?x.error?(console.error(x.error),u.finaliseStreamedMessage(),r.addNewErrorMessage("service",x.error),t.streamHandlers.onClose(),s=!1):re.upsertWFiles(r,u.upsertStreamedMessage.bind(u),u,x):console.error(ee.INVALID_RESPONSE(b,"server",!!t.deepChat.responseInterceptor,x));case 9:case"end":return M.stop()}},v)}));return function(b){return m.apply(this,arguments)}}();t.streamHandlers.abortStream.abort=function(){e.attemptToFinaliseStream(u,r),t.streamHandlers.onClose(),s=!1};var p=e.generateOptionalSignals();(o=(a=t.requestSettings).handler)==null||o.call(a,n,V(V({},p),{},{onOpen:c,onResponse:h,onClose:d,stopClicked:t.streamHandlers.stopClicked}))}},{key:"websocket",value:function(t,n){var r=this,a,o,s={isOpen:!1,newUserMessage:{listener:function(){}},roleToStream:{}};t.websocket=s;var l=function(){n.removeError(),s.isOpen=!0},u=function(){s.isOpen=!1},c=function(){var h=k(f().mark(function p(m){var v,b,w,_,x;return f().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:if(s.isOpen){M.next=2;break}return M.abrupt("return");case 2:return M.next=4,(b=(v=t.deepChat).responseInterceptor)==null?void 0:b.call(v,m);case 4:if(M.t0=M.sent,M.t0){M.next=7;break}M.t0=m;case 7:w=M.t0,B.validateResponseFormat(w)?typeof w.error=="string"?(console.error(w.error),n.isLastMessageError()||n.addNewErrorMessage("service",w.error)):re.isSimulation(t.deepChat.stream)?(_=lt.stream.bind(r,t,n,s.roleToStream),x=s.roleToStream[m.role||F.AI_ROLE],re.upsertWFiles(n,_,x,m)):n.addNewMessage(w):(console.error(ee.INVALID_RESPONSE(m,"server",!!t.deepChat.responseInterceptor,w)),n.addNewErrorMessage("service","Error in server message"));case 9:case"end":return M.stop()}},p)}));return function(m){return h.apply(this,arguments)}}(),d=e.generateOptionalSignals();(o=(a=t.requestSettings).handler)==null||o.call(a,void 0,V(V({},d),{},{onOpen:l,onResponse:c,onClose:u,newUserMessage:s.newUserMessage}))}},{key:"generateOptionalSignals",value:function(){return{onClose:function(){},onOpen:function(){},stopClicked:{listener:function(){}},newUserMessage:{listener:function(){}}}}}]),e}(),J=function(){function e(){g(this,e)}return y(e,null,[{key:"request",value:function(){var i=k(f().mark(function n(r,a,o){var s,l,u,c,d,h,p,m,v,b,w,_,x=arguments;return f().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:return s=x.length>3&&x[3]!==void 0?x[3]:!0,d={body:a,headers:(l=r.requestSettings)==null?void 0:l.headers},M.next=4,B.processRequestInterceptor(r.deepChat,d);case 4:if(h=M.sent,p=h.body,m=h.headers,v=h.error,b=r.completionsHandlers.onFinish,!v){M.next=11;break}return M.abrupt("return",B.onInterceptorError(o,v,b));case 11:if(!((u=r.requestSettings)!=null&&u.handler)){M.next=13;break}return M.abrupt("return",Jn.request(r,p,o));case 13:if(((c=r.requestSettings)==null?void 0:c.url)!==Se.URL){M.next=15;break}return M.abrupt("return",Se.request(r,o));case 15:w=!0,_=B.fetch.bind(this,r,m,s),_(p).then(function(j){return w=!!j.ok,j}).then(function(j){return B.processResponseByType(j)}).then(function(){var j=k(f().mark(function W(H){var Z,te,X,G;return f().wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:if(r.extractResultData){Y.next=2;break}return Y.abrupt("return");case 2:return Y.next=4,(te=(Z=r.deepChat).responseInterceptor)==null?void 0:te.call(Z,H);case 4:if(Y.t0=Y.sent,Y.t0){Y.next=7;break}Y.t0=H;case 7:return X=Y.t0,Y.next=10,r.extractResultData(X,_,p);case 10:if(G=Y.sent,w){Y.next=13;break}throw H;case 13:if(!(!G||R(G)!="object")){Y.next=15;break}throw Error(ee.INVALID_RESPONSE(H,"response",!!r.deepChat.responseInterceptor,X)
512);case 15:G.makingAnotherRequest||(re.isSimulatable(r.deepChat.stream,G)?re.simulate(o,r.streamHandlers,G):(o.addNewMessage(G),b()));case 16:case"end":return Y.stop()}},W)}));return function(W){return j.apply(this,arguments)}}()).catch(function(j){B.displayError(o,j),b()});case 18:case"end":return M.stop()}},n,this)}));function t(n,r,a){return i.apply(this,arguments)}return t}()},{key:"executePollRequest",value:function(t,n,r,a){var o=t.completionsHandlers.onFinish;fetch(n,r).then(function(s){return s.json()}).then(function(){var s=k(f().mark(function l(u){var c,d,h;return f().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:if(t.extractPollResultData){m.next=2;break}return m.abrupt("return");case 2:return m.t0=t,m.next=5,(d=(c=t.deepChat).responseInterceptor)==null?void 0:d.call(c,u);case 5:if(m.t1=m.sent,m.t1){m.next=8;break}m.t1=u;case 8:return m.t2=m.t1,m.next=11,m.t0.extractPollResultData.call(m.t0,m.t2);case 11:h=m.sent,h.timeoutMS?setTimeout(function(){e.executePollRequest(t,n,r,a)},h.timeoutMS):re.isSimulatable(t.deepChat.stream,u)?re.simulate(a,t.streamHandlers,h):(a.addNewMessage(h),o());case 13:case"end":return m.stop()}},l)}));return function(l){return s.apply(this,arguments)}}()).catch(function(s){B.displayError(a,s),o()})}},{key:"poll",value:function(){var i=k(f().mark(function n(r,a,o){var s,l,u,c,d,h,p,m,v,b,w,_,x,N=arguments;return f().wrap(function(j){for(;;)switch(j.prev=j.next){case 0:return s=N.length>3&&N[3]!==void 0?N[3]:!0,d={body:a,headers:(l=r.requestSettings)==null?void 0:l.headers},j.next=4,B.processRequestInterceptor(r.deepChat,d);case 4:if(h=j.sent,p=h.body,m=h.headers,v=h.error,!v){j.next=10;break}return j.abrupt("return",B.onInterceptorError(o,v));case 10:b=((u=r.requestSettings)==null?void 0:u.url)||r.url||"",w=((c=r.requestSettings)==null?void 0:c.method)||"POST",_=s?JSON.stringify(p):p,x={method:w,body:_,headers:m},r.requestSettings.credentials&&(x.credentials=r.requestSettings.credentials),e.executePollRequest(r,b,x,o);case 12:case"end":return j.stop()}},n)}));function t(n,r,a){return i.apply(this,arguments)}return t}()},{key:"verifyKey",value:function(t,n,r,a,o,s,l,u,c){if(t==="")return s(ee.INVALID_KEY);l(),fetch(n,{method:a,headers:r,body:c||null}).then(function(d){return B.processResponseByType(d)}).then(function(d){u(d,t,o,s)}).catch(function(d){s(ee.CONNECTION_FAILED),console.error(d)})}}]),e}(),Zn=function(){function e(){g(this,e)}return y(e,null,[{key:"getCharacterLimitMessages",value:function(t,n){var r;if(n===-1)return t;var a=0,o=t.length-1;for(o;o>=0;o-=1){var s=(r=t[o])==null?void 0:r.text;if(s!==void 0&&(a+=s.length,a>n)){t[o].text=s.substring(0,s.length-(a-n));break}}return t.slice(Math.max(o,0))}},{key:"getMaxMessages",value:function(t,n){return t.slice(Math.max(t.length-n,0))}},{key:"processMessages",value:function(t,n,r){return n!==void 0?n>0&&(t=e.getMaxMessages(t,n)):t=[t[t.length-1]],t=JSON.parse(JSON.stringify(t)),r===void 0?t:e.getCharacterLimitMessages(t,r)}}]),e}(),fu=function(){function e(){g(this,e)}return y(e,null,[{key:"parseConfig",value:function(t,n,r,a){var o,s={files:n};if(R(a)=="object"){var l=a.files,u=a.request,c=a.button;l&&(l.infoModal&&(s.files.infoModal=l.infoModal,(o=l.infoModal)!=null&&o.textMarkDown&&(s.infoModalTextMarkUp=r.render(l.infoModal.textMarkDown))),l.acceptedFormats&&(s.files.acceptedFormats=l.acceptedFormats),l.maxNumberOfFiles&&(s.files.maxNumberOfFiles=l.maxNumberOfFiles)),s.button=c,u&&(u.headers||u.method||u.url||u.credentials||t.headers||t.method||t.url||t.credentials)&&(s.request={url:(u==null?void 0:u.url)||t.url,method:(u==null?void 0:u.method)||t.method,headers:(u==null?void 0:u.headers)||t.headers,credentials:(u==null?void 0:u.credentials)||t.credentials})}return s}},{key:"processMixedFiles",value:function(t,n,r){if(r){var a={acceptedFormats:""};t.fileTypes.mixedFiles=e.parseConfig(t.requestSettings,a,n,r)}}},{key:"processMicrophone",value:function(t,n,r,a){var o,s,l,u,c,d,h,p,m=V({acceptedFormats:"audio/*"},((l=t.fileTypes.audio)==null?void 0:l.files)||{});r&&(navigator.mediaDevices.getUserMedia!==void 0?(t.recordAudio=e.parseConfig(t.requestSettings,m,
512n,r),R(r)=="object"&&r.files&&((o=(u=t.recordAudio).files)!==null&&o!==void 0||(u.files={}),t.recordAudio.files.format=(c=r.files)==null?void 0:c.format,t.recordAudio.files.maxDurationSeconds=(d=r.files)==null?void 0:d.maxDurationSeconds,(h=t.fileTypes.audio)!=null&&h.files&&((s=(p=t.fileTypes.audio.files).maxNumberOfFiles)!==null&&s!==void 0||(p.maxNumberOfFiles=r.files.maxNumberOfFiles)))):a||(t.fileTypes.audio=e.parseConfig(t.requestSettings,m,n,r)))}},{key:"processAudioConfig",value:function(t,n,r,a){if(!(!r&&!a)){var o=V({acceptedFormats:"audio/*"},(a==null?void 0:a.files)||{});t.fileTypes.audio=e.parseConfig(t.requestSettings,o,n,r)}}},{key:"processGifConfig",value:function(t,n,r,a){if(!(!r&&!a)){var o=V({acceptedFormats:"image/gif"},(a==null?void 0:a.files)||{});t.fileTypes.gifs=e.parseConfig(t.requestSettings,o,n,r)}}},{key:"processCamera",value:function(t,n,r,a){var o,s,l,u,c,d=V({acceptedFormats:"image/*"},((s=t.fileTypes.images)==null?void 0:s.files)||{});r&&(navigator.mediaDevices.getUserMedia!==void 0?(t.camera=e.parseConfig(t.requestSettings,d,n,r),R(r)=="object"&&(t.camera.modalContainerStyle=r.modalContainerStyle,r.files&&((o=(l=t.camera).files)!==null&&o!==void 0||(l.files={}),t.camera.files.format=(u=r.files)==null?void 0:u.format,t.camera.files.dimensions=(c=r.files)==null?void 0:c.dimensions))):a||(t.fileTypes.images=e.parseConfig(t.requestSettings,d,n,r)))}},{key:"processImagesConfig",value:function(t,n,r,a){if(!(!r&&!a)){var o=V({acceptedFormats:"image/*"},(a==null?void 0:a.files)||{});t.fileTypes.images=e.parseConfig(t.requestSettings,o,n,r)}}},{key:"populateDefaultFileIO",value:function(t,n){var r,a,o,s,l;t&&((r=t.files)!==null&&r!==void 0||(t.files={}),(a=(s=t.files).acceptedFormats)!==null&&a!==void 0||(s.acceptedFormats=n),(o=(l=t.files).maxNumberOfFiles)!==null&&o!==void 0||(l.maxNumberOfFiles=1))}},{key:"set",value:function(t,n,r){e.populateDefaultFileIO(r==null?void 0:r.audio,".4a,.mp3,.webm,.mp4,.mpga,.wav,.mpeg,.m4a"),e.populateDefaultFileIO(r==null?void 0:r.images,".png,.jpg");var a=In.createNew();e.processImagesConfig(n,a,t.images,r==null?void 0:r.images),e.processCamera(n,a,t.camera,t.images),e.processGifConfig(n,a,t.gifs,r==null?void 0:r.gifs),e.processAudioConfig(n,a,t.audio,r==null?void 0:r.audio),e.processMicrophone(n,a,t.microphone,t.audio),e.processMixedFiles(n,a,t.mixedFiles)}}]),e}(),Tt=function(){function e(i,t,n){var r;g(this,e);var a,o,s,l;this.rawBody={},this.validateConfigKey=!1,this.canSendMessage=e.canSendMessage,this.requestSettings={},this.fileTypes={},this.completionsHandlers={},this.streamHandlers={},this.deepChat=i,this.demo=n,Object.assign(this.rawBody,(a=i.request)==null?void 0:a.additionalBodyProps),this.totalMessagesMaxCharLength=(o=i==null?void 0:i.requestBodyLimits)==null?void 0:o.totalMessagesMaxCharLength,this.maxMessages=(s=i==null?void 0:i.requestBodyLimits)==null?void 0:s.maxMessages,fu.set(i,this,t),i.request&&(this.requestSettings=i.request),this.demo&&((r=(l=this.requestSettings).url)!==null&&r!==void 0||(l.url=Se.URL)),this.requestSettings.websocket&&lt.setup(this)}return y(e,[{key:"verifyKey",value:function(t,n){}},{key:"getServiceIOByType",value:function(t){if(t.type.startsWith("audio")&&this.fileTypes.audio)return this.fileTypes.audio;if(t.type.startsWith("image")){if(this.fileTypes.gifs&&t.type.endsWith("/gif"))return this.fileTypes.gifs;if(this.fileTypes.images)return this.fileTypes.images;if(this.camera)return this.camera}return this.fileTypes.mixedFiles}},{key:"request",value:function(){var i=k(f().mark(function n(r,a){var o,s,l=arguments;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return o=l.length>2&&l[2]!==void 0?l[2]:!0,s=this.deepChat.stream,c.abrupt("return",s&&!re.isSimulation(s)?re.request(this,r,a):J.request(this,r,a,o));case 3:case"end":return c.stop()}},n,this)}));function t(n,r){return i.apply(this,arguments)}return t}()},{key:"callAPIWithText",value:function(){var i=k(f().mark(function n(r,a){var o,s,l,u,c,d,h,p;return f().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return h=V({messages:a},this.rawBody),p=!1,(l=this.requestSettings.headers)!=null&&l["Content-Type"]||((o=(u=this.requestSettings).headers)!==null&&o!==void 0||(u.headers={}),(s=(c=this.requestSettings.headers)["Content-Type"])!==null&&s!==void 0||(c["Content-Type"]="application/json"),p=!0),v.next=5,this.request(h,r);case 5:p&&((d=this.requestSettings.headers)==null||delete d["Content-Type"]);case 6:case"end":return v.stop()}},n,this)}));function t(n,r){return i.apply(this,arguments)}return t}()},{key:"callApiWithFiles",value:function(){var i=k(f().mark(function n(r,a,o){var s,l,u;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return s=e.createCustomFormDataBody(this.rawBody,a,o),l=this.requestSettings,u=this.getServiceIOByType(o[0]),this.requestSettings=(u==null?void 0:u.request)||this.requestSettings,d.next=4,this.request(s,r,!1);case 4:this.requestSettings=l;case 5:case"end":return d.stop()}},n,this)}));function t(n,r,a){return i.apply(this,arguments)}return t}()},{key:"callServiceAPI",value:function(){var i=k(f().mark(function n(r,a,o){return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:o?this.callApiWithFiles(r,a,o):this.callAPIWithText(r,a);case 1:case"end":return l.stop()}},n,this)}));function t(n,r,a){return i.apply(this,arguments)}return t}()},{key:"callAPI",value:function(){var i=k(f().mark(function n(r,a){var o,s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(this.requestSettings){u.next=2;break}throw new Error("Request settings have not been set up");case 2:o=Zn.processMessages(a.messages,this.maxMessages,this.totalMessagesMaxCharLength),this.requestSettings.websocket?(s=V({messages:o},this.rawBody),lt.sendWebsocket(this,s,a,!1)):this.callServiceAPI(a,o,r.files);case 4:case"end":return u.stop()}},n,this)}));function t(n,r){return i.apply(this,arguments)}return t}()},{key:"extractResultData",value:function(){var i=k(f().mark(function n(r){return f().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(!r.error){o.next=2;break}throw r.error;case 2:if(!r.result){o.next=4;break}return o.abrupt("return",Re.handleResponseProperty(r));case 4:if(!B.validateResponseFormat(r)){o.next=6;break}return o.abrupt("return",r);case 6:case"end":return o.stop()}},n)}));function t(n){return i.apply(this,arguments)}return t}()},{key:"isDirectConnection",value:function(){return!1}},{key:"isWebModel",value:function(){return!1}}],[{key:"canSendMessage",value:function(t,n,r){return r?!0:!!(t&&t.trim()!=="")||!!(n&&n.length>0)}},{key:"createCustomFormDataBody",value:function(t,n,r){var a=new FormData;r.forEach(function(l){return a.append("files",l)}),Object.keys(t).forEach(function(l){return a.append(l,String(t[l]))});var o=0;
512n.slice(0,n.length-1).forEach(function(l){a.append("message".concat(o+=1),JSON.stringify(l))});var s=n[n.length-1];return s.text&&(delete s.files,a.append("message".concat(o+=1),JSON.stringify(s))),a}}]),e}(),ce=function(e){P(i,e);function i(t,n,r,a,o){var s;g(this,i);var l;return s=O(this,i,[t,o]),s.insertKeyPlaceholderText="API Key",s.keyHelpUrl="",Object.assign(s.rawBody,(l=t.request)==null?void 0:l.additionalBodyProps),s.keyVerificationDetails=n,s.buildHeadersFunc=r,a&&s.setApiKeyProperties(a),s.requestSettings=s.buildRequestSettings(s.key||"",t.request),s}return y(i,[{key:"setApiKeyProperties",value:function(n){this.key=n.key,n.validateKeyProperty&&(this.validateConfigKey=n.validateKeyProperty)}},{key:"buildRequestSettings",value:function(n,r){var a,o=r??{};return(a=o.headers)!==null&&a!==void 0||(o.headers={}),Object.assign(o.headers,this.buildHeadersFunc(n)),o}},{key:"keyAuthenticated",value:function(n,r){this.requestSettings=this.buildRequestSettings(r,this.requestSettings),this.key=r,n()}},{key:"verifyKey",value:function(n,r){var a=this.keyVerificationDetails,o=a.url,s=a.method,l=a.handleVerificationResult,u=a.createHeaders,c=a.body,d=(u==null?void 0:u(n))||this.buildHeadersFunc(n);J.verifyKey(n,o,d,s,this.keyAuthenticated.bind(this,r.onSuccess),r.onFail,r.onLoad,l,c)}},{key:"isDirectConnection",value:function(){return!0}}]),i}(Tt),mu=function(){function e(){g(this,e)}return y(e,null,[{key:"waitForPropertiesToBeUpdatedBeforeRender",value:function(t){t._propUpdated_=!1,setTimeout(function(){t._propUpdated_?e.waitForPropertiesToBeUpdatedBeforeRender(t):(t._waitingToRender_=!1,t.onRender())})}},{key:"attemptRender",value:function(t){t._propUpdated_=!0,t._waitingToRender_||(t._waitingToRender_=!0,e.waitForPropertiesToBeUpdatedBeforeRender(t))}}]),e}(),Xn=function(e){P(i,e);function i(){var t;return g(this,i),t=O(this,i),t._waitingToRender_=!1,t._propUpdated_=!1,Object.keys(i._attributeToProperty_).forEach(function(n){var r=i._attributeToProperty_[n];t.constructPropertyAccessors(r),t.hasOwnProperty(n)||t.constructPropertyAccessors(r,n)}),t}return y(i,[{key:"constructPropertyAccessors",value:function(n,r){var a;Object.defineProperty(this,r||n,{get:function(){return a}
512,set:function(s){a=s,r?this[n]=s:mu.attemptRender(this)}})}},{key:"attributeChangedCallback",value:function(n,r,a){if(r!==a){var o=i._attributes_[n](a),s=i._attributeToProperty_[n];this[s]=o}}},{key:"onRender",value:function(){}}],[{key:"observedAttributes",get:function(){return Object.keys(i._attributes_)||[]}}]),i}(En(HTMLElement));Xn._attributes_={};Xn._attributeToProperty_={};var vu=Xn,gu=`<?xml version="1.0" standalone="no"?>
513<svg version="1.1"
514	xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
515	xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0.9em" height="0.9em"
516	viewBox="0 0 1200 1200" enable-background="new 0 0 1200 1200">
517		<path d="
518			M669.727,273.516c-22.891-2.476-46.15-3.895-69.727-4.248c-103.025,0.457-209.823,25.517-310.913,73.536
519			c-75.058,37.122-148.173,89.529-211.67,154.174C46.232,529.978,6.431,577.76,0,628.74c0.76,44.162,48.153,98.67,77.417,131.764
520			c59.543,62.106,130.754,113.013,211.67,154.174c2.75,1.335,5.51,2.654,8.276,3.955l-75.072,131.102l102.005,60.286l551.416-960.033
521			l-98.186-60.008L669.727,273.516z M902.563,338.995l-74.927,129.857c34.47,44.782,54.932,100.006,54.932,159.888
522			c0,149.257-126.522,270.264-282.642,270.264c-6.749,0-13.29-0.728-19.922-1.172l-49.585,85.84c22.868,2.449,45.99,4.233,69.58,4.541
523			c103.123-0.463,209.861-25.812,310.84-73.535c75.058-37.122,148.246-89.529,211.743-154.174
524			c31.186-32.999,70.985-80.782,77.417-131.764c-0.76-44.161-48.153-98.669-77.417-131.763
525			c-59.543-62.106-130.827-113.013-211.743-154.175C908.108,341.478,905.312,340.287,902.563,338.995L902.563,338.995z
526			M599.927,358.478c6.846,0,13.638,0.274,20.361,0.732l-58.081,100.561c-81.514,16.526-142.676,85.88-142.676,168.897
527			c0,20.854,3.841,40.819,10.913,59.325c0.008,0.021-0.008,0.053,0,0.074l-58.228,100.854
528			c-34.551-44.823-54.932-100.229-54.932-160.182C317.285,479.484,443.808,358.477,599.927,358.478L599.927,358.478z M768.896,570.513
529			L638.013,797.271c81.076-16.837,141.797-85.875,141.797-168.603C779.81,608.194,775.724,588.729,768.896,570.513L768.896,570.513z"
530			/>
531</svg>
532`,yu=`<?xml version="1.0" standalone="no"?>
533<svg version="1.1"
534	xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
535	xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="0.9em" height="0.9em"
536	viewBox="0 0 1200 1200" enable-background="new 0 0 1200 1200">
537		<path id="path6686" inkscape:connector-curvature="0" d="M779.843,599.925c0,95.331-80.664,172.612-180.169,172.612
538			c-99.504,0-180.168-77.281-180.168-172.612c0-95.332,80.664-172.612,180.168-172.612
539			C699.179,427.312,779.843,504.594,779.843,599.925z M600,240.521c-103.025,0.457-209.814,25.538-310.904,73.557
540			c-75.058,37.122-148.206,89.496-211.702,154.141C46.208,501.218,6.431,549,0,599.981c0.76,44.161,48.13,98.669,77.394,131.763
541			c59.543,62.106,130.786,113.018,211.702,154.179c94.271,45.751,198.616,72.092,310.904,73.557
542			c103.123-0.464,209.888-25.834,310.866-73.557c75.058-37.122,148.243-89.534,211.74-154.179
543			c31.185-32.999,70.962-80.782,77.394-131.763c-0.76-44.161-48.13-98.671-77.394-131.764
544			c-59.543-62.106-130.824-112.979-211.74-154.141C816.644,268.36,712.042,242.2,600,240.521z M599.924,329.769
545			c156.119,0,282.675,120.994,282.675,270.251c0,149.256-126.556,270.25-282.675,270.25S317.249,749.275,317.249,600.02
546			C317.249,450.763,443.805,329.769,599.924,329.769L599.924,329.769z"/>
547</svg>
548`,pe=function(){function e(){g(this,e)}return y(e,null,[{key:"createSVGElement",value:function(t){return new DOMParser().parseFromString(t,"image/svg+xml").documentElement}}]),e}(),Gi=function(){function e(){g(this,e)}return y(e,null,[{key:"changeVisibility",value:function(t,n,r,a){a.target.id===e.VISIBLE_ICON_ID?(n.style.display="none",r.style.display="block",t.type="password"):(n.style.display="block",r.style.display="none",t.type="text")}},{key:"createIconElement",value:function(t,n){var r=pe.createSVGElement(t);return r.id=n,r.classList.add("visibility-icon"),r}},{key:"create",value:function(t){var n=document.createElement("div");n.id="visibility-icon-container";var r=e.createIconElement(yu,e.VISIBLE_ICON_ID);r.style.display="none",n.appendChild(r);var a=e.createIconElement(gu,"not-visible-icon");return n.appendChild(a),n.onclick=e.changeVisibility.bind(this,t,r,a),n}}]),e}();Gi.VISIBLE_ICON_ID="visible-icon";var bu=Gi,ku=function(){function e(){g(this,e)}return y(e,null,[{key:"createCautionText",value:function(){var t=document.createElement("a");return t.classList.add("insert-key-input-help-text"),t.innerText="Please exercise CAUTION when inserting your API key outside of deepchat.dev or localhost!!",t}},{key:"createHelpLink",value:function(t){var n=document.createElement("a");return n.classList.add("insert-key-input-help-text"),n.href=t,n.innerText="Find more info here",n.target="_blank",n}},{key:"createFailText",value:function(){var t=document.createElement("div");return t.id="insert-key-input-invalid-text",t.style.display="none",t}},{key:"createHelpTextContainer",value:function(t){var n=arguments.length>
5481&&arguments[1]!==void 0?arguments[1]:!0,r=document.createElement("div");r.id="insert-key-help-text-container";var a=document.createElement("div");a.id="insert-key-help-text-contents";var o=e.createFailText();if(a.appendChild(o),t){var s=e.createHelpLink(t);a.appendChild(s)}if(n===!0){var l=e.createCautionText();a.appendChild(l)}return r.appendChild(a),{helpTextContainerElement:r,failTextElement:o}}},{key:"onFail",value:function(t,n,r,a){t.classList.replace("insert-key-input-valid","insert-key-input-invalid"),r.innerText=a,r.style.display="block",n.innerText="Start",t.classList.remove("loading")}},{key:"onLoad",value:function(t,n){t.classList.add("loading"),n.innerHTML='<div id="loading-ring"></div>'}},{key:"verifyKey",value:function(t,n,r){var a=t.value.trim();r.verifyKey(a,n)}},{key:"addVerificationEvents",value:function(t,n,r,a,o){var s={onSuccess:a,onFail:e.onFail.bind(this,t,n,r),onLoad:e.onLoad.bind(this,t,n)},l=e.verifyKey.bind(this,t,s,o);n.onclick=l,t.onkeydown=function(u){!t.classList.contains("loading")&&u.key===ne.ENTER&&l()}}},{key:"createStartButton",value:function(){var t=document.createElement("div");return t.id="start-button",t.innerText="Start",t}},{key:"onInputFocus",value:function(t){t.target.classList.replace("insert-key-input-invalid","insert-key-input-valid")}},{key:"createInput",value:function(t){var n=document.createElement("div");n.id="insert-key-input-container";var r=document.createElement("input");return r.id="insert-key-input",r.placeholder=t||"API Key",r.type="password",r.classList.add("insert-key-input-valid"),r.onfocus=e.onInputFocus,n.appendChild(r),n}},{key:"createContents",value:function(t,n){var r,a=document.createElement("div");a.id="insert-key-contents";var o=e.createInput(n.insertKeyPlaceholderText),s=o.children[0],l=bu.create(s);o.appendChild(l),a.appendChild(o);var u=e.createStartButton(),c=e.createHelpTextContainer(n.keyHelpUrl,(r=n.deepChat._insertKeyViewStyles)==null?void 0:r.displayCautionText),d=c.helpTextContainerElement,h=c.failTextElement;return a.appendChild(u),a.appendChild(d),e.addVerificationEvents(s,u,h,t,n),a}},{key:"createElements",value:function(t,n){var r=document.createElement("div");r.id="insert-key-view";var a=e.createContents(t,n);return r.appendChild(a),r}},{key:"render",value:function(t,n,r){var a=e.createElements(n,r);t.replaceChildren(a)}}]),e}(),ut=function(){function e(){g(this,e)}return y(e,null,[{key:"enableButtons",value:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;window.webLLM?(t&&(t.disabled=!1),n&&(n.disabled=!1)):r<Qn.MODULE_SEARCH_LIMIT_S*4&&setTimeout(function(){return e.enableButtons(t,n,r+1)},250)}},{key:"setUpInitial",value:function(t,n,r,a){var o=(n==null?void 0:n.downloadClass)||e.DOWNLOAD_BUTTON_CLASS,s=(n==null?void 0:n.uploadClass)||e.UPLOAD_BUTTON_CLASS,l=(n==null?void 0:n.fileInputClass)||e.FILE_INPUT_CLASS;return setTimeout(function(){var u=r==null?void 0:r.getElementsByClassName(o)[0],c=r==null?void 0:r.getElementsByClassName(l)[0],d=r==null?void 0:r.getElementsByClassName(s)[0];u&&(u.onclick=function(){return t()}),c&&(c.onchange=function(){c.files&&c.files.length>0&&t(c.files)}),d&&(d.onclick=function(){return c.click()}),(u||d)&&e.enableButtons(u,d)}),(n==null?void 0:n.initialHtml)||`<div>
549        Download or upload a web model that will run entirely on your browser: <br/> 
550        <button disabled class="`.concat(o,` deep-chat-button deep-chat-web-model-button">Download</button>
551        `).concat(a?"":'<input type="file" class="'.concat(l,`" hidden multiple />
552          <button disabled class="`).concat(s,' deep-chat-button deep-chat-web-model-button">Upload</button>'),`
553      </div>`)}},{key:"exportFile",value:function(t){for(var n=document.createElement("a"),r=4,a=function(l){setTimeout(function(){for(var u=l*r,c=u;c<Math.min(u+r,t.length);c+=1){var d=URL.createObjectURL(t[c]);n.href=d,n.download=t[c].name,document.body.appendChild(n),n.click(),URL.revokeObjectURL(d)}},500*l)},o=0;o<t.length/r;o+=1)a(o)}},{key:"setUpAfterLoad",value:function(t,n,r,a){var o=(n==null?void 0:n.exportFilesClass)||e.EXPORT_BUTTON_CLASS;return setTimeout(function(){var s=r==null?void 0:r.getElementsByClassName(o)[
5530];s&&(s.onclick=function(){return e.exportFile(t)})}),(n==null?void 0:n.afterLoadHtml)||`<div>
554        Model loaded successfully and has been cached for future requests.
555        `.concat(a?"":'<br/> <button style="margin-top: 5px" class="'.concat(o,' deep-chat-button">Export</button>'),`
556      </div>`)}}]),e}();ut.DOWNLOAD_BUTTON_CLASS="deep-chat-download-button";ut.UPLOAD_BUTTON_CLASS="deep-chat-upload-button";ut.FILE_INPUT_CLASS="deep-chat-file-input";ut.EXPORT_BUTTON_CLASS="deep-chat-export-button";var Nr=ut,Dr={model_list:[{model_url:"https://huggingface.co/mlc-ai/Llama-2-7b-chat-hf-q4f32_1-MLC/resolve/main/",local_id:"Llama-2-7b-chat-hf-q4f32_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-7b-chat-hf/Llama-2-7b-chat-hf-q4f32_1-ctx4k_cs1k-webgpu.wasm",vram_required_MB:9109.03,low_resource_required:!1},{model_url:"https://huggingface.co/mlc-ai/Llama-2-7b-chat-hf-q4f16_1-MLC/resolve/main/",local_id:"Llama-2-7b-chat-hf-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-7b-chat-hf/Llama-2-7b-chat-hf-q4f16_1-ctx4k_cs1k-webgpu.wasm",vram_required_MB:6749.02,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/Llama-2-7b-chat-hf-q4f16_1-MLC/resolve/main/",local_id:"Llama-2-7b-chat-hf-q4f16_1-1k",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-7b-chat-hf/Llama-2-7b-chat-hf-q4f16_1-ctx1k-webgpu.wasm",vram_required_MB:4618.52,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/Llama-2-13b-chat-hf-q4f16_1-MLC/resolve/main/",local_id:"Llama-2-13b-chat-hf-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-13b-chat-hf/Llama-2-13b-chat-hf-q4f16_1-ctx4k_cs1k-webgpu.wasm",vram_required_MB:11814.09,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/Llama-2-70b-chat-hf-q4f16_1-MLC/resolve/main/",local_id:"Llama-2-70b-chat-hf-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-70b-chat-hf/Llama-2-70b-chat-hf-q4f16_1-ctx4k_cs1k-webgpu.wasm",vram_required_MB:43729.05,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f16_1-MLC/resolve/main/",local_id:"RedPajama-INCITE-Chat-3B-v1-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f16_1-ctx2k-webgpu.wasm",vram_required_MB:2972.09,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f32_1-MLC/resolve/main/",local_id:"RedPajama-INCITE-Chat-3B-v1-q4f32_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f32_1-ctx2k-webgpu.wasm",vram_required_MB:3928.09,low_resource_required:!1},{model_url:"https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f16_1-MLC/resolve/main/",local_id:"RedPajama-INCITE-Chat-3B-v1-q4f16_1-1k",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f16_1-ctx1k-webgpu.wasm",vram_required_MB:2041.09,low_resource_required:!0,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f32_1-MLC/resolve/main/",local_id:"RedPajama-INCITE-Chat-3B-v1-q4f32_1-1k",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f32_1-ctx1k-webgpu.wasm",vram_required_MB:2558.09,low_resource_required:!0},{model_url:"https://huggingface.co/mlc-ai/WizardMath-7B-V1.1-q4f16_1-MLC/resolve/main/",local_id:"WizardMath-7B-V1.1-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",vram_required_MB:6079.02,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/Mistral-7B-Instruct-v0.2-q4f16_1-MLC/resolve/main/",local_id:"Mistral-7B-Instruct-v0.2-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",vram_required_MB:6079.02,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/OpenHermes-2.5-Mistral-7B-q4f16_1-MLC/resolve/main/",local_id:"OpenHermes-2.5-Mistral-7B-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",vram_required_MB:6079.02,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/NeuralHermes-2.5-Mistral-7B-q4f16_1-MLC/resolve/main/",local_id:"NeuralHermes-2.5-Mistral-7B-q4f16_1",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",vram_required_MB:6079.02,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q0f16-MLC/resolve/main/",local_id:"TinyLlama-1.1B-Chat-v0.4-q0f16",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q0f16-ctx2k-webgpu.wasm",vram_required_MB:5063.52,low_resource_required:!1,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q0f32-MLC/resolve/main/",local_id:"TinyLlama-1.1B-Chat-v0.4-q0f32",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q0f32-ctx2k-webgpu.wasm",vram_required_MB:5394.53,low_resource_required:!1},{model_url:"https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q4f16_1-MLC/resolve/main/",local_id:"TinyLlama-1.1B-Chat-v0.4-q4f16_1-1k",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q4f16_1-ctx1k-webgpu.wasm",vram_required_MB:899.11,low_resource_required:!0,required_features:["shader-f16"]},{model_url:"https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q4f32_1-MLC/resolve/main/",local_id:"TinyLlama-1.1B-Chat-v0.4-q4f32_1-1k",model_lib_url:"https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q4f32_1-ctx1k-webgpu.wasm",vram_required_MB:992.11,low_resource_required:!0}],use_web_worker:!0},Ze=function(e){P(i,e);function i(t){var n;g(this,i);var r,a;return n=O(this,i,[t]),n._isModelLoaded=!1,n._isModelLoading=!1,n._loadOnFirstMessage=!1,n._webModel={}
556,n.permittedErrorPrefixes=[i.MULTIPLE_MODELS_ERROR,i.WEB_LLM_NOT_FOUND_ERROR,i.GENERIC_ERROR],n._conversationHistory=[],R(t.webModel)=="object"&&(n._webModel=t.webModel),(r=n._webModel.load)!=null&&r.clearCache&&i.clearAllCache(),n.findModelInWindow(t),n.canSendMessage=n.canSubmit.bind(de(n)),n._chatEl=(a=t.shadowRoot)==null?void 0:a.children[0],t.initialMessages&&i.setUpHistory(n._conversationHistory,t.initialMessages),n}return y(i,[{key:"setUpMessages",value:function(n){var r=this;this._messages=n,this._removeIntro=function(){n.removeIntroductoryMessage(),r._removeIntro=void 0}}},{key:"findModelInWindow",value:function(n){var r=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o;window.webLLM?this.configureInit(this.shouldAddInitialMessage(n.introMessage)):a>i.MODULE_SEARCH_LIMIT_S?((o=this._messages)==null||o.addNewErrorMessage("service",i.WEB_LLM_NOT_FOUND_ERROR),console.error("The deep-chat-web-llm module has not been attached to the window object. Please see the following guide:"),console.error("https://deepchat.dev/examples/externalModules")):setTimeout(function(){return r.findModelInWindow(n,a+1)},1e3)}},{key:"shouldAddInitialMessage",value:function(n){var r;return!n&&this._webModel&&((r=this._webModel.introMessage)==null?void 0:r.displayed)!==!1}},{key:"scrollToTop",value:function(n){var r=this,a;((a=this._webModel.introMessage)==null?void 0:a.autoScroll)!==!1&&setTimeout(function(){var o,s;(o=r._messages)!=null&&o.elementRef&&he.scrollToTop((s=r._messages)==null?void 0:s.elementRef)},n)}},{key:"getIntroMessage",value:function(n){if(!(!this.shouldAddInitialMessage(n)||!this._chatEl)){var r=Nr.setUpInitial(this.init.bind(this),this._webModel.introMessage,this._chatEl,!!this._webModel.worker);return this.scrollToTop(1),{role:F.AI_ROLE,html:r,sendUpdate:!1}}}},{key:"configureInit",value:function(){var t=k(f().mark(function r(a){var o;return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(o=this._webModel.load,!o){l.next=8;break}if(!o.onInit){l.next=5;break}return this.init(),l.abrupt("return");case 5:if(!o.onMessage){l.next=8;break}return this._loadOnFirstMessage=!0,l.abrupt("return");case 8:a||this.init();case 9:case"end":return l.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"init",value:function(){var t=k(f().mark(function r(a){var o,s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if((o=this._messages)==null||o.removeError(),s=this.attemptToCreateChat(),u.t0=s,!u.t0){u.next=6;break}return u.next=6,this.loadModel(s,a);case 6:case"end":return u.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"attemptToCreateChat",value:function(){var n;if(i.chat){(n=this._messages)==null||n.addNewErrorMessage("service",i.MULTIPLE_MODELS_ERROR),console.error(i.MULTIPLE_MODELS_ERROR);return}if(!(this._isModelLoaded||this._isModelLoading)){var r=this._webModel.worker;return Dr.use_web_worker&&r?new window.webLLM.ChatWorkerClient(r):new window.webLLM.ChatModule}}},{key:"getConfig",value:function(){var n,r=i.DEFAULT_MODEL;this._webModel.model&&(r=this._webModel.model);var a=JSON.parse(JSON.stringify(Dr));if(this._webModel.urls){var o=a.model_list.find(function(s){return s.local_id=r});o&&(this._webModel.urls.model&&(o.model_url=this._webModel.urls.model),this._webModel.urls.wasm&&(o.model_lib_url=this._webModel.urls.wasm))}return(n=this._webModel.load)!=null&&n.skipCache&&(a.use_cache=!1),{model:r,appConfig:a}}},{key:"loadModel",value:function(){var t=k(f().mark(function r(a,o){var s=this,l,u,c,d,h,p,m,v,b,w,_,x,N,M,j;return f().wrap(function(H){for(;;)switch(H.prev=H.next){case 0:return this.scrollToTop(),i.chat=a,this._isModelLoading=!0,v=((l=this._webModel.introMessage)==null?void 0:l.displayed)===!1,b=function(te){var X;(X=s._messages)==null||X.addNewMessage({html:"<div>".concat(te.text,"</div>"),overwrite:!0,sendUpdate:!1}),v&&(setTimeout(function(){var G;return he.scrollToBottom((G=s._messages)==null?void 0:G.elementRef)}),v=!1)},i.chat.setInitProgressCallback(b),H.prev=4,_=this.getConfig(),x=_.model,N=_.appConfig,M={},this._webModel.instruction&&(M.conv_config={system:this._webModel.instruction}),this._conversationHistory.length>0&&(M.conversation_history=this._conversationHistory),H.next=10,i.chat.reload(x,M,N,o);case 10:w=H.sent,H.next=16;break;case 13:return H.prev=13,H.t0=H.catch(4),H.abrupt("return",this.unloadChat(H.t0));case 16:(c=(u=this.deepChat)._validationHandler)==null||c.call(u),(d=this._webModel.introMessage)!=null&&d.removeAfterLoad?this._webModel.introMessage.displayed===!1?(p=this._messages)==null||p.removeLastMessage():(m=this._removeIntro)==null||m.call(this):(j=Nr.setUpAfterLoad(w,this._webModel.introMessage,this._chatEl,!!this._webModel.worker),(h=this._messages)==null||h.addNewMessage({html:j,overwrite:!0,sendUpdate:!1})),this._isModelLoaded=!0,this._isModelLoading=!1;case 18:case"end":return H.stop()}}
556,r,this,[[4,13]])}));function n(r,a){return t.apply(this,arguments)}return n}()},{key:"unloadChat",value:function(){var t=k(f().mark(function r(a){var o;return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if((o=this._messages)==null||o.addNewErrorMessage("service",i.GENERIC_ERROR),console.error(a),this._isModelLoaded=!1,this._isModelLoading=!1,l.t0=i.chat,!l.t0){l.next=9;break}return l.next=8,i.chat.unload();case 8:i.chat=void 0;case 9:case"end":return l.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"immediateResp",value:function(){var t=k(f().mark(function r(a,o,s){var l,u;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.next=2,s.generate(o,void 0,0);case 2:return d.t0=d.sent,l={text:d.t0},d.next=6,i.processResponse(this.deepChat,a,l);case 6:u=d.sent,u&&a.addNewMessage(u),this.completionsHandlers.onFinish();case 8:case"end":return d.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"streamResp",value:function(){var t=k(f().mark(function r(a,o,s){var l=this,u;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return this.streamHandlers.abortStream.abort=function(){s.interruptGenerate()},this.streamHandlers.onOpen(),u=new Pe(a),d.next=4,s.generate(o,function(){var h=k(f().mark(function p(m,v){var b;return f().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return _.next=2,i.processResponse(l.deepChat,a,{text:v});case 2:b=_.sent,b&&u.upsertStreamedMessage({text:b.text,overwrite:!0});case 4:case"end":return _.stop()}},p)}));return function(p,m){return h.apply(this,arguments)}}());case 4:u.finaliseStreamedMessage(),this.streamHandlers.onClose();case 6:case"end":return d.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"generateRespByType",value:function(){var t=k(f().mark(function r(a,o,s,l){var u;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(d.prev=0,!s){d.next=6;break}return d.next=4,this.streamResp(a,o,l);case 4:d.next=8;break;case 6:return d.next=8,this.immediateResp(a,o,l);case 8:d.next=13;break;case 10:d.prev=10,d.t0=d.catch(0),(u=this._messages)==null||u.addNewErrorMessage("service"),console.log(d.t0);case 13:case"end":return d.stop()}},r,this,[[0,10]])}));function n(r,a,o,s){return t.apply(this,arguments)}return n}()},{key:"generateResp",value:function(){var t=k(f().mark(function r(a,o,s){var l,u,c,d,h,p,m;return f().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return l=o[o.length-1].text,b.next=3,B.processRequestInterceptor(this.deepChat,{body:{text:l}});case 3:u=b.sent,c=u.body,d=u.error,h=!!this.deepChat.stream;try{d?(B.displayError(a,new Error(d)),(h?this.streamHandlers.onClose:this.completionsHandlers.onFinish)()):!c||!c.text?(p=ee.INVALID_MODEL_REQUEST({body:c},!1),console.error(p),m=h?this.streamHandlers.onClose:this.completionsHandlers.onFinish,B.onInterceptorError(a,p,m)):this.generateRespByType(a,c.text,!!this.deepChat.stream,s)}catch(w){this.unloadChat(w)}case 8:case"end":return b.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o){var s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(this._isModelLoaded){c.next=7;break}if(!this._loadOnFirstMessage){c.next=6;break}return c.next=4,this.init();case 4:c.next=7;break;case 6:return c.abrupt("return");case 7:!i.chat||this._isModelLoading||((s=this._webModel.introMessage)!=null&&s.removeAfterMessage&&((l=this._removeIntro)==null||l.call(this)),a.addLoadingMessage(),this.generateResp(a,o,i.chat));case 8:case"end":return c.stop()}},r,this)}));function n(r,a){return t.apply(this,arguments)}return n}()},{key:"canSubmit",value:function(n){return!(n!=null&&n.trim())||this._isModelLoading?!1:this._loadOnFirstMessage?!0:!!this._isModelLoaded}},{key:"isWebModel",value:function(){return!0}}],[{key:"setUpHistory",value:function(n,r){r.forEach(function(a,o){if(a.role===F.USER_ROLE&&a.text){var s=r[o+1];s!=null&&s.text&&s.role!==F.USER_ROLE&&n.push([a.text,s.text])}})}},{key:"processResponse",value:function(){var t=k(f().mark(function r(a,o,s){var l,u,c;return f().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,(l=a.responseInterceptor)==null?void 0:l.call(a,s);case 2:if(h.t0=h.sent,h.t0){h.next=5;break}h.t0=s;case 5:if(u=h.t0,!u.error){h.next=11;break}return B.displayError(o,new Error(u.error)),h.abrupt("return");case 11:if(!(!u||!u.text)){h.next=15;break}return c=ee.INVALID_MODEL_RESPONSE(s,!!a.responseInterceptor,u),B.displayError(o,new Error(c)),h.abrupt("return");case 15:return h.abrupt("return",u);case 16:case"end":return h.stop()}},r)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"clearAllCache",value:function(){i.clearCache("webllm/model"),i.clearCache("webllm/wasm")}},{key:"clearCache",value:function(n){caches.open(n).then(function(r){r.keys().then(function(a){a.forEach(function(o){r.delete(o)})})})}}]),i}(Tt);Ze.GENERIC_ERROR="Error, please check the [troubleshooting](https://deepchat.dev/docs/webModel#troubleshooting) section of documentation for help.";
556Ze.MULTIPLE_MODELS_ERROR="Cannot run multiple web models";Ze.WEB_LLM_NOT_FOUND_ERROR="WebLLM module not found";Ze.DEFAULT_MODEL="Llama-2-7b-chat-hf-q4f32_1";Ze.MODULE_SEARCH_LIMIT_S=5;var Qn=Ze,Fr=function(){function e(){g(this,e)}return y(e,null,[{key:"buildHeaders",value:function(t){return{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"}}},{key:"handleVerificationResult",value:function(t,n,r,a){var o=t;Array.isArray(o.error)&&o.error[0]==="Error in `parameters`: field required"?r(n):a(ee.INVALID_KEY)}},{key:"buildKeyVerificationDetails",value:function(){return{url:"https://api-inference.huggingface.co/models/gpt2",method:"POST",handleVerificationResult:e.handleVerificationResult}}}]),e}(),Wi=function(e){P(i,e);function i(t,n,r,a,o,s){var l;return g(this,i),l=O(this,i,[t,Fr.buildKeyVerificationDetails(),Fr.buildHeaders,o,s]),l.insertKeyPlaceholderText="Hugging Face Token",l.keyHelpUrl="https://huggingface.co/settings/tokens",l.introPanelMarkUp=`
557    <div style="width: 100%; text-align: center; margin-left: -10px"><b>Hugging Face</b></div>
558    <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>`,l.permittedErrorPrefixes=["Authorization header"],l.url="".concat(i.URL_PREFIX).concat(r),l.textInputPlaceholderText=n,R(a)=="object"&&(a.model&&(l.url="".concat(i.URL_PREFIX).concat(a.model)),a.options&&(l.rawBody.options=a.options),a.parameters&&(l.rawBody.parameters=a.parameters)),l}return y(i,[{key:"preprocessBody",value:function(n,r,a){var o,s=JSON.parse(JSON.stringify(n)),l=r[r.length-1].text;if(l)return(o=s.options)!==null&&o!==void 0||(s.options={}),s.options.wait_for_model=!0,V({inputs:l},s)}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o,s){var l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(this.requestSettings){c.next=2;break}throw new Error("Request settings have not been set up");case 2:l=this.preprocessBody(this.rawBody,o,s),J.request(this,l,a);case 4:case"end":return c.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()}]),i}(ce);Wi.URL_PREFIX="https://api-inference.huggingface.co/models/";var ze=Wi,er=function(e){P(i,e);function i(t,n,r,a,o,s){var l;return g(this,i),l=O(this,i,[t,n,r,a,o,s]),l.isTextInputDisabled=!0,l.canSendMessage=i.canSendFile,l}return y(i,[{key:"preprocessBody",value:function(n,r,a){return a[0]}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o,s){return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(this.requestSettings){u.next=2;break}throw new Error("Request settings have not been set up");case 2:if(s!=null&&s[0]){u.next=4;break}throw new Error("No file was added");case 4:J.poll(this,s[0],a,!1);case 5:case"end":return u.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()}],[{key:"canSendFile",value:function(n,r){return!!(r!=null&&r[0])}}]),i}(ze),_u=function(e){P(i,e);function i(t){g(this,i);var n,r,a,o=(r=(n=t.directConnection)==null?void 0:n.huggingFace)==null?void 0:r.audioClassification,s=(a=t.directConnection)==null?void 0:a.huggingFace;return O(this,i,[t,"Attach an audio file","ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition",o,s,{audio:{}}])}return y(i,[{key:"extractPollResultData",value:function(){var t=k(f().mark(function r(a){var o;return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(!a.estimated_time){l.next=2;break}return l.abrupt("return",{timeoutMS:(a.estimated_time+1)*1e3});case 2:if(!a.error){l.next=4;break}throw a.error;case 4:return l.abrupt("return",{text:((o=a[0])==null?void 0:o.label)||""});case 5:case"end":return l.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(er),wu=function(e){P(i,e);function i(t){g(this,i);var n,r,a,o=(r=(n=t.directConnection)==null?void 0:n.huggingFace)==null?void 0:r.imageClassification,s=(a=t.directConnection)==null?void 0:a.huggingFace;return O(this,i,[t,"Attach an image file","google/vit-base-patch16-224",o,s,{images:{}}])}return y(i,[{key:"extractPollResultData",value:function(){var t=k(f().mark(function r(a){var o;return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(!a.estimated_time){l.next=2;break}return l.abrupt("return",{timeoutMS:(a.estimated_time+1)*1e3});case 2:if(!a.error){l.next=4;break}throw a.error;case 4:return l.abrupt("return",{text:((o=a[0])==null?void 0:o.label)||""});case 5:case"end":return l.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(er),ct="data:image/png;base64,",Ee=function(){function e(){g(this,e)}return y(e,null,[{key:"buildHeaders",value:function(t){return{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"}}},{key:"handleVerificationResult",value:function(t,n,r,a){t.message?a(ee.INVALID_KEY):r(n)}}
558,{key:"buildKeyVerificationDetails",value:function(){return{url:"https://api.stability.ai/v1/engines/list",method:"GET",handleVerificationResult:e.handleVerificationResult}}}]),e}(),qt=function(e){P(i,e);function i(t,n,r,a,o){var s;return g(this,i),s=O(this,i,[t,n,r,a,o]),s.insertKeyPlaceholderText="Stability AI API Key",s.keyHelpUrl="https://platform.stability.ai/docs/getting-started/authentication",s.permittedErrorPrefixes=["Incorrect","invalid_"],s}return y(i)}(ce),Su=function(e){P(i,e);function i(t){var n;g(this,i);var r,a=JSON.parse(JSON.stringify(t.directConnection)),o=a==null?void 0:a.stabilityAI,s={images:{files:{acceptedFormats:".png",maxNumberOfFiles:1}}};n=O(this,i,[t,Ee.buildKeyVerificationDetails(),Ee.buildHeaders,o,s]),n.url="https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale",n.textInputPlaceholderText="Describe image changes",n.introPanelMarkUp=`
559    <div style="width: 100%; text-align: center; margin-left: -10px"><b>Stability AI</b></div>
560    <div style="width: 100%; text-align: center; margin-left: -10px; margin-top: 5px"><b>Image to Image Upscale</b></div>
561    <p>Upload an image to generate a new one with higher resolution.</p>
562    <p>Click <a href="https://platform.stability.ai/">here</a> for more info.</p>`;var l=(r=a==null?void 0:a.stabilityAI)==null?void 0:r.imageToImageUpscale;return R(l)=="object"&&(l.engine_id&&(n.url="https://api.stability.ai/v1/generation/".concat(l.engine_id,"/image-to-image/upscale")),i.cleanConfig(l),Object.assign(n.rawBody,l)),n.canSendMessage=i.canSendFileMessage,n}return y(i,[{key:"createFormDataBody",value:function(n,r){var a=new FormData;return a.append("image",r),Object.keys(n).forEach(function(o){a.append(o,String(n[o]))}),a}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o,s){var l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(this.requestSettings){c.next=2;break}throw new Error("Request settings have not been set up");case 2:if(s){c.next=4;break}throw new Error("Image was not found");case 4:l=this.createFormDataBody(this.rawBody,s[0]),B.tempRemoveContentHeader(this.requestSettings,J.request.bind(this,this,l,a),!1);case 6:case"end":return c.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.message){s.next=2;break}throw a.message;case 2:return s.abrupt("return",{files:a.artifacts.map(function(l){return{src:"".concat(ct).concat(l.base64),type:"image"}})});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}],[{key:"cleanConfig",value:function(n){delete n.engine_id}},{key:"canSendFileMessage",value:function(n,r){return!!(r!=null&&r[0])}}]),i}(qt),xu=function(e){P(i,e);function i(t){var n;g(this,i);var r,a=JSON.parse(JSON.stringify(t.directConnection)),o=a==null?void 0:a.stabilityAI,s={images:{files:{acceptedFormats:".png",maxNumberOfFiles:2}}};n=O(this,i,[t,Ee.buildKeyVerificationDetails(),Ee.buildHeaders,o,s]),n.url="https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking",n._maskSource="MASK_IMAGE_WHITE",n.textInputPlaceholderText="Describe image changes",n.introPanelMarkUp=`
563    <div style="width: 100%; text-align: center; margin-left: -10px"><b>Stability AI</b></div>
564    <div style="width: 100%; text-align: center; margin-left: -10px; margin-top: 5px"><b>Image to Image Masking</b></div>
565    <p>Upload an image, its mask image to create a new one based on the changes you have described for the mask area.</p>
566    <p>Click <a href="https://platform.stability.ai/">here</a> for more info.</p>`;var l=(r=a==null?void 0:a.stabilityAI)==null?void 0:r.imageToImageMasking;return R(l)=="object"&&(l.engine_id&&(n.url="https://api.stability.ai/v1/generation/".concat(l.engine_id,"/image-to-image/masking")),l.weight!==void 0&&l.weight!==null&&(n._imageWeight=l.weight),l.mask_source!==void 0&&l.mask_source!==null&&(n._maskSource=l.mask_source),i.cleanConfig(l),Object.assign(n.rawBody,l)),n.canSendMessage=i.canSendFileTextMessage,n}return y(i,[{key:"createFormDataBody",value:function(n,r,a,o){var s=new FormData;return s.append("init_image",r),s.append("mask_source",String(this._maskSource)),s.append("mask_image",a),o&&o!==""&&s.append("text_prompts[0][text]",o),this._imageWeight!==void 0&&this._imageWeight!==null&&s.append("text_prompts[0][weight]",String(this._imageWeight)),Object.keys(n).forEac
566h(function(l){s.append(l,String(n[l]))}),s.get("weight")===void 0&&s.append("weight",String(1)),s}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o,s){var l,u,c,d;return f().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(this.requestSettings){p.next=2;break}throw new Error("Request settings have not been set up");case 2:if(!(!s||!s[0]||!s[1])){p.next=4;break}throw new Error("Image was not found");case 4:c=(u=(l=o[o.length-1])==null?void 0:l.text)==null?void 0:u.trim(),d=this.createFormDataBody(this.rawBody,s[0],s[1],c),B.tempRemoveContentHeader(this.requestSettings,J.request.bind(this,this,d,a),!1);case 6:case"end":return p.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.message){s.next=2;break}throw a.message;case 2:return s.abrupt("return",{files:a.artifacts.map(function(l){return{src:"".concat(ct).concat(l.base64),type:"image"}})});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}],[{key:"cleanConfig",value:function(n){delete n.engine_id,delete n.weight}},{key:"canSendFileTextMessage",value:function(n,r){return!!(r!=null&&r[0])&&!!(n&&n.trim()!=="")}}]),i}(qt),Eu=function(e){P(i,e);function i(t){g(this,i);var n,r,a,o=(r=(n=t.directConnection)==null?void 0:n.huggingFace)==null?void 0:r.audioSpeechRecognition,s=(a=t.directConnection)==null?void 0:a.huggingFace;return O(this,i,[t,"Attach an audio file","facebook/wav2vec2-large-960h-lv60-self",o,s,{audio:{}}])}return y(i,[{key:"extractPollResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.estimated_time){s.next=2;break}return s.abrupt("return",{timeoutMS:(a.estimated_time+1)*1e3});case 2:if(!a.error){s.next=4;break}throw a.error;case 4:return s.abrupt("return",{text:a.text||""});case 5:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(er),Cu=function(e){P(i,e);function i(t){g(this,i);var n,r,a,o=(r=(n=t.directConnection)==null?void 0:n.huggingFace)==null?void 0:r.textGeneration,s=(a=t.directConnection)==null?void 0:a.huggingFace;return O(this,i,[t,"Once upon a time","gpt2",o,s])}return y(i,[{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.error){s.next=2;break}throw a.error;case 2:return s.abrupt("return",{text:a[0].generated_text||""});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(ze),Mu=function(e){P(i,e);function i(t){var n;g(this,i);var r,a,o,s=(a=(r=t.directConnection)==null?void 0:r.huggingFace)==null?void 0:a.questionAnswer,l=(o=t.directConnection)==null?void 0:o.huggingFace;return n=O(this,i,[t,"Ask a question","bert-large-uncased-whole-word-masking-finetuned-squad",s,l]),n.permittedErrorPrefixes=["Authorization header","Error in"],n.context=s.context,n}return y(i,[{key:"preprocessBody",value:function(n,r){var a=r[r.length-1].text;if(a)return{inputs:{question:a,context:this.context,options:{wait_for_model:!0}}}}},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.error){s.next=2;break}throw a.error;case 2:return s.abrupt("return",{text:a.answer||""});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(ze),Au=function(e){P(i,e);function i(t){g(this,i);var n,r,a,o=(r=(n=t.directConnection)==null?void 0:n.huggingFace)==null?void 0:r.summarization,s=(a=t.directConnection)==null?void 0:a.huggingFace;return O(this,i,[t,"Insert text to summarize","facebook/bart-large-cnn",o,s])}return y(i,[{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.error){s.next=2;break}throw a.error;case 2:return s.abrupt("return",{text:a[0].summary_text||""});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(ze),Tu=function(e){P(i,e);function i(t){var n,r;g(this,i);var a,o,s,l=(o=(a=t.directConnection)==null?void 0:a.huggingFace)==null?void 0:o.conversation,u=(s=t.directConnection)==null?void 0:s.huggingFace;return r=O(this,i,[t,"Ask me anything!","facebook/blenderbot-400M-distill",l,u]),(n=r.maxMessages)!==null&&n!==void 0||(r.maxMessages=-1),r}return y(i,[{key:"processMessages",value:function(n){var r=n.filter(function(u){return u.text}),a=r[r.length-1].text,o=r.slice(0,r.length-1);if(a){var s=o.filter(function(u){return u.role==="user"}).map(function(u){return u.text}),l=o.filter(function(u){return u.role==="ai"}).map(function(u){return u.text});return{past_user_inputs:s,generated_responses:l,mostRecentMessageText:a}}}},{key:"preprocessBody",value:function(n,r){var a,o=JSON.parse(JSON.stringify(n)),s=this.processMessages(r);if(s)return(a=o.options)!==null&&a!==void 0||(o.options={}),o.options.wait_for_model=!0,V({inputs:{past_user_inputs:s.past_user_inputs,generated_responses:s.generated_responses,text:s.mostRecentMessageText}},o)}},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.error){s.next=2;break}throw a.error;case 2:return s.abrupt("return",{text:a.generated_text||""});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(ze),Iu=function(e){P(i,e);function i(t){var n;g(this,i);var r,a=JSON.parse(JSON.stringify(t.directConnection)),o=a.stabilityAI,s={images:{files:{acceptedFormats:".png",maxNumberOfFiles:1}}};
566n=O(this,i,[t,Ee.buildKeyVerificationDetails(),Ee.buildHeaders,o,s]),n.url="https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image",n.textInputPlaceholderText="Describe image changes",n.introPanelMarkUp=`
567    <div style="width: 100%; text-align: center; margin-left: -10px"><b>Stability AI: Image to Image</b></div>
568    <p>Upload an image to create a new one with the changes you have described.</p>
569    <p>Click <a href="https://platform.stability.ai/">here</a> for more info.</p>`;var l=(r=a.stabilityAI)==null?void 0:r.imageToImage;return R(l)=="object"&&(l.engine_id&&(n.url="https://api.stability.ai/v1/generation/".concat(l.engine_id,"/text-to-image")),l.weight!==void 0&&l.weight!==null&&(n._imageWeight=l.weight),i.cleanConfig(l),Object.assign(n.rawBody,l)),n.canSendMessage=i.canSendFileTextMessage,n}return y(i,[{key:"createFormDataBody",value:function(n,r,a){var o=new FormData;return o.append("init_image",r),a&&a!==""&&o.append("text_prompts[0][text]",a),this._imageWeight!==void 0&&this._imageWeight!==null&&o.append("text_prompts[0][weight]",String(this._imageWeight)),Object.keys(n).forEach(function(s){o.append(s,String(n[s]))}),o.get("weight")===void 0&&o.append("weight",String(1)),o}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o,s){var l,u,c,d;return f().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(this.requestSettings){p.next=2;break}throw new Error("Request settings have not been set up");case 2:if(s){p.next=4;break}throw new Error("Image was not found");case 4:c=(u=(l=o[o.length-1])==null?void 0:l.text)==null?void 0:u.trim(),d=this.createFormDataBody(this.rawBody,s[0],c),B.tempRemoveContentHeader(this.requestSettings,J.request.bind(this,this,d,a),!1);case 6:case"end":return p.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.message){s.next=2;break}throw a.message;case 2:return s.abrupt("return",{files:a.artifacts.map(function(l){return{src:"".concat(ct).concat(l.base64),type:"image"}})});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}],[{key:"cleanConfig",value:function(n){delete n.engine_id,delete n.weight}},{key:"canSendFileTextMessage",value:function(n,r){return!!(r!=null&&r[0])&&!!(n&&n.trim()!=="")}}]),i}(qt),Lu=function(e){P(i,e);function i(t){g(this,i);var n,r,a,o=(r=(n=t.directConnection)==null?void 0:n.huggingFace)==null?void 0:r.translation,s=(a=t.directConnection)==null?void 0:a.huggingFace;return O(this,i,[t,"Insert text to translate","Helsinki-NLP/opus-tatoeba-en-ja",o,s])}return y(i,[{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.error){s.next=2;break}throw a.error;case 2:return s.abrupt("return",{text:a[0].translation_text||""});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(ze),Ru=function(e){P(i,e);function i(t){var n;g(this,i);var r,a=JSON.parse(JSON.stringify(t.directConnection)),o=a.stabilityAI;n=O(this,i,[t,Ee.buildKeyVerificationDetails(),Ee.buildHeaders,o]),n.url="https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image",n.textInputPlaceholderText="Describe an image",n.introPanelMarkUp=`
570    <div style="width: 100%; text-align: center; margin-left: -10px"><b>Stability AI: Text to Image</b></div>
571    <p>Insert text to generate an image.</p>
572    <p>Click <a href="https://platform.stability.ai/">here</a> for more info.</p>`;var s=(r=a.stabilityAI)==null?void 0:r.textToImage;return R(s)=="object"&&(s.engine_id&&(n.url="https://api.stability.ai/v1/generation/".concat(s.engine_id,"/text-to-image")),s.weight!==void 0&&s.weight!==null&&(n._imageWeight=s.weight),i.cleanConfig(s),Object.assign(n.rawBody,s)),n.canSendMessage=i.canSendTextMessage,n}return y(i,[{key:"preprocessBody",value:function(n,r){var a=JSON.parse(JSON.stringify(n)),o={text:r};return this._imageWeight&&(o.weight=this._imageWeight),a.text_prompts=[o],a}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o){var s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(this.requestSettings){u.next=2;break}throw new Error("Request settings have not been set up");case 2:s=this.preprocessBody(this.rawBody,o[o.length-1].text),J.request(this,s,a);case 4:case"end":return u.stop()}},r,this)}));function n(r,a){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.message){s.next=2;break}throw a.message;case 2:return s.abrupt("return",{files:a.artifacts.map(function(l){return{src:"".concat(ct).concat(l.base64),type:"image"}})});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}],[{key:"cleanConfig",value:function(n){delete n.engine_id,delete n.weight}},{key:"canSendTextMessage",value:function(n){return!!(n&&n.trim()!=="")}}]),i}(qt),Ou=function(e){P(i,e);function i(t){var n;g(this,i);var r,a,o,s=(a=(r=t.directConnection)==null?void 0:r.huggingFace)==null?void 0:a.fillMask,l=(o=t.directConnection)==null?void 0:o.huggingFace;return n=O(this,i,[t,"The goal of life is [MASK].","bert-base-uncased",s,l]),n.introPanelMarkUp=`
573    <div style="width: 100%; text-align: center; margin-left: -10px"><b>Hugging Face</b></div>
574    <p>
574Insert a sentence with the word [MASK] and the model will try to fill it for you. E.g. I want [MASK].</p>
575    <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>`,n.permittedErrorPrefixes=["Authorization header","No mask_token"],n}return y(i,[{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.error){s.next=2;break}throw a.error;case 2:return s.abrupt("return",{text:a[0].sequence||""});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(ze),jr=function(){function e(){g(this,e)}return y(e,null,[{key:"buildHeaders",value:function(t){return{Authorization:"Bearer ".concat(t),"Content-Type":"application/json",accept:"application/json"}}},{key:"handleVerificationResult",value:function(t,n,r,a){var o;(o=t.message)!=null&&o.includes("invalid request: prompt must be at least 1 token long")?r(n):a(ee.INVALID_KEY)}},{key:"buildKeyVerificationDetails",value:function(){return{url:"https://api.cohere.ai/v1/generate",method:"POST",handleVerificationResult:e.handleVerificationResult,body:JSON.stringify({prompt:""})}}}]),e}(),tr=function(e){P(i,e);function i(t,n,r,a,o){var s;return g(this,i),s=O(this,i,[t,jr.buildKeyVerificationDetails(),jr.buildHeaders,o]),s.insertKeyPlaceholderText="Cohere API Key",s.keyHelpUrl="https://dashboard.cohere.ai/api-keys",s.permittedErrorPrefixes=["invalid"],s.url=n,s.textInputPlaceholderText=r,a&&R(a)=="object"&&Object.assign(s.rawBody,a),s}return y(i)}(ce),Pu=function(e){P(i,e);function i(t){g(this,i);var n,r,a,o=(r=(n=t.directConnection)==null?void 0:n.cohere)==null?void 0:r.textGeneration,s=(a=t.directConnection)==null?void 0:a.cohere;return O(this,i,[t,"https://api.cohere.ai/v1/generate","Once upon a time",o,s])}return y(i,[{key:"preprocessBody",value:function(n,r){var a=JSON.parse(JSON.stringify(n)),o=r[r.length-1].text;if(o)return V({prompt:o},a)}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o){var s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(this.requestSettings){u.next=2;break}throw new Error("Request settings have not been set up");case 2:s=this.preprocessBody(this.rawBody,o),J.request(this,s,a);case 4:case"end":return u.stop()}},r,this)}));function n(r,a){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){var o;return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(!a.message){l.next=2;break}throw a.message;case 2:return l.abrupt("return",{text:((o=a.generations)==null?void 0:o[0].text)||""});case 3:case"end":return l.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(tr),Nu=function(e){P(i,e);function i(t){g(this,i);var n,r,a,o=(r=(n=t.directConnection)==null?void 0:n.cohere)==null?void 0:r.summarization,s=(a=t.directConnection)==null?void 0:a.cohere;return O(this,i,[t,"https://api.cohere.ai/v1/summarize","Insert text to summarize",o,s])}return y(i,[{key:"preprocessBody",value:function(n,r){var a=JSON.parse(JSON.stringify(n)),o=r[r.length-1].text;if(o)return V({text:o},a)}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o){var s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(this.requestSettings){u.next=2;break}throw new Error("Request settings have not been set up");case 2:s=this.preprocessBody(this.rawBody,o),J.request(this,s,a);case 4:case"end":return u.stop()}},r,this)}));function n(r,a){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.message){s.next=2;break}throw a.message;case 2:return s.abrupt("return",{text:a.summary||""});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(tr),ae=function(){function e(){g(this,e)}return y(e,null,[{key:"buildHeaders",value:function(t){return{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"}}},{key:"handleVerificationResult",value:function(t,n,r,a){var o=t;o.error?o.error.code==="invalid_api_key"?a(ee.INVALID_KEY):a(ee.CONNECTION_FAILED):r(n)}}
575,{key:"buildKeyVerificationDetails",value:function(){return{url:"https://api.openai.com/v1/models",method:"GET",handleVerificationResult:e.handleVerificationResult}}},{key:"directFetch",value:function(){var i=k(f().mark(function n(r,a,o){var s,l,u=arguments;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return s=u.length>3&&u[3]!==void 0?u[3]:!0,r.requestSettings.method=o,d.next=4,B.fetch(r,r.requestSettings.headers,s,a).then(function(h){return B.processResponseByType(h)});case 4:if(l=d.sent,!l.error){d.next=7;break}throw l.error.message;case 7:return d.abrupt("return",l);case 8:case"end":return d.stop()}},n)}));function t(n,r,a){return i.apply(this,arguments)}return t}()}]),e}(),nr=function(e){P(i,e);function i(t){var n,r,a;g(this,i);var o,s,l,u=JSON.parse(JSON.stringify(t.directConnection)),c=u==null?void 0:u.openAI;a=O(this,i,[t,ae.buildKeyVerificationDetails(),ae.buildHeaders,c]),a.insertKeyPlaceholderText="OpenAI API Key",a.keyHelpUrl="https://platform.openai.com/account/api-keys",a.url="https://api.openai.com/v1/audio/speech",a.permittedErrorPrefixes=["Invalid"],a.introPanelMarkUp=`
576    <div style="width: 100%; text-align: center; margin-left: -10px"><b>OpenAI : Text To Speech</b></div>
577    <p>Generate an audio file based on your text input.</p>
578    <p>Click <a href="https://platform.openai.com/docs/guides/text-to-speech">here</a> for more information.</p>`;var d=(o=u==null?void 0:u.openAI)==null?void 0:o.textToSpeech;return R(d)=="object"&&Object.assign(a.rawBody,d),(n=(s=a.rawBody).model)!==null&&n!==void 0||(s.model=i.DEFAULT_MODEL),(r=(l=a.rawBody).voice)!==null&&r!==void 0||(l.voice=i.DEFAULT_VOIDE),a.textInputPlaceholderText="Insert text to generate audio",a.rawBody.response_format="mp3",a}return y(i,[{key:"preprocessBody",value:function(n,r){var a,o,s=JSON.parse(JSON.stringify(n)),l=(o=(a=r[r.length-1])==null?void 0:a.text)==null?void 0:o.trim();return l&&l!==""&&(s.input=l),s}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o){var s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if((s=this.requestSettings)!=null&&s.headers){c.next=2;break}throw new Error("Request settings have not been set up");case 2:this.url=this.requestSettings.url||this.url,l=this.preprocessBody(this.rawBody,o),J.request(this,l,a);case 5:case"end":return c.stop()}},r,this)}));function n(r,a){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!(a instanceof Blob)){s.next=2;break}return s.abrupt("return",new Promise(function(l){var u=new FileReader;u.readAsDataURL(a),u.onload=function(c){l({files:[{src:c.target.result,type:"audio"}]})}}));case 2:if(!a.error){s.next=4;break}throw a.error.message;case 4:return s.abrupt("return",{error:"error"});case 5:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(ce);nr.DEFAULT_MODEL="tts-1";nr.DEFAULT_VOIDE="alloy";var Du=nr,Ut=function(e){P(i,e);function i(t){var n,r;g(this,i);var a,o,s=JSON.parse(JSON.stringify(t.directConnection)),l=s==null?void 0:s.openAI;r=O(this,i,[t,ae.buildKeyVerificationDetails(),ae.buildHeaders,l,{audio:{}}]),r.insertKeyPlaceholderText="OpenAI API Key",r.keyHelpUrl="https://platform.openai.com/account/api-keys",r.introPanelMarkUp=`
579    <div style="width: 100%; text-align: center; margin-left: -10px"><b>OpenAI : Speech To Text</b></div>
580    <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio
581      processing.
582    <p>Click <a href="https://platform.openai.com/docs/guides/speech-to-text">here</a> for more info.</p>`,r.url="",r.permittedErrorPrefixes=["Invalid"],r.textInputPlaceholderText="Upload an audio file",r._service_url=i.AUDIO_TRANSCRIPTIONS_URL;var u=(a=s==null?void 0:s.openAI)==null?void 0:a.audio;return R(u)=="object"&&(r.processConfig(u),i.cleanConfig(u),Object.assign(r.rawBody,u)),(n=(o=r.rawBody).model)!==null&&n!==void 0||(o.model=i.DEFAULT_MODEL),r.rawBody.response_format="json",r.canSendMessage=i.canSendFileMessage,r}return y(i,[{key:"processConfig",value:function(n){n!=null&&n.type&&n.type==="translation"&&(this._service_url=i.AU
582DIO_TRANSLATIONS_URL,delete n.language)}},{key:"preprocessBody",value:function(n,r){var a,o,s=JSON.parse(JSON.stringify(n)),l=(o=(a=r[r.length-1])==null?void 0:a.text)==null?void 0:o.trim();return l&&l!==""&&(s.prompt=l),s}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o,s){var l,u,c;return f().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if((l=this.requestSettings)!=null&&l.headers){h.next=2;break}throw new Error("Request settings have not been set up");case 2:if(s!=null&&s[0]){h.next=4;break}throw new Error("No file was added");case 4:this.url=this.requestSettings.url||this._service_url,u=this.preprocessBody(this.rawBody,o),c=i.createFormDataBody(u,s[0]),B.tempRemoveContentHeader(this.requestSettings,J.request.bind(this,this,c,a),!1);case 7:case"end":return h.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.error){s.next=2;break}throw a.error.message;case 2:return s.abrupt("return",{text:a.text});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}],[{key:"canSendFileMessage",value:function(n,r){return!!(r!=null&&r[0])}},{key:"cleanConfig",value:function(n){delete n.type}},{key:"createFormDataBody",value:function(n,r){var a=new FormData;return a.append("file",r),Object.keys(n).forEach(function(o){a.append(o,String(n[o]))}),a}}]),i}(ce);Ut.AUDIO_TRANSCRIPTIONS_URL="https://api.openai.com/v1/audio/transcriptions";Ut.AUDIO_TRANSLATIONS_URL="https://api.openai.com/v1/audio/translations";Ut.DEFAULT_MODEL="whisper-1";var Fu=Ut,Ne=function(){function e(){g(this,e)}return y(e,null,[{key:"buildTextToSpeechHeaders",value:function(t,n){return{"Ocp-Apim-Subscription-Key":n,"Content-Type":"application/ssml+xml","X-Microsoft-OutputFormat":t}}},{key:"buildSpeechToTextHeaders",value:function(t){return{"Ocp-Apim-Subscription-Key":t,Accept:"application/json"}}},{key:"handleSpeechVerificationResult",value:function(t,n,r,a){t.error?a(ee.INVALID_KEY):r(n)}},{key:"buildSpeechKeyVerificationDetails",value:function(t){return{url:"https://".concat(t,".api.cognitive.microsoft.com/sts/v1.0/issuetoken"),method:"POST",createHeaders:function(r){return{"Ocp-Apim-Subscription-Key":"".concat(r)}},handleVerificationResult:e.handleSpeechVerificationResult}}},{key:"buildSummarizationHeader",value:function(t){return{"Ocp-Apim-Subscription-Key":t,"Content-Type":"application/json"}}},{key:"handleLanguageVerificationResult",value:function(t,n,r,a){var o;((o=t.error)==null?void 0:o.code)==="401"?a(ee.INVALID_KEY):r(n)}},{key:"buildLanguageKeyVerificationDetails",value:function(t){return{url:"".concat(t,"/language/analyze-text/jobs?api-version=2022-10-01-preview"),method:"POST",createHeaders:function(r){return{"Ocp-Apim-Subscription-Key":"".concat(r)}},handleVerificationResult:e.handleLanguageVerificationResult}}},{key:"handleTranslationVerificationResult",value:function(t,n,r,a){t.json().then(function(o){!Array.isArray(o)&&o.error.code===401e3?a(ee.INVALID_KEY):r(n)})}},{key:"buildTranslationKeyVerificationDetails",value:function(t){return{url:"https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es",method:"POST",createHeaders:function(r){return e.buildTranslationHeaders(t,r)},handleVerificationResult:e.handleTranslationVerificationResult}}},{key:"buildTranslationHeaders",value:function(t,n){var r={"Ocp-Apim-Subscription-Key":n,"Content-Type":"application/json"};return t&&(r["Ocp-Apim-Subscription-Region"]=t),r}}]),e}(),ju=function(e){P(i,e);function i(t,n,r,a,o){var s;return g(this,i),s=O(this,i,[t,Ne.buildLanguageKeyVerificationDetails(r),n,a,o]),s.insertKeyPlaceholderText="Azure Language Subscription Key",s.keyHelpUrl="https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",s.permittedErrorPrefixes=["Access"],s}return y(i)}(ce),Bu=function(e){P(i,e);function i(t){var n,r;g(this,i);var a,o,s,l,u=(o=(a=t.directConnection)==null?void 0:a.azure)==null?void 0:o.summarization,c=(s=t.directConnection)==null?void 0:s.azure;return r=O(this,i,[t,Ne.buildSummarizationHeader,u.endpoint,c]),r.url="",r.textInputPlaceholderText="Insert text to summarize",(n=(l=r.rawBody).language)!==null&&n!==void 0||(l.language="en"),Object.assign(r.rawBody,u),r.url="".concat(u.endpoint,"/language/analyze-text/jobs?api-version=2022-10-01-preview"),r}return y(i,[{key:"preprocessBody",value:function(n,r){var a=r[r.length-1].text;if(a)return{analysisInput:{documents:[{id:"1",language:n.language,text:a}]},tasks:[{kind:"ExtractiveSummarization"}]}}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o){var s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(this.requestSettings){u.next=2;break}throw new Error("Request settings have not been set up");case 2:s=this.preprocessBody(this.rawBody,o),J.request(this,s,a),this.messages=a;case 4:case"end":return u.stop()}},r,this)}));function n(r,a){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){var o,s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(!a.error){c.next=2;break}throw a.error.message;case 2:return this.messages&&this.completionsHandlers&&(s=a.headers.get("operation-location"),l={method:"GET",headers:(o=this.requestSettings)==null?void 0:o.headers},J.executePollRequest(this,s,l,this.messages)),c.abrupt("return",{makingAnotherRequest:!0});case 4:case"end":return c.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"extractPollResultData",value:function(){var t=k(f().mark(function r(a){var o,s,l,u;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!a.error){d.next=2;break}throw a.error;case 2:if(a.status!=="running"){d.next=4;break}return d.abrupt("return",{timeoutMS:2e3});case 4:if(!(a.errors.length>0)){d.next=6;break}throw a.errors[0];case 6:if(!(a.tasks.items[0].results.errors.length>0)){d.next=8;break}throw a.tasks.items[0].results.errors[0];case 8:o="",s=ls(a.tasks.items[0].results.documents[0].sentences);try{for(s.s();!(l=s.n()).done;)u=l.value,o+=u.text}catch(h){s.e(h)}finally{s.f()}return d.abrupt("return",{text:o||""});case 12:case"end":return d.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(ju),mn=function(){function e(){g(this,e)}return y(e,null,[{key:"poll",value:function(){var i=k(f().mark(function n(r,a){var o,s,l,u;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return o={authorization:r,"content-type":"application/json"},d.t0="https://api.assemblyai.com/v2/transcript/",d.next=4,fetch("https://api.assemblyai.com/v2/transcript",{method:"POST",body:JSON.stringify({audio_url:a}),headers:o});case 4:return d.next=6,d.sent.json();case 6:d.t1=d.sent.id,s=d.t0.concat.call(d.t0,d.t1);case 8:if(l){d.next=24;break}return d.next=11,fetch(s,{headers:o});case 11:return d.next=13,d.sent.json();case 13:if(u=d.sent,u.status!=="completed"){d.next=18;break}l=u,d.next=22;break;case 18:if(u.status!=="error"){d.next=20;break}throw new Error("Transcription failed: ".concat(u.error));case 20:return d.next=22,new Promise(function(h){return setTimeout(h,3e3)});case 22:d.next=8;break;case 24:return d.abrupt("return",l);case 25:case"end":return d.stop()}},n)}));function t(n,r){return i.apply(this,arguments)}return t}()},{key:"buildHeaders",value:function(t){return{Authorization:t,"Content-Type":"application/octet-stream"}}},{key:"handleVerificationResult",value:function(t,n,r,a){var o=t;o.error?o.error.code==="invalid_api_key"?a(ee.INVALID_KEY):a(ee.CONNECTION_FAILED):r(n)}}
582,{key:"buildKeyVerificationDetails",value:function(){return{url:"https://api.assemblyai.com/v2/upload",method:"POST",handleVerificationResult:e.handleVerificationResult}}}]),e}(),qu=function(e){P(i,e);function i(t){var n;g(this,i);var r,a=(r=t.directConnection)==null?void 0:r.assemblyAI;return n=O(this,i,[t,mn.buildKeyVerificationDetails(),mn.buildHeaders,a,{audio:{}}]),n.insertKeyPlaceholderText="AssemblyAI API Key",n.keyHelpUrl="https://www.assemblyai.com/app/account",n.introPanelMarkUp=`
583    <div style="width: 100%; text-align: center; margin-left: -10px"><b>AssemblyAI Audio</b></div>
584    <p><b>Upload an audio file</b> to transcribe it into text.
585    <p>
586      Click <a href="https://www.assemblyai.com/docs/Guides/transcribing_an_audio_file#get-started">here</a> for more info.
587    </p>`,n.url="https://api.assemblyai.com/v2/upload",n.isTextInputDisabled=!0,n.textInputPlaceholderText="Upload an audio file",n.permittedErrorPrefixes=["Authentication","Invalid"],n.canSendMessage=i.canFileSendMessage,n}return y(i,[{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o,s){var l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if((l=this.requestSettings)!=null&&l.headers){c.next=2;break}throw new Error("Request settings have not been set up");case 2:if(s!=null&&s[0]){c.next=4;break}throw new Error("No file was added");case 4:J.request(this,s[0],a,!1);case 5:case"end":return c.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){var o,s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(!a.error){c.next=2;break}throw a.error;case 2:return l=(s=(o=this.requestSettings)==null?void 0:o.headers)==null?void 0:s.Authorization,c.next=5,mn.poll(l,a.upload_url);case 5:return c.t0=c.sent.text,c.abrupt("return",{text:c.t0});case 7:case"end":return c.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()}],[{key:"canFileSendMessage",value:function(n,r){return!!(r!=null&&r[0])}}]),i}(ce),Ki=function(e){P(i,e);function i(t,n,r,a,o){var s;return g(this,i),s=O(this,i,[t,Ne.buildSpeechKeyVerificationDetails(r),n,a,o]),s.insertKeyPlaceholderText="Azure Speech Subscription Key",s.keyHelpUrl="https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",s}return y(i)}(ce),Yi=function(e){P(i,e);function i(t){var n,r,a,o;g(this,i);var s,l,u,c,d,h,p=(l=(s=t.directConnection)==null?void 0:s.azure)==null?void 0:l.textToSpeech,m=(u=t.directConnection)==null?void 0:u.azure;return o=O(this,i,[t,Ne.buildTextToSpeechHeaders.bind({},(p==null?void 0:p.outputFormat)||"audio-16khz-128kbitrate-mono-mp3"),p.region,m]),o.introPanelMarkUp=`
588    <div style="width: 100%; text-align: center; margin-left: -10px"><b>Azure Text To Speech</b></div>
589    <p>Insert text to synthesize it to audio.
590    <p>
591      Click <a href="`.concat(i.HELP_LINK,`">here</a> for more info.
592    </p>`),o.url="",Object.assign(o.rawBody,p),(n=(c=o.rawBody).lang)!==null&&n!==void 0||(c.lang="en-US"),(r=(d=o.rawBody).name)!==null&&r!==void 0||(d.name="en-US-JennyNeural"),(a=(h=o.rawBody).gender)!==null&&a!==void 0||(h.gender="Female"),o.url="https://".concat(p.region,".tts.speech.microsoft.com/cognitiveservices/v1"),o}return y(i,[{key:"preprocessBody",value:function(n,r){var a=r[r.length-1].text;if(a)return"<speak version='1.0' xml:lang='".concat(n.lang,`'>
593      <voice xml:lang='`).concat(n.lang,"' xml:gender='").concat(n.gender,"' name='").concat(n.name,`'>
594        `).concat(a,`
595      </voice>
596    </speak>`)}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o){var s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(this.requestSettings){u.next=2;break}throw new Error("Request settings have not been set up");case 2:s=this.preprocessBody(this.rawBody,o),J.request(this,s,a,!1);case 4:case"end":return u.stop()}},r,this)}));function n(r,a){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.abrupt("return",new Promise(function(l){var u=new FileReader;
596u.readAsDataURL(a),u.onload=function(c){l({files:[{src:c.target.result,type:"audio"}]})}}));case 1:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(Ki);Yi.HELP_LINK="https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";var Uu=Yi,Ji=function(e){P(i,e);function i(t){var n;g(this,i);var r,a,o,s=(a=(r=t.directConnection)==null?void 0:r.azure)==null?void 0:a.speechToText,l=(o=t.directConnection)==null?void 0:o.azure,u={audio:{files:{acceptedFormats:".wav,.ogg"}}};n=O(this,i,[t,Ne.buildSpeechToTextHeaders,s.region,l,u]),n.introPanelMarkUp=`
597    <div style="width: 100%; text-align: center; margin-left: -10px"><b>Azure Speech To Text</b></div>
598    <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.
599    <p>
600      Click <a href="`.concat(i.HELP_LINK,`">here</a> for more info.
601    </p>`),n.url="",n.isTextInputDisabled=!0,n.textInputPlaceholderText="Upload an audio file",n.canSendMessage=i.canFileSendMessage;var c=s.lang||"en-US";return n.url="https://".concat(s.region,".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(c,"&format=detailed"),n.recordAudio=void 0,n}return y(i,[{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o,s){var l,u;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if((l=this.requestSettings)!=null&&l.headers){d.next=2;break}throw new Error("Request settings have not been set up");case 2:if(s!=null&&s[0]){d.next=4;break}throw new Error("No file was added");case 4:(u=this.requestSettings)!=null&&u.headers&&(this.requestSettings.headers["Content-Type"]=s[0].name.toLocaleLowerCase().endsWith(".wav")?"audio/wav; codecs=audio/pcm; samplerate=16000":"audio/ogg; codecs=opus"),J.request(this,s[0],a,!1);case 5:case"end":return d.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.error){s.next=2;break}throw a.error;case 2:return s.abrupt("return",{text:a.DisplayText||""});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}],[{key:"canFileSendMessage",value:function(n,r){return!!(r!=null&&r[0])}}]),i}(Ki);Ji.HELP_LINK="https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";var zu=Ji,Hu=function(e){P(i,e);function i(t){var n;g(this,i);var r,a,o,s=(a=(r=t.directConnection)==null?void 0:r.azure)==null?void 0:a.translation,l=(o=t.directConnection)==null?void 0:o.azure;return n=O(this,i,[t,Ne.buildTranslationKeyVerificationDetails(s.region),Ne.buildTranslationHeaders.bind({},s==null?void 0:s.region),l]),n.insertKeyPlaceholderText="Azure Translate Subscription Key",n.keyHelpUrl="https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal",n.url="",n.url="https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(s.language||"es"),n}return y(i,[{key:"preprocessBody",value:function(n){var r=n[n.length-1].text;if(r)return[{Text:r}]}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o){var s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(this.requestSettings){u.next=2;break}throw new Error("Request settings have not been set up");case 2:s=this.preprocessBody(o),J.request(this,s,a);case 4:case"end":return u.stop()}},r,this)}));function n(r,a){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){var o;return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(!Array.isArray(a)){l.next=2;break}return l.abrupt("return",{text:((o=a[0].translations)==null?void 0:o[0].text)||""});case 2:throw a.error;case 3:case"end":return l.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(ce),Br=function(){function e(){g(this,e)}return y(e,null,[{key:"storeFiles",value:function(){var i=k(f().mark(function n(r,a,o){var s,l,u,c;return f().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(s=r.requestSettings.headers,s){h.next=3;break}return h.abrupt("return");case 3:return r.url="https://api.openai.com/v1/files",l=s[B.CONTENT_TYPE],delete s[B.CONTENT_TYPE],u=o.map(function(){var p=k(f().mark(function m(v){var b;return f().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return b=new FormData,_.abrupt("return",(b.append("purpose","assistants"),b.append("file",v),new Promise(function(x){x(ae.directFetch(r,b,"POST",!1))})));case 2:case"end":return _.stop()}},m)}));return function(m){return p.apply(this,arguments)}}()),h.prev=7,h.next=10,Promise.all(u);case 10:return c=h.sent.map(function(p){return p.id}),h.abrupt("return",(s[B.CONTENT_TYPE]=l,c));case 14:throw h.prev=14,h.t0=h.catch(7),s[B.CONTENT_TYPE]=l,B.displayError(a,h.t0),r.completionsHandlers.onFinish(),h.t0;case 17:case"end":return h.stop()}},n,null,[[7,14]])}
601));function t(n,r,a){return i.apply(this,arguments)}return t}()},{key:"getType",value:function(t,n){var r=t[n].path;return!r||r.endsWith("png")?"image":"any"}},{key:"getFiles",value:function(){var i=k(f().mark(function n(r,a){var o,s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return o=a.map(function(c){var d=c.fileId;return r.url="https://api.openai.com/v1/files/".concat(d,"/content"),new Promise(function(h){h(ae.directFetch(r,void 0,"GET",!1))})}),u.next=3,Promise.all(o);case 3:return s=u.sent.map(function(c,d){return new Promise(function(h){var p=new FileReader;p.readAsDataURL(c),p.onload=function(m){h({src:m.target.result,name:a[d].name,type:e.getType(a,d)})}})}),u.next=6,Promise.all(s);case 6:return u.abrupt("return",u.sent);case 7:case"end":return u.stop()}},n)}));function t(n,r){return i.apply(this,arguments)}return t}()},{key:"getFileName",value:function(t){var n=t.split("/");return n[n.length-1]}},{key:"getFileDetails",value:function(t,n){var r,a=[];return(r=n==null?void 0:n.text)!=null&&r.value&&t.content.forEach(function(o){var s,l;(l=(s=o.text)==null?void 0:s.annotations)==null||l.forEach(function(u){var c;u.text&&u.text.startsWith("sandbox:")&&(c=u.file_path)!=null&&c.file_id&&a.push({path:u.text,fileId:u.file_path.file_id,name:e.getFileName(u.text)})})}),n!=null&&n.image_file&&a.push({fileId:n.image_file.file_id}),a}},{key:"getFilesAndNewText",value:function(){var i=k(f().mark(function n(r,a,o,s){var l,u,c;return f().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(h.t0=a.length>0,!h.t0){h.next=6;break}return h.next=4,e.getFiles(r,a);case 4:c=h.sent,(l=s==null?void 0:s.text)!=null&&l.value&&c.forEach(function(p,m){var v;if(p.src){var b=a[m].path;(v=s==null?void 0:s.text)!=null&&v.value&&b&&(s.text.value=s.text.value.replace(b,p.src))}});case 6:return h.abrupt("return",{files:c,text:(u=s==null?void 0:s.text)==null?void 0:u.value,role:o});case 7:case"end":return h.stop()}},n)}));function t(n,r,a,o){return i.apply(this,arguments)}return t}()},{key:"getFilesAndText",value:function(){var i=k(f().mark(function n(r,a,o){var s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return s=e.getFileDetails(a,o),u.next=3,e.getFilesAndNewText(r,s,a.role,o);case 3:return u.abrupt("return",u.sent);case 4:case"end":return u.stop()}},n)}));function t(n,r,a){return i.apply(this,arguments)}return t}()}]),e}(),zt=function(e){P(i,e);function i(t){var n,r,a;g(this,i);var o,s,l,u,c,d,h=JSON.parse(JSON.stringify(t.directConnection)),p=h.openAI;a=O(this,i,[t,ae.buildKeyVerificationDetails(),ae.buildHeaders,p]),a.insertKeyPlaceholderText="OpenAI API Key",a.keyHelpUrl="https://platform.openai.com/account/api-keys",a.url="",a.permittedErrorPrefixes=["Incorrect"],a.searchedForThreadId=!1,a.config={},a.newAssistantDetails={model:"gpt-4"},a.shouldFetchHistory=!1;var m=(o=h.openAI)==null?void 0:o.assistant;if(R(m)=="object"){a.config=m;var v=a.config,b=v.new_assistant,w=v.thread_id,_=v.load_thread_history;Object.assign(a.newAssistantDetails,b),w&&(a.sessionId=w),_&&(a.shouldFetchHistory=!0);var x=(l=(s=t.directConnection)==null?void 0:s.openAI)==null?void 0:l.assistant,N=x.function_handler;N&&(a._functionHandler=N)}else(u=h.openAI)!=null&&u.assistant&&(h.openAI.assistant=m);return(n=(c=a.requestSettings).headers)!==null&&n!==void 0||(c.headers={}),(r=(d=a.requestSettings.headers)["OpenAI-Beta"])!==null&&r!==void 0||(d["OpenAI-Beta"]="assistants=v1"),a.maxMessages=1,a.shouldFetchHistory&&a.sessionId&&(a.fetchHistory=a.fetchHistoryFunc.bind(de(a))),a}return y(i,[{key:"fetchHistoryFunc",value:function(){var t=k(f().mark(function r(){var a=this,o;return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return setTimeout(function(){return a.deepChat.disableSubmitButton()},2),l.prev=1,l.next=4,this.getThreadMessages(this.sessionId,!0);case 4:return o=l.sent,l.abrupt("return",(this.deepChat.disableSubmitButton(!1),o.reverse()));case 8:return l.prev=8,l.t0=l.catch(1),l.abrupt("return",[{error:"failed to fetch thread history"}]);case 11:case"end":return l.stop()}},r,this,[[1,8]])}));function n(){return t.apply(this,arguments)}return n}()},{key:"processMessage",value:function(n,r){var a=this.totalMessagesMaxCharLength||-1;return{content:Zn.getCharacterLimitMessages(n,a)[0].text||"",role:"user",file_ids:r}}},{key:"createNewThreadMessages",value:function(n,r,a){var o=JSON.parse(JSON.stringify(n)),s=this.processMessage(r,a);return o.thread={messages:[s]},o}},{key:"callService",value:function(n,r,a){if(this.sessionId){this.url="".concat(i.THREAD_PREFIX,"/").concat(this.sessionId,"/messages");var o=this.processMessage(r,a);J.request(this,o,n)}else{this.url="".concat(i.THREAD_PREFIX,"/runs");var s=this.createNewThreadMessages(this.rawBody,r,a);J.request(this,s,n)}this.messages=n}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o,s){var l,u,c;return f().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(this.requestSettings){h.next=2;break}throw new Error("Request settings have not been set up");case 2:if(!((l=(u=this.rawBody).assistant_id)!==null&&l!==void 0)){h.next=6;break}h.next=12;break;case 6:if(h.t0=this.config.assistant_id,h.t0){h.next=11;break}return h.next=10,this.createNewAssistant();case 10:h.t0=h.sent;case 11:u.assistant_id=h.t0;
601case 12:if(this.searchedForThreadId||this.searchPreviousMessagesForThreadId(a.messages),!s){h.next=19;break}return h.next=16,Br.storeFiles(this,a,s);case 16:h.t1=h.sent,h.next=20;break;case 19:h.t1=void 0;case 20:c=h.t1,this.requestSettings.method="POST",this.callService(a,o,c);case 22:case"end":return h.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"createNewAssistant",value:function(){var t=k(f().mark(function r(){var a;return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.prev=0,this.url=i.NEW_ASSISTANT_URL,s.next=4,ae.directFetch(this,JSON.parse(JSON.stringify(this.newAssistantDetails)),"POST");case 4:return a=s.sent,s.abrupt("return",(this.config.assistant_id=a.id,this.config.assistant_id));case 8:s.prev=8,s.t0=s.catch(0),console.error(s.t0),console.error("Failed to create a new assistant");case 11:case"end":return s.stop()}},r,this,[[0,8]])}));function n(){return t.apply(this,arguments)}return n}()},{key:"searchPreviousMessagesForThreadId",value:function(n){var r=n.find(function(a){return a._sessionId});r&&(this.sessionId=r._sessionId),this.searchedForThreadId=!0}},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){var o,s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(!a.error){c.next=2;break}throw a.error.message;case 2:return c.next=4,this.assignThreadAndRun(a);case 4:return s="".concat(i.THREAD_PREFIX,"/").concat(this.sessionId,"/runs/").concat(this.run_id),l={method:"GET",headers:(o=this.requestSettings)==null?void 0:o.headers},c.abrupt("return",(J.executePollRequest(this,s,l,this.messages),{makingAnotherRequest:!0}));case 6:case"end":return c.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"assignThreadAndRun",value:function(){var t=k(f().mark(function r(a){var o;return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(!this.sessionId){l.next=8;break}return this.url="".concat(i.THREAD_PREFIX,"/").concat(this.sessionId,"/runs"),l.next=4,ae.directFetch(this,JSON.parse(JSON.stringify(this.rawBody)),"POST");case 4:o=l.sent,this.run_id=o.id,l.next=9;break;case 8:this.sessionId=a.thread_id,this.run_id=a.id,this.messages&&(this.messages.messages[this.messages.messages.length-1]._sessionId=this.sessionId);case 9:case"end":return l.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"getThreadMessages",value:function(){var t=k(f().mark(function r(a){var o=this,s,l,u,c,d,h=arguments;return f().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return s=h.length>1&&h[1]!==void 0?h[1]:!1,this.url="".concat(i.THREAD_PREFIX,"/").concat(a,"/messages"),m.next=4,ae.directFetch(this,{},"GET");case 4:if(c=m.sent,m.t0=!s&&this.deepChat.responseInterceptor,!m.t0){m.next=10;break}return m.next=9,(u=(l=this.deepChat).responseInterceptor)==null?void 0:u.call(l,c);case 9:c=m.sent;case 10:return d=(s?c.data:[c.data[0]]).map(function(){var v=k(f().mark(function b(w){var _;return f().wrap(function(N){for(;;)switch(N.prev=N.next){case 0:return _=w.content.find(function(M){return!!M.text||!!M.image_file}),N.next=3,Br.getFilesAndText(o,w,_);case 3:return N.abrupt("return",N.sent);case 4:case"end":return N.stop()}},b)}));return function(b){return v.apply(this,arguments)}}()),m.abrupt("return",Promise.all(d));case 12:case"end":return m.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"extractPollResultData",value:function(){var t=k(f().mark(function r(a){var o,s,l,u,c,d,h,p,m,v,b;return f().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:if(u=a.status,c=a.required_action,!(u==="queued"||u==="in_progress")){_.next=3;break}return _.abrupt("return",{timeoutMS:i.POLLING_TIMEOUT_MS});case 3:if(!(u==="completed"&&this.messages)){_.next=11;break}return _.next=6,this.getThreadMessages(a.thread_id);case 6:return d=_.sent,h=d[0],p=h.text,m=h.files,_.abrupt("return",{text:p,_sessionId:this.sessionId,files:m});case 11:if(v=(o=c==null?void 0:c.submit_tool_outputs)==null?void 0:o.tool_calls,!(u==="requires_action"&&v)){_.next=22;break}return _.next=15,this.handleTools(v);case 15:return b=_.sent,_.next=18,(l=(s=this.deepChat).responseInterceptor)==null?void 0:l.call(s,b);
601case 18:if(_.t0=_.sent,_.t0){_.next=21;break}_.t0=b;case 21:return _.abrupt("return",_.t0);case 22:throw Error("Thread run status: ".concat(u));case 23:case"end":return _.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"handleTools",value:function(){var t=k(f().mark(function r(a){var o,s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(this._functionHandler){c.next=2;break}throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Assistant) object.");case 2:return o=a.map(function(d){return{name:d.function.name,arguments:d.function.arguments}}),c.next=5,this._functionHandler(o);case 5:if(s=c.sent,!(!Array.isArray(s)||s.find(function(d){return typeof d!="string"})||a.length!==s.length)){c.next=8;break}throw Error("Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.");case 8:return l=s.map(function(d,h){return{tool_call_id:a[h].id,output:d}}),this.url="".concat(i.THREAD_PREFIX,"/").concat(this.sessionId,"/runs/").concat(this.run_id,"/submit_tool_outputs"),c.next=12,ae.directFetch(this,{tool_outputs:l},"POST");case 12:return c.abrupt("return",{timeoutMS:i.POLLING_TIMEOUT_MS});case 13:case"end":return c.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(ce);zt.THREAD_PREFIX="https://api.openai.com/v1/threads";zt.NEW_ASSISTANT_URL="https://api.openai.com/v1/assistants";zt.POLLING_TIMEOUT_MS=800;var $u=zt,Ht=function(e){P(i,e);function i(t){var n;g(this,i);var r,a=t.directConnection,o=a==null?void 0:a.openAI,s={images:{files:{acceptedFormats:".png",maxNumberOfFiles:2}}};n=O(this,i,[t,ae.buildKeyVerificationDetails(),ae.buildHeaders,o,s]),n.insertKeyPlaceholderText="OpenAI API Key",n.keyHelpUrl="https://platform.openai.com/account/api-keys",n.introPanelMarkUp=`
602    <div style="width: 100%; text-align: center; margin-left: -10px"><b>OpenAI DALL·E</b></div>
603    <p><b>Insert text</b> to generate an image.</p>
604    <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>
605    <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should
606      take place and text to specify the edit.</p>
607    <p>Click <a href="https://platform.openai.com/docs/guides/images/introduction">here</a> for more info.</p>`,n.url="",n.permittedErrorPrefixes=["Incorrect","Invalid input image"];var l=(r=a==null?void 0:a.openAI)==null?void 0:r.images;if(n.camera){var u=R(l)=="object"&&l.size?Number.parseInt(l.size):1024;n.camera.files={dimensions:{width:u,height:u}}}return R(l)=="object"&&Object.assign(n.rawBody,l),n.canSendMessage=i.canFileSendMessage,n}return y(i,[{key:"preprocessBody",value:function(n,r){var a=JSON.parse(JSON.stringify(n));return r&&r!==""&&(a.prompt=r),a}},{key:"callApiWithImage",value:function(n,r,a){var o,s,l,u=(s=(o=r[r.length-1])==null?void 0:o.text)==null?void 0:s.trim();if(a[1]||u&&u!==""){this.url=i.IMAGE_EDIT_URL;var c=this.preprocessBody(this.rawBody,u);l=i.createFormDataBody(c,a[0],a[1])}else this.url=i.IMAGE_VARIATIONS_URL,l=i.createFormDataBody(this.rawBody,a[0]);B.tempRemoveContentHeader(this.requestSettings,J.request.bind(this,this,l,n),!1)}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o,s){var l,u;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if((l=this.requestSettings)!=null&&l.headers){d.next=2;break}throw new Error("Request settings have not been set up");case 2:if(!(s!=null&&s[0])){d.next=6;break}this.callApiWithImage(a,o,s),d.next=11;break;case 6:if(this.requestSettings){d.next=8;break}throw new Error("Request settings have not been set up");case 8:this.url=i.IMAGE_GENERATION_URL,u=this.preprocessBody(this.rawBody,o[o.length-1].text),J.request(this,u,a);case 11:case"end":return d.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.error){s.next=2;break}throw a.error.message;case 2:return s.abrupt("return",{files:a.data.map(function(l){return l.url?{src:l.url,type:"image"}:{src:"".concat(ct).concat(l.b64_json),type:"image"}})});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}],[{key:"canFileSendMessage",value:function(n,r){return!!(r!=null&&r[0])||!!(n&&n.trim()!=="")}},{key:"createFormDataBody",value:function(n,r,a){var o=new FormData;return o.append("image",r),a&&o.append("mask",a),Object.keys(n).forEac
607h(function(s){o.append(s,String(n[s]))}),o}}]),i}(ce);Ht.IMAGE_GENERATION_URL="https://api.openai.com/v1/images/generations";Ht.IMAGE_VARIATIONS_URL="https://api.openai.com/v1/images/variations";Ht.IMAGE_EDIT_URL="https://api.openai.com/v1/images/edits";var Vu=Ht,Gu=function(e){P(i,e);function i(t){var n,r,a;g(this,i);var o,s,l,u,c=JSON.parse(JSON.stringify(t.directConnection)),d=c.openAI;a=O(this,i,[t,ae.buildKeyVerificationDetails(),ae.buildHeaders,d]),a.insertKeyPlaceholderText="OpenAI API Key",a.keyHelpUrl="https://platform.openai.com/account/api-keys",a.url="https://api.openai.com/v1/chat/completions",a.permittedErrorPrefixes=["Incorrect"],a.asyncCallInProgress=!1,a._systemMessage=i.generateSystemMessage("You are a helpful assistant.");var h=(o=c.openAI)==null?void 0:o.chat;if(R(h)=="object"){h.system_prompt&&(a._systemMessage=i.generateSystemMessage(h.system_prompt));var p=(l=(s=t.directConnection)==null?void 0:s.openAI)==null?void 0:l.chat,m=p.function_handler;m&&(a._functionHandler=m),a.cleanConfig(h),Object.assign(a.rawBody,h)}return(n=a.maxMessages)!==null&&n!==void 0||(a.maxMessages=-1),(r=(u=a.rawBody).model)!==null&&r!==void 0||(u.model="gpt-3.5-turbo"),a}return y(i,[{key:"cleanConfig",value:function(n){delete n.system_prompt,delete n.function_handler}},{key:"preprocessBody",value:function(n,r){var a,o=JSON.parse(JSON.stringify(n)),s=Zn.getCharacterLimitMessages(r,this.totalMessagesMaxCharLength?this.totalMessagesMaxCharLength-this._systemMessage.content.length:-1).map(function(l){return{content:i.getContent(l),role:l.role===F.USER_ROLE?"user":"assistant"}});return r.find(function(l){return l.files&&l.files.length>0})&&((a=o.max_tokens)!==null&&a!==void 0||(o.max_tokens=300)),o.messages=[this._systemMessage].concat(bi(s)),o}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o){var s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(this.requestSettings){c.next=2;break}throw new Error("Request settings have not been set up");case 2:s=this.preprocessBody(this.rawBody,o),l=this.deepChat.stream,l&&(R(l)!="object"||!l.simulation)||s.stream?(s.stream=!0,re.request(this,s,a)):J.request(this,s,a);case 4:case"end":return c.stop()}},r,this)}));function n(r,a){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a,o,s){var l,u,c,d;return f().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(!a.error){p.next=2;break}throw a.error.message;case 2:return p.abrupt("return",(u=(l=a.choices)==null?void 0:l[0])!=null&&u.delta?this.extractStreamResult(a.choices[0],o,s):(d=(c=a.choices)==null?void 0:c[0])!=null&&d.message?a.choices[0].message.tool_calls?this.handleTools(a.choices[0].message,o,s):{text:a.choices[0].message.content}:{text:""});case 3:case"end":return p.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"extractStreamResult",value:function(){var t=k(f().mark(function r(a,o,s){var l=this,u,c,d;return f().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(u=a.delta,c=a.finish_reason,c!=="tool_calls"){p.next=7;break}return this.asyncCallInProgress=!0,d={tool_calls:this._streamToolCalls},p.abrupt("return",(this._streamToolCalls=void 0,this.handleTools(d,o,s)));case 7:u!=null&&u.tool_calls&&(this._streamToolCalls?u.tool_calls.forEach(function(m,v){l._streamToolCalls&&(l._streamToolCalls[v].function.arguments+=m.function.arguments)}):this._streamToolCalls=u.tool_calls);case 8:return p.abrupt("return",{text:(u==null?void 0:u.content)||""});case 9:case"end":return p.stop()}},r,this)}));function n(r,a,o){return t.apply(this,arguments)}return n}()},{key:"handleTools",value:function(){var t=k(f().mark(function r(a,o,s){var l,u,c,d,h,p,m,v,b,w;return f().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(!(!a.tool_calls||!o||!s||!this._functionHandler)){x.next=2;break}throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Chat) object.");case 2:return p=JSON.parse(JSON.stringify(s)),m=a.tool_calls.map(function(N){return{name:N.function.name,arguments:N.function.arguments}}),x.next=6,(l=this._functionHandler)==null?void 0:l.call(this,m);case 6:if(v=x.sent,!v.text){x.next=15;break}return b={text:v.text},x.next=11,(c=(u=this.deepChat).responseInterceptor)==null?void 0:c.call(u,b);case 11:if(x.t0=x.sent,x.t0){x.next=14;break}x.t0=b;case 14:return x.abrupt("return",x.t0);case 15:if(p.messages.push({tool_calls:a.tool_calls,role:"assistant",content:null}
607),!(Array.isArray(v)&&!v.find(function(N){return typeof N!="string"})||m.length===v.length)){x.next=35;break}return v.forEach(function(N,M){var j,W=(j=a.tool_calls)==null?void 0:j[M];p==null||p.messages.push({role:"tool",tool_call_id:W==null?void 0:W.id,name:W==null?void 0:W.function.name,content:N.response})}),delete p.tools,delete p.tool_choice,delete p.stream,x.prev=17,x.next=20,o==null?void 0:o(p).then(function(N){return B.processResponseByType(N)});case 20:return w=x.sent,x.next=23,(h=(d=this.deepChat).responseInterceptor)==null?void 0:h.call(d,w);case 23:if(x.t1=x.sent,x.t1){x.next=26;break}x.t1=w;case 26:if(w=x.t1,!w.error){x.next=29;break}throw w.error.message;case 29:return x.abrupt("return",{text:w.choices[0].message.content||""});case 32:throw x.prev=32,x.t2=x.catch(17),this.asyncCallInProgress=!1,x.t2;case 35:throw Error("Response object must either be {response: string}[] for each individual function or {text: string} for a direct response, see https://deepchat.dev/docs/directConnection/OpenAI#FunctionHandler.");case 36:case"end":return x.stop()}},r,this,[[17,32]])}));function n(r,a,o){return t.apply(this,arguments)}return n}()}],[{key:"generateSystemMessage",value:function(n){return{role:"system",content:n}}},{key:"getContent",value:function(n){if(n.files&&n.files.length>0){var r=n.files.map(function(a){return{type:"image_url",image_url:{url:a.src}}});return n.text&&n.text.trim().length>0&&r.unshift({type:"text",text:n.text}),r}return n.text}}]),i}(ce),Wu=function(e){P(i,e);function i(t){var n,r;g(this,i);var a,o=JSON.parse(JSON.stringify(t.directConnection)),s=(a=o.cohere)==null?void 0:a.chat,l=o.cohere;return r=O(this,i,[t,"https://api.cohere.ai/v1/chat","Ask me anything!",s,l]),R(s)=="object"&&Object.assign(r.rawBody,s),(n=r.maxMessages)!==null&&n!==void 0||(r.maxMessages=-1),r}return y(i,[{key:"preprocessBody",value:function(n,r){var a=JSON.parse(JSON.stringify(n)),o=r.filter(function(s){return s.text});return a.query=o[o.length-1].text,a.chat_history=o.slice(0,o.length-1).map(function(s){return{text:s.text,user_name:s.role==="ai"?"CHATBOT":"USER"}}),a}},{key:"callServiceAPI",value:function(){var t=k(f().mark(function r(a,o){var s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(this.requestSettings){u.next=2;break}throw new Error("Request settings have not been set up");case 2:s=this.preprocessBody(this.rawBody,o),J.request(this,s,a);case 4:case"end":return u.stop()}},r,this)}));function n(r,a){return t.apply(this,arguments)}return n}()},{key:"extractResultData",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.message){s.next=2;break}throw a.message;case 2:return s.abrupt("return",{text:a.text});case 3:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()}]),i}(tr),Ku=function(){function e(){g(this,e)}return y(e,null,[{key:"create",value:function(t){var n=t.directConnection,r=t.request,a=t.demo,o=t.webModel;if(o)return new Qn(t);if(n){if(n.openAI)return n.openAI.images?new Vu(t):n.openAI.speechToText?new Fu(t):n.openAI.textToSpeech?new Du(t):n.openAI.assistant?new $u(t):new Gu(t);if(n.assemblyAI)return new qu(t);if(n.cohere)return n.cohere.textGeneration?new Pu(t):n.cohere.summarization?new Nu(t):new Wu(t);if(n.huggingFace)return n.huggingFace.textGeneration?new Cu(t):n.huggingFace.summarization?new Au(t):n.huggingFace.translation?new Lu(t):n.huggingFace.fillMask?new Ou(t):n.huggingFace.questionAnswer?new Mu(t):n.huggingFace.audioSpeechRecognition?new Eu(t):n.huggingFace.audioClassification?new _u(t):n.huggingFace.imageClassification?new wu(t):new Tu(t);if(n.azure){if(n.azure.speechToText)return new zu(t);if(n.azure.textToSpeech)return new Uu(t);if(n.azure.summarization)return new Bu(t);if(n.azure.translation)return new Hu(t)}if(n.stabilityAI)return n.stabilityAI.imageToImage?new Iu(t):n.stabilityAI.imageToImageUpscale?new Su(t):n.stabilityAI.imageToImageMasking?new xu(t):new Ru(t)}return r?new Tt(t):new Tt(t,void 0,a||!0)}}]),e}(),Zi=function(){function e(){g(this,e)}return y(e,null,[{key:"appendStyleSheetToHead",value:function(){var t=document.getElementsByTagName("head")[0];if(!Array.from(t.getElementsByTagName("link")).some(function(r){return r.getAttribute("href")===e.FONT_URL})){var n=document.createElement("link");n.rel="stylesheet",n.href=e.FONT_URL,t.appendChild(n)}}}]),e}();Zi.FONT_URL="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap";var Yu=Zi,Xi=y(function e(){g(this,e)});Xi.attibutes={string:function(i){return i},number:function(i){return parseFloat(i)},boolean:function(i){return i==="true"},object:function(i){return JSON.parse(i)},array:function(i){return JSON.parse(i)},function:function(i){return new Function("return ".concat(i))()}};function U(e){return function(i,t){Object.defineProperty(i,t,{});var n=i.constructor,r=t.toLocaleLowerCase();n._attributes_[r]=Xi.attibutes[e],n._attributeToProperty_[r]=t}}var Ju=function(){function e(){g(this,e)}
607return y(e,null,[{key:"colorToHex",value:function(t){var n=document.createElement("div");return n.style.color=t,document.body.appendChild(n),"#".concat(window.getComputedStyle(n).color.match(/\d+/g).map(function(r){return parseInt(r).toString(16).padStart(2,"0")}).join(""))}},{key:"set",value:function(t,n){var r,a,o,s;if((a=(r=n==null?void 0:n.loading)==null?void 0:r.bubble)!=null&&a.color){var l=e.colorToHex((s=(o=n==null?void 0:n.loading)==null?void 0:o.bubble)==null?void 0:s.color);t.style.setProperty("--message-dots-color",l),t.style.setProperty("--message-dots-color-fade","".concat(l,"33"))}else t.style.setProperty("--message-dots-color","#848484"),t.style.setProperty("--message-dots-color-fade","#55555533")}}]),e}(),Zu=function(){function e(i,t,n){g(this,e),this._isDisplayed=!1,i?(this._elementRef=this.createIntroPanelWithChild(i,n),this._isDisplayed=!0):t&&(this._elementRef=this.createInternalIntroPanel(t,n),this._isDisplayed=!0)}return y(e,[{key:"createIntroPanelWithChild",value:function(t,n){var r=e.createIntroPanel(n);return t.style.display==="none"&&(t.style.display="block"),r.appendChild(t),r}},{key:"createInternalIntroPanel",value:function(t,n){var r=e.createIntroPanel(n);return r.id="internal-intro-panel",r.innerHTML=t,r}},{key:"hide",value:function(){this._isDisplayed&&this._elementRef&&(this._elementRef.style.display="none",this._isDisplayed=!1)}},{key:"display",value:function(){!this._isDisplayed&&this._elementRef&&(this._elementRef.style.display="",this._isDisplayed=!0)}}],[{key:"createIntroPanel",value:function(t){var n=document.createElement("div");return n.classList.add("intro-panel"),Object.assign(n.style,t),n}}]),e}(),Xu=function(){function e(){g(this,e)}return y(e,null,[{key:"getText",value:function(t,n){var r;if(!t.directConnection&&!t.request&&!t.webModel&&!t.demo)return`Connect to any API using the [request](https://deepchat.dev/docs/connect#Request)
608        property or a popular service via
609        [directConnection](https://deepchat.dev/docs/directConnection/#directConnection).
610        
611 Host AI entirely on your browser via a [webModel](https://deepchat.dev/docs/webModel).
612        
613 To get started checkout the [Start](https://deepchat.dev/start) page and
614        live code [examples](https://deepchat.dev/examples/frameworks).
615        
616 To remove this message set the [demo](https://deepchat.dev/docs/demo#demo) property to true.`;if(t.directConnection){if(!n.isDirectConnection())return`Please define a valid service inside
617          the [directConnection](https://deepchat.dev/docs/directConnection/#directConnection) object.`;var a=(r=t.directConnection.openAI)==null?void 0:r.chat;if(R(a)=="object"&&a.tools&&!a.function_handler)return"Please define the `function_handler` property inside the openAI [chat](https://deepchat.dev/docs/directConnection/openAI#Chat) object."}else if(t.request&&!t.request.url&&!t.request.handler)return"Please define a `url` or a `handler` property inside the [request](https://deepchat.dev/docs/connect#Request) object.";return null}}]),e}(),Qu=`<?xml version="1.0" encoding="iso-8859-1"?>
618<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 
619	 viewBox="50 30 420 450" xml:space="preserve">
620<g filter="brightness(0) saturate(100%) invert(16%) sepia(0%) saturate(1942%) hue-rotate(215deg) brightness(99%) contrast(93%)">
621	<g>
622		<path d="M447.933,103.629c-0.034-3.076-1.224-6.09-3.485-8.352L352.683,3.511c-0.004-0.004-0.007-0.005-0.011-0.008
623			C350.505,1.338,347.511,0,344.206,0H89.278C75.361,0,64.04,11.32,64.04,25.237v461.525c0,13.916,11.32,25.237,25.237,25.237
624			h333.444c13.916,0,25.237-11.32,25.237-25.237V103.753C447.96,103.709,447.937,103.672,447.933,103.629z M356.194,40.931
625			l50.834,50.834h-49.572c-0.695,0-1.262-0.567-1.262-1.262V40.931z M423.983,486.763c0,0.695-0.566,1.261-1.261,1.261H89.278
626			c-0.695,0-1.261-0.566-1.261-1.261V25.237c0-0.695,0.566-1.261,1.261-1.261h242.94v66.527c0,13.916,11.322,25.239,25.239,25.239
627			h66.527V486.763z"/>
628	</g>
629</g>
630<g>
631	<g>
632		<path d="M362.088,164.014H149.912c-6.62,0-11.988,5.367-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175
633			c6.62,0,11.988-5.368,11.988-11.988C374.076,169.381,368.707,164.014,362.088,164.014z"/>
634	</g>
635</g>
636<g>
637	<g>
638		<path d="M362.088,236.353H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.62,5.368,11.988,11.988,11.988h212.175
639			c6.62,0,11.988-5.368,11.988-11.988C374.076,241.721,368.707,236.353,362.088,236.353z"/>
640	</g>
641</g>
642<g>
643	<g>
644		<path d="M362.088,308.691H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988h212.175
645			c6.62,0,11.988-5.367,11.988-11.988C374.076,314.06,368.707,308.691,362.088,308.691z"/>
646	</g>
647</g>
648<g>
649	<g>
650		<path d="M256,381.031H149.912c-6.62,0-11.988,5.368-11.988,11.988c0,6.621,5.368,11.988,11.988,11.988H256
651			c6.62,0,11.988-5.367,11.988-11.988C267.988,386.398,262.62,381.031,256,381.031z"/>
652	</g>
653</g>
654</svg>`,ec=function(){function e(){g(this,e)}return y(e,null,[{key:"createImage",value:function(t,n){var r=new Image;return r.src=t.src,ye.scrollDownOnImageLoad(r.src,n),ye.processContent("image",r,r.src,t.name)}
654},{key:"addNewImageMessage",value:function(){var i=k(f().mark(function n(r,a,o){var s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:s=e.createImage(a,r.elementRef),l=r.createNewMessageElement("",o),l.bubbleElement.appendChild(s),l.bubbleElement.classList.add("image-message"),ye.addMessage(r,l,"image",o);case 2:case"end":return c.stop()}},n)}));function t(n,r,a){return i.apply(this,arguments)}return t}()},{key:"createAudioElement",value:function(t,n){var r=document.createElement("audio");return r.src=t.src,r.classList.add("audio-player"),r.controls=!0,we.IS_SAFARI&&(r.classList.add("audio-player-safari"),r.classList.add(n===F.USER_ROLE?"audio-player-safari-right":"audio-player-safari-left")),r}},{key:"addNewAudioMessage",value:function(t,n,r){var a=e.createAudioElement(n,r),o=t.createNewMessageElement("",r);o.bubbleElement.appendChild(a),o.bubbleElement.classList.add("audio-message"),ye.addMessage(t,o,"audio",r)}},{key:"createAnyFile",value:function(t){var n=document.createElement("div");n.classList.add("any-file-message-contents");var r=document.createElement("div");r.classList.add("any-file-message-icon-container");var a=pe.createSVGElement(Qu);a.classList.add("any-file-message-icon"),r.appendChild(a);var o=document.createElement("div");return o.classList.add("any-file-message-text"),o.textContent=t.name||ye.DEFAULT_FILE_NAME,n.appendChild(r),n.appendChild(o),ye.processContent("any",n,t.src,o.textContent)}},{key:"addNewAnyFileMessage",value:function(t,n,r){var a=t.createNewMessageElement("",r),o=e.createAnyFile(n);a.bubbleElement.classList.add("any-file-message-bubble"),a.bubbleElement.appendChild(o),ye.addMessage(t,a,"file",r)}},{key:"addMessages",value:function(t,n,r){n.forEach(function(a){var o,s;a.ref&&(a=ye.removeFileRef(a)),a.type==="audio"||(o=a.src)!=null&&o.startsWith("data:audio")?e.addNewAudioMessage(t,a,r):a.type==="image"||(s=a.src)!=null&&s.startsWith("data:image")?e.addNewImageMessage(t,a,r):e.addNewAnyFileMessage(t,a,r)})}}]),e}(),tc=function(e){P(i,e);function i(t,n,r){var a;g(this,i);var o,s;a=O(this,i,[t]);var l=n.permittedErrorPrefixes,u=n.introPanelMarkUp,c=n.demo;return a._errorMessageOverrides=(o=t.errorMessages)==null?void 0:o.overrides,a._onClearMessages=At.onClearMessages.bind(de(a),t),a._onError=At.onError.bind(de(a),t),a._displayLoadingMessage=i.getDisplayLoadingMessage(t,n),a._permittedErrorPrefixes=l,a.addSetupMessageIfNeeded(t,n)||a.populateIntroPanel(r,u,t.introPanelStyle),a.addIntroductoryMessage(t,n),t.initialMessages&&a.populateInitialMessages(t.initialMessages),a._displayServiceErrorMessages=(s=t.errorMessages)==null?void 0:s.displayServiceErrorMessages,t.getMessages=function(){return JSON.parse(JSON.stringify(a.messages))},t.clearMessages=a.clearMessages.bind(de(a),n),t.refreshMessages=a.refreshTextMessages.bind(de(a)),t.scrollToBottom=he.scrollToBottom.bind(de(a),a.elementRef),t._addMessage=function(d,h){a.addNewMessage(V(V({},d),{},{sendUpdate:!!h}),!h)},n.isWebModel()&&n.setUpMessages(de(a)),c&&a.prepareDemo(c),t.textToSpeech&&xt.processConfig(t.textToSpeech,function(d){a.textToSpeech=d}),n.fetchHistory&&a.fetchHistory(n.fetchHistory),a}return y(i,[{key:"prepareDemo",value:function(n){R(n)=="object"&&(n.response&&(this.customDemoResponse=n.response),n.displayErrors&&(n.displayErrors.default&&this.addNewErrorMessage("",""),n.displayErrors.service&&this.addNewErrorMessage("service",""),n.displayErrors.speechToText&&this.addNewErrorMessage("speechToText","")),n.displayLoadingBubble&&this.addLoadingMessage())}},{key:"addSetupMessageIfNeeded",value:function(n,r){var a=Xu.getText(n,r);if(a){var o=this.createAndAppendNewMessageElement(a,F.AI_ROLE);this.applyCustomStyles(o,F.AI_ROLE,!1)}return!!a}},{key:"addIntroductoryMessage",value:function(n,r){var a,o;n!=null&&n.shadowRoot&&(this._introMessage=n.introMessage);var s=this._introMessage;if(r!=null&&r.isWebModel()&&((a=s)!==null&&a!==void 0||(s=r.getIntroMessage(s))),s){var l;s!=null&&s.text?l=this.createAndAppendNewMessageElement(s.text,F.AI_ROLE):s!=null&&s.html&&(l=Mn.add(this,s.html,F.AI_ROLE,this.messageElementRefs)),l&&(this.applyCustomStyles(l,F.AI_ROLE,!1,(o=this.messageStyles)==null?void 0:o.intro),l.outerContainer.classList.add("deep-chat-intro"))}}},{key:"removeIntroductoryMessage",value:function(){var n=this.messageElementRefs[0];n.outerContainer.classList.contains("deep-chat-intro")&&(n.outerContainer.remove(),this.messageElementRefs.shift())}},{key:"populateInitialMessages",value:function(n){var r=this;
654n.forEach(function(a){Re.processInitialMessageFile(a),r.addNewMessage(a,!0)}),setTimeout(function(){return he.scrollToBottom(r.elementRef)},0)}},{key:"fetchHistory",value:function(){var t=k(f().mark(function r(a){var o=this;return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,a();case 2:l.sent.forEach(function(u){u.error?o.addNewErrorMessage("service",u.error):o.addNewMessage(u,!0)}),setTimeout(function(){return he.scrollToBottom(o.elementRef)},0);case 4:case"end":return l.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"addNewMessage",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=i.createMessageContent(n),o={status:n.overwrite};if(!n.ignoreText&&a.text!==void 0&&n.text!==null&&(this.addNewTextMessage(a.text,a.role,o),!r&&this.textToSpeech&&a.role!==F.USER_ROLE&&xt.speak(a.text,this.textToSpeech)),a.files&&Array.isArray(a.files)&&ec.addMessages(this,a.files,a.role),a.html!==void 0&&a.html!==null){var s=Mn.add(this,a.html,a.role,this.messageElementRefs,o);Mt.isElementTemporary(s)&&delete a.html}this.isValidMessageContent(a)&&this.updateStateOnMessage(a,n.overwrite,n.sendUpdate,r)}},{key:"isValidMessageContent",value:function(n){return n.text||n.html||n.files&&n.files.length>0}},{key:"updateStateOnMessage",value:function(n,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;r||this.messages.push(n),a&&this.sendClientUpdate(n,o)}},{key:"removeMessageOnError",value:function(){var n=this.messageElementRefs[this.messageElementRefs.length-1],r=n==null?void 0:n.bubbleElement;(r!=null&&r.classList.contains(Pe.MESSAGE_CLASS)&&r.textContent===""||i.isTemporaryElement(n))&&this.removeLastMessage()}},{key:"addNewErrorMessage",value:function(n,r){var a,o,s,l,u;this.removeMessageOnError();var c=i.createBaseElements(),d=c.outerContainer,h=c.bubbleElement;h.classList.add("error-message-text");var p=this.getPermittedMessage(r)||((a=this._errorMessageOverrides)==null?void 0:a[n])||((o=this._errorMessageOverrides)==null?void 0:o.default)||"Error, please try again.";this.renderText(h,p);var m=Et.extractParticularSharedStyles(["fontSize","fontFamily"],(s=this.messageStyles)==null?void 0:s.default);Et.applyCustomStylesToElements(c,!1,m),Et.applyCustomStylesToElements(c,!1,(l=this.messageStyles)==null?void 0:l.error),this.elementRef.appendChild(d),he.scrollToBottom(this.elementRef),this.textToSpeech&&xt.speak(p,this.textToSpeech),(u=this._onError)==null||u.call(this,p)}},{key:"getPermittedMessage",value:function(n){if(n){if(this._displayServiceErrorMessages)return n;if(typeof n=="string"&&this._permittedErrorPrefixes){var r=i.checkPermittedErrorPrefixes(this._permittedErrorPrefixes,n);if(r)return r}else if(Array.isArray(n)&&this._permittedErrorPrefixes)for(var a=0;a<n.length;a+=1){var o=i.checkPermittedErrorPrefixes(this._permittedErrorPrefixes,n[a]);if(o)return o}}}},{key:"removeError",value:function(){this.isLastMessageError()&&F.getLastMessageElement(this.elementRef).remove()}},{key:"addLoadingMessage",value:function(){var n;if(this._displayLoadingMessage){var r=this.createMessageElements("",F.AI_ROLE),a=r.outerContainer,o=r.bubbleElement;o.classList.add("loading-message-text");var s=document.createElement("div");s.classList.add("dots-flashing"),o.appendChild(s),this.applyCustomStyles(r,F.AI_ROLE,!1,(n=this.messageStyles)==null?void 0:n.loading),Ju.set(o,this.messageStyles),this.elementRef.appendChild(a),he.scrollToBottom(this.elementRef)}}},{key:"populateIntroPanel",value:function(n,r,a){(n||r)&&(this._introPanel=new Zu(n,r,a),this._introPanel._elementRef&&(at.apply(this,this._introPanel._elementRef),this.elementRef.appendChild(this._introPanel._elementRef)))}},{key:"addMultipleFiles",value:function(){var t=k(f().mark(function r(a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.abrupt("return",Promise.all((a||[]).map(function(l){return new Promise(function(u){if(!l.type||l.type==="any"){var c=l.file.name||ye.DEFAULT_FILE_NAME;u({name:c,type:"any",ref:l.file})}else{var d=new FileReader;d.readAsDataURL(l.file),d.onload=function(){u({src:d.result,type:l.type,ref:l.file})}}})})));case 1:case"end":return s.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"clearMessages",value:function(n,r){var a,o,s=[];
654this.messageElementRefs.forEach(function(l){var u=l.bubbleElement.classList;u.contains("loading-message-text")||u.contains(Pe.MESSAGE_CLASS)?s.push(l):l.outerContainer.remove()}),Array.from(this.elementRef.children).forEach(function(l){var u,c=(u=l.children[0])==null?void 0:u.children[0];c!=null&&c.classList.contains("error-message-text")&&l.remove()}),this.messageElementRefs=s,r!==!1&&((a=this._introPanel)!=null&&a._elementRef&&this._introPanel.display(),this.addIntroductoryMessage()),this.messages.splice(0,this.messages.length),this.textElementsToText.splice(0,this.textElementsToText.length),(o=this._onClearMessages)==null||o.call(this),delete n.sessionId}}],[{key:"getDisplayLoadingMessage",value:function(n,r){var a;return r.websocket?!1:(a=n.displayLoadingBubble)!==null&&a!==void 0?a:!0}},{key:"checkPermittedErrorPrefixes",value:function(n,r){for(var a=0;a<n.length;a+=1)if(r.startsWith(n[a]))return r}}]),i}(Hi),dt=function(){function e(){g(this,e)}return y(e,null,[{key:"adjustInputPadding",value:function(t,n){n["inside-left"].length>0&&t.classList.add("text-input-inner-left-adjustment"),n["inside-right"].length>0&&t.classList.add("text-input-inner-right-adjustment")}},{key:"adjustForOutsideButton",value:function(t,n,r){r["outside-right"].length===0&&r["outside-left"].length>0?(t[0].classList.add(e.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS),n.classList.add(e.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)):r["outside-left"].length===0&&r["outside-right"].length>0&&(t[3].classList.add(e.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS),n.classList.add(e.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS))}},{key:"adjustOutsideSubmit",value:function(t,n,r){if(!(r["inside-left"].length>0||r["inside-right"].length>0)){if(r["outside-right"].length===0&&r["outside-left"].length>0)return t[0].classList.add(e.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS),n.classList.add(e.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS),r["outside-left"].map(function(a){return a.button.elementRef.classList.add("submit-button-enlarged")});if(r["outside-left"].length===0&&r["outside-right"].length>0)return t[3].classList.add(e.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS),n.classList.add(e.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS),r["outside-right"].map(function(a){return a.button.elementRef.classList.add("submit-button-enlarged")})}}},{key:"set",value:function(t,n,r,a){e.adjustOutsideSubmit(n,r,a)||e.adjustForOutsideButton(n,r,a),e.adjustInputPadding(t,a)}}]),e}();dt.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS="text-input-container-left-adjustment";dt.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS="text-input-container-right-adjustment";dt.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS="text-input-container-left-small-adjustment";dt.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS="text-input-container-right-small-adjustment";var nc=dt,It=function(){function e(){g(this,e)}return y(e,null,[{key:"create",value:function(){return Array.from({length:4}).map(function(t,n){var r=document.createElement("div");return r.classList.add("input-button-container"),(n===0||n===3)&&r.classList.add("outer-button-container"),(n===1||n===2)&&r.classList.add("inner-button-container"),r})}},{key:"add",value:function(t,n){t.insertBefore(n[1],t.firstChild),t.insertBefore(n[0],t.firstChild),t.appendChild(n[2]),t.appendChild(n[3])}},{key:"getContainerIndex",value:function(t){return t==="outside-left"?0:t==="inside-left"?1:t==="inside-right"?2:3}},{key:"addButton",value:function(t,n,r){n.classList.add(r);var a=e.getContainerIndex(r);t[a].appendChild(n),a===3&&n.classList.add("outside-right")}}]),e}(),qr=["camera","gifs","images","audio","mixedFiles","submit","microphone"],Je=function(){function e(){g(this,e)}return y(e,null,[{key:"createTextElement",value:function(t){var n=document.createElement("div");return n.classList.add("text-button"),n.innerText=t,n}},{key:"createElement",value:function(t,n){return n?e.createTextElement(t):pe.createSVGElement(t)}},{key:"createCustomElement",value:function(t,n){var r,a,o,s,l=n==null?void 0:n[t];if((r=l==null?void 0:l.text)!=null&&r.content)return e.createElement((a=l==null?void 0:l.text)==null?void 0:a.content,!0);if((o=l==null?void 0:l.svg)!=null&&o.content)return e.createElement((s=l==null?void 0:l.svg)==null?void 0:s.content,!1)}},{key:"processElement",value:function(t,n){n!=null&&n.classList.contains("text-button")||t.classList.add("input-button-svg")}},{key:"createSpecificStateElement",value:function(t,n,r){var a;return r&&(a=e.createCustomElement(n,r)),e.processElement(t,a),a}},{key:"create",value:function(t,n,r){var a={};if(!r)return e.processElement(t),a;var o=e.createSpecificStateElement(t,n[0],r);a[n[0]]=o;var s=o;
654return n.slice(1).forEach(function(l){s=e.createCustomElement(l,r)||s,a[l]=s}),a}}]),e}(),rc=`<?xml version="1.0" encoding="utf-8"?>
655<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg">
656    <path d="M16 0c-8.836 0-16 7.163-16 16s7.163 16 16 16c8.837 0 16-7.163 16-16s-7.163-16-16-16zM16 30.032c-7.72 0-14-6.312-14-14.032s6.28-14 14-14 14 6.28 14 14-6.28 14.032-14 14.032zM23 15h-6v-6c0-0.552-0.448-1-1-1s-1 0.448-1 1v6h-6c-0.552 0-1 0.448-1 1s0.448 1 1 1h6v6c0 0.552 0.448 1 1 1s1-0.448 1-1v-6h6c0.552 0 1-0.448 1-1s-0.448-1-1-1z"></path>
657</svg>`,Ie=function(){function e(){g(this,e)}return y(e,null,[{key:"unsetAllCSS",value:function(t,n){var r,a;n.container&&ie.unsetAllCSSMouseStates(t,n.container),(r=n.svg)!=null&&r.styles&&ie.unsetAllCSSMouseStates(t.children[0],n.svg.styles),(a=n.text)!=null&&a.styles&&ie.unsetAllCSSMouseStates(t.children[0],n.text.styles)}},{key:"unsetActionCSS",value:function(t,n){var r,a;n.container&&ie.unsetActivityCSSMouseStates(t,n.container),(r=n.svg)!=null&&r.styles&&ie.unsetActivityCSSMouseStates(t.children[0],n.svg.styles),(a=n.text)!=null&&a.styles&&ie.unsetActivityCSSMouseStates(t.children[0],n.text.styles)}},{key:"setElementsCSS",value:function(t,n,r){var a,o,s,l,u;Object.assign(t.style,(a=n.container)==null?void 0:a[r]),Object.assign(t.children[0].style,(s=(o=n.svg)==null?void 0:o.styles)==null?void 0:s[r]),Object.assign(t.children[0].style,(u=(l=n.text)==null?void 0:l.styles)==null?void 0:u[r])}},{key:"setElementCssUpToState",value:function(t,n,r){e.setElementsCSS(t,n,"default"),r!=="default"&&(e.setElementsCSS(t,n,"hover"),r!=="hover"&&e.setElementsCSS(t,n,"click"))}}]),e}(),ht=function(){function e(i,t,n,r){g(this,e),this._mouseState={state:"default"},this.elementRef=i,this._customStyles=n,this.position=t,this.dropupText=r}return y(e,[{key:"buttonMouseLeave",value:function(t){this._mouseState.state="default",t&&(Ie.unsetAllCSS(this.elementRef,t),Ie.setElementsCSS(this.elementRef,t,"default"))}},{key:"buttonMouseEnter",value:function(t){this._mouseState.state="hover",t&&Ie.setElementsCSS(this.elementRef,t,"hover")}},{key:"buttonMouseUp",value:function(t){t&&Ie.unsetActionCSS(this.elementRef,t),this.buttonMouseEnter(t)}},{key:"buttonMouseDown",value:function(t){this._mouseState.state="click",t&&Ie.setElementsCSS(this.elementRef,t,"click")}},{key:"setEvents",value:function(t){this.elementRef.onmousedown=this.buttonMouseDown.bind(this,t),this.elementRef.onmouseup=this.buttonMouseUp.bind(this,t),this.elementRef.onmouseenter=this.buttonMouseEnter.bind(this,t),this.elementRef.onmouseleave=this.buttonMouseLeave.bind(this,t)}},{key:"unsetCustomStateStyles",value:function(t){if(this._customStyles)for(var n=0;n<t.length;n+=1){var r=t[n],a=r&&this._customStyles[r];a&&Ie.unsetActionCSS(this.elementRef,a)}}},{key:"reapplyStateStyle",value:function(t,n){if(this._customStyles){n&&this.unsetCustomStateStyles(n);var r=this._customStyles[t];r&&Ie.setElementCssUpToState(this.elementRef,r,this._mouseState.state),this.setEvents(r)}}}]),e}(),Ur=function(){function e(){g(this,e)}return y(e,null,[{key:"focusItemWhenOnEdge",value:function(t,n){var r=n?t.children[0]:t.children[t.children.length-1];e.focusSiblingItem(r,t,n,!0)}},{key:"focusSiblingItem",value:function(t,n,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=a?t:t[r?"nextSibling":"previousSibling"];o?(t.dispatchEvent(new MouseEvent("mouseleave")),o.dispatchEvent(new MouseEvent("mouseenter"))):(t.dispatchEvent(new MouseEvent("mouseleave")),e.focusItemWhenOnEdge(n,r))}}]),e}(),ic=function(){function e(){g(this,e)}return y(e,null,[{key:"addItemEvents",value:function(t,n,r,a){Li.add(n,a),n.addEventListener("click",function(){r.click()}),n.addEventListener("mouseenter",function(o){t.highlightedItem=o.target}),n.addEventListener("mouseleave",function(){t.highlightedItem=void 0})}},{key:"createItemText",value:function(t,n){var r=document.createElement("div");return Object.assign(r.style,n),r.classList.add("dropup-menu-item-text"),r.textContent=t||"File",r}},{key:"createItemIcon",value:function(t,n){var r=document.createElement("div");return Object.assign(r.style,n),r.classList.add("dropup-menu-item-icon"),r.appendChild(t.children[0]),r}},{key:"populateItem",value:function(t,n,r,a){var o=t.children[0];o.classList.contains("text-button")?n.appendChild(e.createItemText(o.textContent,a==null?void 0:a.text)):(n.appendChild(e.createItemIcon(t,a==null?void 0:a.iconContainer)),n.appendChild(e.createItemText(r,a==null?void 0:a.text)))}},{key:"createItem",value:function(t,n,r){var a,o=n.elementRef,s=n.dropupText,l=document.createElement("div");Object.assign(l.style,(a=r==null?void 0:r.item)==null?void 0:a.default),e.populateItem(o,l,s,r),l.classList.add("dropup-menu-item");var u=ie.processStateful((r==null?void 0:r.item)||{},{backgroundColor:"#f3f3f3"},{backgroundColor:"#ebebeb"});return e.addItemEvents(t,l,o,u),l}}]),e}(),ac=function(){function e(i,t){var n=this;g(this,e);var r;this._isOpen=!0,this._styles=t,this.elementRef=e.createElement((r=this._styles)==null?void 0:r.container),this.close(),setTimeout(function(){return n.addWindowEvents(i)})}return y(e,[{key:"open",value:function(){this.elementRef.style.display="block",this._isOpen=!0}},{key:"close",value:function(){this._isOpen&&(this.elementRef.style.display="none",this._isOpen=!1)}},{key:"toggle",value:function(){this._isOpen?this.close():this.open()}},{key:"addItem",value:function(t){var n=ic.createItem(this,t,this._styles);this.elementRef.appendChild(n)}},{key:"addWindowEvents",value:function(t){this.clickEvent=this.windowClick.bind(this,t),window.addEventListener("click",this.clickEvent),this.keyDownEvent=this.windowKeyDown.bind(this,t),window.addEventListener("keydown",this.keyDownEvent)}},{key:"windowClick",value:function(t,n){var r;!t.isConnected&&this.clickEvent?window.removeEventListener("click",this.clickEvent):t.parentElement!==((r=n.target.shadowRoot)==null?void 0:r.children[0])&&this.close()}},{key:"windowKeyDown",value:function(t,n){var r,a,o;!t.isConnected&&this.keyDownEvent?window.removeEventListener("keydown",this.keyDownEvent):this._isOpen&&(n.key===ne.ESCAPE?(this.close(),(r=this.highlightedItem)==null||r.dispatchEvent(new MouseEvent("mouseleave"))):n.key===ne.ENTER?((a=this.highlightedItem)==null||a.click(),(
657o=this.highlightedItem)==null||o.dispatchEvent(new MouseEvent("mouseleave"))):n.key===ne.ARROW_DOWN?Ur.focusSiblingItem(this.highlightedItem||this.elementRef.children[this.elementRef.children.length-1],this.elementRef,!0):n.key===ne.ARROW_UP&&Ur.focusSiblingItem(this.highlightedItem||this.elementRef.children[0],this.elementRef,!1))}}],[{key:"createElement",value:function(t){var n=document.createElement("div");return n.id="dropup-menu",Object.assign(n.style,t),n}}]),e}(),zr=function(e){P(i,e);function i(t,n){var r;g(this,i);var a;r=O(this,i,[i.createButtonElement(),void 0,{styles:(a=n==null?void 0:n.button)==null?void 0:a.styles}]);var o=r.createInnerElements(r._customStyles);return r._menu=new ac(t,n==null?void 0:n.menu),r.addClickEvent(),r.buttonContainer=i.createButtonContainer(),r.elementRef.appendChild(o.styles),r.buttonContainer.appendChild(r.elementRef),r.elementRef.classList.add("dropup-icon","upload-file-button"),r.elementRef.children[0].id="dropup-icon",r.buttonContainer.appendChild(r._menu.elementRef),r.reapplyStateStyle("styles"),r.addContainerEvents(t),r}return y(i,[{key:"createInnerElements",value:function(n){return{styles:this.createInnerElement(i.createSVGIconElement(),"styles",n)}}},{key:"createInnerElement",value:function(n,r,a){return Je.createSpecificStateElement(this.elementRef,r,a)||n}},{key:"addClickEvent",value:function(){this.elementRef.onclick=this._menu.toggle.bind(this._menu)}},{key:"addItem",value:function(n){this._menu.addItem(n)}},{key:"addContainerEvents",value:function(n){var r=this;n.addEventListener("click",function(a){a.target.classList.contains("dropup-icon")||r._menu.close()})}}],[{key:"createButtonElement",value:function(){var n=document.createElement("div");return n.classList.add("input-button"),n}},{key:"createSVGIconElement",value:function(){return pe.createSVGElement(rc)}},{key:"createButtonContainer",value:function(){var n=document.createElement("div");return n.id="dropup-container",n}},{key:"getPosition",value:function(n,r){var a,o;return(a=r==null?void 0:r.button)!=null&&a.position?(o=r==null?void 0:r.button)==null?void 0:o.position:n["outside-left"].length>0&&n["outside-right"].length===0?"outside-right":"outside-left"}}]),i}(ht),oc=function(){function e(){g(this,e)}return y(e,null,[{key:"addToDropup",value:function(t,n,r,a){var o=new zr(r,a);qr.forEach(function(l){var u=n["dropup-menu"].findIndex(function(d){return d.buttonType===l}),c=n["dropup-menu"][u];c&&(o.addItem(c.button),n["dropup-menu"].splice(u,1))});var s=zr.getPosition(n,a);It.addButton(t,o.buttonContainer,s),n[s].push({})}},{key:"addToSideContainer",value:function(t,n){["inside-left","inside-right","outside-left","outside-right"].forEach(function(r){var a=r;n[a].forEach(function(o){It.addButton(t,o.button.elementRef,a)})})}},{key:"setPosition",value:function(t,n,r){var a=V(V({},t[n]),{},{buttonType:n});r.push(a),delete t[n]}},{key:"createPositionsObj",value:function(){return{"dropup-menu":[],"outside-left":[],"inside-left":[],"inside-right":[],"outside-right":[]}}},{key:"generatePositions",value:function(t){var n=e.createPositionsObj();Object.keys(t).forEach(function(a){var o,s=(o=t[a])==null?void 0:o.button.position;s&&e.setPosition(t,a,n[s])}),n["inside-right"].length===0&&t.submit&&e.setPosition(t,"submit",n["inside-right"]),n["outside-right"].length===0&&(t.submit?e.setPosition(t,"submit",n["outside-right"]):t.microphone?e.setPosition(t,"microphone",n["outside-right"]):t.camera&&e.setPosition(t,"camera",n["outside-right"])),t.submit&&e.setPosition(t,"submit",n["outside-left"].length===0?n["outside-left"]:n["inside-right"]),t.microphone&&e.setPosition(t,"microphone",n["outside-left"].length===0?n["outside-left"]:n["inside-right"]);var r=Object.keys(t);return r.length>1||n["dropup-menu"].length>0?qr.forEach(function(a){t[a]&&n["dropup-menu"].push(V(V({},t[a]),{},{buttonType:a}))}):r.length===1&&e.setPosition(t,r[0],n["outside-right"].length===0?n["outside-right"]:n["outside-left"]),n}},{key:"addButtons",value:function(t,n,r,a){var o=e.generatePositions(n);return e.addToSideContainer(t,o),o["dropup-menu"].length>0&&e.addToDropup(t,o,r,a),o}}]),e}(),sc=`<?xml version="1.0" encoding="utf-8"?>
658<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
659<title>file</title>
660<path d="M20 10.9696L11.9628 18.5497C10.9782 19.4783 9.64274 20 8.25028 20C6.85782 20 5.52239 19.4783 4.53777 18.5497C3.55315 17.6211 3 16.3616 3 15.0483C3 13.7351 3.55315 12.4756 4.53777 11.547L12.575 3.96687C13.2314 3.34779 14.1217 3 15.05 3C15.9783 3 16.8686 3.34779 17.525 3.96687C18.1814 4.58595 18.5502 5.4256 18.5502 6.30111C18.5502 7.17662 18.1814 8.01628 17.525 8.63535L9.47904 16.2154C9.15083 16.525 8.70569 16.6989 8.24154 16.6989C7.77738 16.6989 7.33224 16.525 7.00403 16.2154C6.67583 15.9059 6.49144 15.4861 6.49144 15.0483C6.49144 14.6106 6.67583 14.1907 7.00403 13.8812L14.429 6.88674" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
661</svg>`,lc=`<?xml version="1.0" encoding="utf-8"?>
662<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
663  <path d="M20,15.2928932 L20,5.5 C20,4.67157288 19.3284271,4 18.5,4 L5.5,4 C4.67157288,4 4,4.67157288 4,5.5 L4,12.2928932 L7.14644661,9.14644661 C7.34170876,8.95118446 7.65829124,8.95118446 7.85355339,9.14644661 L13.5,14.7928932 L16.1464466,12.1464466 C16.3417088,11.9511845 16.6582912,11.9511845 16.8535534,12.1464466 L20,15.2928932 Z M20,16.7071068 L16.5,13.2071068 L13.8535534,15.8535534 C13.6582912,16.0488155 13.3417088,16.0488155 13.1464466,15.8535534 L7.5,10.2071068 L4,13.7071068 L4,18.5 C4,19.3284271 4.67157288,20 5.5,20 L18.5,20 C19.3284271,20 20,19.3284271 20,18.5 L20,16.7071068 Z M3,5.5 C3,4.11928813 4.11928813,3 5.5,3 L18.5,3 C19.8807119,3 21,4.11928813 21,5.5 L21,18.5 C21,19.8807119 19.8807119,21 18.5,21 L5.5,21 C4.11928813,21 3,19.8807119 3,18.5 L3,5.5 Z M15,6 L1
6637,6 C17.5522847,6 18,6.44771525 18,7 L18,9 C18,9.55228475 17.5522847,10 17,10 L15,10 C14.4477153,10 14,9.55228475 14,9 L14,7 C14,6.44771525 14.4477153,6 15,6 Z M15,7 L15,9 L17,9 L17,7 L15,7 Z"/>
664</svg>
665`,uc=`<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-49.49 -49.49 593.87 593.87" stroke-width="3.95908" transform="rotate(0)">
666  <g stroke-width="0"></g>
667  <g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.98977"></g>
668  <g>
669    <g>
670      <g>
671        <path d="M163.205,76.413v293.301c-3.434-3.058-7.241-5.867-11.486-8.339c-21.38-12.452-49.663-15.298-77.567-7.846 c-49.038,13.096-80.904,54.519-71.038,92.337c4.019,15.404,14.188,28.221,29.404,37.087c13.553,7.894,29.87,11.933,47.115,11.933 c9.962,0,20.231-1.356,30.447-4.087c42.74-11.406,72.411-44.344,72.807-77.654h0.011v-0.162c0.002-0.166,0-0.331,0-0.496V187.072 l290.971-67.3v178.082c-3.433-3.055-7.238-5.863-11.481-8.334c-21.385-12.452-49.654-15.308-77.567-7.846 c-49.038,13.087-80.904,54.519-71.038,92.356c4.019,15.385,14.183,28.212,29.404,37.067c13.548,7.894,29.875,11.933,47.115,11.933 c9.962,0,20.231-1.356,30.452-4.087c42.74-11.413,72.411-44.346,72.804-77.654h0.004v-0.065c0.003-0.236,0.001-0.469,0-0.704V0 L163.205,76.413z M104.999,471.779c-22.543,6.038-45.942,3.846-62.572-5.846c-10.587-6.163-17.591-14.817-20.255-25.038 c-7.144-27.375,18.452-58.029,57.062-68.346c8.409-2.25,16.938-3.346,25.188-3.346c13.87,0,26.962,3.115,37.389,9.192 c10.587,6.163,17.591,14.817,20.255,25.029c0.809,3.102,1.142,6.248,1.139,9.4v0.321h0.014 C162.99,437.714,139.082,462.678,104.999,471.779z M182.898,166.853V92.067l290.971-67.298v74.784L182.898,166.853z M415.677,399.923c-22.558,6.038-45.942,3.837-62.587-5.846c-10.587-6.163-17.587-14.817-20.25-25.019 c-7.144-27.385,18.452-58.058,57.058-68.365c8.414-2.25,16.942-3.346,25.192-3.346c13.875,0,26.962,3.115,37.385,9.192 c10.596,6.163,17.596,14.817,20.26,25.029v0.01c0.796,3.05,1.124,6.144,1.135,9.244v0.468h0.02 C473.668,365.851,449.763,390.814,415.677,399.923z">
672        </path>
673      </g>
674    </g>
675  </g>
676</svg>`,cc=`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
677<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 5.9266752 5.6408391" height="21.31971" width="22.4">
678  <g>
679    <path d="m 5.2564627,1.548212 c -3.1136005,-0.4796804 -1.5568006,-0.2398402 0,0 z M 2.0001198,2.0922063 c 0.1556781,0 0.2657489,0.020893 0.3917849,0.080366 0.081154,0.038347 0.1153492,0.134065 0.076377,0.2138602 -0.038973,0.07979 -0.1363527,0.1134129 -0.2175069,0.075091 -0.078199,-0.036919 -0.1407455,-0.048792 -0.250655,-0.048792 -0.2260486,0 -0.3921482,0.2042182 -0.3921482,0.4801409 0,0.2761822 0.1663188,0.4810688 0.3921482,0.4810688 0.1117901,0 0.2064255,-0.046133 0.255659,-0.1284198 l 0.00162,-0.00389 V 3.0534032 l -0.098011,1.75e-4 c -0.081844,0 -0.1495979,-0.059305 -0.1612403,-0.1365887 l -0.00175,-0.023683 c 0,-0.08047 0.060311,-0.1470874 0.1389194,-0.1585331 l 0.024085,-0.00195 h 0.2612303 c 0.081842,0 0.149598,0.059305 0.1612404,0.1365891 l 0.00175,0.023683 -3.398e-4,0.3968809 v 0 l -0.00168,0.014211 v 0 l -0.00553,0.023034 v 0 l -0.00532,0.014145 c -0.098178,0.22826 -0.3236506,0.3528713 -0.5706303,0.3528713 -0.4240855,0 -0.7181621,-0.3622714 -0.7181621,-0.8016063 0,-0.4391857 0.2940275,-0.8006848 0.7181621,-0.8006848 z m 1.2034759,0.031275 c 0.081843,0 0.1495977,0.059305 0.1612403,0.1365891 l 0.00175,0.023683 v 1.2211775 c 0,0.088516 -0.07298,0.1602721 -0.1630073,0.1602721 -0.081841,0 -0.1495972,-0.059305 -0.1612397,-0.1365892 L 3.040589,3.5049308 V 2.2837527 c 0,-0.088516 0.07298,-0.1602721 0.1630067,-0.1602714 z m 0.7813442,0 0.5209469,0.00195 c 0.090025,3.048e-4 0.1627543,0.072306 0.1624458,0.1608234 -2.809e-4,0.08047 -0.06083,0.1468798 -0.1394772,0.158066 l -0.024092,0.00195 -0.3575326,-0.0013 v 0.4497782 l 0.2928918,2.27e-4 c 0.081842,0 0.1495979,0.059305 0.1612403,0.136589 l 0.00175,0.023683 c 0,0.080469 -0.06031,0.1470871 -0.1389193,0.1585393 l -0.024092,0.00195 -0.2928919,-2.336e-4 1.563e-4,0.2860316 c 0,0.080471 -0.06031,0.1470873 -0.1389193,0.1585395 l -0.024085,0.00195 c -0.081843,0 -0.1495979,-0.059305 -0.1612403,-0.1365826 l -0.00175,-0.023691 V 2.2841354 c 2.798e-4,-0.08047 0.060829,-0.1468797 0.1394758,-0.1580594 z"/>
680    <path d="m 5.0894191,1.0943261 c 0,-0.21918999 -0.177687,-0.39686999 -0.396876,-0.39686999 h -3.43959 c -0.2191879,0 -0.391262,0.1777519 -0.3968759,0.39686999 l -0.027082,3.4379266 c 0.040152,0.2939927 0.4235456,0.409415 0.4235456,0.409415 l 3.4785583,-0.00851 c 0,0 0.3008506,-0.1402998 0.3236271,-0.4201576 0.042911,-0.5272495 0.034693,-1.6106146 0.034693,-3.4186761 z m -4.49792494,0 c 0,-0.36530999 0.29614504,-0.66145999 0.66145894,-0.66145999 h 3.43959 c 0.365314,0 0.66146,0.29615 0.66146,0.66145999 v 3.43959 c 0,0.36532 -0.296146,0.66146 -0.66146,0.66146 h -3.43959 c -0.3653139,0 -0.66145894,-0.29614 -0.66145894,-0.66146 z"/>
680
681  </g>
682</svg>
683`,dc={images:{id:"upload-images-icon",svgString:lc,dropupText:"Image"},gifs:{id:"upload-gifs-icon",svgString:cc,dropupText:"GIF"},audio:{id:"upload-audio-icon",svgString:uc,dropupText:"Audio"},mixedFiles:{id:"upload-mixed-files-icon",svgString:sc,dropupText:"File"}},rr=function(){function e(i,t,n,r){var a=this;g(this,e),this._attachments=[],this._fileCountLimit=99,this._acceptedFormat="",t.maxNumberOfFiles&&(this._fileCountLimit=t.maxNumberOfFiles),this._toggleContainerDisplay=n,this._fileAttachmentsContainerRef=r,t.acceptedFormats&&(this._acceptedFormat=t.acceptedFormats),setTimeout(function(){a._validationHandler=i._validationHandler})}return y(e,[{key:"attemptAddFile",value:function(t,n){return e.isFileTypeValid(t,this._acceptedFormat)?(this.addAttachmentBasedOnType(t,n,!0),!0):!1}},{key:"addAttachmentBasedOnType",value:function(t,n,r){var a=e.getTypeFromBlob(t);if(a==="image"){var o=e.createImageAttachment(n);this.addFileAttachment(t,"image",o,r)}else if(a==="audio"){var s=On.createAudioAttachment(n);this.addFileAttachment(t,"audio",s,r)}else{var l=e.createAnyFileAttachment(t.name);this.addFileAttachment(t,"any",l,r)}}},{key:"addFileAttachment",value:function(t,n,r,a){var o,s=e.createContainer(r);if(this._attachments.length>=this._fileCountLimit){var l=this._attachments[this._attachments.length-1].removeButton;l==null||l.click();var u=this._fileAttachmentsContainerRef.children;this._fileAttachmentsContainerRef.insertBefore(s,u[0])}else this._fileAttachmentsContainerRef.appendChild(s);var c={file:t,attachmentContainerElement:s,fileType:n};return a&&(c.removeButton=this.createRemoveAttachmentButton(c),s.appendChild(c.removeButton)),this._toggleContainerDisplay(!0),this._attachments.push(c),this._fileAttachmentsContainerRef.scrollTop=this._fileAttachmentsContainerRef.scrollHeight,(o=this._validationHandler)==null||o.call(this),c}},{key:"createRemoveAttachmentButton",value:function(t){var n=document.createElement("div");n.classList.add("remove-file-attachment-button"),n.onclick=this.removeAttachment.bind(this,t);var r=document.createElement("div");return r.classList.add("x-icon"),r.innerText="×",n.appendChild(r),n}},{key:"removeAttachment",value:function(t){var n,r=this._attachments.findIndex(function(o){return o===t}),a=this._attachments[r].attachmentContainerElement;this._attachments.splice(r,1),On.stopAttachmentPlayback(a),a.remove(),this._toggleContainerDisplay(!1),(n=this._validationHandler)==null||n.call(this)}},{key:"getFiles",value:function(){return Array.from(this._attachments).map(function(t){return{file:t.file,type:t.fileType}})}},{key:"removeAllAttachments",value:function(){this._attachments.forEach(function(t){setTimeout(function(){var n;return(n=t.removeButton)==null?void 0:n.click()})})}}],[{key:"isFileTypeValid",value:function(t,n){if(n==="")return!0;for(var r=n.split(","),a=0;a<r.length;a++){var o=r[a].trim();if(t.type===o)return!0;if(o.startsWith(".")){var s=o.slice(1);if(t.name.endsWith(s))return!0}else if(t.name.endsWith(o)||o.endsWith("/*")&&t.type.startsWith(o.slice(0,-2)))return!0}return!1}},{key:"getTypeFromBlob",value:function(t){var n=t.type;return n.startsWith("image")?"image":n.startsWith("audio")?"audio":"any"}},{key:"createImageAttachment",value:function(t){var n=new Image;return n.src=t,n.classList.add("image-attachment"),n}},{key:"createAnyFileAttachment",value:function(t){var n=document.createElement("div");n.classList.add("border-bound-attachment"),we.IS_SAFARI&&n.classList.add("border-bound-attachment-safari");var r=document.createElement("div");r.classList.add("any-file-attachment-text");var a=document.createElement("div");return a.classList.add("file-attachment-text-container"),a.appendChild(r),r.textContent=t,n.appendChild(a),n}},{key:"createContainer",value:function(t){var n=document.createElement("div");return n.classList.add("file-attachment"),n.appendChild(t),n}}]),e}(),hc=`<?xml version="1.0" encoding="utf-8"?>
684<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg">
685  <title>play</title>
686  <path d="M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z"></path>
687</svg>`,Hr=`<?xml version="1.0" encoding="utf-8"?>
688<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg">
689<title>stop</title>
690<path d="M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z"></path>
691</svg>`,Qi=function(e){P(i,e);function i(t,n,r,a){return g(this,i),O(this,i,[t,n,r,a])}return y(i,[{key:"createTimer",value:function(n,r){var a=this,o=0,s=r!==void 0&&r<i.TIMER_LIMIT_S?r:i.TIMER_LIMIT_S;return setInterval(function(){var l;o+=1,o===s&&((l=a.stopPlaceholderCallback)==null||l.call(a),a.clearTimer()),o===600&&n.classList.add("audio-placeholder-text-4-digits");var u=Math.floor(o/60),c=(o%60).toString().padStart(2,"0");n.textContent="".concat(u,":").concat(c)},1e3)}},{key:"createPlaceholderAudioAttachment",value:function(n){var r=i.createAudioContainer(),a=document.createElement("div");a.classList.add("audio-placeholder-text-3-digits");var o=document.createElement("div");o.classList.add("file-attachment-text-container","audio-placeholder-text-3-digits-container"),o.appendChild(a);var s=pe.createSVGElement(Hr);return s.classList.add("attachment-icon","stop-icon","not-removable-attachment-icon"),a.textContent="0:00",this._activePlaceholderTimer=this.createTimer(a,n),r.appendChild(o),this.addPlaceholderAudioAttachmentEvents(r,s,o),r}},{key:"addPlaceholderAudioAttachmentEvents",value:function(n,r,a){var o=this,s=function(){return n.replaceChildren(r)};n.addEventListener("mouseenter",s);var l=function(){return n.replaceChildren(a)};n.addEventListener("mouseleave",l);var u=function(){var d;return(d=o.stopPlaceholderCallback)==null?void 0:d.call(o)};n.addEventListener("click",u)}},{key:"addPlaceholderAttachment",value:function(n,r){var a=this.createPlaceholderAudioAttachment(r);this._activePlaceholderAttachment=this.addFileAttachment(new File([],""),"audio",a,!1),this.stopPlaceholderCallback=n}},{key:"completePlaceholderAttachment",value:function(n,r){var a=this._activePlaceholderAttachment;a&&(a.file=n,i.addAudioElements(a.attachmentContainerElement.children[0],r),a.removeButton=this.createRemoveAttachmentButton(a),a.attachmentContainerElement.appendChild(a.removeButton),this._activePlaceholderAttachment=void 0,this.clearTimer())}},{key:"removePlaceholderAttachment",value:function(){this._activePlaceholderAttachment&&(this.removeAttachment(this._activePlaceholderAttachment),this._activePlaceholderAttachment=void 0,this.clearTimer())}},{key:"clearTimer",value:function(){this._activePlaceholderTimer!==void 0&&(clearInterval(this._activePlaceholderTimer),this._activePlaceholderTimer=void 0,this.stopPlaceholderCallback=void 0)}}],[{key:"createAudioContainer",value:function(){var n=document.createElement("div");return n.classList.add("border-bound-attachment","audio-attachment-icon-container"),we.IS_SAFARI&&n.classList.add("border-bound-attachment-safari"),n}},{key:"addAudioElements",value:function(n,r){var a=n.parentElement?he.cloneElement(n):n,o=document.createElement("audio");o.src=r;var s=pe.createSVGElement(hc);s.classList.add("attachment-icon","play-icon");var l=pe.createSVGElement(Hr);l.classList.add("attachment-icon","stop-icon"),a.replaceChildren(s),o.onplay=function(){a.replaceChildren(l)},o.onpause=function(){a.replaceChildren(s),o.currentTime=0},o.onended=function(){a.replaceChildren(s)},a.onclick=function(){o.paused?o.play():o.pause()}}},{key:"createAudioAttachment",value:function(n){var r=i.createAudioContainer();return i.addAudioElements(r,n),r}},{key:"stopAttachmentPlayback",value:function(n){var r,a,o;(o=(a=(r=n.children[0])==null?void 0:r.children)==null?void 0:a[0])!=null&&o.classList.contains("stop-icon")&&n.children[0].click()}}]),i}(rr);Qi.TIMER_LIMIT_S=5999;var On=Qi,pc=function(){function e(){g(this,e)}return y(e,null,[{key:"create",value:function(t,n,r,a,o){return o==="audio"?new On(t,n,r,a):new rr(t,n,r,a)}}]),e}(),ir=function(){function e(i,t,n){g(this,e),this._fileAttachmentsTypes=[],this.elementRef=this.createAttachmentContainer();var r=R(n)=="object"&&!!n.displayFileAttachmentContainer;this.toggleContainerDisplay(r),i.appendChild(this.elementRef),t&&Object.assign(this.elementRef.style,t)}return y(e,[{key:"addType",value:function(t,n,r){var a=pc.create(t,n,this.toggleContainerDisplay.bind(this),this.elementRef,r);return this._fileAttachmentsTypes.push(a),a}},{key:"createAttachmentContainer",value:function(){var t=document.createElement("div");return t.id="file-attachment-container",t}},{key:"toggleContainerDisplay",value:function(t){t?this.elementRef.style.display="block":this.elementRef.children.length===0&&(this.elementRef.style.display="none")}},{key:"getAllFileData",value:function(){var t=this._fileAttachmentsTypes.map(function(n){return n.getFiles()}).flat();return t.length>0?t:void 0}},{key:"completePlaceholders",value:function(){var i=k(f().mark(function n(){return f().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,Promise.all(this._fileAttachmentsTypes.map(function(){var o=k(f().mark(function s(l){var u;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.abrupt("return",(u=l.stopPlaceholderCallback)==null?void 0:u.call(l));case 1:case"end":return d.stop()}},s)}));return function(s){return o.apply(this,arguments)}}()));case 2:case"end":return a.stop()}},n,this)}));function t(){return i.apply(this,arguments)}return t}()},{key:"addFilesToAnyType",value:function(t){e.addFilesToType(t,this._fileAttachmentsTypes)}},{key:"removeAllFiles",value:function(){this._fileAttachmentsTypes.forEac
691h(function(t){return t.removeAllAttachments()}),this.elementRef.replaceChildren(),this.toggleContainerDisplay(!1)}},{key:"getNumberOfTypes",value:function(){return this._fileAttachmentsTypes.length}}],[{key:"addFilesToType",value:function(t,n){t.forEach(function(r){var a=new FileReader;a.readAsDataURL(r),a.onload=function(o){for(var s=0;s<n.length&&!n[s].attemptAddFile(r,o.target.result);s+=1);}})}}]),e}(),ea=function(){function e(i,t,n){g(this,e),this._isOpen=!1,this._contentRef=e.createModalContent(t,n==null?void 0:n.backgroundColor),this._buttonPanel=e.createButtonPanel(n==null?void 0:n.backgroundColor),this._elementRef=e.createContainer(this._contentRef,n),this._elementRef.appendChild(this._buttonPanel),i.appendChild(this._elementRef),this._backgroundPanelRef=e.createDarkBackgroundPanel(),i.appendChild(this._backgroundPanelRef),this.addWindowEvents(i)}return y(e,[{key:"isOpen",value:function(){return this._isOpen}},{key:"addButtons",value:function(){for(var t=this,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];r.forEach(function(o){return t._buttonPanel.appendChild(o)})}},{key:"close",value:function(){var t=this;this._elementRef.classList.remove("show-modal"),this._elementRef.classList.add("hide-modal"),this._backgroundPanelRef.classList.remove("show-modal-background"),this._backgroundPanelRef.classList.add("hide-modal-background"),this._isOpen=!1,setTimeout(function(){t._elementRef.style.display="none",t._backgroundPanelRef.style.display="none"},e.MODAL_CLOSE_TIMEOUT_MS)}},{key:"displayModalElements",value:function(){this._elementRef.style.display="flex",this._elementRef.classList.remove("hide-modal"),this._elementRef.classList.add("show-modal"),this._backgroundPanelRef.style.display="block",this._backgroundPanelRef.classList.remove("hide-modal-background"),this._backgroundPanelRef.classList.add("show-modal-background"),this._isOpen=!0}},{key:"openTextModal",value:function(t){this._contentRef.innerHTML=t,this.displayModalElements()}},{key:"addCloseButton",value:function(t,n,r){var a=this,o=n?e.createSVGButton(t):e.createTextButton(t);return this.addButtons(o),o.onclick=function(){a.close(),setTimeout(function(){r==null||r()},140)},o}},{key:"addWindowEvents",value:function(t){this.keyDownEvent=this.windowKeyDown.bind(this,t),window.addEventListener("keydown",this.keyDownEvent)}},{key:"windowKeyDown",value:function(t,n){var r,a;!t.isConnected&&this.keyDownEvent?window.removeEventListener("keydown",this.keyDownEvent):this._isOpen&&(n.key===ne.ESCAPE?(this.close(),(r=this.extensionCloseCallback)==null||r.call(this)):n.key===ne.ENTER&&(this.close(),(a=this.extensionCloseCallback)==null||a.call(this)))}}],[{key:"createContainer",value:function(t,n){var r=document.createElement("div");return r.classList.add("modal"),r.appendChild(t),n&&delete n.backgroundColor,Object.assign(r.style,n),r}},{key:"createModalContent",value:function(t,n){var r,a=document.createElement("div");return(r=a.classList).add.apply(r,bi(t)),n&&(a.style.backgroundColor=n),document.createElement("div").appendChild(a),a}},{key:"createButtonPanel",value:function(t){var n=document.createElement("div");return n.classList.add("modal-button-panel"),t&&(n.style.backgroundColor=t),n}},{key:"createDarkBackgroundPanel",value:function(){var t=document.createElement("div");return t.id="modal-background-panel",t}},{key:"createTextButton",value:function(t){var n=document.createElement("div");return n.classList.add("modal-button"),n.textContent=t,n}},{key:"createSVGButton",value:function(t){var n=document.createElement("div");n.classList.add("modal-button","modal-svg-button");var r=pe.createSVGElement(t);return r.classList.add("modal-svg-button-icon"),n.appendChild(r),n}},{key:"createTextModalFunc",value:function(t,n,r){var a;if(R(n)=="object"&&(a=n.files)!=null&&a.infoModal){var o=new e(t,["modal-content"],n.files.infoModal.containerStyle);return o.addCloseButton("OK",!1,r),o.openTextModal.bind(o,n.infoModalTextMarkUp||"")}}}]),e}();ea.MODAL_CLOSE_TIMEOUT_MS=190;var et=ea,fc=function(e){P(i,e);function i(t,n,r,a,o,s){var l;g(this,i);var u,c,d,h,p,m;l=O(this,i,[i.createButtonElement(),(u=r.button)==null?void 0:u.position,r.button,s]);var v=l.createInnerElements(a,o,l._customStyles);return l._inputElement=i.createInputElement((c=r==null?void 0:r.files)==null?void 0:c.acceptedFormats),l.addClickEvent(t,r),l.elementRef.replaceChildren(v.styles),l.reapplyStateStyle("styles"),l._fileAttachmentsType=n,l._openM
691odalOnce=((h=(d=r.files)==null?void 0:d.infoModal)==null?void 0:h.openModalOnce)===!1||(m=(p=r.files)==null?void 0:p.infoModal)==null?void 0:m.openModalOnce,l}return y(i,[{key:"createInnerElements",value:function(n,r,a){var o=i.createSVGIconElement(n,r);return{styles:this.createInnerElement(o,"styles",a)}}},{key:"triggerImportPrompt",value:function(n){n.onchange=this.import.bind(this,n),n.click()}},{key:"import",value:function(n){ir.addFilesToType(Array.from(n.files||[]),[this._fileAttachmentsType]),n.value=""}},{key:"createInnerElement",value:function(n,r,a){return Je.createSpecificStateElement(this.elementRef,r,a)||n}},{key:"addClickEvent",value:function(n,r){var a=this.triggerImportPrompt.bind(this,this._inputElement),o=et.createTextModalFunc(n,r,a);this.elementRef.onclick=this.click.bind(this,o)}},{key:"click",value:function(n){n&&(this._openModalOnce===void 0||this._openModalOnce===!0)?(n(),this._openModalOnce===!0&&(this._openModalOnce=!1)):this.triggerImportPrompt(this._inputElement)}}],[{key:"createInputElement",value:function(n){var r=document.createElement("input");return r.type="file",r.accept=n||"",r.hidden=!0,r.multiple=!0,r}},{key:"createButtonElement",value:function(){var n=document.createElement("div");return n.classList.add("input-button","upload-file-button"),n}},{key:"createSVGIconElement",value:function(n,r){var a=pe.createSVGElement(r);return a.id=n,a}}]),i}(ht),$r=function(){function e(){g(this,e)}return y(e,null,[{key:"create",value:function(t,n,r){var a=e.createElement(r);e.addEvents(a,t,n),t.appendChild(a)}},{key:"createElement",value:function(t){var n=document.createElement("div");return n.id="drag-and-drop",R(t)=="object"&&Object.assign(n.style,t),n}},{key:"addEvents",value:function(t,n,r){n.ondragenter=function(a){a.preventDefault(),e.display(t)},t.ondragleave=function(a){a.preventDefault(),e.hide(t)},t.ondragover=function(a){a.preventDefault()},t.ondrop=function(a){a.preventDefault(),e.uploadFile(r,a),e.hide(t)}}},{key:"uploadFile",value:function(t,n){var r,a=(r=n.dataTransfer)==null?void 0:r.files;a&&t.addFilesToAnyType(Array.from(a))}},{key:"display",value:function(t){t.style.display="block"}},{key:"hide",value:function(t){t.style.display="none"}},{key:"isEnabled",value:function(t,n){return n!==void 0&&n===!1?!1:!!n||t.getNumberOfTypes()>0}}]),e}(),mc=function(){function e(){g(this,e)}return y(e,null,[{key:"validate",value:function(t,n,r,a,o){var s=t(r,a,o);return s?n.changeToSubmitIcon():n.changeToDisabledIcon(),s}},{key:"useValidationFunc",value:function(){var i=k(f().mark(function n(r,a,o,s){var l,u,c,d;return f().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return l=a.inputElementRef,u=l.classList.contains("text-input-placeholder")?"":l.textContent,p.next=3,o.completePlaceholders();case 3:return c=o.getAllFileData(),d=c==null?void 0:c.map(function(m){return m.file}),p.abrupt("return",e.validate(r,s,u,d));case 5:case"end":return p.stop()}},n)}));function t(n,r,a,o){return i.apply(this,arguments)}return t}()},{key:"useValidationFuncProgrammatic",value:function(){var i=k(f().mark(function n(r,a,o){var s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return l=(s=a.files)==null?void 0:s.map(function(d){return d.file}),c.abrupt("return",e.validate(r,o,a.text,l,!0));case 2:case"end":return c.stop()}},n)}));function t(n,r,a){return i.apply(this,arguments)}return t}()},{key:"validateWebsocket",value:function(t,n){return t.websocket&&!lt.canSendMessage(t.websocket)?(n.changeToDisabledIcon(),!1):!0}},{key:"attach",value:function(t,n,r,a,o){var s=t.validateInput||Re.processValidateInput(t);t._validationHandler=function(){var l=k(f().mark(function u(c){var d;return f().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(!(o.status.loadingActive||o.status.requestInProgress||n.isSubmitProgrammaticallyDisabled===!0||!e.validateWebsocket(n,o))){p.next=2;break}return p.abrupt("return",!1);case 2:return d=s||n.canSendMessage,p.abrupt("return",d?c?e.useValidationFuncProgrammatic(d,c,o):e.useValidationFunc(d,r,a,o):null);case 4:case"end":return p.stop()}},u)}));return function(u){return l.apply(this,arguments)}}()}}]),e}(),vc=`<?xml version="1.0" encoding="iso-8859-1"?>
692<svg height="1.4em" width="1.4em" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
693	 viewBox="0 0 490.9 490.9" xml:space="preserve">
694	<g>
695		<g>
696			<path d="M245.5,322.9c53,0,96.2-43.2,96.2-96.2V96.2c0-53-43.2-96.2-96.2-96.2s-96.2,43.2-96.2,96.2v
696130.5
697				C149.3,279.8,192.5,322.9,245.5,322.9z M173.8,96.2c0-39.5,32.2-71.7,71.7-71.7s71.7,32.2,71.7,71.7v130.5
698				c0,39.5-32.2,71.7-71.7,71.7s-71.7-32.2-71.7-71.7V96.2z"/>
699			<path d="M94.4,214.5c-6.8,0-12.3,5.5-12.3,12.3c0,85.9,66.7,156.6,151.1,162.8v76.7h-63.9c-6.8,0-12.3,5.5-12.3,12.3
700				s5.5,12.3,12.3,12.3h152.3c6.8,0,12.3-5.5,12.3-12.3s-5.5-12.3-12.3-12.3h-63.9v-76.7c84.4-6.3,151.1-76.9,151.1-162.8
701				c0-6.8-5.5-12.3-12.3-12.3s-12.3,5.5-12.3,12.3c0,76.6-62.3,138.9-138.9,138.9s-138.9-62.3-138.9-138.9
702				C106.6,220,101.2,214.5,94.4,214.5z"/>
703		</g>
704	</g>
705</svg>
706`,ta=function(e){P(i,e);function i(t){var n;return g(this,i),(t==null?void 0:t.position)==="dropup-menu"&&(t.position="outside-right"),n=O(this,i,[i.createMicrophoneElement(),t==null?void 0:t.position,t]),n.isActive=!1,n._innerElements=n.createInnerElements(n._customStyles),n.changeToDefault(),n}return y(i,[{key:"createInnerElements",value:function(n){var r=i.createSVGIconElement();return{default:this.createInnerElement(r,"default",n),active:this.createInnerElement(r,"active",n),unsupported:this.createInnerElement(r,"unsupported",n),commandMode:this.createInnerElement(r,"commandMode",n)}}},{key:"createInnerElement",value:function(n,r,a){return Je.createSpecificStateElement(this.elementRef,r,a)||n}},{key:"changeToActive",value:function(){this.elementRef.replaceChildren(this._innerElements.active),this.toggleIconFilter("active"),this.reapplyStateStyle("active",["default","commandMode"]),this.isActive=!0}},{key:"changeToDefault",value:function(){this.elementRef.replaceChildren(this._innerElements.default),this.toggleIconFilter("default"),this.reapplyStateStyle("default",["active","commandMode"]),this.isActive=!1}},{key:"changeToCommandMode",value:function(){this.elementRef.replaceChildren(this._innerElements.unsupported),this.toggleIconFilter("command"),this.reapplyStateStyle("commandMode",["active"])}},{key:"changeToUnsupported",value:function(){this.elementRef.replaceChildren(this._innerElements.unsupported),this.elementRef.classList.add("unsupported-microphone"),this.reapplyStateStyle("unsupported",["active"])}},{key:"toggleIconFilter",value:function(n){var r=this.elementRef.children[0];if(r.tagName.toLocaleLowerCase()==="svg")switch(n){case"default":r.classList.remove("active-microphone-icon","command-microphone-icon"),r.classList.add("default-microphone-icon");break;case"active":r.classList.remove("default-microphone-icon","command-microphone-icon"),r.classList.add("active-microphone-icon");break;case"command":r.classList.remove("active-microphone-icon","default-microphone-icon"),r.classList.add("command-microphone-icon");break}}}],[{key:"createMicrophoneElement",value:function(){var n=document.createElement("div");return n.id="microphone-button",n.classList.add("input-button"),n}},{key:"createSVGIconElement",value:function(){var n=pe.createSVGElement(vc);return n.id="microphone-icon",n}}]),i}(ht),na={},$t={},Vt={},pt={},He={};Object.defineProperty(He,"__esModule",{value:!0});He.Text=void 0;var Gt=function(){function e(){g(this,e)}return y(e,null,[{key:"capitalize",value:function(t){return t.replace(e.FIRST_CHAR_REGEX,function(n){return n.toUpperCase()})}},{key:"lineBreak",value:function(t){return t.replace(e.DOUBLE_LINE,"<p></p>").replace(e.ONE_LINE,"<br>")}},{key:"isCharDefined",value:function(t){return t!==void 0&&t!==" "&&t!==" "&&t!==`
707`&&t!==""}},{key:"breakupIntoWordsArr",value:function(t){return t.split(/(\W+)/)}}]),e}();He.Text=Gt;Gt.FIRST_CHAR_REGEX=/\S/;Gt.DOUBLE_LINE=/\n\n/g;Gt.ONE_LINE=/\n/g;Object.defineProperty(pt,"__esModule",{value:!0});pt.Translate=void 0;var gc=He,yc=function(){function e(){g(this,e)}return y(e,null,[{key:"translate",value:function(t,n){for(var r=gc.Text.breakupIntoWordsArr(t),a=0;a<r.length;a+=1)n[r[a]]&&(r[a]=n[r[a]]);return r.join("")}}]),e}();pt.Translate=yc;Object.defineProperty(Vt,"__esModule",{value:!0});Vt.WebSpeechTranscript=void 0;var Vr=pt,bc=function(){function e(){g(this,e)}return y(e,null,[{key:"extract",value:function(t,n,r){for(var a="",o=t.resultIndex;o<t.results.length;++o){var s=t.results[o][0].transcript;r&&(s=Vr.Translate.translate(s,r)),t.results[o].isFinal?n+=s:a+=s}return{interimTranscript:a,finalTranscript:n,newText:a||n}}},{key:"extractSafari",value:function(t,n,r){for(var a="",o="",s=t.resultIndex;s<t.results.length;++s){var l=t.results[s][0].transcript;r&&(l=Vr.Translate.translate(l,r)),a+=l}return{interimTranscript:o,finalTranscript:a,newText:a}}}]),e}();
707Vt.WebSpeechTranscript=bc;var Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.Browser=void 0;var tt=y(function e(){g(this,e)});Xe.Browser=tt;tt.IS_SAFARI=function(){return tt._IS_SAFARI===void 0&&(tt._IS_SAFARI=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),tt._IS_SAFARI};var ft={},Wt={};Object.defineProperty(Wt,"__esModule",{value:!0});Wt.EventListeners=void 0;var ra=function(){function e(){g(this,e)}return y(e,null,[{key:"getElementIfFocusedOnAvailable",value:function(t,n){return Array.isArray(t)?t.find(function(r){return n===r}):n===t?t:void 0}},{key:"keyDownWindow",value:function(t){var n=this;t.element&&e.getElementIfFocusedOnAvailable(t.element,document.activeElement)&&(e.KEY_DOWN_TIMEOUT!==null&&clearTimeout(e.KEY_DOWN_TIMEOUT),e.KEY_DOWN_TIMEOUT=setTimeout(function(){e.KEY_DOWN_TIMEOUT=null,n.resetRecording(t)},500))}},{key:"mouseDownWindow",value:function(t,n){this.mouseDownElement=e.getElementIfFocusedOnAvailable(t,n.target)}},{key:"mouseUpWindow",value:function(t){this.mouseDownElement&&this.resetRecording(t),this.mouseDownElement=void 0}},{key:"add",value:function(t,n){var r=(n==null?void 0:n.insertInCursorLocation)===void 0||(n==null?void 0:n.insertInCursorLocation);n!=null&&n.element&&r&&(t.mouseDownEvent=e.mouseDownWindow.bind(t,n.element),document.addEventListener("mousedown",t.mouseDownEvent),t.mouseUpEvent=e.mouseUpWindow.bind(t,n),document.addEventListener("mouseup",t.mouseUpEvent),t.keyDownEvent=e.keyDownWindow.bind(t,n),document.addEventListener("keydown",t.keyDownEvent))}},{key:"remove",value:function(t){document.removeEventListener("mousedown",t.mouseDownEvent),document.removeEventListener("mouseup",t.mouseUpEvent),document.removeEventListener("keydown",t.keyDownEvent)}}]),e}();Wt.EventListeners=ra;ra.KEY_DOWN_TIMEOUT=null;var Kt={};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.PreResultUtils=void 0;var kc=function(){function e(){g(this,e)}return y(e,null,[{key:"process",value:function(t,n,r,a,o){var s=a==null?void 0:a(n,r);return s?(setTimeout(function(){s.restart?t.resetRecording(o):s.stop&&t.stop()}),(s.stop||s.restart)&&s.removeNewText):!1}}]),e}();Kt.PreResultUtils=kc;var mt={},vt={};Object.defineProperty(vt,"__esModule",{value:!0});vt.AutoScroll=void 0;var _c=function(){function e(){g(this,e)}return y(e,null,[{key:"changeStateIfNeeded",value:function(t,n){n&&!t.isCursorAtEnd&&(t.endPadding="",t.scrollingSpan.innerHTML="&nbsp;")}},{key:"scrollGeneric",value:function(t,n){t.isCursorAtEnd?n.scrollTop=n.scrollHeight:t.scrollingSpan.scrollIntoView({block:"nearest"})}},{key:"scrollSafariPrimitiveToEnd",value:function(t){t.scrollLeft=t.scrollWidth,t.scrollTop=t.scrollHeight}},{key:"isElementOverflown",value:function(t){return t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth}},{key:"isRequired",value:function(t,n){return t&&e.isElementOverflown(n)}}]),e}();vt.AutoScroll=_c;var $e={};Object.defineProperty($e,"__esModule",{value:!0});$e.Elements=void 0;var wc=function(){function e(){g(this,e)}return y(e,null,[{key:"isPrimitiveElement",value:function(t){return t.tagName==="INPUT"||t.tagName==="TEXTAREA"}},{key:"createInterimSpan",value:function(){var t=document.createElement("span");return t.style.color="grey",t.style.pointerEvents="none",t}},{key:"createGenericSpan",value:function(){var t=document.createElement("span");return t.style.pointerEvents="none",t}},{key:"appendSpans",value:function(t,n){if(t.spansPopulated=!0,t.insertInCursorLocation&&document.activeElement===n){var r=window.getSelection();if(r!=null&&r.focusNode){var a=r.getRangeAt(0);a.insertNode(t.scrollingSpan),a.insertNode(t.interimSpan),a.insertNode(t.finalSpan),a.collapse(!1),r.removeAllRanges(),r.addRange(a);return}}n.appendChild(t.finalSpan),n.appendChild(t.interimSpan),n.appendChild(t.scrollingSpan)}},{key:"applyCustomColors",value:function(t,n){n.interim&&(t.interimSpan.style.color=n.interim),n.final&&(t.finalSpan.style.color=n.final)}},{key:"isInsideShadowDOM",value:function(t){return t.getRootNode()instanceof ShadowRoot}}]),e}();$e.Elements=wc;var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.Cursor=void 0;var Sc=function(){function e(){g(this,e)}return y(e,null,[{key:"setOffsetForGeneric",value:function(t,n){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=0,o=0;o<t.childNodes.length;o+=1){var s=t.childNodes[o];if(s.childNodes.length>0){var l=e.setOffsetForGeneric(s,n,r);if(l===-1)return-1;r+=l}else if(s.textContent!==null){if(r+s.textContent.length>n){var u=document.createRange();u.setStart(s,n-r),u.collapse(!0);var c=window.getSelection();return c==null||c.removeAllRanges(),c==null||c.addRange(u),t.focu
707s(),-1}r+=s.textContent.length,a+=s.textContent.length}}return a}},{key:"focusEndOfGeneric",value:function(t){var n=document.createRange();n.selectNodeContents(t),n.collapse(!1);var r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(n))}},{key:"setOffsetForSafariGeneric",value:function(t,n){var r=window.getSelection();if(r){var a=e.getGenericElementCursorOffset(t,r,!0);console.log(a),setTimeout(function(){},100),e.setOffsetForGeneric(t,a+n)}}},{key:"setOffsetForPrimitive",value:function(t,n,r){r&&t.blur(),t.setSelectionRange(n,n),t.focus()}},{key:"getGenericElementCursorOffset",value:function(t,n,r){var a=0;if(n.rangeCount>0){var o=n.getRangeAt(0),s=o.cloneRange();s.selectNodeContents(t),r?s.setEnd(o.startContainer,o.startOffset):s.setEnd(o.endContainer,o.endOffset),a=s.toString().length}return a}}]),e}();Ve.Cursor=Sc;Object.defineProperty(mt,"__esModule",{value:!0});mt.CommandUtils=void 0;var Gr=vt,xc=$e,Ec=Xe,Wr=Ve,Kr=He,Cc=function(){function e(){g(this,e)}return y(e,null,[{key:"processCommand",value:function(t,n){return(!n||!n.caseSensitive)&&(t=t.toLowerCase()),(n==null?void 0:n.substrings)===!1?Kr.Text.breakupIntoWordsArr(t):t}},{key:"process",value:function(t){var n;return((n=t.settings)===null||n===void 0?void 0:n.caseSensitive)===!0?t:Object.keys(t).reduce(function(r,a){var o=t[a];return r[a]=typeof o=="string"?e.processCommand(o,t.settings):o,r},{})}},{key:"toggleCommandModeOn",value:function(t){var n;t.isWaitingForCommand=!0,(n=t.onCommandModeTrigger)===null||n===void 0||n.call(t,!0)}},{key:"toggleCommandModeOff",value:function(t){var n;t.isWaitingForCommand&&((n=t.onCommandModeTrigger)===null||n===void 0||n.call(t,!1),t.isWaitingForCommand=!1)}},{key:"setText",value:function(t,n,r,a){e.toggleCommandModeOff(t),xc.Elements.isPrimitiveElement(a)?(a.value=r,t.isTargetInShadow||Wr.Cursor.setOffsetForPrimitive(a,r.length,!0),Ec.Browser.IS_SAFARI()&&t.autoScroll&&Gr.AutoScroll.scrollSafariPrimitiveToEnd(a)):(a.textContent=r,t.isTargetInShadow||Wr.Cursor.focusEndOfGeneric(a),setTimeout(function(){return Gr.AutoScroll.scrollGeneric(t,a)})),t.resetRecording(n)}},{key:"checkIfMatchesSubstring",value:function(t,n){return n.includes(t)}},{key:"checkIfMatchesWord",value:function(t,n,r){for(var a=t,o=r.length-1;o>=0;o-=1){for(var s=o,l=a.length-1;r[s]===a[l]&&l>=0;)s-=1,l-=1;if(l<0)return!0}return!1}},{key:"execCommand",value:function(t,n,r,a,o){var s,l,u,c=t.commands;if(!(!c||!a||!r)){var d=((s=c.settings)===null||s===void 0?void 0:s.caseSensitive)===!0?n:n.toLowerCase(),h=Kr.Text.breakupIntoWordsArr(d),p=((l=c.settings)===null||l===void 0?void 0:l.substrings)===!1?e.checkIfMatchesWord:e.checkIfMatchesSubstring;if(c.commandMode&&p(c.commandMode,d,h))return t.setInterimColorToFinal(),setTimeout(function(){return e.toggleCommandModeOn(t)}),{doNotProcessTranscription:!1};if(!(c.commandMode&&!t.isWaitingForCommand)){if(c.stop&&p(c.stop,d,h))return e.toggleCommandModeOff(t),setTimeout(function(){return t.stop()}),{doNotProcessTranscription:!1};if(c.pause&&p(c.pause,d,h))return e.toggleCommandModeOff(t),t.setInterimColorToFinal(),setTimeout(function(){var m;t.isPaused=!0,(m=t.onPauseTrigger)===null||m===void 0||m.call(t,!0)}),{doNotProcessTranscription:!1};if(c.resume&&p(c.resume,d,h))return t.isPaused=!1,(u=t.onPauseTrigger)===null||u===void 0||u.call(t,!1),e.toggleCommandModeOff(t),t.resetRecording(r),{doNotProcessTranscription:!0};if(c.reset&&p(c.reset,d,h))return o!==void 0&&e.setText(t,r,o,a),{doNotProcessTranscription:!0};if(c.removeAllText&&p(c.removeAllText,d,h))return e.setText(t,r,"",a),{doNotProcessTranscription:!0}}}}}]),e}();mt.CommandUtils=Cc;var Yt={};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.Highlight=void 0;var Mc=$e,Qe=Ve,Ac=function(){function e(){g(this,e)}return y(e,null,[{key:"setStateForPrimitive",value:function(t,n){var r,a;n.selectionStart!==null&&(r=n.selectionStart),n.selectionEnd!==null&&(a=n.selectionEnd),t.isHighlighted=r!==a}},{key:"setStateForGeneric",value:function(t,n){var r=window.getSelection();if(r!=null&&r.focusNode){var a=Qe.Cursor.getGenericElementCursorOffset(n,r,!0),o=Qe.Cursor.getGenericElementCursorOffset(n,r,!1);t.isHighlighted=a!==o}}},{key:"setState",value:function(t,n){document.activeElement===n&&(Mc.Elements.isPrimitiveElement(n)?e.setStateForPrimitive(t,n):e.setStateForGeneric(t,n))}},{key:"removeForGeneric",value:function(t,n){var r=window.getSelection();if(r){var a=Qe.Cursor.getGenericElementCursorOffset(n,r,!0);r.deleteFromDocument(),Qe.Cursor.setOffsetForGeneric(n,a),t.isHighlighted=!1}}},{key:"removeForPrimitive",value:function(t,n){var r=n.selectionStart,a=n.selectionEnd,o=n.value;if(r&&a){var s=o.substring(0,r)+o.substring(a);n.value=s,Qe.Cursor.setOffsetForPrimitive(n,r,t.autoScroll)}t.isHighlighted=!1}}]),e}();Yt.Highlight=Ac;var Jt={};
707Object.defineProperty(Jt,"__esModule",{value:!0});Jt.Padding=void 0;var Tc=$e,Yr=Ve,Ke=He,Ic=function(){function e(){g(this,e)}return y(e,null,[{key:"setStateForPrimitiveElement",value:function(t,n){if(document.activeElement===n&&n.selectionStart!==null){var r=n.selectionStart,a=n.value[r-1],o=n.selectionEnd===null?r:n.selectionEnd,s=n.value[o];Ke.Text.isCharDefined(a)&&(t.startPadding=" ",t.numberOfSpacesBeforeNewText=1),Ke.Text.isCharDefined(s)&&(t.endPadding=" ",t.numberOfSpacesAfterNewText=1),t.isCursorAtEnd=n.value.length===o;return}var l=n.value[n.value.length-1];Ke.Text.isCharDefined(l)&&(t.startPadding=" ",t.numberOfSpacesBeforeNewText=1),t.isCursorAtEnd=!0}},{key:"setStateForGenericElement",value:function(t,n){var r,a,o;if(document.activeElement===n){var s=window.getSelection();if(s!=null&&s.focusNode){var l=Yr.Cursor.getGenericElementCursorOffset(n,s,!0),u=(r=n.textContent)===null||r===void 0?void 0:r[l-1],c=Yr.Cursor.getGenericElementCursorOffset(n,s,!1),d=(a=n.textContent)===null||a===void 0?void 0:a[c];Ke.Text.isCharDefined(u)&&(t.startPadding=" "),Ke.Text.isCharDefined(d)&&(t.endPadding=" "),t.isCursorAtEnd=((o=n.textContent)===null||o===void 0?void 0:o.length)===c;return}}var h=n.innerText.charAt(n.innerText.length-1);Ke.Text.isCharDefined(h)&&(t.startPadding=" "),t.isCursorAtEnd=!0}},{key:"setState",value:function(t,n){Tc.Elements.isPrimitiveElement(n)?e.setStateForPrimitiveElement(t,n):e.setStateForGenericElement(t,n)}},{key:"adjustStateAfterRecodingPrimitiveElement",value:function(t,n){if(t.primitiveTextRecorded=!0,t.insertInCursorLocation&&document.activeElement===n&&(n.selectionEnd!==null&&(t.endPadding=t.endPadding+n.value.slice(n.selectionEnd)),n.selectionStart!==null)){t.startPadding=n.value.slice(0,n.selectionStart)+t.startPadding;return}t.startPadding=n.value+t.startPadding}},{key:"adjustSateForNoTextPrimitiveElement",value:function(t){t.numberOfSpacesBeforeNewText===1&&(t.startPadding=t.startPadding.substring(0,t.startPadding.length-1),t.numberOfSpacesBeforeNewText=0),t.numberOfSpacesAfterNewText===1&&(t.endPadding=t.endPadding.substring(1),t.numberOfSpacesAfterNewText=0)}}]),e}();Jt.Padding=Ic;Object.defineProperty(ft,"__esModule",{value:!0});ft.Speech=void 0;var Jr=Wt,Lc=Kt,Zr=mt,St=vt,vn=Yt,ge=$e,gn=Jt,Xr=Xe,Qr=Ve,yn=He,Rc=function(){function e(){g(this,e),this.finalTranscript="",this.interimSpan=ge.Elements.createInterimSpan(),this.finalSpan=ge.Elements.createGenericSpan(),this.scrollingSpan=ge.Elements.createGenericSpan(),this.isCursorAtEnd=!1,this.spansPopulated=!1,this.startPadding="",this.endPadding="",this.numberOfSpacesBeforeNewText=0,this.numberOfSpacesAfterNewText=0,this.isHighlighted=!1,this.primitiveTextRecorded=!1,this.recognizing=!1,this._displayInterimResults=!0,this.insertInCursorLocation=!0,this.autoScroll=!0,this.isRestarting=!1,this.isPaused=!1,this.isWaitingForCommand=!1,this.isTargetInShadow=!1,this.cannotBeStopped=!1,this.resetState()}return y(e,[{key:"prepareBeforeStart",value:function(t){var n,r;if(t!=null&&t.element)if(Jr.EventListeners.add(this,t),Array.isArray(t.element)){var a=t.element.find(function(o){return o===document.activeElement})||t.element[0];if(!a)return;this.prepare(a)}else this.prepare(t.element);(t==null?void 0:t.displayInterimResults)!==void 0&&(this._displayInterimResults=t.displayInterimResults),t!=null&&t.textColor&&(this._finalTextColor=(n=t==null?void 0:t.textColor)===null||n===void 0?void 0:n.final,ge.Elements.applyCustomColors(this,t.textColor)),(t==null?void 0:t.insertInCursorLocation)!==void 0&&(this.insertInCursorLocation=t.insertInCursorLocation),(t==null?void 0:t.autoScroll)!==void 0&&(this.autoScroll=t.autoScroll),this._onResult=t==null?void 0:t.onResult,this._onPreResult=t==null?void 0:t.onPreResult,this._onStart=t==null?void 0:t.onStart,this._onStop=t==null?void 0:t.onStop,this._onError=t==null?void 0:t.onError,this.onCommandModeTrigger=t==null?void 0:t.onCommandModeTrigger,this.onPauseTrigger=t==null?void 0:t.onPauseTrigger,this._options=t,!((r=this._options)===null||r===void 0)&&r.commands&&(this.commands=Zr.CommandUtils.process(this._options.commands))}},{key:"prepare",value:function(t){gn.Padding.setState(this,t),vn.Highlight.setState(this,t),this.isTargetInShadow=ge.Elements.isInsideShadowDOM(t),ge.Elements.isPrimitiveElement(t)?(this._primitiveElement=t,this._originalText=this._primitiveElement.value):(this._genericElement=t,this._originalText=this._genericElement.textContent)}},{key:"resetRecording",value:function(t){this.isRestarting=!0,this.stop(!0),this.resetState(!0),this.start(t,!0)}},{key:"updateElements",value:function(t,n,r){var a,o=yn.Text.capitalize(n);if(!(this.finalTranscript===o&&t==="")){Lc.PreResultUtils.process(this,r,t==="",this._onPreResult,this._options)&&(t="",r="");var s=this.commands&&Zr.CommandUtils.execCommand(this,r,this._options,this._primitiveElement||this._genericElement,this._originalText);if(s){if(s.doNotProcessTranscription)return;t="",r=""}if(!(this.isPaused||this.isWaitingForCommand)){(a=this._onResult)===null||a===void 0||a.call(this,r,t===""),this.finalTranscript=o,this._displayInterimResults||(t="");var l=this.finalTranscript===""&&t==="";this._primitiveElement?this.updatePrimitiveElement(this._primitiveElement,t,l):this._genericElement&&this.updateGenericElement(this._genericElement,t,l)}}}},{key:"updatePrimitiveElement",value:function(t,n,r){this.isHighlighted&&vn.Highlight.removeForPrimitive(this,t),this.primitiveTextRecorded||gn.Padding.adjustStateAfterRecodingPrimitiveElement(this,t),r&&gn.Padding.adjustSateForNoTextPrimitiveElement(this);var a=this.startPadding+this.finalTranscript+n;if(t.value=a+this.endPadding,!this.isTargetInShadow){var o=a.length+this.numberOfSpacesAfterNewText;Qr.Cursor.setOffsetForPrimitive(t,o,this.autoScroll)}this.autoScroll&&Xr.Browser.IS_SAFARI()&&this.isCursorAtEnd&&St.AutoScroll.scrollSafariPrimitiveToEnd(t)}},{key:"updateGenericElement",value:function(t,n,r){this.isHighlighted&&vn.Highlight.removeForGeneric(this,t),this.spansPopulated||ge.Elements.appendSpans(this,t);var a=(r?"":this.startPadding)+yn.Text.lineBreak(this.finalTranscript);this.finalSpan.innerHTML=a;var o=St.AutoScroll.isRequired(this.autoScroll,t);St.AutoScroll.changeStateIfNeeded(this,o);var s=yn.Text.lineBreak(n)+(r?"":this.endPadding);this.interimSpan.innerHTML=s,Xr.Browser.IS_SAFARI()&&this.insertInCursorLocation&&Qr.Cursor.setOffsetForSafariGeneric(t,a.length+s.length),o&&St.AutoScroll.scrollGeneric(this,t),r&&(this.scrollingSpan.innerHTML="")}},{key:"finalise",value:function(t){this._genericElement&&(t?(this.finalSpan=ge.Elements.createGenericSpan(),this.setInterimColorToFinal(),this.interimSpan=ge.Elements.createInterimSpan(),this.scrollingSpan=ge.Elements.createGenericSpan()):this._genericElement.textContent=this._genericElement.textContent,this.spansPopulated=!1),Jr.EventListeners.remove(this)}},{key:"setInterimColorToFinal",value:function(){this.interimSpan.style.color=this._finalTextColor||"black"}},{key:"resetState",value:function(t){this._primitiveElement=void 0,this._genericElement=void 0,this.finalTranscript="",this.finalSpan.innerHTML="",this.interimSpan.innerHTML="",this.scrollingSpan.innerHTML="",this.startPadding="",this.endPadding="",this.isHighlighted=!1,this.primitiveTextRecorded=!1,this.numberOfSpacesBeforeNewText=0,this.numberOfSpacesAfterNewText=0,t||(this.stopTimeout=void 0)}},{key:"setStateOnStart",value:function(){var t;this.recognizing=!0,this.isRestarting?this.isRestarting=!1:(t=this._onStart)===null||t===void 0||t.call(this)}},{key:"setStateOnStop",value:function(){var t;this.recognizing=!1,this.isRestarting||(t=this._onStop)===null||t===void 0||t.call(this)}},{key:"setStateOnError",value:function(t){var n;(n=this._onError)===null||n===void 0||n.call(this,t),this.recognizing=!1}}]),e}();ft.Speech=Rc;
707Object.defineProperty($t,"__esModule",{value:!0});$t.WebSpeech=void 0;var ei=Vt,ti=Xe,Oc=ft,Pc=function(e){P(i,e);function i(){return g(this,i),O(this,i)}return y(i,[{key:"start",value:function(n){var r;this._extractText===void 0&&(this._extractText=ti.Browser.IS_SAFARI()?ei.WebSpeechTranscript.extractSafari:ei.WebSpeechTranscript.extract),this.validate()&&(this.prepareBeforeStart(n),this.instantiateService(n),(r=this._service)===null||r===void 0||r.start(),this._translations=n==null?void 0:n.translations)}},{key:"validate",value:function(){return i.getAPI()?!0:(this.error("Speech Recognition is unsupported"),!1)}},{key:"instantiateService",value:function(n){var r,a,o=i.getAPI();this._service=new o,this._service.continuous=!0,this._service.interimResults=(r=n==null?void 0:n.displayInterimResults)!==null&&r!==void 0?r:!0,this._service.lang=((a=n==null?void 0:n.language)===null||a===void 0?void 0:a.trim())||"en-US",this.setEvents()}},{key:"setEvents",value:function(){var n=this;this._service&&(this._service.onstart=function(){n.setStateOnStart()},this._service.onerror=function(r){ti.Browser.IS_SAFARI()&&r.message==="Another request is started"||r.error==="aborted"&&n.isRestarting||r.error!=="no-speech"&&n.error(r.message||r.error)},this._service.onaudioend=function(){n.setStateOnStop()},this._service.onend=function(){n._stopping=!1},this._service.onresult=function(r){if(R(r.results)>"u"&&n._service)n._service.onend=null,n._service.stop();else if(n._extractText&&!n._stopping){var a=n._extractText(r,n.finalTranscript,n._translations),o=a.interimTranscript,s=a.finalTranscript,l=a.newText;n.updateElements(o,s,l)}})}},{key:"stop",value:function(n){var r;this._stopping=!0,(r=this._service)===null||r===void 0||r.stop(),this.finalise(n)}},{key:"error",value:function(n){console.error(n),this.setStateOnError(n),this.stop()}}],[{key:"getAPI",value:function(){return window.webkitSpeechRecognition||window.SpeechRecognition}}]),i}(Oc.Speech);$t.WebSpeech=Pc;var Zt={};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.GlobalState=void 0;var ia=function(){function e(){g(this,e)}return y(e,null,[{key:"doubleClickDetector",value:function(){return e.doubleClickPending?!0:(e.doubleClickPending=!0,setTimeout(function(){e.doubleClickPending=!1},300),!1)}}]),e}();Zt.GlobalState=ia;ia.doubleClickPending=!1;var Xt={},Qt={};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.PreventConnectionStop=void 0;var Nc=function(){function e(){g(this,e)}return y(e,null,[{key:"applyPrevention",value:function(t){clearTimeout(t._manualConnectionStopPrevention),t.cannotBeStopped=!0,t._manualConnectionStopPrevention=setTimeout(function(){t.cannotBeStopped=!1},800)}},{key:"clearPrevention",value:function(t){clearTimeout(t._manualConnectionStopPrevention),t.cannotBeStopped=!1}}]),e}();Qt.PreventConnectionStop=Nc;var en={},tn={};Object.defineProperty(tn,"__esModule",{value:!0});tn.README_URL=void 0;tn.README_URL="https://github.com/OvidijusParsiunas/speech-to-element";Object.defineProperty(en,"__esModule",{value:!0});en.AzureSpeechConfig=void 0;var bn=tn,Dc=function(){function e(){g(this,e)}return y(e,null,[{key:"validateOptions",value:function(t,n){return n?!n.subscriptionKey&&!n.token&&!n.retrieveToken?(t("Please define a 'subscriptionKey', 'token' or 'retrieveToken' property - more info: ".concat(bn.README_URL)),!1):n.region?!0:(t("Please define a 'region' property - more info: ".concat(bn.README_URL)),!1):(t("Please provide subscription details - more info: ".concat(bn.README_URL)),!1)}},{key:"getNewSpeechConfig",value:function(){var i=k(f().mark(function n(r,a){return f().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!a.region){s.next=2;break}return s.abrupt("return",a.subscriptionKey?r.fromSubscription(a.subscriptionKey.trim(),a.region.trim()):a.token?r.fromAuthorizationToken(a.token.trim(),a.region.trim()):a.retrieveToken?a.retrieveToken().then(function(l){return a.region?r.fromAuthorizationToken((l==null?void 0:l.trim())||"",a.region.trim()):null}).catch(function(l){return console.error(l),null}):null);case 2:case"end":return s.stop()}},n)}));function t(n,r){return i.apply(this,arguments)}return t}()},{key:"process",value:function(t,n){n.language&&(t.speechRecognitionLanguage=n.language.trim())}},{key:"get",value:function(){var i=k(f().mark(function n(r,a){var o;return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,e.getNewSpeechConfig(r,a);case 2:return o=l.sent,l.abrupt("return",(o&&e.process(o,a),o));case 4:case"end":return l.stop()}},n)}));function t(n,r){return i.apply(this,arguments)}return t}()}]),e}();en.AzureSpeechConfig=Dc;var nn={};Object.defineProperty(nn,"__esModule",{value:!0});nn.StopTimeout=void 0;var aa=function(){function e(){g(this,e)}return y(e,null,[{key:"set",value:function(t){t.stopTimeout=setTimeout(function(){return t.stop()},t.stopTimeoutMS)}},{key:"reset",value:function(t,n){t.stopTimeoutMS=n||e.DEFAULT_MS,t.stopTimeout&&clearTimeout(t.stopTimeout),e.set(t)}}]),e}();nn.StopTimeout=aa;aa.DEFAULT_MS=2e4;var rn={};Object.defineProperty(rn,"__esModule",{value:!0});rn.AzureTranscript=void 0;var Fc=pt,jc=function(){function e(){g(this,e)}return y(e,null,[{key:"extract",value:function(t,n,r,a){return a&&(t=Fc.Translate.translate(t,a)),r?{interimTranscript:"",finalTranscript:n+t,newText:t}:{interimTranscript:t,finalTranscript:n,newText:t}}}]),e}();rn.AzureTranscript=jc;
707Object.defineProperty(Xt,"__esModule",{value:!0});Xt.Azure=void 0;var ni=Qt,ri=en,kn=nn,ii=rn,Bc=ft,qc=function(e){P(i,e);function i(){var t;return g(this,i),t=O(this,i,arguments),t._newTextPadding="",t}return y(i,[{key:"start",value:function(n,r){this._newTextPadding="",this.stopTimeout===void 0&&kn.StopTimeout.reset(this,n==null?void 0:n.stopAfterSilenceMs),this.prepareBeforeStart(n),this.startAsync(n),r||ni.PreventConnectionStop.applyPrevention(this)}},{key:"startAsync",value:function(){var t=k(f().mark(function r(a){var o;return f().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:if(l.t0=this.validate(a),!l.t0){l.next=6;break}return l.next=4,this.instantiateService(a);case 4:this._translations=a==null?void 0:a.translations,(o=this._service)===null||o===void 0||o.startContinuousRecognitionAsync(function(){},this.error);case 6:case"end":return l.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"validate",value:function(n){return i.getAPI()?ri.AzureSpeechConfig.validateOptions(this.error.bind(this),n):(this.moduleNotFound(),!1)}},{key:"instantiateService",value:function(){var t=k(f().mark(function r(a){var o,s,l,u;return f().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return o=i.getAPI(),s=o.AudioConfig.fromDefaultMicrophoneInput(),d.next=4,ri.AzureSpeechConfig.get(o.SpeechConfig,a);case 4:l=d.sent,l?(u=new o.SpeechRecognizer(l,s),this.setEvents(u),this._service=u,a.retrieveToken&&this.retrieveTokenInterval(a.retrieveToken)):this.error("Unable to contact Azure server");case 6:case"end":return d.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"setEvents",value:function(n){n.recognizing=this.onRecognizing.bind(this),n.recognized=this.onRecognized.bind(this),n.sessionStarted=this.onSessionStarted.bind(this),n.canceled=this.onCanceled.bind(this),n.sessionStopped=this.onSessionStopped.bind(this)}},{key:"onRecognizing",value:function(n,r){if(!this._stopping){var a=ii.AzureTranscript.extract(this._newTextPadding+r.result.text,this.finalTranscript,!1,this._translations),o=a.interimTranscript,s=a.finalTranscript,l=a.newText;kn.StopTimeout.reset(this,this.stopTimeoutMS),this.updateElements(o,s,l)}}},{key:"onRecognized",value:function(n,r){var a=r.result;switch(a.reason){case window.SpeechSDK.ResultReason.Canceled:break;case window.SpeechSDK.ResultReason.RecognizedSpeech:if(a.text&&!this._stopping){var o=ii.AzureTranscript.extract(this._newTextPadding+a.text,this.finalTranscript,!0,this._translations),s=o.interimTranscript,l=o.finalTranscript,u=o.newText;kn.StopTimeout.reset(this,this.stopTimeoutMS),this.updateElements(s,l,u),l!==""&&(this._newTextPadding=" ")}break}}},{key:"onCanceled",value:function(n,r){r.reason===window.SpeechSDK.CancellationReason.Error&&this.error(r.errorDetails)}},{key:"onSessionStarted",value:function(){ni.PreventConnectionStop.clearPrevention(this),this.setStateOnStart()}},{key:"onSessionStopped",value:function(){this._retrieveTokenInterval||clearInterval(this._retrieveTokenInterval),this._stopping=!1,this.setStateOnStop()}},{key:"retrieveTokenInterval",value:function(n){var r=this;this._retrieveTokenInterval=setInterval(function(){n==null||n().then(function(a){r._service&&(r._service.authorizationToken=(a==null?void 0:a.trim())||"")}).catch(function(a){r.error(a)})},1e4)}},{key:"stop",value:function(n){var r;!n&&this._retrieveTokenInterval&&clearInterval(this._retrieveTokenInterval),this._stopping=!0,(r=this._service)===null||r===void 0||r.stopContinuousRecognitionAsync(),this.finalise(n)}},{key:"moduleNotFound",value:function(){console.error("speech recognition module not found:"),console.error(`please install the 'microsoft-cognitiveservices-speech-sdk' npm package or add a script tag: <script src="https://aka.ms/csspeech/jsbrowserpackageraw"><\/script>`),this.setStateOnError("speech recognition module not found")}},{key:"error",value:function(n){this._retrieveTokenInterval&&clearInterval(this._retrieveTokenInterval),console.error(n),this.setStateOnError(n),this.stop()}}],[{key:"getAPI",value:function(){return window.SpeechSDK}}]),i}(Bc.Speech);Xt.Azure=qc;Object.defineProperty(na,"__esModule",{value:!0});var ai=$t,Uc=mt,ve=Zt,zc=Xt,Hc=function(){function e(){g(this,e)}return y(e,null,[{key:"toggle",value:function(t,n){var r,a,o=t.toLocaleLowerCase().trim();!((r=ve.GlobalState.service)===null||r===void 0)&&r.recognizing?this.stop():o==="webspeech"?e.startWebSpeech(n):o==="azure"?e.startAzure(n):(console.error("service not found - must be either 'webspeech' or 'azure'"),(a=n==null?void 0:n.onError)===null||a===void 0||a.call(n,"service not found - must be either 'webspeech' or 'azure'"))}},{key:"startWebSpeech",value:function(t){e.stop()||(ve.GlobalState.service=new ai.WebSpeech,ve.GlobalState.service.start(t))}},{key:"isWebSpeechSupported",value:function(){return!!ai.WebSpeech.getAPI()}},{key:"startAzure",value:function(t){var n;e.stop()||!((n=ve.GlobalState.service)===null||n===void 0)&&n.cannotBeStopped||(ve.GlobalState.service=new zc.Azure,ve.GlobalState.service.start(t))}},{key:"stop",value:function(){var t;return ve.GlobalState.doubleClickDetector()?!0:(!((t=ve.GlobalState.service)===null||t===void 0)&&t.recognizing&&ve.GlobalState.service.stop(),!1)}},{key:"endCommandMode",value:function(){ve.GlobalState.service&&Uc.CommandUtils.toggleCommandModeOff(ve.GlobalState.service)}}]),e}(),_n=na.default=Hc,$c=function(e){P(i,e);function i(t,n,r){var a;g(this,i);var o;
707a=O(this,i,[R(t.speechToText)=="object"?(o=t.speechToText)==null?void 0:o.button:{}]);var s=i.processConfiguration(n,t.speechToText),l=s.serviceName,u=s.processedConfig;if(a._addErrorMessage=r,l==="webspeech"&&!_n.isWebSpeechSupported())a.changeToUnsupported();else{var c=!t.textInput||!t.textInput.disabled;a.elementRef.onclick=a.buttonClick.bind(de(a),n,c,l,u)}return a}return y(i,[{key:"buttonClick",value:function(n,r,a,o){n.removeTextIfPlaceholder(),_n.toggle(a,V({insertInCursorLocation:!1,element:r?n.inputElementRef:void 0,onError:this.onError.bind(this),onStart:this.changeToActive.bind(this),onStop:this.changeToDefault.bind(this),onCommandModeTrigger:this.onCommandModeTrigger.bind(this)},o))}},{key:"onCommandModeTrigger",value:function(n){n?this.changeToCommandMode():this.changeToActive()}},{key:"onError",value:function(){this._addErrorMessage("speechToText","speech input error")}}],[{key:"processConfiguration",value:function(n,r){var a,o,s,l,u,c=R(r)=="object"?r:{},d=R(c.webSpeech)=="object"?c.webSpeech:{},h=c.azure||{},p=V(V({displayInterimResults:(a=c.displayInterimResults)!==null&&a!==void 0?a:void 0,textColor:(o=c.textColor)!==null&&o!==void 0?o:void 0,translations:(s=c.translations)!==null&&s!==void 0?s:void 0,commands:(l=c.commands)!==null&&l!==void 0?l:void 0},d),h),m=(u=c.commands)==null?void 0:u.submit;return m&&(p.onPreResult=function(v){return v.toLowerCase().includes(m)?(setTimeout(function(){var b;return(b=n.submit)==null?void 0:b.call(n)}),_n.endCommandMode(),{restart:!0,removeNewText:!0}):null}),{serviceName:i.getServiceName(c),processedConfig:p}}},{key:"getServiceName",value:function(n){return n.webSpeech?"webspeech":n.azure?"azure":"webspeech"}}]),i}(ta),oa=function(){function e(){g(this,e)}return y(e,null,[{key:"getFileName",value:function(t,n){var r=new Date,a=String(r.getHours()).padStart(2,"0"),o=String(r.getMinutes()).padStart(2,"0"),s=String(r.getSeconds()).padStart(2,"0");return"".concat(t,"-").concat(a,"-").concat(o,"-").concat(s,".").concat(n)}}]),e}(),Vc=function(e){P(i,e);function i(t,n){var r;g(this,i);var a,o;return r=O(this,i,[n.button]),r._waitingForBrowserApproval=!1,r._audioType=t,r._extension=((a=n.files)==null?void 0:a.format)||"mp3",r._maxDurationSeconds=(o=n.files)==null?void 0:o.maxDurationSeconds,r.elementRef.onclick=r.buttonClick.bind(de(r)),r}return y(i,[{key:"buttonClick",value:function(){this._waitingForBrowserApproval||(this.isActive?this.stop():(this._waitingForBrowserApproval=!0,this.record()))}},{key:"stop",value:function(){var n=this;return new Promise(function(r){var a,o;n.changeToDefault(),(a=n._mediaRecorder)==null||a.stop(),(o=n._mediaStream)==null||o.getTracks().forEach(function(s){return s.stop()}),setTimeout(function(){r()},10)})}},{key:"record",value:function(){var n=this;navigator.mediaDevices.getUserMedia({audio:!0}).then(function(r){n.changeToActive(),n._mediaRecorder=new MediaRecorder(r),n._audioType.addPlaceholderAttachment(n.stop.bind(n),n._maxDurationSeconds),n._mediaStream=r,n._mediaRecorder.addEventListener("dataavailable",function(a){n.createFile(a)}),n._mediaRecorder.start()}).catch(function(r){console.error(r),n.stop()}).finally(function(){n._waitingForBrowserApproval=!1})}},{key:"createFile",value:function(n){var r=this,a=new Blob([n.data],{type:"audio/".concat(this._extension)}),o=oa.getFileName(this._newFilePrefix||"audio",this._extension),s=new File([a],o,{type:a.type}),l=new FileReader;l.readAsDataURL(s),l.onload=function(u){r._audioType.completePlaceholderAttachment(s,u.target.result)}}}]),i}(ta),Gc=`<?xml version="1.0" standalone="no"?>
708<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
709<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="1" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round">
710  <line x1="22" y1="2" x2="11" y2="14"></line>
711  <polygon points="22 2 15 22 11 14 2 10 22 2"></polygon>
712</svg>
713`,Le=function(){function e(){g(this,e)}return y(e,null,[{key:"setPropertyValueIfDoesNotExist",value:function(t,n,r){var a,o,s=n[0];n.length===1?(a=t[s])!==null&&a!==void 0||(t[s]=r):((o=t[s])!==null&&o!==void 0||(t[s]={}),n.shift(),e.setPropertyValueIfDoesNotExist(t[s],n,r))}},{key:"setPropertyValue",value:function(t,n,r){var a,o=n[0];n.length===1?t[o]=r:((a=t[o])!==null&&a!==void 0||(t[o]={}),n.shift(),e.setPropertyValue(t[o],n,r))}},{key:"getObjectValue",value:function(t,n){var r=n[0],a=t[r];return a===void 0||n.length===1?a:e.getObjectValue(a,n.slice(1))}}
713,{key:"overwritePropertyObjectFromAnother",value:function(t,n,r){var a=e.getObjectValue(n,r);if(a){var o=V(V({},a),e.getObjectValue(t,r)||{});e.setPropertyValue(t,r,o)}}}]),e}(),oi=function(){function e(){g(this,e)}return y(e,null,[{key:"resetSubmit",value:function(t,n){n?t.unsetCustomStateStyles(["loading","submit"]):t.unsetCustomStateStyles(["stop","loading","submit"]),t.reapplyStateStyle("submit")}},{key:"overwriteDefaultStyleWithSubmit",value:function(t,n){if(t.submit){var r=JSON.parse(JSON.stringify(t[n]||{}));Le.overwritePropertyObjectFromAnother(r,t.submit,["container","default"]),Le.overwritePropertyObjectFromAnother(r,t.submit,["text","styles","default"]),Le.overwritePropertyObjectFromAnother(r,t.submit,["svg","styles","default"]),t[n]=r}}},{key:"setUpDisabledButton",value:function(t){Le.setPropertyValueIfDoesNotExist(t,["submit","container","default","backgroundColor"],""),Le.setPropertyValueIfDoesNotExist(t,["disabled","container","default","backgroundColor"],"unset"),Le.setPropertyValueIfDoesNotExist(t.submit,["svg","styles","default","filter"],""),Le.setPropertyValueIfDoesNotExist(t.disabled,["svg","styles","default","filter"],"brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(5564%) hue-rotate(207deg) brightness(100%) contrast(97%)"),e.overwriteDefaultStyleWithSubmit(t,"disabled")}},{key:"process",value:function(t){var n=JSON.parse(JSON.stringify(t||{}));return e.overwriteDefaultStyleWithSubmit(n,"loading"),e.overwriteDefaultStyleWithSubmit(n,"stop"),t!=null&&t.alwaysEnabled||e.setUpDisabledButton(n),n}}]),e}(),an=function(e){P(i,e);function i(t,n,r,a,o){var s;g(this,i);var l=oi.process(t.submitButtonStyles);return s=O(this,i,[i.createButtonContainerElement(),l==null?void 0:l.position,l]),s._isSVGLoadingIconOverriden=!1,s.status={requestInProgress:!1,loadingActive:!1},s._messages=r,s._inputElementRef=n,s._fileAttachments=o,s._innerElements=s.createInnerElements(),s._abortStream=new AbortController,s._stopClicked={listener:function(){}},s._serviceIO=a,s._alwaysEnabled=!!(l!=null&&l.alwaysEnabled),t.disableSubmitButton=s.disableSubmitButton.bind(de(s),a),s.attemptOverwriteLoadingStyle(t),setTimeout(function(){var u;s._validationHandler=t._validationHandler,s.assignHandlers(s._val
713idationHandler),(u=s._validationHandler)==null||u.call(de(s))}),s}return y(i,[{key:"createInnerElements",value:function(){var n=Je.create(this.elementRef,["submit","loading","stop"],this._customStyles),r=n.submit,a=n.loading,o=n.stop,s=r||i.createSubmitIconElement();return{submit:s,loading:a||i.createLoadingIconElement(),stop:o||i.createStopIconElement(),disabled:this.createDisabledIconElement(s)}}},{key:"createDisabledIconElement",value:function(n){return Je.createCustomElement("disabled",this._customStyles)||n.cloneNode(!0)}},{key:"attemptOverwriteLoadingStyle",value:function(n){var r,a,o,s,l,u,c,d,h;if(!((a=(r=this._customStyles)==null?void 0:r.submit)!=null&&a.svg||(l=(s=(o=this._customStyles)==null?void 0:o.loading)==null?void 0:s.svg)!=null&&l.content||(d=(c=(u=this._customStyles)==null?void 0:u.loading)==null?void 0:c.text)!=null&&d.content)&&(n.displayLoadingBubble===void 0||n.displayLoadingBubble===!0)){var p=document.createElement("style");p.textContent=`
714        .loading-button > * {
715          filter: brightness(0) saturate(100%) invert(72%) sepia(0%) saturate(3044%) hue-rotate(322deg) brightness(100%)
716            contrast(96%) !important;
717        }`,(h=n.shadowRoot)==null||h.appendChild(p),this._isSVGLoadingIconOverriden=!0}}},{key:"assignHandlers",value:function(n){this._serviceIO.completionsHandlers={onFinish:this.resetSubmit.bind(this,n)},this._serviceIO.streamHandlers={onOpen:this.changeToStopIcon.bind(this),onClose:this.resetSubmit.bind(this,n),abortStream:this._abortStream,stopClicked:this._stopClicked};var r=this._serviceIO.deepChat.stream;R(r)=="object"&&typeof r.simulation=="number"&&(this._serviceIO.streamHandlers.simulationInterim=r.simulation)}},{key:"resetSubmit",value:function(n){this.status.requestInProgress=!1,this.status.loadingActive=!1,n()}},{key:"submitFromInput",value:function(){var t=k(f().mark(function r(){var a,o,s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this._fileAttachments.completePlaceholders();case 2:o=this._fileAttachments.getAllFileData(),this._inputElementRef.classList.contains("text-input-placeholder")?this.attemptSubmit({text:"",files:o}):(s=(a=this._inputElementRef.textContent)==null?void 0:a.trim(),this.attemptSubmit({text:s,files:o}));case 4:case"end":return u.stop()}},r,this)}));function n(){return t.apply(this,arguments)}return n}()},{key:"programmaticSubmit",value:function(){var t=k(f().mark(function r(a){var o=this,s;return f().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:typeof a=="string"&&(a=Re.processSubmitUserMessage(a)),s={text:a.text},a.files&&(s.files=Array.from(a.files).map(function(c){return{file:c,type:rr.getTypeFromBlob(c)}})),setTimeout(function(){return o.attemptSubmit(s,!0)});case 3:case"end":return u.stop()}},r)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"attemptSubmit",value:function(){var t=k(f().mark(function r(a){var o,s,l,u,c,d,h=arguments;return f().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return o=h.length>1&&h[1]!==void 0?h[1]:!1,m.next=3,(s=this._validationHandler)==null?void 0:s.call(this,o?a:void 0);case 3:if(m.t0=m.sent,m.t1=!1,m.t0!==m.t1){m.next=7;break}return m.abrupt("return");case 7:return this.changeToLoadingIcon(),m.next=10,this.addNewMessage(a);case 10:return this._serviceIO.isWebModel()||this._messages.addLoadingMessage(),$n.clear(this._inputElementRef),c=(l=a.files)==null?void 0:l.map(function(v){return v.file}),d={text:a.text===""?void 0:a.text,files:c},m.next=15,this._serviceIO.callAPI(d,this._messages);case 15:(u=this._fileAttachments)==null||u.removeAllFiles();case 16:case"end":return m.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"addNewMessage",value:function(){var t=k(f().mark(function r(a){var o,s,l;return f().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(o=a.text,s=a.files,l={role:F.USER_ROLE},o&&(l.text=o),c.t0=s,!c.t0){c.next=8;break}return c.next=7,this._messages.addMultipleFiles(s);case 7:l.files=c.sent;case 8:this._serviceIO.sessionId&&(l._sessionId=this._serviceIO.sessionId),Object.keys(l).length>0&&this._messages.addNewMessage(l);case 10:case"end":return c.stop()}},r,this)}));function n(r){return t.apply(this,arguments)}return n}()},{key:"stopStream",value:function(){var n;this._abortStream.abort(),(n=this._stopClicked)==null||n.listener(),this._val
717idationHandler&&this.resetSubmit(this._validationHandler)}},{key:"changeToStopIcon",value:function(){this._serviceIO.websocket||(this.elementRef.classList.remove(i.LOADING_CLASS,i.DISABLED_CLASS,i.SUBMIT_CLASS),this.elementRef.replaceChildren(this._innerElements.stop),this.reapplyStateStyle("stop",["loading","submit"]),this.elementRef.onclick=this.stopStream.bind(this),this.status.loadingActive=!1)}},{key:"changeToLoadingIcon",value:function(){this._serviceIO.websocket||(this._isSVGLoadingIconOverriden||this.elementRef.replaceChildren(this._innerElements.loading),this.elementRef.classList.remove(i.SUBMIT_CLASS,i.DISABLED_CLASS),this.elementRef.classList.add(i.LOADING_CLASS),this.reapplyStateStyle("loading",["submit"]),this.elementRef.onclick=function(){},this.status.requestInProgress=!0,this.status.loadingActive=!0)}},{key:"changeToSubmitIcon",value:function(){this.elementRef.classList.contains(i.SUBMIT_CLASS)||(this.elementRef.classList.remove(i.LOADING_CLASS,i.DISABLED_CLASS),this.elementRef.classList.add(i.SUBMIT_CLASS),this.elementRef.replaceChildren(this._innerElements.submit),oi.resetSubmit(this,this.status.loadingActive),this.elementRef.onclick=this.submitFromInput.bind(this))}},{key:"changeToDisabledIcon",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this._alwaysEnabled&&!n?this.changeToSubmitIcon():this.elementRef.classList.contains(i.DISABLED_CLASS)||(this.elementRef.classList.remove(i.LOADING_CLASS,i.SUBMIT_CLASS),this.elementRef.classList.add(i.DISABLED_CLASS),this.elementRef.replaceChildren(this._innerElements.disabled),this.reapplyStateStyle("disabled",["submit"]),this.elementRef.onclick=function(){})}},{key:"disableSubmitButton",value:function(n,r){var a;n.isSubmitProgrammaticallyDisabled=r!==!1,!(this.status.requestInProgress||this.status.loadingActive)&&(r===!1?(a=this._validationHandler)==null||a.call(this):this.changeToDisabledIcon(!0))}}],[{key:"createButtonContainerElement",value:function(){var n=document.createElement("div");return n.classList.add("input-button"),n}},{key:"createSubmitIconElement",value:function(){var n=pe.createSVGElement(Gc);return n.id="submit-icon",n}},{key:"createLoadingIconElement",value:function(){var n=document.createElement("div");return n.classList.add("dots-jumping"),n}},{key:"createStopIconElement",value:function(){var n=document.createElement("div");return n.id="stop-icon",n}}]),i}(ht);an.SUBMIT_CLASS="submit-button";an.LOADING_CLASS="loading-button";an.DISABLED_CLASS="disabled-button";var Wc=an,Kc=`<?xml version="1.0" encoding="utf-8"?>
718<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
719  <path d="M27.1 14.313V5.396L24.158 8.34c-2.33-2.325-5.033-3.503-8.11-3.503C9.902 4.837 4.901 9.847 4.899 16c.001 6.152 5.003 11.158 11.15 11.16 4.276 0 9.369-2.227 10.836-8.478l.028-.122h-3.23l-.022.068c-1.078 3.242-4.138 5.421-7.613 5.421a8 8 0 0 1-5.691-2.359A7.993 7.993 0 0 1 8 16.001c0-4.438 3.611-8.049 8.05-8.049 2.069 0 3.638.58 5.924 2.573l-3.792 3.789H27.1z"/>
720</svg>
721`,Yc=`<?xml version="1.0" encoding="utf-8"?>
722<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg">
723  <title>capture</title>
724  <path d="M0 16q0 3.264 1.28 6.208t3.392 5.12 5.12 3.424 6.208 1.248 6.208-1.248 5.12-3.424 3.392-5.12 1.28-6.208-1.28-6.208-3.392-5.12-5.088-3.392-6.24-1.28q-3.264 0-6.208 1.28t-5.12 3.392-3.392 5.12-1.28 6.208zM4 16q0-3.264 1.6-6.016t4.384-4.352 6.016-1.632 6.016 1.632 4.384 4.352 1.6 6.016-1.6 6.048-4.384 4.352-6.016 1.6-6.016-1.6-4.384-4.352-1.6-6.048z"></path>
725</svg>
726`,Jc=`<?xml version="1.0" encoding="utf-8"?>
727<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
728  <path d="M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z"/>
729</svg>`,Zc=`<?xml version="1.0" encoding="utf-8"?>
730<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
731  <path d="M4.89163 13.2687L9.16582 17.5427L18.7085 8" stroke="#000000" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
732</svg>`,Xc=function(e){P(i,e);function i(t,n,r,a){var o;
732g(this,i),o=O(this,i,[t,["modal-content","modal-camera-content"],r]),o._stopped=!1,o._format="image/png",o._canvas=document.createElement("canvas"),o._canvas.classList.add("camera-modal-canvas");var s=o.addButtonsAndTheirEvents(n),l=s.captureButton,u=s.submitButton;return o._captureButton=l,o._submitButton=u,o._captureIcon=o._captureButton.children[0],o._refreshIcon=pe.createSVGElement(Kc),o._refreshIcon.classList.add("modal-svg-button-icon","modal-svg-refresh-icon"),(a==null?void 0:a.format)==="jpeg"&&(o._format="image/jpeg"),a!=null&&a.dimensions&&(o._dimensions=a.dimensions),o._contentRef.appendChild(o._canvas),o.extensionCloseCallback=o.stop,o}return y(i,[{key:"addButtonsAndTheirEvents",value:function(n){var r=et.createSVGButton(Yc);r.classList.add("modal-svg-camera-button"),r.children[0].classList.add("modal-svg-camera-icon");var a=this.addCloseButton(Jc,!0);a.classList.add("modal-svg-close-button"),a.children[0].classList.add("modal-svg-close-icon");var o=et.createSVGButton(Zc);return o.classList.add("modal-svg-submit-button"),this.addButtons(r,o),this.addButtonEvents(r,a,o,n),{captureButton:r,submitButton:o}}},{key:"addButtonEvents",value:function(n,r,a,o){var s=this;n.onclick=function(){s.capture()},r.addEventListener("click",this.stop.bind(this)),a.onclick=function(){var l=s.getFile();l&&ir.addFilesToType([l],[o]),s.stop(),s.close()}}},{key:"stop",value:function(){var n=this;this._mediaStream&&this._mediaStream.getTracks().forEach(function(r){return r.stop()}),this._stopped=!0,setTimeout(function(){n._captureButton.replaceChildren(n._captureIcon),n._captureButton.classList.replace("modal-svg-refresh-button","modal-svg-camera-button");var r=n._canvas.getContext("2d");r==null||r.clearRect(0,0,n._canvas.width,n._canvas.height)},et.MODAL_CLOSE_TIMEOUT_MS)}},{key:"start",value:function(){var n=this;this._dataURL=void 0,this._submitButton.classList.add("modal-svg-submit-disabled"),this._stopped=!1,navigator.mediaDevices.getUserMedia({video:this._dimensions||!0}).then(function(r){if(n._mediaStream=r,!n.isOpen())return n.stop();var a=document.createElement("video");a.srcObject=r,a.play(),requestAnimationFrame(n.updateCanvas.bind(n,a,n._canvas))}).catch(function(r){console.error(r),n.stop(),n.close()})}},{key:"capture",value:function(){this._dataURL?(this._captureButton.replaceChildren(this._captureIcon),this._captureButton.classList.replace("modal-svg-refresh-button","modal-svg-camera-button"),this._submitButton.classList.add("modal-svg-submit-disabled"),this._dataURL=void 0):(this._captureButton.replaceChildren(this._refreshIcon),this._captureButton.classList.replace("modal-svg-camera-button","modal-svg-refresh-button"),this._submitButton.classList.remove("modal-svg-submit-disabled"),this._dataURL=this._canvas.toDataURL())}},{key:"getFile",value:function(){if(this._dataURL){for(var n=atob(this._dataURL.split(",")[1]),r=new Array(n.length),a=0;a<n.length;a++)r[a]=n.charCodeAt(a);var o=new Uint8Array(r),s=new Blob([o],{type:this._format}),l=this._format==="image/jpeg"?"jpeg":"png",u=oa.getFileName(this._newFilePrefix||"photo",l);return new File([s],u,{type:s.type})}}},{key:"updateCanvas",value:function(n,r){if(!this._stopped){if(!this._dataURL){r.width=n.videoWidth,r.height=n.videoHeight;var a=r.getContext("2d");a==null||a.drawImage(n,0,0,r.width,r.height)}requestAnimationFrame(this.updateCanvas.bind(this,n,r))}}},{key:"openCameraModal",value:function(n){this.displayModalElements(),n.start()}}],[{key:"createCameraModalFunc",value:function(n,r,a,o){var s=new i(n,r,a,o);return s.openCameraModal.bind(s,s)}}]),i}(et),Qc=`<?xml version="1.0" encoding="utf-8"?>
733<svg viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg">
734  <path d="M29 7h-4.599l-2.401-4h-12l-2.4 4h-4.6c-1 0-3 1-3 2.969v16.031c0 1.657 1.5 3 2.792 3h26.271c1.313 0 2.938-1.406 2.938-2.968v-16.032c0-1-1-3-3-3zM30 26.032c0 0.395-0.639 0.947-0.937 0.969h-26.265c-0.232-0.019-0.797-0.47-0.797-1v-16.031c0-0.634 0.851-0.953 1-0.969h5.732l2.4-4h9.802l1.785 3.030 0.55 0.97h5.731c0.705 0 0.99 0.921 1 1v16.032zM16 10c-3.866 0-7 3.134-7 7s3.134 7 7 7 7-3.134 7-7-3.134-7-7-7zM16 22c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z"></path>
735</svg>`,ed=function(e){P(i,e);function i(t,n,r){var a;g(this,i);var o;
735a=O(this,i,[i.createButtonElement(),(o=r==null?void 0:r.button)==null?void 0:o.position,(r==null?void 0:r.button)||{},"Photo"]);var s=a.createInnerElements(a._customStyles);return r&&a.addClickEvent(t,n,r.modalContainerStyle,r.files),a.elementRef.classList.add("upload-file-button"),a.elementRef.appendChild(s.styles),a.reapplyStateStyle("styles"),a}return y(i,[{key:"createInnerElements",value:function(n){return{styles:this.createInnerElement(i.createSVGIconElement(),"styles",n)}}},{key:"createInnerElement",value:function(n,r,a){return Je.createSpecificStateElement(this.elementRef,r,a)||n}},{key:"addClickEvent",value:function(n,r,a,o){var s=Xc.createCameraModalFunc(n,r,a,o);this.elementRef.onclick=s}}],[{key:"createButtonElement",value:function(){var n=document.createElement("div");return n.classList.add("input-button"),n}},{key:"createSVGIconElement",value:function(){var n=pe.createSVGElement(Qc);return n.id="camera-icon",n}}]),i}(ht),td=function(){function e(i,t,n,r){g(this,e),this.elementRef=e.createPanelElement(i.inputAreaStyle);var a=new $n(i,n),o={},s=this.createFileUploadComponents(i,n,r,o);i.speechToText&&!o.microphone&&(o.microphone={button:new $c(i,a,t.addNewErrorMessage.bind(t))});var l=new Wc(i,a.inputElementRef,t,n,s);a.submit=l.submitFromInput.bind(l),mc.attach(i,n,a,s,l),i.submitUserMessage=l.programmaticSubmit.bind(l),o.submit={button:l},e.addElements(this.elementRef,a,o,r,s,i.dropupStyles)}return y(e,[{key:"createFileUploadComponents",value:function(t,n,r,a){var o,s,l,u,c=new ir(this.elementRef,t.attachmentContainerStyle,n.demo);if(e.createUploadButtons(t,n.fileTypes||{},c,r,a),(o=n.camera)!=null&&o.files){var d=((s=a.images)==null?void 0:s.fileType)||c.addType(t,n.camera.files,"images");a.camera={button:new ed(r,d,n.camera)}}if((l=n.recordAudio)!=null&&l.files){var h=((u=a.audio)==null?void 0:u.fileType)||c.addType(t,n.recordAudio.files,"audio");a.microphone={button:new Vc(h,n.recordAudio)}}return $r.isEnabled(c,t.dragAndDrop)&&$r.create(r,c,t.dragAndDrop),c}}],[{key:"createPanelElement",value:function(t){var n=document.createElement("div");return n.id="input",Object.assign(n.style,t),n}},{key:"createUploadButtons",value:function(t,n,r,a,o){Object.keys(n).forEach(function(s){var l=s,u=n[l];if(u.files){var c=r.addType(t,u.files,l),d=dc[l],h=d.id,p=d.svgString,m=d.dropupText,v=new fc(a,c,u,h,p,m);o[l]={button:v,fileType:c}}})}},{key:"addElements",value:function(t,n,r,a,o,s){he.addElements(t,n.elementRef);var l=It.create(),u=oc.addButtons(l,r,a,s);nc.set(n.inputElementRef,l,o.elementRef,u),It.add(t,l)}}]),e}(),nd=function(){function e(){g(this,e)}return y(e,null,[{key:"createElements",value:function(t,n,r){var a=document.createElement("div");a.id="chat-view";var o=new tc(t,n,r);n.websocket&&lt.createConnection(n,o);var s=new td(t,o,n,a);return he.addElements(a,o.elementRef,s.elementRef),a}},{key:"render",value:function(t,n,r,a){var o=e.createElements(t,r,a);n.replaceChildren(o)}}]),e}(),rd=`#validate-property-key-view{height:100%;position:relative;display:flex;justify-content:center;align-items:center;padding:8px}#large-loading-ring{display:inline-block;width:50px;height:50px}#large-loading-ring:after{content:" ";display:block;width:38px;height:38px;margin:1px;border-radius:50%;border:5px solid #5fb2ff;border-color:#5fb2ff transparent #5fb2ff transparent;animation:large-loading-ring 1.4s linear infinite}@keyframes large-loading-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}#insert-key-view{height:100%;position:relative}#insert-key-contents{text-align:center;position:absolute;top:44%;left:50%;transform:translate(-50%,-50%);width:82%;display:flex;max-width:700px}#insert-key-title{margin-bottom:15px}#insert-key-input-container{margin-right:2.7em;width:calc(100% - 80px)}#insert-key-input{padding:.3em 1.7em .3em .3em;border-width:1px;border-style:solid;border-radius:3px;width:100%;font-size:inherit}.insert-key-input-valid{border-color:gray}.insert-key-input-invalid{border-color:red}#visibility-icon-container{position:relative;float:right;cursor:pointer;-webkit-user-select:none;user-select:none}.visibility-icon{filter:brightness(0) saturate(100%) invert(63%) sepia(1%) saturate(9%) hue-rotate(43deg) brightness(98%) contrast(92%);position:absolute;right:-1.7em;top:-1.43em}#visible-icon{top:-1.4em}.visibility-icon:hover{filter:unset}.visibility-icon>*{pointer-events:none}#start-button{border:1px solid grey;color:#454545;border-radius:4px;width:3em;display:flex;justify-content:center;align-items:center;cursor:pointer;padding:.28em .3em;-webkit-user-select:none;user-select:none;background-color:#fff}#start-button:hover{background-color:#f2f2f2}#start-button:active{background-color:#d2d2d2}#insert-key-help-text-container{width:100%;position:absolute;margin-top:32px;margin-bottom:20px}#insert-key-help-text-contents{width:100%;position:absolute}#insert-key-input-invalid-text{display:block;margin-top:1em;margin-bottom:.5em;color:red}.insert-key-input-help-text{display:block;margin-top:16px}#loading-ring{display:inline-block;width:16px;height:16px}#loading-ring:after{content:" ";display:block;width:11px;height:11px;margin:1px;border-radius:50%;border:2px solid #0084ff;border-color:#0084ff transparent #0084ff transparent;animation:loading-ring 1.2s linear infinite}@keyframes loading-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}#error-view{color:red;font-size:1.2em;line-height:1.3em;margin-top:-5px;text-align:center;height:100%;display:flex;justify-content:center;align-items:center;padding-left:8px;padding-right:8px}.intro-panel{position:absolute;display:flex;justify-content:center;right:0;bottom:0;left:0;margin:auto;height:fit-content;top:-2.5em}#internal-intro-panel{width:250px;height:min-content;display:block;border-radius:5px;overflow:auto;border:1px solid rgb(203,203,203);padding:10px;max-height:calc(100% - 6.8em)}#internal-intro-panel>p{margin-block-start:.8em;margin-block-end:.8em}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
736  Theme: a11y-dark
737  Author: @ericwbailey
738  Maintainer: @ericwbailey
739
740  Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css
741*/.hljs{background:#2b2b2b;color:#f8f8f2}.hljs-comment,.hljs-quote{color:#d4d0ab}.hljs-deletion,.hljs-name,.hljs-regexp,.hljs-selector-class,.hljs-selector-id,.hljs-tag,.hljs-template-variable,.hljs-variable{color:#ffa07a}.hljs-built_in,.hljs-link,.hljs-literal,.hljs-meta,.hljs-number,.hljs-params,.hljs-type{color:#f5ab35}.hljs-attribute{color:gold}.hljs-addition,.hljs-bullet,.hljs-string,.hljs-symbol{color:#abe338}.hljs-section,.hljs-title{color:#00e0e0}
741.hljs-keyword,.hljs-selector-tag{color:#dcc6e0}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}@media screen and (-ms-high-contrast: active){.hljs-addition,.hljs-attribute,.hljs-built_in,.hljs-bullet,.hljs-comment,.hljs-link,.hljs-literal,.hljs-meta,.hljs-number,.hljs-params,.hljs-quote,.hljs-string,.hljs-symbol,.hljs-type{color:highlight}.hljs-keyword,.hljs-selector-tag{font-weight:700}}#messages{overflow:auto}.outer-message-container:last-child{margin-bottom:5px}.inner-message-container{display:flex;margin-left:auto;margin-right:auto;width:calc(97.5% - 24px);max-width:100%}.message-bubble{margin-top:10px;word-wrap:break-word;width:fit-content;max-width:60%;border-radius:10px;padding:.42em .55em;height:fit-content;line-height:1.26em}.user-message-text{color:#fff;background-color:#0084ff;margin-right:0;margin-left:auto}.ai-message-text{color:#000;background-color:#e4e6eb;margin-left:0;margin-right:auto}.html-message{max-width:unset}.error-message-text{margin:14px auto 10px;background-color:#f4c0c0;color:#474747;text-align:center;max-width:95%}.loading-message-text{width:1em;padding:.6em .75em .6em 1.3em}.message-bubble>p:first-child{margin-top:0}.message-bubble>p:last-child{margin-bottom:0}pre{overflow:auto;display:block;word-break:break-all;word-wrap:break-word;border-radius:7px;background:#2b2b2b;color:#f8f8f2;margin-top:.8em;margin-bottom:.8em;padding:.6em;font-size:.9em;line-height:1.5em}.image-message{padding:0;display:flex;background-color:#ddd}.image-message>*,.image-message>*>*{width:100%;border-radius:8px;display:flex}.audio-message{width:60%;max-width:300px;height:2.2em;max-height:54px;padding:0;background-color:unset}.audio-player{width:100%;height:100%}.audio-player-safari{height:fit-content;width:40px}.audio-player-safari-left{float:left}.audio-player-safari-right{float:right}.any-file-message-bubble{padding:1px}.any-file-message-contents{display:flex}.any-file-message-icon-container{width:1.3em;min-width:1.3em;position:relative;border-radius:4px;margin-left:6px;margin-right:2px}.any-file-message-icon{background-color:#fff;border-radius:4px;position:absolute;width:1em;height:1.25em;padding:1px;margin-top:auto;margin-bottom:auto;top:0;bottom:0}.any-file-message-text{padding-top:5px;overflow-wrap:anywhere;padding-bottom:5px;padding-right:7px}.message-bubble>a{color:inherit}.left-item-position{margin-right:10px}.right-item-position{margin-left:10px}.deep-chat-web-model-button{margin-top:10px;margin-bottom:5px;margin-left:1px}.avatar{padding-top:5px;width:1.5em;height:1.5em;border-radius:1px}.avatar-container{margin-top:9px}.name{margin-top:16px;font-size:15px}#drag-and-drop{position:absolute;display:none;z-index:10;height:calc(100% - 10px);width:calc(100% - 10px);background-color:#70c6ff4d;border:5px dashed #6dafff}#file-attachment-container{position:absolute;height:3.6em;width:calc(80% - 4px);top:-2.5em;border-radius:5px;overflow:auto;text-align:left;background-color:#d7d7d73b;padding-left:4px}.file-attachment{width:2.85em;height:2.85em;display:inline-flex;margin-right:.6em;margin-bottom:.44em;margin-top:4px;position:relative;background-color:#fff;border-radius:5px}.image-attachment{width:100%;height:100%;object-fit:cover;border-radius:5px}.border-bound-attachment{width:calc(100% - 2px);height:calc(100% - 2px);border:1px solid #c3c3c3;border-radius:5px;overflow:hidden}.border-bound-attachment-safari{width:calc(100% - 1px);height:calc(100% - 1px)}.audio-attachment-icon-container{cursor:pointer}.audio-attachment-icon-container:hover{background-color:#f8f8f8}.attachment-icon{left:0;right:0;bottom:0;top:2px;margin:auto;position:absolute;width:25px;-webkit-user-select:none;user-select:none}.not-removable-attachment-icon{top:0;right:0;bottom:0;left:0}.play-icon{filter:brightness(0) saturate(100%) invert(17%) sepia(0%) saturate(1392%) hue-rotate(67deg) brightness(98%) contrast(97%)}.stop-icon{filter:brightness(0) saturate(100%) invert(29%) sepia(90%) saturate(1228%) hue-rotate(198deg) brightness(93%) contrast(98%)}.audio-placeholder-text-3-digits{padding-left:.26rem}.audio-placeholder-text-4-digits{padding-left:.1rem}.any-file-attachment{padding:2px 0}.file-attachment-text-container{position:absolute;width:inherit;display:flex;align-items:center;height:100%;top:-1px}.audio-placeholder-text-3-digits-container{padding-top:1px;cursor:default}.any-file-attachment-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding-left:.13em;margin-left:auto;margin-right:auto}.remove-file-attachment-button{height:1.25em;width:1.25em;border:1px solid #cfcfcf;border-radius:25px;background-color:#fff;top:-4px;right:-5px;position:absolute;display:flex;justify-content:center;cursor:pointer;-webkit-user-select:none;user-select:none}.remove-file-attachment-button:hover{background-color:#e4e4e4}.remove-file-attachment-button:active{background-color:#d7d7d7}.x-icon{color:#4e4e4e;top:-.075em;position:relative;font-size:1.05em}.modal{display:none;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:80%;max-width:420px;max-height:80%;margin:auto;top:0;right:0;bottom:0;left:0;z-index:2}.modal-content{border-top:1px solid rgb(217,217,217);border-left:1px solid rgb(217,217,217);border-right:1px solid rgb(217,217,217);border-top-left-radius:inherit;border-top-right-radius:inherit;background-color:#fff;overflow-y:auto;height:fit-content;max-height:calc(100% - 3.3em);width:100%}.modal-content>p{margin-left:1em;margin-right:1em}.modal-content>ul{margin-right:1em}.modal-button-panel{height:3.3em;border:1px solid;border-color:rgb(223,223,223) rgb(217,217,217) rgb(217,217,217);border-bottom-left-radius:inherit;border-bottom-right-radius:inherit;background-color:#fff;text-align:center;justify-content:center;display:flex;width:100%}.modal-button{min-width:2.5em;text-align:center;color:#fff;border-radius:5px;padding:.4em .4em .3em;height:1.25em;background-color:#3279b2;top:0;bottom:0;cursor:pointer;-webkit-user-select:none;user-select:none;margin:auto .31em}.modal-button:hover{background-color:#276da7}.modal-button:active{background-color:#1b5687}.modal-svg-button{padding:0 0 2px;width:2em;height:1.8em}.modal-svg-button-icon{width:100%;height:100%;filter:brightness(0) saturate(100%) invert(100%) sepia(15%) saturate(4%) hue-rotate(346deg) brightness(101%) contrast(102%)}#modal-background-panel{position:absolute;width:100%;height:100%;background-color:#00000042;
741z-index:1;display:none}.show-modal-background{animation:fadeInBackground .3s ease-in-out}@keyframes fadeInBackground{0%{opacity:0}to{opacity:1}}.show-modal{animation:fadeInModal .3s ease-in-out}@keyframes fadeInModal{0%{opacity:0;scale:.95}to{opacity:1;scale:1}}.hide-modal-background{animation:fadeOutBackground .2s ease-in-out}@keyframes fadeOutBackground{0%{opacity:1}to{opacity:0}}.hide-modal{animation:fadeOutModal .2s ease-in-out}@keyframes fadeOutModal{0%{opacity:1;scale:1}to{opacity:0;scale:.95}}.modal-camera-content{overflow:hidden;text-align:center;border:unset;height:100%;background-color:#2a2a2a;display:flex;justify-content:center}.camera-modal-canvas{max-width:100%;max-height:100%;margin-top:auto;margin-bottom:auto}.modal-svg-submit-button{background-color:green}.modal-svg-submit-button:hover{background-color:#007500}.modal-svg-submit-button:active{background-color:#006500}.modal-svg-submit-disabled{pointer-events:none;background-color:#747474}.modal-svg-close-button{height:1.56em;padding-top:.37em;padding-bottom:0;background-color:#c13e3e}.modal-svg-close-button:hover{background-color:#b43434}.modal-svg-close-button:active{background-color:#972929}.modal-svg-close-icon{width:80%;height:80%}.modal-svg-camera-button{height:1.6em;padding-top:.38em;padding-bottom:0}.modal-svg-camera-icon{height:76%}.modal-svg-refresh-icon{height:105%}.modal-svg-refresh-button{height:1.66em;padding-top:.11em;padding-bottom:.21em}.input-button-container{position:relative;z-index:1}.inside-right{position:absolute;right:calc(10% + .35em);bottom:.85em}.inside-left{position:absolute;left:calc(10% + .35em);bottom:.85em}.outside-left{position:absolute;right:calc(11px - .55em);bottom:.88em}.outside-right{position:absolute;left:calc(11px - .55em);bottom:.88em}#upload-images-icon{position:absolute;pointer-events:none;width:1.45em;height:1.45em;left:.11em;bottom:.08em;filter:brightness(0) saturate(100%) invert(43%) sepia(0%) saturate(740%) hue-rotate(77deg) brightness(99%) contrast(92%)}#upload-gifs-icon{position:absolute;pointer-events:none;width:1.5em;height:1.48em;left:.07em;bottom:.08em;filter:brightness(0) saturate(100%) invert(49%) sepia(0%) saturate(2586%) hue-rotate(12deg) brightness(93%) contrast(90%)}#upload-audio-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.17em;bottom:.2em;filter:brightness(0) saturate(100%) invert(15%) sepia(0%) saturate(337%) hue-rotate(125deg) brightness(91%) contrast(94%);transform:scaleX(.95)}#camera-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.23em;bottom:.2em;filter:brightness(0) saturate(100%) invert(52%) sepia(0%) saturate(161%) hue-rotate(164deg) brightness(91%) contrast(92%);transform:scaleX(.95)}#upload-mixed-files-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.25em;bottom:.2em;filter:brightness(0) saturate(100%) invert(53%) sepia(0%) saturate(36%) hue-rotate(74deg) brightness(98%) contrast(93%);transform:scaleX(.95)}#interim-text{color:gray}#microphone-button{padding-top:.5px}.outer-button-container>#microphone-button{padding-bottom:1px}#microphone-icon{position:absolute;pointer-events:none;width:1.21em;height:1.21em;left:.25em;bottom:.25em}.default-microphone-icon{filter:brightness(0) saturate(100%) invert(32%) sepia(0%) saturate(924%) hue-rotate(46deg) brightness(95%) contrast(99%)}.active-microphone-icon{filter:brightness(0) saturate(100%) invert(10%) sepia(97%) saturate(7495%) hue-rotate(0deg) brightness(101%) contrast(107%);border-radius:10px}.command-microphone-icon{filter:brightness(0) saturate(100%) invert(42%) sepia(96%) saturate(1067%) hue-rotate(77deg) brightness(99%) contrast(102%)}.unsupported-microphone{display:none}#submit-icon{height:100%;filter:brightness(0) saturate(100%) invert(32%) sepia(0%) saturate(924%) hue-rotate(46deg) brightness(95%) contrast(99%);width:1.21em}#stop-icon{background-color:#acacac;position:absolute;width:.95em;height:.95em;left:.35em;bottom:.35em;border-radius:2px}.submit-button-enlarged{scale:1.1;margin-right:.3em;margin-left:.3em}.dots-jumping{position:relative;left:calc(-9990px + .275em);width:.22em;height:.22em;border-radius:5px;background-color:#848484;color:#848484;box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484;animation:dots-jumping 1.5s infinite linear;bottom:-.7em}@keyframes dots-jumping{0%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}16.667%{box-shadow:9990px -6px #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}33.333%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}50%{box-shadow:9990px 0 #848484,calc(9990px + .44em) -6px 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}66.667%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}83.333%{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) -6px 0 0 #848484}to{box-shadow:9990px 0 #848484,calc(9990px + .44em) 0 0 0 #848484,calc(9990px + .8em) 0 0 0 #848484}}.dots-flashing{position:relative;width:.45em;height:.45em;border-radius:5px;background-color:var(--message-dots-color);color:var(--message-dots-color);animation:dots-flashing 1s infinite linear alternate;animation-delay:.5s}.dots-flashing:before,.dots-flashing:after{content:"";display:inline-block;position:absolute;top:0}.dots-flashing:before{left:-.7em;width:.45em;height:.45em;border-radius:5px;background-color:var(--message-dots-color);color:var(--message-dots-color);animation:dots-flashing 1s infinite alternate;animation-delay:0s}.dots-flashing:after{left:.7em;width:.45em;height:.45em;border-radius:5px;background-color:var(--message-dots-color);color:var(--message-dots-color);animation:dots-flashing 1s infinite alternate;animation-delay:1s}@keyframes dots-flashing{0%{background-color:var(--message-dots-color)}50%,to{background-color:var(--message-dots-color-fade)}}.input-button{border-radius:4px;cursor:pointer;margin-bottom:.2em;-webkit-user-select:none;user-select:none}.input-button-svg{width:1.65em;height:1.65em}.input-button:hover{background-color:#9c9c9c2e}.input-button:active{background-color:#9c9c9c5e}
741.loading-button{cursor:auto}.loading-button:hover{background-color:unset}.text-button{filter:unset!important;display:flex;justify-content:center;align-items:center;margin-left:4px;margin-right:4px;height:1.6em}#text-input-container{background-color:#fff;width:80%;display:flex;border:1px solid #0000001a;border-radius:5px;margin-top:.8em;margin-bottom:.8em;box-shadow:#959da533 0 1px 12px;overflow-y:auto;max-height:200px;position:relative}.text-input-container-left-adjustment{margin-left:1.5em}.text-input-container-right-adjustment{margin-right:1.5em}.text-input-container-left-small-adjustment{margin-left:1.1em}.text-input-container-left-small-adjustment>.outside-left{right:calc(14px - .55em)}.text-input-container-right-small-adjustment{margin-right:1.1em}.text-input-container-right-small-adjustment>.outside-right{left:calc(14px - .55em)}#text-input{text-align:left;outline:none;word-wrap:break-word;line-break:auto}.text-input-styling{padding:.4em .5em;overflow:overlay;width:100%}.text-input-inner-left-adjustment{padding-left:2.2em}.text-input-inner-right-adjustment{padding-right:2em}.text-input-disabled{pointer-events:none;-webkit-user-select:none;user-select:none}.text-input-placeholder{color:gray}.outside-right>#dropup-menu,.inside-right>#dropup-menu{right:0}#dropup-icon{position:absolute;pointer-events:none;width:1.16em;height:1.2em;left:.265em;bottom:.43em;filter:brightness(0) saturate(100%) invert(54%) sepia(0%) saturate(724%) hue-rotate(6deg) brightness(92%) contrast(90%)}#dropup-menu{background-color:#fff;position:absolute;transform:translateY(-100%);border-radius:5px;z-index:1;top:-.49em;box-shadow:#0003 -1px 2px 10px,#0000001a 0 2px 4px;cursor:pointer;-webkit-user-select:none;user-select:none}.dropup-menu-item{height:1.4em;padding:.28em .84em .28em .35em;display:flex;position:relative}.dropup-menu-item:first-child{padding-top:.49em;border-top-left-radius:inherit;border-top-right-radius:inherit}.dropup-menu-item:last-child{padding-bottom:.45em;border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.dropup-menu-item-icon{width:1.39em;position:relative;margin-right:.56em}.dropup-menu-item-icon>svg{bottom:0!important;top:0!important;margin-bottom:auto;margin-top:auto}.dropup-menu-item-text{margin-top:.08em;width:max-content}#input{width:100%;display:inline-flex;text-align:center;margin-left:auto;margin-right:auto;margin-top:auto;position:relative;justify-content:center}#chat-view{height:100%;display:grid;grid-template-columns:100%}::-webkit-scrollbar{width:9px;height:9px}::-webkit-scrollbar-thumb{background-color:#d0d0d0;border-radius:5px}::-webkit-scrollbar-track{background-color:#f2f2f2}:host{all:initial;display:table-cell}#container{height:inherit;width:inherit;overflow:hidden}
742`,id=Object.defineProperty,z=function(i,t,n,r){for(var a=void 0,o=i.length-1,s;o>=0;o--)(s=i[o])&&(a=s(t,n,a)||a);return a&&id(t,n,a),a},q=function(e){P(i,e);function i(){var t;return g(this,i),t=O(this,i),t.getMessages=function(){return[]},t.submitUserMessage=function(){return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.")},t.focusInput=function(){return Ci.focusFromParentElement(t._elementRef)},t.refreshMessages=function(){},t.clearMessages=function(){},t.scrollToBottom=function(){},t.disableSubmitButton=function(){},t._hasBeenRendered=!1,t._auxiliaryStyleApplied=!1,t._addMessage=function(){return console.warn("addMessage failed - please wait for chat view to render before calling this property.")},Yu.appendStyleSheetToHead(),t._elementRef=document.createElement("div"),t._elementRef.id="container",t.attachShadow({mode:"open"}).appendChild(t._elementRef),cn.apply(rd,t.shadowRoot),setTimeout(function(){t._hasBeenRendered||t.onRender()},20),t}return y(i,[{key:"changeToChatView",value:function(){this._activeService&&(this._activeService.validateConfigKey=!1),this.onRender()}},{key:"onRender",value:function(){var n;(!this._activeService||this._activeService.demo)&&(this._activeService=Ku.create(this)),this.auxiliaryStyle&&!this._auxiliaryStyleApplied&&(cn.apply(this.auxiliaryStyle,this.shadowRoot),this._auxiliaryStyleApplied=!0),cn.applyDefaultStyleToComponent(this.style,this.chatStyle),Re.checkForContainerStyles(this,this._elementRef),this._activeService.key&&this._activeService.validateConfigKey?fs.render(this._elementRef,this.changeToChatView.bind(this),this._activeService):!(this._activeService instanceof ce)||this._activeService.key?((n=this._childElement)!==null&&n!==void 0||(this._childElement=this.children[0]),nd.render(this,this._elementRef,this._activeService,this._childElement)):this._activeService instanceof ce&&ku.render(this._elementRef,this.changeToChatView.bind(this),this._activeService),this._hasBeenRendered=!0,At.onRender(this)}},{key:"disconnectedCallback",value:function(){Qn.chat=void 0}}]),i}(vu);z([U("object")],q.prototype,"directConnection");z([U("object")],q.prototype,"request");z([U("object")],q.prototype,"webModel");z([U("object")],q.prototype,"stream");z([U("object")],q.prototype,"requestBodyLimits");z([U("function")],q.prototype,"requestInterceptor");z([U("function")],q.prototype,"responseInterceptor");z([U("function")],q.prototype,"validateInput");z([U("object")],q.prototype,"chatStyle");z([U("object")],q.prototype,"attachmentContainerStyle");z([U("object")],q.prototype,"dropupStyles");z([U("object")],q.prototype,"inputAreaStyle");z([U("object")],q.prototype,"textInput");z([U("object")],q.prototype,"submitButtonStyles");z([U("string")],q.prototype,"auxiliaryStyle");z([U("array")],q.prototype,"initialMessages");z([U("object")],q.prototype,"introMessage");z([U("object")],q.prototype,"avatars");z([U("object")],q.prototype,"names");z([U("boolean")],q.prototype,"displayLoadingBubble");z([U("object")],q.prototype,"errorMessages");z([U("object")],q.prototype,"messageStyles");z([U("object")],q.prototype,"textToSpeech");z([U("object")],q.prototype,"speechToText");z([U("object")],q.prototype,"images");z([U("object")],q.prototype,"gifs");z([U("object")],q.prototype,"camera");z([U("object")],q.prototype,"audio");z([U("object")],q.prototype,"microphone");z([U("object")],q.prototype,"mixedFiles");z([U("object")],q.prototype,"dragAndDrop");z([U("object")],q.prototype,"introPanelStyle");z([U("object")],q.prototype,"htmlClassUtilities");z([U("function")],q.prototype,"onNewMessage");z([U("function")],q.prototype,"onClearMessages");z([U("function")],q.prototype,"onComponentRender");z([U("function")],q.prototype,"onError");z([U("object")],q.prototype,"demo");z([U("object")],q.prototype,"_insertKeyViewStyles");customElements.define("deep-chat",q);const sa="Chat failed to load. Clear chat or try again in a moment.";
742class _e extends Error{constructor(i,t,n){super(i),this.details=t,this.code=n,this.name="CustomError"}}function Lt(e){e instanceof _e&&e.details&&console.error("Details:",e.details)}const ad=["s","q","search"];function od(e){const i=new URLSearchParams(e),t=new URLSearchParams;for(const r of ad)for(const a of i.getAll(r))t.append(r,a);const n=t.toString();return n?`?${n}`:""}function sd(){if(typeof window>"u"||!window.location)return;const{origin:e,pathname:i}=window.location,t=od(window.location.search),n=`${e}${i}${t}`;return{url:n,pathname:i,search:t,currentScreen:{url:n,pathname:i,search:t}}}async function wn(e,i="GET",t=null,n){const r={method:i,headers:{"Content-Type":"application/json"}};n&&(r.headers={...r.headers,Authorization:`Bearer ${n}`}),i==="POST"&&t&&(r.body=JSON.stringify(t));try{const a=await fetch(`https://public-api.wordpress.com/wpcom/v2/${e}`,r);if(!a.ok)throw a.status===429?new _e("Rate limit exceeded","Please try again later","RATE_LIMIT"):a.status===403?new _e("Request failed",`Status: ${a.status}`,"REQUEST_UNAUTHORIZED"):new _e("Request failed",`Status: ${a.status}`,"REQUEST_FAILED");return await a.json()}catch(a){throw a instanceof _e?a:new _e("Request failed",a.message,"UNKNOWN_ERROR")}}class ld{constructor(i,t){$(this,"token");$(this,"bot");this.token=t,this.bot=i}async loadPreviousMessages(i,t){return await wn(`odie/chat/${this.bot}/${i}?${t?`&session_id=${t}`:""}`,"GET",null,this.token)}async sendMessage(i,t,n){var s,l;const r=sd(),a={message:i,session_id:n,...r?{context:r}:{}},o=await wn(`odie/chat/${this.bot}/${t||""}`,"POST",a,this.token);if(!o)throw new _e("Failed to update chat session","No response data");return{chatId:o.chat_id,sessionId:o.session_id,messageId:(s=o.messages[0])==null?void 0:s.message_id,content:(l=o==null?void 0:o.messages[0])==null?void 0:l.content,sources:o.messages[0].context.sources}}async sendFeedback(i,t,n,r){const a={rating_value:n?1:0,session_id:r};if(!i||!t)throw new _e("Failed to send feedback","No chat ID or message ID");return await wn(`odie/chat/${this.bot}/${i}/${t}/feedback?`,"POST",a,this.token)}}const Pt=class Pt{constructor(i,t,n,r=!1,a=null,o,s=null){$(this,"_ttl");$(this,"_chatBot");$(this,"_chatElementRef");$(this,"_chatId");$(this,"_sessionId");$(this,"_chatService");$(this,"_hideInputArea",!1);$(this,"_notice");$(this,"_lastMessageTime",null);$(this,"_placeholder");if(!t)throw new Error("Error initializing chat");this._chatBot=t,this._chatId=this.getChatIdFromStorage(),this._sessionId=this.getSessionIdFromStorage(),this._chatElementRef=document.createElement("deep-chat"),this._chatElementRef.id="chat-element",this._chatElementRef.setAttribute("part","chat-element"),i.appendChild(this._chatElementRef),this._chatService=new ld(t,n),this._hideInputArea=r,this._notice=a,this._ttl=o??Pt.DEFAULT_TTL,this._placeholder=s,this.initializeChat()}initializeChat(){this.setupMessageHandlers(),this.applyChatStyles(),this.setupHtmlClassUtilities(),this.setupOnComponentRender()}async loadPreviousMessages(){if(this._chatId){const i=await this._chatService.loadPreviousMessages(this._chatId,this._sessionId);if(i.messages&&i.messages.length>0){const t=i.messages[i.messages.length-1];t.created_at&&(this._lastMessageTime=this.parseUTCTimestamp(t.created_at))}if(this.isChatExpired())return this.clearChat(),[];this.addMessagesToHistory(i.messages)}return[]}async handleChatRequest(i,t){try{if(this.isChatExpired()){t.onResponse({error:"Chat session expired. Please clear the chat to start a new conversation."});return}const{chatId:n,sessionId:r,messageId:a=0,content:o,sources:s}=await this._chatService.sendMessage(i.messages[0].text,this._chatId,this._sessionId);this._chatId=n,this.saveChatIdToStorage(n),this._sessionId=r,this.saveSessionIdToStorage(r),this._lastMessageTime=Date.now(),t.onResponse({role:"ai",html:mr(o,s,a,this._notice)})}catch(n){t.onResponse({error:n.message})}}setupMessageHandlers(){this._chatElementRef.request={handler:this.handleChatRequest.bind(this)}}applyChatStyles(){this._chatElementRef.messageStyles=this.getMessageStyles(),this._chatElementRef.chatStyle=this.getChatStyle(),this._chatElementRef.inputAreaStyle=this.getInputAreaStyle(),this._chatElementRef.textInput=this.getTextInputConfig(),this._chatElementRef.submitButtonStyles=this.getSubmitButtonStyles()}getSubmitButtonStyles(){return{submit:{container:{default:{backgroundColor:"var(--submit-button-color)",color:"var(--submit-button-text-color)",borderRadius:"var(--submit-button-border-radius)"},hover:{backgroundColor:"var(--submit-button-hover-color)"}}}}}getMessageStyles(){return{default:{shared:{innerContainer:{width:"var(--bubble-max-width)"},bubble:{padding:"var(--bubble-padding)"}},user:{bubble:{borderBottomRightRadius:"0",border:"var(--reply-bubble-border)",borderRadius:"var(--reply-bubble-border-radius)",backgroundColor:"var(--reply-bubble-color)",color:"var(--reply-color)",overflow:"hidden",fontFamily:"var(--font-family)",fontSize:"var(--text-size)"}},ai:{bubble:{width:"100%",maxWidth:"100%",border:"var(--ai-bubble-border)",borderRadius:"var(--ai-bubble-border-radius)",backgroundColor:"var(--ai-bubble-color)",color:"var(--ai-text-color)",fontFamily:"var(--font-family)",fontSize:"var(--text-size)"}}}}}getChatStyle(){return{border:"var(--chat-element-border)",width:"100%",height:"100%",maxWidth:"100vw",backgroundColor:"transparent",fontFamily:"var(--font-family)"}}getInputAreaStyle(){return{display:this._hideInputArea?"none":"flex"}}getTextInputConfig(){return{styles:{container:{backgroundColor:"var(--input-area-background-color)",border:"var(--input-area-border)",borderRadius:"var(--input-area-border-radius)",boxShadow:"var(--input-area-box-sha
742dow)"},text:{color:"var(--input-text-color)",fontFamily:"var(--font-family)"},focus:{border:"var(--input-focus-border)"}},placeholder:{...this._placeholder?{text:this._placeholder}:{},style:{color:"var(--input-placeholder-color)"}}}}setupOnComponentRender(){this._chatElementRef.onNewMessage=()=>{setTimeout(()=>{const i=this._chatElementRef.shadowRoot.getElementById("messages"),[t]=Array.from(i.getElementsByClassName("user-message")).slice(-1);!t||i.scrollTop<t.offsetTop||(i.scrollTop=t.offsetTop-5)})}}setupHtmlClassUtilities(){this._chatElementRef.htmlClassUtilities=this.getHtmlClassUtilities()}getHtmlClassUtilities(){return{response:{styles:{default:{margin:"-15px 0"}}},"response-a":{styles:{default:{color:"var(--response-link-color)"},hover:{color:"var(--response-link-color-hover)"}}},feedback:{styles:{default:{display:"flex",position:"absolute",top:"5px",right:"5px"}}},"feedback-text":{styles:{default:{width:"calc(100% - 42px)",paddingTop:"2px"}}},"feedback-icon":{styles:{default:{width:"20px",height:"20px",cursor:"pointer",borderRadius:"5px"}}},"feedback-icon-positive":{events:{click:i=>this.sendFeedback(!0,i)},styles:{hover:{fill:"var(--feedback-positive-hover-color)"}}},"feedback-icon-negative":{events:{click:i=>this.sendFeedback(!1,i)},styles:{default:{transform:"rotate(180deg)",marginLeft:"3px"},hover:{fill:"var(--feedback-negative-hover-color)"}}},footer:{styles:{default:{position:"relative"}}},sources:{styles:{default:{margin:"20px 0",color:"var(--ai-sources-color)",minHeight:"10px"}}},"sources-summary":{styles:{default:{fontWeight:"bold",cursor:"pointer",padding:"5px",borderRadius:"4px"}}},"sources-ul":{styles:{default:{listStyle:"none",padding:"0",margin:"10px 0 0"}}},"sources-li":{styles:{default:{margin:"10px 0"}}}
742,"sources-a":{styles:{default:{textDecoration:"none",color:"inherit",display:"flex",alignItems:"center",marginLeft:"20px"},hover:{textDecoration:"underline"}}},"sources-icons":{styles:{default:{width:"16px",height:"16px",minWidth:"16px",marginRight:"8px",fill:"currentColor"}}},notice:{styles:{default:{fontSize:"80%",textAlign:"right"}}},"notice-link":{styles:{default:{color:"var(--notice-link-color)",textDecoration:"none"},hover:{color:"var(--notice-link-color-hover)",textDecoration:"underline"}}}}}getLocalStorageKey(i){return`ai-widget-${this._chatBot}-${i}-id`}saveChatIdToStorage(i){localStorage.setItem(this.getLocalStorageKey("chat"),i.toString())}saveSessionIdToStorage(i){localStorage.setItem(this.getLocalStorageKey("session"),i)}getChatIdFromStorage(){const i=localStorage.getItem(this.getLocalStorageKey("chat"));return i?parseInt(i,10):null}getSessionIdFromStorage(){return localStorage.getItem(this.getLocalStorageKey("session"))||null}parseUTCTimestamp(i){const t=i.replace(" ","T")+"Z";return new Date(t).getTime()}isChatExpired(){return!this._chatId||!this._lastMessageTime?!1:Date.now()-this._lastMessageTime>this._ttl}setAvatar(i){this._chatElementRef.avatars={ai:{src:i,styles:{avatar:{display:i?"unset":"none",height:"var(--avatar-size)",marginTop:"-3px",width:"var(--avatar-size)",border:"var(--ai-avatar-border)",borderRadius:"var(--ai-avatar-border-radius)"}}},user:{styles:{avatar:{display:"none"}}}}}setFirstMessage(i){this._chatElementRef.introMessage={text:i}}setErrorMessage(i){this._chatElementRef.introMessage={html:is(i)}}addMessagesToHistory(i){const t=i==null?void 0:i.map(n=>n.role==="user"?{role:"user",text:n.content}:{role:"ai",html:mr(n.content,n.context.sources,n.message_id,this._notice)});this.setHistory(t)}clearChat(){var i;try{this._chatElementRef.clearMessages()}catch{this._chatElementRef.introMessage={text:((i=this._chatElementRef.introMessage)==null?void 0:i.text)||""}}this._chatId=null,localStorage.removeItem(this.getLocalStorageKey("chat")),this._sessionId=null,localStorage.removeItem(this.getLocalStorageKey("session")),this._lastMessageTime=null,this.setHistory([])}sendMessage(i){i.trim()!==""&&this._chatElementRef.submitUserMessage({text:i})}getChatId(){return this._chatId}getMessages(){return this._chatElementRef.getMessages()}isChatExpiredPublic(){return this.isChatExpired()}async sendFeedback(i,t){const n=t.target,r=n==null?void 0:n.getAttribute("data-message-id");if(!r||!this._chatId)return;const a=n.closest(".feedback");if(a){const o=a.querySelector(".feedback-icon-positive"),s=a.querySelector(".feedback-icon-negative");o&&o.setAttribute("fill","var(--feedback-default-color)"),s&&s.setAttribute("fill","var(--feedback-default-color)")}try{await this._chatService.sendFeedback(this._chatId,Number(r),i,this._sessionId),n.setAttribute("fill",i?"var(--feedback-positive-color)":"var(--feedback-negative-color)")}catch(o){Lt(o)}}setHistory(i){this._chatElementRef.initialMessages=i}async load(){await this.loadPreviousMessages()}};$(Pt,"DEFAULT_TTL",24*60*60*1e3);let Rt=Pt;const Ot=["utm-source","utm-medium","utm-campaign","utm-target-domain"];class ud extends HTMLElement{constructor(){super();$(this,"_shadowRoot");$(this,"_chatLogic");$(this,"_token");$(this,"_bot");$(this,"_avatar");$(this,"_title");$(this,"_subtitle");$(this,"_firstMessage");$(this,"_placeholder");$(this,"_clearOnError",!1);$(this,"_notice",null);$(this,"_ttl");this._shadowRoot=this.attachShadow({mode:"open"}),this._chatLogic=null,this._token=this.getAttribute("token"),this._bot=this.getAttribute("bot"),this._avatar=this.getAttribute("avatar"),this._title=this.getAttribute("title"),this._subtitle=this.getAttribute("subtitle"),this._firstMessage=this.getAttribute("first-message"),this._placeholder=this.getAttribute("placeholder"),this._clearOnError=!!this.hasAttribute("clear-on-error");const t=this.getAttribute("ttl");if(this._ttl=t?parseInt(t,10):void 0,this.hasAttribute("notice")){try{this._notice=JSON.parse(this.getAttribute("notice")||"{}")}catch{}this.hasAttribute("notice")&&(this._notice=this.getAttribute("notice")||"{}")}this._configureUtmParams(),this._shadowRoot.innerHTML=Qo}_configureUtmParams(){const t=this.getAttribute("utm-source"),n=this.getAttribute("utm-medium"),r=this.getAttribute("utm-campaign"),a=this.getAttribute("utm-target-domain");a&&t&&n&&r&&vi({utm_source:t,utm_medium:n,utm_campaign:r,utm_target_domain:a})}static get observedAttributes(){return["token","bot","avatar","title","subtitle","first-message","placeholder","clear-on-error","notice","ttl",...Ot]}attributeChangedCallback(t,n,r){if(n!==r){const o={token:"_token",bot:"_bot",avatar:"_avatar",title:"_title",subt
742itle:"_subtitle","first-message":"_firstMessage",placeholder:"_placeholder",notice:"_notice"}[t];o&&(this[o]=r),Ot.includes(t)&&this._configureUtmParams()}}setTitle(t){this._shadowRoot.querySelector(".header-title").textContent=t}setSubtitle(t){this._shadowRoot.querySelector(".header-subtitle").textContent=t}setLoaded(){this._shadowRoot.querySelector("#chat-widget").classList.add("loaded")}load(){var t;this._chatLogic&&((t=this._chatLogic)==null||t.load().then(()=>{var n,r;(n=this._chatLogic)==null||n.setAvatar(this._avatar),(r=this._chatLogic)==null||r.setFirstMessage(this._firstMessage),this.setSupportLink(),this.setTitle(this._title),this.setSubtitle(this._subtitle),this.setLoaded()}).catch(n=>this.handleOnLoadError(n)))}setSupportLink(){const t=document.createElement("div");t.id="support-link",t.setAttribute("part","support-link");const n=document.createElement("slot");n.name="support-link",t.appendChild(n),this._shadowRoot.querySelector("#chat-content").appendChild(t)}connectedCallback(){var t;this.addEventListeners(),this._chatLogic=new Rt(this._shadowRoot.querySelector("#chat-content"),this._bot,this._token,!1,this._notice,this._ttl,this._placeholder),(t=this._chatLogic)==null||t.load().then(()=>{var n,r;(n=this._chatLogic)==null||n.setAvatar(this._avatar),(r=this._chatLogic)==null||r.setFirstMessage(this._firstMessage),this.setSupportLink(),this.setTitle(this._title),this.setSubtitle(this._subtitle),this.setLoaded()}).catch(n=>{var r;Lt(n),(r=this._chatLogic)==null||r.setErrorMessage("We failed to load the chat. Please try again later or start a new chat."),this.setTitle(this._title),this.setSubtitle(this._subtitle),this.setLoaded()})}addEventListeners(){const t=this._shadowRoot.querySelector("#chat-icon"),n=this._shadowRoot.querySelector("#chat-close"),r=this._shadowRoot.querySelector("#chat-clear");this._shadowRoot.addEventListener("keypress",a=>a.stopPropagation()),t.addEventListener("click",()=>this.toggleChat()),n.addEventListener("click",()=>this.toggleChat()),r.addEventListener("click",()=>this.clearChat())}toggleChat(){const t=this._shadowRoot.querySelector("#chat-widget");t.classList.contains("open")?(t.classList.add("closing"),setTimeout(()=>{t.classList.remove("open","closing")},500)):t.classList.add("open")}clearChat(){this._chatLogic&&(this._chatLogic.clearChat(),this.load())}handleOnLoadError(t){var n;Lt(t),this.setTitle(this._title),this.setSubtitle(this._subtitle),this._clearOnError?this.clearChat():(n=this._chatLogic)==null||n.setErrorMessage(sa),this.setLoaded()}getChatId(){return this._chatLogic?this._chatLogic.getChatId():null}getMessages(){return this._chatLogic?this._chatLogic.getMessages():[]}isChatExpired(){return this._chatLogic?this._chatLogic.isChatExpiredPublic():!1}}class cd extends HTMLElement{constructor(){super();$(this,"_shadowRoot");$(this,"_chatLogic");$(this,"_token");$(this,"_bot");$(this,"_avatar");$(this,"_firstMessage");$(this,"_placeholder");$(this,"_hideInputArea",!1);$(this,"_clearOnError",!1);$(this,"_notice",null);$(this,"_ttl");this._shadowRoot=this.attachShadow({mode:"open"}),this._chatLogic=null,this._token=this.getAttribute("token"),this._bot=this.getAttribute("bot"),this._avatar=this.getAttribute("avatar"),this._firstMessage=this.getAttribute("first-message"),this._placeholder=this.getAttribute("placeholder"),this._clearOnError=!!this.hasAttribute("clear-on-error");const t=this.getAttribute("ttl");this._ttl=t?parseInt(t,10):void 0,this.hasAttribute("notice")&&(this._notice=this.getAttribute("notice")),this._configureUtmParams(),this._shadowRoot.innerHTML=es}_configureUtmParams(){const t=this.getAttribute("utm-source"),n=this.getAttribute("utm-medium"),r=this.getAttribute("utm-campaign"),a=this.getAttribute("utm-target-domain");a&&t&&n&&r&&vi({utm_source:t,utm_medium:n,utm_campaign:r,utm_target_domain:a})}static get observedAttributes(){return["token","bot","avatar","first-message","placeholder","hide-input-area","clear-on-error","notice","ttl",...Ot]}attributeChangedCallback(t,n,r){if(n!==r){const o={token:"_token",bot:"_bot",avatar:"_avatar","first-message":"_firstMessage",placeholder:"_placeholder","hide-input-area":"_hideInputArea","clear-on-error":"_clearOnError",notice:"_notice"}[t];o&&(this[o]=r),Ot.includes(t)&&this._configureUtmParams()}}setLoaded(){this._shadowRoot.querySelector("#chat-embed").classList.add("loaded")}load(){this._chatLogic&&this._chatLogic.load().then(()=>{var t,n;(t=this._chatLogic)==null||t.setAvatar(this._avatar),(n=this._chatLogic)==null||n.setFirstMessage(this._firstMessage),this.setLoaded()}).catch(t=>this.handleOnLoadError(t))}connectedCallback(){this.addEventListeners(),this._chatLogic=new Rt(this._shadowRoot.querySelector("#chat-content"),this._bot,this._token,this._hideInputArea,this._notice,this._ttl,this._placeholder),this.load()}addEventListeners(){const t=this._shadowRoot.querySelector("#chat-clear");this._shadowRoot.addEventListener("keypress",n=>n.stopPropagation()),t.addEventListener("click",()=>this.clearChat())}clearChat(){this._chatLogic&&(this._chatLogic.clearChat(),this.load())}handleOnLoadError(t){var n;Lt(t),this._clearOnError?this.clearChat():(n=this._chatLogic)==null||n.setErrorMessage(sa),this.setLoaded()}sendMessage(t){this._chatLogic&&this._chatLogic.sendMessage(t)}getChatId(){return this._chatLogic?this._chatLogic.getChatId():null}getMessages(){return this._chatLogic?this._chatLogic.getMessages():[]}isChatExpired(){return this._chatLogic?this._chatLogic.isChatExpiredPublic():!1}}customElements.define("chat-widget",ud);customElements.define("chat-embed",cd);
743;
744(()=>{var e={7961(e){let n;window._tkq=window._tkq||[];const t=console.error;const o={initialize:function(e,n){o.setUser(e,n),o.identifyUser()},mc:{bumpStat:function(e,n){const t=function(e,n){let t="";if("object"==typeof e)for(const n in e)t+="&x_"+encodeURIComponent(n)+"="+encodeURIComponent(e[n]);else t="&x_"+encodeURIComponent(e)+"="+encodeURIComponent(n);return t}(e,n);(new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv"+t+"&t="+Math.random()}}
744,tracks:{recordEvent:function(e,n){n=n||{},0===e.indexOf("jetpack_")?window._tkq.push(["recordEvent",e,n]):t('- Event name must be prefixed by "jetpack_"')},recordPageView:function(e){o.tracks.recordEvent("jetpack_page_view",{path:e})}},setUser:function(e,t){n={ID:e,username:t}},identifyUser:function(){n&&window._tkq.push(["identifyUser",n.ID,n.username])},clearedIdentity:function(){window._tkq.push(["clearIdentity"])}};e.exports=o}},n={};var t=function t(o){var r=n[o];if(void 0!==r)return r.exports;var i=n[o]={exports:{}};return e[o](i,i.exports,t),i.exports}(7961);window.analytics=t})();;
745( function () {
746	'use strict';
747
748	if ( typeof window.wpcom === 'undefined' ) {
749		window.wpcom = {};
750	}
751
752	if ( window.wpcom.carousel ) {
753		return;
754	}
755
756	var prebuilt_widths = jetpackCarouselStrings.widths;
757	var pageviews_stats_args = jetpackCarouselStrings.stats_query_args;
758
759	var findFirstLargeEnoughWidth = function ( original_w, original_h, dest_w, dest_h ) {
760		var inverse_ratio = original_h / original_w;
761
762		for ( var i = 0; i < prebuilt_widths.length; ++i ) {
763			if ( prebuilt_widths[ i ] >= dest_w || prebuilt_widths[ i ] * inverse_ratio >= dest_h ) {
764				return prebuilt_widths[ i ];
765			}
766		}
767
768		return original_w;
769	};
770
771	var removeResizeFromImageURL = function ( url ) {
772		return removeArgFromURL( url, 'resize' );
773	};
774
775	var removeArgFromURL = function ( url, arg ) {
776		var re = new RegExp( '[\\?&]' + arg + '(=[^?&]+)?' );
777		if ( url.match( re ) ) {
778			return url.replace( re, '' );
779		}
780		return url;
781	};
782
783	var addWidthToImageURL = function ( url, width ) {
784		width = parseInt( width, 10 );
785		// Give devices with a higher devicePixelRatio higher-res images (Retina display = 2, Android phones = 1.5, etc)
786		if ( 'undefined' !== typeof window.devicePixelRatio && window.devicePixelRatio > 1 ) {
787			width = Math.round( width * window.devicePixelRatio );
788		}
789		url = addArgToURL( url, 'w', width );
790		url = addArgToURL( url, 'h', '' );
791		return url;
792	};
793
794	var addArgToURL = function ( url, arg, value ) {
795		var re = new RegExp( arg + '=[^?&]+' );
796		if ( url.match( re ) ) {
797			return url.replace( re, arg + '=' + value );
798		} else {
799			var divider = url.indexOf( '?' ) !== -1 ? '&' : '?';
800			return url + divider + arg + '=' + value;
801		}
802	};
803
804	var stat = function ( names ) {
805		if ( typeof names !== 'string' ) {
806			names = names.join( ',' );
807		}
808
809		new Image().src = window.location.protocol +
810			'//pixel.wp.com/g.gif?v=wpcom-no-pv' +
811			'&x_carousel=' + names +
812			'&baba=' + Math.random();
813	};
814
815	var lastTrackedPostId = null;
816
817	var pageview = function ( post_id ) {
818		// Prevent duplicate tracking of the same post during slide transitions
819		if ( post_id === lastTrackedPostId ) {
820			return;
821		}
822
823		lastTrackedPostId = post_id;
824
825		new Image().src = window.location.protocol +
826			'//pixel.wp.com/g.gif?host=' + encodeURIComponent( window.location.host ) +
827			'&ref=' + encodeURIComponent( document.referrer ) +
828			'&rand=' + Math.random() +
829			'&' + pageviews_stats_args +
830			'&post=' + encodeURIComponent( post_id );
831	};
832
833	var generateImgSrc = function ( srcItem, max ) {
834		var origSize = srcItem.getAttribute( 'data-orig-size' ) || '';
835
836		var src = srcItem.getAttribute( 'src' ) || srcItem.getAttribute( 'original' ) || srcItem.getAttribute( 'data-original' ) || srcItem.getAttribute( 'data-lazy-src' );
837		if ( src.indexOf( 'imgpress' ) !== -1 ) {
838			src = srcItem.getAttribute( 'data-orig-file' );
839		}
840		// Square/Circle galleries use a resize param that needs to be removed.
841		src = removeResizeFromImageURL( src );
842		src = addWidthToImageURL(
843			src,
844			findFirstLargeEnoughWidth( origSize.width, origSize.height, max.width, max.height )
845		);
846
847		return src;
848	};
849
850	window.wpcom.carousel = {
851		findFirstLargeEnoughWidth: findFirstLargeEnoughWidth,
852		removeResizeFromImageURL: removeResizeFromImageURL,
853		addWidthToImageURL: addWidthToImageURL,
854		stat: stat,
855		pageview: pageview,
856		generateImgSrc: generateImgSrc
857	};
858
859} )();
860;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.