@memori.ai/memori-webcomponent 7.17.2 → 7.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -242,7 +242,7 @@ to {
242
242
  * SPDX-License-Identifier: MIT
243
243
  */
244
244
  const nf="144",rf={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},of={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},sf=0,af=1,lf=2,cf=3,uf=0,df=1,hf=2,pf=3,mf=0,ff=1,gf=2,vf=0,yf=1,Sf=2,_f=3,bf=4,xf=5,wf=100,Cf=101,Af=102,Ef=103,Tf=104,If=200,Mf=201,Rf=202,Pf=203,Nf=204,Of=205,Df=206,kf=207,Lf=208,Bf=209,zf=210,Ff=0,Uf=1,jf=2,Gf=3,Hf=4,Vf=5,Wf=6,qf=7,Jf=0,Kf=1,Yf=2,$f=0,Xf=1,Qf=2,Zf=3,eg=4,tg=5,ng=300,rg=301,ig=302,og=303,sg=304,ag=306,lg=1e3,cg=1001,ug=1002,dg=1003,hg=1004,pg=1004,mg=1005,fg=1005,gg=1006,vg=1007,yg=1007,Sg=1008,_g=1008,bg=1009,xg=1010,wg=1011,Cg=1012,Ag=1013,Eg=1014,Tg=1015,Ig=1016,Mg=1017,Rg=1018,Pg=1020,Ng=1021,Og=1022,Dg=1023,kg=1024,Lg=1025,Bg=1026,zg=1027,Fg=1028,Ug=1029,jg=1030,Gg=1031,Hg=1033,Vg=33776,Wg=33777,qg=33778,Jg=33779,Kg=35840,Yg=35841,$g=35842,Xg=35843,Qg=36196,Zg=37492,ev=37496,tv=37808,nv=37809,rv=37810,iv=37811,ov=37812,sv=37813,av=37814,lv=37815,cv=37816,uv=37817,dv=37818,hv=37819,pv=37820,mv=37821,fv=36492,gv=2200,vv=2201,yv=2202,Sv=2300,_v=2301,bv=2302,xv=2400,wv=2401,Cv=2402,Av=2500,Ev=2501,Tv=0,Iv=1,Mv=2,Rv=3e3,Pv=3001,Nv=3200,Ov=3201,Dv=0,kv=1,Lv="",Bv="srgb",zv="srgb-linear",Fv=0,Uv=7680,jv=7681,Gv=7682,Hv=7683,Vv=34055,Wv=34056,qv=5386,Jv=512,Kv=513,Yv=514,$v=515,Xv=516,Qv=517,Zv=518,ey=519,ty=35044,ny=35048,ry=35040,iy=35045,oy=35049,sy=35041,ay=35046,ly=35050,cy=35042,uy="100",dy="300 es",hy=1035;class py{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,r=n.length;t<r;t++)n[t].call(this,e);e.target=null}}}const my=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let fy=1234567;const gy=Math.PI/180,vy=180/Math.PI;function yy(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(my[255&e]+my[e>>8&255]+my[e>>16&255]+my[e>>24&255]+"-"+my[255&t]+my[t>>8&255]+"-"+my[t>>16&15|64]+my[t>>24&255]+"-"+my[63&n|128]+my[n>>8&255]+"-"+my[n>>16&255]+my[n>>24&255]+my[255&r]+my[r>>8&255]+my[r>>16&255]+my[r>>24&255]).toLowerCase()}function Sy(e,t,n){return Math.max(t,Math.min(n,e))}function _y(e,t){return(e%t+t)%t}function by(e,t,n){return(1-n)*e+n*t}function xy(e){return 0==(e&e-1)&&0!==e}function wy(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Cy(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function Ay(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Ey(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}var Ty=Object.freeze({__proto__:null,DEG2RAD:gy,RAD2DEG:vy,generateUUID:yy,clamp:Sy,euclideanModulo:_y,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:by,damp:function(e,t,n,r){return by(e,t,1-Math.exp(-n*r))},pingpong:function(e,t=1){return t-Math.abs(_y(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(fy=e);let t=fy+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*gy},radToDeg:function(e){return e*vy},isPowerOfTwo:xy,ceilPowerOfTwo:wy,floorPowerOfTwo:Cy,setQuaternionFromProperEuler:function(e,t,n,r,i){const o=Math.cos,s=Math.sin,a=o(n/2),l=s(n/2),c=o((t+r)/2),u=s((t+r)/2),d=o((t-r)/2),h=s((t-r)/2),p=o((r-t)/2),m=s((r-t)/2);switch(i){case"XYX":e.set(a*u,l*d,l*h,a*c);break;case"YZY":e.set(l*h,a*u,l*d,a*c);break;case"ZXZ":e.set(l*d,l*h,a*u,a*c);break;case"XZX":e.set(a*u,l*m,l*p,a*c);break;case"YXY":e.set(l*p,a*u,l*m,a*c);break;case"ZYZ":e.set(l*m,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:Ey,denormalize:Ay});class Iy{constructor(e=0,t=0){Iy.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class My{constructor(){My.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,n,r,i,o,s,a,l){const c=this.elements;return c[0]=e,c[1]=r,c[2]=s,c[3]=t,c[4]=i,c[5]=a,c[6]=n,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,o=n[0],s=n[3],a=n[6],l=n[1],c=n[4],u=n[7],d=n[2],h=n[5],p=n[8],m=r[0],f=r[3],g=r[6],v=r[1],y=r[4],S=r[7],_=r[2],b=r[5],x=r[8];return i[0]=o*m+s*v+a*_,i[3]=o*f+s*y+a*b,i[6]=o*g+s*S+a*x,i[1]=l*m+c*v+u*_,i[4]=l*f+c*y+u*b,i[7]=l*g+c*S+u*x,i[2]=d*m+h*v+p*_,i[5]=d*f+h*y+p*b,i[8]=d*g+h*S+p*x,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8];return t*o*c-t*s*l-n*i*c+n*s*a+r*i*l-r*o*a}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],u=c*o-s*l,d=s*a-c*i,h=l*i-o*a,p=t*u+n*d+r*h;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=u*m,e[1]=(r*l-c*n)*m,e[2]=(s*n-r*o)*m,e[3]=d*m,e[4]=(c*t-r*a)*m,e[5]=(r*i-s*t)*m,e[6]=h*m,e[7]=(n*a-l*t)*m,e[8]=(o*t-n*i)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,o,s){const a=Math.cos(i),l=Math.sin(i);return this.set(n*a,n*l,-n*(a*o+l*s)+o+e,-r*l,r*a,-r*(-l*o+a*s)+s+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],o=r[3],s=r[6],a=r[1],l=r[4],c=r[7];return r[0]=t*i+n*a,r[3]=t*o+n*l,r[6]=t*s+n*c,r[1]=-n*i+t*a,r[4]=-n*o+t*l,r[7]=-n*s+t*c,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}function Ry(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}const Py={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Ny(e,t){return new Py[e](t)}function Oy(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Dy(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function ky(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}const Ly={[Bv]:{[zv]:Dy},[zv]:{[Bv]:ky}},By={legacyMode:!0,get workingColorSpace(){return zv},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(Ly[t]&&void 0!==Ly[t][n]){const r=Ly[t][n];return e.r=r(e.r),e.g=r(e.g),e.b=r(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},zy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Fy={r:0,g:0,b:0},Uy={h:0,s:0,l:0},jy={h:0,s:0,l:0};function Gy(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Hy(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}class Vy{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Bv){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,By.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=zv){return this.r=e,this.g=t,this.b=n,By.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=zv){if(e=_y(e,1),t=Sy(t,0,1),n=Sy(n,0,1),0===t)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Gy(i,r,e+1/3),this.g=Gy(i,r,e),this.b=Gy(i,r,e-1/3)}return By.toWorkingColorSpace(this,r),this}setStyle(e,t=Bv){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;const i=r[1],o=r[2];switch(i){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,By.toWorkingColorSpace(this,t),n(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,By.toWorkingColorSpace(this,t),n(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const r=parseFloat(e[1])/360,i=parseFloat(e[2])/100,o=parseFloat(e[3])/100;return n(e[4]),this.setHSL(r,i,o,t)}}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=r[1],n=e.length;if(3===n)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,By.toWorkingColorSpace(this,t),this;if(6===n)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,By.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=Bv){const n=zy[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Dy(e.r),this.g=Dy(e.g),this.b=Dy(e.b),this}copyLinearToSRGB(e){return this.r=ky(e.r),this.g=ky(e.g),this.b=ky(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Bv){return By.fromWorkingColorSpace(Hy(this,Fy),e),Sy(255*Fy.r,0,255)<<16^Sy(255*Fy.g,0,255)<<8^Sy(255*Fy.b,0,255)<<0}getHexString(e=Bv){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=zv){By.fromWorkingColorSpace(Hy(this,Fy),t);const n=Fy.r,r=Fy.g,i=Fy.b,o=Math.max(n,r,i),s=Math.min(n,r,i);let a,l;const c=(s+o)/2;if(s===o)a=0,l=0;else{const e=o-s;switch(l=c<=.5?e/(o+s):e/(2-o-s),o){case n:a=(r-i)/e+(r<i?6:0);break;case r:a=(i-n)/e+2;break;case i:a=(n-r)/e+4}a/=6}return e.h=a,e.s=l,e.l=c,e}getRGB(e,t=zv){return By.fromWorkingColorSpace(Hy(this,Fy),t),e.r=Fy.r,e.g=Fy.g,e.b=Fy.b,e}getStyle(e=Bv){return By.fromWorkingColorSpace(Hy(this,Fy),e),e!==Bv?`color(${e} ${Fy.r} ${Fy.g} ${Fy.b})`:`rgb(${255*Fy.r|0},${255*Fy.g|0},${255*Fy.b|0})`}offsetHSL(e,t,n){return this.getHSL(Uy),Uy.h+=e,Uy.s+=t,Uy.l+=n,this.setHSL(Uy.h,Uy.s,Uy.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Uy),e.getHSL(jy);const n=by(Uy.h,jy.h,t),r=by(Uy.s,jy.s,t),i=by(Uy.l,jy.l,t);return this.setHSL(n,r,i),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let Wy;Vy.NAMES=zy;class qy{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Wy&&(Wy=Oy("canvas")),Wy.width=e.width,Wy.height=e.height;const n=Wy.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Wy}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=Oy("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=255*Dy(i[e]/255);return n.putImageData(r,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*Dy(t[e]/255)):t[e]=Dy(t[e]);return{data:t,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class Jy{constructor(e=null){this.isSource=!0,this.uuid=yy(),this.data=e,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(null!==r){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(Ky(r[t].image)):e.push(Ky(r[t]))}else e=Ky(r);n.url=e}return t||(e.images[this.uuid]=n),n}}function Ky(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?qy.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Yy=0;class $y extends py{constructor(e=$y.DEFAULT_IMAGE,t=$y.DEFAULT_MAPPING,n=cg,r=cg,i=gg,o=Sg,s=Dg,a=bg,l=1,c=Rv){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Yy++}),this.uuid=yy(),this.name="",this.source=new Jy(e),this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=a,this.offset=new Iy(0,0),this.repeat=new Iy(1,1),this.center=new Iy(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new My,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ng)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case lg:e.x=e.x-Math.floor(e.x);break;case cg:e.x=e.x<0?0:1;break;case ug:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case lg:e.y=e.y-Math.floor(e.y);break;case cg:e.y=e.y<0?0:1;break;case ug:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}$y.DEFAULT_IMAGE=null,$y.DEFAULT_MAPPING=ng;class Xy{constructor(e=0,t=0,n=0,r=1){Xy.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,i=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*i,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i;const o=.01,s=.1,a=e.elements,l=a[0],c=a[4],u=a[8],d=a[1],h=a[5],p=a[9],m=a[2],f=a[6],g=a[10];if(Math.abs(c-d)<o&&Math.abs(u-m)<o&&Math.abs(p-f)<o){if(Math.abs(c+d)<s&&Math.abs(u+m)<s&&Math.abs(p+f)<s&&Math.abs(l+h+g-3)<s)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,a=(h+1)/2,v=(g+1)/2,y=(c+d)/4,S=(u+m)/4,_=(p+f)/4;return e>a&&e>v?e<o?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=y/n,i=S/n):a>v?a<o?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(a),n=y/r,i=_/r):v<o?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(v),n=S/i,r=_/i),this.set(n,r,i,t),this}let v=Math.sqrt((f-p)*(f-p)+(u-m)*(u-m)+(d-c)*(d-c));return Math.abs(v)<.001&&(v=1),this.x=(f-p)/v,this.y=(u-m)/v,this.z=(d-c)/v,this.w=Math.acos((l+h+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Qy extends py{constructor(e,t,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Xy(0,0,e,t),this.scissorTest=!1,this.viewport=new Xy(0,0,e,t);const r={width:e,height:t,depth:1};this.texture=new $y(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:gg,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null,this.samples=void 0!==n.samples?n.samples:0}setSize(e,t,n=1){this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Jy(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Zy extends $y{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=dg,this.minFilter=dg,this.wrapR=cg,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class eS extends Qy{constructor(e,t,n){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Zy(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class tS extends $y{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=dg,this.minFilter=dg,this.wrapR=cg,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class nS extends Qy{constructor(e,t,n){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new tS(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class rS extends Qy{constructor(e,t,n,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const i=this.texture;this.texture=[];for(let e=0;e<n;e++)this.texture[e]=i.clone(),this.texture[e].isRenderTargetTexture=!0}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.texture.length;r<i;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class iS{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,o,s){let a=n[r+0],l=n[r+1],c=n[r+2],u=n[r+3];const d=i[o+0],h=i[o+1],p=i[o+2],m=i[o+3];if(0===s)return e[t+0]=a,e[t+1]=l,e[t+2]=c,void(e[t+3]=u);if(1===s)return e[t+0]=d,e[t+1]=h,e[t+2]=p,void(e[t+3]=m);if(u!==m||a!==d||l!==h||c!==p){let e=1-s;const t=a*d+l*h+c*p+u*m,n=t>=0?1:-1,r=1-t*t;if(r>Number.EPSILON){const i=Math.sqrt(r),o=Math.atan2(i,t*n);e=Math.sin(e*o)/i,s=Math.sin(s*o)/i}const i=s*n;if(a=a*e+d*i,l=l*e+h*i,c=c*e+p*i,u=u*e+m*i,e===1-s){const e=1/Math.sqrt(a*a+l*l+c*c+u*u);a*=e,l*=e,c*=e,u*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,o){const s=n[r],a=n[r+1],l=n[r+2],c=n[r+3],u=i[o],d=i[o+1],h=i[o+2],p=i[o+3];return e[t]=s*p+c*u+a*h-l*d,e[t+1]=a*p+c*d+l*u-s*h,e[t+2]=l*p+c*h+s*d-a*u,e[t+3]=c*p-s*u-a*d-l*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const n=e._x,r=e._y,i=e._z,o=e._order,s=Math.cos,a=Math.sin,l=s(n/2),c=s(r/2),u=s(i/2),d=a(n/2),h=a(r/2),p=a(i/2);switch(o){case"XYZ":this._x=d*c*u+l*h*p,this._y=l*h*u-d*c*p,this._z=l*c*p+d*h*u,this._w=l*c*u-d*h*p;break;case"YXZ":this._x=d*c*u+l*h*p,this._y=l*h*u-d*c*p,this._z=l*c*p-d*h*u,this._w=l*c*u+d*h*p;break;case"ZXY":this._x=d*c*u-l*h*p,this._y=l*h*u+d*c*p,this._z=l*c*p+d*h*u,this._w=l*c*u-d*h*p;break;case"ZYX":this._x=d*c*u-l*h*p,this._y=l*h*u+d*c*p,this._z=l*c*p-d*h*u,this._w=l*c*u+d*h*p;break;case"YZX":this._x=d*c*u+l*h*p,this._y=l*h*u+d*c*p,this._z=l*c*p-d*h*u,this._w=l*c*u-d*h*p;break;case"XZY":this._x=d*c*u-l*h*p,this._y=l*h*u-d*c*p,this._z=l*c*p+d*h*u,this._w=l*c*u+d*h*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],i=t[8],o=t[1],s=t[5],a=t[9],l=t[2],c=t[6],u=t[10],d=n+s+u;if(d>0){const e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(c-a)*e,this._y=(i-l)*e,this._z=(o-r)*e}else if(n>s&&n>u){const e=2*Math.sqrt(1+n-s-u);this._w=(c-a)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(i+l)/e}else if(s>u){const e=2*Math.sqrt(1+s-n-u);this._w=(i-l)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+u-n-s);this._w=(o-r)/e,this._x=(i+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Sy(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,i=e._z,o=e._w,s=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+o*s+r*l-i*a,this._y=r*c+o*a+i*s-n*l,this._z=i*c+o*l+n*a-r*s,this._w=o*c-n*s-r*a-i*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,r=this._y,i=this._z,o=this._w;let s=o*e._w+n*e._x+r*e._y+i*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;const a=1-s*s;if(a<=Number.EPSILON){const e=1-t;return this._w=e*o+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,s),u=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=o*u+this._w*d,this._x=n*u+this._x*d,this._y=r*u+this._y*d,this._z=i*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(t*Math.cos(r),n*Math.sin(i),n*Math.cos(i),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class oS{constructor(e=0,t=0,n=0){oS.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(aS.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(aS.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,i=e.elements,o=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,s=e.z,a=e.w,l=a*t+o*r-s*n,c=a*n+s*t-i*r,u=a*r+i*n-o*t,d=-i*t-o*n-s*r;return this.x=l*a+d*-i+c*-s-u*-o,this.y=c*a+d*-o+u*-i-l*-s,this.z=u*a+d*-s+l*-o-c*-i,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,i=e.z,o=t.x,s=t.y,a=t.z;return this.x=r*a-i*s,this.y=i*o-n*a,this.z=n*s-r*o,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return sS.copy(this).projectOnVector(e),this.sub(sS)}reflect(e){return this.sub(sS.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Sy(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const sS=new oS,aS=new iS;class lS{constructor(e=new oS(1/0,1/0,1/0),t=new oS(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,s=-1/0;for(let a=0,l=e.length;a<l;a+=3){const l=e[a],c=e[a+1],u=e[a+2];l<t&&(t=l),c<n&&(n=c),u<r&&(r=u),l>i&&(i=l),c>o&&(o=c),u>s&&(s=u)}return this.min.set(t,n,r),this.max.set(i,o,s),this}setFromBufferAttribute(e){let t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,s=-1/0;for(let a=0,l=e.count;a<l;a++){const l=e.getX(a),c=e.getY(a),u=e.getZ(a);l<t&&(t=l),c<n&&(n=c),u<r&&(r=u),l>i&&(i=l),c>o&&(o=c),u>s&&(s=u)}return this.min.set(t,n,r),this.max.set(i,o,s),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=uS.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(void 0!==n)if(t&&null!=n.attributes&&void 0!==n.attributes.position){const t=n.attributes.position;for(let n=0,r=t.count;n<r;n++)uS.fromBufferAttribute(t,n).applyMatrix4(e.matrixWorld),this.expandByPoint(uS)}else null===n.boundingBox&&n.computeBoundingBox(),dS.copy(n.boundingBox),dS.applyMatrix4(e.matrixWorld),this.union(dS);const r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,uS),uS.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(yS),SS.subVectors(this.max,yS),hS.subVectors(e.a,yS),pS.subVectors(e.b,yS),mS.subVectors(e.c,yS),fS.subVectors(pS,hS),gS.subVectors(mS,pS),vS.subVectors(hS,mS);let t=[0,-fS.z,fS.y,0,-gS.z,gS.y,0,-vS.z,vS.y,fS.z,0,-fS.x,gS.z,0,-gS.x,vS.z,0,-vS.x,-fS.y,fS.x,0,-gS.y,gS.x,0,-vS.y,vS.x,0];return!!xS(t,hS,pS,mS,SS)&&(t=[1,0,0,0,1,0,0,0,1],!!xS(t,hS,pS,mS,SS)&&(_S.crossVectors(fS,gS),t=[_S.x,_S.y,_S.z],xS(t,hS,pS,mS,SS)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return uS.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(uS).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(cS[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),cS[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),cS[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),cS[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),cS[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),cS[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),cS[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),cS[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(cS)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const cS=[new oS,new oS,new oS,new oS,new oS,new oS,new oS,new oS],uS=new oS,dS=new lS,hS=new oS,pS=new oS,mS=new oS,fS=new oS,gS=new oS,vS=new oS,yS=new oS,SS=new oS,_S=new oS,bS=new oS;function xS(e,t,n,r,i){for(let o=0,s=e.length-3;o<=s;o+=3){bS.fromArray(e,o);const s=i.x*Math.abs(bS.x)+i.y*Math.abs(bS.y)+i.z*Math.abs(bS.z),a=t.dot(bS),l=n.dot(bS),c=r.dot(bS);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>s)return!1}return!0}const wS=new lS,CS=new oS,AS=new oS,ES=new oS;class TS{constructor(e=new oS,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):wS.setFromPoints(e).getCenter(n);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){ES.subVectors(e,this.center);const t=ES.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(ES.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return!0===this.center.equals(e.center)?AS.set(0,0,1).multiplyScalar(e.radius):AS.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(CS.copy(e.center).add(AS)),this.expandByPoint(CS.copy(e.center).sub(AS)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const IS=new oS,MS=new oS,RS=new oS,PS=new oS,NS=new oS,OS=new oS,DS=new oS;class kS{constructor(e=new oS,t=new oS(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,IS)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=IS.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(IS.copy(this.direction).multiplyScalar(t).add(this.origin),IS.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){MS.copy(e).add(t).multiplyScalar(.5),RS.copy(t).sub(e).normalize(),PS.copy(this.origin).sub(MS);const i=.5*e.distanceTo(t),o=-this.direction.dot(RS),s=PS.dot(this.direction),a=-PS.dot(RS),l=PS.lengthSq(),c=Math.abs(1-o*o);let u,d,h,p;if(c>0)if(u=o*a-s,d=o*s-a,p=i*c,u>=0)if(d>=-p)if(d<=p){const e=1/c;u*=e,d*=e,h=u*(u+o*d+2*s)+d*(o*u+d+2*a)+l}else d=i,u=Math.max(0,-(o*d+s)),h=-u*u+d*(d+2*a)+l;else d=-i,u=Math.max(0,-(o*d+s)),h=-u*u+d*(d+2*a)+l;else d<=-p?(u=Math.max(0,-(-o*i+s)),d=u>0?-i:Math.min(Math.max(-i,-a),i),h=-u*u+d*(d+2*a)+l):d<=p?(u=0,d=Math.min(Math.max(-i,-a),i),h=d*(d+2*a)+l):(u=Math.max(0,-(o*i+s)),d=u>0?i:Math.min(Math.max(-i,-a),i),h=-u*u+d*(d+2*a)+l);else d=o>0?-i:i,u=Math.max(0,-(o*d+s)),h=-u*u+d*(d+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(RS).multiplyScalar(d).add(MS),h}intersectSphere(e,t){IS.subVectors(e.center,this.origin);const n=IS.dot(this.direction),r=IS.dot(IS)-n*n,i=e.radius*e.radius;if(r>i)return null;const o=Math.sqrt(i-r),s=n-o,a=n+o;return s<0&&a<0?null:s<0?this.at(a,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,o,s,a;const l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,r=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,r=(e.min.x-d.x)*l),c>=0?(i=(e.min.y-d.y)*c,o=(e.max.y-d.y)*c):(i=(e.max.y-d.y)*c,o=(e.min.y-d.y)*c),n>o||i>r?null:((i>n||n!=n)&&(n=i),(o<r||r!=r)&&(r=o),u>=0?(s=(e.min.z-d.z)*u,a=(e.max.z-d.z)*u):(s=(e.max.z-d.z)*u,a=(e.min.z-d.z)*u),n>a||s>r?null:((s>n||n!=n)&&(n=s),(a<r||r!=r)&&(r=a),r<0?null:this.at(n>=0?n:r,t)))}intersectsBox(e){return null!==this.intersectBox(e,IS)}intersectTriangle(e,t,n,r,i){NS.subVectors(t,e),OS.subVectors(n,e),DS.crossVectors(NS,OS);let o,s=this.direction.dot(DS);if(s>0){if(r)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}PS.subVectors(this.origin,e);const a=o*this.direction.dot(OS.crossVectors(PS,OS));if(a<0)return null;const l=o*this.direction.dot(NS.cross(PS));if(l<0)return null;if(a+l>s)return null;const c=-o*PS.dot(DS);return c<0?null:this.at(c/s,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class LS{constructor(){LS.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,n,r,i,o,s,a,l,c,u,d,h,p,m,f){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=c,g[10]=u,g[14]=d,g[3]=h,g[7]=p,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new LS).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,r=1/BS.setFromMatrixColumn(e,0).length(),i=1/BS.setFromMatrixColumn(e,1).length(),o=1/BS.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,r=e.y,i=e.z,o=Math.cos(n),s=Math.sin(n),a=Math.cos(r),l=Math.sin(r),c=Math.cos(i),u=Math.sin(i);if("XYZ"===e.order){const e=o*c,n=o*u,r=s*c,i=s*u;t[0]=a*c,t[4]=-a*u,t[8]=l,t[1]=n+r*l,t[5]=e-i*l,t[9]=-s*a,t[2]=i-e*l,t[6]=r+n*l,t[10]=o*a}else if("YXZ"===e.order){const e=a*c,n=a*u,r=l*c,i=l*u;t[0]=e+i*s,t[4]=r*s-n,t[8]=o*l,t[1]=o*u,t[5]=o*c,t[9]=-s,t[2]=n*s-r,t[6]=i+e*s,t[10]=o*a}else if("ZXY"===e.order){const e=a*c,n=a*u,r=l*c,i=l*u;t[0]=e-i*s,t[4]=-o*u,t[8]=r+n*s,t[1]=n+r*s,t[5]=o*c,t[9]=i-e*s,t[2]=-o*l,t[6]=s,t[10]=o*a}else if("ZYX"===e.order){const e=o*c,n=o*u,r=s*c,i=s*u;t[0]=a*c,t[4]=r*l-n,t[8]=e*l+i,t[1]=a*u,t[5]=i*l+e,t[9]=n*l-r,t[2]=-l,t[6]=s*a,t[10]=o*a}else if("YZX"===e.order){const e=o*a,n=o*l,r=s*a,i=s*l;t[0]=a*c,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=o*c,t[9]=-s*c,t[2]=-l*c,t[6]=n*u+r,t[10]=e-i*u}else if("XZY"===e.order){const e=o*a,n=o*l,r=s*a,i=s*l;t[0]=a*c,t[4]=-u,t[8]=l*c,t[1]=e*u+i,t[5]=o*c,t[9]=n*u-r,t[2]=r*u-n,t[6]=s*c,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(FS,e,US)}lookAt(e,t,n){const r=this.elements;return HS.subVectors(e,t),0===HS.lengthSq()&&(HS.z=1),HS.normalize(),jS.crossVectors(n,HS),0===jS.lengthSq()&&(1===Math.abs(n.z)?HS.x+=1e-4:HS.z+=1e-4,HS.normalize(),jS.crossVectors(n,HS)),jS.normalize(),GS.crossVectors(HS,jS),r[0]=jS.x,r[4]=GS.x,r[8]=HS.x,r[1]=jS.y,r[5]=GS.y,r[9]=HS.y,r[2]=jS.z,r[6]=GS.z,r[10]=HS.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,i=this.elements,o=n[0],s=n[4],a=n[8],l=n[12],c=n[1],u=n[5],d=n[9],h=n[13],p=n[2],m=n[6],f=n[10],g=n[14],v=n[3],y=n[7],S=n[11],_=n[15],b=r[0],x=r[4],w=r[8],C=r[12],A=r[1],E=r[5],T=r[9],I=r[13],M=r[2],R=r[6],P=r[10],N=r[14],O=r[3],D=r[7],k=r[11],L=r[15];return i[0]=o*b+s*A+a*M+l*O,i[4]=o*x+s*E+a*R+l*D,i[8]=o*w+s*T+a*P+l*k,i[12]=o*C+s*I+a*N+l*L,i[1]=c*b+u*A+d*M+h*O,i[5]=c*x+u*E+d*R+h*D,i[9]=c*w+u*T+d*P+h*k,i[13]=c*C+u*I+d*N+h*L,i[2]=p*b+m*A+f*M+g*O,i[6]=p*x+m*E+f*R+g*D,i[10]=p*w+m*T+f*P+g*k,i[14]=p*C+m*I+f*N+g*L,i[3]=v*b+y*A+S*M+_*O,i[7]=v*x+y*E+S*R+_*D,i[11]=v*w+y*T+S*P+_*k,i[15]=v*C+y*I+S*N+_*L,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],o=e[1],s=e[5],a=e[9],l=e[13],c=e[2],u=e[6],d=e[10],h=e[14];return e[3]*(+i*a*u-r*l*u-i*s*d+n*l*d+r*s*h-n*a*h)+e[7]*(+t*a*h-t*l*d+i*o*d-r*o*h+r*l*c-i*a*c)+e[11]*(+t*l*u-t*s*h-i*o*u+n*o*h+i*s*c-n*l*c)+e[15]*(-r*s*c-t*a*u+t*s*d+r*o*u-n*o*d+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],u=e[9],d=e[10],h=e[11],p=e[12],m=e[13],f=e[14],g=e[15],v=u*f*l-m*d*l+m*a*h-s*f*h-u*a*g+s*d*g,y=p*d*l-c*f*l-p*a*h+o*f*h+c*a*g-o*d*g,S=c*m*l-p*u*l+p*s*h-o*m*h-c*s*g+o*u*g,_=p*u*a-c*m*a-p*s*d+o*m*d+c*s*f-o*u*f,b=t*v+n*y+r*S+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const x=1/b;return e[0]=v*x,e[1]=(m*d*i-u*f*i-m*r*h+n*f*h+u*r*g-n*d*g)*x,e[2]=(s*f*i-m*a*i+m*r*l-n*f*l-s*r*g+n*a*g)*x,e[3]=(u*a*i-s*d*i-u*r*l+n*d*l+s*r*h-n*a*h)*x,e[4]=y*x,e[5]=(c*f*i-p*d*i+p*r*h-t*f*h-c*r*g+t*d*g)*x,e[6]=(p*a*i-o*f*i-p*r*l+t*f*l+o*r*g-t*a*g)*x,e[7]=(o*d*i-c*a*i+c*r*l-t*d*l-o*r*h+t*a*h)*x,e[8]=S*x,e[9]=(p*u*i-c*m*i-p*n*h+t*m*h+c*n*g-t*u*g)*x,e[10]=(o*m*i-p*s*i+p*n*l-t*m*l-o*n*g+t*s*g)*x,e[11]=(c*s*i-o*u*i-c*n*l+t*u*l+o*n*h-t*s*h)*x,e[12]=_*x,e[13]=(c*m*r-p*u*r+p*n*d-t*m*d-c*n*f+t*u*f)*x,e[14]=(p*s*r-o*m*r-p*n*a+t*m*a+o*n*f-t*s*f)*x,e[15]=(o*u*r-c*s*r+c*n*a-t*u*a-o*n*d+t*s*d)*x,this}scale(e){const t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),r=Math.sin(t),i=1-n,o=e.x,s=e.y,a=e.z,l=i*o,c=i*s;return this.set(l*o+n,l*s-r*a,l*a+r*s,0,l*s+r*a,c*s+n,c*a-r*o,0,l*a-r*s,c*a+r*o,i*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,o){return this.set(1,n,i,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,i=t._x,o=t._y,s=t._z,a=t._w,l=i+i,c=o+o,u=s+s,d=i*l,h=i*c,p=i*u,m=o*c,f=o*u,g=s*u,v=a*l,y=a*c,S=a*u,_=n.x,b=n.y,x=n.z;return r[0]=(1-(m+g))*_,r[1]=(h+S)*_,r[2]=(p-y)*_,r[3]=0,r[4]=(h-S)*b,r[5]=(1-(d+g))*b,r[6]=(f+v)*b,r[7]=0,r[8]=(p+y)*x,r[9]=(f-v)*x,r[10]=(1-(d+m))*x,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let i=BS.set(r[0],r[1],r[2]).length();const o=BS.set(r[4],r[5],r[6]).length(),s=BS.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],zS.copy(this);const a=1/i,l=1/o,c=1/s;return zS.elements[0]*=a,zS.elements[1]*=a,zS.elements[2]*=a,zS.elements[4]*=l,zS.elements[5]*=l,zS.elements[6]*=l,zS.elements[8]*=c,zS.elements[9]*=c,zS.elements[10]*=c,t.setFromRotationMatrix(zS),n.x=i,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,o){const s=this.elements,a=2*i/(t-e),l=2*i/(n-r),c=(t+e)/(t-e),u=(n+r)/(n-r),d=-(o+i)/(o-i),h=-2*o*i/(o-i);return s[0]=a,s[4]=0,s[8]=c,s[12]=0,s[1]=0,s[5]=l,s[9]=u,s[13]=0,s[2]=0,s[6]=0,s[10]=d,s[14]=h,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,o){const s=this.elements,a=1/(t-e),l=1/(n-r),c=1/(o-i),u=(t+e)*a,d=(n+r)*l,h=(o+i)*c;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-u,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-d,s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-h,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const BS=new oS,zS=new LS,FS=new oS(0,0,0),US=new oS(1,1,1),jS=new oS,GS=new oS,HS=new oS,VS=new LS,WS=new iS;class qS{constructor(e=0,t=0,n=0,r=qS.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,i=r[0],o=r[4],s=r[8],a=r[1],l=r[5],c=r[9],u=r[2],d=r[6],h=r[10];switch(t){case"XYZ":this._y=Math.asin(Sy(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,h),this._z=Math.atan2(-o,i)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Sy(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,h),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-u,i),this._z=0);break;case"ZXY":this._x=Math.asin(Sy(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(a,i));break;case"ZYX":this._y=Math.asin(-Sy(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,h),this._z=Math.atan2(a,i)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(Sy(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(s,h));break;case"XZY":this._z=Math.asin(-Sy(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,i)):(this._x=Math.atan2(-c,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return VS.makeRotationFromQuaternion(e),this.setFromRotationMatrix(VS,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return WS.setFromEuler(this),this.setFromQuaternion(WS,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}qS.DefaultOrder="XYZ",qS.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class JS{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return 0!=(this.mask&e.mask)}isEnabled(e){return 0!=(this.mask&(1<<e|0))}}let KS=0;const YS=new oS,$S=new iS,XS=new LS,QS=new oS,ZS=new oS,e_=new oS,t_=new iS,n_=new oS(1,0,0),r_=new oS(0,1,0),i_=new oS(0,0,1),o_={type:"added"},s_={type:"removed"};class a_ extends py{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:KS++}),this.uuid=yy(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=a_.DefaultUp.clone();const e=new oS,t=new qS,n=new iS,r=new oS(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new LS},normalMatrix:{value:new My}}),this.matrix=new LS,this.matrixWorld=new LS,this.matrixAutoUpdate=a_.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=a_.DefaultMatrixWorldAutoUpdate,this.layers=new JS,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return $S.setFromAxisAngle(e,t),this.quaternion.multiply($S),this}rotateOnWorldAxis(e,t){return $S.setFromAxisAngle(e,t),this.quaternion.premultiply($S),this}rotateX(e){return this.rotateOnAxis(n_,e)}rotateY(e){return this.rotateOnAxis(r_,e)}rotateZ(e){return this.rotateOnAxis(i_,e)}translateOnAxis(e,t){return YS.copy(e).applyQuaternion(this.quaternion),this.position.add(YS.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(n_,e)}translateY(e){return this.translateOnAxis(r_,e)}translateZ(e){return this.translateOnAxis(i_,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(XS.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?QS.copy(e):QS.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),ZS.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?XS.lookAt(ZS,QS,this.up):XS.lookAt(QS,ZS,this.up),this.quaternion.setFromRotationMatrix(XS),r&&(XS.extractRotation(r.matrixWorld),$S.setFromRotationMatrix(XS),this.quaternion.premultiply($S.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(o_)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(s_)),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(s_)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),XS.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),XS.multiply(e.parent.matrixWorld)),e.applyMatrix4(XS),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ZS,e,e_),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ZS,t_,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++){const r=t[n];!0!==r.matrixWorldAutoUpdate&&!0!==e||r.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&!0===n.matrixWorldAutoUpdate&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++){const n=e[t];!0===n.matrixWorldAutoUpdate&&n.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};function i(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){const r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){const t=o(e.geometries),r=o(e.materials),i=o(e.textures),s=o(e.images),a=o(e.shapes),l=o(e.skeletons),c=o(e.animations),u=o(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),s.length>0&&(n.images=s),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),u.length>0&&(n.nodes=u)}return n.object=r,n;function o(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];this.add(n.clone())}return this}}a_.DefaultUp=new oS(0,1,0),a_.DefaultMatrixAutoUpdate=!0,a_.DefaultMatrixWorldAutoUpdate=!0;const l_=new oS,c_=new oS,u_=new oS,d_=new oS,h_=new oS,p_=new oS,m_=new oS,f_=new oS,g_=new oS,v_=new oS;class y_{constructor(e=new oS,t=new oS,n=new oS){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),l_.subVectors(e,t),r.cross(l_);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){l_.subVectors(r,t),c_.subVectors(n,t),u_.subVectors(e,t);const o=l_.dot(l_),s=l_.dot(c_),a=l_.dot(u_),l=c_.dot(c_),c=c_.dot(u_),u=o*l-s*s;if(0===u)return i.set(-2,-1,-1);const d=1/u,h=(l*a-s*c)*d,p=(o*c-s*a)*d;return i.set(1-h-p,p,h)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,d_),d_.x>=0&&d_.y>=0&&d_.x+d_.y<=1}static getUV(e,t,n,r,i,o,s,a){return this.getBarycoord(e,t,n,r,d_),a.set(0,0),a.addScaledVector(i,d_.x),a.addScaledVector(o,d_.y),a.addScaledVector(s,d_.z),a}static isFrontFacing(e,t,n,r){return l_.subVectors(n,t),c_.subVectors(e,t),l_.cross(c_).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return l_.subVectors(this.c,this.b),c_.subVectors(this.a,this.b),.5*l_.cross(c_).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return y_.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return y_.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,r,i){return y_.getUV(e,this.a,this.b,this.c,t,n,r,i)}containsPoint(e){return y_.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return y_.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,i=this.c;let o,s;h_.subVectors(r,n),p_.subVectors(i,n),f_.subVectors(e,n);const a=h_.dot(f_),l=p_.dot(f_);if(a<=0&&l<=0)return t.copy(n);g_.subVectors(e,r);const c=h_.dot(g_),u=p_.dot(g_);if(c>=0&&u<=c)return t.copy(r);const d=a*u-c*l;if(d<=0&&a>=0&&c<=0)return o=a/(a-c),t.copy(n).addScaledVector(h_,o);v_.subVectors(e,i);const h=h_.dot(v_),p=p_.dot(v_);if(p>=0&&h<=p)return t.copy(i);const m=h*l-a*p;if(m<=0&&l>=0&&p<=0)return s=l/(l-p),t.copy(n).addScaledVector(p_,s);const f=c*p-h*u;if(f<=0&&u-c>=0&&h-p>=0)return m_.subVectors(i,r),s=(u-c)/(u-c+(h-p)),t.copy(r).addScaledVector(m_,s);const g=1/(f+m+d);return o=m*g,s=d*g,t.copy(n).addScaledVector(h_,o).addScaledVector(p_,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let S_=0;class __ extends py{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:S_++}),this.uuid=yy(),this.name="",this.type="Material",this.blending=yf,this.side=mf,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Nf,this.blendDst=Of,this.blendEquation=wf,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Gf,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ey,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Uv,this.stencilZFail=Uv,this.stencilZPass=Uv,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}const r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){const t=[];for(const n in e){const r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==yf&&(n.blending=this.blending),this.side!==mf&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){const t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class b_ extends __{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Vy(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Jf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const x_=new oS,w_=new Iy;class C_{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=ty,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)w_.fromBufferAttribute(this,t),w_.applyMatrix3(e),this.setXY(t,w_.x,w_.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)x_.fromBufferAttribute(this,t),x_.applyMatrix3(e),this.setXYZ(t,x_.x,x_.y,x_.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)x_.fromBufferAttribute(this,t),x_.applyMatrix4(e),this.setXYZ(t,x_.x,x_.y,x_.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)x_.fromBufferAttribute(this,t),x_.applyNormalMatrix(e),this.setXYZ(t,x_.x,x_.y,x_.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)x_.fromBufferAttribute(this,t),x_.transformDirection(e),this.setXYZ(t,x_.x,x_.y,x_.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Ay(t,this.array)),t}setX(e,t){return this.normalized&&(t=Ey(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ay(t,this.array)),t}setY(e,t){return this.normalized&&(t=Ey(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Ay(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Ey(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Ay(t,this.array)),t}setW(e,t){return this.normalized&&(t=Ey(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Ey(t,this.array),n=Ey(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Ey(t,this.array),n=Ey(n,this.array),r=Ey(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=Ey(t,this.array),n=Ey(n,this.array),r=Ey(r,this.array),i=Ey(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==ty&&(e.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class A_ extends C_{constructor(e,t,n){super(new Int8Array(e),t,n)}}class E_ extends C_{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class T_ extends C_{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class I_ extends C_{constructor(e,t,n){super(new Int16Array(e),t,n)}}class M_ extends C_{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class R_ extends C_{constructor(e,t,n){super(new Int32Array(e),t,n)}}class P_ extends C_{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class N_ extends C_{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}}class O_ extends C_{constructor(e,t,n){super(new Float32Array(e),t,n)}}class D_ extends C_{constructor(e,t,n){super(new Float64Array(e),t,n)}}let k_=0;const L_=new LS,B_=new a_,z_=new oS,F_=new lS,U_=new lS,j_=new oS;class G_ extends py{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:k_++}),this.uuid=yy(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Ry(e)?P_:M_)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new My).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return L_.makeRotationFromQuaternion(e),this.applyMatrix4(L_),this}rotateX(e){return L_.makeRotationX(e),this.applyMatrix4(L_),this}rotateY(e){return L_.makeRotationY(e),this.applyMatrix4(L_),this}rotateZ(e){return L_.makeRotationZ(e),this.applyMatrix4(L_),this}translate(e,t,n){return L_.makeTranslation(e,t,n),this.applyMatrix4(L_),this}scale(e,t,n){return L_.makeScale(e,t,n),this.applyMatrix4(L_),this}lookAt(e){return B_.lookAt(e),B_.updateMatrix(),this.applyMatrix4(B_.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(z_).negate(),this.translate(z_.x,z_.y,z_.z),this}setFromPoints(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new O_(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new lS);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new oS(-1/0,-1/0,-1/0),new oS(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];F_.setFromBufferAttribute(n),this.morphTargetsRelative?(j_.addVectors(this.boundingBox.min,F_.min),this.boundingBox.expandByPoint(j_),j_.addVectors(this.boundingBox.max,F_.max),this.boundingBox.expandByPoint(j_)):(this.boundingBox.expandByPoint(F_.min),this.boundingBox.expandByPoint(F_.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new TS);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new oS,1/0);if(e){const n=this.boundingSphere.center;if(F_.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];U_.setFromBufferAttribute(n),this.morphTargetsRelative?(j_.addVectors(F_.min,U_.min),F_.expandByPoint(j_),j_.addVectors(F_.max,U_.max),F_.expandByPoint(j_)):(F_.expandByPoint(U_.min),F_.expandByPoint(U_.max))}F_.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)j_.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(j_));if(t)for(let i=0,o=t.length;i<o;i++){const o=t[i],s=this.morphTargetsRelative;for(let t=0,i=o.count;t<i;t++)j_.fromBufferAttribute(o,t),s&&(z_.fromBufferAttribute(e,t),j_.add(z_)),r=Math.max(r,n.distanceToSquared(j_))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=e.array,r=t.position.array,i=t.normal.array,o=t.uv.array,s=r.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new C_(new Float32Array(4*s),4));const a=this.getAttribute("tangent").array,l=[],c=[];for(let e=0;e<s;e++)l[e]=new oS,c[e]=new oS;const u=new oS,d=new oS,h=new oS,p=new Iy,m=new Iy,f=new Iy,g=new oS,v=new oS;function y(e,t,n){u.fromArray(r,3*e),d.fromArray(r,3*t),h.fromArray(r,3*n),p.fromArray(o,2*e),m.fromArray(o,2*t),f.fromArray(o,2*n),d.sub(u),h.sub(u),m.sub(p),f.sub(p);const i=1/(m.x*f.y-f.x*m.y);isFinite(i)&&(g.copy(d).multiplyScalar(f.y).addScaledVector(h,-m.y).multiplyScalar(i),v.copy(h).multiplyScalar(m.x).addScaledVector(d,-f.x).multiplyScalar(i),l[e].add(g),l[t].add(g),l[n].add(g),c[e].add(v),c[t].add(v),c[n].add(v))}let S=this.groups;0===S.length&&(S=[{start:0,count:n.length}]);for(let e=0,t=S.length;e<t;++e){const t=S[e],r=t.start;for(let e=r,i=r+t.count;e<i;e+=3)y(n[e+0],n[e+1],n[e+2])}const _=new oS,b=new oS,x=new oS,w=new oS;function C(e){x.fromArray(i,3*e),w.copy(x);const t=l[e];_.copy(t),_.sub(x.multiplyScalar(x.dot(t))).normalize(),b.crossVectors(w,t);const n=b.dot(c[e])<0?-1:1;a[4*e]=_.x,a[4*e+1]=_.y,a[4*e+2]=_.z,a[4*e+3]=n}for(let e=0,t=S.length;e<t;++e){const t=S[e],r=t.start;for(let e=r,i=r+t.count;e<i;e+=3)C(n[e+0]),C(n[e+1]),C(n[e+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new C_(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const r=new oS,i=new oS,o=new oS,s=new oS,a=new oS,l=new oS,c=new oS,u=new oS;if(e)for(let d=0,h=e.count;d<h;d+=3){const h=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,h),i.fromBufferAttribute(t,p),o.fromBufferAttribute(t,m),c.subVectors(o,i),u.subVectors(r,i),c.cross(u),s.fromBufferAttribute(n,h),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,m),s.add(c),a.add(c),l.add(c),n.setXYZ(h,s.x,s.y,s.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),o.fromBufferAttribute(t,e+2),c.subVectors(o,i),u.subVectors(r,i),c.cross(u),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)j_.fromBufferAttribute(e,t),j_.normalize(),e.setXYZ(t,j_.x,j_.y,j_.z)}toNonIndexed(){function e(e,t){const n=e.array,r=e.itemSize,i=e.normalized,o=new n.constructor(t.length*r);let s=0,a=0;for(let i=0,l=t.length;i<l;i++){s=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)o[a++]=n[s++]}return new C_(o,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new G_,n=this.index.array,r=this.attributes;for(const i in r){const o=e(r[i],n);t.setAttribute(i,o)}const i=this.morphAttributes;for(const r in i){const o=[],s=i[r];for(let t=0,r=s.length;t<r;t++){const r=e(s[t],n);o.push(r)}t.morphAttributes[r]=o}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let e=0,n=o.length;e<n;e++){const n=o[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const r=n[t];e.data.attributes[t]=r.toJSON(e.data)}const r={};let i=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],o=[];for(let t=0,r=n.length;t<r;t++){const r=n[t];o.push(r.toJSON(e.data))}o.length>0&&(r[t]=o,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const r=e.attributes;for(const e in r){const n=r[e];this.setAttribute(e,n.clone(t))}const i=e.morphAttributes;for(const e in i){const n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let e=0,t=o.length;e<t;e++){const t=o[e];this.addGroup(t.start,t.count,t.materialIndex)}const s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());const a=e.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,void 0!==e.parameters&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}const H_=new LS,V_=new kS,W_=new TS,q_=new oS,J_=new oS,K_=new oS,Y_=new oS,$_=new oS,X_=new oS,Q_=new oS,Z_=new oS,eb=new oS,tb=new Iy,nb=new Iy,rb=new Iy,ib=new oS,ob=new oS;class sb extends a_{constructor(e=new G_,t=new b_){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}raycast(e,t){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),W_.copy(n.boundingSphere),W_.applyMatrix4(i),!1===e.ray.intersectsSphere(W_))return;if(H_.copy(i).invert(),V_.copy(e.ray).applyMatrix4(H_),null!==n.boundingBox&&!1===V_.intersectsBox(n.boundingBox))return;let o;const s=n.index,a=n.attributes.position,l=n.morphAttributes.position,c=n.morphTargetsRelative,u=n.attributes.uv,d=n.attributes.uv2,h=n.groups,p=n.drawRange;if(null!==s)if(Array.isArray(r))for(let n=0,i=h.length;n<i;n++){const i=h[n],m=r[i.materialIndex];for(let n=Math.max(i.start,p.start),r=Math.min(s.count,Math.min(i.start+i.count,p.start+p.count));n<r;n+=3){const r=s.getX(n),h=s.getX(n+1),p=s.getX(n+2);o=ab(this,m,e,V_,a,l,c,u,d,r,h,p),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=i.materialIndex,t.push(o))}}else{for(let n=Math.max(0,p.start),i=Math.min(s.count,p.start+p.count);n<i;n+=3){const i=s.getX(n),h=s.getX(n+1),p=s.getX(n+2);o=ab(this,r,e,V_,a,l,c,u,d,i,h,p),o&&(o.faceIndex=Math.floor(n/3),t.push(o))}}else if(void 0!==a)if(Array.isArray(r))for(let n=0,i=h.length;n<i;n++){const i=h[n],s=r[i.materialIndex];for(let n=Math.max(i.start,p.start),r=Math.min(a.count,Math.min(i.start+i.count,p.start+p.count));n<r;n+=3){o=ab(this,s,e,V_,a,l,c,u,d,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=i.materialIndex,t.push(o))}}else{for(let n=Math.max(0,p.start),i=Math.min(a.count,p.start+p.count);n<i;n+=3){o=ab(this,r,e,V_,a,l,c,u,d,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),t.push(o))}}}}function ab(e,t,n,r,i,o,s,a,l,c,u,d){q_.fromBufferAttribute(i,c),J_.fromBufferAttribute(i,u),K_.fromBufferAttribute(i,d);const h=e.morphTargetInfluences;if(o&&h){Q_.set(0,0,0),Z_.set(0,0,0),eb.set(0,0,0);for(let e=0,t=o.length;e<t;e++){const t=h[e],n=o[e];0!==t&&(Y_.fromBufferAttribute(n,c),$_.fromBufferAttribute(n,u),X_.fromBufferAttribute(n,d),s?(Q_.addScaledVector(Y_,t),Z_.addScaledVector($_,t),eb.addScaledVector(X_,t)):(Q_.addScaledVector(Y_.sub(q_),t),Z_.addScaledVector($_.sub(J_),t),eb.addScaledVector(X_.sub(K_),t)))}q_.add(Q_),J_.add(Z_),K_.add(eb)}e.isSkinnedMesh&&(e.boneTransform(c,q_),e.boneTransform(u,J_),e.boneTransform(d,K_));const p=function(e,t,n,r,i,o,s,a){let l;if(l=t.side===ff?r.intersectTriangle(s,o,i,!0,a):r.intersectTriangle(i,o,s,t.side!==gf,a),null===l)return null;ob.copy(a),ob.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(ob);return c<n.near||c>n.far?null:{distance:c,point:ob.clone(),object:e}}(e,t,n,r,q_,J_,K_,ib);if(p){a&&(tb.fromBufferAttribute(a,c),nb.fromBufferAttribute(a,u),rb.fromBufferAttribute(a,d),p.uv=y_.getUV(ib,q_,J_,K_,tb,nb,rb,new Iy)),l&&(tb.fromBufferAttribute(l,c),nb.fromBufferAttribute(l,u),rb.fromBufferAttribute(l,d),p.uv2=y_.getUV(ib,q_,J_,K_,tb,nb,rb,new Iy));const e={a:c,b:u,c:d,normal:new oS,materialIndex:0};y_.getNormal(q_,J_,K_,e.normal),p.face=e}return p}class lb extends G_{constructor(e=1,t=1,n=1,r=1,i=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};const s=this;r=Math.floor(r),i=Math.floor(i),o=Math.floor(o);const a=[],l=[],c=[],u=[];let d=0,h=0;function p(e,t,n,r,i,o,p,m,f,g,v){const y=o/f,S=p/g,_=o/2,b=p/2,x=m/2,w=f+1,C=g+1;let A=0,E=0;const T=new oS;for(let o=0;o<C;o++){const s=o*S-b;for(let a=0;a<w;a++){const d=a*y-_;T[e]=d*r,T[t]=s*i,T[n]=x,l.push(T.x,T.y,T.z),T[e]=0,T[t]=0,T[n]=m>0?1:-1,c.push(T.x,T.y,T.z),u.push(a/f),u.push(1-o/g),A+=1}}for(let e=0;e<g;e++)for(let t=0;t<f;t++){const n=d+t+w*e,r=d+t+w*(e+1),i=d+(t+1)+w*(e+1),o=d+(t+1)+w*e;a.push(n,r,o),a.push(r,i,o),E+=6}s.addGroup(h,E,v),h+=E,d+=A}p("z","y","x",-1,-1,n,t,e,o,i,0),p("z","y","x",1,-1,n,t,-e,o,i,1),p("x","z","y",1,1,e,n,t,r,o,2),p("x","z","y",1,-1,e,n,-t,r,o,3),p("x","y","z",1,-1,e,t,n,r,i,4),p("x","y","z",-1,-1,e,t,-n,r,i,5),this.setIndex(a),this.setAttribute("position",new O_(l,3)),this.setAttribute("normal",new O_(c,3)),this.setAttribute("uv",new O_(u,2))}static fromJSON(e){return new lb(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function cb(e){const t={};for(const n in e){t[n]={};for(const r in e[n]){const i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}}return t}function ub(e){const t={};for(let n=0;n<e.length;n++){const r=cb(e[n]);for(const e in r)t[e]=r[e]}return t}const db={clone:cb,merge:ub};class hb extends __{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=cb(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:"m4",value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class pb extends a_{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new LS,this.projectionMatrix=new LS,this.projectionMatrixInverse=new LS}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}class mb extends pb{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*vy*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*gy*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*vy*Math.atan(Math.tan(.5*gy*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,r,i,o){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*gy*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r;const o=this.view;if(null!==this.view&&this.view.enabled){const e=o.fullWidth,s=o.fullHeight;i+=o.offsetX*r/e,t-=o.offsetY*n/s,r*=o.width/e,n*=o.height/s}const s=this.filmOffset;0!==s&&(i+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const fb=90;class gb extends a_{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n;const r=new mb(fb,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new oS(1,0,0)),this.add(r);const i=new mb(fb,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new oS(-1,0,0)),this.add(i);const o=new mb(fb,1,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new oS(0,1,0)),this.add(o);const s=new mb(fb,1,e,t);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new oS(0,-1,0)),this.add(s);const a=new mb(fb,1,e,t);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new oS(0,0,1)),this.add(a);const l=new mb(fb,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new oS(0,0,-1)),this.add(l)}update(e,t){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,o,s,a,l]=this.children,c=e.getRenderTarget(),u=e.toneMapping,d=e.xr.enabled;e.toneMapping=$f,e.xr.enabled=!1;const h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,i),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,a),n.texture.generateMipmaps=h,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(c),e.toneMapping=u,e.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class vb extends $y{constructor(e,t,n,r,i,o,s,a,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:rg,n,r,i,o,s,a,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class yb extends Qy{constructor(e,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new vb(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:gg}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new lb(5,5,5),i=new hb({name:"CubemapFromEquirect",uniforms:cb(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:ff,blending:vf});i.uniforms.tEquirect.value=t;const o=new sb(r,i),s=t.minFilter;t.minFilter===Sg&&(t.minFilter=gg);return new gb(1,10,this).update(e,o),t.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,r){const i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}}const Sb=new oS,_b=new oS,bb=new My;class xb{constructor(e=new oS(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=Sb.subVectors(n,t).cross(_b.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(Sb),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(n).multiplyScalar(i).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||bb.getNormalMatrix(e),r=this.coplanarPoint(Sb).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const wb=new TS,Cb=new oS;class Ab{constructor(e=new xb,t=new xb,n=new xb,r=new xb,i=new xb,o=new xb){this.planes=[e,t,n,r,i,o]}set(e,t,n,r,i,o){const s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(r),s[4].copy(i),s[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],c=n[6],u=n[7],d=n[8],h=n[9],p=n[10],m=n[11],f=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(s-r,u-a,m-d,y-f).normalize(),t[1].setComponents(s+r,u+a,m+d,y+f).normalize(),t[2].setComponents(s+i,u+l,m+h,y+g).normalize(),t[3].setComponents(s-i,u-l,m-h,y-g).normalize(),t[4].setComponents(s-o,u-c,m-p,y-v).normalize(),t[5].setComponents(s+o,u+c,m+p,y+v).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),wb.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(wb)}intersectsSprite(e){return wb.center.set(0,0,0),wb.radius=.7071067811865476,wb.applyMatrix4(e.matrixWorld),this.intersectsSphere(wb)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++){if(t[e].distanceToPoint(n)<r)return!1}return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(Cb.x=r.normal.x>0?e.max.x:e.min.x,Cb.y=r.normal.y>0?e.max.y:e.min.y,Cb.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Cb)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Eb(){let e=null,t=!1,n=null,r=null;function i(t,o){n(t,o),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Tb(e,t){const n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){if(t.isGLBufferAttribute){const e=r.get(t);return void((!e||e.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version}))}t.isInterleavedBufferAttribute&&(t=t.data);const o=r.get(t);void 0===o?r.set(t,function(t,r){const i=t.array,o=t.usage,s=e.createBuffer();let a;if(e.bindBuffer(r,s),e.bufferData(r,i,o),t.onUploadCallback(),i instanceof Float32Array)a=5126;else if(i instanceof Uint16Array)if(t.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");a=5131}else a=5123;else if(i instanceof Int16Array)a=5122;else if(i instanceof Uint32Array)a=5125;else if(i instanceof Int32Array)a=5124;else if(i instanceof Int8Array)a=5120;else if(i instanceof Uint8Array)a=5121;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);a=5121}return{buffer:s,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(t,i)):o.version<t.version&&(!function(t,r,i){const o=r.array,s=r.updateRange;e.bindBuffer(i,t),-1===s.count?e.bufferSubData(i,0,o):(n?e.bufferSubData(i,s.offset*o.BYTES_PER_ELEMENT,o,s.offset,s.count):e.bufferSubData(i,s.offset*o.BYTES_PER_ELEMENT,o.subarray(s.offset,s.offset+s.count)),s.count=-1)}(o.buffer,t,i),o.version=t.version)}}}class Ib extends G_{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const i=e/2,o=t/2,s=Math.floor(n),a=Math.floor(r),l=s+1,c=a+1,u=e/s,d=t/a,h=[],p=[],m=[],f=[];for(let e=0;e<c;e++){const t=e*d-o;for(let n=0;n<l;n++){const r=n*u-i;p.push(r,-t,0),m.push(0,0,1),f.push(n/s),f.push(1-e/a)}}for(let e=0;e<a;e++)for(let t=0;t<s;t++){const n=t+l*e,r=t+l*(e+1),i=t+1+l*(e+1),o=t+1+l*e;h.push(n,r,o),h.push(r,i,o)}this.setIndex(h),this.setAttribute("position",new O_(p,3)),this.setAttribute("normal",new O_(m,3)),this.setAttribute("uv",new O_(f,2))}static fromJSON(e){return new Ib(e.width,e.height,e.widthSegments,e.heightSegments)}}const Mb={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\n\tvec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n#define Material_LightProbeLOD( material )\t(0)",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},Rb={common:{diffuse:{value:new Vy(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new My},uv2Transform:{value:new My},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Iy(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Vy(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Vy(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new My}},sprite:{diffuse:{value:new Vy(16777215)},opacity:{value:1},center:{value:new Iy(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new My}}},Pb={basic:{uniforms:ub([Rb.common,Rb.specularmap,Rb.envmap,Rb.aomap,Rb.lightmap,Rb.fog]),vertexShader:Mb.meshbasic_vert,fragmentShader:Mb.meshbasic_frag},lambert:{uniforms:ub([Rb.common,Rb.specularmap,Rb.envmap,Rb.aomap,Rb.lightmap,Rb.emissivemap,Rb.bumpmap,Rb.normalmap,Rb.displacementmap,Rb.fog,Rb.lights,{emissive:{value:new Vy(0)}}]),vertexShader:Mb.meshlambert_vert,fragmentShader:Mb.meshlambert_frag},phong:{uniforms:ub([Rb.common,Rb.specularmap,Rb.envmap,Rb.aomap,Rb.lightmap,Rb.emissivemap,Rb.bumpmap,Rb.normalmap,Rb.displacementmap,Rb.fog,Rb.lights,{emissive:{value:new Vy(0)},specular:{value:new Vy(1118481)},shininess:{value:30}}]),vertexShader:Mb.meshphong_vert,fragmentShader:Mb.meshphong_frag},standard:{uniforms:ub([Rb.common,Rb.envmap,Rb.aomap,Rb.lightmap,Rb.emissivemap,Rb.bumpmap,Rb.normalmap,Rb.displacementmap,Rb.roughnessmap,Rb.metalnessmap,Rb.fog,Rb.lights,{emissive:{value:new Vy(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Mb.meshphysical_vert,fragmentShader:Mb.meshphysical_frag},toon:{uniforms:ub([Rb.common,Rb.aomap,Rb.lightmap,Rb.emissivemap,Rb.bumpmap,Rb.normalmap,Rb.displacementmap,Rb.gradientmap,Rb.fog,Rb.lights,{emissive:{value:new Vy(0)}}]),vertexShader:Mb.meshtoon_vert,fragmentShader:Mb.meshtoon_frag},matcap:{uniforms:ub([Rb.common,Rb.bumpmap,Rb.normalmap,Rb.displacementmap,Rb.fog,{matcap:{value:null}}]),vertexShader:Mb.meshmatcap_vert,fragmentShader:Mb.meshmatcap_frag},points:{uniforms:ub([Rb.points,Rb.fog]),vertexShader:Mb.points_vert,fragmentShader:Mb.points_frag},dashed:{uniforms:ub([Rb.common,Rb.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mb.linedashed_vert,fragmentShader:Mb.linedashed_frag},depth:{uniforms:ub([Rb.common,Rb.displacementmap]),vertexShader:Mb.depth_vert,fragmentShader:Mb.depth_frag},normal:{uniforms:ub([Rb.common,Rb.bumpmap,Rb.normalmap,Rb.displacementmap,{opacity:{value:1}}]),vertexShader:Mb.meshnormal_vert,fragmentShader:Mb.meshnormal_frag},sprite:{uniforms:ub([Rb.sprite,Rb.fog]),vertexShader:Mb.sprite_vert,fragmentShader:Mb.sprite_frag},background:{uniforms:{uvTransform:{value:new My},t2D:{value:null}},vertexShader:Mb.background_vert,fragmentShader:Mb.background_frag},cube:{uniforms:ub([Rb.envmap,{opacity:{value:1}}]),vertexShader:Mb.cube_vert,fragmentShader:Mb.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mb.equirect_vert,fragmentShader:Mb.equirect_frag},distanceRGBA:{uniforms:ub([Rb.common,Rb.displacementmap,{referencePosition:{value:new oS},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mb.distanceRGBA_vert,fragmentShader:Mb.distanceRGBA_frag},shadow:{uniforms:ub([Rb.lights,Rb.fog,{color:{value:new Vy(0)},opacity:{value:1}}]),vertexShader:Mb.shadow_vert,fragmentShader:Mb.shadow_frag}};function Nb(e,t,n,r,i,o){const s=new Vy(0);let a,l,c=!0===i?0:1,u=null,d=0,h=null;function p(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,o)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),c=t,p(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,p(s,c)},render:function(n,i){let o=!1,m=!0===i.isScene?i.background:null;m&&m.isTexture&&(m=t.get(m));const f=e.xr,g=f.getSession&&f.getSession();g&&"additive"===g.environmentBlendMode&&(m=null),null===m?p(s,c):m&&m.isColor&&(p(m,1),o=!0),(e.autoClear||o)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.mapping===ag)?(void 0===l&&(l=new sb(new lb(1,1,1),new hb({name:"BackgroundCubeMaterial",uniforms:cb(Pb.cube.uniforms),vertexShader:Pb.cube.vertexShader,fragmentShader:Pb.cube.fragmentShader,side:ff,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),l.material.uniforms.envMap.value=m,l.material.uniforms.flipEnvMap.value=m.isCubeTexture&&!1===m.isRenderTargetTexture?-1:1,u===m&&d===m.version&&h===e.toneMapping||(l.material.needsUpdate=!0,u=m,d=m.version,h=e.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null)):m&&m.isTexture&&(void 0===a&&(a=new sb(new Ib(2,2),new hb({name:"BackgroundMaterial",uniforms:cb(Pb.background.uniforms),vertexShader:Pb.background.vertexShader,fragmentShader:Pb.background.fragmentShader,side:mf,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(a)),a.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),a.material.uniforms.uvTransform.value.copy(m.matrix),u===m&&d===m.version&&h===e.toneMapping||(a.material.needsUpdate=!0,u=m,d=m.version,h=e.toneMapping),a.layers.enableAll(),n.unshift(a,a.geometry,a.material,0,0,null))}}}function Ob(e,t,n,r){const i=e.getParameter(34921),o=r.isWebGL2?null:t.get("OES_vertex_array_object"),s=r.isWebGL2||null!==o,a={},l=p(null);let c=l,u=!1;function d(t){return r.isWebGL2?e.bindVertexArray(t):o.bindVertexArrayOES(t)}function h(t){return r.isWebGL2?e.deleteVertexArray(t):o.deleteVertexArrayOES(t)}function p(e){const t=[],n=[],r=[];for(let e=0;e<i;e++)t[e]=0,n[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function m(){const e=c.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function f(e){g(e,0)}function g(n,i){const o=c.newAttributes,s=c.enabledAttributes,a=c.attributeDivisors;if(o[n]=1,0===s[n]&&(e.enableVertexAttribArray(n),s[n]=1),a[n]!==i){(r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),a[n]=i}}function v(){const t=c.newAttributes,n=c.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function y(t,n,i,o,s,a){!0!==r.isWebGL2||5124!==i&&5125!==i?e.vertexAttribPointer(t,n,i,o,s,a):e.vertexAttribIPointer(t,n,i,s,a)}function S(){_(),u=!0,c!==l&&(c=l,d(c.object))}function _(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,h,S,_){let b=!1;if(s){const t=function(t,n,i){const s=!0===i.wireframe;let l=a[t.id];void 0===l&&(l={},a[t.id]=l);let c=l[n.id];void 0===c&&(c={},l[n.id]=c);let u=c[s];void 0===u&&(u=p(r.isWebGL2?e.createVertexArray():o.createVertexArrayOES()),c[s]=u);return u}(S,h,l);c!==t&&(c=t,d(c.object)),b=function(e,t,n,r){const i=c.attributes,o=t.attributes;let s=0;const a=n.getAttributes();for(const t in a){if(a[t].location>=0){const n=i[t];let r=o[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===n)return!0;if(n.attribute!==r)return!0;if(r&&n.data!==r.data)return!0;s++}}return c.attributesNum!==s||c.index!==r}(i,S,h,_),b&&function(e,t,n,r){const i={},o=t.attributes;let s=0;const a=n.getAttributes();for(const t in a){if(a[t].location>=0){let n=o[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}}c.attributes=i,c.attributesNum=s,c.index=r}(i,S,h,_)}else{const e=!0===l.wireframe;c.geometry===S.id&&c.program===h.id&&c.wireframe===e||(c.geometry=S.id,c.program=h.id,c.wireframe=e,b=!0)}null!==_&&n.update(_,34963),(b||u)&&(u=!1,function(i,o,s,a){if(!1===r.isWebGL2&&(i.isInstancedMesh||a.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;m();const l=a.attributes,c=s.getAttributes(),u=o.defaultAttributeValues;for(const t in c){const r=c[t];if(r.location>=0){let o=l[t];if(void 0===o&&("instanceMatrix"===t&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===t&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){const t=o.normalized,s=o.itemSize,l=n.get(o);if(void 0===l)continue;const c=l.buffer,u=l.type,d=l.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,l=n.stride,h=o.offset;if(n.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)g(r.location+e,n.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)}else for(let e=0;e<r.locationSize;e++)f(r.location+e);e.bindBuffer(34962,c);for(let e=0;e<r.locationSize;e++)y(r.location+e,s/r.locationSize,u,t,l*d,(h+s/r.locationSize*e)*d)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)g(r.location+e,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<r.locationSize;e++)f(r.location+e);e.bindBuffer(34962,c);for(let e=0;e<r.locationSize;e++)y(r.location+e,s/r.locationSize,u,t,s*d,s/r.locationSize*e*d)}}else if(void 0!==u){const n=u[t];if(void 0!==n)switch(n.length){case 2:e.vertexAttrib2fv(r.location,n);break;case 3:e.vertexAttrib3fv(r.location,n);break;case 4:e.vertexAttrib4fv(r.location,n);break;default:e.vertexAttrib1fv(r.location,n)}}}}v()}(i,l,h,S),null!==_&&e.bindBuffer(34963,n.get(_).buffer))},reset:S,resetDefaultState:_,dispose:function(){S();for(const e in a){const t=a[e];for(const e in t){const n=t[e];for(const e in n)h(n[e].object),delete n[e];delete t[e]}delete a[e]}},releaseStatesOfGeometry:function(e){if(void 0===a[e.id])return;const t=a[e.id];for(const e in t){const n=t[e];for(const e in n)h(n[e].object),delete n[e];delete t[e]}delete a[e.id]},releaseStatesOfProgram:function(e){for(const t in a){const n=a[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)h(r[e].object),delete r[e];delete n[e.id]}},initAttributes:m,enableAttribute:f,disableUnusedAttributes:v}}function Db(e,t,n,r){const i=r.isWebGL2;let o;this.setMode=function(e){o=e},this.render=function(t,r){e.drawArrays(o,t,r),n.update(r,o,1)},this.renderInstances=function(r,s,a){if(0===a)return;let l,c;if(i)l=e,c="drawArraysInstanced";else if(l=t.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](o,r,s,a),n.update(s,o,a)}}function kb(e,t,n){let r;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const a=i(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const l=o||t.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,u=e.getParameter(34930),d=e.getParameter(35660),h=e.getParameter(3379),p=e.getParameter(34076),m=e.getParameter(34921),f=e.getParameter(36347),g=e.getParameter(36348),v=e.getParameter(36349),y=d>0,S=o||t.has("OES_texture_float");return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:s,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:d,maxTextureSize:h,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:S,floatVertexTextures:y&&S,maxSamples:o?e.getParameter(36183):0}}function Lb(e){const t=this;let n=null,r=0,i=!1,o=!1;const s=new xb,a=new My,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){const o=null!==e?e.length:0;let c=null;if(0!==o){if(c=l.value,!0!==i||null===c){const t=r+4*o,i=n.matrixWorldInverse;a.getNormalMatrix(i),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,n=r;t!==o;++t,n+=4)s.copy(e[t]).applyMatrix4(i,a),s.normal.toArray(c,n),c[n+3]=s.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=o,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,o){const s=0!==e.length||t||0!==r||i;return i=t,n=u(e,o,0),r=e.length,s},this.beginShadows=function(){o=!0,u(null)},this.endShadows=function(){o=!1,c()},this.setState=function(t,s,a){const d=t.clippingPlanes,h=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||null===d||0===d.length||o&&!p)o?u(null):c();else{const e=o?0:r,t=4*e;let i=m.clippingState||null;l.value=i,i=u(d,s,t,a);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=e}}}function Bb(e){let t=new WeakMap;function n(e,t){return t===og?e.mapping=rg:t===sg&&(e.mapping=ig),e}function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){const o=i.mapping;if(o===og||o===sg){if(t.has(i)){return n(t.get(i).texture,i.mapping)}{const o=i.image;if(o&&o.height>0){const s=new yb(o.height/2);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}}return i},dispose:function(){t=new WeakMap}}}Pb.physical={uniforms:ub([Pb.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Iy(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Vy(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Iy},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Vy(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Vy(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Mb.meshphysical_vert,fragmentShader:Mb.meshphysical_frag};class zb extends pb{constructor(e=-1,t=1,n=1,r=-1,i=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=n-e,o=n+e,s=r+t,a=r-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,o=i+e*this.view.width,s-=t*this.view.offsetY,a=s-t*this.view.height}this.projectionMatrix.makeOrthographic(i,o,s,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}const Fb=[.125,.215,.35,.446,.526,.582],Ub=20,jb=new zb,Gb=new Vy;let Hb=null;const Vb=(1+Math.sqrt(5))/2,Wb=1/Vb,qb=[new oS(1,1,1),new oS(-1,1,1),new oS(1,1,-1),new oS(-1,1,-1),new oS(0,Vb,Wb),new oS(0,Vb,-Wb),new oS(Wb,0,Vb),new oS(-Wb,0,Vb),new oS(Vb,Wb,0),new oS(-Vb,Wb,0)];class Jb{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100){Hb=this._renderer.getRenderTarget(),this._setSize(256);const i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Xb(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=$b(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Hb),e.scissorTest=!1,Yb(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===rg||e.mapping===ig?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Hb=this._renderer.getRenderTarget();const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:gg,minFilter:gg,generateMipmaps:!1,type:Ig,format:Dg,encoding:Rv,depthBuffer:!1},r=Kb(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Kb(e,t,n);const{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){const t=[],n=[],r=[];let i=e;const o=e-4+1+Fb.length;for(let s=0;s<o;s++){const o=Math.pow(2,i);n.push(o);let a=1/o;s>e-4?a=Fb[s-e+4-1]:0===s&&(a=0),r.push(a);const l=1/(o-2),c=-l,u=1+l,d=[c,c,u,c,u,u,c,c,u,u,c,u],h=6,p=6,m=3,f=2,g=1,v=new Float32Array(m*p*h),y=new Float32Array(f*p*h),S=new Float32Array(g*p*h);for(let e=0;e<h;e++){const t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];v.set(r,m*p*e),y.set(d,f*p*e);const i=[e,e,e,e,e,e];S.set(i,g*p*e)}const _=new G_;_.setAttribute("position",new C_(v,m)),_.setAttribute("uv",new C_(y,f)),_.setAttribute("faceIndex",new C_(S,g)),t.push(_),i>4&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}(r)),this._blurMaterial=function(e,t,n){const r=new Float32Array(Ub),i=new oS(0,1,0),o=new hb({name:"SphericalGaussianBlur",defines:{n:Ub,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Qb(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:vf,depthTest:!1,depthWrite:!1});return o}(r,e,t)}return r}_compileMaterial(e){const t=new sb(this._lodPlanes[0],e);this._renderer.compile(t,jb)}_sceneToCubeUV(e,t,n,r){const i=new mb(90,1,t,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(Gb),a.toneMapping=$f,a.autoClear=!1;const u=new b_({name:"PMREM.Background",side:ff,depthWrite:!1,depthTest:!1}),d=new sb(new lb,u);let h=!1;const p=e.background;p?p.isColor&&(u.color.copy(p),e.background=null,h=!0):(u.color.copy(Gb),h=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(i.up.set(0,o[t],0),i.lookAt(s[t],0,0)):1===n?(i.up.set(0,0,o[t]),i.lookAt(0,s[t],0)):(i.up.set(0,o[t],0),i.lookAt(0,0,s[t]));const l=this._cubeSize;Yb(r,n*l,t>2?l:0,l,l),a.setRenderTarget(r),h&&a.render(d,i),a.render(e,i)}d.geometry.dispose(),d.material.dispose(),a.toneMapping=c,a.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===rg||e.mapping===ig;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=Xb()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=$b());const i=r?this._cubemapMaterial:this._equirectMaterial,o=new sb(this._lodPlanes[0],i);i.uniforms.envMap.value=e;const s=this._cubeSize;Yb(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(o,jb)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;t<this._lodPlanes.length;t++){const n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=qb[(t-1)%qb.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,r,i){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",i),this._halfBlur(o,e,n,n,r,"longitudinal",i)}_halfBlur(e,t,n,r,i,o,s){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new sb(this._lodPlanes[r],l),u=l.uniforms,d=this._sizeLods[n]-1,h=isFinite(i)?Math.PI/(2*d):2*Math.PI/39,p=i/h,m=isFinite(i)?1+Math.floor(3*p):Ub;m>Ub&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let e=0;e<Ub;++e){const t=e/p,n=Math.exp(-t*t/2);f.push(n),0===e?g+=n:e<m&&(g+=2*n)}for(let e=0;e<f.length;e++)f[e]=f[e]/g;u.envMap.value=e.texture,u.samples.value=m,u.weights.value=f,u.latitudinal.value="latitudinal"===o,s&&(u.poleAxis.value=s);const{_lodMax:v}=this;u.dTheta.value=h,u.mipInt.value=v-n;const y=this._sizeLods[r];Yb(t,3*y*(r>v-4?r-v+4:0),4*(this._cubeSize-y),3*y,2*y),a.setRenderTarget(t),a.render(c,jb)}}function Kb(e,t,n){const r=new Qy(e,t,n);return r.texture.mapping=ag,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Yb(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function $b(){return new hb({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Qb(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:vf,depthTest:!1,depthWrite:!1})}function Xb(){return new hb({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Qb(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:vf,depthTest:!1,depthWrite:!1})}function Qb(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Zb(e){let t=new WeakMap,n=null;function r(e){const n=e.target;n.removeEventListener("dispose",r);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){const o=i.mapping,s=o===og||o===sg,a=o===rg||o===ig;if(s||a){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;let r=t.get(i);return null===n&&(n=new Jb(e)),r=s?n.fromEquirectangular(i,r):n.fromCubemap(i,r),t.set(i,r),r.texture}if(t.has(i))return t.get(i).texture;{const o=i.image;if(s&&o&&o.height>0||a&&o&&function(e){let t=0;const n=6;for(let r=0;r<n;r++)void 0!==e[r]&&t++;return t===n}(o)){null===n&&(n=new Jb(e));const o=s?n.fromEquirectangular(i):n.fromCubemap(i);return t.set(i,o),i.addEventListener("dispose",r),o.texture}return null}}}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function ex(e){const t={};function n(n){if(void 0!==t[n])return t[n];let r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){const t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function tx(e,t,n,r){const i={},o=new WeakMap;function s(e){const a=e.target;null!==a.index&&t.remove(a.index);for(const e in a.attributes)t.remove(a.attributes[e]);a.removeEventListener("dispose",s),delete i[a.id];const l=o.get(a);l&&(t.remove(l),o.delete(a)),r.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(e){const n=[],r=e.index,i=e.attributes.position;let s=0;if(null!==r){const e=r.array;s=r.version;for(let t=0,r=e.length;t<r;t+=3){const r=e[t+0],i=e[t+1],o=e[t+2];n.push(r,i,i,o,o,r)}}else{const e=i.array;s=i.version;for(let t=0,r=e.length/3-1;t<r;t+=3){const e=t+0,r=t+1,i=t+2;n.push(e,r,r,i,i,e)}}const a=new(Ry(n)?P_:M_)(n,1);a.version=s;const l=o.get(e);l&&t.remove(l),o.set(e,a)}return{get:function(e,t){return!0===i[t.id]||(t.addEventListener("dispose",s),i[t.id]=!0,n.memory.geometries++),t},update:function(e){const n=e.attributes;for(const e in n)t.update(n[e],34962);const r=e.morphAttributes;for(const e in r){const n=r[e];for(let e=0,r=n.length;e<r;e++)t.update(n[e],34962)}},getWireframeAttribute:function(e){const t=o.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&a(e)}else a(e);return o.get(e)}}}function nx(e,t,n,r){const i=r.isWebGL2;let o,s,a;this.setMode=function(e){o=e},this.setIndex=function(e){s=e.type,a=e.bytesPerElement},this.render=function(t,r){e.drawElements(o,r,s,t*a),n.update(r,o,1)},this.renderInstances=function(r,l,c){if(0===c)return;let u,d;if(i)u=e,d="drawElementsInstanced";else if(u=t.get("ANGLE_instanced_arrays"),d="drawElementsInstancedANGLE",null===u)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[d](o,l,s,r*a,c),n.update(l,o,c)}}function rx(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,r){switch(t.calls++,n){case 4:t.triangles+=r*(e/3);break;case 1:t.lines+=r*(e/2);break;case 3:t.lines+=r*(e-1);break;case 2:t.lines+=r*e;break;case 0:t.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function ix(e,t){return e[0]-t[0]}function ox(e,t){return Math.abs(t[1])-Math.abs(e[1])}function sx(e,t,n){const r={},i=new Float32Array(8),o=new WeakMap,s=new Xy,a=[];for(let e=0;e<8;e++)a[e]=[e,0];return{update:function(l,c,u,d){const h=l.morphTargetInfluences;if(!0===t.isWebGL2){const r=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,i=void 0!==r?r.length:0;let a=o.get(c);if(void 0===a||a.count!==i){void 0!==a&&a.texture.dispose();const e=void 0!==c.morphAttributes.position,n=void 0!==c.morphAttributes.normal,r=void 0!==c.morphAttributes.color,l=c.morphAttributes.position||[],u=c.morphAttributes.normal||[],d=c.morphAttributes.color||[];let h=0;!0===e&&(h=1),!0===n&&(h=2),!0===r&&(h=3);let p=c.attributes.position.count*h,m=1;p>t.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);const f=new Float32Array(p*m*4*i),g=new Zy(f,p,m,i);g.type=Tg,g.needsUpdate=!0;const v=4*h;for(let t=0;t<i;t++){const i=l[t],o=u[t],a=d[t],c=p*m*4*t;for(let t=0;t<i.count;t++){const l=t*v;!0===e&&(s.fromBufferAttribute(i,t),f[c+l+0]=s.x,f[c+l+1]=s.y,f[c+l+2]=s.z,f[c+l+3]=0),!0===n&&(s.fromBufferAttribute(o,t),f[c+l+4]=s.x,f[c+l+5]=s.y,f[c+l+6]=s.z,f[c+l+7]=0),!0===r&&(s.fromBufferAttribute(a,t),f[c+l+8]=s.x,f[c+l+9]=s.y,f[c+l+10]=s.z,f[c+l+11]=4===a.itemSize?s.w:1)}}a={count:i,texture:g,size:new Iy(p,m)},o.set(c,a),c.addEventListener("dispose",(function e(){g.dispose(),o.delete(c),c.removeEventListener("dispose",e)}))}let l=0;for(let e=0;e<h.length;e++)l+=h[e];const u=c.morphTargetsRelative?1:1-l;d.getUniforms().setValue(e,"morphTargetBaseInfluence",u),d.getUniforms().setValue(e,"morphTargetInfluences",h),d.getUniforms().setValue(e,"morphTargetsTexture",a.texture,n),d.getUniforms().setValue(e,"morphTargetsTextureSize",a.size)}else{const t=void 0===h?0:h.length;let n=r[c.id];if(void 0===n||n.length!==t){n=[];for(let e=0;e<t;e++)n[e]=[e,0];r[c.id]=n}for(let e=0;e<t;e++){const t=n[e];t[0]=e,t[1]=h[e]}n.sort(ox);for(let e=0;e<8;e++)e<t&&n[e][1]?(a[e][0]=n[e][0],a[e][1]=n[e][1]):(a[e][0]=Number.MAX_SAFE_INTEGER,a[e][1]=0);a.sort(ix);const o=c.morphAttributes.position,s=c.morphAttributes.normal;let l=0;for(let e=0;e<8;e++){const t=a[e],n=t[0],r=t[1];n!==Number.MAX_SAFE_INTEGER&&r?(o&&c.getAttribute("morphTarget"+e)!==o[n]&&c.setAttribute("morphTarget"+e,o[n]),s&&c.getAttribute("morphNormal"+e)!==s[n]&&c.setAttribute("morphNormal"+e,s[n]),i[e]=r,l+=r):(o&&!0===c.hasAttribute("morphTarget"+e)&&c.deleteAttribute("morphTarget"+e),s&&!0===c.hasAttribute("morphNormal"+e)&&c.deleteAttribute("morphNormal"+e),i[e]=0)}const u=c.morphTargetsRelative?1:1-l;d.getUniforms().setValue(e,"morphTargetBaseInfluence",u),d.getUniforms().setValue(e,"morphTargetInfluences",i)}}}}function ax(e,t,n,r){let i=new WeakMap;function o(e){const t=e.target;t.removeEventListener("dispose",o),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(e){const s=r.render.frame,a=e.geometry,l=t.get(e,a);return i.get(l)!==s&&(t.update(l),i.set(l,s)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",o)&&e.addEventListener("dispose",o),n.update(e.instanceMatrix,34962),null!==e.instanceColor&&n.update(e.instanceColor,34962)),l},dispose:function(){i=new WeakMap}}}const lx=new $y,cx=new Zy,ux=new tS,dx=new vb,hx=[],px=[],mx=new Float32Array(16),fx=new Float32Array(9),gx=new Float32Array(4);function vx(e,t,n){const r=e[0];if(r<=0||r>0)return e;const i=t*n;let o=hx[i];if(void 0===o&&(o=new Float32Array(i),hx[i]=o),0!==t){r.toArray(o,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(o,i)}return o}function yx(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Sx(e,t){for(let n=0,r=t.length;n<r;n++)e[n]=t[n]}function _x(e,t){let n=px[t];void 0===n&&(n=new Int32Array(t),px[t]=n);for(let r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function bx(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function xx(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(yx(n,t))return;e.uniform2fv(this.addr,t),Sx(n,t)}}function wx(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(yx(n,t))return;e.uniform3fv(this.addr,t),Sx(n,t)}}function Cx(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(yx(n,t))return;e.uniform4fv(this.addr,t),Sx(n,t)}}function Ax(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(yx(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Sx(n,t)}else{if(yx(n,r))return;gx.set(r),e.uniformMatrix2fv(this.addr,!1,gx),Sx(n,r)}}function Ex(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(yx(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Sx(n,t)}else{if(yx(n,r))return;fx.set(r),e.uniformMatrix3fv(this.addr,!1,fx),Sx(n,r)}}function Tx(e,t){const n=this.cache,r=t.elements;if(void 0===r){if(yx(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Sx(n,t)}else{if(yx(n,r))return;mx.set(r),e.uniformMatrix4fv(this.addr,!1,mx),Sx(n,r)}}function Ix(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Mx(e,t){const n=this.cache;yx(n,t)||(e.uniform2iv(this.addr,t),Sx(n,t))}function Rx(e,t){const n=this.cache;yx(n,t)||(e.uniform3iv(this.addr,t),Sx(n,t))}function Px(e,t){const n=this.cache;yx(n,t)||(e.uniform4iv(this.addr,t),Sx(n,t))}function Nx(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Ox(e,t){const n=this.cache;yx(n,t)||(e.uniform2uiv(this.addr,t),Sx(n,t))}function Dx(e,t){const n=this.cache;yx(n,t)||(e.uniform3uiv(this.addr,t),Sx(n,t))}function kx(e,t){const n=this.cache;yx(n,t)||(e.uniform4uiv(this.addr,t),Sx(n,t))}function Lx(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2D(t||lx,i)}function Bx(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||ux,i)}function zx(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||dx,i)}function Fx(e,t,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||cx,i)}function Ux(e,t){e.uniform1fv(this.addr,t)}function jx(e,t){const n=vx(t,this.size,2);e.uniform2fv(this.addr,n)}function Gx(e,t){const n=vx(t,this.size,3);e.uniform3fv(this.addr,n)}function Hx(e,t){const n=vx(t,this.size,4);e.uniform4fv(this.addr,n)}function Vx(e,t){const n=vx(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Wx(e,t){const n=vx(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function qx(e,t){const n=vx(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Jx(e,t){e.uniform1iv(this.addr,t)}function Kx(e,t){e.uniform2iv(this.addr,t)}function Yx(e,t){e.uniform3iv(this.addr,t)}function $x(e,t){e.uniform4iv(this.addr,t)}function Xx(e,t){e.uniform1uiv(this.addr,t)}function Qx(e,t){e.uniform2uiv(this.addr,t)}function Zx(e,t){e.uniform3uiv(this.addr,t)}function ew(e,t){e.uniform4uiv(this.addr,t)}function tw(e,t,n){const r=t.length,i=_x(n,r);e.uniform1iv(this.addr,i);for(let e=0;e!==r;++e)n.setTexture2D(t[e]||lx,i[e])}function nw(e,t,n){const r=t.length,i=_x(n,r);e.uniform1iv(this.addr,i);for(let e=0;e!==r;++e)n.setTexture3D(t[e]||ux,i[e])}function rw(e,t,n){const r=t.length,i=_x(n,r);e.uniform1iv(this.addr,i);for(let e=0;e!==r;++e)n.setTextureCube(t[e]||dx,i[e])}function iw(e,t,n){const r=t.length,i=_x(n,r);e.uniform1iv(this.addr,i);for(let e=0;e!==r;++e)n.setTexture2DArray(t[e]||cx,i[e])}class ow{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return bx;case 35664:return xx;case 35665:return wx;case 35666:return Cx;case 35674:return Ax;case 35675:return Ex;case 35676:return Tx;case 5124:case 35670:return Ix;case 35667:case 35671:return Mx;case 35668:case 35672:return Rx;case 35669:case 35673:return Px;case 5125:return Nx;case 36294:return Ox;case 36295:return Dx;case 36296:return kx;case 35678:case 36198:case 36298:case 36306:case 35682:return Lx;case 35679:case 36299:case 36307:return Bx;case 35680:case 36300:case 36308:case 36293:return zx;case 36289:case 36303:case 36311:case 36292:return Fx}}(t.type)}}class sw{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Ux;case 35664:return jx;case 35665:return Gx;case 35666:return Hx;case 35674:return Vx;case 35675:return Wx;case 35676:return qx;case 5124:case 35670:return Jx;case 35667:case 35671:return Kx;case 35668:case 35672:return Yx;case 35669:case 35673:return $x;case 5125:return Xx;case 36294:return Qx;case 36295:return Zx;case 36296:return ew;case 35678:case 36198:case 36298:case 36306:case 35682:return tw;case 35679:case 36299:case 36307:return nw;case 35680:case 36300:case 36308:case 36293:return rw;case 36289:case 36303:case 36311:case 36292:return iw}}(t.type)}}class aw{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let i=0,o=r.length;i!==o;++i){const o=r[i];o.setValue(e,t[o.id],n)}}}const lw=/(\w+)(\])?(\[|\.)?/g;function cw(e,t){e.seq.push(t),e.map[t.id]=t}function uw(e,t,n){const r=e.name,i=r.length;for(lw.lastIndex=0;;){const o=lw.exec(r),s=lw.lastIndex;let a=o[1];const l="]"===o[2],c=o[3];if(l&&(a|=0),void 0===c||"["===c&&s+2===i){cw(n,void 0===c?new ow(a,e,t):new sw(a,e,t));break}{let e=n.map[a];void 0===e&&(e=new aw(a),cw(n,e)),n=e}}}class dw{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,35718);for(let r=0;r<n;++r){const n=e.getActiveUniform(t,r);uw(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,r){const i=this.map[t];void 0!==i&&i.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];void 0!==r&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let i=0,o=t.length;i!==o;++i){const o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,i=e.length;r!==i;++r){const i=e[r];i.id in t&&n.push(i)}return n}}function hw(e,t,n){const r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}let pw=0;function mw(e,t,n){const r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&""===i)return"";const o=/ERROR: 0:(\d+)/.exec(i);if(o){const r=parseInt(o[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+function(e,t){const n=e.split("\n"),r=[],i=Math.max(t-6,0),o=Math.min(t+6,n.length);for(let e=i;e<o;e++){const i=e+1;r.push(`${i===t?">":" "} ${i}: ${n[e]}`)}return r.join("\n")}(e.getShaderSource(t),r)}return i}function fw(e,t){const n=function(e){switch(e){case Rv:return["Linear","( value )"];case Pv:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function gw(e,t){let n;switch(t){case Xf:n="Linear";break;case Qf:n="Reinhard";break;case Zf:n="OptimizedCineon";break;case eg:n="ACESFilmic";break;case tg:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function vw(e){return""!==e}function yw(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Sw(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const _w=/^[ \t]*#include +<([\w\d./]+)>/gm;function bw(e){return e.replace(_w,xw)}function xw(e,t){const n=Mb[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return bw(n)}const ww=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Cw(e){return e.replace(ww,Aw)}function Aw(e,t,n,r){let i="";for(let e=parseInt(t);e<parseInt(n);e++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return i}function Ew(e){let t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function Tw(e,t,n,r){const i=e.getContext(),o=n.defines;let s=n.vertexShader,a=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===df?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===hf?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===pf&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case rg:case ig:t="ENVMAP_TYPE_CUBE";break;case ag:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),u=function(e){let t="ENVMAP_MODE_REFLECTION";e.envMap&&e.envMapMode===ig&&(t="ENVMAP_MODE_REFRACTION");return t}(n),d=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case Jf:t="ENVMAP_BLENDING_MULTIPLY";break;case Kf:t="ENVMAP_BLENDING_MIX";break;case Yf:t="ENVMAP_BLENDING_ADD"}return t}(n),h=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,r=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}(n),p=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(vw).join("\n")}(n),m=function(e){const t=[];for(const n in e){const r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(o),f=i.createProgram();let g,v,y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=[m].filter(vw).join("\n"),g.length>0&&(g+="\n"),v=[p,m].filter(vw).join("\n"),v.length>0&&(v+="\n")):(g=[Ew(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(vw).join("\n"),v=[p,Ew(n),"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+u:"",n.envMap?"#define "+d:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==$f?"#define TONE_MAPPING":"",n.toneMapping!==$f?Mb.tonemapping_pars_fragment:"",n.toneMapping!==$f?gw("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Mb.encodings_pars_fragment,fw("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(vw).join("\n")),s=bw(s),s=yw(s,n),s=Sw(s,n),a=bw(a),a=yw(a,n),a=Sw(a,n),s=Cw(s),a=Cw(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",n.glslVersion===dy?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===dy?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v);const S=y+v+a,_=hw(i,35633,y+g+s),b=hw(i,35632,S);if(i.attachShader(f,_),i.attachShader(f,b),void 0!==n.index0AttributeName?i.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(f,0,"position"),i.linkProgram(f),e.debug.checkShaderErrors){const e=i.getProgramInfoLog(f).trim(),t=i.getShaderInfoLog(_).trim(),n=i.getShaderInfoLog(b).trim();let r=!0,o=!0;if(!1===i.getProgramParameter(f,35714)){r=!1;const t=mw(i,_,"vertex"),n=mw(i,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(f,35715)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+n)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==t&&""!==n||(o=!1);o&&(this.diagnostics={runnable:r,programLog:e,vertexShader:{log:t,prefix:g},fragmentShader:{log:n,prefix:v}})}let x,w;return i.deleteShader(_),i.deleteShader(b),this.getUniforms=function(){return void 0===x&&(x=new dw(i,f)),x},this.getAttributes=function(){return void 0===w&&(w=function(e,t){const n={},r=e.getProgramParameter(t,35721);for(let i=0;i<r;i++){const r=e.getActiveAttrib(t,i),o=r.name;let s=1;35674===r.type&&(s=2),35675===r.type&&(s=3),35676===r.type&&(s=4),n[o]={type:r.type,location:e.getAttribLocation(t,o),locationSize:s}}return n}(i,f)),w},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(f),this.program=void 0},this.name=n.shaderName,this.id=pw++,this.cacheKey=t,this.usedTimes=1,this.program=f,this.vertexShader=_,this.fragmentShader=b,this}let Iw=0;class Mw{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return!1===o.has(r)&&(o.add(r),r.usedTimes++),!1===o.has(i)&&(o.add(i),i.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new Rw(e),t.set(e,n)),n}}class Rw{constructor(e){this.id=Iw++,this.code=e,this.usedTimes=0}}function Pw(e,t,n,r,i,o,s){const a=new JS,l=new Mw,c=[],u=i.isWebGL2,d=i.logarithmicDepthBuffer,h=i.vertexTextures;let p=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};return{getParameters:function(o,a,c,f,g){const v=f.fog,y=g.geometry,S=o.isMeshStandardMaterial?f.environment:null,_=(o.isMeshStandardMaterial?n:t).get(o.envMap||S),b=_&&_.mapping===ag?_.image.height:null,x=m[o.type];null!==o.precision&&(p=i.getMaxPrecision(o.precision),p!==o.precision&&console.warn("THREE.WebGLProgram.getParameters:",o.precision,"not supported, using",p,"instead."));const w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,C=void 0!==w?w.length:0;let A,E,T,I,M=0;if(void 0!==y.morphAttributes.position&&(M=1),void 0!==y.morphAttributes.normal&&(M=2),void 0!==y.morphAttributes.color&&(M=3),x){const e=Pb[x];A=e.vertexShader,E=e.fragmentShader}else A=o.vertexShader,E=o.fragmentShader,l.update(o),T=l.getVertexShaderID(o),I=l.getFragmentShaderID(o);const R=e.getRenderTarget(),P=o.alphaTest>0,N=o.clearcoat>0,O=o.iridescence>0;return{isWebGL2:u,shaderID:x,shaderName:o.type,vertexShader:A,fragmentShader:E,defines:o.defines,customVertexShaderID:T,customFragmentShaderID:I,isRawShaderMaterial:!0===o.isRawShaderMaterial,glslVersion:o.glslVersion,precision:p,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:h,outputEncoding:null===R?e.outputEncoding:!0===R.isXRRenderTarget?R.texture.encoding:Rv,map:!!o.map,matcap:!!o.matcap,envMap:!!_,envMapMode:_&&_.mapping,envMapCubeUVHeight:b,lightMap:!!o.lightMap,aoMap:!!o.aoMap,emissiveMap:!!o.emissiveMap,bumpMap:!!o.bumpMap,normalMap:!!o.normalMap,objectSpaceNormalMap:o.normalMapType===kv,tangentSpaceNormalMap:o.normalMapType===Dv,decodeVideoTexture:!!o.map&&!0===o.map.isVideoTexture&&o.map.encoding===Pv,clearcoat:N,clearcoatMap:N&&!!o.clearcoatMap,clearcoatRoughnessMap:N&&!!o.clearcoatRoughnessMap,clearcoatNormalMap:N&&!!o.clearcoatNormalMap,iridescence:O,iridescenceMap:O&&!!o.iridescenceMap,iridescenceThicknessMap:O&&!!o.iridescenceThicknessMap,displacementMap:!!o.displacementMap,roughnessMap:!!o.roughnessMap,metalnessMap:!!o.metalnessMap,specularMap:!!o.specularMap,specularIntensityMap:!!o.specularIntensityMap,specularColorMap:!!o.specularColorMap,opaque:!1===o.transparent&&o.blending===yf,alphaMap:!!o.alphaMap,alphaTest:P,gradientMap:!!o.gradientMap,sheen:o.sheen>0,sheenColorMap:!!o.sheenColorMap,sheenRoughnessMap:!!o.sheenRoughnessMap,transmission:o.transmission>0,transmissionMap:!!o.transmissionMap,thicknessMap:!!o.thicknessMap,combine:o.combine,vertexTangents:!!o.normalMap&&!!y.attributes.tangent,vertexColors:o.vertexColors,vertexAlphas:!0===o.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,vertexUvs:!!(o.map||o.bumpMap||o.normalMap||o.specularMap||o.alphaMap||o.emissiveMap||o.roughnessMap||o.metalnessMap||o.clearcoatMap||o.clearcoatRoughnessMap||o.clearcoatNormalMap||o.iridescenceMap||o.iridescenceThicknessMap||o.displacementMap||o.transmissionMap||o.thicknessMap||o.specularIntensityMap||o.specularColorMap||o.sheenColorMap||o.sheenRoughnessMap),uvsVertexOnly:!(o.map||o.bumpMap||o.normalMap||o.specularMap||o.alphaMap||o.emissiveMap||o.roughnessMap||o.metalnessMap||o.clearcoatNormalMap||o.iridescenceMap||o.iridescenceThicknessMap||o.transmission>0||o.transmissionMap||o.thicknessMap||o.specularIntensityMap||o.specularColorMap||o.sheen>0||o.sheenColorMap||o.sheenRoughnessMap||!o.displacementMap),fog:!!v,useFog:!0===o.fog,fogExp2:v&&v.isFogExp2,flatShading:!!o.flatShading,sizeAttenuation:o.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:C,morphTextureStride:M,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numSpotLightMaps:a.spotLightMap.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numSpotLightShadowsWithMaps:a.numSpotLightShadowsWithMaps,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:o.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:o.toneMapped?e.toneMapping:$f,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:o.premultipliedAlpha,doubleSided:o.side===gf,flipSided:o.side===ff,useDepthPacking:!!o.depthPacking,depthPacking:o.depthPacking||0,index0AttributeName:o.index0AttributeName,extensionDerivatives:o.extensions&&o.extensions.derivatives,extensionFragDepth:o.extensions&&o.extensions.fragDepth,extensionDrawBuffers:o.extensions&&o.extensions.drawBuffers,extensionShaderTextureLOD:o.extensions&&o.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||r.has("EXT_shader_texture_lod"),customProgramCacheKey:o.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){a.disableAll(),t.isWebGL2&&a.enable(0);t.supportsVertexTextures&&a.enable(1);t.instancing&&a.enable(2);t.instancingColor&&a.enable(3);t.map&&a.enable(4);t.matcap&&a.enable(5);t.envMap&&a.enable(6);t.lightMap&&a.enable(7);t.aoMap&&a.enable(8);t.emissiveMap&&a.enable(9);t.bumpMap&&a.enable(10);t.normalMap&&a.enable(11);t.objectSpaceNormalMap&&a.enable(12);t.tangentSpaceNormalMap&&a.enable(13);t.clearcoat&&a.enable(14);t.clearcoatMap&&a.enable(15);t.clearcoatRoughnessMap&&a.enable(16);t.clearcoatNormalMap&&a.enable(17);t.iridescence&&a.enable(18);t.iridescenceMap&&a.enable(19);t.iridescenceThicknessMap&&a.enable(20);t.displacementMap&&a.enable(21);t.specularMap&&a.enable(22);t.roughnessMap&&a.enable(23);t.metalnessMap&&a.enable(24);t.gradientMap&&a.enable(25);t.alphaMap&&a.enable(26);t.alphaTest&&a.enable(27);t.vertexColors&&a.enable(28);t.vertexAlphas&&a.enable(29);t.vertexUvs&&a.enable(30);t.vertexTangents&&a.enable(31);t.uvsVertexOnly&&a.enable(32);e.push(a.mask),a.disableAll(),t.fog&&a.enable(0);t.useFog&&a.enable(1);t.flatShading&&a.enable(2);t.logarithmicDepthBuffer&&a.enable(3);t.skinning&&a.enable(4);t.morphTargets&&a.enable(5);t.morphNormals&&a.enable(6);t.morphColors&&a.enable(7);t.premultipliedAlpha&&a.enable(8);t.shadowMapEnabled&&a.enable(9);t.physicallyCorrectLights&&a.enable(10);t.doubleSided&&a.enable(11);t.flipSided&&a.enable(12);t.useDepthPacking&&a.enable(13);t.dithering&&a.enable(14);t.specularIntensityMap&&a.enable(15);t.specularColorMap&&a.enable(16);t.transmission&&a.enable(17);t.transmissionMap&&a.enable(18);t.thicknessMap&&a.enable(19);t.sheen&&a.enable(20);t.sheenColorMap&&a.enable(21);t.sheenRoughnessMap&&a.enable(22);t.decodeVideoTexture&&a.enable(23);t.opaque&&a.enable(24);e.push(a.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=m[e.type];let n;if(t){const e=Pb[t];n=db.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let r;for(let e=0,t=c.length;e<t;e++){const t=c[e];if(t.cacheKey===n){r=t,++r.usedTimes;break}}return void 0===r&&(r=new Tw(e,n,t,o),c.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){const t=c.indexOf(e);c[t]=c[c.length-1],c.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:c,dispose:function(){l.dispose()}}}function Nw(){let e=new WeakMap;return{get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function Ow(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Dw(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function kw(){const e=[];let t=0;const n=[],r=[],i=[];function o(n,r,i,o,s,a){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:r,material:i,groupOrder:o,renderOrder:n.renderOrder,z:s,group:a},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=i,l.groupOrder=o,l.renderOrder=n.renderOrder,l.z=s,l.group=a),t++,l}return{opaque:n,transmissive:r,transparent:i,init:function(){t=0,n.length=0,r.length=0,i.length=0},push:function(e,t,s,a,l,c){const u=o(e,t,s,a,l,c);s.transmission>0?r.push(u):!0===s.transparent?i.push(u):n.push(u)},unshift:function(e,t,s,a,l,c){const u=o(e,t,s,a,l,c);s.transmission>0?r.unshift(u):!0===s.transparent?i.unshift(u):n.unshift(u)},finish:function(){for(let n=t,r=e.length;n<r;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||Ow),r.length>1&&r.sort(t||Dw),i.length>1&&i.sort(t||Dw)}}}function Lw(){let e=new WeakMap;return{get:function(t,n){const r=e.get(t);let i;return void 0===r?(i=new kw,e.set(t,[i])):n>=r.length?(i=new kw,r.push(i)):i=r[n],i},dispose:function(){e=new WeakMap}}}function Bw(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new oS,color:new Vy};break;case"SpotLight":n={position:new oS,direction:new oS,color:new Vy,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new oS,color:new Vy,distance:0,decay:0};break;case"HemisphereLight":n={direction:new oS,skyColor:new Vy,groundColor:new Vy};break;case"RectAreaLight":n={color:new Vy,position:new oS,halfWidth:new oS,halfHeight:new oS}}return e[t.id]=n,n}}}let zw=0;function Fw(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Uw(e,t){const n=new Bw,r=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Iy};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Iy,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let e=0;e<9;e++)i.probe.push(new oS);const o=new oS,s=new LS,a=new LS;return{setup:function(o,s){let a=0,l=0,c=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let u=0,d=0,h=0,p=0,m=0,f=0,g=0,v=0,y=0,S=0;o.sort(Fw);const _=!0!==s?Math.PI:1;for(let e=0,t=o.length;e<t;e++){const t=o[e],s=t.color,b=t.intensity,x=t.distance,w=t.shadow&&t.shadow.map?t.shadow.map.texture:null;if(t.isAmbientLight)a+=s.r*b*_,l+=s.g*b*_,c+=s.b*b*_;else if(t.isLightProbe)for(let e=0;e<9;e++)i.probe[e].addScaledVector(t.sh.coefficients[e],b);else if(t.isDirectionalLight){const e=n.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity*_),t.castShadow){const e=t.shadow,n=r.get(t);n.shadowBias=e.bias,n.shadowNormalBias=e.normalBias,n.shadowRadius=e.radius,n.shadowMapSize=e.mapSize,i.directionalShadow[u]=n,i.directionalShadowMap[u]=w,i.directionalShadowMatrix[u]=t.shadow.matrix,f++}i.directional[u]=e,u++}else if(t.isSpotLight){const e=n.get(t);e.position.setFromMatrixPosition(t.matrixWorld),e.color.copy(s).multiplyScalar(b*_),e.distance=x,e.coneCos=Math.cos(t.angle),e.penumbraCos=Math.cos(t.angle*(1-t.penumbra)),e.decay=t.decay,i.spot[h]=e;const o=t.shadow;if(t.map&&(i.spotLightMap[y]=t.map,y++,o.updateMatrices(t),t.castShadow&&S++),i.spotLightMatrix[h]=o.matrix,t.castShadow){const e=r.get(t);e.shadowBias=o.bias,e.shadowNormalBias=o.normalBias,e.shadowRadius=o.radius,e.shadowMapSize=o.mapSize,i.spotShadow[h]=e,i.spotShadowMap[h]=w,v++}h++}else if(t.isRectAreaLight){const e=n.get(t);e.color.copy(s).multiplyScalar(b),e.halfWidth.set(.5*t.width,0,0),e.halfHeight.set(0,.5*t.height,0),i.rectArea[p]=e,p++}else if(t.isPointLight){const e=n.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity*_),e.distance=t.distance,e.decay=t.decay,t.castShadow){const e=t.shadow,n=r.get(t);n.shadowBias=e.bias,n.shadowNormalBias=e.normalBias,n.shadowRadius=e.radius,n.shadowMapSize=e.mapSize,n.shadowCameraNear=e.camera.near,n.shadowCameraFar=e.camera.far,i.pointShadow[d]=n,i.pointShadowMap[d]=w,i.pointShadowMatrix[d]=t.shadow.matrix,g++}i.point[d]=e,d++}else if(t.isHemisphereLight){const e=n.get(t);e.skyColor.copy(t.color).multiplyScalar(b*_),e.groundColor.copy(t.groundColor).multiplyScalar(b*_),i.hemi[m]=e,m++}}p>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=Rb.LTC_FLOAT_1,i.rectAreaLTC2=Rb.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=Rb.LTC_HALF_1,i.rectAreaLTC2=Rb.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=a,i.ambient[1]=l,i.ambient[2]=c;const b=i.hash;b.directionalLength===u&&b.pointLength===d&&b.spotLength===h&&b.rectAreaLength===p&&b.hemiLength===m&&b.numDirectionalShadows===f&&b.numPointShadows===g&&b.numSpotShadows===v&&b.numSpotMaps===y||(i.directional.length=u,i.spot.length=h,i.rectArea.length=p,i.point.length=d,i.hemi.length=m,i.directionalShadow.length=f,i.directionalShadowMap.length=f,i.pointShadow.length=g,i.pointShadowMap.length=g,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=f,i.pointShadowMatrix.length=g,i.spotLightMatrix.length=v+y-S,i.spotLightMap.length=y,i.numSpotLightShadowsWithMaps=S,b.directionalLength=u,b.pointLength=d,b.spotLength=h,b.rectAreaLength=p,b.hemiLength=m,b.numDirectionalShadows=f,b.numPointShadows=g,b.numSpotShadows=v,b.numSpotMaps=y,i.version=zw++)},setupView:function(e,t){let n=0,r=0,l=0,c=0,u=0;const d=t.matrixWorldInverse;for(let t=0,h=e.length;t<h;t++){const h=e[t];if(h.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(h.matrixWorld),o.setFromMatrixPosition(h.target.matrixWorld),e.direction.sub(o),e.direction.transformDirection(d),n++}else if(h.isSpotLight){const e=i.spot[l];e.position.setFromMatrixPosition(h.matrixWorld),e.position.applyMatrix4(d),e.direction.setFromMatrixPosition(h.matrixWorld),o.setFromMatrixPosition(h.target.matrixWorld),e.direction.sub(o),e.direction.transformDirection(d),l++}else if(h.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(h.matrixWorld),e.position.applyMatrix4(d),a.identity(),s.copy(h.matrixWorld),s.premultiply(d),a.extractRotation(s),e.halfWidth.set(.5*h.width,0,0),e.halfHeight.set(0,.5*h.height,0),e.halfWidth.applyMatrix4(a),e.halfHeight.applyMatrix4(a),c++}else if(h.isPointLight){const e=i.point[r];e.position.setFromMatrixPosition(h.matrixWorld),e.position.applyMatrix4(d),r++}else if(h.isHemisphereLight){const e=i.hemi[u];e.direction.setFromMatrixPosition(h.matrixWorld),e.direction.transformDirection(d),u++}}},state:i}}function jw(e,t){const n=new Uw(e,t),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(e){n.setup(r,e)},setupLightsView:function(e){n.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){i.push(e)}}}function Gw(e,t){let n=new WeakMap;return{get:function(r,i=0){const o=n.get(r);let s;return void 0===o?(s=new jw(e,t),n.set(r,[s])):i>=o.length?(s=new jw(e,t),o.push(s)):s=o[i],s},dispose:function(){n=new WeakMap}}}class Hw extends __{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Nv,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Vw extends __{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new oS,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function Ww(e,t,n){let r=new Ab;const i=new Iy,o=new Iy,s=new Xy,a=new Hw({depthPacking:Ov}),l=new Vw,c={},u=n.maxTextureSize,d={0:ff,1:mf,2:gf},h=new hb({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Iy},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const m=new G_;m.setAttribute("position",new C_(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new sb(m,h),g=this;function v(n,r){const o=t.update(f);h.defines.VSM_SAMPLES!==n.blurSamples&&(h.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,h.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Qy(i.x,i.y)),h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,o,h,f,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,o,p,f,null)}function y(t,n,r,i,o,s){let u=null;const h=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(u=void 0!==h?h:!0===r.isPointLight?l:a,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const e=u.uuid,t=n.uuid;let r=c[e];void 0===r&&(r={},c[e]=r);let i=r[t];void 0===i&&(i=u.clone(),r[t]=i),u=i}return u.visible=n.visible,u.wireframe=n.wireframe,u.side=s===pf?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],u.alphaMap=n.alphaMap,u.alphaTest=n.alphaTest,u.clipShadows=n.clipShadows,u.clippingPlanes=n.clippingPlanes,u.clipIntersection=n.clipIntersection,u.displacementMap=n.displacementMap,u.displacementScale=n.displacementScale,u.displacementBias=n.displacementBias,u.wireframeLinewidth=n.wireframeLinewidth,u.linewidth=n.linewidth,!0===r.isPointLight&&!0===u.isMeshDistanceMaterial&&(u.referencePosition.setFromMatrixPosition(r.matrixWorld),u.nearDistance=i,u.farDistance=o),u}function S(n,i,o,s,a){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===pf)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const r=t.update(n),i=n.material;if(Array.isArray(i)){const t=r.groups;for(let l=0,c=t.length;l<c;l++){const c=t[l],u=i[c.materialIndex];if(u&&u.visible){const t=y(n,u,s,o.near,o.far,a);e.renderBufferDirect(o,null,r,t,n,c)}}}else if(i.visible){const t=y(n,i,s,o.near,o.far,a);e.renderBufferDirect(o,null,r,t,n,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)S(l[e],i,o,s,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=df,this.render=function(t,n,a){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===t.length)return;const l=e.getRenderTarget(),c=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),h=e.state;h.setBlending(vf),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);for(let l=0,c=t.length;l<c;l++){const c=t[l],d=c.shadow;if(void 0===d){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===d.autoUpdate&&!1===d.needsUpdate)continue;i.copy(d.mapSize);const p=d.getFrameExtents();if(i.multiply(p),o.copy(d.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(o.x=Math.floor(u/p.x),i.x=o.x*p.x,d.mapSize.x=o.x),i.y>u&&(o.y=Math.floor(u/p.y),i.y=o.y*p.y,d.mapSize.y=o.y)),null===d.map){const e=this.type!==pf?{minFilter:dg,magFilter:dg}:{};d.map=new Qy(i.x,i.y,e),d.map.texture.name=c.name+".shadowMap",d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();const m=d.getViewportCount();for(let e=0;e<m;e++){const t=d.getViewport(e);s.set(o.x*t.x,o.y*t.y,o.x*t.z,o.y*t.w),h.viewport(s),d.updateMatrices(c,e),r=d.getFrustum(),S(n,a,d.camera,c,this.type)}!0!==d.isPointLightShadow&&this.type===pf&&v(d,a),d.needsUpdate=!1}g.needsUpdate=!1,e.setRenderTarget(l,c,d)}}function qw(e,t,n){const r=n.isWebGL2;const i=new function(){let t=!1;const n=new Xy;let r=null;const i=new Xy(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,o,s,a){!0===a&&(t*=s,r*=s,o*=s),n.set(t,r,o,s),!1===i.equals(n)&&(e.clearColor(t,r,o,s),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},o=new function(){let t=!1,n=null,r=null,i=null;return{setTest:function(e){e?U(2929):j(2929)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case Ff:e.depthFunc(512);break;case Uf:e.depthFunc(519);break;case jf:e.depthFunc(513);break;case Gf:e.depthFunc(515);break;case Hf:e.depthFunc(514);break;case Vf:e.depthFunc(518);break;case Wf:e.depthFunc(516);break;case qf:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}},s=new function(){let t=!1,n=null,r=null,i=null,o=null,s=null,a=null,l=null,c=null;return{setTest:function(e){t||(e?U(2960):j(2960))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,s){r===t&&i===n&&o===s||(e.stencilFunc(t,n,s),r=t,i=n,o=s)},setOp:function(t,n,r){s===t&&a===n&&l===r||(e.stencilOp(t,n,r),s=t,a=n,l=r)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,r=null,i=null,o=null,s=null,a=null,l=null,c=null}}},a=new WeakMap,l=new WeakMap;let c={},u={},d=new WeakMap,h=[],p=null,m=!1,f=null,g=null,v=null,y=null,S=null,_=null,b=null,x=!1,w=null,C=null,A=null,E=null,T=null;const I=e.getParameter(35661);let M=!1,R=0;const P=e.getParameter(7938);-1!==P.indexOf("WebGL")?(R=parseFloat(/^WebGL (\d)/.exec(P)[1]),M=R>=1):-1!==P.indexOf("OpenGL ES")&&(R=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),M=R>=2);let N=null,O={};const D=e.getParameter(3088),k=e.getParameter(2978),L=(new Xy).fromArray(D),B=(new Xy).fromArray(k);function z(t,n,r){const i=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;t<r;t++)e.texImage2D(n+t,0,6408,1,1,0,6408,5121,i);return o}const F={};function U(t){!0!==c[t]&&(e.enable(t),c[t]=!0)}function j(t){!1!==c[t]&&(e.disable(t),c[t]=!1)}F[3553]=z(3553,3553,1),F[34067]=z(34067,34069,6),i.setClear(0,0,0,1),o.setClear(1),s.setClear(0),U(2929),o.setFunc(Gf),W(!1),q(af),U(2884),V(vf);const G={[wf]:32774,[Cf]:32778,[Af]:32779};if(r)G[Ef]=32775,G[Tf]=32776;else{const e=t.get("EXT_blend_minmax");null!==e&&(G[Ef]=e.MIN_EXT,G[Tf]=e.MAX_EXT)}const H={[If]:0,[Mf]:1,[Rf]:768,[Nf]:770,[zf]:776,[Lf]:774,[Df]:772,[Pf]:769,[Of]:771,[Bf]:775,[kf]:773};function V(t,n,r,i,o,s,a,l){if(t!==vf){if(!1===m&&(U(3042),m=!0),t===xf)o=o||n,s=s||r,a=a||i,n===g&&o===S||(e.blendEquationSeparate(G[n],G[o]),g=n,S=o),r===v&&i===y&&s===_&&a===b||(e.blendFuncSeparate(H[r],H[i],H[s],H[a]),v=r,y=i,_=s,b=a),f=t,x=null;else if(t!==f||l!==x){if(g===wf&&S===wf||(e.blendEquation(32774),g=wf,S=wf),l)switch(t){case yf:e.blendFuncSeparate(1,771,1,771);break;case Sf:e.blendFunc(1,1);break;case _f:e.blendFuncSeparate(0,769,0,1);break;case bf:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case yf:e.blendFuncSeparate(770,771,1,771);break;case Sf:e.blendFunc(770,1);break;case _f:e.blendFuncSeparate(0,769,0,1);break;case bf:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}v=null,y=null,_=null,b=null,f=t,x=l}}else!0===m&&(j(3042),m=!1)}function W(t){w!==t&&(t?e.frontFace(2304):e.frontFace(2305),w=t)}function q(t){t!==sf?(U(2884),t!==C&&(t===af?e.cullFace(1029):t===lf?e.cullFace(1028):e.cullFace(1032))):j(2884),C=t}function J(t,n,r){t?(U(32823),E===n&&T===r||(e.polygonOffset(n,r),E=n,T=r)):j(32823)}function K(t){void 0===t&&(t=33984+I-1),N!==t&&(e.activeTexture(t),N=t)}return{buffers:{color:i,depth:o,stencil:s},enable:U,disable:j,bindFramebuffer:function(t,n){return u[t]!==n&&(e.bindFramebuffer(t,n),u[t]=n,r&&(36009===t&&(u[36160]=n),36160===t&&(u[36009]=n)),!0)},drawBuffers:function(r,i){let o=h,s=!1;if(r)if(o=d.get(i),void 0===o&&(o=[],d.set(i,o)),r.isWebGLMultipleRenderTargets){const e=r.texture;if(o.length!==e.length||36064!==o[0]){for(let t=0,n=e.length;t<n;t++)o[t]=36064+t;o.length=e.length,s=!0}}else 36064!==o[0]&&(o[0]=36064,s=!0);else 1029!==o[0]&&(o[0]=1029,s=!0);s&&(n.isWebGL2?e.drawBuffers(o):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(o))},useProgram:function(t){return p!==t&&(e.useProgram(t),p=t,!0)},setBlending:V,setMaterial:function(e,t){e.side===gf?j(2884):U(2884);let n=e.side===ff;t&&(n=!n),W(n),e.blending===yf&&!1===e.transparent?V(vf):V(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),o.setFunc(e.depthFunc),o.setTest(e.depthTest),o.setMask(e.depthWrite),i.setMask(e.colorWrite);const r=e.stencilWrite;s.setTest(r),r&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),J(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?U(32926):j(32926)},setFlipSided:W,setCullFace:q,setLineWidth:function(t){t!==A&&(M&&e.lineWidth(t),A=t)},setPolygonOffset:J,setScissorTest:function(e){e?U(3089):j(3089)},activeTexture:K,bindTexture:function(t,n){null===N&&K();let r=O[N];void 0===r&&(r={type:void 0,texture:void 0},O[N]=r),r.type===t&&r.texture===n||(e.bindTexture(t,n||F[t]),r.type=t,r.texture=n)},unbindTexture:function(){const t=O[N];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){let r=l.get(n);void 0===r&&(r=new WeakMap,l.set(n,r));let i=r.get(t);void 0===i&&(i=e.getUniformBlockIndex(n,t.name),r.set(t,i))},uniformBlockBinding:function(t,n){const r=l.get(n).get(t);a.get(t)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),a.set(t,r))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===L.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),L.copy(t))},viewport:function(t){!1===B.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),B.copy(t))},reset:function(){e.disable(3042),e.disable(2884),e.disable(2929),e.disable(32823),e.disable(3089),e.disable(2960),e.disable(32926),e.blendEquation(32774),e.blendFunc(1,0),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(513),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(519,0,4294967295),e.stencilOp(7680,7680,7680),e.clearStencil(0),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.activeTexture(33984),e.bindFramebuffer(36160,null),!0===r&&(e.bindFramebuffer(36009,null),e.bindFramebuffer(36008,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),c={},N=null,O={},u={},d=new WeakMap,h=[],p=null,m=!1,f=null,g=null,v=null,y=null,S=null,_=null,b=null,x=!1,w=null,C=null,A=null,E=null,T=null,L.set(0,0,e.canvas.width,e.canvas.height),B.set(0,0,e.canvas.width,e.canvas.height),i.reset(),o.reset(),s.reset()}}}function Jw(e,t,n,r,i,o,s){const a=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,u=i.maxTextureSize,d=i.maxSamples,h=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,p=/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let f;const g=new WeakMap;let v=!1;try{v="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function y(e,t){return v?new OffscreenCanvas(e,t):Oy("canvas")}function S(e,t,n,r){let i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const r=t?Cy:Math.floor,o=r(i*e.width),s=r(i*e.height);void 0===f&&(f=y(o,s));const a=n?y(o,s):f;a.width=o,a.height=s;return a.getContext("2d").drawImage(e,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),a}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function _(e){return xy(e.width)&&xy(e.height)}function b(e,t){return e.generateMipmaps&&t&&e.minFilter!==dg&&e.minFilter!==gg}function x(t){e.generateMipmap(t)}function w(n,r,i,o,s=!1){if(!1===a)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=r;return 6403===r&&(5126===i&&(l=33326),5131===i&&(l=33325),5121===i&&(l=33321)),33319===r&&(5126===i&&(l=33328),5131===i&&(l=33327),5121===i&&(l=33323)),6408===r&&(5126===i&&(l=34836),5131===i&&(l=34842),5121===i&&(l=o===Pv&&!1===s?35907:32856),32819===i&&(l=32854),32820===i&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||t.get("EXT_color_buffer_float"),l}function C(e,t,n){return!0===b(e,n)||e.isFramebufferTexture&&e.minFilter!==dg&&e.minFilter!==gg?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function A(e){return e===dg||e===hg||e===mg?9728:9729}function E(e){const t=e.target;t.removeEventListener("dispose",E),function(e){const t=r.get(e);if(void 0===t.__webglInit)return;const n=e.source,i=g.get(n);if(i){const r=i[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&I(e),0===Object.keys(i).length&&g.delete(n)}r.remove(e)}(t),t.isVideoTexture&&m.delete(t)}function T(t){const n=t.target;n.removeEventListener("dispose",T),function(t){const n=t.texture,i=r.get(t),o=r.get(n);void 0!==o.__webglTexture&&(e.deleteTexture(o.__webglTexture),s.memory.textures--);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(i.__webglFramebuffer[t]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[t]);else{if(e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let t=0;t<i.__webglColorRenderbuffer.length;t++)i.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[t]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(let t=0,i=n.length;t<i;t++){const i=r.get(n[t]);i.__webglTexture&&(e.deleteTexture(i.__webglTexture),s.memory.textures--),r.remove(n[t])}r.remove(n),r.remove(t)}(n)}function I(t){const n=r.get(t);e.deleteTexture(n.__webglTexture);const i=t.source;delete g.get(i)[n.__cacheKey],s.memory.textures--}let M=0;function R(e,t){const i=r.get(e);if(e.isVideoTexture&&function(e){const t=s.render.frame;m.get(e)!==t&&(m.set(e,t),e.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&i.__version!==e.version){const n=e.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void k(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}const P={[lg]:10497,[cg]:33071,[ug]:33648},N={[dg]:9728,[hg]:9984,[mg]:9986,[gg]:9729,[vg]:9985,[Sg]:9987};function O(n,o,s){if(s?(e.texParameteri(n,10242,P[o.wrapS]),e.texParameteri(n,10243,P[o.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,P[o.wrapR]),e.texParameteri(n,10240,N[o.magFilter]),e.texParameteri(n,10241,N[o.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),o.wrapS===cg&&o.wrapT===cg||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,A(o.magFilter)),e.texParameteri(n,10241,A(o.minFilter)),o.minFilter!==dg&&o.minFilter!==gg&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){const s=t.get("EXT_texture_filter_anisotropic");if(o.type===Tg&&!1===t.has("OES_texture_float_linear"))return;if(!1===a&&o.type===Ig&&!1===t.has("OES_texture_half_float_linear"))return;(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function D(t,n){let r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",E));const i=n.source;let o=g.get(i);void 0===o&&(o={},g.set(i,o));const a=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(n);if(a!==t.__cacheKey){void 0===o[a]&&(o[a]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,r=!0),o[a].usedTimes++;const i=o[t.__cacheKey];void 0!==i&&(o[t.__cacheKey].usedTimes--,0===i.usedTimes&&I(n)),t.__cacheKey=a,t.__webglTexture=o[a].texture}return r}function k(t,r,i){let s=3553;r.isDataArrayTexture&&(s=35866),r.isData3DTexture&&(s=32879);const l=D(t,r),c=r.source;if(n.activeTexture(33984+i),n.bindTexture(s,t.__webglTexture),c.version!==c.__currentVersion||!0===l){e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);const t=function(e){return!a&&(e.wrapS!==cg||e.wrapT!==cg||e.minFilter!==dg&&e.minFilter!==gg)}(r)&&!1===_(r.image);let i=S(r.image,t,!1,u);i=j(r,i);const d=_(i)||a,h=o.convert(r.format,r.encoding);let p,m=o.convert(r.type),f=w(r.internalFormat,h,m,r.encoding,r.isVideoTexture);O(s,r,d);const g=r.mipmaps,v=a&&!0!==r.isVideoTexture,y=void 0===c.__currentVersion||!0===l,A=C(r,i,d);if(r.isDepthTexture)f=6402,a?f=r.type===Tg?36012:r.type===Eg?33190:r.type===Pg?35056:33189:r.type===Tg&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Bg&&6402===f&&r.type!==Cg&&r.type!==Eg&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Eg,m=o.convert(r.type)),r.format===zg&&6402===f&&(f=34041,r.type!==Pg&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Pg,m=o.convert(r.type))),y&&(v?n.texStorage2D(3553,1,f,i.width,i.height):n.texImage2D(3553,0,f,i.width,i.height,0,h,m,null));else if(r.isDataTexture)if(g.length>0&&d){v&&y&&n.texStorage2D(3553,A,f,g[0].width,g[0].height);for(let e=0,t=g.length;e<t;e++)p=g[e],v?n.texSubImage2D(3553,e,0,0,p.width,p.height,h,m,p.data):n.texImage2D(3553,e,f,p.width,p.height,0,h,m,p.data);r.generateMipmaps=!1}else v?(y&&n.texStorage2D(3553,A,f,i.width,i.height),n.texSubImage2D(3553,0,0,0,i.width,i.height,h,m,i.data)):n.texImage2D(3553,0,f,i.width,i.height,0,h,m,i.data);else if(r.isCompressedTexture){v&&y&&n.texStorage2D(3553,A,f,g[0].width,g[0].height);for(let e=0,t=g.length;e<t;e++)p=g[e],r.format!==Dg?null!==h?v?n.compressedTexSubImage2D(3553,e,0,0,p.width,p.height,h,p.data):n.compressedTexImage2D(3553,e,f,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):v?n.texSubImage2D(3553,e,0,0,p.width,p.height,h,m,p.data):n.texImage2D(3553,e,f,p.width,p.height,0,h,m,p.data)}else if(r.isDataArrayTexture)v?(y&&n.texStorage3D(35866,A,f,i.width,i.height,i.depth),n.texSubImage3D(35866,0,0,0,0,i.width,i.height,i.depth,h,m,i.data)):n.texImage3D(35866,0,f,i.width,i.height,i.depth,0,h,m,i.data);else if(r.isData3DTexture)v?(y&&n.texStorage3D(32879,A,f,i.width,i.height,i.depth),n.texSubImage3D(32879,0,0,0,0,i.width,i.height,i.depth,h,m,i.data)):n.texImage3D(32879,0,f,i.width,i.height,i.depth,0,h,m,i.data);else if(r.isFramebufferTexture){if(y)if(v)n.texStorage2D(3553,A,f,i.width,i.height);else{let e=i.width,t=i.height;for(let r=0;r<A;r++)n.texImage2D(3553,r,f,e,t,0,h,m,null),e>>=1,t>>=1}}else if(g.length>0&&d){v&&y&&n.texStorage2D(3553,A,f,g[0].width,g[0].height);for(let e=0,t=g.length;e<t;e++)p=g[e],v?n.texSubImage2D(3553,e,0,0,h,m,p):n.texImage2D(3553,e,f,h,m,p);r.generateMipmaps=!1}else v?(y&&n.texStorage2D(3553,A,f,i.width,i.height),n.texSubImage2D(3553,0,0,0,h,m,i)):n.texImage2D(3553,0,f,h,m,i);b(r,d)&&x(s),c.__currentVersion=c.version,r.onUpdate&&r.onUpdate(r)}t.__version=r.version}function L(t,i,s,a,l){const c=o.convert(s.format,s.encoding),u=o.convert(s.type),d=w(s.internalFormat,c,u,s.encoding);r.get(i).__hasExternalTextures||(32879===l||35866===l?n.texImage3D(l,0,d,i.width,i.height,i.depth,0,c,u,null):n.texImage2D(l,0,d,i.width,i.height,0,c,u,null)),n.bindFramebuffer(36160,t),U(i)?h.framebufferTexture2DMultisampleEXT(36160,a,l,r.get(s).__webglTexture,0,F(i)):e.framebufferTexture2D(36160,a,l,r.get(s).__webglTexture,0),n.bindFramebuffer(36160,null)}function B(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){let i=33189;if(r||U(n)){const t=n.depthTexture;t&&t.isDepthTexture&&(t.type===Tg?i=36012:t.type===Eg&&(i=33190));const r=F(n);U(n)?h.renderbufferStorageMultisampleEXT(36161,r,i,n.width,n.height):e.renderbufferStorageMultisample(36161,r,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){const i=F(n);r&&!1===U(n)?e.renderbufferStorageMultisample(36161,i,35056,n.width,n.height):U(n)?h.renderbufferStorageMultisampleEXT(36161,i,35056,n.width,n.height):e.renderbufferStorage(36161,34041,n.width,n.height),e.framebufferRenderbuffer(36160,33306,36161,t)}else{const t=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let i=0;i<t.length;i++){const s=t[i],a=o.convert(s.format,s.encoding),l=o.convert(s.type),c=w(s.internalFormat,a,l,s.encoding),u=F(n);r&&!1===U(n)?e.renderbufferStorageMultisample(36161,u,c,n.width,n.height):U(n)?h.renderbufferStorageMultisampleEXT(36161,u,c,n.width,n.height):e.renderbufferStorage(36161,c,n.width,n.height)}}e.bindRenderbuffer(36161,null)}function z(t){const i=r.get(t),o=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(o)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),R(i.depthTexture,0);const o=r.get(i.depthTexture).__webglTexture,s=F(i);if(i.depthTexture.format===Bg)U(i)?h.framebufferTexture2DMultisampleEXT(36160,36096,3553,o,0,s):e.framebufferTexture2D(36160,36096,3553,o,0);else{if(i.depthTexture.format!==zg)throw new Error("Unknown depthTexture format");U(i)?h.framebufferTexture2DMultisampleEXT(36160,33306,3553,o,0,s):e.framebufferTexture2D(36160,33306,3553,o,0)}}(i.__webglFramebuffer,t)}else if(o){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)n.bindFramebuffer(36160,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]=e.createRenderbuffer(),B(i.__webglDepthbuffer[r],t,!1)}else n.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),B(i.__webglDepthbuffer,t,!1);n.bindFramebuffer(36160,null)}function F(e){return Math.min(d,e.samples)}function U(e){const n=r.get(e);return a&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(e,n){const r=e.encoding,i=e.format,o=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===hy||r!==Rv&&(r===Pv?!1===a?!0===t.has("EXT_sRGB")&&i===Dg?(e.format=hy,e.minFilter=gg,e.generateMipmaps=!1):n=qy.sRGBToLinear(n):i===Dg&&o===bg||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",r)),n}this.allocateTextureUnit=function(){const e=M;return e>=l&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l),M+=1,e},this.resetTextureUnits=function(){M=0},this.setTexture2D=R,this.setTexture2DArray=function(e,t){const i=r.get(e);e.version>0&&i.__version!==e.version?k(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){const i=r.get(e);e.version>0&&i.__version!==e.version?k(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=function(t,i){const s=r.get(t);t.version>0&&s.__version!==t.version?function(t,r,i){if(6!==r.image.length)return;const s=D(t,r),l=r.source;if(n.activeTexture(33984+i),n.bindTexture(34067,t.__webglTexture),l.version!==l.__currentVersion||!0===s){e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);const t=r.isCompressedTexture||r.image[0].isCompressedTexture,i=r.image[0]&&r.image[0].isDataTexture,u=[];for(let e=0;e<6;e++)u[e]=t||i?i?r.image[e].image:r.image[e]:S(r.image[e],!1,!0,c),u[e]=j(r,u[e]);const d=u[0],h=_(d)||a,p=o.convert(r.format,r.encoding),m=o.convert(r.type),f=w(r.internalFormat,p,m,r.encoding),g=a&&!0!==r.isVideoTexture,v=void 0===l.__currentVersion||!0===s;let y,A=C(r,d,h);if(O(34067,r,h),t){g&&v&&n.texStorage2D(34067,A,f,d.width,d.height);for(let e=0;e<6;e++){y=u[e].mipmaps;for(let t=0;t<y.length;t++){const i=y[t];r.format!==Dg?null!==p?g?n.compressedTexSubImage2D(34069+e,t,0,0,i.width,i.height,p,i.data):n.compressedTexImage2D(34069+e,t,f,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):g?n.texSubImage2D(34069+e,t,0,0,i.width,i.height,p,m,i.data):n.texImage2D(34069+e,t,f,i.width,i.height,0,p,m,i.data)}}}else{y=r.mipmaps,g&&v&&(y.length>0&&A++,n.texStorage2D(34067,A,f,u[0].width,u[0].height));for(let e=0;e<6;e++)if(i){g?n.texSubImage2D(34069+e,0,0,0,u[e].width,u[e].height,p,m,u[e].data):n.texImage2D(34069+e,0,f,u[e].width,u[e].height,0,p,m,u[e].data);for(let t=0;t<y.length;t++){const r=y[t].image[e].image;g?n.texSubImage2D(34069+e,t+1,0,0,r.width,r.height,p,m,r.data):n.texImage2D(34069+e,t+1,f,r.width,r.height,0,p,m,r.data)}}else{g?n.texSubImage2D(34069+e,0,0,0,p,m,u[e]):n.texImage2D(34069+e,0,f,p,m,u[e]);for(let t=0;t<y.length;t++){const r=y[t];g?n.texSubImage2D(34069+e,t+1,0,0,p,m,r.image[e]):n.texImage2D(34069+e,t+1,f,p,m,r.image[e])}}}b(r,h)&&x(34067),l.__currentVersion=l.version,r.onUpdate&&r.onUpdate(r)}t.__version=r.version}(s,t,i):(n.activeTexture(33984+i),n.bindTexture(34067,s.__webglTexture))},this.rebindTextures=function(e,t,n){const i=r.get(e);void 0!==t&&L(i.__webglFramebuffer,e,e.texture,36064,3553),void 0!==n&&z(e)},this.setupRenderTarget=function(t){const l=t.texture,c=r.get(t),u=r.get(l);t.addEventListener("dispose",T),!0!==t.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=e.createTexture()),u.__version=l.version,s.memory.textures++);const d=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultipleRenderTargets,p=_(t)||a;if(d){c.__webglFramebuffer=[];for(let t=0;t<6;t++)c.__webglFramebuffer[t]=e.createFramebuffer()}else{if(c.__webglFramebuffer=e.createFramebuffer(),h)if(i.drawBuffers){const n=t.texture;for(let t=0,i=n.length;t<i;t++){const i=r.get(n[t]);void 0===i.__webglTexture&&(i.__webglTexture=e.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(a&&t.samples>0&&!1===U(t)){const r=h?l:[l];c.__webglMultisampledFramebuffer=e.createFramebuffer(),c.__webglColorRenderbuffer=[],n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer);for(let n=0;n<r.length;n++){const i=r[n];c.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(36161,c.__webglColorRenderbuffer[n]);const s=o.convert(i.format,i.encoding),a=o.convert(i.type),l=w(i.internalFormat,s,a,i.encoding),u=F(t);e.renderbufferStorageMultisample(36161,u,l,t.width,t.height),e.framebufferRenderbuffer(36160,36064+n,36161,c.__webglColorRenderbuffer[n])}e.bindRenderbuffer(36161,null),t.depthBuffer&&(c.__webglDepthRenderbuffer=e.createRenderbuffer(),B(c.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(36160,null)}}if(d){n.bindTexture(34067,u.__webglTexture),O(34067,l,p);for(let e=0;e<6;e++)L(c.__webglFramebuffer[e],t,l,36064,34069+e);b(l,p)&&x(34067),n.unbindTexture()}else if(h){const e=t.texture;for(let i=0,o=e.length;i<o;i++){const o=e[i],s=r.get(o);n.bindTexture(3553,s.__webglTexture),O(3553,o,p),L(c.__webglFramebuffer,t,o,36064+i,3553),b(o,p)&&x(3553)}n.unbindTexture()}else{let e=3553;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(a?e=t.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(e,u.__webglTexture),O(e,l,p),L(c.__webglFramebuffer,t,l,36064,e),b(l,p)&&x(e),n.unbindTexture()}t.depthBuffer&&z(t)},this.updateRenderTargetMipmap=function(e){const t=_(e)||a,i=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture];for(let o=0,s=i.length;o<s;o++){const s=i[o];if(b(s,t)){const t=e.isWebGLCubeRenderTarget?34067:3553,i=r.get(s).__webglTexture;n.bindTexture(t,i),x(t),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(a&&t.samples>0&&!1===U(t)){const i=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],o=t.width,s=t.height;let a=16384;const l=[],c=t.stencilBuffer?33306:36096,u=r.get(t),d=!0===t.isWebGLMultipleRenderTargets;if(d)for(let t=0;t<i.length;t++)n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+t,36161,null),n.bindFramebuffer(36160,u.__webglFramebuffer),e.framebufferTexture2D(36009,36064+t,3553,null,0);n.bindFramebuffer(36008,u.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,u.__webglFramebuffer);for(let n=0;n<i.length;n++){l.push(36064+n),t.depthBuffer&&l.push(c);const h=void 0!==u.__ignoreDepthValues&&u.__ignoreDepthValues;if(!1===h&&(t.depthBuffer&&(a|=256),t.stencilBuffer&&(a|=1024)),d&&e.framebufferRenderbuffer(36008,36064,36161,u.__webglColorRenderbuffer[n]),!0===h&&(e.invalidateFramebuffer(36008,[c]),e.invalidateFramebuffer(36009,[c])),d){const t=r.get(i[n]).__webglTexture;e.framebufferTexture2D(36009,36064,3553,t,0)}e.blitFramebuffer(0,0,o,s,0,0,o,s,a,9728),p&&e.invalidateFramebuffer(36008,l)}if(n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,null),d)for(let t=0;t<i.length;t++){n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+t,36161,u.__webglColorRenderbuffer[t]);const o=r.get(i[t]).__webglTexture;n.bindFramebuffer(36160,u.__webglFramebuffer),e.framebufferTexture2D(36009,36064+t,3553,o,0)}n.bindFramebuffer(36009,u.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=z,this.setupFrameBufferTexture=L,this.useMultisampledRTT=U}function Kw(e,t,n){const r=n.isWebGL2;return{convert:function(n,i=null){let o;if(n===bg)return 5121;if(n===Mg)return 32819;if(n===Rg)return 32820;if(n===xg)return 5120;if(n===wg)return 5122;if(n===Cg)return 5123;if(n===Ag)return 5124;if(n===Eg)return 5125;if(n===Tg)return 5126;if(n===Ig)return r?5131:(o=t.get("OES_texture_half_float"),null!==o?o.HALF_FLOAT_OES:null);if(n===Ng)return 6406;if(n===Dg)return 6408;if(n===kg)return 6409;if(n===Lg)return 6410;if(n===Bg)return 6402;if(n===zg)return 34041;if(n===Fg)return 6403;if(n===Og)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===hy)return o=t.get("EXT_sRGB"),null!==o?o.SRGB_ALPHA_EXT:null;if(n===Ug)return 36244;if(n===jg)return 33319;if(n===Gg)return 33320;if(n===Hg)return 36249;if(n===Vg||n===Wg||n===qg||n===Jg)if(i===Pv){if(o=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===o)return null;if(n===Vg)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Wg)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===qg)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Jg)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(o=t.get("WEBGL_compressed_texture_s3tc"),null===o)return null;if(n===Vg)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Wg)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===qg)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Jg)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Kg||n===Yg||n===$g||n===Xg){if(o=t.get("WEBGL_compressed_texture_pvrtc"),null===o)return null;if(n===Kg)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Yg)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===$g)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Xg)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===Qg)return o=t.get("WEBGL_compressed_texture_etc1"),null!==o?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===Zg||n===ev){if(o=t.get("WEBGL_compressed_texture_etc"),null===o)return null;if(n===Zg)return i===Pv?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===ev)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}if(n===tv||n===nv||n===rv||n===iv||n===ov||n===sv||n===av||n===lv||n===cv||n===uv||n===dv||n===hv||n===pv||n===mv){if(o=t.get("WEBGL_compressed_texture_astc"),null===o)return null;if(n===tv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===nv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===rv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===iv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ov)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===sv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===av)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===lv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===cv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===uv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===dv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===hv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===pv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===mv)return i===Pv?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===fv){if(o=t.get("EXT_texture_compression_bptc"),null===o)return null;if(n===fv)return i===Pv?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===Pg?r?34042:(o=t.get("WEBGL_depth_texture"),null!==o?o.UNSIGNED_INT_24_8_WEBGL:null):void 0!==e[n]?e[n]:null}}}class Yw extends mb{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class $w extends a_{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Xw={type:"move"};class Qw{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new $w,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new $w,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new oS,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new oS),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new $w,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new oS,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new oS),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,o=null;const s=this._targetRay,a=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){o=!0;for(const r of e.hand.values()){const e=t.getJointPose(r,n);if(void 0===l.joints[r.jointName]){const e=new $w;e.matrixAutoUpdate=!1,e.visible=!1,l.joints[r.jointName]=e,l.add(e)}const i=l.joints[r.jointName];null!==e&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=e.radius),i.visible=null!==e}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],s=r.position.distanceTo(i.position),a=.02,c=.005;l.inputState.pinching&&s>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==a&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1));null!==s&&(r=t.getPose(e.targetRaySpace,n),null===r&&null!==i&&(r=i),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(Xw)))}return null!==s&&(s.visible=null!==r),null!==a&&(a.visible=null!==i),null!==l&&(l.visible=null!==o),this}}class Zw extends $y{constructor(e,t,n,r,i,o,s,a,l,c){if((c=void 0!==c?c:Bg)!==Bg&&c!==zg)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Bg&&(n=Eg),void 0===n&&c===zg&&(n=Pg),super(null,r,i,o,s,a,c,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:dg,this.minFilter=void 0!==a?a:dg,this.flipY=!1,this.generateMipmaps=!1}}class eC extends py{constructor(e,t){super();const n=this;let r=null,i=1,o=null,s="local-floor",a=null,l=null,c=null,u=null,d=null,h=null;const p=t.getContextAttributes();let m=null,f=null;const g=[],v=[],y=new mb;y.layers.enable(1),y.viewport=new Xy;const S=new mb;S.layers.enable(2),S.viewport=new Xy;const _=[y,S],b=new Yw;b.layers.enable(1),b.layers.enable(2);let x=null,w=null;function C(e){const t=v.indexOf(e.inputSource);if(-1===t)return;const n=g[t];void 0!==n&&n.dispatchEvent({type:e.type,data:e.inputSource})}function A(){r.removeEventListener("select",C),r.removeEventListener("selectstart",C),r.removeEventListener("selectend",C),r.removeEventListener("squeeze",C),r.removeEventListener("squeezestart",C),r.removeEventListener("squeezeend",C),r.removeEventListener("end",A),r.removeEventListener("inputsourceschange",E);for(let e=0;e<g.length;e++){const t=v[e];null!==t&&(v[e]=null,g[e].disconnect(t))}x=null,w=null,e.setRenderTarget(m),d=null,u=null,c=null,r=null,f=null,P.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function E(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],r=v.indexOf(n);r>=0&&(v[r]=null,g[r].dispatchEvent({type:"disconnected",data:n}))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let r=v.indexOf(n);if(-1===r){for(let e=0;e<g.length;e++){if(e>=v.length){v.push(n),r=e;break}if(null===v[e]){v[e]=n,r=e;break}}if(-1===r)break}const i=g[r];i&&i.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=g[e];return void 0===t&&(t=new Qw,g[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=g[e];return void 0===t&&(t=new Qw,g[e]=t),t.getGripSpace()},this.getHand=function(e){let t=g[e];return void 0===t&&(t=new Qw,g[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){i=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a||o},this.setReferenceSpace=function(e){a=e},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return c},this.getFrame=function(){return h},this.getSession=function(){return r},this.setSession=async function(l){if(r=l,null!==r){if(m=e.getRenderTarget(),r.addEventListener("select",C),r.addEventListener("selectstart",C),r.addEventListener("selectend",C),r.addEventListener("squeeze",C),r.addEventListener("squeezestart",C),r.addEventListener("squeezeend",C),r.addEventListener("end",A),r.addEventListener("inputsourceschange",E),!0!==p.xrCompatible&&await t.makeXRCompatible(),void 0===r.renderState.layers||!1===e.capabilities.isWebGL2){const n={antialias:void 0!==r.renderState.layers||p.antialias,alpha:p.alpha,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:i};d=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:d}),f=new Qy(d.framebufferWidth,d.framebufferHeight,{format:Dg,type:bg,encoding:e.outputEncoding,stencilBuffer:p.stencil})}else{let n=null,o=null,s=null;p.depth&&(s=p.stencil?35056:33190,n=p.stencil?zg:Bg,o=p.stencil?Pg:Eg);const a={colorFormat:32856,depthFormat:s,scaleFactor:i};c=new XRWebGLBinding(r,t),u=c.createProjectionLayer(a),r.updateRenderState({layers:[u]}),f=new Qy(u.textureWidth,u.textureHeight,{format:Dg,type:bg,depthTexture:new Zw(u.textureWidth,u.textureHeight,o,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:p.stencil,encoding:e.outputEncoding,samples:p.antialias?4:0});e.properties.get(f).__ignoreDepthValues=u.ignoreDepthValues}f.isXRRenderTarget=!0,this.setFoveation(1),a=null,o=await r.requestReferenceSpace(s),P.setContext(r),P.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const T=new oS,I=new oS;function M(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===r)return;b.near=S.near=y.near=e.near,b.far=S.far=y.far=e.far,x===b.near&&w===b.far||(r.updateRenderState({depthNear:b.near,depthFar:b.far}),x=b.near,w=b.far);const t=e.parent,n=b.cameras;M(b,t);for(let e=0;e<n.length;e++)M(n[e],t);b.matrixWorld.decompose(b.position,b.quaternion,b.scale),e.matrix.copy(b.matrix),e.matrix.decompose(e.position,e.quaternion,e.scale);const i=e.children;for(let e=0,t=i.length;e<t;e++)i[e].updateMatrixWorld(!0);2===n.length?function(e,t,n){T.setFromMatrixPosition(t.matrixWorld),I.setFromMatrixPosition(n.matrixWorld);const r=T.distanceTo(I),i=t.projectionMatrix.elements,o=n.projectionMatrix.elements,s=i[14]/(i[10]-1),a=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(o[8]+1)/o[0],h=s*u,p=s*d,m=r/(-u+d),f=m*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();const g=s+m,v=a+m,y=h-f,S=p+(r-f),_=l*a/v*g,b=c*a/v*g;e.projectionMatrix.makePerspective(y,S,_,b,g,v)}(b,y,S):b.projectionMatrix.copy(y.projectionMatrix)},this.getCamera=function(){return b},this.getFoveation=function(){return null!==u?u.fixedFoveation:null!==d?d.fixedFoveation:void 0},this.setFoveation=function(e){null!==u&&(u.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)};let R=null;const P=new Eb;P.setAnimationLoop((function(t,n){if(l=n.getViewerPose(a||o),h=n,null!==l){const t=l.views;null!==d&&(e.setRenderTargetFramebuffer(f,d.framebuffer),e.setRenderTarget(f));let n=!1;t.length!==b.cameras.length&&(b.cameras.length=0,n=!0);for(let r=0;r<t.length;r++){const i=t[r];let o=null;if(null!==d)o=d.getViewport(i);else{const t=c.getViewSubImage(u,i);o=t.viewport,0===r&&(e.setRenderTargetTextures(f,t.colorTexture,u.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(f))}let s=_[r];void 0===s&&(s=new mb,s.layers.enable(r),s.viewport=new Xy,_[r]=s),s.matrix.fromArray(i.transform.matrix),s.projectionMatrix.fromArray(i.projectionMatrix),s.viewport.set(o.x,o.y,o.width,o.height),0===r&&b.matrix.copy(s.matrix),!0===n&&b.cameras.push(s)}}for(let e=0;e<g.length;e++){const t=v[e],r=g[e];null!==t&&void 0!==r&&r.update(t,n,a||o)}R&&R(t,n),h=null})),this.setAnimationLoop=function(e){R=e},this.dispose=function(){}}}function tC(e,t){function n(n,r){n.opacity.value=r.opacity,r.color&&n.diffuse.value.copy(r.color),r.emissive&&n.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(n.map.value=r.map),r.alphaMap&&(n.alphaMap.value=r.alphaMap),r.bumpMap&&(n.bumpMap.value=r.bumpMap,n.bumpScale.value=r.bumpScale,r.side===ff&&(n.bumpScale.value*=-1)),r.displacementMap&&(n.displacementMap.value=r.displacementMap,n.displacementScale.value=r.displacementScale,n.displacementBias.value=r.displacementBias),r.emissiveMap&&(n.emissiveMap.value=r.emissiveMap),r.normalMap&&(n.normalMap.value=r.normalMap,n.normalScale.value.copy(r.normalScale),r.side===ff&&n.normalScale.value.negate()),r.specularMap&&(n.specularMap.value=r.specularMap),r.alphaTest>0&&(n.alphaTest.value=r.alphaTest);const i=t.get(r).envMap;if(i&&(n.envMap.value=i,n.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;const t=!0!==e.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*t}let o,s;r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity),r.map?o=r.map:r.specularMap?o=r.specularMap:r.displacementMap?o=r.displacementMap:r.normalMap?o=r.normalMap:r.bumpMap?o=r.bumpMap:r.roughnessMap?o=r.roughnessMap:r.metalnessMap?o=r.metalnessMap:r.alphaMap?o=r.alphaMap:r.emissiveMap?o=r.emissiveMap:r.clearcoatMap?o=r.clearcoatMap:r.clearcoatNormalMap?o=r.clearcoatNormalMap:r.clearcoatRoughnessMap?o=r.clearcoatRoughnessMap:r.iridescenceMap?o=r.iridescenceMap:r.iridescenceThicknessMap?o=r.iridescenceThicknessMap:r.specularIntensityMap?o=r.specularIntensityMap:r.specularColorMap?o=r.specularColorMap:r.transmissionMap?o=r.transmissionMap:r.thicknessMap?o=r.thicknessMap:r.sheenColorMap?o=r.sheenColorMap:r.sheenRoughnessMap&&(o=r.sheenRoughnessMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),n.uvTransform.value.copy(o.matrix)),r.aoMap?s=r.aoMap:r.lightMap&&(s=r.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),n.uv2Transform.value.copy(s.matrix))}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,r,i,o,s){r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(e,r):r.isMeshToonMaterial?(n(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(n(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(n(e,r),function(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap);n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap);const r=t.get(n).envMap;r&&(e.envMapIntensity.value=n.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,n){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===ff&&e.clearcoatNormalScale.value.negate()));t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=n.texture,e.transmissionSamplerSize.value.set(n.width,n.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap);t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,r,s)):r.isMeshMatcapMaterial?(n(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?n(e,r):r.isMeshDistanceMaterial?(n(e,r),function(e,t){e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?n(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,n,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*r,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);t.alphaTest>0&&(e.alphaTest.value=t.alphaTest);let i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,r,i,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);t.alphaTest>0&&(e.alphaTest.value=t.alphaTest);let n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function nC(e,t,n,r){let i={},o={},s=[];const a=n.isWebGL2?e.getParameter(35375):0;function l(e,t,n){const r=e.value;if(void 0===n[t])return n[t]="number"==typeof r?r:r.clone(),!0;if("number"==typeof r){if(n[t]!==r)return n[t]=r,!0}else{const e=n[t];if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const t=e.value,n={boundary:0,storage:0};return"number"==typeof t?(n.boundary=4,n.storage=4):t.isVector2?(n.boundary=8,n.storage=8):t.isVector3||t.isColor?(n.boundary=16,n.storage=12):t.isVector4?(n.boundary=16,n.storage=16):t.isMatrix3?(n.boundary=48,n.storage=48):t.isMatrix4?(n.boundary=64,n.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),n}function u(t){const n=t.target;n.removeEventListener("dispose",u);const r=s.indexOf(n.__bindingPointIndex);s.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete o[n.id]}return{bind:function(e,t){const n=t.program;r.uniformBlockBinding(e,n)},update:function(n,d){let h=i[n.id];void 0===h&&(!function(e){const t=e.uniforms;let n=0;const r=16;let i=0;for(let e=0,o=t.length;e<o;e++){const o=t[e],s=c(o);if(o.__data=new Float32Array(s.storage/Float32Array.BYTES_PER_ELEMENT),o.__offset=n,e>0){i=n%r;0!==i&&r-i-s.boundary<0&&(n+=r-i,o.__offset=n)}n+=s.storage}i=n%r,i>0&&(n+=r-i);e.__size=n,e.__cache={}}(n),h=function(t){const n=function(){for(let e=0;e<a;e++)if(-1===s.indexOf(e))return s.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;const r=e.createBuffer(),i=t.__size,o=t.usage;return e.bindBuffer(35345,r),e.bufferData(35345,i,o),e.bindBuffer(35345,null),e.bindBufferBase(35345,n,r),r}(n),i[n.id]=h,n.addEventListener("dispose",u));const p=d.program;r.updateUBOMapping(n,p);const m=t.render.frame;o[n.id]!==m&&(!function(t){const n=i[t.id],r=t.uniforms,o=t.__cache;e.bindBuffer(35345,n);for(let t=0,n=r.length;t<n;t++){const n=r[t];if(!0===l(n,t,o)){const t=n.value,r=n.__offset;"number"==typeof t?(n.__data[0]=t,e.bufferSubData(35345,r,n.__data)):(n.value.isMatrix3?(n.__data[0]=n.value.elements[0],n.__data[1]=n.value.elements[1],n.__data[2]=n.value.elements[2],n.__data[3]=n.value.elements[0],n.__data[4]=n.value.elements[3],n.__data[5]=n.value.elements[4],n.__data[6]=n.value.elements[5],n.__data[7]=n.value.elements[0],n.__data[8]=n.value.elements[6],n.__data[9]=n.value.elements[7],n.__data[10]=n.value.elements[8],n.__data[11]=n.value.elements[0]):t.toArray(n.__data),e.bufferSubData(35345,r,n.__data))}}e.bindBuffer(35345,null)}(n),o[n.id]=m)},dispose:function(){for(const t in i)e.deleteBuffer(i[t]);s=[],i={},o={}}}}function rC(e={}){this.isWebGLRenderer=!0;const t=void 0!==e.canvas?e.canvas:function(){const e=Oy("canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,r=void 0===e.depth||e.depth,i=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,a=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,l=void 0!==e.powerPreference?e.powerPreference:"default",c=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let u;u=null!==n?n.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;let d=null,h=null;const p=[],m=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Rv,this.physicallyCorrectLights=!1,this.toneMapping=$f,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const f=this;let g=!1,v=0,y=0,S=null,_=-1,b=null;const x=new Xy,w=new Xy;let C=null,A=t.width,E=t.height,T=1,I=null,M=null;const R=new Xy(0,0,A,E),P=new Xy(0,0,A,E);let N=!1;const O=new Ab;let D=!1,k=!1,L=null;const B=new LS,z=new Iy,F=new oS,U={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===S?T:1}let G,H,V,W,q,J,K,Y,$,X,Q,Z,ee,te,ne,re,ie,oe,se,ae,le,ce,ue,de,he=n;function pe(e,n){for(let r=0;r<e.length;r++){const i=e[r],o=t.getContext(i,n);if(null!==o)return o}return null}try{const e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:a,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${nf}`),t.addEventListener("webglcontextlost",ge,!1),t.addEventListener("webglcontextrestored",ve,!1),t.addEventListener("webglcontextcreationerror",ye,!1),null===he){const t=["webgl2","webgl","experimental-webgl"];if(!0===f.isWebGL1Renderer&&t.shift(),he=pe(t,e),null===he)throw pe(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===he.getShaderPrecisionFormat&&(he.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function me(){G=new ex(he),H=new kb(he,G,e),G.init(H),ce=new Kw(he,G,H),V=new qw(he,G,H),W=new rx,q=new Nw,J=new Jw(he,G,V,q,H,ce,W),K=new Bb(f),Y=new Zb(f),$=new Tb(he,H),ue=new Ob(he,G,$,H),X=new tx(he,$,W,ue),Q=new ax(he,X,$,W),se=new sx(he,H,J),re=new Lb(q),Z=new Pw(f,K,Y,G,H,ue,re),ee=new tC(f,q),te=new Lw,ne=new Gw(G,H),oe=new Nb(f,K,V,Q,u,s),ie=new Ww(f,Q,H),de=new nC(he,W,H,V),ae=new Db(he,G,W,H),le=new nx(he,G,W,H),W.programs=Z.programs,f.capabilities=H,f.extensions=G,f.properties=q,f.renderLists=te,f.shadowMap=ie,f.state=V,f.info=W}me();const fe=new eC(f,he);function ge(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function ve(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;const e=W.autoReset,t=ie.enabled,n=ie.autoUpdate,r=ie.needsUpdate,i=ie.type;me(),W.autoReset=e,ie.enabled=t,ie.autoUpdate=n,ie.needsUpdate=r,ie.type=i}function ye(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Se(e){const t=e.target;t.removeEventListener("dispose",Se),function(e){(function(e){const t=q.get(e).programs;void 0!==t&&(t.forEach((function(e){Z.releaseProgram(e)})),e.isShaderMaterial&&Z.releaseShaderCache(e))})(e),q.remove(e)}(t)}this.xr=fe,this.getContext=function(){return he},this.getContextAttributes=function(){return he.getContextAttributes()},this.forceContextLoss=function(){const e=G.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=G.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return T},this.setPixelRatio=function(e){void 0!==e&&(T=e,this.setSize(A,E,!1))},this.getSize=function(e){return e.set(A,E)},this.setSize=function(e,n,r){fe.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(A=e,E=n,t.width=Math.floor(e*T),t.height=Math.floor(n*T),!1!==r&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(A*T,E*T).floor()},this.setDrawingBufferSize=function(e,n,r){A=e,E=n,T=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(x)},this.getViewport=function(e){return e.copy(R)},this.setViewport=function(e,t,n,r){e.isVector4?R.set(e.x,e.y,e.z,e.w):R.set(e,t,n,r),V.viewport(x.copy(R).multiplyScalar(T).floor())},this.getScissor=function(e){return e.copy(P)},this.setScissor=function(e,t,n,r){e.isVector4?P.set(e.x,e.y,e.z,e.w):P.set(e,t,n,r),V.scissor(w.copy(P).multiplyScalar(T).floor())},this.getScissorTest=function(){return N},this.setScissorTest=function(e){V.setScissorTest(N=e)},this.setOpaqueSort=function(e){I=e},this.setTransparentSort=function(e){M=e},this.getClearColor=function(e){return e.copy(oe.getClearColor())},this.setClearColor=function(){oe.setClearColor.apply(oe,arguments)},this.getClearAlpha=function(){return oe.getClearAlpha()},this.setClearAlpha=function(){oe.setClearAlpha.apply(oe,arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;e&&(r|=16384),t&&(r|=256),n&&(r|=1024),he.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ge,!1),t.removeEventListener("webglcontextrestored",ve,!1),t.removeEventListener("webglcontextcreationerror",ye,!1),te.dispose(),ne.dispose(),q.dispose(),K.dispose(),Y.dispose(),Q.dispose(),ue.dispose(),de.dispose(),Z.dispose(),fe.dispose(),fe.removeEventListener("sessionstart",be),fe.removeEventListener("sessionend",xe),L&&(L.dispose(),L=null),we.stop()},this.renderBufferDirect=function(e,t,n,r,i,o){null===t&&(t=U);const s=i.isMesh&&i.matrixWorld.determinant()<0,a=function(e,t,n,r,i){!0!==t.isScene&&(t=U);J.resetTextureUnits();const o=t.fog,s=r.isMeshStandardMaterial?t.environment:null,a=null===S?f.outputEncoding:!0===S.isXRRenderTarget?S.texture.encoding:Rv,l=(r.isMeshStandardMaterial?Y:K).get(r.envMap||s),c=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,u=!!r.normalMap&&!!n.attributes.tangent,d=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,g=r.toneMapped?f.toneMapping:$f,v=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,y=void 0!==v?v.length:0,x=q.get(r),w=h.state.lights;if(!0===D&&(!0===k||e!==b)){const t=e===b&&r.id===_;re.setState(r,e,t)}let C=!1;r.version===x.__version?x.needsLights&&x.lightsStateVersion!==w.state.version||x.outputEncoding!==a||i.isInstancedMesh&&!1===x.instancing?C=!0:i.isInstancedMesh||!0!==x.instancing?i.isSkinnedMesh&&!1===x.skinning?C=!0:i.isSkinnedMesh||!0!==x.skinning?x.envMap!==l||!0===r.fog&&x.fog!==o?C=!0:void 0===x.numClippingPlanes||x.numClippingPlanes===re.numPlanes&&x.numIntersection===re.numIntersection?(x.vertexAlphas!==c||x.vertexTangents!==u||x.morphTargets!==d||x.morphNormals!==p||x.morphColors!==m||x.toneMapping!==g||!0===H.isWebGL2&&x.morphTargetsCount!==y)&&(C=!0):C=!0:C=!0:C=!0:(C=!0,x.__version=r.version);let A=x.currentProgram;!0===C&&(A=Ie(r,t,i));let I=!1,M=!1,R=!1;const P=A.getUniforms(),N=x.uniforms;V.useProgram(A.program)&&(I=!0,M=!0,R=!0);r.id!==_&&(_=r.id,M=!0);if(I||b!==e){if(P.setValue(he,"projectionMatrix",e.projectionMatrix),H.logarithmicDepthBuffer&&P.setValue(he,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),b!==e&&(b=e,M=!0,R=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){const t=P.map.cameraPosition;void 0!==t&&t.setValue(he,F.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&P.setValue(he,"isOrthographic",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&P.setValue(he,"viewMatrix",e.matrixWorldInverse)}if(i.isSkinnedMesh){P.setOptional(he,i,"bindMatrix"),P.setOptional(he,i,"bindMatrixInverse");const e=i.skeleton;e&&(H.floatVertexTextures?(null===e.boneTexture&&e.computeBoneTexture(),P.setValue(he,"boneTexture",e.boneTexture,J),P.setValue(he,"boneTextureSize",e.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const O=n.morphAttributes;(void 0!==O.position||void 0!==O.normal||void 0!==O.color&&!0===H.isWebGL2)&&se.update(i,n,r,A);(M||x.receiveShadow!==i.receiveShadow)&&(x.receiveShadow=i.receiveShadow,P.setValue(he,"receiveShadow",i.receiveShadow));r.isMeshGouraudMaterial&&null!==r.envMap&&(N.envMap.value=l,N.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);M&&(P.setValue(he,"toneMappingExposure",f.toneMappingExposure),x.needsLights&&(z=R,(B=N).ambientLightColor.needsUpdate=z,B.lightProbe.needsUpdate=z,B.directionalLights.needsUpdate=z,B.directionalLightShadows.needsUpdate=z,B.pointLights.needsUpdate=z,B.pointLightShadows.needsUpdate=z,B.spotLights.needsUpdate=z,B.spotLightShadows.needsUpdate=z,B.rectAreaLights.needsUpdate=z,B.hemisphereLights.needsUpdate=z),o&&!0===r.fog&&ee.refreshFogUniforms(N,o),ee.refreshMaterialUniforms(N,r,T,E,L),dw.upload(he,x.uniformsList,N,J));var B,z;r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(dw.upload(he,x.uniformsList,N,J),r.uniformsNeedUpdate=!1);r.isSpriteMaterial&&P.setValue(he,"center",i.center);if(P.setValue(he,"modelViewMatrix",i.modelViewMatrix),P.setValue(he,"normalMatrix",i.normalMatrix),P.setValue(he,"modelMatrix",i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){const e=r.uniformsGroups;for(let t=0,n=e.length;t<n;t++)if(H.isWebGL2){const n=e[t];de.update(n,A),de.bind(n,A)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return A}(e,t,n,r,i);V.setMaterial(r,s);let l=n.index;const c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let u,d=1;!0===r.wireframe&&(l=X.getWireframeAttribute(n),d=2),ue.setup(i,r,a,n,l);let p=ae;null!==l&&(u=$.get(l),p=le,p.setIndex(u));const m=null!==l?l.count:c.count,g=n.drawRange.start*d,v=n.drawRange.count*d,y=null!==o?o.start*d:0,x=null!==o?o.count*d:1/0,w=Math.max(g,y),C=Math.min(m,g+v,y+x)-1,A=Math.max(0,C-w+1);if(0!==A){if(i.isMesh)!0===r.wireframe?(V.setLineWidth(r.wireframeLinewidth*j()),p.setMode(1)):p.setMode(4);else if(i.isLine){let e=r.linewidth;void 0===e&&(e=1),V.setLineWidth(e*j()),i.isLineSegments?p.setMode(1):i.isLineLoop?p.setMode(2):p.setMode(3)}else i.isPoints?p.setMode(0):i.isSprite&&p.setMode(4);if(i.isInstancedMesh)p.renderInstances(w,A,i.count);else if(n.isInstancedBufferGeometry){const e=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(w,A,e)}else p.render(w,A)}},this.compile=function(e,t){function n(e,t,n){!0===e.transparent&&e.side===gf?(e.side=ff,e.needsUpdate=!0,Ie(e,t,n),e.side=mf,e.needsUpdate=!0,Ie(e,t,n),e.side=gf):Ie(e,t,n)}h=ne.get(e),h.init(),m.push(h),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(h.pushLight(e),e.castShadow&&h.pushShadow(e))})),h.setupLights(f.physicallyCorrectLights),e.traverse((function(t){const r=t.material;if(r)if(Array.isArray(r))for(let i=0;i<r.length;i++){n(r[i],e,t)}else n(r,e,t)})),m.pop(),h=null};let _e=null;function be(){we.stop()}function xe(){we.start()}const we=new Eb;function Ce(e,t,n,r){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)h.pushLight(e),e.castShadow&&h.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||O.intersectsSprite(e)){r&&F.setFromMatrixPosition(e.matrixWorld).applyMatrix4(B);const t=Q.update(e),i=e.material;i.visible&&d.push(e,t,i,n,F.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==W.render.frame&&(e.skeleton.update(),e.skeleton.frame=W.render.frame),!e.frustumCulled||O.intersectsObject(e))){r&&F.setFromMatrixPosition(e.matrixWorld).applyMatrix4(B);const t=Q.update(e),i=e.material;if(Array.isArray(i)){const r=t.groups;for(let o=0,s=r.length;o<s;o++){const s=r[o],a=i[s.materialIndex];a&&a.visible&&d.push(e,t,a,n,F.z,s)}}else i.visible&&d.push(e,t,i,n,F.z,null)}const i=e.children;for(let e=0,o=i.length;e<o;e++)Ce(i[e],t,n,r)}function Ae(e,t,n,r){const i=e.opaque,s=e.transmissive,a=e.transparent;h.setupLightsView(n),s.length>0&&function(e,t,n){const r=H.isWebGL2;null===L&&(L=new Qy(1,1,{generateMipmaps:!0,type:G.has("EXT_color_buffer_half_float")?Ig:bg,minFilter:Sg,samples:r&&!0===o?4:0}));f.getDrawingBufferSize(z),r?L.setSize(z.x,z.y):L.setSize(Cy(z.x),Cy(z.y));const i=f.getRenderTarget();f.setRenderTarget(L),f.clear();const s=f.toneMapping;f.toneMapping=$f,Ee(e,t,n),f.toneMapping=s,J.updateMultisampleRenderTarget(L),J.updateRenderTargetMipmap(L),f.setRenderTarget(i)}(i,t,n),r&&V.viewport(x.copy(r)),i.length>0&&Ee(i,t,n),s.length>0&&Ee(s,t,n),a.length>0&&Ee(a,t,n),V.buffers.depth.setTest(!0),V.buffers.depth.setMask(!0),V.buffers.color.setMask(!0),V.setPolygonOffset(!1)}function Ee(e,t,n){const r=!0===t.isScene?t.overrideMaterial:null;for(let i=0,o=e.length;i<o;i++){const o=e[i],s=o.object,a=o.geometry,l=null===r?o.material:r,c=o.group;s.layers.test(n.layers)&&Te(s,t,n,a,l,c)}}function Te(e,t,n,r,i,o){e.onBeforeRender(f,t,n,r,i,o),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(f,t,n,r,e,o),!0===i.transparent&&i.side===gf?(i.side=ff,i.needsUpdate=!0,f.renderBufferDirect(n,t,r,i,e,o),i.side=mf,i.needsUpdate=!0,f.renderBufferDirect(n,t,r,i,e,o),i.side=gf):f.renderBufferDirect(n,t,r,i,e,o),e.onAfterRender(f,t,n,r,i,o)}function Ie(e,t,n){!0!==t.isScene&&(t=U);const r=q.get(e),i=h.state.lights,o=h.state.shadowsArray,s=i.state.version,a=Z.getParameters(e,i.state,o,t,n),l=Z.getProgramCacheKey(a);let c=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?Y:K).get(e.envMap||r.environment),void 0===c&&(e.addEventListener("dispose",Se),c=new Map,r.programs=c);let u=c.get(l);if(void 0!==u){if(r.currentProgram===u&&r.lightsStateVersion===s)return Me(e,a),u}else a.uniforms=Z.getUniforms(e),e.onBuild(n,a,f),e.onBeforeCompile(a,f),u=Z.acquireProgram(a,l),c.set(l,u),r.uniforms=a.uniforms;const d=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(d.clippingPlanes=re.uniform),Me(e,a),r.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),r.lightsStateVersion=s,r.needsLights&&(d.ambientLightColor.value=i.state.ambient,d.lightProbe.value=i.state.probe,d.directionalLights.value=i.state.directional,d.directionalLightShadows.value=i.state.directionalShadow,d.spotLights.value=i.state.spot,d.spotLightShadows.value=i.state.spotShadow,d.rectAreaLights.value=i.state.rectArea,d.ltc_1.value=i.state.rectAreaLTC1,d.ltc_2.value=i.state.rectAreaLTC2,d.pointLights.value=i.state.point,d.pointLightShadows.value=i.state.pointShadow,d.hemisphereLights.value=i.state.hemi,d.directionalShadowMap.value=i.state.directionalShadowMap,d.directionalShadowMatrix.value=i.state.directionalShadowMatrix,d.spotShadowMap.value=i.state.spotShadowMap,d.spotLightMatrix.value=i.state.spotLightMatrix,d.spotLightMap.value=i.state.spotLightMap,d.pointShadowMap.value=i.state.pointShadowMap,d.pointShadowMatrix.value=i.state.pointShadowMatrix);const p=u.getUniforms(),m=dw.seqWithValue(p.seq,d);return r.currentProgram=u,r.uniformsList=m,u}function Me(e,t){const n=q.get(e);n.outputEncoding=t.outputEncoding,n.instancing=t.instancing,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}we.setAnimationLoop((function(e){_e&&_e(e)})),"undefined"!=typeof self&&we.setContext(self),this.setAnimationLoop=function(e){_e=e,fe.setAnimationLoop(e),null===e?we.stop():we.start()},fe.addEventListener("sessionstart",be),fe.addEventListener("sessionend",xe),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===g)return;!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===fe.enabled&&!0===fe.isPresenting&&(!0===fe.cameraAutoUpdate&&fe.updateCamera(t),t=fe.getCamera()),!0===e.isScene&&e.onBeforeRender(f,e,t,S),h=ne.get(e,m.length),h.init(),m.push(h),B.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),O.setFromProjectionMatrix(B),k=this.localClippingEnabled,D=re.init(this.clippingPlanes,k,t),d=te.get(e,p.length),d.init(),p.push(d),Ce(e,t,0,f.sortObjects),d.finish(),!0===f.sortObjects&&d.sort(I,M),!0===D&&re.beginShadows();const n=h.state.shadowsArray;if(ie.render(n,e,t),!0===D&&re.endShadows(),!0===this.info.autoReset&&this.info.reset(),oe.render(d,e),h.setupLights(f.physicallyCorrectLights),t.isArrayCamera){const n=t.cameras;for(let t=0,r=n.length;t<r;t++){const r=n[t];Ae(d,e,r,r.viewport)}}else Ae(d,e,t);null!==S&&(J.updateMultisampleRenderTarget(S),J.updateRenderTargetMipmap(S)),!0===e.isScene&&e.onAfterRender(f,e,t),ue.resetDefaultState(),_=-1,b=null,m.pop(),h=m.length>0?m[m.length-1]:null,p.pop(),d=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return S},this.setRenderTargetTextures=function(e,t,n){q.get(e.texture).__webglTexture=t,q.get(e.depthTexture).__webglTexture=n;const r=q.get(e);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0===G.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){const n=q.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){S=e,v=t,y=n;let r=!0;if(e){const t=q.get(e);void 0!==t.__useDefaultFramebuffer?(V.bindFramebuffer(36160,null),r=!1):void 0===t.__webglFramebuffer?J.setupRenderTarget(e):t.__hasExternalTextures&&J.rebindTextures(e,q.get(e.texture).__webglTexture,q.get(e.depthTexture).__webglTexture)}let i=null,o=!1,s=!1;if(e){const n=e.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(s=!0);const r=q.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=r[t],o=!0):i=H.isWebGL2&&e.samples>0&&!1===J.useMultisampledRTT(e)?q.get(e).__webglMultisampledFramebuffer:r,x.copy(e.viewport),w.copy(e.scissor),C=e.scissorTest}else x.copy(R).multiplyScalar(T).floor(),w.copy(P).multiplyScalar(T).floor(),C=N;if(V.bindFramebuffer(36160,i)&&H.drawBuffers&&r&&V.drawBuffers(e,i),V.viewport(x),V.scissor(w),V.setScissorTest(C),o){const r=q.get(e.texture);he.framebufferTexture2D(36160,36064,34069+t,r.__webglTexture,n)}else if(s){const r=q.get(e.texture),i=t||0;he.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}_=-1},this.readRenderTargetPixels=function(e,t,n,r,i,o,s){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=q.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){V.bindFramebuffer(36160,a);try{const s=e.texture,a=s.format,l=s.type;if(a!==Dg&&ce.convert(a)!==he.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===Ig&&(G.has("EXT_color_buffer_half_float")||H.isWebGL2&&G.has("EXT_color_buffer_float"));if(!(l===bg||ce.convert(l)===he.getParameter(35738)||l===Tg&&(H.isWebGL2||G.has("OES_texture_float")||G.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&he.readPixels(t,n,r,i,ce.convert(a),ce.convert(l),o)}finally{const e=null!==S?q.get(S).__webglFramebuffer:null;V.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){const r=Math.pow(2,-n),i=Math.floor(t.image.width*r),o=Math.floor(t.image.height*r);J.setTexture2D(t,0),he.copyTexSubImage2D(3553,n,0,0,e.x,e.y,i,o),V.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r=0){const i=t.image.width,o=t.image.height,s=ce.convert(n.format),a=ce.convert(n.type);J.setTexture2D(n,0),he.pixelStorei(37440,n.flipY),he.pixelStorei(37441,n.premultiplyAlpha),he.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?he.texSubImage2D(3553,r,e.x,e.y,i,o,s,a,t.image.data):t.isCompressedTexture?he.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,s,t.mipmaps[0].data):he.texSubImage2D(3553,r,e.x,e.y,s,a,t.image),0===r&&n.generateMipmaps&&he.generateMipmap(3553),V.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,r,i=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,a=e.max.z-e.min.z+1,l=ce.convert(r.format),c=ce.convert(r.type);let u;if(r.isData3DTexture)J.setTexture3D(r,0),u=32879;else{if(!r.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");J.setTexture2DArray(r,0),u=35866}he.pixelStorei(37440,r.flipY),he.pixelStorei(37441,r.premultiplyAlpha),he.pixelStorei(3317,r.unpackAlignment);const d=he.getParameter(3314),h=he.getParameter(32878),p=he.getParameter(3316),m=he.getParameter(3315),g=he.getParameter(32877),v=n.isCompressedTexture?n.mipmaps[0]:n.image;he.pixelStorei(3314,v.width),he.pixelStorei(32878,v.height),he.pixelStorei(3316,e.min.x),he.pixelStorei(3315,e.min.y),he.pixelStorei(32877,e.min.z),n.isDataTexture||n.isData3DTexture?he.texSubImage3D(u,i,t.x,t.y,t.z,o,s,a,l,c,v.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),he.compressedTexSubImage3D(u,i,t.x,t.y,t.z,o,s,a,l,v.data)):he.texSubImage3D(u,i,t.x,t.y,t.z,o,s,a,l,c,v),he.pixelStorei(3314,d),he.pixelStorei(32878,h),he.pixelStorei(3316,p),he.pixelStorei(3315,m),he.pixelStorei(32877,g),0===i&&r.generateMipmaps&&he.generateMipmap(u),V.unbindTexture()},this.initTexture=function(e){e.isCubeTexture?J.setTextureCube(e,0):e.isData3DTexture?J.setTexture3D(e,0):e.isDataArrayTexture?J.setTexture2DArray(e,0):J.setTexture2D(e,0),V.unbindTexture()},this.resetState=function(){v=0,y=0,S=null,V.reset(),ue.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class iC extends rC{}iC.prototype.isWebGL1Renderer=!0;class oC{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Vy(e),this.density=t}clone(){return new oC(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class sC{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Vy(e),this.near=t,this.far=n}clone(){return new sC(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class aC extends a_{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class lC{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=ty,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=yy()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=yy()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=yy()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const cC=new oS;class uC{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)cC.fromBufferAttribute(this,t),cC.applyMatrix4(e),this.setXYZ(t,cC.x,cC.y,cC.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)cC.fromBufferAttribute(this,t),cC.applyNormalMatrix(e),this.setXYZ(t,cC.x,cC.y,cC.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)cC.fromBufferAttribute(this,t),cC.transformDirection(e),this.setXYZ(t,cC.x,cC.y,cC.z);return this}setX(e,t){return this.normalized&&(t=Ey(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Ey(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Ey(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Ey(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Ay(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Ay(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Ay(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Ay(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ey(t,this.array),n=Ey(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ey(t,this.array),n=Ey(n,this.array),r=Ey(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Ey(t,this.array),n=Ey(n,this.array),r=Ey(r,this.array),i=Ey(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new C_(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new uC(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class dC extends __{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Vy(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let hC;const pC=new oS,mC=new oS,fC=new oS,gC=new Iy,vC=new Iy,yC=new LS,SC=new oS,_C=new oS,bC=new oS,xC=new Iy,wC=new Iy,CC=new Iy;class AC extends a_{constructor(e){if(super(),this.isSprite=!0,this.type="Sprite",void 0===hC){hC=new G_;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new lC(e,5);hC.setIndex([0,1,2,0,2,3]),hC.setAttribute("position",new uC(t,3,0,!1)),hC.setAttribute("uv",new uC(t,2,3,!1))}this.geometry=hC,this.material=void 0!==e?e:new dC,this.center=new Iy(.5,.5)}raycast(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),mC.setFromMatrixScale(this.matrixWorld),yC.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),fC.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&mC.multiplyScalar(-fC.z);const n=this.material.rotation;let r,i;0!==n&&(i=Math.cos(n),r=Math.sin(n));const o=this.center;EC(SC.set(-.5,-.5,0),fC,o,mC,r,i),EC(_C.set(.5,-.5,0),fC,o,mC,r,i),EC(bC.set(.5,.5,0),fC,o,mC,r,i),xC.set(0,0),wC.set(1,0),CC.set(1,1);let s=e.ray.intersectTriangle(SC,_C,bC,!1,pC);if(null===s&&(EC(_C.set(-.5,.5,0),fC,o,mC,r,i),wC.set(0,1),s=e.ray.intersectTriangle(SC,bC,_C,!1,pC),null===s))return;const a=e.ray.origin.distanceTo(pC);a<e.near||a>e.far||t.push({distance:a,point:pC.clone(),uv:y_.getUV(pC,SC,_C,bC,xC,wC,CC,new Iy),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function EC(e,t,n,r,i,o){gC.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(vC.x=o*gC.x-i*gC.y,vC.y=i*gC.x+o*gC.y):vC.copy(gC),e.copy(t),e.x+=vC.x,e.y+=vC.y,e.applyMatrix4(yC)}const TC=new oS,IC=new oS;class MC extends a_{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let e=0,n=t.length;e<n;e++){const n=t[e];this.addLevel(n.object.clone(),n.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);const n=this.levels;let r;for(r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){TC.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(TC);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){TC.setFromMatrixPosition(e.matrixWorld),IC.setFromMatrixPosition(this.matrixWorld);const n=TC.distanceTo(IC)/e.zoom;let r,i;for(t[0].object.visible=!0,r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let e=0,r=n.length;e<r;e++){const r=n[e];t.object.levels.push({object:r.object.uuid,distance:r.distance})}return t}}const RC=new oS,PC=new Xy,NC=new Xy,OC=new oS,DC=new LS;class kC extends sb{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new LS,this.bindMatrixInverse=new LS}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Xy,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const n=this.skeleton,r=this.geometry;PC.fromBufferAttribute(r.attributes.skinIndex,e),NC.fromBufferAttribute(r.attributes.skinWeight,e),RC.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const r=NC.getComponent(e);if(0!==r){const i=PC.getComponent(e);DC.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(OC.copy(RC).applyMatrix4(DC),r)}}return t.applyMatrix4(this.bindMatrixInverse)}}class LC extends a_{constructor(){super(),this.isBone=!0,this.type="Bone"}}class BC extends $y{constructor(e=null,t=1,n=1,r,i,o,s,a,l=dg,c=dg,u,d){super(null,o,s,a,l,c,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const zC=new LS,FC=new LS;class UC{constructor(e=[],t=[]){this.uuid=yy(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new LS)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new LS;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=e.length;r<i;r++){const i=e[r]?e[r].matrixWorld:FC;zC.multiplyMatrices(i,t[r]),zC.toArray(n,16*r)}null!==r&&(r.needsUpdate=!0)}clone(){return new UC(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=wy(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new BC(t,e,e,Dg,Tg);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const r=e.bones[n];let i=t[r];void 0===i&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),i=new LC),this.bones.push(i),this.boneInverses.push((new LS).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,i=t.length;r<i;r++){const i=t[r];e.bones.push(i.uuid);const o=n[r];e.boneInverses.push(o.toArray())}return e}}class jC extends C_{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const GC=new LS,HC=new LS,VC=[],WC=new sb;class qC extends sb{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new jC(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}raycast(e,t){const n=this.matrixWorld,r=this.count;if(WC.geometry=this.geometry,WC.material=this.material,void 0!==WC.material)for(let i=0;i<r;i++){this.getMatrixAt(i,GC),HC.multiplyMatrices(n,GC),WC.matrixWorld=HC,WC.raycast(e,VC);for(let e=0,n=VC.length;e<n;e++){const n=VC[e];n.instanceId=i,n.object=this,t.push(n)}VC.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new jC(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class JC extends __{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Vy(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const KC=new oS,YC=new oS,$C=new LS,XC=new kS,QC=new TS;class ZC extends a_{constructor(e=new G_,t=new JC){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)KC.fromBufferAttribute(t,e-1),YC.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=KC.distanceTo(YC);e.setAttribute("lineDistance",new O_(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),QC.copy(n.boundingSphere),QC.applyMatrix4(r),QC.radius+=i,!1===e.ray.intersectsSphere(QC))return;$C.copy(r).invert(),XC.copy(e.ray).applyMatrix4($C);const s=i/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s,l=new oS,c=new oS,u=new oS,d=new oS,h=this.isLineSegments?2:1,p=n.index,m=n.attributes.position;if(null!==p){for(let n=Math.max(0,o.start),r=Math.min(p.count,o.start+o.count)-1;n<r;n+=h){const r=p.getX(n),i=p.getX(n+1);l.fromBufferAttribute(m,r),c.fromBufferAttribute(m,i);if(XC.distanceSqToSegment(l,c,d,u)>a)continue;d.applyMatrix4(this.matrixWorld);const o=e.ray.origin.distanceTo(d);o<e.near||o>e.far||t.push({distance:o,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,o.start),r=Math.min(m.count,o.start+o.count)-1;n<r;n+=h){l.fromBufferAttribute(m,n),c.fromBufferAttribute(m,n+1);if(XC.distanceSqToSegment(l,c,d,u)>a)continue;d.applyMatrix4(this.matrixWorld);const r=e.ray.origin.distanceTo(d);r<e.near||r>e.far||t.push({distance:r,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}const eA=new oS,tA=new oS;class nA extends ZC{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)eA.fromBufferAttribute(t,e),tA.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+eA.distanceTo(tA);e.setAttribute("lineDistance",new O_(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class rA extends ZC{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class iA extends __{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Vy(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const oA=new LS,sA=new kS,aA=new TS,lA=new oS;class cA extends a_{constructor(e=new G_,t=new iA){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),aA.copy(n.boundingSphere),aA.applyMatrix4(r),aA.radius+=i,!1===e.ray.intersectsSphere(aA))return;oA.copy(r).invert(),sA.copy(e.ray).applyMatrix4(oA);const s=i/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s,l=n.index,c=n.attributes.position;if(null!==l){for(let n=Math.max(0,o.start),i=Math.min(l.count,o.start+o.count);n<i;n++){const i=l.getX(n);lA.fromBufferAttribute(c,i),uA(lA,i,a,r,e,t,this)}}else{for(let n=Math.max(0,o.start),i=Math.min(c.count,o.start+o.count);n<i;n++)lA.fromBufferAttribute(c,n),uA(lA,n,a,r,e,t,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function uA(e,t,n,r,i,o,s){const a=sA.distanceSqToPoint(e);if(a<n){const n=new oS;sA.closestPointToPoint(e,n),n.applyMatrix4(r);const l=i.ray.origin.distanceTo(n);if(l<i.near||l>i.far)return;o.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,object:s})}}class dA extends $y{constructor(e,t,n,r,i,o,s,a,l){super(e,t,n,r,i,o,s,a,l),this.isVideoTexture=!0,this.minFilter=void 0!==o?o:gg,this.magFilter=void 0!==i?i:gg,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){c.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class hA extends $y{constructor(e,t,n){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=n,this.magFilter=dg,this.minFilter=dg,this.generateMipmaps=!1,this.needsUpdate=!0}}class pA extends $y{constructor(e,t,n,r,i,o,s,a,l,c,u,d){super(null,o,s,a,l,c,r,i,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class mA extends $y{constructor(e,t,n,r,i,o,s,a,l){super(e,t,n,r,i,o,s,a,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class fA{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),i=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let r=0;const i=n.length;let o;o=t||e*n[i-1];let s,a=0,l=i-1;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),s=n[r]-o,s<0)a=r+1;else{if(!(s>0)){l=r;break}l=r-1}if(r=l,n[r]===o)return r/(i-1);const c=n[r];return(r+(o-c)/(n[r+1]-c))/(i-1)}getTangent(e,t){const n=1e-4;let r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);const o=this.getPoint(r),s=this.getPoint(i),a=t||(o.isVector2?new Iy:new oS);return a.copy(s).sub(o).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new oS,r=[],i=[],o=[],s=new oS,a=new LS;for(let t=0;t<=e;t++){const n=t/e;r[t]=this.getTangentAt(n,new oS)}i[0]=new oS,o[0]=new oS;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);c<=l&&(l=c,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),d<=l&&n.set(0,0,1),s.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],s),o[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),o[t]=o[t-1].clone(),s.crossVectors(r[t-1],r[t]),s.length()>Number.EPSILON){s.normalize();const e=Math.acos(Sy(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(a.makeRotationAxis(s,e))}o[t].crossVectors(r[t],i[t])}if(!0===t){let t=Math.acos(Sy(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(s.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(a.makeRotationAxis(r[n],t*n)),o[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:o}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class gA extends fA{constructor(e=0,t=0,n=1,r=1,i=0,o=2*Math.PI,s=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=s,this.aRotation=a}getPoint(e,t){const n=t||new Iy,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const o=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=o?0:r),!0!==this.aClockwise||o||(i===r?i=-r:i-=r);const s=this.aStartAngle+e*i;let a=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){const e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=a-this.aX,r=l-this.aY;a=n*e-r*t+this.aX,l=n*t+r*e+this.aY}return n.set(a,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class vA extends gA{constructor(e,t,n,r,i,o){super(e,t,n,n,r,i,o),this.isArcCurve=!0,this.type="ArcCurve"}}function yA(){let e=0,t=0,n=0,r=0;function i(i,o,s,a){e=i,t=s,n=-3*i+3*o-2*s-a,r=2*i-2*o+s+a}return{initCatmullRom:function(e,t,n,r,o){i(t,n,o*(n-e),o*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,o,s,a){let l=(t-e)/o-(n-e)/(o+s)+(n-t)/s,c=(n-t)/s-(r-t)/(s+a)+(r-n)/a;l*=s,c*=s,i(t,n,l,c)},calc:function(i){const o=i*i;return e+t*i+n*o+r*(o*i)}}}const SA=new oS,_A=new yA,bA=new yA,xA=new yA;class wA extends fA{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new oS){const n=t,r=this.points,i=r.length,o=(i-(this.closed?0:1))*e;let s,a,l=Math.floor(o),c=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?s=r[(l-1)%i]:(SA.subVectors(r[0],r[1]).add(r[0]),s=SA);const u=r[l%i],d=r[(l+1)%i];if(this.closed||l+2<i?a=r[(l+2)%i]:(SA.subVectors(r[i-1],r[i-2]).add(r[i-1]),a=SA),"centripetal"===this.curveType||"chordal"===this.curveType){const e="chordal"===this.curveType?.5:.25;let t=Math.pow(s.distanceToSquared(u),e),n=Math.pow(u.distanceToSquared(d),e),r=Math.pow(d.distanceToSquared(a),e);n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),_A.initNonuniformCatmullRom(s.x,u.x,d.x,a.x,t,n,r),bA.initNonuniformCatmullRom(s.y,u.y,d.y,a.y,t,n,r),xA.initNonuniformCatmullRom(s.z,u.z,d.z,a.z,t,n,r)}else"catmullrom"===this.curveType&&(_A.initCatmullRom(s.x,u.x,d.x,a.x,this.tension),bA.initCatmullRom(s.y,u.y,d.y,a.y,this.tension),xA.initCatmullRom(s.z,u.z,d.z,a.z,this.tension));return n.set(_A.calc(c),bA.calc(c),xA.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new oS).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function CA(e,t,n,r,i){const o=.5*(r-t),s=.5*(i-n),a=e*e;return(2*n-2*r+o+s)*(e*a)+(-3*n+3*r-2*o-s)*a+o*e+n}function AA(e,t,n,r){return function(e,t){const n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,r)}function EA(e,t,n,r,i){return function(e,t){const n=1-e;return n*n*n*t}(e,t)+function(e,t){const n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,r)+function(e,t){return e*e*e*t}(e,i)}class TA extends fA{constructor(e=new Iy,t=new Iy,n=new Iy,r=new Iy){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Iy){const n=t,r=this.v0,i=this.v1,o=this.v2,s=this.v3;return n.set(EA(e,r.x,i.x,o.x,s.x),EA(e,r.y,i.y,o.y,s.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class IA extends fA{constructor(e=new oS,t=new oS,n=new oS,r=new oS){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new oS){const n=t,r=this.v0,i=this.v1,o=this.v2,s=this.v3;return n.set(EA(e,r.x,i.x,o.x,s.x),EA(e,r.y,i.y,o.y,s.y),EA(e,r.z,i.z,o.z,s.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class MA extends fA{constructor(e=new Iy,t=new Iy){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Iy){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const n=t||new Iy;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class RA extends fA{constructor(e=new oS,t=new oS){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new oS){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class PA extends fA{constructor(e=new Iy,t=new Iy,n=new Iy){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Iy){const n=t,r=this.v0,i=this.v1,o=this.v2;return n.set(AA(e,r.x,i.x,o.x),AA(e,r.y,i.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class NA extends fA{constructor(e=new oS,t=new oS,n=new oS){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new oS){const n=t,r=this.v0,i=this.v1,o=this.v2;return n.set(AA(e,r.x,i.x,o.x),AA(e,r.y,i.y,o.y),AA(e,r.z,i.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class OA extends fA{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Iy){const n=t,r=this.points,i=(r.length-1)*e,o=Math.floor(i),s=i-o,a=r[0===o?o:o-1],l=r[o],c=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return n.set(CA(s,a.x,l.x,c.x,u.x),CA(s,a.y,l.y,c.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new Iy).fromArray(n))}return this}}var DA=Object.freeze({__proto__:null,ArcCurve:vA,CatmullRomCurve3:wA,CubicBezierCurve:TA,CubicBezierCurve3:IA,EllipseCurve:gA,LineCurve:MA,LineCurve3:RA,QuadraticBezierCurve:PA,QuadraticBezierCurve3:NA,SplineCurve:OA});class kA extends fA{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new MA(t,e))}getPoint(e,t){const n=e*this.getLength(),r=this.getCurveLengths();let i=0;for(;i<r.length;){if(r[i]>=n){const e=r[i]-n,o=this.curves[i],s=o.getLength(),a=0===s?0:1-e/s;return o.getPointAt(a,t)}i++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let r=0,i=this.curves;r<i.length;r++){const o=i[r],s=o.isEllipseCurve?2*e:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,a=o.getPoints(s);for(let e=0;e<a.length;e++){const r=a[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push((new DA[n.type]).fromJSON(n))}return this}}class LA extends kA{constructor(e){super(),this.type="Path",this.currentPoint=new Iy,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new MA(this.currentPoint.clone(),new Iy(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){const i=new PA(this.currentPoint.clone(),new Iy(e,t),new Iy(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,i,o){const s=new TA(this.currentPoint.clone(),new Iy(e,t),new Iy(n,r),new Iy(i,o));return this.curves.push(s),this.currentPoint.set(i,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new OA(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,i,o){const s=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(e+s,t+a,n,r,i,o),this}absarc(e,t,n,r,i,o){return this.absellipse(e,t,n,n,r,i,o),this}ellipse(e,t,n,r,i,o,s,a){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,r,i,o,s,a),this}absellipse(e,t,n,r,i,o,s,a){const l=new gA(e,t,n,r,i,o,s,a);if(this.curves.length>0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class BA extends G_{constructor(e=[new Iy(0,-.5),new Iy(.5,0),new Iy(0,.5)],t=12,n=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=Sy(r,0,2*Math.PI);const i=[],o=[],s=[],a=[],l=[],c=1/t,u=new oS,d=new Iy,h=new oS,p=new oS,m=new oS;let f=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:f=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,h.x=1*g,h.y=-f,h.z=0*g,m.copy(h),h.normalize(),a.push(h.x,h.y,h.z);break;case e.length-1:a.push(m.x,m.y,m.z);break;default:f=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,h.x=1*g,h.y=-f,h.z=0*g,p.copy(h),h.x+=m.x,h.y+=m.y,h.z+=m.z,h.normalize(),a.push(h.x,h.y,h.z),m.copy(p)}for(let i=0;i<=t;i++){const h=n+i*c*r,p=Math.sin(h),m=Math.cos(h);for(let n=0;n<=e.length-1;n++){u.x=e[n].x*p,u.y=e[n].y,u.z=e[n].x*m,o.push(u.x,u.y,u.z),d.x=i/t,d.y=n/(e.length-1),s.push(d.x,d.y);const r=a[3*n+0]*p,c=a[3*n+1],h=a[3*n+0]*m;l.push(r,c,h)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){const r=t+n*e.length,o=r,s=r+e.length,a=r+e.length+1,l=r+1;i.push(o,s,l),i.push(a,l,s)}this.setIndex(i),this.setAttribute("position",new O_(o,3)),this.setAttribute("uv",new O_(s,2)),this.setAttribute("normal",new O_(l,3))}static fromJSON(e){return new BA(e.points,e.segments,e.phiStart,e.phiLength)}}class zA extends BA{constructor(e=1,t=1,n=4,r=8){const i=new LA;i.absarc(0,-t/2,e,1.5*Math.PI,0),i.absarc(0,t/2,e,0,.5*Math.PI),super(i.getPoints(n),r),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:r}}static fromJSON(e){return new zA(e.radius,e.length,e.capSegments,e.radialSegments)}}class FA extends G_{constructor(e=1,t=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const i=[],o=[],s=[],a=[],l=new oS,c=new Iy;o.push(0,0,0),s.push(0,0,1),a.push(.5,.5);for(let i=0,u=3;i<=t;i++,u+=3){const d=n+i/t*r;l.x=e*Math.cos(d),l.y=e*Math.sin(d),o.push(l.x,l.y,l.z),s.push(0,0,1),c.x=(o[u]/e+1)/2,c.y=(o[u+1]/e+1)/2,a.push(c.x,c.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute("position",new O_(o,3)),this.setAttribute("normal",new O_(s,3)),this.setAttribute("uv",new O_(a,2))}static fromJSON(e){return new FA(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class UA extends G_{constructor(e=1,t=1,n=1,r=8,i=1,o=!1,s=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:s,thetaLength:a};const l=this;r=Math.floor(r),i=Math.floor(i);const c=[],u=[],d=[],h=[];let p=0;const m=[],f=n/2;let g=0;function v(n){const i=p,o=new Iy,m=new oS;let v=0;const y=!0===n?e:t,S=!0===n?1:-1;for(let e=1;e<=r;e++)u.push(0,f*S,0),d.push(0,S,0),h.push(.5,.5),p++;const _=p;for(let e=0;e<=r;e++){const t=e/r*a+s,n=Math.cos(t),i=Math.sin(t);m.x=y*i,m.y=f*S,m.z=y*n,u.push(m.x,m.y,m.z),d.push(0,S,0),o.x=.5*n+.5,o.y=.5*i*S+.5,h.push(o.x,o.y),p++}for(let e=0;e<r;e++){const t=i+e,r=_+e;!0===n?c.push(r,r+1,t):c.push(r+1,r,t),v+=3}l.addGroup(g,v,!0===n?1:2),g+=v}!function(){const o=new oS,v=new oS;let y=0;const S=(t-e)/n;for(let l=0;l<=i;l++){const c=[],g=l/i,y=g*(t-e)+e;for(let e=0;e<=r;e++){const t=e/r,i=t*a+s,l=Math.sin(i),m=Math.cos(i);v.x=y*l,v.y=-g*n+f,v.z=y*m,u.push(v.x,v.y,v.z),o.set(l,S,m).normalize(),d.push(o.x,o.y,o.z),h.push(t,1-g),c.push(p++)}m.push(c)}for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=m[t][e],r=m[t+1][e],i=m[t+1][e+1],o=m[t][e+1];c.push(n,r,o),c.push(r,i,o),y+=6}l.addGroup(g,y,0),g+=y}(),!1===o&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new O_(u,3)),this.setAttribute("normal",new O_(d,3)),this.setAttribute("uv",new O_(h,2))}static fromJSON(e){return new UA(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class jA extends UA{constructor(e=1,t=1,n=8,r=1,i=!1,o=0,s=2*Math.PI){super(0,e,t,n,r,i,o,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:s}}static fromJSON(e){return new jA(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class GA extends G_{constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};const i=[],o=[];function s(e,t,n,r){const i=r+1,o=[];for(let r=0;r<=i;r++){o[r]=[];const s=e.clone().lerp(n,r/i),a=t.clone().lerp(n,r/i),l=i-r;for(let e=0;e<=l;e++)o[r][e]=0===e&&r===i?s:s.clone().lerp(a,e/l)}for(let e=0;e<i;e++)for(let t=0;t<2*(i-e)-1;t++){const n=Math.floor(t/2);t%2==0?(a(o[e][n+1]),a(o[e+1][n]),a(o[e][n])):(a(o[e][n+1]),a(o[e+1][n+1]),a(o[e+1][n]))}}function a(e){i.push(e.x,e.y,e.z)}function l(t,n){const r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function c(e,t,n,r){r<0&&1===e.x&&(o[t]=e.x-1),0===n.x&&0===n.z&&(o[t]=r/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}!function(e){const n=new oS,r=new oS,i=new oS;for(let o=0;o<t.length;o+=3)l(t[o+0],n),l(t[o+1],r),l(t[o+2],i),s(n,r,i,e)}(r),function(e){const t=new oS;for(let n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}(n),function(){const e=new oS;for(let n=0;n<i.length;n+=3){e.x=i[n+0],e.y=i[n+1],e.z=i[n+2];const r=u(e)/2/Math.PI+.5,s=(t=e,Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5);o.push(r,1-s)}var t;(function(){const e=new oS,t=new oS,n=new oS,r=new oS,s=new Iy,a=new Iy,l=new Iy;for(let d=0,h=0;d<i.length;d+=9,h+=6){e.set(i[d+0],i[d+1],i[d+2]),t.set(i[d+3],i[d+4],i[d+5]),n.set(i[d+6],i[d+7],i[d+8]),s.set(o[h+0],o[h+1]),a.set(o[h+2],o[h+3]),l.set(o[h+4],o[h+5]),r.copy(e).add(t).add(n).divideScalar(3);const p=u(r);c(s,h+0,e,p),c(a,h+2,t,p),c(l,h+4,n,p)}})(),function(){for(let e=0;e<o.length;e+=6){const t=o[e+0],n=o[e+2],r=o[e+4],i=Math.max(t,n,r),s=Math.min(t,n,r);i>.9&&s<.1&&(t<.2&&(o[e+0]+=1),n<.2&&(o[e+2]+=1),r<.2&&(o[e+4]+=1))}}()}(),this.setAttribute("position",new O_(i,3)),this.setAttribute("normal",new O_(i.slice(),3)),this.setAttribute("uv",new O_(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new GA(e.vertices,e.indices,e.radius,e.details)}}class HA extends GA{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new HA(e.radius,e.detail)}}const VA=new oS,WA=new oS,qA=new oS,JA=new y_;class KA extends G_{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,r=Math.pow(10,n),i=Math.cos(gy*t),o=e.getIndex(),s=e.getAttribute("position"),a=o?o.count:s.count,l=[0,0,0],c=["a","b","c"],u=new Array(3),d={},h=[];for(let e=0;e<a;e+=3){o?(l[0]=o.getX(e),l[1]=o.getX(e+1),l[2]=o.getX(e+2)):(l[0]=e,l[1]=e+1,l[2]=e+2);const{a:t,b:n,c:a}=JA;if(t.fromBufferAttribute(s,l[0]),n.fromBufferAttribute(s,l[1]),a.fromBufferAttribute(s,l[2]),JA.getNormal(qA),u[0]=`${Math.round(t.x*r)},${Math.round(t.y*r)},${Math.round(t.z*r)}`,u[1]=`${Math.round(n.x*r)},${Math.round(n.y*r)},${Math.round(n.z*r)}`,u[2]=`${Math.round(a.x*r)},${Math.round(a.y*r)},${Math.round(a.z*r)}`,u[0]!==u[1]&&u[1]!==u[2]&&u[2]!==u[0])for(let e=0;e<3;e++){const t=(e+1)%3,n=u[e],r=u[t],o=JA[c[e]],s=JA[c[t]],a=`${n}_${r}`,p=`${r}_${n}`;p in d&&d[p]?(qA.dot(d[p].normal)<=i&&(h.push(o.x,o.y,o.z),h.push(s.x,s.y,s.z)),d[p]=null):a in d||(d[a]={index0:l[e],index1:l[t],normal:qA.clone()})}}for(const e in d)if(d[e]){const{index0:t,index1:n}=d[e];VA.fromBufferAttribute(s,t),WA.fromBufferAttribute(s,n),h.push(VA.x,VA.y,VA.z),h.push(WA.x,WA.y,WA.z)}this.setAttribute("position",new O_(h,3))}}}class YA extends LA{constructor(e){super(e),this.uuid=yy(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push((new LA).fromJSON(n))}return this}}const $A=function(e,t,n=2){const r=t&&t.length,i=r?t[0]*n:e.length;let o=XA(e,0,i,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c,u,d,h,p;if(r&&(o=function(e,t,n,r){const i=[];let o,s,a,l,c;for(o=0,s=t.length;o<s;o++)a=t[o]*r,l=o<s-1?t[o+1]*r:e.length,c=XA(e,a,l,r,!1),c===c.next&&(c.steiner=!0),i.push(lE(c));for(i.sort(iE),o=0;o<i.length;o++)oE(i[o],n),n=QA(n,n.next);return n}(e,t,o,n)),e.length>80*n){a=c=e[0],l=u=e[1];for(let t=n;t<i;t+=n)d=e[t],h=e[t+1],d<a&&(a=d),h<l&&(l=h),d>c&&(c=d),h>u&&(u=h);p=Math.max(c-a,u-l),p=0!==p?1/p:0}return ZA(o,s,n,a,l,p),s};function XA(e,t,n,r,i){let o,s;if(i===function(e,t,n,r){let i=0;for(let o=t,s=n-r;o<n;o+=r)i+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return i}(e,t,n,r)>0)for(o=t;o<n;o+=r)s=yE(o,e[o],e[o+1],s);else for(o=n-r;o>=t;o-=r)s=yE(o,e[o],e[o+1],s);return s&&hE(s,s.next)&&(SE(s),s=s.next),s}function QA(e,t){if(!e)return e;t||(t=e);let n,r=e;do{if(n=!1,r.steiner||!hE(r,r.next)&&0!==dE(r.prev,r,r.next))r=r.next;else{if(SE(r),r=t=r.prev,r===r.next)break;n=!0}}while(n||r!==t);return t}function ZA(e,t,n,r,i,o,s){if(!e)return;!s&&o&&function(e,t,n,r){let i=e;do{null===i.z&&(i.z=aE(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n,r,i,o,s,a,l,c=1;do{for(n=e,e=null,o=null,s=0;n;){for(s++,r=n,a=0,t=0;t<c&&(a++,r=r.nextZ,r);t++);for(l=c;a>0||l>0&&r;)0!==a&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(s>1)}(i)}(e,r,i,o);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,o?tE(e,r,i,o):eE(e))t.push(a.i/n),t.push(e.i/n),t.push(l.i/n),SE(e),e=l.next,c=l.next;else if((e=l)===c){s?1===s?ZA(e=nE(QA(e),t,n),t,n,r,i,o,2):2===s&&rE(e,t,n,r,i,o):ZA(QA(e),t,n,r,i,o,1);break}}function eE(e){const t=e.prev,n=e,r=e.next;if(dE(t,n,r)>=0)return!1;let i=e.next.next;for(;i!==e.prev;){if(cE(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&dE(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function tE(e,t,n,r){const i=e.prev,o=e,s=e.next;if(dE(i,o,s)>=0)return!1;const a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,l=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,c=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,u=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,d=aE(a,l,t,n,r),h=aE(c,u,t,n,r);let p=e.prevZ,m=e.nextZ;for(;p&&p.z>=d&&m&&m.z<=h;){if(p!==e.prev&&p!==e.next&&cE(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&dE(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,m!==e.prev&&m!==e.next&&cE(i.x,i.y,o.x,o.y,s.x,s.y,m.x,m.y)&&dE(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;p&&p.z>=d;){if(p!==e.prev&&p!==e.next&&cE(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&dE(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=h;){if(m!==e.prev&&m!==e.next&&cE(i.x,i.y,o.x,o.y,s.x,s.y,m.x,m.y)&&dE(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function nE(e,t,n){let r=e;do{const i=r.prev,o=r.next.next;!hE(i,o)&&pE(i,r,r.next,o)&&gE(i,o)&&gE(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),SE(r),SE(r.next),r=e=o),r=r.next}while(r!==e);return QA(r)}function rE(e,t,n,r,i,o){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&uE(s,e)){let a=vE(s,e);return s=QA(s,s.next),a=QA(a,a.next),ZA(s,t,n,r,i,o),void ZA(a,t,n,r,i,o)}e=e.next}s=s.next}while(s!==e)}function iE(e,t){return e.x-t.x}function oE(e,t){if(t=function(e,t){let n=t;const r=e.x,i=e.y;let o,s=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>s){if(s=e,e===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!o)return null;if(r===s)return o;const a=o,l=o.x,c=o.y;let u,d=1/0;n=o;do{r>=n.x&&n.x>=l&&r!==n.x&&cE(i<c?r:s,i,l,c,i<c?s:r,i,n.x,n.y)&&(u=Math.abs(i-n.y)/(r-n.x),gE(n,e)&&(u<d||u===d&&(n.x>o.x||n.x===o.x&&sE(o,n)))&&(o=n,d=u)),n=n.next}while(n!==a);return o}(e,t),t){const n=vE(t,e);QA(t,t.next),QA(n,n.next)}}function sE(e,t){return dE(e.prev,e,t.prev)<0&&dE(t.next,e,e.next)<0}function aE(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function lE(e){let t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function cE(e,t,n,r,i,o,s,a){return(i-s)*(t-a)-(e-s)*(o-a)>=0&&(e-s)*(r-a)-(n-s)*(t-a)>=0&&(n-s)*(o-a)-(i-s)*(r-a)>=0}function uE(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&pE(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(gE(e,t)&&gE(t,e)&&function(e,t){let n=e,r=!1;const i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(dE(e.prev,e,t.prev)||dE(e,t.prev,t))||hE(e,t)&&dE(e.prev,e,e.next)>0&&dE(t.prev,t,t.next)>0)}function dE(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function hE(e,t){return e.x===t.x&&e.y===t.y}function pE(e,t,n,r){const i=fE(dE(e,t,n)),o=fE(dE(e,t,r)),s=fE(dE(n,r,e)),a=fE(dE(n,r,t));return i!==o&&s!==a||(!(0!==i||!mE(e,n,t))||(!(0!==o||!mE(e,r,t))||(!(0!==s||!mE(n,e,r))||!(0!==a||!mE(n,t,r)))))}function mE(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function fE(e){return e>0?1:e<0?-1:0}function gE(e,t){return dE(e.prev,e,e.next)<0?dE(e,t,e.next)>=0&&dE(e,e.prev,t)>=0:dE(e,t,e.prev)<0||dE(e,e.next,t)<0}function vE(e,t){const n=new _E(e.i,e.x,e.y),r=new _E(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function yE(e,t,n,r){const i=new _E(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function SE(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function _E(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class bE{static area(e){const t=e.length;let n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n}static isClockWise(e){return bE.area(e)<0}static triangulateShape(e,t){const n=[],r=[],i=[];xE(e),wE(n,e);let o=e.length;t.forEach(xE);for(let e=0;e<t.length;e++)r.push(o),o+=t[e].length,wE(n,t[e]);const s=$A(n,r);for(let e=0;e<s.length;e+=3)i.push(s.slice(e,e+3));return i}}function xE(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function wE(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class CE extends G_{constructor(e=new YA([new Iy(.5,.5),new Iy(-.5,.5),new Iy(-.5,-.5),new Iy(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,r=[],i=[];for(let t=0,n=e.length;t<n;t++){o(e[t])}function o(e){const o=[],s=void 0!==t.curveSegments?t.curveSegments:12,a=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:1;let c=void 0===t.bevelEnabled||t.bevelEnabled,u=void 0!==t.bevelThickness?t.bevelThickness:.2,d=void 0!==t.bevelSize?t.bevelSize:u-.1,h=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3;const m=t.extrudePath,f=void 0!==t.UVGenerator?t.UVGenerator:AE;let g,v,y,S,_,b=!1;m&&(g=m.getSpacedPoints(a),b=!0,c=!1,v=m.computeFrenetFrames(a,!1),y=new oS,S=new oS,_=new oS),c||(p=0,u=0,d=0,h=0);const x=e.extractPoints(s);let w=x.shape;const C=x.holes;if(!bE.isClockWise(w)){w=w.reverse();for(let e=0,t=C.length;e<t;e++){const t=C[e];bE.isClockWise(t)&&(C[e]=t.reverse())}}const A=bE.triangulateShape(w,C),E=w;for(let e=0,t=C.length;e<t;e++){const t=C[e];w=w.concat(t)}function T(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}const I=w.length,M=A.length;function R(e,t,n){let r,i,o;const s=e.x-t.x,a=e.y-t.y,l=n.x-e.x,c=n.y-e.y,u=s*s+a*a,d=s*c-a*l;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(u),h=Math.sqrt(l*l+c*c),p=t.x-a/d,m=t.y+s/d,f=((n.x-c/h-p)*c-(n.y+l/h-m)*l)/(s*c-a*l);r=p+s*f-e.x,i=m+a*f-e.y;const g=r*r+i*i;if(g<=2)return new Iy(r,i);o=Math.sqrt(g/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(a)===Math.sign(c)&&(e=!0),e?(r=-a,i=s,o=Math.sqrt(u)):(r=s,i=a,o=Math.sqrt(u/2))}return new Iy(r/o,i/o)}const P=[];for(let e=0,t=E.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),P[e]=R(E[e],E[n],E[r]);const N=[];let O,D=P.concat();for(let e=0,t=C.length;e<t;e++){const t=C[e];O=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),O[e]=R(t[e],t[r],t[i]);N.push(O),D=D.concat(O)}for(let e=0;e<p;e++){const t=e/p,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+h;for(let e=0,t=E.length;e<t;e++){const t=T(E[e],P[e],r);B(t.x,t.y,-n)}for(let e=0,t=C.length;e<t;e++){const t=C[e];O=N[e];for(let e=0,i=t.length;e<i;e++){const i=T(t[e],O[e],r);B(i.x,i.y,-n)}}}const k=d+h;for(let e=0;e<I;e++){const t=c?T(w[e],D[e],k):w[e];b?(S.copy(v.normals[0]).multiplyScalar(t.x),y.copy(v.binormals[0]).multiplyScalar(t.y),_.copy(g[0]).add(S).add(y),B(_.x,_.y,_.z)):B(t.x,t.y,0)}for(let e=1;e<=a;e++)for(let t=0;t<I;t++){const n=c?T(w[t],D[t],k):w[t];b?(S.copy(v.normals[e]).multiplyScalar(n.x),y.copy(v.binormals[e]).multiplyScalar(n.y),_.copy(g[e]).add(S).add(y),B(_.x,_.y,_.z)):B(n.x,n.y,l/a*e)}for(let e=p-1;e>=0;e--){const t=e/p,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+h;for(let e=0,t=E.length;e<t;e++){const t=T(E[e],P[e],r);B(t.x,t.y,l+n)}for(let e=0,t=C.length;e<t;e++){const t=C[e];O=N[e];for(let e=0,i=t.length;e<i;e++){const i=T(t[e],O[e],r);b?B(i.x,i.y+g[a-1].y,g[a-1].x+n):B(i.x,i.y,l+n)}}}function L(e,t){let n=e.length;for(;--n>=0;){const r=n;let i=n-1;i<0&&(i=e.length-1);for(let e=0,n=a+2*p;e<n;e++){const n=I*e,o=I*(e+1);F(t+r+n,t+i+n,t+i+o,t+r+o)}}}function B(e,t,n){o.push(e),o.push(t),o.push(n)}function z(e,t,i){U(e),U(t),U(i);const o=r.length/3,s=f.generateTopUV(n,r,o-3,o-2,o-1);j(s[0]),j(s[1]),j(s[2])}function F(e,t,i,o){U(e),U(t),U(o),U(t),U(i),U(o);const s=r.length/3,a=f.generateSideWallUV(n,r,s-6,s-3,s-2,s-1);j(a[0]),j(a[1]),j(a[3]),j(a[1]),j(a[2]),j(a[3])}function U(e){r.push(o[3*e+0]),r.push(o[3*e+1]),r.push(o[3*e+2])}function j(e){i.push(e.x),i.push(e.y)}!function(){const e=r.length/3;if(c){let e=0,t=I*e;for(let e=0;e<M;e++){const n=A[e];z(n[2]+t,n[1]+t,n[0]+t)}e=a+2*p,t=I*e;for(let e=0;e<M;e++){const n=A[e];z(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<M;e++){const t=A[e];z(t[2],t[1],t[0])}for(let e=0;e<M;e++){const t=A[e];z(t[0]+I*a,t[1]+I*a,t[2]+I*a)}}n.addGroup(e,r.length/3-e,0)}(),function(){const e=r.length/3;let t=0;L(E,t),t+=E.length;for(let e=0,n=C.length;e<n;e++){const n=C[e];L(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}()}this.setAttribute("position",new O_(r,3)),this.setAttribute("uv",new O_(i,2)),this.computeVertexNormals()}toJSON(){const e=super.toJSON();return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){const r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,e)}static fromJSON(e,t){const n=[];for(let r=0,i=e.shapes.length;r<i;r++){const i=t[e.shapes[r]];n.push(i)}const r=e.options.extrudePath;return void 0!==r&&(e.options.extrudePath=(new DA[r.type]).fromJSON(r)),new CE(n,e.options)}}const AE={generateTopUV:function(e,t,n,r,i){const o=t[3*n],s=t[3*n+1],a=t[3*r],l=t[3*r+1],c=t[3*i],u=t[3*i+1];return[new Iy(o,s),new Iy(a,l),new Iy(c,u)]},generateSideWallUV:function(e,t,n,r,i,o){const s=t[3*n],a=t[3*n+1],l=t[3*n+2],c=t[3*r],u=t[3*r+1],d=t[3*r+2],h=t[3*i],p=t[3*i+1],m=t[3*i+2],f=t[3*o],g=t[3*o+1],v=t[3*o+2];return Math.abs(a-u)<Math.abs(s-c)?[new Iy(s,1-l),new Iy(c,1-d),new Iy(h,1-m),new Iy(f,1-v)]:[new Iy(a,1-l),new Iy(u,1-d),new Iy(p,1-m),new Iy(g,1-v)]}};class EE extends GA{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new EE(e.radius,e.detail)}}class TE extends GA{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new TE(e.radius,e.detail)}}class IE extends G_{constructor(e=.5,t=1,n=8,r=1,i=0,o=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},n=Math.max(3,n);const s=[],a=[],l=[],c=[];let u=e;const d=(t-e)/(r=Math.max(1,r)),h=new oS,p=new Iy;for(let e=0;e<=r;e++){for(let e=0;e<=n;e++){const r=i+e/n*o;h.x=u*Math.cos(r),h.y=u*Math.sin(r),a.push(h.x,h.y,h.z),l.push(0,0,1),p.x=(h.x/t+1)/2,p.y=(h.y/t+1)/2,c.push(p.x,p.y)}u+=d}for(let e=0;e<r;e++){const t=e*(n+1);for(let e=0;e<n;e++){const r=e+t,i=r,o=r+n+1,a=r+n+2,l=r+1;s.push(i,o,l),s.push(o,a,l)}}this.setIndex(s),this.setAttribute("position",new O_(a,3)),this.setAttribute("normal",new O_(l,3)),this.setAttribute("uv",new O_(c,2))}static fromJSON(e){return new IE(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class ME extends G_{constructor(e=new YA([new Iy(0,.5),new Iy(-.5,-.5),new Iy(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],r=[],i=[],o=[];let s=0,a=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(s,a,t),s+=a,a=0;function l(e){const s=r.length/3,l=e.extractPoints(t);let c=l.shape;const u=l.holes;!1===bE.isClockWise(c)&&(c=c.reverse());for(let e=0,t=u.length;e<t;e++){const t=u[e];!0===bE.isClockWise(t)&&(u[e]=t.reverse())}const d=bE.triangulateShape(c,u);for(let e=0,t=u.length;e<t;e++){const t=u[e];c=c.concat(t)}for(let e=0,t=c.length;e<t;e++){const t=c[e];r.push(t.x,t.y,0),i.push(0,0,1),o.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){const t=d[e],r=t[0]+s,i=t[1]+s,o=t[2]+s;n.push(r,i,o),a+=3}}this.setIndex(n),this.setAttribute("position",new O_(r,3)),this.setAttribute("normal",new O_(i,3)),this.setAttribute("uv",new O_(o,2))}toJSON(){const e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){const r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){const n=[];for(let r=0,i=e.shapes.length;r<i;r++){const i=t[e.shapes[r]];n.push(i)}return new ME(n,e.curveSegments)}}class RE extends G_{constructor(e=1,t=32,n=16,r=0,i=2*Math.PI,o=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:s},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const a=Math.min(o+s,Math.PI);let l=0;const c=[],u=new oS,d=new oS,h=[],p=[],m=[],f=[];for(let h=0;h<=n;h++){const g=[],v=h/n;let y=0;0==h&&0==o?y=.5/t:h==n&&a==Math.PI&&(y=-.5/t);for(let n=0;n<=t;n++){const a=n/t;u.x=-e*Math.cos(r+a*i)*Math.sin(o+v*s),u.y=e*Math.cos(o+v*s),u.z=e*Math.sin(r+a*i)*Math.sin(o+v*s),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),f.push(a+y,1-v),g.push(l++)}c.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){const t=c[e][r+1],i=c[e][r],s=c[e+1][r],l=c[e+1][r+1];(0!==e||o>0)&&h.push(t,i,l),(e!==n-1||a<Math.PI)&&h.push(i,s,l)}this.setIndex(h),this.setAttribute("position",new O_(p,3)),this.setAttribute("normal",new O_(m,3)),this.setAttribute("uv",new O_(f,2))}static fromJSON(e){return new RE(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class PE extends GA{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new PE(e.radius,e.detail)}}class NE extends G_{constructor(e=1,t=.4,n=8,r=6,i=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},n=Math.floor(n),r=Math.floor(r);const o=[],s=[],a=[],l=[],c=new oS,u=new oS,d=new oS;for(let o=0;o<=n;o++)for(let h=0;h<=r;h++){const p=h/r*i,m=o/n*Math.PI*2;u.x=(e+t*Math.cos(m))*Math.cos(p),u.y=(e+t*Math.cos(m))*Math.sin(p),u.z=t*Math.sin(m),s.push(u.x,u.y,u.z),c.x=e*Math.cos(p),c.y=e*Math.sin(p),d.subVectors(u,c).normalize(),a.push(d.x,d.y,d.z),l.push(h/r),l.push(o/n)}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){const n=(r+1)*e+t-1,i=(r+1)*(e-1)+t-1,s=(r+1)*(e-1)+t,a=(r+1)*e+t;o.push(n,i,a),o.push(i,s,a)}this.setIndex(o),this.setAttribute("position",new O_(s,3)),this.setAttribute("normal",new O_(a,3)),this.setAttribute("uv",new O_(l,2))}static fromJSON(e){return new NE(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class OE extends G_{constructor(e=1,t=.4,n=64,r=8,i=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:o},n=Math.floor(n),r=Math.floor(r);const s=[],a=[],l=[],c=[],u=new oS,d=new oS,h=new oS,p=new oS,m=new oS,f=new oS,g=new oS;for(let s=0;s<=n;++s){const y=s/n*i*Math.PI*2;v(y,i,o,e,h),v(y+.01,i,o,e,p),f.subVectors(p,h),g.addVectors(p,h),m.crossVectors(f,g),g.crossVectors(m,f),m.normalize(),g.normalize();for(let e=0;e<=r;++e){const i=e/r*Math.PI*2,o=-t*Math.cos(i),p=t*Math.sin(i);u.x=h.x+(o*g.x+p*m.x),u.y=h.y+(o*g.y+p*m.y),u.z=h.z+(o*g.z+p*m.z),a.push(u.x,u.y,u.z),d.subVectors(u,h).normalize(),l.push(d.x,d.y,d.z),c.push(s/n),c.push(e/r)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){const n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),o=(r+1)*e+t,a=(r+1)*(e-1)+t;s.push(n,i,a),s.push(i,o,a)}function v(e,t,n,r,i){const o=Math.cos(e),s=Math.sin(e),a=n/t*e,l=Math.cos(a);i.x=r*(2+l)*.5*o,i.y=r*(2+l)*s*.5,i.z=r*Math.sin(a)*.5}this.setIndex(s),this.setAttribute("position",new O_(a,3)),this.setAttribute("normal",new O_(l,3)),this.setAttribute("uv",new O_(c,2))}static fromJSON(e){return new OE(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class DE extends G_{constructor(e=new NA(new oS(-1,-1,0),new oS(-1,1,0),new oS(1,1,0)),t=64,n=1,r=8,i=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i};const o=e.computeFrenetFrames(t,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const s=new oS,a=new oS,l=new Iy;let c=new oS;const u=[],d=[],h=[],p=[];function m(i){c=e.getPointAt(i/t,c);const l=o.normals[i],h=o.binormals[i];for(let e=0;e<=r;e++){const t=e/r*Math.PI*2,i=Math.sin(t),o=-Math.cos(t);a.x=o*l.x+i*h.x,a.y=o*l.y+i*h.y,a.z=o*l.z+i*h.z,a.normalize(),d.push(a.x,a.y,a.z),s.x=c.x+n*a.x,s.y=c.y+n*a.y,s.z=c.z+n*a.z,u.push(s.x,s.y,s.z)}}!function(){for(let e=0;e<t;e++)m(e);m(!1===i?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=r;n++)l.x=e/t,l.y=n/r,h.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=r;t++){const n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),o=(r+1)*e+t,s=(r+1)*(e-1)+t;p.push(n,i,s),p.push(i,o,s)}}()}(),this.setIndex(p),this.setAttribute("position",new O_(u,3)),this.setAttribute("normal",new O_(d,3)),this.setAttribute("uv",new O_(h,2))}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new DE((new DA[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class kE extends G_{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],n=new Set,r=new oS,i=new oS;if(null!==e.index){const o=e.attributes.position,s=e.index;let a=e.groups;0===a.length&&(a=[{start:0,count:s.count,materialIndex:0}]);for(let e=0,l=a.length;e<l;++e){const l=a[e],c=l.start;for(let e=c,a=c+l.count;e<a;e+=3)for(let a=0;a<3;a++){const l=s.getX(e+a),c=s.getX(e+(a+1)%3);r.fromBufferAttribute(o,l),i.fromBufferAttribute(o,c),!0===LE(r,i,n)&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}}else{const o=e.attributes.position;for(let e=0,s=o.count/3;e<s;e++)for(let s=0;s<3;s++){const a=3*e+s,l=3*e+(s+1)%3;r.fromBufferAttribute(o,a),i.fromBufferAttribute(o,l),!0===LE(r,i,n)&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}this.setAttribute("position",new O_(t,3))}}}function LE(e,t,n){const r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return!0!==n.has(r)&&!0!==n.has(i)&&(n.add(r),n.add(i),!0)}var BE=Object.freeze({__proto__:null,BoxGeometry:lb,CapsuleGeometry:zA,CircleGeometry:FA,ConeGeometry:jA,CylinderGeometry:UA,DodecahedronGeometry:HA,EdgesGeometry:KA,ExtrudeGeometry:CE,IcosahedronGeometry:EE,LatheGeometry:BA,OctahedronGeometry:TE,PlaneGeometry:Ib,PolyhedronGeometry:GA,RingGeometry:IE,ShapeGeometry:ME,SphereGeometry:RE,TetrahedronGeometry:PE,TorusGeometry:NE,TorusKnotGeometry:OE,TubeGeometry:DE,WireframeGeometry:kE});class zE extends __{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Vy(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class FE extends hb{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class UE extends __{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Vy(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vy(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dv,this.normalScale=new Iy(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class jE extends UE{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Iy(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Sy(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Vy(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Vy(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Vy(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class GE extends __{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Vy(16777215),this.specular=new Vy(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vy(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dv,this.normalScale=new Iy(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Jf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class HE extends __{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Vy(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vy(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dv,this.normalScale=new Iy(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class VE extends __{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dv,this.normalScale=new Iy(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class WE extends __{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Vy(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Vy(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dv,this.normalScale=new Iy(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Jf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class qE extends __{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Vy(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Dv,this.normalScale=new Iy(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class JE extends JC{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function KE(e,t,n){return $E(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)}function YE(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function $E(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function XE(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n}function QE(e,t,n){const r=e.length,i=new e.constructor(r);for(let o=0,s=0;s!==r;++o){const r=n[o]*t;for(let n=0;n!==t;++n)i[s++]=e[r+n]}return i}function ZE(e,t,n,r){let i=1,o=e[0];for(;void 0!==o&&void 0===o[r];)o=e[i++];if(void 0===o)return;let s=o[r];if(void 0!==s)if(Array.isArray(s))do{s=o[r],void 0!==s&&(t.push(o.time),n.push.apply(n,s)),o=e[i++]}while(void 0!==o);else if(void 0!==s.toArray)do{s=o[r],void 0!==s&&(t.push(o.time),s.toArray(n,n.length)),o=e[i++]}while(void 0!==o);else do{s=o[r],void 0!==s&&(t.push(o.time),n.push(s)),o=e[i++]}while(void 0!==o)}var eT=Object.freeze({__proto__:null,arraySlice:KE,convertArray:YE,isTypedArray:$E,getKeyframeOrder:XE,sortedArray:QE,flattenJSON:ZE,subclip:function(e,t,n,r,i=30){const o=e.clone();o.name=t;const s=[];for(let e=0;e<o.tracks.length;++e){const t=o.tracks[e],a=t.getValueSize(),l=[],c=[];for(let e=0;e<t.times.length;++e){const o=t.times[e]*i;if(!(o<n||o>=r)){l.push(t.times[e]);for(let n=0;n<a;++n)c.push(t.values[e*a+n])}}0!==l.length&&(t.times=YE(l,t.times.constructor),t.values=YE(c,t.values.constructor),s.push(t))}o.tracks=s;let a=1/0;for(let e=0;e<o.tracks.length;++e)a>o.tracks[e].times[0]&&(a=o.tracks[e].times[0]);for(let e=0;e<o.tracks.length;++e)o.tracks[e].shift(-1*a);return o.resetDuration(),o},makeClipAdditive:function(e,t=0,n=e,r=30){r<=0&&(r=30);const i=n.tracks.length,o=t/r;for(let t=0;t<i;++t){const r=n.tracks[t],i=r.ValueTypeName;if("bool"===i||"string"===i)continue;const s=e.tracks.find((function(e){return e.name===r.name&&e.ValueTypeName===i}));if(void 0===s)continue;let a=0;const l=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let c=0;const u=s.getValueSize();s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=u/3);const d=r.times.length-1;let h;if(o<=r.times[0]){const e=a,t=l-a;h=KE(r.values,e,t)}else if(o>=r.times[d]){const e=d*l+a,t=e+l-a;h=KE(r.values,e,t)}else{const e=r.createInterpolant(),t=a,n=l-a;e.evaluate(o),h=KE(e.resultBuffer,t,n)}if("quaternion"===i){(new iS).fromArray(h).normalize().conjugate().toArray(h)}const p=s.times.length;for(let e=0;e<p;++e){const t=e*u+c;if("quaternion"===i)iS.multiplyQuaternionsFlat(s.values,t,h,0,s.values,t);else{const e=u-2*c;for(let n=0;n<e;++n)s.values[t+n]-=h[n]}}}return e.blendMode=Ev,e}});class tT{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{let o;n:{r:if(!(e<r)){for(let o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(i=r,r=t[++n],e<r)break t}o=t.length;break n}if(e>=i)break e;{const s=t[1];e<s&&(n=2,i=s);for(let o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.copySampleValue_(0);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break t}o=n,n=0}}for(;n<o;){const r=n+o>>>1;e<t[r]?o=r:n=r+1}if(r=t[n],i=t[n-1],void 0===i)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class nT extends tT{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:xv,endingEnd:xv}}intervalChanged_(e,t,n){const r=this.parameterPositions;let i=e-2,o=e+1,s=r[i],a=r[o];if(void 0===s)switch(this.getSettings_().endingStart){case wv:i=e,s=2*t-n;break;case Cv:i=r.length-2,s=t+r[i]-r[i+1];break;default:i=e,s=n}if(void 0===a)switch(this.getSettings_().endingEnd){case wv:o=e,a=2*n-t;break;case Cv:o=1,a=n+r[1]-r[0];break;default:o=e-1,a=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(a-n),this._offsetPrev=i*c,this._offsetNext=o*c}interpolate_(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=e*s,l=a-s,c=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,h=this._weightNext,p=(n-t)/(r-t),m=p*p,f=m*p,g=-d*f+2*d*m-d*p,v=(1+d)*f+(-1.5-2*d)*m+(-.5+d)*p+1,y=(-1-h)*f+(1.5+h)*m+.5*p,S=h*f-h*m;for(let e=0;e!==s;++e)i[e]=g*o[c+e]+v*o[l+e]+y*o[a+e]+S*o[u+e];return i}}class rT extends tT{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=e*s,l=a-s,c=(n-t)/(r-t),u=1-c;for(let e=0;e!==s;++e)i[e]=o[l+e]*u+o[a+e]*c;return i}}class iT extends tT{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class oT{constructor(e,t,n,r){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=YE(t,this.TimeBufferType),this.values=YE(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:YE(e.times,Array),values:YE(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new iT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new rT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new nT(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Sv:t=this.InterpolantFactoryMethodDiscrete;break;case _v:t=this.InterpolantFactoryMethodLinear;break;case bv:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Sv;case this.InterpolantFactoryMethodLinear:return _v;case this.InterpolantFactoryMethodSmooth:return bv}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){const n=this.times,r=n.length;let i=0,o=r-1;for(;i!==r&&n[i]<e;)++i;for(;-1!==o&&n[o]>t;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);const e=this.getValueSize();this.times=KE(n,i,o),this.values=KE(this.values,i*e,o*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let t=0;t!==i;t++){const r=n[t];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,r),e=!1;break}if(null!==o&&o>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,r,o),e=!1;break}o=r}if(void 0!==r&&$E(r))for(let t=0,n=r.length;t!==n;++t){const n=r[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=KE(this.times),t=KE(this.values),n=this.getValueSize(),r=this.getInterpolation()===bv,i=e.length-1;let o=1;for(let s=1;s<i;++s){let i=!1;const a=e[s];if(a!==e[s+1]&&(1!==s||a!==e[0]))if(r)i=!0;else{const e=s*n,r=e-n,o=e+n;for(let s=0;s!==n;++s){const n=t[e+s];if(n!==t[r+s]||n!==t[o+s]){i=!0;break}}}if(i){if(s!==o){e[o]=e[s];const r=s*n,i=o*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++o}}if(i>0){e[o]=e[i];for(let e=i*n,r=o*n,s=0;s!==n;++s)t[r+s]=t[e+s];++o}return o!==e.length?(this.times=KE(e,0,o),this.values=KE(t,0,o*n)):(this.times=e,this.values=t),this}clone(){const e=KE(this.times,0),t=KE(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}oT.prototype.TimeBufferType=Float32Array,oT.prototype.ValueBufferType=Float32Array,oT.prototype.DefaultInterpolation=_v;class sT extends oT{}sT.prototype.ValueTypeName="bool",sT.prototype.ValueBufferType=Array,sT.prototype.DefaultInterpolation=Sv,sT.prototype.InterpolantFactoryMethodLinear=void 0,sT.prototype.InterpolantFactoryMethodSmooth=void 0;class aT extends oT{}aT.prototype.ValueTypeName="color";class lT extends oT{}lT.prototype.ValueTypeName="number";class cT extends tT{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(n-t)/(r-t);let l=e*s;for(let e=l+s;l!==e;l+=4)iS.slerpFlat(i,0,o,l-s,o,l,a);return i}}class uT extends oT{InterpolantFactoryMethodLinear(e){return new cT(this.times,this.values,this.getValueSize(),e)}}uT.prototype.ValueTypeName="quaternion",uT.prototype.DefaultInterpolation=_v,uT.prototype.InterpolantFactoryMethodSmooth=void 0;class dT extends oT{}dT.prototype.ValueTypeName="string",dT.prototype.ValueBufferType=Array,dT.prototype.DefaultInterpolation=Sv,dT.prototype.InterpolantFactoryMethodLinear=void 0,dT.prototype.InterpolantFactoryMethodSmooth=void 0;class hT extends oT{}hT.prototype.ValueTypeName="vector";class pT{constructor(e,t=-1,n,r=Av){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=yy(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(mT(n[e]).scale(r));const i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=n.length;e!==r;++e)t.push(oT.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const i=t.length,o=[];for(let e=0;e<i;e++){let s=[],a=[];s.push((e+i-1)%i,e,(e+1)%i),a.push(0,1,0);const l=XE(s);s=QE(s,1,l),a=QE(a,1,l),r||0!==s[0]||(s.push(i),a.push(a[0])),o.push(new lT(".morphTargetInfluences["+t[e].name+"]",s,a).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},i=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],o=n.name.match(i);if(o&&o.length>1){const e=o[1];let t=r[e];t||(r[e]=t=[]),t.push(n)}}const o=[];for(const e in r)o.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,r,i){if(0!==n.length){const o=[],s=[];ZE(n,o,s,r),0!==o.length&&i.push(new e(t,o,s))}},r=[],i=e.name||"default",o=e.fps||30,s=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const i=l[e].keys;if(i&&0!==i.length)if(i[0].morphTargets){const e={};let t;for(t=0;t<i.length;t++)if(i[t].morphTargets)for(let n=0;n<i[t].morphTargets.length;n++)e[i[t].morphTargets[n]]=-1;for(const n in e){const e=[],o=[];for(let r=0;r!==i[t].morphTargets.length;++r){const r=i[t];e.push(r.time),o.push(r.morphTarget===n?1:0)}r.push(new lT(".morphTargetInfluence["+n+"]",e,o))}a=e.length*o}else{const o=".bones["+t[e].name+"]";n(hT,o+".position",i,"pos",r),n(uT,o+".quaternion",i,"rot",r),n(hT,o+".scale",i,"scl",r)}}if(0===r.length)return null;return new this(i,a,r,s)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function mT(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return lT;case"vector":case"vector2":case"vector3":case"vector4":return hT;case"color":return aT;case"quaternion":return uT;case"bool":case"boolean":return sT;case"string":return dT}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];ZE(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const fT={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class gT{constructor(e,t,n){const r=this;let i,o=!1,s=0,a=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===o&&void 0!==r.onStart&&r.onStart(e,s,a),o=!0},this.itemEnd=function(e){s++,void 0!==r.onProgress&&r.onProgress(e,s,a),s===a&&(o=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return i?i(e):e},this.setURLModifier=function(e){return i=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],r=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null}}}const vT=new gT;class yT{constructor(e){this.manager=void 0!==e?e:vT,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const ST={};class _T extends Error{constructor(e,t){super(e),this.response=t}}class bT extends yT{constructor(e){super(e)}load(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=fT.get(e);if(void 0!==i)return this.manager.itemStart(e),setTimeout((()=>{t&&t(i),this.manager.itemEnd(e)}),0),i;if(void 0!==ST[e])return void ST[e].push({onLoad:t,onProgress:n,onError:r});ST[e]=[],ST[e].push({onLoad:t,onProgress:n,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,a=this.responseType;fetch(o).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=ST[e],r=t.body.getReader(),i=t.headers.get("Content-Length"),o=i?parseInt(i):0,s=0!==o;let a=0;const l=new ReadableStream({start(e){!function t(){r.read().then((({done:r,value:i})=>{if(r)e.close();else{a+=i.byteLength;const r=new ProgressEvent("progress",{lengthComputable:s,loaded:a,total:o});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(r)}e.enqueue(i),t()}}))}()}});return new Response(l)}throw new _T(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)})).then((e=>{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,s)));case"json":return e.json();default:if(void 0===s)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then((e=>r.decode(e)))}}})).then((t=>{fT.add(e,t);const n=ST[e];delete ST[e];for(let e=0,r=n.length;e<r;e++){const r=n[e];r.onLoad&&r.onLoad(t)}})).catch((t=>{const n=ST[e];if(void 0===n)throw this.manager.itemError(e),t;delete ST[e];for(let e=0,r=n.length;e<r;e++){const r=n[e];r.onError&&r.onError(t)}this.manager.itemError(e)})).finally((()=>{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class xT extends yT{constructor(e){super(e)}load(e,t,n,r){const i=this,o=new bT(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}parse(e){const t=[];for(let n=0;n<e.length;n++){const r=pT.parse(e[n]);t.push(r)}return t}}class wT extends yT{constructor(e){super(e)}load(e,t,n,r){const i=this,o=[],s=new pA,a=new bT(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(i.withCredentials);let l=0;function c(c){a.load(e[c],(function(e){const n=i.parse(e,!0);o[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(s.minFilter=gg),s.image=o,s.format=n.format,s.needsUpdate=!0,t&&t(s))}),n,r)}if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)c(t);else a.load(e,(function(e){const n=i.parse(e,!0);if(n.isCubemap){const e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){o[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)o[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),o[t].format=n.format,o[t].width=n.width,o[t].height=n.height}s.image=o}else s.image.width=n.width,s.image.height=n.height,s.mipmaps=n.mipmaps;1===n.mipmapCount&&(s.minFilter=gg),s.format=n.format,s.needsUpdate=!0,t&&t(s)}),n,r);return s}}class CT extends yT{constructor(e){super(e)}load(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,o=fT.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;const s=Oy("img");function a(){c(),fT.add(e,this),t&&t(this),i.manager.itemEnd(e)}function l(t){c(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function c(){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",a,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),i.manager.itemStart(e),s.src=e,s}}class AT extends yT{constructor(e){super(e)}load(e,t,n,r){const i=new vb,o=new CT(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let s=0;function a(n){o.load(e[n],(function(e){i.images[n]=e,s++,6===s&&(i.needsUpdate=!0,t&&t(i))}),void 0,r)}for(let t=0;t<e.length;++t)a(t);return i}}class ET extends yT{constructor(e){super(e)}load(e,t,n,r){const i=this,o=new BC,s=new bT(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(i.withCredentials),s.load(e,(function(e){const n=i.parse(e);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:cg,o.wrapT=void 0!==n.wrapT?n.wrapT:cg,o.magFilter=void 0!==n.magFilter?n.magFilter:gg,o.minFilter=void 0!==n.minFilter?n.minFilter:gg,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(o.encoding=n.encoding),void 0!==n.flipY&&(o.flipY=n.flipY),void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps,o.minFilter=Sg),1===n.mipmapCount&&(o.minFilter=gg),void 0!==n.generateMipmaps&&(o.generateMipmaps=n.generateMipmaps),o.needsUpdate=!0,t&&t(o,n))}),n,r),o}}class TT extends yT{constructor(e){super(e)}load(e,t,n,r){const i=new $y,o=new CT(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,(function(e){i.image=e,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}class IT extends a_{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Vy(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}class MT extends IT{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(a_.DefaultUp),this.updateMatrix(),this.groundColor=new Vy(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const RT=new LS,PT=new oS,NT=new oS;class OT{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Iy(512,512),this.map=null,this.mapPass=null,this.matrix=new LS,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ab,this._frameExtents=new Iy(1,1),this._viewportCount=1,this._viewports=[new Xy(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;PT.setFromMatrixPosition(e.matrixWorld),t.position.copy(PT),NT.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(NT),t.updateMatrixWorld(),RT.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(RT),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class DT extends OT{constructor(){super(new mb(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*vy*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;n===t.fov&&r===t.aspect&&i===t.far||(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class kT extends IT{constructor(e,t,n=0,r=Math.PI/3,i=0,o=1){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(a_.DefaultUp),this.updateMatrix(),this.target=new a_,this.distance=n,this.angle=r,this.penumbra=i,this.decay=o,this.map=null,this.shadow=new DT}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const LT=new LS,BT=new oS,zT=new oS;class FT extends OT{constructor(){super(new mb(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Iy(4,2),this._viewportCount=6,this._viewports=[new Xy(2,1,1,1),new Xy(0,1,1,1),new Xy(3,1,1,1),new Xy(1,1,1,1),new Xy(3,0,1,1),new Xy(1,0,1,1)],this._cubeDirections=[new oS(1,0,0),new oS(-1,0,0),new oS(0,0,1),new oS(0,0,-1),new oS(0,1,0),new oS(0,-1,0)],this._cubeUps=[new oS(0,1,0),new oS(0,1,0),new oS(0,1,0),new oS(0,1,0),new oS(0,0,1),new oS(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),BT.setFromMatrixPosition(e.matrixWorld),n.position.copy(BT),zT.copy(n.position),zT.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(zT),n.updateMatrixWorld(),r.makeTranslation(-BT.x,-BT.y,-BT.z),LT.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(LT)}}class UT extends IT{constructor(e,t,n=0,r=1){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new FT}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class jT extends OT{constructor(){super(new zb(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class GT extends IT{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(a_.DefaultUp),this.updateMatrix(),this.target=new a_,this.shadow=new jT}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class HT extends IT{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class VT extends IT{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class WT{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new oS)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,r=e.y,i=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*i),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],n*r*1.092548),t.addScaledVector(o[5],r*i*1.092548),t.addScaledVector(o[6],.315392*(3*i*i-1)),t.addScaledVector(o[7],n*i*1.092548),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){const n=e.x,r=e.y,i=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],1.023328*r),t.addScaledVector(o[2],1.023328*i),t.addScaledVector(o[3],1.023328*n),t.addScaledVector(o[4],.858086*n*r),t.addScaledVector(o[5],.858086*r*i),t.addScaledVector(o[6],.743125*i*i-.247708),t.addScaledVector(o[7],.858086*n*i),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+3*r);return this}toArray(e=[],t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+3*r);return e}static getBasisAt(e,t){const n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}}class qT extends IT{constructor(e=new WT,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class JT extends yT{constructor(e){super(e),this.textures={}}load(e,t,n,r){const i=this,o=new bT(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}parse(e){const t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}const r=JT.createMaterialFromType(e.type);if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&void 0!==r.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.sheen&&(r.sheen=e.sheen),void 0!==e.sheenColor&&(r.sheenColor=(new Vy).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(r.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==r.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==r.specular&&r.specular.setHex(e.specular),void 0!==e.specularIntensity&&(r.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==r.specularColor&&r.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearcoat&&(r.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(r.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.iridescence&&(r.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(r.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(r.transmission=e.transmission),void 0!==e.thickness&&(r.thickness=e.thickness),void 0!==e.attenuationDistance&&(r.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==r.attenuationColor&&r.attenuationColor.setHex(e.attenuationColor),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.shadowSide&&(r.shadowSide=e.shadowSide),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(r.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(r.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(r.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(r.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(r.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(r.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(r.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(r.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),1!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.alphaToCoverage&&(r.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(r.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.toneMapped&&(r.toneMapped=e.toneMapped),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const t in e.uniforms){const i=e.uniforms[t];switch(r.uniforms[t]={},i.type){case"t":r.uniforms[t].value=n(i.value);break;case"c":r.uniforms[t].value=(new Vy).setHex(i.value);break;case"v2":r.uniforms[t].value=(new Iy).fromArray(i.value);break;case"v3":r.uniforms[t].value=(new oS).fromArray(i.value);break;case"v4":r.uniforms[t].value=(new Xy).fromArray(i.value);break;case"m3":r.uniforms[t].value=(new My).fromArray(i.value);break;case"m4":r.uniforms[t].value=(new LS).fromArray(i.value);break;default:r.uniforms[t].value=i.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(r.glslVersion=e.glslVersion),void 0!==e.extensions)for(const t in e.extensions)r.extensions[t]=e.extensions[t];if(void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.matcap&&(r.matcap=n(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),r.normalScale=(new Iy).fromArray(t)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(r.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(r.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=(new Iy).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(r.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(r.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(r.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(r.thicknessMap=n(e.thicknessMap)),void 0!==e.sheenColorMap&&(r.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(r.sheenRoughnessMap=n(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){return new{ShadowMaterial:zE,SpriteMaterial:dC,RawShaderMaterial:FE,ShaderMaterial:hb,PointsMaterial:iA,MeshPhysicalMaterial:jE,MeshStandardMaterial:UE,MeshPhongMaterial:GE,MeshToonMaterial:HE,MeshNormalMaterial:VE,MeshLambertMaterial:WE,MeshDepthMaterial:Hw,MeshDistanceMaterial:Vw,MeshBasicMaterial:b_,MeshMatcapMaterial:qE,LineDashedMaterial:JE,LineBasicMaterial:JC,Material:__}[e]}}class KT{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class YT extends G_{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class $T extends yT{constructor(e){super(e)}load(e,t,n,r){const i=this,o=new bT(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{t(i.parse(JSON.parse(n)))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}parse(e){const t={},n={};function r(e,r){if(void 0!==t[r])return t[r];const i=e.interleavedBuffers[r],o=function(e,t){if(void 0!==n[t])return n[t];const r=e.arrayBuffers,i=r[t],o=new Uint32Array(i).buffer;return n[t]=o,o}(e,i.buffer),s=Ny(i.type,o),a=new lC(s,i.stride);return a.uuid=i.uuid,t[r]=a,a}const i=e.isInstancedBufferGeometry?new YT:new G_,o=e.data.index;if(void 0!==o){const e=Ny(o.type,o.array);i.setIndex(new C_(e,1))}const s=e.data.attributes;for(const t in s){const n=s[t];let o;if(n.isInterleavedBufferAttribute){const t=r(e.data,n.data);o=new uC(t,n.itemSize,n.offset,n.normalized)}else{const e=Ny(n.type,n.array);o=new(n.isInstancedBufferAttribute?jC:C_)(e,n.itemSize,n.normalized)}void 0!==n.name&&(o.name=n.name),void 0!==n.usage&&o.setUsage(n.usage),void 0!==n.updateRange&&(o.updateRange.offset=n.updateRange.offset,o.updateRange.count=n.updateRange.count),i.setAttribute(t,o)}const a=e.data.morphAttributes;if(a)for(const t in a){const n=a[t],o=[];for(let t=0,i=n.length;t<i;t++){const i=n[t];let s;if(i.isInterleavedBufferAttribute){const t=r(e.data,i.data);s=new uC(t,i.itemSize,i.offset,i.normalized)}else{const e=Ny(i.type,i.array);s=new C_(e,i.itemSize,i.normalized)}void 0!==i.name&&(s.name=i.name),o.push(s)}i.morphAttributes[t]=o}e.data.morphTargetsRelative&&(i.morphTargetsRelative=!0);const l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){const t=l[e];i.addGroup(t.start,t.count,t.materialIndex)}const c=e.data.boundingSphere;if(void 0!==c){const e=new oS;void 0!==c.center&&e.fromArray(c.center),i.boundingSphere=new TS(e,c.radius)}return e.name&&(i.name=e.name),e.userData&&(i.userData=e.userData),i}}class XT extends yT{constructor(e){super(e)}load(e,t,n,r){const i=this,o=""===this.path?KT.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const s=new bT(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){let o=null;try{o=JSON.parse(n)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}const s=o.metadata;void 0!==s&&void 0!==s.type&&"geometry"!==s.type.toLowerCase()?i.parse(o,t):console.error("THREE.ObjectLoader: Can't load "+e)}),n,r)}async loadAsync(e,t){const n=""===this.path?KT.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||n;const r=new bT(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const i=await r.loadAsync(e,t),o=JSON.parse(i),s=o.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(o)}parse(e,t){const n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,(function(){void 0!==t&&t(l)})),s=this.parseTextures(e.textures,o),a=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,i,a,s,n),c=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,c),void 0!==t){let e=!1;for(const t in o)if(o[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,n),i=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,i),s=this.parseMaterials(e.materials,o),a=this.parseObject(e.object,r,s,o,t),l=this.parseSkeletons(e.skeletons,a);return this.bindSkeletons(a,l),a}parseShapes(e){const t={};if(void 0!==e)for(let n=0,r=e.length;n<r;n++){const r=(new YA).fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},r={};if(t.traverse((function(e){e.isBone&&(r[e.uuid]=e)})),void 0!==e)for(let t=0,i=e.length;t<i;t++){const i=(new UC).fromJSON(e[t],r);n[i.uuid]=i}return n}parseGeometries(e,t){const n={};if(void 0!==e){const r=new $T;for(let i=0,o=e.length;i<o;i++){let o;const s=e[i];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(s);break;default:s.type in BE?o=BE[s.type].fromJSON(s,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${s.type}"`)}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}}return n}parseMaterials(e,t){const n={},r={};if(void 0!==e){const i=new JT;i.setTextures(t);for(let t=0,o=e.length;t<o;t++){const o=e[t];void 0===n[o.uuid]&&(n[o.uuid]=i.parse(o)),r[o.uuid]=n[o.uuid]}}return r}parseAnimations(e){const t={};if(void 0!==e)for(let n=0;n<e.length;n++){const r=e[n],i=pT.parse(r);t[i.uuid]=i}return t}parseImages(e,t){const n=this,r={};let i;function o(e){if("string"==typeof e){const t=e;return function(e){return n.manager.itemStart(e),i.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:Ny(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){const n=new gT(t);i=new CT(n),i.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){const n=e[t],i=n.url;if(Array.isArray(i)){const e=[];for(let t=0,n=i.length;t<n;t++){const n=o(i[t]);null!==n&&(n instanceof HTMLImageElement?e.push(n):e.push(new BC(n.data,n.width,n.height)))}r[n.uuid]=new Jy(e)}else{const e=o(n.url);r[n.uuid]=new Jy(e)}}}return r}async parseImagesAsync(e){const t=this,n={};let r;async function i(e){if("string"==typeof e){const n=e,i=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:t.resourcePath+n;return await r.loadAsync(i)}return e.data?{data:Ny(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){r=new CT(this.manager),r.setCrossOrigin(this.crossOrigin);for(let t=0,r=e.length;t<r;t++){const r=e[t],o=r.url;if(Array.isArray(o)){const e=[];for(let t=0,n=o.length;t<n;t++){const n=o[t],r=await i(n);null!==r&&(r instanceof HTMLImageElement?e.push(r):e.push(new BC(r.data,r.width,r.height)))}n[r.uuid]=new Jy(e)}else{const e=await i(r.url);n[r.uuid]=new Jy(e)}}}return n}parseTextures(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}const r={};if(void 0!==e)for(let i=0,o=e.length;i<o;i++){const o=e[i];void 0===o.image&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),void 0===t[o.image]&&console.warn("THREE.ObjectLoader: Undefined image",o.image);const s=t[o.image],a=s.data;let l;Array.isArray(a)?(l=new vb,6===a.length&&(l.needsUpdate=!0)):(l=a&&a.data?new BC:new $y,a&&(l.needsUpdate=!0)),l.source=s,l.uuid=o.uuid,void 0!==o.name&&(l.name=o.name),void 0!==o.mapping&&(l.mapping=n(o.mapping,QT)),void 0!==o.offset&&l.offset.fromArray(o.offset),void 0!==o.repeat&&l.repeat.fromArray(o.repeat),void 0!==o.center&&l.center.fromArray(o.center),void 0!==o.rotation&&(l.rotation=o.rotation),void 0!==o.wrap&&(l.wrapS=n(o.wrap[0],ZT),l.wrapT=n(o.wrap[1],ZT)),void 0!==o.format&&(l.format=o.format),void 0!==o.type&&(l.type=o.type),void 0!==o.encoding&&(l.encoding=o.encoding),void 0!==o.minFilter&&(l.minFilter=n(o.minFilter,eI)),void 0!==o.magFilter&&(l.magFilter=n(o.magFilter,eI)),void 0!==o.anisotropy&&(l.anisotropy=o.anisotropy),void 0!==o.flipY&&(l.flipY=o.flipY),void 0!==o.premultiplyAlpha&&(l.premultiplyAlpha=o.premultiplyAlpha),void 0!==o.unpackAlignment&&(l.unpackAlignment=o.unpackAlignment),void 0!==o.userData&&(l.userData=o.userData),r[o.uuid]=l}return r}parseObject(e,t,n,r,i){let o,s,a;function l(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function c(e){if(void 0!==e){if(Array.isArray(e)){const t=[];for(let r=0,i=e.length;r<i;r++){const i=e[r];void 0===n[i]&&console.warn("THREE.ObjectLoader: Undefined material",i),t.push(n[i])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}function u(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),r[e]}switch(e.type){case"Scene":o=new aC,void 0!==e.background&&(Number.isInteger(e.background)?o.background=new Vy(e.background):o.background=u(e.background)),void 0!==e.environment&&(o.environment=u(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?o.fog=new sC(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(o.fog=new oC(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":o=new mb(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(o.focus=e.focus),void 0!==e.zoom&&(o.zoom=e.zoom),void 0!==e.filmGauge&&(o.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(o.filmOffset=e.filmOffset),void 0!==e.view&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new zb(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(o.zoom=e.zoom),void 0!==e.view&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new HT(e.color,e.intensity);break;case"DirectionalLight":o=new GT(e.color,e.intensity);break;case"PointLight":o=new UT(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new VT(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new kT(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new MT(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=(new qT).fromJSON(e);break;case"SkinnedMesh":s=l(e.geometry),a=c(e.material),o=new kC(s,a),void 0!==e.bindMode&&(o.bindMode=e.bindMode),void 0!==e.bindMatrix&&o.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(o.skeleton=e.skeleton);break;case"Mesh":s=l(e.geometry),a=c(e.material),o=new sb(s,a);break;case"InstancedMesh":s=l(e.geometry),a=c(e.material);const t=e.count,n=e.instanceMatrix,r=e.instanceColor;o=new qC(s,a,t),o.instanceMatrix=new jC(new Float32Array(n.array),16),void 0!==r&&(o.instanceColor=new jC(new Float32Array(r.array),r.itemSize));break;case"LOD":o=new MC;break;case"Line":o=new ZC(l(e.geometry),c(e.material));break;case"LineLoop":o=new rA(l(e.geometry),c(e.material));break;case"LineSegments":o=new nA(l(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new cA(l(e.geometry),c(e.material));break;case"Sprite":o=new AC(c(e.material));break;case"Group":o=new $w;break;case"Bone":o=new LC;break;default:o=new a_}if(o.uuid=e.uuid,void 0!==e.name&&(o.name=e.name),void 0!==e.matrix?(o.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(void 0!==e.position&&o.position.fromArray(e.position),void 0!==e.rotation&&o.rotation.fromArray(e.rotation),void 0!==e.quaternion&&o.quaternion.fromArray(e.quaternion),void 0!==e.scale&&o.scale.fromArray(e.scale)),void 0!==e.castShadow&&(o.castShadow=e.castShadow),void 0!==e.receiveShadow&&(o.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(o.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(o.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(o.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&o.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(o.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(o.visible=e.visible),void 0!==e.frustumCulled&&(o.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(o.renderOrder=e.renderOrder),void 0!==e.userData&&(o.userData=e.userData),void 0!==e.layers&&(o.layers.mask=e.layers),void 0!==e.children){const s=e.children;for(let e=0;e<s.length;e++)o.add(this.parseObject(s[e],t,n,r,i))}if(void 0!==e.animations){const t=e.animations;for(let e=0;e<t.length;e++){const n=t[e];o.animations.push(i[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(o.autoUpdate=e.autoUpdate);const t=e.levels;for(let e=0;e<t.length;e++){const n=t[e],r=o.getObjectByProperty("uuid",n.object);void 0!==r&&o.addLevel(r,n.distance)}}return o}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse((function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){const n=t[e.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}}))}}const QT={UVMapping:ng,CubeReflectionMapping:rg,CubeRefractionMapping:ig,EquirectangularReflectionMapping:og,EquirectangularRefractionMapping:sg,CubeUVReflectionMapping:ag},ZT={RepeatWrapping:lg,ClampToEdgeWrapping:cg,MirroredRepeatWrapping:ug},eI={NearestFilter:dg,NearestMipmapNearestFilter:hg,NearestMipmapLinearFilter:mg,LinearFilter:gg,LinearMipmapNearestFilter:vg,LinearMipmapLinearFilter:Sg};class tI extends yT{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const i=this,o=fT.get(e);if(void 0!==o)return i.manager.itemStart(e),setTimeout((function(){t&&t(o),i.manager.itemEnd(e)}),0),o;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(e,s).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){fT.add(e,n),t&&t(n),i.manager.itemEnd(e)})).catch((function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}let nI;const rI={getContext:function(){return void 0===nI&&(nI=new(window.AudioContext||window.webkitAudioContext)),nI},setContext:function(e){nI=e}};class iI extends yT{constructor(e){super(e)}load(e,t,n,r){const i=this,o=new bT(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){try{const e=n.slice(0);rI.getContext().decodeAudioData(e,(function(e){t(e)}))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}}class oI extends qT{constructor(e,t,n=1){super(void 0,n),this.isHemisphereLightProbe=!0;const r=(new Vy).set(e),i=(new Vy).set(t),o=new oS(r.r,r.g,r.b),s=new oS(i.r,i.g,i.b),a=Math.sqrt(Math.PI),l=a*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(s).multiplyScalar(a),this.sh.coefficients[1].copy(o).sub(s).multiplyScalar(l)}}class sI extends qT{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const n=(new Vy).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const aI=new LS,lI=new LS,cI=new LS;class uI{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new mb,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new mb,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,cI.copy(e.projectionMatrix);const n=t.eyeSep/2,r=n*t.near/t.focus,i=t.near*Math.tan(gy*t.fov*.5)/t.zoom;let o,s;lI.elements[12]=-n,aI.elements[12]=n,o=-i*t.aspect+r,s=i*t.aspect+r,cI.elements[0]=2*t.near/(s-o),cI.elements[8]=(s+o)/(s-o),this.cameraL.projectionMatrix.copy(cI),o=-i*t.aspect-r,s=i*t.aspect-r,cI.elements[0]=2*t.near/(s-o),cI.elements[8]=(s+o)/(s-o),this.cameraR.projectionMatrix.copy(cI)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(lI),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(aI)}}class dI{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=hI(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=hI();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function hI(){return("undefined"==typeof performance?Date:performance).now()}const pI=new oS,mI=new iS,fI=new oS,gI=new oS;class vI extends a_{constructor(){super(),this.type="AudioListener",this.context=rI.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new dI}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(pI,mI,fI),gI.set(0,0,-1).applyQuaternion(mI),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(pI.x,e),t.positionY.linearRampToValueAtTime(pI.y,e),t.positionZ.linearRampToValueAtTime(pI.z,e),t.forwardX.linearRampToValueAtTime(gI.x,e),t.forwardY.linearRampToValueAtTime(gI.y,e),t.forwardZ.linearRampToValueAtTime(gI.z,e),t.upX.linearRampToValueAtTime(n.x,e),t.upY.linearRampToValueAtTime(n.y,e),t.upZ.linearRampToValueAtTime(n.z,e)}else t.setPosition(pI.x,pI.y,pI.z),t.setOrientation(gI.x,gI.y,gI.z,n.x,n.y,n.z)}}class yI extends a_{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const SI=new oS,_I=new iS,bI=new oS,xI=new oS;class wI extends yI{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(SI,_I,bI),xI.set(0,0,1).applyQuaternion(_I);const t=this.panner;if(t.positionX){const e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(SI.x,e),t.positionY.linearRampToValueAtTime(SI.y,e),t.positionZ.linearRampToValueAtTime(SI.z,e),t.orientationX.linearRampToValueAtTime(xI.x,e),t.orientationY.linearRampToValueAtTime(xI.y,e),t.orientationZ.linearRampToValueAtTime(xI.z,e)}else t.setPosition(SI.x,SI.y,SI.z),t.setOrientation(xI.x,xI.y,xI.z)}}class CI{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class AI{constructor(e,t,n){let r,i,o;switch(this.binding=e,this.valueSize=n,t){case"quaternion":r=this._slerp,i=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,r=this.valueSize,i=e*r+r;let o=this.cumulativeWeight;if(0===o){for(let e=0;e!==r;++e)n[i+e]=n[e];o=t}else{o+=t;const e=t/o;this._mixBufferRegion(n,i,0,e,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,o=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){const e=t*this._origIndex;this._mixBufferRegion(n,r,e,1-i,t)}o>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let e=t,i=t+t;e!==i;++e)if(n[e]!==n[e+t]){s.setValue(n,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let e=n,i=r;e!==i;++e)t[e]=t[r+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,r,i){if(r>=.5)for(let r=0;r!==i;++r)e[t+r]=e[n+r]}_slerp(e,t,n,r){iS.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,i){const o=this._workIndex*i;iS.multiplyQuaternionsFlat(e,o,e,t,e,n),iS.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,n,r,i){const o=1-r;for(let s=0;s!==i;++s){const i=t+s;e[i]=e[i]*o+e[n+s]*r}}_lerpAdditive(e,t,n,r,i){for(let o=0;o!==i;++o){const i=t+o;e[i]=e[i]+e[n+o]*r}}}const EI="\\[\\]\\.:\\/",TI=new RegExp("["+EI+"]","g"),II="[^"+EI+"]",MI="[^"+EI.replace("\\.","")+"]",RI=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",II)+/(WCOD+)?/.source.replace("WCOD",MI)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",II)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",II)+"$"),PI=["material","materials","bones","map"];class NI{constructor(e,t,n){this.path=t,this.parsedPath=n||NI.parseTrackName(t),this.node=NI.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new NI.Composite(e,t,n):new NI(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(TI,"")}static parseTrackName(e){const t=RI.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const e=n.nodeName.substring(r+1);-1!==PI.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let r=0;r<e.length;r++){const i=e[r];if(i.name===t||i.uuid===t)return i;const o=n(i.children);if(o)return o}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,r=t.propertyName;let i=t.propertyIndex;if(e||(e=NI.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let r=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===r){r=t;break}break;case"map":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==r){if(void 0===e[r])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[r]}}const o=e[r];if(void 0===o){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+r+" but it wasn't found.",e)}let s=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[i]&&(i=e.morphTargetDictionary[i])}a=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=i}else void 0!==o.fromArray&&void 0!==o.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(a=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}NI.Composite=class{constructor(e,t,n){const r=n||NI.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},NI.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},NI.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},NI.prototype.GetterByBindingType=[NI.prototype._getValue_direct,NI.prototype._getValue_array,NI.prototype._getValue_arrayElement,NI.prototype._getValue_toArray],NI.prototype.SetterByBindingTypeAndVersioning=[[NI.prototype._setValue_direct,NI.prototype._setValue_direct_setNeedsUpdate,NI.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[NI.prototype._setValue_array,NI.prototype._setValue_array_setNeedsUpdate,NI.prototype._setValue_array_setMatrixWorldNeedsUpdate],[NI.prototype._setValue_arrayElement,NI.prototype._setValue_arrayElement_setNeedsUpdate,NI.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[NI.prototype._setValue_fromArray,NI.prototype._setValue_fromArray_setNeedsUpdate,NI.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class OI{constructor(){this.isAnimationObjectGroup=!0,this.uuid=yy(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,o=i.length;let s,a=e.length,l=this.nCachedObjects_;for(let c=0,u=arguments.length;c!==u;++c){const u=arguments[c],d=u.uuid;let h=t[d];if(void 0===h){h=a++,t[d]=h,e.push(u);for(let e=0,t=o;e!==t;++e)i[e].push(new NI(u,n[e],r[e]))}else if(h<l){s=e[h];const a=--l,c=e[a];t[c.uuid]=h,e[h]=c,t[d]=a,e[a]=u;for(let e=0,t=o;e!==t;++e){const t=i[e],o=t[a];let s=t[h];t[h]=o,void 0===s&&(s=new NI(u,n[e],r[e])),t[a]=s}}else e[h]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_;for(let o=0,s=arguments.length;o!==s;++o){const s=arguments[o],a=s.uuid,l=t[a];if(void 0!==l&&l>=i){const o=i++,c=e[o];t[c.uuid]=l,e[l]=c,t[a]=o,e[o]=s;for(let e=0,t=r;e!==t;++e){const t=n[e],r=t[o],i=t[l];t[l]=r,t[o]=i}}}this.nCachedObjects_=i}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,o=e.length;for(let s=0,a=arguments.length;s!==a;++s){const a=arguments[s].uuid,l=t[a];if(void 0!==l)if(delete t[a],l<i){const s=--i,a=e[s],c=--o,u=e[c];t[a.uuid]=l,e[l]=a,t[u.uuid]=s,e[s]=u,e.pop();for(let e=0,t=r;e!==t;++e){const t=n[e],r=t[s],i=t[c];t[l]=r,t[s]=i,t.pop()}}else{const i=--o,s=e[i];i>0&&(t[s.uuid]=l),e[l]=s,e.pop();for(let e=0,t=r;e!==t;++e){const t=n[e];t[l]=t[i],t.pop()}}}this.nCachedObjects_=i}subscribe_(e,t){const n=this._bindingsIndicesByPath;let r=n[e];const i=this._bindings;if(void 0!==r)return i[r];const o=this._paths,s=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,u=new Array(l);r=i.length,n[e]=r,o.push(e),s.push(t),i.push(u);for(let n=c,r=a.length;n!==r;++n){const r=a[n];u[n]=new NI(r,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const r=this._paths,i=this._parsedPaths,o=this._bindings,s=o.length-1,a=o[s];t[e[s]]=n,o[n]=a,o.pop(),i[n]=i[s],i.pop(),r[n]=r[s],r.pop()}}}class DI{constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;const i=t.tracks,o=i.length,s=new Array(o),a={endingStart:xv,endingEnd:xv};for(let e=0;e!==o;++e){const t=i[e].createInterpolant(null);s[e]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=vv,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,r=e._clip.duration,i=r/n,o=n/r;e.warp(1,i,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const r=this._mixer,i=r.time,o=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=r._lendControlInterpolant(),this._timeScaleInterpolant=s);const a=s.parameterPositions,l=s.sampleValues;return a[0]=i,a[1]=i+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled)return void this._updateWeight(e);const i=this._startTime;if(null!==i){const r=(e-i)*n;r<0||0===n?t=0:(this._startTime=null,t=n*r)}t*=this._updateTimeScale(e);const o=this._updateTime(t),s=this._updateWeight(e);if(s>0){const e=this._interpolants,t=this._propertyBindings;if(this.blendMode===Ev)for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(o),t[n].accumulateAdditive(s);else for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(o),t[n].accumulate(r,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let r=this.time+e,i=this._loopCount;const o=n===yv;if(0===e)return-1===i?r:o&&1==(1&i)?t-r:r;if(n===gv){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),r>=t||r<0){const n=Math.floor(r/t);r-=t*n,i+=Math.abs(n);const s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){const t=e<0;this._setEndings(t,!t,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(o&&1==(1&i))return t-r}return r}_setEndings(e,t,n){const r=this._interpolantSettings;n?(r.endingStart=wv,r.endingEnd=wv):(r.endingStart=e?this.zeroSlopeAtStart?wv:xv:Cv,r.endingEnd=t?this.zeroSlopeAtEnd?wv:xv:Cv)}_scheduleFading(e,t,n){const r=this._mixer,i=r.time;let o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const s=o.parameterPositions,a=o.sampleValues;return s[0]=i,a[0]=t,s[1]=i+e,a[1]=n,this}}const kI=new Float32Array(1);class LI extends py{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,o=e._propertyBindings,s=e._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let e=0;e!==i;++e){const i=r[e],l=i.name;let u=c[l];if(void 0!==u)++u.referenceCount,o[e]=u;else{if(u=o[e],void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,a,l));continue}const r=t&&t._propertyBindings[e].binding.parsedPath;u=new AI(NI.create(n,l,r),i.ValueTypeName,i.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,a,l),o[e]=u}s[e].resultBuffer=u.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,n){const r=this._actions,i=this._actionsByClip;let o=i[t];if(void 0===o)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=o;else{const t=o.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;const i=e._clip.uuid,o=this._actionsByClip,s=o[i],a=s.knownActions,l=a[a.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,a[c]=l,a.pop(),e._byClipCacheIndex=null;delete s.actionByRoot[(e._localRoot||this._root).uuid],0===a.length&&delete o[i],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_addInactiveBinding(e,t,n){const r=this._bindingsByRootAndName,i=this._bindings;let o=r[t];void 0===o&&(o={},r[t]=o),o[n]=e,e._cacheIndex=i.length,i.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,o=this._bindingsByRootAndName,s=o[r],a=t[t.length-1],l=e._cacheIndex;a._cacheIndex=l,t[l]=a,t.pop(),delete s[i],0===Object.keys(s).length&&delete o[r]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return void 0===n&&(n=new rT(new Float32Array(2),new Float32Array(2),1,kI),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i}clipAction(e,t,n){const r=t||this._root,i=r.uuid;let o="string"==typeof e?pT.findByName(r,e):e;const s=null!==o?o.uuid:e,a=this._actionsByClip[s];let l=null;if(void 0===n&&(n=null!==o?o.blendMode:Av),void 0!==a){const e=a.actionByRoot[i];if(void 0!==e&&e.blendMode===n)return e;l=a.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const c=new DI(this,o,t,n);return this._bindAction(c,l),this._addInactiveAction(c,s,i),c}existingAction(e,t){const n=t||this._root,r=n.uuid,i="string"==typeof e?pT.findByName(n,e):e,o=i?i.uuid:e,s=this._actionsByClip[o];return void 0!==s&&s.actionByRoot[r]||null}stopAllAction(){const e=this._actions;for(let t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),o=this._accuIndex^=1;for(let s=0;s!==n;++s){t[s]._update(r,e,i,o)}const s=this._bindings,a=this._nActiveBindings;for(let e=0;e!==a;++e)s[e].apply(o);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){const e=i.knownActions;for(let n=0,r=e.length;n!==r;++n){const r=e[n];this._deactivateAction(r);const i=r._cacheIndex,o=t[t.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,o._cacheIndex=i,t[i]=o,t.pop(),this._removeInactiveBindingsForAction(r)}delete r[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const e in n){const r=n[e].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}const r=this._bindingsByRootAndName[t];if(void 0!==r)for(const e in r){const t=r[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){const n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class BI{constructor(e){this.value=e}clone(){return new BI(void 0===this.value.clone?this.value:this.value.clone())}}let zI=0;class FI extends py{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:zI++}),this.name="",this.usage=ty,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let e=0,n=t.length;e<n;e++)this.uniforms.push(t[e].clone());return this}clone(){return(new this.constructor).copy(this)}}class UI extends lC{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class jI{constructor(e,t,n,r,i){this.isGLBufferAttribute=!0,this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=r,this.count=i,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class GI{constructor(e,t,n=0,r=1/0){this.ray=new kS(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new JS,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,n=[]){return VI(e,this,n,t),n.sort(HI),n}intersectObjects(e,t=!0,n=[]){for(let r=0,i=e.length;r<i;r++)VI(e[r],this,n,t);return n.sort(HI),n}}function HI(e,t){return e.distance-t.distance}function VI(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===r){const r=e.children;for(let e=0,i=r.length;e<i;e++)VI(r[e],t,n,!0)}}class WI{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Sy(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class qI{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return(new this.constructor).copy(this)}}const JI=new Iy;class KI{constructor(e=new Iy(1/0,1/0),t=new Iy(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=JI.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return JI.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const YI=new oS,$I=new oS;class XI{constructor(e=new oS,t=new oS){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){YI.subVectors(e,this.start),$I.subVectors(this.end,this.start);const n=$I.dot($I);let r=$I.dot(YI)/n;return t&&(r=Sy(r,0,1)),r}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const QI=new oS;class ZI extends a_{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new G_,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1,n=32;e<n;e++,t++){const i=e/n*Math.PI*2,o=t/n*Math.PI*2;r.push(Math.cos(i),Math.sin(i),1,Math.cos(o),Math.sin(o),1)}n.setAttribute("position",new O_(r,3));const i=new JC({fog:!1,toneMapped:!1});this.cone=new nA(n,i),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),QI.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(QI),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const eM=new oS,tM=new LS,nM=new LS;class rM extends nA{constructor(e){const t=iM(e),n=new G_,r=[],i=[],o=new Vy(0,0,1),s=new Vy(0,1,0);for(let e=0;e<t.length;e++){const n=t[e];n.parent&&n.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(o.r,o.g,o.b),i.push(s.r,s.g,s.b))}n.setAttribute("position",new O_(r,3)),n.setAttribute("color",new O_(i,3));super(n,new JC({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,r=n.getAttribute("position");nM.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e<t.length;e++){const i=t[e];i.parent&&i.parent.isBone&&(tM.multiplyMatrices(nM,i.matrixWorld),eM.setFromMatrixPosition(tM),r.setXYZ(n,eM.x,eM.y,eM.z),tM.multiplyMatrices(nM,i.parent.matrixWorld),eM.setFromMatrixPosition(tM),r.setXYZ(n+1,eM.x,eM.y,eM.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function iM(e){const t=[];!0===e.isBone&&t.push(e);for(let n=0;n<e.children.length;n++)t.push.apply(t,iM(e.children[n]));return t}class oM extends sb{constructor(e,t,n){super(new RE(t,4,2),new b_({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const sM=new oS,aM=new Vy,lM=new Vy;class cM extends a_{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const r=new TE(t);r.rotateY(.5*Math.PI),this.material=new b_({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const i=r.getAttribute("position"),o=new Float32Array(3*i.count);r.setAttribute("color",new C_(o,3)),this.add(new sb(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");aM.copy(this.light.color),lM.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){const r=e<n/2?aM:lM;t.setXYZ(e,r.r,r.g,r.b)}t.needsUpdate=!0}e.lookAt(sM.setFromMatrixPosition(this.light.matrixWorld).negate())}}class uM extends nA{constructor(e=10,t=10,n=4473924,r=8947848){n=new Vy(n),r=new Vy(r);const i=t/2,o=e/t,s=e/2,a=[],l=[];for(let e=0,c=0,u=-s;e<=t;e++,u+=o){a.push(-s,0,u,s,0,u),a.push(u,0,-s,u,0,s);const t=e===i?n:r;t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3}const c=new G_;c.setAttribute("position",new O_(a,3)),c.setAttribute("color",new O_(l,3));super(c,new JC({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}class dM extends nA{constructor(e=10,t=16,n=8,r=64,i=4473924,o=8947848){i=new Vy(i),o=new Vy(o);const s=[],a=[];if(t>1)for(let n=0;n<t;n++){const r=n/t*(2*Math.PI),l=Math.sin(r)*e,c=Math.cos(r)*e;s.push(0,0,0),s.push(l,0,c);const u=1&n?i:o;a.push(u.r,u.g,u.b),a.push(u.r,u.g,u.b)}for(let t=0;t<n;t++){const l=1&t?i:o,c=e-e/n*t;for(let e=0;e<r;e++){let t=e/r*(2*Math.PI),n=Math.sin(t)*c,i=Math.cos(t)*c;s.push(n,0,i),a.push(l.r,l.g,l.b),t=(e+1)/r*(2*Math.PI),n=Math.sin(t)*c,i=Math.cos(t)*c,s.push(n,0,i),a.push(l.r,l.g,l.b)}}const l=new G_;l.setAttribute("position",new O_(s,3)),l.setAttribute("color",new O_(a,3));super(l,new JC({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}const hM=new oS,pM=new oS,mM=new oS;class fM extends a_{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);let r=new G_;r.setAttribute("position",new O_([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const i=new JC({fog:!1,toneMapped:!1});this.lightPlane=new ZC(r,i),this.add(this.lightPlane),r=new G_,r.setAttribute("position",new O_([0,0,0,0,0,1],3)),this.targetLine=new ZC(r,i),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){hM.setFromMatrixPosition(this.light.matrixWorld),pM.setFromMatrixPosition(this.light.target.matrixWorld),mM.subVectors(pM,hM),this.lightPlane.lookAt(pM),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(pM),this.targetLine.scale.z=mM.length()}}const gM=new oS,vM=new pb;class yM extends nA{constructor(e){const t=new G_,n=new JC({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],o={};function s(e,t){a(e),a(t)}function a(e){r.push(0,0,0),i.push(0,0,0),void 0===o[e]&&(o[e]=[]),o[e].push(r.length/3-1)}s("n1","n2"),s("n2","n4"),s("n4","n3"),s("n3","n1"),s("f1","f2"),s("f2","f4"),s("f4","f3"),s("f3","f1"),s("n1","f1"),s("n2","f2"),s("n3","f3"),s("n4","f4"),s("p","n1"),s("p","n2"),s("p","n3"),s("p","n4"),s("u1","u2"),s("u2","u3"),s("u3","u1"),s("c","t"),s("p","c"),s("cn1","cn2"),s("cn3","cn4"),s("cf1","cf2"),s("cf3","cf4"),t.setAttribute("position",new O_(r,3)),t.setAttribute("color",new O_(i,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const l=new Vy(16755200),c=new Vy(16711680),u=new Vy(43775),d=new Vy(16777215),h=new Vy(3355443);this.setColors(l,c,u,d,h)}setColors(e,t,n,r,i){const o=this.geometry.getAttribute("color");o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.b),o.setXYZ(32,n.r,n.g,n.b),o.setXYZ(33,n.r,n.g,n.b),o.setXYZ(34,n.r,n.g,n.b),o.setXYZ(35,n.r,n.g,n.b),o.setXYZ(36,n.r,n.g,n.b),o.setXYZ(37,n.r,n.g,n.b),o.setXYZ(38,r.r,r.g,r.b),o.setXYZ(39,r.r,r.g,r.b),o.setXYZ(40,i.r,i.g,i.b),o.setXYZ(41,i.r,i.g,i.b),o.setXYZ(42,i.r,i.g,i.b),o.setXYZ(43,i.r,i.g,i.b),o.setXYZ(44,i.r,i.g,i.b),o.setXYZ(45,i.r,i.g,i.b),o.setXYZ(46,i.r,i.g,i.b),o.setXYZ(47,i.r,i.g,i.b),o.setXYZ(48,i.r,i.g,i.b),o.setXYZ(49,i.r,i.g,i.b),o.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap;vM.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),SM("c",t,e,vM,0,0,-1),SM("t",t,e,vM,0,0,1),SM("n1",t,e,vM,-1,-1,-1),SM("n2",t,e,vM,1,-1,-1),SM("n3",t,e,vM,-1,1,-1),SM("n4",t,e,vM,1,1,-1),SM("f1",t,e,vM,-1,-1,1),SM("f2",t,e,vM,1,-1,1),SM("f3",t,e,vM,-1,1,1),SM("f4",t,e,vM,1,1,1),SM("u1",t,e,vM,.7,1.1,-1),SM("u2",t,e,vM,-.7,1.1,-1),SM("u3",t,e,vM,0,2,-1),SM("cf1",t,e,vM,-1,0,1),SM("cf2",t,e,vM,1,0,1),SM("cf3",t,e,vM,0,-1,1),SM("cf4",t,e,vM,0,1,1),SM("cn1",t,e,vM,-1,0,-1),SM("cn2",t,e,vM,1,0,-1),SM("cn3",t,e,vM,0,-1,-1),SM("cn4",t,e,vM,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function SM(e,t,n,r,i,o,s){gM.set(i,o,s).unproject(r);const a=t[e];if(void 0!==a){const e=n.getAttribute("position");for(let t=0,n=a.length;t<n;t++)e.setXYZ(a[t],gM.x,gM.y,gM.z)}}const _M=new lS;class bM extends nA{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new G_;i.setIndex(new C_(n,1)),i.setAttribute("position",new C_(r,3)),super(i,new JC({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&_M.setFromObject(this.object),_M.isEmpty())return;const t=_M.min,n=_M.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}}class xM extends nA{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new G_;r.setIndex(new C_(n,1)),r.setAttribute("position",new O_([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(r,new JC({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}}class wM extends ZC{constructor(e,t=1,n=16776960){const r=n,i=new G_;i.setAttribute("position",new O_([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),super(i,new JC({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=new G_;o.setAttribute("position",new O_([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),o.computeBoundingSphere(),this.add(new sb(o,new b_({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}}const CM=new oS;let AM,EM;class TM extends a_{constructor(e=new oS(0,0,1),t=new oS(0,0,0),n=1,r=16776960,i=.2*n,o=.2*i){super(),this.type="ArrowHelper",void 0===AM&&(AM=new G_,AM.setAttribute("position",new O_([0,0,0,0,1,0],3)),EM=new UA(0,.5,1,5,1),EM.translate(0,-.5,0)),this.position.copy(t),this.line=new ZC(AM,new JC({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new sb(EM,new b_({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{CM.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(CM,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class IM extends nA{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new G_;n.setAttribute("position",new O_(t,3)),n.setAttribute("color",new O_([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(n,new JC({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const r=new Vy,i=this.geometry.attributes.color.array;return r.set(e),r.toArray(i,0),r.toArray(i,3),r.set(t),r.toArray(i,6),r.toArray(i,9),r.set(n),r.toArray(i,12),r.toArray(i,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class MM{constructor(){this.type="ShapePath",this.color=new Vy,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new LA,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,i,o){return this.currentPath.bezierCurveTo(e,t,n,r,i,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(e,t){const n=t.length;let r=!1;for(let i=n-1,o=0;o<n;i=o++){let n=t[i],s=t[o],a=s.x-n.x,l=s.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[o],a=-a,s=t[i],l=-l),e.y<n.y||e.y>s.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-a*(e.y-n.y);if(0===t)return!0;if(t<0)continue;r=!r}}else{if(e.y!==n.y)continue;if(s.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=s.x)return!0}}return r}const n=bE.isClockWise,r=this.subPaths;if(0===r.length)return[];let i,o,s;const a=[];if(1===r.length)return o=r[0],s=new YA,s.curves=o.curves,a.push(s),a;let l=!n(r[0].getPoints());l=e?!l:l;const c=[],u=[];let d,h,p=[],m=0;u[m]=void 0,p[m]=[];for(let t=0,s=r.length;t<s;t++)o=r[t],d=o.getPoints(),i=n(d),i=e?!i:i,i?(!l&&u[m]&&m++,u[m]={s:new YA,p:d},u[m].s.curves=o.curves,l&&m++,p[m]=[]):p[m].push({h:o,p:d[0]});if(!u[0])return function(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n],i=new YA;i.curves=r.curves,t.push(i)}return t}(r);if(u.length>1){let e=!1,n=0;for(let e=0,t=u.length;e<t;e++)c[e]=[];for(let r=0,i=u.length;r<i;r++){const i=p[r];for(let o=0;o<i.length;o++){const s=i[o];let a=!0;for(let i=0;i<u.length;i++)t(s.p,u[i].p)&&(r!==i&&n++,a?(a=!1,c[i].push(s)):e=!0);a&&c[r].push(s)}}n>0&&!1===e&&(p=c)}for(let e=0,t=u.length;e<t;e++){s=u[e].s,a.push(s),h=p[e];for(let e=0,t=h.length;e<t;e++)s.holes.push(h[e].h)}return a}}const RM=PM();function PM(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(r[e]=0,r[256|e]=32768,i[e]=24,i[256|e]=24):t<-14?(r[e]=1024>>-t-14,r[256|e]=1024>>-t-14|32768,i[e]=-t-1,i[256|e]=-t-1):t<=15?(r[e]=t+15<<10,r[256|e]=t+15<<10|32768,i[e]=13,i[256|e]=13):t<128?(r[e]=31744,r[256|e]=64512,i[e]=24,i[256|e]=24):(r[e]=31744,r[256|e]=64512,i[e]=13,i[256|e]=13)}const o=new Uint32Array(2048),s=new Uint32Array(64),a=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;0==(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,o[e]=t|n}for(let e=1024;e<2048;++e)o[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=1199570944,s[32]=2147483648;for(let e=33;e<63;++e)s[e]=2147483648+(e-32<<23);s[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(a[e]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:o,exponentTable:s,offsetTable:a}}var NM=Object.freeze({__proto__:null,toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Sy(e,-65504,65504),RM.floatView[0]=e;const t=RM.uint32View[0],n=t>>23&511;return RM.baseTable[n]+((8388607&t)>>RM.shiftTable[n])},fromHalfFloat:function(e){const t=e>>10;return RM.uint32View[0]=RM.mantissaTable[RM.offsetTable[t]+(1023&e)]+RM.exponentTable[t],RM.floatView[0]}});function OM(){console.error("THREE.ImmediateRenderObject has been removed.")}class DM extends Qy{constructor(e,t,n){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,n),this.samples=4}}class kM extends Zy{constructor(e,t,n,r){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(e,t,n,r)}}class LM extends tS{constructor(e,t,n,r){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(e,t,n,r)}}class BM extends lb{constructor(e,t,n,r,i,o){console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),super(e,t,n,r,i,o)}}class zM extends zA{constructor(e,t,n,r){console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),super(e,t,n,r)}}class FM extends FA{constructor(e,t,n,r){console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),super(e,t,n,r)}}class UM extends jA{constructor(e,t,n,r,i,o,s){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(e,t,n,r,i,o,s)}}class jM extends UA{constructor(e,t,n,r,i,o,s,a){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(e,t,n,r,i,o,s,a)}}class GM extends HA{constructor(e,t){console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),super(e,t)}}class HM extends CE{constructor(e,t){console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),super(e,t)}}class VM extends EE{constructor(e,t){console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),super(e,t)}}class WM extends BA{constructor(e,t,n,r){console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),super(e,t,n,r)}}class qM extends TE{constructor(e,t){console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),super(e,t)}}class JM extends Ib{constructor(e,t,n,r){console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),super(e,t,n,r)}}class KM extends GA{constructor(e,t,n,r){console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),super(e,t,n,r)}}class YM extends IE{constructor(e,t,n,r,i,o){console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),super(e,t,n,r,i,o)}}class $M extends ME{constructor(e,t){console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),super(e,t)}}class XM extends RE{constructor(e,t,n,r,i,o,s){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(e,t,n,r,i,o,s)}}class QM extends PE{constructor(e,t){console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),super(e,t)}}class ZM extends NE{constructor(e,t,n,r,i){console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),super(e,t,n,r,i)}}class eR extends OE{constructor(e,t,n,r,i,o){console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),super(e,t,n,r,i,o)}}class tR extends DE{constructor(e,t,n,r,i){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(e,t,n,r,i)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:nf}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=nf);const nR=()=>{let e=!1;if("maxTouchPoints"in navigator)e=navigator.maxTouchPoints>0;else if("msMaxTouchPoints"in navigator)e=navigator.msMaxTouchPoints>0;else{const n=window&&"matchMedia"in window&&matchMedia("(pointer:coarse)");if(n&&"(pointer:coarse)"===n.media)e=!!n.matches;else if("orientation"in window)e=!0;else{var t=null===navigator||void 0===navigator?void 0:navigator.userAgent;e=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(t)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(t)}}return e},rR=/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$_:;|,~+=\{\}\[\]%^&*-]).{8,}$/,iR=/^\w+([.-]?[+]?\w+)*@\w+([.-]?\w+)*(\.\w{2,})+$/,oR=/^(?!.*\.\.)(?!.*\.$)[^\W][\w.+-]{2,32}$/;function sR(e,t){const n=(0,c.useRef)(),r=(0,c.useRef)(null);return(0,c.useEffect)((()=>(r.current=e,()=>{r.current=null})),[e]),(0,c.useEffect)((()=>()=>{clearTimeout(n.current)}),[]),(0,c.useMemo)((()=>(...e)=>{clearTimeout(n.current),n.current=window.setTimeout((()=>{r.current&&r.current(...e)}),t)}),[t])}const aR=e=>e.slice(0,e.length/2).trim().toLowerCase()===e.slice(e.length/2+1).trim().toLowerCase()?e.slice(0,e.length/2):e,lR=e=>e.replaceAll(/[^\p{L}\p{N}\p{P}\p{Z}^$\n]/gu,"").trim(),cR=e=>e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll(/```*?```/g,"")).replaceAll(/```[\s\S]*?```/g,"")).replaceAll(/`[^`]*`/g,"")).replaceAll(/!\[[^\]]*\]\([^)]*\)/g,"")).replaceAll(/\[([^\]]*)\]\([^)]*\)/g,"$1")).replaceAll(/^> /gm,"")).replaceAll(/^#+ /gm,"")).replaceAll(/[*_]/g,"")).replaceAll(/---/g,"")).replaceAll(/~~/g,"")).replaceAll(/^\s*[-*+] /gm,"")).replaceAll(/^\s*\d+\.\s+/gm,"")).replaceAll(/^\|.*\|$/gm,"")).replaceAll(/\$\$[\s\S]*?\$\$/g,"")).replaceAll(/\$[\s\S]*?\$/g,"")).replaceAll(/\\\([\s\S]*?\\\)/g,"")).replaceAll(/\\\[[\s\S]*?\\\]/g,"")).replaceAll(/\s+/g," ").trim(),uR=e=>{const t=/<output.*?<\/output>/gs;if(!t.test(e))return e;const n=e.replace(t,"");return uR(n)},dR=e=>{const t=document.createElement("div");return t.innerHTML=e,t.textContent||""},hR=e=>{const t=document.createElement("textarea");return t.textContent=e,t.innerHTML};function pR(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const mR={startup:{elements:[".memori-chat--bubble-content"]},options:{processHtmlClass:"memori-chat--bubble-content"},tex:{inlineMath:[["$","$"],["\\$","\\$"]],displayMath:[["$$","$$"]],processEscapes:!0},asciimath:{fixphi:!0,displaystyle:!0,decimalsign:"."},skipStartupTypeset:!0,chtml:{displayAlign:"left"},svg:{fontCache:"global"}},fR=()=>{window.MathJax=mR,(()=>{const e=document.createElement("script");e.src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js",e.async=!0,e.id="mathjax-script",document.head.appendChild(e)})()};function gR(e){Object.values(e).forEach((e=>{e instanceof UE&&(e.roughness=.8,e.metalness=.1,e.shadowSide=2,e.map&&(e.map.anisotropy=16))}))}function vR(e){return!0===e.isSkinnedMesh}const yR=(e,t=!1)=>{try{return JSON.parse(e)}catch(n){return t?e:null}};c=o("85Hg2"),c=o("85Hg2");function SR(e,t){let[n,r]=(0,c.useState)(e),i=Ph(e);return Mh((()=>r(i.current)),[i,r,...t]),n}c=o("85Hg2");function _R(e){var t;if(e.type)return e.type;let n=null!=(t=e.as)?t:"button";return"string"==typeof n&&"button"===n.toLowerCase()?"button":void 0}function bR(e,t){let[n,r]=(0,c.useState)((()=>_R(e)));return Mh((()=>{r(_R(e))}),[e.type,e.as]),Mh((()=>{n||!t.current||t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")}),[n,t]),n}c=o("85Hg2");function xR({container:e,accept:t,walk:n,enabled:r=!0}){let i=(0,c.useRef)(t),o=(0,c.useRef)(n);(0,c.useEffect)((()=>{i.current=t,o.current=n}),[t,n]),Mh((()=>{if(!e||!r)return;let t=yp(e);if(!t)return;let n=i.current,s=o.current,a=Object.assign((e=>n(e)),{acceptNode:n}),l=t.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,a,!1);for(;l.nextNode();)s(l.currentNode)}),[e,r,i,o])}var wR=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(wR||{});function CR(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),i=null!=r?r:-1,o=(()=>{switch(e.focus){case 0:return n.findIndex((e=>!t.resolveDisabled(e)));case 1:{let e=n.slice().reverse().findIndex(((e,n,r)=>!(-1!==i&&r.length-n-1>=i)&&!t.resolveDisabled(e)));return-1===e?e:n.length-1-e}case 2:return n.findIndex(((e,n)=>!(n<=i)&&!t.resolveDisabled(e)));case 3:{let e=n.slice().reverse().findIndex((e=>!t.resolveDisabled(e)));return-1===e?e:n.length-1-e}case 4:return n.findIndex((n=>t.resolveId(n)===e.id));case 5:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}})();return-1===o?r:o}function AR(e={},t=null,n=[]){for(let[r,i]of Object.entries(e))TR(n,ER(t,r),i);return n}function ER(e,t){return e?e+"["+t+"]":t}function TR(e,t,n){if(Array.isArray(n))for(let[r,i]of n.entries())TR(e,ER(t,r.toString()),i);else n instanceof Date?e.push([t,n.toISOString()]):"boolean"==typeof n?e.push([t,n?"1":"0"]):"string"==typeof n?e.push([t,n]):"number"==typeof n?e.push([t,`${n}`]):null==n?e.push([t,""]):AR(n,t,e)}function IR(e){var t;let n=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(n)for(let e of n.elements)if("INPUT"===e.tagName&&"submit"===e.type||"BUTTON"===e.tagName&&"submit"===e.type||"INPUT"===e.nodeName&&"image"===e.type)return void e.click()}c=o("85Hg2");function MR(e,t,n){let[r,i]=(0,c.useState)(n),o=void 0!==e,s=(0,c.useRef)(o),a=(0,c.useRef)(!1),l=(0,c.useRef)(!1);return!o||s.current||a.current?!o&&s.current&&!l.current&&(l.current=!0,s.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(a.current=!0,s.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[o?e:r,Dh((e=>(o||i(e),null==t?void 0:t(e))))]}var RR=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(RR||{}),PR=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(PR||{}),NR=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(NR||{}),OR=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e))(OR||{});function DR(e,t=(e=>e)){let n=null!==e.activeOptionIndex?e.options[e.activeOptionIndex]:null,r=Rp(t(e.options.slice()),(e=>e.dataRef.current.domRef.current)),i=n?r.indexOf(n):null;return-1===i&&(i=null),{options:r,activeOptionIndex:i}}let kR={1:e=>e.dataRef.current.disabled||1===e.comboboxState?e:{...e,activeOptionIndex:null,comboboxState:1},0(e){if(e.dataRef.current.disabled||0===e.comboboxState)return e;let t=e.activeOptionIndex,{isSelected:n}=e.dataRef.current,r=e.options.findIndex((e=>n(e.dataRef.current.value)));return-1!==r&&(t=r),{...e,comboboxState:0,activeOptionIndex:t}},2(e,t){var n;if(e.dataRef.current.disabled||e.dataRef.current.optionsRef.current&&!e.dataRef.current.optionsPropsRef.current.static&&1===e.comboboxState)return e;let r=DR(e);if(null===r.activeOptionIndex){let e=r.options.findIndex((e=>!e.dataRef.current.disabled));-1!==e&&(r.activeOptionIndex=e)}let i=CR(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...e,...r,activeOptionIndex:i,activationTrigger:null!=(n=t.trigger)?n:1}},3:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},r=DR(e,(e=>[...e,n]));null===e.activeOptionIndex&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(n));let i={...e,...r,activationTrigger:1};return e.dataRef.current.__demoMode&&void 0===e.dataRef.current.value&&(i.activeOptionIndex=0),i},4:(e,t)=>{let n=DR(e,(e=>{let n=e.findIndex((e=>e.id===t.id));return-1!==n&&e.splice(n,1),e}));return{...e,...n,activationTrigger:1}},5:(e,t)=>({...e,labelId:t.id})},LR=(0,c.createContext)(null);function BR(e){let t=(0,c.useContext)(LR);if(null===t){let t=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,BR),t}return t}LR.displayName="ComboboxActionsContext";let zR=(0,c.createContext)(null);function FR(e){let t=(0,c.useContext)(zR);if(null===t){let t=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,FR),t}return t}function UR(e,t){return mh(t.type,kR,e,t)}zR.displayName="ComboboxDataContext";let jR=c.Fragment;let GR=bh((function(e,n){let{value:r,defaultValue:i,onChange:o,name:s,by:a=((e,t)=>e===t),disabled:l=!1,__demoMode:u=!1,nullable:d=!1,multiple:h=!1,...p}=e,[m,f]=MR(r,o,i),[g,v]=(0,c.useReducer)(UR,{dataRef:(0,c.createRef)(),comboboxState:u?0:1,options:[],activeOptionIndex:null,activationTrigger:1,labelId:null}),y=(0,c.useRef)(!1),S=(0,c.useRef)({static:!1,hold:!1}),_=(0,c.useRef)(null),b=(0,c.useRef)(null),x=(0,c.useRef)(null),w=(0,c.useRef)(null),C=Dh("string"==typeof a?(e,t)=>{let n=a;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:a),A=(0,c.useCallback)((e=>mh(E.mode,{1:()=>m.some((t=>C(t,e))),0:()=>C(m,e)})),[m]),E=(0,c.useMemo)((()=>({...g,optionsPropsRef:S,labelRef:_,inputRef:b,buttonRef:x,optionsRef:w,value:m,disabled:l,mode:h?1:0,get activeOptionIndex(){if(y.current&&null===g.activeOptionIndex&&g.options.length>0){let e=g.options.findIndex((e=>!e.dataRef.current.disabled));if(-1!==e)return e}return g.activeOptionIndex},compare:C,isSelected:A,nullable:d,__demoMode:u})),[m,l,h,d,u,g]);Mh((()=>{g.dataRef.current=E}),[E]),cm([E.buttonRef,E.inputRef,E.optionsRef],(()=>v({type:1})),0===E.comboboxState);let T=(0,c.useMemo)((()=>({open:0===E.comboboxState,disabled:l,activeIndex:E.activeOptionIndex,activeOption:null===E.activeOptionIndex?null:E.options[E.activeOptionIndex].dataRef.current.value,value:m})),[E,l,m]),I=Dh((e=>{let t=E.options.find((t=>t.id===e));!t||k(t.dataRef.current.value)})),M=Dh((()=>{if(null!==E.activeOptionIndex){let{dataRef:e,id:t}=E.options[E.activeOptionIndex];k(e.current.value),v({type:2,focus:wR.Specific,id:t})}})),R=Dh((()=>{v({type:0}),y.current=!0})),P=Dh((()=>{v({type:1}),y.current=!1})),N=Dh(((e,t,n)=>(y.current=!1,e===wR.Specific?v({type:2,focus:wR.Specific,id:t,trigger:n}):v({type:2,focus:e,trigger:n})))),O=Dh(((e,t)=>(v({type:3,id:e,dataRef:t}),()=>v({type:4,id:e})))),D=Dh((e=>(v({type:5,id:e}),()=>v({type:5,id:null})))),k=Dh((e=>mh(E.mode,{0:()=>null==f?void 0:f(e),1(){let t=E.value.slice(),n=t.findIndex((t=>C(t,e)));return-1===n?t.push(e):t.splice(n,1),null==f?void 0:f(t)}}))),L=(0,c.useMemo)((()=>({onChange:k,registerOption:O,registerLabel:D,goToOption:N,closeCombobox:P,openCombobox:R,selectActiveOption:M,selectOption:I})),[]),B=null===n?{}:{ref:n};return t(c).createElement(LR.Provider,{value:L},t(c).createElement(zR.Provider,{value:E},t(c).createElement(Th,{value:mh(E.comboboxState,{0:Ah.Open,1:Ah.Closed})},null!=s&&null!=m&&AR({[s]:m}).map((([e,n])=>t(c).createElement(vp,{features:gp.Hidden,...xh({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:e,value:n})}))),yh({ourProps:B,theirProps:p,slot:T,defaultTag:jR,name:"Combobox"}))))})),HR=bh((function(e,t){var n,r;let{value:i,onChange:o,displayValue:s,type:a="text",...l}=e,u=FR("Combobox.Input"),d=BR("Combobox.Input"),h=Bh(u.inputRef,t),p=`headlessui-combobox-input-${fp()}`,m=qh(),f=!1;zp((([e,t],[n,r])=>{!u.inputRef.current||(0===r&&1===t?function(e){var t;let n=u.inputRef.current;if(!n||n.value===e)return;let r=Object.getOwnPropertyDescriptor(n.constructor.prototype,"value");null==(t=null==r?void 0:r.set)||t.call(n,e),f=!0,n.dispatchEvent(new Event("input",{bubbles:!0})),n.value=e,f=!1}(e):e!==n&&(u.inputRef.current.value=e))}),[(0,c.useMemo)((()=>{var e;return"function"==typeof s?null!=(e=s(u.value))?e:"":"string"==typeof u.value?u.value:""}),[u.value]),u.comboboxState]);let g=(0,c.useRef)(!1),v=Dh((()=>{g.current=!0})),y=Dh((()=>{setTimeout((()=>{g.current=!1}))})),S=Dh((e=>{switch(e.key){case up.Backspace:case up.Delete:if(0!==u.mode||!u.nullable)return;let t=e.currentTarget;m.requestAnimationFrame((()=>{""===t.value&&(d.onChange(null),u.optionsRef.current&&(u.optionsRef.current.scrollTop=0),d.goToOption(wR.Nothing))}));break;case up.Enter:if(0!==u.comboboxState||g.current)return;if(e.preventDefault(),e.stopPropagation(),null===u.activeOptionIndex)return void d.closeCombobox();d.selectActiveOption(),0===u.mode&&d.closeCombobox();break;case up.ArrowDown:return e.preventDefault(),e.stopPropagation(),mh(u.comboboxState,{0:()=>{d.goToOption(wR.Next)},1:()=>{d.openCombobox()}});case up.ArrowUp:return e.preventDefault(),e.stopPropagation(),mh(u.comboboxState,{0:()=>{d.goToOption(wR.Previous)},1:()=>{d.openCombobox(),m.nextFrame((()=>{u.value||d.goToOption(wR.Last)}))}});case up.Home:case up.PageUp:return e.preventDefault(),e.stopPropagation(),d.goToOption(wR.First);case up.End:case up.PageDown:return e.preventDefault(),e.stopPropagation(),d.goToOption(wR.Last);case up.Escape:return 0!==u.comboboxState?void 0:(e.preventDefault(),u.optionsRef.current&&!u.optionsPropsRef.current.static&&e.stopPropagation(),d.closeCombobox());case up.Tab:if(0!==u.comboboxState)return;0===u.mode&&d.selectActiveOption(),d.closeCombobox()}})),_=Dh((e=>{f||d.openCombobox(),null==o||o(e)})),b=SR((()=>{if(u.labelId)return[u.labelId].join(" ")}),[u.labelId]),x=(0,c.useMemo)((()=>({open:0===u.comboboxState,disabled:u.disabled})),[u]);return yh({ourProps:{ref:h,id:p,role:"combobox",type:a,"aria-controls":null==(n=u.optionsRef.current)?void 0:n.id,"aria-expanded":u.disabled?void 0:0===u.comboboxState,"aria-activedescendant":null===u.activeOptionIndex||null==(r=u.options[u.activeOptionIndex])?void 0:r.id,"aria-multiselectable":1===u.mode||void 0,"aria-labelledby":b,disabled:u.disabled,onCompositionStart:v,onCompositionEnd:y,onKeyDown:S,onChange:_},theirProps:l,slot:x,defaultTag:"input",name:"Combobox.Input"})})),VR=bh((function(e,t){var n;let r=FR("Combobox.Button"),i=BR("Combobox.Button"),o=Bh(r.buttonRef,t),s=`headlessui-combobox-button-${fp()}`,a=qh(),l=Dh((e=>{switch(e.key){case up.ArrowDown:return e.preventDefault(),e.stopPropagation(),1===r.comboboxState&&i.openCombobox(),a.nextFrame((()=>{var e;return null==(e=r.inputRef.current)?void 0:e.focus({preventScroll:!0})}));case up.ArrowUp:return e.preventDefault(),e.stopPropagation(),1===r.comboboxState&&(i.openCombobox(),a.nextFrame((()=>{r.value||i.goToOption(wR.Last)}))),a.nextFrame((()=>{var e;return null==(e=r.inputRef.current)?void 0:e.focus({preventScroll:!0})}));case up.Escape:return 0!==r.comboboxState?void 0:(e.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&e.stopPropagation(),i.closeCombobox(),a.nextFrame((()=>{var e;return null==(e=r.inputRef.current)?void 0:e.focus({preventScroll:!0})})));default:return}})),u=Dh((e=>{if(dp(e.currentTarget))return e.preventDefault();0===r.comboboxState?i.closeCombobox():(e.preventDefault(),i.openCombobox()),a.nextFrame((()=>{var e;return null==(e=r.inputRef.current)?void 0:e.focus({preventScroll:!0})}))})),d=SR((()=>{if(r.labelId)return[r.labelId,s].join(" ")}),[r.labelId,s]),h=(0,c.useMemo)((()=>({open:0===r.comboboxState,disabled:r.disabled,value:r.value})),[r]),p=e;return yh({ourProps:{ref:o,id:s,type:bR(e,r.buttonRef),tabIndex:-1,"aria-haspopup":!0,"aria-controls":null==(n=r.optionsRef.current)?void 0:n.id,"aria-expanded":r.disabled?void 0:0===r.comboboxState,"aria-labelledby":d,disabled:r.disabled,onClick:u,onKeyDown:l},theirProps:p,slot:h,defaultTag:"button",name:"Combobox.Button"})})),WR=bh((function(e,t){let n=FR("Combobox.Label"),r=`headlessui-combobox-label-${fp()}`,i=BR("Combobox.Label"),o=Bh(n.labelRef,t);Mh((()=>i.registerLabel(r)),[r]);let s=Dh((()=>{var e;return null==(e=n.inputRef.current)?void 0:e.focus({preventScroll:!0})})),a=(0,c.useMemo)((()=>({open:0===n.comboboxState,disabled:n.disabled})),[n]);return yh({ourProps:{ref:o,id:r,onClick:s},theirProps:e,slot:a,defaultTag:"label",name:"Combobox.Label"})})),qR=gh.RenderStrategy|gh.Static,JR=bh((function(e,t){var n;let{hold:r=!1,...i}=e,o=FR("Combobox.Options"),s=Bh(o.optionsRef,t),a=`headlessui-combobox-options-${fp()}`,l=Eh(),u=null!==l?l===Ah.Open:0===o.comboboxState;Mh((()=>{var t;o.optionsPropsRef.current.static=null!=(t=e.static)&&t}),[o.optionsPropsRef,e.static]),Mh((()=>{o.optionsPropsRef.current.hold=r}),[o.optionsPropsRef,r]),xR({container:o.optionsRef.current,enabled:0===o.comboboxState,accept:e=>"option"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let d=SR((()=>{var e,t;return null!=(t=o.labelId)?t:null==(e=o.buttonRef.current)?void 0:e.id}),[o.labelId,o.buttonRef.current]),h=(0,c.useMemo)((()=>({open:0===o.comboboxState})),[o]);return yh({ourProps:{"aria-activedescendant":null===o.activeOptionIndex||null==(n=o.options[o.activeOptionIndex])?void 0:n.id,"aria-labelledby":d,role:"listbox",id:a,ref:s},theirProps:i,slot:h,defaultTag:"ul",features:qR,visible:u,name:"Combobox.Options"})})),KR=bh((function(e,t){var n,r;let{disabled:i=!1,value:o,...s}=e,a=FR("Combobox.Option"),l=BR("Combobox.Option"),u=`headlessui-combobox-option-${fp()}`,d=null!==a.activeOptionIndex&&a.options[a.activeOptionIndex].id===u,h=a.isSelected(o),p=(0,c.useRef)(null),m=Ph({disabled:i,value:o,domRef:p,textValue:null==(r=null==(n=p.current)?void 0:n.textContent)?void 0:r.toLowerCase()}),f=Bh(t,p),g=Dh((()=>l.selectOption(u)));Mh((()=>l.registerOption(u,m)),[m,u]);let v=(0,c.useRef)(!a.__demoMode);Mh((()=>{if(!a.__demoMode)return;let e=Uh();return e.requestAnimationFrame((()=>{v.current=!0})),e.dispose}),[]),Mh((()=>{if(0!==a.comboboxState||!d||!v.current||0===a.activationTrigger)return;let e=Uh();return e.requestAnimationFrame((()=>{var e,t;null==(t=null==(e=p.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})),e.dispose}),[p,d,a.comboboxState,a.activationTrigger,a.activeOptionIndex]);let y=Dh((e=>{if(i)return e.preventDefault();g(),0===a.mode&&l.closeCombobox()})),S=Dh((()=>{if(i)return l.goToOption(wR.Nothing);l.goToOption(wR.Specific,u)})),_=Dh((()=>{i||d||l.goToOption(wR.Specific,u,0)})),b=Dh((()=>{i||!d||a.optionsPropsRef.current.hold||l.goToOption(wR.Nothing)})),x=(0,c.useMemo)((()=>({active:d,selected:h,disabled:i})),[d,h,i]);return yh({ourProps:{id:u,ref:f,role:"option",tabIndex:!0===i?void 0:-1,"aria-disabled":!0===i||void 0,"aria-selected":h,disabled:void 0,onClick:y,onFocus:S,onPointerMove:_,onMouseMove:_,onPointerLeave:b,onMouseLeave:b},theirProps:s,slot:x,defaultTag:"li",name:"Combobox.Option"})})),YR=Object.assign(GR,{Input:HR,Button:VR,Label:WR,Options:JR,Option:KR});const $R=({center:e,size:n})=>{const r=Dm();return(0,c.useEffect)((()=>{const i=new(t(km).Circle)(e,n),o=r.layerContainer||r.map;return o.addLayer(i),()=>{o.removeLayer(i)}})),null},XR=({center:e,uncertainty:t})=>{const[n,r]=(0,c.useState)(!1),i=ef(),o=(0,c.useCallback)((()=>{let n=void 0!==t?Math.round(Math.log2(1e7/t)):i.getZoom();i.setView(e,n)}),[e,t,i]);return(0,c.useEffect)((()=>{n||(o(),r(!0))}),[]),(0,c.useEffect)((()=>{o()}),[e,t,o]),null};let QR=t(km).icon({iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12.5,20.5],shadowAnchor:[12.5,20.5]});t(km).Marker.prototype.options.icon=QR;const ZR=e=>{let t="Position";return(null==e?void 0:e.address)?t=[e.address.village||e.address.suburb,e.address.town||e.address.city||e.address.county||e.address.state,e.address.country].filter(Boolean).filter(((e,t,n)=>n.indexOf(e)===t)).join(", "):(null==e?void 0:e.display_name)&&(t=e.display_name),t};var eP=({venue:e,setVenue:n,showUncertainty:r=!1,showGpsButton:i=!0,saveAndClose:o})=>{var a,l,u;const{t:d}=Ce(),[h,p]=(0,c.useState)(!1),[m,f]=(0,c.useState)(!1),[g,v]=(0,c.useState)(!1),[y,S]=(0,c.useState)(""),[_,b]=(0,c.useState)([]),x=sR((async e=>{v(!0);try{let t=await fetch(`https://nominatim.openstreetmap.org/search?q=${e}&format=jsonv2&limit=5&addressdetails=1`),n=await t.json();b(n)}catch(e){console.error(e)}finally{v(!1)}}),1e3);return(0,c.useEffect)((()=>{p(!0)}),[]),(0,c.useEffect)((()=>{const e=document.createElement("link");return e.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",e.rel="stylesheet",e.integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=",e.crossOrigin="",document.head.appendChild(e),()=>{document.head.removeChild(e)}}),[]),(0,s.jsxs)("fieldset",{className:"memori--venue-widget",children:[(0,s.jsx)("legend",{className:"sr-only",children:"Venue"}),(0,s.jsxs)("div",{className:"memori--venue-widget__form-item",children:[(0,s.jsx)("div",{className:"memori--venue-widget__geosuggest",children:m?(0,s.jsx)("p",{children:d("write_and_speak.updatingPosition")}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"memori--venue-widget-search",children:(0,s.jsxs)(YR,{value:(null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)?{place_id:0,lat:null==e?void 0:e.latitude,lon:null==e?void 0:e.longitude,display_name:null==e?void 0:e.placeName}:void 0,onChange:e=>{console.log(e);const t=ZR(e);n({latitude:e.lat,longitude:e.lon,placeName:t,uncertainty:(null==e?void 0:e.boundingbox)?Rm(e.boundingbox):2})},children:[(0,s.jsx)(YR.Input,{className:"memori--venue-widget-search--input",displayValue:e=>e?ZR(e):"",placeholder:d("searchVenue"),onChange:e=>{return t=e.target.value,S(t),void x(t);var t}}),(g||_.length>0||0===_.length&&""!==y)&&(0,s.jsx)(lp,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(YR.Options,{className:"memori--venue-widget-search--options",children:g?(0,s.jsx)(Am,{spinning:!0,children:(0,s.jsxs)("center",{className:"memori--venue-widget-search--option",children:[d("loading"),"..."]})}):0===_.length&&""!==y?(0,s.jsx)("center",{className:"memori--venue-widget-search--option",children:d("nothingFound")}):null==_?void 0:_.map((e=>(0,s.jsx)(YR.Option,{as:c.Fragment,value:e,children:({active:n,selected:r})=>(0,s.jsx)("li",{className:t(Cs)("memori--venue-widget-search--option",{"memori--venue-widget-search--option-active":n,"memori--venue-widget-search--option-selected":r}),children:e.display_name})},e.place_id)))})})]})}),i&&(0,s.jsx)(Em,{className:"memori--venue-widget__gps-button",primary:!0,loading:m,onClick:()=>{f(!0),(async()=>{f(!0),navigator.geolocation.getCurrentPosition((async e=>{let r={latitude:e.coords.latitude,longitude:e.coords.longitude,placeName:"Position",uncertainty:e.coords.accuracy/1e3};try{const t=await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${e.coords.latitude}&lon=${e.coords.longitude}&format=jsonv2&addressdetails=1`),i=await t.json(),s=ZR(i);r={latitude:e.coords.latitude,longitude:e.coords.longitude,placeName:s,uncertainty:e.coords.accuracy/1e3},n(r)}catch(e){let i=e;console.error("[POSITION ERROR]",i),(null==i?void 0:i.message)&&t(ed).error(i.message),n(r)}finally{o&&o(r)}f(!1)}),(e=>{console.error("[POSITION ERROR]",e),t(ed).error(e.message),f(!1)}))})()},children:d("write_and_speak.useMyPosition")})]})}),(0,s.jsx)("div",{children:(0,s.jsx)(Em,{outlined:!0,className:"memori--venue-widget__no-location-button",onClick:()=>{let e={latitude:0,longitude:0,placeName:"Position",uncertainty:0};n(e),o&&o(e)},children:d("write_and_speak.dontWantToProvidePosition")})}),r&&(0,s.jsxs)("label",{className:"memori--venue-widget__select-label",children:[(0,s.jsxs)("span",{children:[d("uncertain"),": "]}),(0,s.jsxs)("select",{className:"memori-select--button memori--venue-widget__uncertainty",value:parseFloat((null!==(a=null==e?void 0:e.uncertainty)&&void 0!==a?a:0).toFixed(2)),disabled:!(e&&e.placeName&&e.latitude&&e.longitude),onChange:t=>{n({...e,uncertainty:parseFloat(t.target.value)})},children:[(null==e?void 0:e.uncertainty)&&![0,1,2,5,10,20,50,100].includes(e.uncertainty)&&(0,s.jsxs)("option",{value:e.uncertainty,children:[e.uncertainty," Km"]}),(0,s.jsx)("option",{value:0,children:d("exactPosition")}),(0,s.jsx)("option",{value:1,children:"1 km"}),(0,s.jsx)("option",{value:2,children:"2 km"}),(0,s.jsx)("option",{value:5,children:"5 km"}),(0,s.jsx)("option",{value:10,children:"10 km"}),(0,s.jsx)("option",{value:20,children:"20 km"}),(0,s.jsx)("option",{value:50,children:"50 km"}),(0,s.jsx)("option",{value:100,children:"100 km"})]})]})]}),(0,s.jsxs)("div",{className:"memori--venue-widget__form-item",children:[(null==e?void 0:e.placeName)&&"Position"!==e.placeName&&(0,s.jsxs)("p",{className:"memori--venue--widget__place-name",children:[(0,s.jsx)("strong",{children:d("venue")}),": ",e.placeName]}),(0,s.jsx)("div",{className:"memori--venue-widget__map",children:h&&(0,s.jsxs)(zm,{className:"memori--venue-widget__map",center:(null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)?[e.latitude,e.longitude]:[44.66579,11.48823],zoom:13,scrollWheelZoom:!0,children:[(0,s.jsx)(Zm,{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(0,s.jsx)(XR,{center:(null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)?[e.latitude,e.longitude]:[44.66579,11.48823],uncertainty:1e3*(null!==(l=null==e?void 0:e.uncertainty)&&void 0!==l?l:0)}),(null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)&&(0,s.jsx)($m,{position:[e.latitude,e.longitude],icon:QR,children:(0,s.jsx)(Xm,{children:null!==(u=e.placeName)&&void 0!==u?u:""})}),(null==e?void 0:e.latitude)&&(null==e?void 0:e.longitude)&&void 0!==(null==e?void 0:e.uncertainty)&&(0,s.jsx)($R,{center:[e.latitude,e.longitude],size:1e3*e.uncertainty})]})})]})]})};var tP=({memori:e,open:t,onClose:n,venue:r,setVenue:i})=>{const{t:o}=Ce();return(0,s.jsxs)(Im,{className:"memori-position-drawer",open:t,onClose:()=>n(r),title:o("widget.position")||"Position",animated:!1,children:[(0,s.jsx)("p",{children:o("write_and_speak.requirePositionHelp",{name:e.name})}),(0,s.jsx)(eP,{venue:r,setVenue:i,showUncertainty:!1,saveAndClose:e=>{i(e),n(e)}})]})};c=o("85Hg2"),c=o("85Hg2");var nP=({open:e=!1,onClose:n,className:r,title:i,description:o,children:a,footer:l,loading:u=!1,closable:d=!0,width:h="100%",widthMd:p="100%"})=>{const{t:m}=Ce();return(0,s.jsx)(lp,{appear:!0,show:e,as:t(c).Fragment,children:(0,s.jsxs)(wm,{open:e,onClose:n,className:t(Cs)("memori-modal",r),children:[(0,s.jsx)(lp.Child,{as:t(c).Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)("div",{className:"memori-modal--backdrop"})}),(0,s.jsx)("div",{className:"memori-modal--container",children:(0,s.jsx)("div",{className:"memori-modal--container-scrollable",children:(0,s.jsx)(lp.Child,{as:t(c).Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsxs)(wm.Panel,{className:"memori-modal--panel",children:[(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-modal--panel {\n --memori-modal--width: ${h};\n --memori-modal--width-md: ${p};\n }\n `}}),d&&(0,s.jsx)("div",{className:"memori-modal--close",children:(0,s.jsx)(Em,{ghost:!0,padded:!0,shape:"circle",icon:(0,s.jsx)(Tm,{}),title:m("close")||"Close",onClick:()=>n(!1)})}),(0,s.jsxs)(Am,{spinning:u,children:[i&&(0,s.jsx)(wm.Title,{className:"memori-modal--title",children:i}),o&&(0,s.jsx)(wm.Description,{className:"memori-modal--description",children:o}),a,l&&(0,s.jsx)("div",{className:"memori-modal--footer",children:l})]})]})})})})]})})},rP=(c=o("85Hg2"),e=>"checkbox"===e.type),iP=e=>e instanceof Date,oP=e=>null==e;const sP=e=>"object"==typeof e;var aP=e=>!oP(e)&&!Array.isArray(e)&&sP(e)&&!iP(e),lP=e=>aP(e)&&e.target?rP(e.target)?e.target.checked:e.target.value:e,cP=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),uP=e=>Array.isArray(e)?e.filter(Boolean):[],dP=e=>void 0===e,hP=(e,t,n)=>{if(!t||!aP(e))return n;const r=uP(t.split(/[,[\].]+?/)).reduce(((e,t)=>oP(e)?e:e[t]),e);return dP(r)||r===e?dP(e[t])?n:e[t]:r};const pP="blur",mP="focusout",fP="onBlur",gP="onChange",vP="onSubmit",yP="onTouched",SP="all",_P="max",bP="min",xP="maxLength",wP="minLength",CP="pattern",AP="required",EP="validate";t(c).createContext(null);var TP=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const i=o;return t._proxyFormState[i]!==SP&&(t._proxyFormState[i]=!r||SP),n&&(n[i]=!0),e[i]}});return i},IP=e=>aP(e)&&!Object.keys(e).length,MP=(e,t,n)=>{const{name:r,...i}=e;return IP(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!n||SP)))},RP=e=>Array.isArray(e)?e:[e];function PP(e){const n=t(c).useRef(e);n.current=e,t(c).useEffect((()=>{const t=!e.disabled&&n.current.subject.subscribe({next:n.current.callback});return()=>{t&&t.unsubscribe()}}),[e.disabled])}var NP=e=>"string"==typeof e,OP=(e,t,n,r)=>NP(e)?(r&&t.watch.add(e),hP(n,e)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),hP(n,e)))):(t.watchAll=!!r,n),DP="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function kP(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(DP&&(e instanceof Blob||e instanceof FileList)||!n&&!aP(e))return e;if(t=n?[]:{},Array.isArray(e)||(e=>{const t=e.constructor&&e.constructor.prototype;return aP(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)t[n]=kP(e[n]);else t=e}return t}var LP=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},BP=e=>/^\w*$/.test(e),zP=e=>uP(e.replace(/["|']|\]/g,"").split(/\.|\[/));function FP(e,t,n){let r=-1;const i=BP(t)?[t]:zP(t),o=i.length,s=o-1;for(;++r<o;){const t=i[r];let o=n;if(r!==s){const n=e[t];o=aP(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}e[t]=o,e=e[t]}return e}const UP=(e,t,n)=>{for(const r of n||Object.keys(e)){const n=hP(e,r);if(n){const{_f:e,...r}=n;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else aP(r)&&UP(r,t)}}};var jP=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))))),GP=(e,t,n)=>{const r=uP(hP(e,n));return FP(r,"root",t[n]),FP(e,n,r),e},HP=e=>"boolean"==typeof e,VP=e=>"file"===e.type,WP=e=>"function"==typeof e,qP=e=>NP(e)||t(c).isValidElement(e),JP=e=>"radio"===e.type,KP=e=>e instanceof RegExp;const YP={value:!1,isValid:!1},$P={value:!0,isValid:!0};var XP=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!dP(e[0].attributes.value)?dP(e[0].value)||""===e[0].value?$P:{value:e[0].value,isValid:!0}:$P:YP}return YP};const QP={isValid:!1,value:null};var ZP=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),QP):QP;function eN(e,t,n="validate"){if(qP(e)||Array.isArray(e)&&e.every(qP)||HP(e)&&!e)return{type:n,message:qP(e)?e:"",ref:t}}var tN=e=>aP(e)&&!KP(e)?e:{value:e,message:""},nN=async(e,t,n,r,i)=>{const{ref:o,refs:s,required:a,maxLength:l,minLength:c,min:u,max:d,pattern:h,validate:p,name:m,valueAsNumber:f,mount:g,disabled:v}=e._f;if(!g||v)return{};const y=s?s[0]:o,S=e=>{r&&y.reportValidity&&(y.setCustomValidity(HP(e)?"":e||""),y.reportValidity())},_={},b=JP(o),x=rP(o),w=b||x,C=(f||VP(o))&&!o.value||""===t||Array.isArray(t)&&!t.length,A=LP.bind(null,m,n,_),E=(e,t,n,r=xP,i=wP)=>{const s=e?t:n;_[m]={type:e?r:i,message:s,ref:o,...A(e?r:i,s)}};if(i?!Array.isArray(t)||!t.length:a&&(!w&&(C||oP(t))||HP(t)&&!t||x&&!XP(s).isValid||b&&!ZP(s).isValid)){const{value:e,message:t}=qP(a)?{value:!!a,message:a}:tN(a);if(e&&(_[m]={type:AP,message:t,ref:y,...A(AP,t)},!n))return S(t),_}if(!(C||oP(u)&&oP(d))){let e,r;const i=tN(d),s=tN(u);if(oP(t)||isNaN(t)){const n=o.valueAsDate||new Date(t),a=e=>new Date((new Date).toDateString()+" "+e),l="time"==o.type,c="week"==o.type;NP(i.value)&&t&&(e=l?a(t)>a(i.value):c?t>i.value:n>new Date(i.value)),NP(s.value)&&t&&(r=l?a(t)<a(s.value):c?t<s.value:n<new Date(s.value))}else{const n=o.valueAsNumber||(t?+t:t);oP(i.value)||(e=n>i.value),oP(s.value)||(r=n<s.value)}if((e||r)&&(E(!!e,i.message,s.message,_P,bP),!n))return S(_[m].message),_}if((l||c)&&!C&&(NP(t)||i&&Array.isArray(t))){const e=tN(l),r=tN(c),i=!oP(e.value)&&t.length>e.value,o=!oP(r.value)&&t.length<r.value;if((i||o)&&(E(i,e.message,r.message),!n))return S(_[m].message),_}if(h&&!C&&NP(t)){const{value:e,message:r}=tN(h);if(KP(e)&&!t.match(e)&&(_[m]={type:CP,message:r,ref:o,...A(CP,r)},!n))return S(r),_}if(p)if(WP(p)){const e=eN(await p(t),y);if(e&&(_[m]={...e,...A(EP,e.message)},!n))return S(e.message),_}else if(aP(p)){let e={};for(const r in p){if(!IP(e)&&!n)break;const i=eN(await p[r](t),y,r);i&&(e={...i,...A(r,i.message)},S(i.message),n&&(_[m]=e))}if(!IP(e)&&(_[m]={ref:y,...e},!n))return _}return S(!0),_};var rN=e=>({isOnSubmit:!e||e===vP,isOnBlur:e===fP,isOnChange:e===gP,isOnAll:e===SP,isOnTouch:e===yP});function iN(e){for(const t in e)if(!dP(e[t]))return!1;return!0}function oN(e,t){const n=BP(t)?[t]:zP(t),r=1==n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=dP(e)?r++:e[t[r++]];return e}(e,n),i=n[n.length-1];let o;r&&delete r[i];for(let t=0;t<n.slice(0,-1).length;t++){let r,i=-1;const s=n.slice(0,-(t+1)),a=s.length-1;for(t>0&&(o=e);++i<s.length;){const t=s[i];r=r?r[t]:e[t],a===i&&(aP(r)&&IP(r)||Array.isArray(r)&&iN(r))&&(o?delete o[t]:delete e[t]),o=r}}return e}function sN(){let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}}var aN=e=>oP(e)||!sP(e);function lN(e,t){if(aN(e)||aN(t))return e===t;if(iP(e)&&iP(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const n=e[i];if(!r.includes(i))return!1;if("ref"!==i){const e=t[i];if(iP(n)&&iP(e)||aP(n)&&aP(e)||Array.isArray(n)&&Array.isArray(e)?!lN(n,e):n!==e)return!1}}return!0}var cN=e=>{const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},uN=e=>"select-multiple"===e.type,dN=e=>cN(e)&&e.isConnected,hN=e=>{for(const t in e)if(WP(e[t]))return!0;return!1};function pN(e,t={}){const n=Array.isArray(e);if(aP(e)||n)for(const n in e)Array.isArray(e[n])||aP(e[n])&&!hN(e[n])?(t[n]=Array.isArray(e[n])?[]:{},pN(e[n],t[n])):oP(e[n])||(t[n]=!0);return t}function mN(e,t,n){const r=Array.isArray(e);if(aP(e)||r)for(const r in e)Array.isArray(e[r])||aP(e[r])&&!hN(e[r])?dP(t)||aN(n[r])?n[r]=Array.isArray(e[r])?pN(e[r],[]):{...pN(e[r])}:mN(e[r],oP(t)?{}:t[r],n[r]):lN(e[r],t[r])?delete n[r]:n[r]=!0;return n}var fN=(e,t)=>mN(e,t,pN(t)),gN=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>dP(e)?e:t?""===e?NaN:e?+e:e:n&&NP(e)?new Date(e):r?r(e):e;function vN(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return VP(t)?t.files:JP(t)?ZP(e.refs).value:uN(t)?[...t.selectedOptions].map((({value:e})=>e)):rP(t)?XP(e.refs).value:gN(dP(t.value)?e.ref.value:t.value,e)}var yN=e=>dP(e)?e:KP(e)?e.source:aP(e)?KP(e.value)?e.value.source:e.value:e;function SN(e,t,n){const r=hP(e,n);if(r||BP(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const r=i.join("."),o=hP(t,r),s=hP(e,r);if(o&&!Array.isArray(o)&&n!==r)return{name:n};if(s&&s.type)return{name:r,error:s};i.pop()}return{name:n}}const _N={mode:vP,reValidateMode:gP,shouldFocusError:!0};function bN(e={}){let t,n={..._N,...e},r={submitCount:0,isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},i={},o=kP(n.defaultValues)||{},s=n.shouldUnregister?{}:kP(o),a={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c=0,u={};const d={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},h={watch:sN(),array:sN(),state:sN()},p=rN(n.mode),m=rN(n.reValidateMode),f=n.criteriaMode===SP,g=async()=>{let e=!1;return d.isValid&&(e=n.resolver?IP((await _()).errors):await b(i,!0),e!==r.isValid&&(r.isValid=e,h.state.next({isValid:e}))),e},v=(e,t,n,r)=>{const l=hP(i,e);if(l){const i=hP(s,e,dP(n)?hP(o,e):n);dP(i)||r&&r.defaultChecked||t?FP(s,e,t?i:vN(l._f)):C(e,i),a.mount&&g()}},y=(e,t,n,i,s)=>{let a=!1,l=!1;const c={name:e};if(d.isDirty&&(l=r.isDirty,r.isDirty=c.isDirty=x(),a=l!==c.isDirty),d.dirtyFields&&(!n||i)){l=hP(r.dirtyFields,e);const n=lN(hP(o,e),t);n?oN(r.dirtyFields,e):FP(r.dirtyFields,e,!0),c.dirtyFields=r.dirtyFields,a=a||l!==!n}if(n){const t=hP(r.touchedFields,e);t||(FP(r.touchedFields,e,n),c.touchedFields=r.touchedFields,a=a||d.touchedFields&&t!==n)}return a&&s&&h.state.next(c),a?c:{}},S=(n,i,o,s)=>{const a=hP(r.errors,n),l=d.isValid&&HP(i)&&r.isValid!==i;var p;if(e.delayError&&o?(p=()=>((e,t)=>{FP(r.errors,e,t),h.state.next({errors:r.errors})})(n,o),t=e=>{clearTimeout(c),c=window.setTimeout(p,e)},t(e.delayError)):(clearTimeout(c),t=null,o?FP(r.errors,n,o):oN(r.errors,n)),(o?!lN(a,o):a)||!IP(s)||l){const e={...s,...l&&HP(i)?{isValid:i}:{},errors:r.errors,name:n};r={...r,...e},h.state.next(e)}u[n]--,d.isValidating&&!Object.values(u).some((e=>e))&&(h.state.next({isValidating:!1}),u={})},_=async e=>n.resolver?await n.resolver({...s},n.context,((e,t,n,r)=>{const i={};for(const n of e){const e=hP(t,n);e&&FP(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}})(e||l.mount,i,n.criteriaMode,n.shouldUseNativeValidation)):{},b=async(e,t,i={valid:!0})=>{for(const o in e){const a=e[o];if(a){const{_f:e,...o}=a;if(e){const o=l.array.has(e.name),c=await nN(a,hP(s,e.name),f,n.shouldUseNativeValidation,o);if(c[e.name]&&(i.valid=!1,t))break;!t&&(hP(c,e.name)?o?GP(r.errors,c,e.name):FP(r.errors,e.name,c[e.name]):oN(r.errors,e.name))}o&&await b(o,t,i)}}return i.valid},x=(e,t)=>(e&&t&&FP(s,e,t),!lN(M(),o)),w=(e,t,n)=>OP(e,l,{...a.mount?s:dP(t)?o:NP(e)?{[e]:t}:t},n),C=(e,t,n={})=>{const r=hP(i,e);let o=t;if(r){const n=r._f;n&&(!n.disabled&&FP(s,e,gN(t,n)),o=DP&&cN(n.ref)&&oP(t)?"":t,uN(n.ref)?[...n.ref.options].forEach((e=>e.selected=o.includes(e.value))):n.refs?rP(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(o)?!!o.find((t=>t===e.value)):o===e.value))):n.refs[0]&&(n.refs[0].checked=!!o):n.refs.forEach((e=>e.checked=e.value===o)):VP(n.ref)?n.ref.value="":(n.ref.value=o,n.ref.type||h.watch.next({name:e})))}(n.shouldDirty||n.shouldTouch)&&y(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&I(e)},A=(e,t,n)=>{for(const r in t){const o=t[r],s=`${e}.${r}`,a=hP(i,s);!l.array.has(e)&&aN(o)&&(!a||a._f)||iP(o)?C(s,o,n):A(s,o,n)}},E=(e,t,n={})=>{const a=hP(i,e),c=l.array.has(e),u=kP(t);FP(s,e,u),c?(h.array.next({name:e,values:s}),(d.isDirty||d.dirtyFields)&&n.shouldDirty&&(r.dirtyFields=fN(o,s),h.state.next({name:e,dirtyFields:r.dirtyFields,isDirty:x(e,u)}))):!a||a._f||oP(u)?C(e,u,n):A(e,u,n),jP(e,l)&&h.state.next({}),h.watch.next({name:e})},T=async e=>{const o=e.target;let a=o.name;const c=hP(i,a);if(c){let b,x;const w=o.type?vN(c._f):lP(e),C=e.type===pP||e.type===mP,A=!((v=c._f).mount&&(v.required||v.min||v.max||v.maxLength||v.minLength||v.pattern||v.validate)||n.resolver||hP(r.errors,a)||c._f.deps)||((e,t,n,r,i)=>!i.isOnAll&&(!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e))(C,hP(r.touchedFields,a),r.isSubmitted,m,p),E=jP(a,l,C);FP(s,a,w),C?(c._f.onBlur&&c._f.onBlur(e),t&&t(0)):c._f.onChange&&c._f.onChange(e);const T=y(a,w,C,!1),M=!IP(T)||E;if(!C&&h.watch.next({name:a,type:e.type}),A)return d.isValid&&g(),M&&h.state.next({name:a,...E?{}:T});if(!C&&E&&h.state.next({}),u[a]=u[a]?u[a]+1:1,h.state.next({isValidating:!0}),n.resolver){const{errors:e}=await _([a]),t=SN(r.errors,i,a),n=SN(e,i,t.name||a);b=n.error,a=n.name,x=IP(e)}else b=(await nN(c,hP(s,a),f,n.shouldUseNativeValidation))[a],g();c._f.deps&&I(c._f.deps),S(a,x,b,T)}var v},I=async(e,t={})=>{let o,s;const a=RP(e);if(h.state.next({isValidating:!0}),n.resolver){const t=await(async e=>{const{errors:t}=await _();if(e)for(const n of e){const e=hP(t,n);e?FP(r.errors,n,e):oN(r.errors,n)}else r.errors=t;return t})(dP(e)?e:a);o=IP(t),s=e?!a.some((e=>hP(t,e))):o}else e?(s=(await Promise.all(a.map((async e=>{const t=hP(i,e);return await b(t&&t._f?{[e]:t}:t)})))).every(Boolean),(s||r.isValid)&&g()):s=o=await b(i);return h.state.next({...!NP(e)||d.isValid&&o!==r.isValid?{}:{name:e},...n.resolver||!e?{isValid:o}:{},errors:r.errors,isValidating:!1}),t.shouldFocus&&!s&&UP(i,(e=>e&&hP(r.errors,e)),e?a:l.mount),s},M=e=>{const t={...o,...a.mount?s:{}};return dP(e)?t:NP(e)?hP(t,e):e.map((e=>hP(t,e)))},R=(e,t)=>({invalid:!!hP((t||r).errors,e),isDirty:!!hP((t||r).dirtyFields,e),isTouched:!!hP((t||r).touchedFields,e),error:hP((t||r).errors,e)}),P=(e,t={})=>{for(const a of e?RP(e):l.mount)l.mount.delete(a),l.array.delete(a),hP(i,a)&&(t.keepValue||(oN(i,a),oN(s,a)),!t.keepError&&oN(r.errors,a),!t.keepDirty&&oN(r.dirtyFields,a),!t.keepTouched&&oN(r.touchedFields,a),!n.shouldUnregister&&!t.keepDefaultValue&&oN(o,a));h.watch.next({}),h.state.next({...r,...t.keepDirty?{isDirty:x()}:{}}),!t.keepIsValid&&g()},N=(e,t={})=>{let r=hP(i,e);const c=HP(t.disabled);return FP(i,e,{...r||{},_f:{...r&&r._f?r._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),r?c&&FP(s,e,t.disabled?void 0:hP(s,e,vN(r._f))):v(e,!0,t.value),{...c?{disabled:t.disabled}:{},...n.shouldUseNativeValidation?{required:!!t.required,min:yN(t.min),max:yN(t.max),minLength:yN(t.minLength),maxLength:yN(t.maxLength),pattern:yN(t.pattern)}:{},name:e,onChange:T,onBlur:T,ref:s=>{if(s){N(e,t),r=hP(i,e);const n=dP(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,a=(e=>JP(e)||rP(e))(n),l=r._f.refs||[];if(a?l.find((e=>e===n)):n===r._f.ref)return;FP(i,e,{_f:{...r._f,...a?{refs:[...l.filter(dN),n,...Array.isArray(hP(o,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),v(e,!1,void 0,n)}else r=hP(i,e,{}),r._f&&(r._f.mount=!1),(n.shouldUnregister||t.shouldUnregister)&&(!cP(l.array,e)||!a.action)&&l.unMount.add(e)}}},O=()=>n.shouldFocusError&&UP(i,(e=>e&&hP(r.errors,e)),l.mount);return{control:{register:N,unregister:P,getFieldState:R,_executeSchema:_,_focusError:O,_getWatch:w,_getDirty:x,_updateValid:g,_removeUnmounted:()=>{for(const e of l.unMount){const t=hP(i,e);t&&(t._f.refs?t._f.refs.every((e=>!dN(e))):!dN(t._f.ref))&&P(e)}l.unMount=new Set},_updateFieldArray:(e,t=[],n,l,c=!0,u=!0)=>{if(l&&n){if(a.action=!0,u&&Array.isArray(hP(i,e))){const t=n(hP(i,e),l.argA,l.argB);c&&FP(i,e,t)}if(u&&Array.isArray(hP(r.errors,e))){const t=n(hP(r.errors,e),l.argA,l.argB);c&&FP(r.errors,e,t),((e,t)=>{!uP(hP(e,t)).length&&oN(e,t)})(r.errors,e)}if(d.touchedFields&&u&&Array.isArray(hP(r.touchedFields,e))){const t=n(hP(r.touchedFields,e),l.argA,l.argB);c&&FP(r.touchedFields,e,t)}d.dirtyFields&&(r.dirtyFields=fN(o,s)),h.state.next({isDirty:x(e,t),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else FP(s,e,t)},_getFieldArray:t=>uP(hP(a.mount?s:o,t,e.shouldUnregister?hP(o,t,[]):[])),_subjects:h,_proxyFormState:d,get _fields(){return i},get _formValues(){return s},get _stateFlags(){return a},set _stateFlags(e){a=e},get _defaultValues(){return o},get _names(){return l},set _names(e){l=e},get _formState(){return r},set _formState(e){r=e},get _options(){return n},set _options(e){n={...n,...e}}},trigger:I,register:N,handleSubmit:(e,t)=>async o=>{o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let a=!0,l=kP(s);h.state.next({isSubmitting:!0});try{if(n.resolver){const{errors:e,values:t}=await _();r.errors=e,l=t}else await b(i);IP(r.errors)?(h.state.next({errors:{},isSubmitting:!0}),await e(l,o)):(t&&await t({...r.errors},o),O())}catch(e){throw a=!1,e}finally{r.isSubmitted=!0,h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:IP(r.errors)&&a,submitCount:r.submitCount+1,errors:r.errors})}},watch:(e,t)=>WP(e)?h.watch.subscribe({next:n=>e(w(void 0,t),n)}):w(e,t,!0),setValue:E,getValues:M,reset:(t,n)=>((t,n={})=>{const c=t||o,u=kP(c),p=t&&!IP(t)?u:o;if(n.keepDefaultValues||(o=c),!n.keepValues){if(n.keepDirtyValues)for(const e of l.mount)hP(r.dirtyFields,e)?FP(p,e,hP(s,e)):E(e,hP(p,e));else{if(DP&&dP(t))for(const e of l.mount){const t=hP(i,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(cN(e)){const t=e.closest("form");if(t){t.reset();break}}}}i={}}s=e.shouldUnregister?n.keepDefaultValues?kP(o):{}:u,h.array.next({values:p}),h.watch.next({values:p})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!d.isValid||!!n.keepIsValid,a.watch=!!e.shouldUnregister,h.state.next({submitCount:n.keepSubmitCount?r.submitCount:0,isDirty:n.keepDirty||n.keepDirtyValues?r.isDirty:!(!n.keepDefaultValues||lN(t,o)),isSubmitted:!!n.keepIsSubmitted&&r.isSubmitted,dirtyFields:n.keepDirty||n.keepDirtyValues?r.dirtyFields:n.keepDefaultValues&&t?fN(o,t):{},touchedFields:n.keepTouched?r.touchedFields:{},errors:n.keepErrors?r.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})})(WP(t)?t(s):t,n),resetField:(e,t={})=>{hP(i,e)&&(dP(t.defaultValue)?E(e,hP(o,e)):(E(e,t.defaultValue),FP(o,e,t.defaultValue)),t.keepTouched||oN(r.touchedFields,e),t.keepDirty||(oN(r.dirtyFields,e),r.isDirty=t.defaultValue?x(e,hP(o,e)):x()),t.keepError||(oN(r.errors,e),d.isValid&&g()),h.state.next({...r}))},clearErrors:e=>{e?RP(e).forEach((e=>oN(r.errors,e))):r.errors={},h.state.next({errors:r.errors})},unregister:P,setError:(e,t,n)=>{const o=(hP(i,e,{_f:{}})._f||{}).ref;FP(r.errors,e,{...t,ref:o}),h.state.next({name:e,errors:r.errors,isValid:!1}),n&&n.shouldFocus&&o&&o.focus&&o.focus()},setFocus:(e,t={})=>{const n=hP(i,e),r=n&&n._f;if(r){const e=r.refs?r.refs[0]:r.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:R}}function xN(e={}){const n=t(c).useRef(),[r,i]=t(c).useState({isDirty:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:e.defaultValues});n.current||(n.current={...bN(e),formState:r});const o=n.current.control;return o._options=e,PP({subject:o._subjects.state,callback:t(c).useCallback((e=>{MP(e,o._proxyFormState,!0)&&(o._formState={...o._formState,...e},i({...o._formState}))}),[o])}),t(c).useEffect((()=>{o._stateFlags.mount||(o._proxyFormState.isValid&&o._updateValid(),o._stateFlags.mount=!0),o._stateFlags.watch&&(o._stateFlags.watch=!1,o._subjects.state.next({})),o._removeUnmounted()})),t(c).useEffect((()=>{r.submitCount&&o._focusError()}),[o,r.submitCount]),n.current.formState=TP(r,o),n.current}var wN=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className:e,"aria-label":t,children:[(0,s.jsx)("path",{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}),(0,s.jsx)("path",{d:"M176 474h672q8 0 8 8v60q0 8-8 8H176q-8 0-8-8v-60q0-8 8-8z"})]});var CN=({pwdOrTokens:e,setPwdOrTokens:t,onFinish:n,minimumNumberOfRecoveryTokens:r=1,showTokens:i=!0,openModal:o=!1,withModal:a=!1})=>{var l;const{t:u}=Ce(),{register:d,handleSubmit:h,formState:{errors:p},setError:m}=xN(),[f,g]=(0,c.useState)(1),[v,y]=(0,c.useState)(!!e),S=(0,s.jsxs)("form",{name:"memoriAuth",onSubmit:h((t=>{var i,o,s;"password"===e&&!(null===(i=t.password)||void 0===i?void 0:i.length)||"tokens"===e&&(((null===(o=null==t?void 0:t.tokens)||void 0===o?void 0:o.length)||0)<r||!(null===(s=null==t?void 0:t.tokens)||void 0===s?void 0:s.every((e=>e.length))))?m("tokens",{type:"minLength",message:"Tokens"}):n&&n(t).then((()=>{y(!1)}))})),className:"memori-auth-widget--form",children:[("password"===e||!i)&&(0,s.jsxs)("fieldset",{className:"memori-auth-widget--password-fieldset",children:[(0,s.jsxs)("label",{children:["Password:"," ",(0,s.jsx)("input",{className:"memori-auth-widget--input",required:!0,type:"password",placeholder:"Password",...d("password",{required:!0})})]}),i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("hr",{}),(0,s.jsx)(Em,{outlined:!0,onClick:()=>t("tokens"),children:u("auth.useRecoveryTokens")||"Recovery tokens"})]})]}),"tokens"===e&&i&&(0,s.jsxs)("fieldset",{className:"memori-auth-widget--tokens-fieldset",name:"tokens",children:[(0,s.jsxs)("legend",{children:[u("auth.tokens"),": "]}),(_=f,Array.from({length:_},((e,t)=>t))).map((e=>(0,s.jsx)("label",{className:"memori-auth-widget--token",children:(0,s.jsx)("input",{type:"password",className:"memori-auth-widget--input",placeholder:"Recovery token",required:!0,autoComplete:"off",...d(`tokens.${e}`,{required:!0})})},e))),(0,s.jsx)(Em,{onClick:()=>g((e=>e+1)),className:"memori-auth-widget--token-add",icon:(0,s.jsx)(wN,{}),children:u("auth.addToken")||"Add token"}),(0,s.jsx)("hr",{}),(0,s.jsx)(Em,{outlined:!0,onClick:()=>t("password"),children:u("auth.usePassword")||"Password"})]}),"minLength"===(null===(l=p.tokens)||void 0===l?void 0:l.type)&&(0,s.jsxs)("div",{className:"memori-auth-widget--error",children:[u("auth.atLeast")||"At least"," ",r]}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,className:"memori-auth-widget--submit",children:u("confirm")||"Submit"})]});var _;return a?(0,s.jsx)(nP,{open:o||v,title:u("auth.title")||"Authentication",onClose:()=>t(null),closable:!1,children:S}):S};c=o("85Hg2");const AN=({type:e,resourceURI:t,sessionID:n,baseURL:r="",apiURL:i=""})=>{let o="cover"===e?`${r}/images/memoriCover.png`:`${r}/images/memoriAvatar.png?v=20231208`;try{return t&&0!==t.length?t.includes("memoriai/memory")&&!t.includes("memori-ai-session-id")&&n?`${t}?memori-ai-session-id=${n}`:(t.startsWith("https://")||t.startsWith("http://"))&&(new URL(t).hostname.includes("memori.ai")||new URL(t).hostname.includes("aclambda.online")||new URL(t).hostname.includes("localhost"))?`${t}${t.endsWith("/")||!n?"":"/"}${n||""}`:t.startsWith("cloud://")?`${(null==i?void 0:i.replace(/v2/,"v1"))||""}/CloudAsset/${t.replace("cloud://","")}`:t.startsWith("guid://")?`${(null==i?void 0:i.replace(/v2/,"v1"))||""}/GuidAsset/${t.replace("guid://","")}`:t||o:o}catch(e){return t||o}};c=o("85Hg2");var EN=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M858.5 763.6a374 374 0 0 0-80.6-119.5 375.63 375.63 0 0 0-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 0 0-80.6 119.5A371.7 371.7 0 0 0 136 901.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 0 0 8-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"})});var TN=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",className:e,"aria-label":t,children:(0,s.jsxs)("g",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",children:[(0,s.jsx)("path",{fillRule:"evenodd",d:"M0 4a4 4 0 014-4h16a4 4 0 014 4v16a4 4 0 01-4 4H4a4 4 0 01-4-4zm4-2.4A2.4 2.4 0 001.6 4v16A2.4 2.4 0 004 22.4h16a2.4 2.4 0 002.4-2.4V4A2.4 2.4 0 0020 1.6z",clipRule:"evenodd"}),(0,s.jsx)("path",{fillRule:"evenodd",d:"M9.715 8.442a.798.798 0 00-1.43 0l-3.2 6.4a.799.799 0 101.431.716l.579-1.158h3.811l.578 1.158a.8.8 0 001.431-.716zm.391 4.358L9 10.589 7.894 12.8z",clipRule:"evenodd"}),(0,s.jsx)("path",{fillRule:"evenodd",d:"M17 8c.552 0 1 .358 1 .8v6.4c0 .442-.448.8-1 .8s-1-.358-1-.8V8.8c0-.442.448-.8 1-.8z",clipRule:"evenodd"})]})});var IN=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className:e,"aria-label":t,children:[(0,s.jsx)("path",{d:"M140 188h584v164h76V144c0-17.7-14.3-32-32-32H96c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h544v-76H140V188z"}),(0,s.jsx)("path",{d:"M414.3 256h-60.6c-3.4 0-6.4 2.2-7.6 5.4L219 629.4c-.3.8-.4 1.7-.4 2.6 0 4.4 3.6 8 8 8h55.1c3.4 0 6.4-2.2 7.6-5.4L322 540h196.2L422 261.4c-1.3-3.2-4.3-5.4-7.7-5.4zm12.4 228h-85.5L384 360.2 426.7 484zM936 528H800v-93c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v93H592c-13.3 0-24 10.7-24 24v176c0 13.3 10.7 24 24 24h136v152c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V752h136c13.3 0 24-10.7 24-24V552c0-13.3-10.7-24-24-24zM728 680h-88v-80h88v80zm160 0h-88v-80h88v80z"})]});var MN=({content:e,className:n,align:r="right",disabled:i=!1,visible:o=!1,children:a})=>(0,s.jsxs)("div",{className:t(Cs)("memori-tooltip",`memori-tooltip--align-${r}`,n,{"memori-tooltip--disabled":i,"memori-tooltip--visible":o}),children:[(0,s.jsx)("div",{className:"memori-tooltip--content",children:e}),(0,s.jsx)("div",{className:"memori-tooltip--trigger",children:a})]}),RN=(c=o("85Hg2"),c=o("85Hg2"),(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(RN||{})),PN=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(PN||{}),NN=(e=>(e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItem=5]="RegisterItem",e[e.UnregisterItem=6]="UnregisterItem",e))(NN||{});function ON(e,t=(e=>e)){let n=null!==e.activeItemIndex?e.items[e.activeItemIndex]:null,r=Rp(t(e.items.slice()),(e=>e.dataRef.current.domRef.current)),i=n?r.indexOf(n):null;return-1===i&&(i=null),{items:r,activeItemIndex:i}}let DN={1:e=>1===e.menuState?e:{...e,activeItemIndex:null,menuState:1},0:e=>0===e.menuState?e:{...e,menuState:0},2:(e,t)=>{var n;let r=ON(e),i=CR(t,{resolveItems:()=>r.items,resolveActiveIndex:()=>r.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeItemIndex:i,activationTrigger:null!=(n=t.trigger)?n:1}},3:(e,t)=>{let n=""!==e.searchQuery?0:1,r=e.searchQuery+t.value.toLowerCase(),i=(null!==e.activeItemIndex?e.items.slice(e.activeItemIndex+n).concat(e.items.slice(0,e.activeItemIndex+n)):e.items).find((e=>{var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(r))&&!e.dataRef.current.disabled})),o=i?e.items.indexOf(i):-1;return-1===o||o===e.activeItemIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeItemIndex:o,activationTrigger:1}},4:e=>""===e.searchQuery?e:{...e,searchQuery:"",searchActiveItemIndex:null},5:(e,t)=>{let n=ON(e,(e=>[...e,{id:t.id,dataRef:t.dataRef}]));return{...e,...n}},6:(e,t)=>{let n=ON(e,(e=>{let n=e.findIndex((e=>e.id===t.id));return-1!==n&&e.splice(n,1),e}));return{...e,...n,activationTrigger:1}}},kN=(0,c.createContext)(null);function LN(e){let t=(0,c.useContext)(kN);if(null===t){let t=new Error(`<${e} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,LN),t}return t}function BN(e,t){return mh(t.type,DN,e,t)}kN.displayName="MenuContext";let zN=c.Fragment,FN=bh((function(e,n){let r=(0,c.useReducer)(BN,{menuState:1,buttonRef:(0,c.createRef)(),itemsRef:(0,c.createRef)(),items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1}),[{menuState:i,itemsRef:o,buttonRef:s},a]=r,l=Bh(n);cm([s,o],((e,t)=>{var n;a({type:1}),Ep(t,Ap.Loose)||(e.preventDefault(),null==(n=s.current)||n.focus())}),0===i);let u=Dh((()=>{a({type:1})})),d=(0,c.useMemo)((()=>({open:0===i,close:u})),[i,u]),h=e,p={ref:l};return t(c).createElement(kN.Provider,{value:r},t(c).createElement(Th,{value:mh(i,{0:Ah.Open,1:Ah.Closed})},yh({ourProps:p,theirProps:h,slot:d,defaultTag:zN,name:"Menu"})))})),UN=bh((function(e,t){var n;let[r,i]=LN("Menu.Button"),o=Bh(r.buttonRef,t),s=`headlessui-menu-button-${fp()}`,a=qh(),l=Dh((e=>{switch(e.key){case up.Space:case up.Enter:case up.ArrowDown:e.preventDefault(),e.stopPropagation(),i({type:0}),a.nextFrame((()=>i({type:2,focus:wR.First})));break;case up.ArrowUp:e.preventDefault(),e.stopPropagation(),i({type:0}),a.nextFrame((()=>i({type:2,focus:wR.Last})))}})),u=Dh((e=>{if(e.key===up.Space)e.preventDefault()})),d=Dh((t=>{if(dp(t.currentTarget))return t.preventDefault();e.disabled||(0===r.menuState?(i({type:1}),a.nextFrame((()=>{var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(t.preventDefault(),i({type:0})))})),h=(0,c.useMemo)((()=>({open:0===r.menuState})),[r]),p=e;return yh({ourProps:{ref:o,id:s,type:bR(e,r.buttonRef),"aria-haspopup":!0,"aria-controls":null==(n=r.itemsRef.current)?void 0:n.id,"aria-expanded":e.disabled?void 0:0===r.menuState,onKeyDown:l,onKeyUp:u,onClick:d},theirProps:p,slot:h,defaultTag:"button",name:"Menu.Button"})})),jN=gh.RenderStrategy|gh.Static,GN=bh((function(e,t){var n,r;let[i,o]=LN("Menu.Items"),s=Bh(i.itemsRef,t),a=Lp(i.itemsRef),l=`headlessui-menu-items-${fp()}`,u=qh(),d=Eh(),h=null!==d?d===Ah.Open:0===i.menuState;(0,c.useEffect)((()=>{let e=i.itemsRef.current;!e||0===i.menuState&&e!==(null==a?void 0:a.activeElement)&&e.focus({preventScroll:!0})}),[i.menuState,i.itemsRef,a]),xR({container:i.itemsRef.current,enabled:0===i.menuState,accept:e=>"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let p=Dh((e=>{var t,n;switch(u.dispose(),e.key){case up.Space:if(""!==i.searchQuery)return e.preventDefault(),e.stopPropagation(),o({type:3,value:e.key});case up.Enter:if(e.preventDefault(),e.stopPropagation(),o({type:1}),null!==i.activeItemIndex){let{dataRef:e}=i.items[i.activeItemIndex];null==(n=null==(t=e.current)?void 0:t.domRef.current)||n.click()}Tp(i.buttonRef.current);break;case up.ArrowDown:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:wR.Next});case up.ArrowUp:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:wR.Previous});case up.Home:case up.PageUp:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:wR.First});case up.End:case up.PageDown:return e.preventDefault(),e.stopPropagation(),o({type:2,focus:wR.Last});case up.Escape:e.preventDefault(),e.stopPropagation(),o({type:1}),Uh().nextFrame((()=>{var e;return null==(e=i.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case up.Tab:e.preventDefault(),e.stopPropagation(),o({type:1}),Uh().nextFrame((()=>{Pp(i.buttonRef.current,e.shiftKey?bp.Previous:bp.Next)}));break;default:1===e.key.length&&(o({type:3,value:e.key}),u.setTimeout((()=>o({type:4})),350))}})),m=Dh((e=>{if(e.key===up.Space)e.preventDefault()})),f=(0,c.useMemo)((()=>({open:0===i.menuState})),[i]),g=e;return yh({ourProps:{"aria-activedescendant":null===i.activeItemIndex||null==(n=i.items[i.activeItemIndex])?void 0:n.id,"aria-labelledby":null==(r=i.buttonRef.current)?void 0:r.id,id:l,onKeyDown:p,onKeyUp:m,role:"menu",tabIndex:0,ref:s},theirProps:g,slot:f,defaultTag:"div",features:jN,visible:h,name:"Menu.Items"})})),HN=c.Fragment,VN=bh((function(e,t){let{disabled:n=!1,...r}=e,[i,o]=LN("Menu.Item"),s=`headlessui-menu-item-${fp()}`,a=null!==i.activeItemIndex&&i.items[i.activeItemIndex].id===s,l=(0,c.useRef)(null),u=Bh(t,l);Mh((()=>{if(0!==i.menuState||!a||0===i.activationTrigger)return;let e=Uh();return e.requestAnimationFrame((()=>{var e,t;null==(t=null==(e=l.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})),e.dispose}),[l,a,i.menuState,i.activationTrigger,i.activeItemIndex]);let d=(0,c.useRef)({disabled:n,domRef:l});Mh((()=>{d.current.disabled=n}),[d,n]),Mh((()=>{var e,t;d.current.textValue=null==(t=null==(e=l.current)?void 0:e.textContent)?void 0:t.toLowerCase()}),[d,l]),Mh((()=>(o({type:5,id:s,dataRef:d}),()=>o({type:6,id:s}))),[d,s]);let h=Dh((()=>{o({type:1})})),p=Dh((e=>{if(n)return e.preventDefault();o({type:1}),Tp(i.buttonRef.current)})),m=Dh((()=>{if(n)return o({type:2,focus:wR.Nothing});o({type:2,focus:wR.Specific,id:s})})),f=Dh((()=>{n||a||o({type:2,focus:wR.Specific,id:s,trigger:0})})),g=Dh((()=>{n||!a||o({type:2,focus:wR.Nothing})})),v=(0,c.useMemo)((()=>({active:a,disabled:n,close:h})),[a,n,h]);return yh({ourProps:{id:s,ref:u,role:"menuitem",tabIndex:!0===n?void 0:-1,"aria-disabled":!0===n||void 0,disabled:void 0,onClick:p,onFocus:m,onPointerMove:f,onMouseMove:f,onPointerLeave:g,onMouseLeave:g},theirProps:r,slot:v,defaultTag:HN,name:"Menu.Item"})})),WN=Object.assign(FN,{Button:UN,Items:GN,Item:VN});var qN=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,"aria-label":t,children:[(0,s.jsx)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,s.jsx)("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17l-.59.59-.58.58V4h16v12zm-9-4h2v2h-2zm0-6h2v4h-2z"})]});const JN={"it-IT":"Non è quello che ti ho chiesto","fr-FR":"Ce n'est pas ce que je t'ai demandé","en-GB":"It's not what I asked"},KN={"it-IT":"La risposta non era corretta","fr-FR":"La réponse n'était pas correcte","en-GB":"The answer was not correct"},YN={"it-IT":"Non mi è piaciuta la risposta","fr-FR":"Je n'ai pas aimé la réponse","en-GB":"I didn't like the answer"};var $N=({memori:e,className:n,onNegativeClick:r,toggle:i=!1,dropdown:o=!1})=>{const[a,l]=(0,c.useState)(),u="it-IT"===e.culture?"it-IT":"fr-FR"===e.culture?"fr-FR":"en-GB",d=JN[u],h=KN[u],p=YN[u];return(0,s.jsx)("div",{className:"memori-chat--feedback"+(n?` ${n}`:""),children:o?(0,s.jsxs)(WN,{as:"div",className:"memori-chat--feedback-menu",children:[(0,s.jsx)(WN.Button,{as:t(c).Fragment,children:(0,s.jsx)(Em,{ghost:!0,shape:"circle",title:"Feedback",className:"memori-chat--feedback-menu-button",disabled:!!a,icon:(0,s.jsx)(qN,{className:a?"memori-chat--feedback-clicked":void 0})})}),(0,s.jsx)(lp,{as:t(c).Fragment,enter:"transition ease-out duration-200",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,s.jsx)(WN.Items,{className:"memori-chat--feedback-menu-items",children:(0,s.jsxs)("div",{className:"memori-chat--feedback-menu-items-container",children:[(0,s.jsx)(WN.Item,{children:({active:e})=>(0,s.jsx)("button",{className:"memori-chat--feedback-menu-item"+(e?" memori-chat--feedback-menu-item-active":""),onClick:()=>{l("up"===a&&i?void 0:"up")},children:p})},"ok"),(0,s.jsx)(WN.Item,{children:({active:e})=>(0,s.jsx)("button",{className:"memori-chat--feedback-menu-item"+(e?" memori-chat--feedback-menu-item-active":""),onClick:()=>{l("down"===a&&i?void 0:"down"),r(d)},children:h})},"no")]})})})]}):(0,s.jsx)(MN,{align:"left",content:"Feedback",children:(0,s.jsx)(Em,{title:"Feedback",onClick:()=>{l("down"===a&&i?void 0:"down"),r(d)},ghost:!0,shape:"circle",icon:(0,s.jsx)(qN,{className:a?"memori-chat--feedback-clicked":void 0})})})})},XN={};!function(e){"use strict";function t(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function n(t){e.defaults=t}e.defaults=t();const r={exec:()=>null};function i(e,t=""){let n="string"==typeof e?e:e.source;const r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(o.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}const o={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},s=/^(?:[ \t]*(?:\n|$))+/,a=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,l=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,c=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,u=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,d=/(?:[*+-]|\d{1,9}[.)])/,h=i(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,d).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),p=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,m=/^[^\n]+/,f=/(?!\s*\])(?:\\.|[^\[\]\\])+/,g=i(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",f).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),v=i(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,d).getRegex(),y="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",S=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_=i("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",S).replace("tag",y).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),b=i(p).replace("hr",c).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",y).getRegex(),x={blockquote:i(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",b).getRegex(),code:a,def:g,fences:l,heading:u,hr:c,html:_,lheading:h,list:v,newline:s,paragraph:b,table:r,text:m},w=i("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",c).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",y).getRegex(),C={...x,table:w,paragraph:i(p).replace("hr",c).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",w).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",y).getRegex()},A={...x,html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",S).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:r,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:i(p).replace("hr",c).replace("heading"," *#{1,6} *[^\n]").replace("lheading",h).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},E=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,T=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,I=/^( {2,}|\\)\n(?!\s*$)/,M=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,R=/\p{P}\p{S}/u,P=i(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,R).getRegex(),N=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,O=i(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,R).getRegex(),D=i("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,R).getRegex(),k=i("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,R).getRegex(),L=i(/\\([punct])/,"gu").replace(/punct/g,R).getRegex(),B=i(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),z=i(S).replace("(?:--\x3e|$)","--\x3e").getRegex(),F=i("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",z).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),U=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,j=i(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",U).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),G=i(/^!?\[(label)\]\[(ref)\]/).replace("label",U).replace("ref",f).getRegex(),H=i(/^!?\[(ref)\](?:\[\])?/).replace("ref",f).getRegex(),V=i("reflink|nolink(?!\\()","g").replace("reflink",G).replace("nolink",H).getRegex(),W={_backpedal:r,anyPunctuation:L,autolink:B,blockSkip:N,br:I,code:T,del:r,emStrongLDelim:O,emStrongRDelimAst:D,emStrongRDelimUnd:k,escape:E,link:j,nolink:H,punctuation:P,reflink:G,reflinkSearch:V,tag:F,text:M,url:r},q={...W,link:i(/^!?\[(label)\]\((.*?)\)/).replace("label",U).getRegex(),reflink:i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",U).getRegex()},J={...W,escape:i(E).replace("])","~|])").getRegex(),url:i(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},K={...J,br:i(I).replace("{2,}","*").getRegex(),text:i(J.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Y={normal:x,gfm:C,pedantic:A},$={normal:W,gfm:J,breaks:K,pedantic:q},X={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Q=e=>X[e];function Z(e,t){if(t){if(o.escapeTest.test(e))return e.replace(o.escapeReplace,Q)}else if(o.escapeTestNoEncode.test(e))return e.replace(o.escapeReplaceNoEncode,Q);return e}function ee(e){try{e=encodeURI(e).replace(o.percentDecode,"%")}catch{return null}return e}function te(e,t){const n=e.replace(o.findPipe,((e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"})).split(o.splitPipe);let r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(o.slashPipe,"|");return n}function ne(e,t,n){const r=e.length;if(0===r)return"";let i=0;for(;i<r;){const o=e.charAt(r-i-1);if(o!==t||n){if(o===t||!n)break;i++}else i++}return e.slice(0,r-i)}function re(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return-1}function ie(e,t,n,r,i){const o=t.href,s=t.title||null,a=e[1].replace(i.other.outputLinkReplace,"$1");if("!"!==e[0].charAt(0)){r.state.inLink=!0;const e={type:"link",raw:n,href:o,title:s,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,e}return{type:"image",raw:n,href:o,title:s,text:a}}function oe(e,t,n){const r=e.match(n.other.indentCodeCompensation);if(null===r)return t;const i=r[1];return t.split("\n").map((e=>{const t=e.match(n.other.beginningSpace);if(null===t)return e;const[r]=t;return r.length>=i.length?e.slice(i.length):e})).join("\n")}class se{options;rules;lexer;constructor(t){this.options=t||e.defaults}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:ne(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=oe(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){const t=ne(e,"#");this.options.pedantic?e=t.trim():t&&!this.rules.other.endingSpaceChar.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ne(t[0],"\n")}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=ne(t[0],"\n").split("\n"),n="",r="";const i=[];for(;e.length>0;){let t=!1;const o=[];let s;for(s=0;s<e.length;s++)if(this.rules.other.blockquoteStart.test(e[s]))o.push(e[s]),t=!0;else{if(t)break;o.push(e[s])}e=e.slice(s);const a=o.join("\n"),l=a.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}\n${a}`:a,r=r?`${r}\n${l}`:l;const c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,i,!0),this.lexer.state.top=c,0===e.length)break;const u=i.at(-1);if("code"===u?.type)break;if("blockquote"===u?.type){const t=u,o=t.raw+"\n"+e.join("\n"),s=this.blockquote(o);i[i.length-1]=s,n=n.substring(0,n.length-t.raw.length)+s.raw,r=r.substring(0,r.length-t.text.length)+s.text;break}if("list"!==u?.type);else{const t=u,o=t.raw+"\n"+e.join("\n"),s=this.list(o);i[i.length-1]=s,n=n.substring(0,n.length-u.raw.length)+s.raw,r=r.substring(0,r.length-t.raw.length)+s.raw,e=o.substring(i.at(-1).raw.length).split("\n")}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const o=this.rules.other.listItemRegex(n);let s=!1;for(;e;){let n=!1,r="",a="";if(!(t=o.exec(e)))break;if(this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],u=!l.trim(),d=0;if(this.options.pedantic?(d=2,a=l.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,a=l.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(c)&&(r+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),o=this.rules.other.headingBeginRegex(d),s=this.rules.other.htmlBeginRegex(d);for(;e;){const h=e.split("\n",1)[0];let p;if(c=h,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),p=c):p=c.replace(this.rules.other.tabCharGlobal," "),i.test(c))break;if(o.test(c))break;if(s.test(c))break;if(t.test(c))break;if(n.test(c))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!c.trim())a+="\n"+p.slice(d);else{if(u)break;if(l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4)break;if(i.test(l))break;if(o.test(l))break;if(n.test(l))break;a+="\n"+c}u||c.trim()||(u=!0),r+=h+"\n",e=e.substring(h.length+1),l=p.slice(d)}}i.loose||(s?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(s=!0));let h,p=null;this.options.gfm&&(p=this.rules.other.listIsTask.exec(a),p&&(h="[ ] "!==p[0],a=a.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:r,task:!!p,checked:h,loose:!1,text:a,tokens:[]}),i.raw+=r}const a=i.items.at(-1);a&&(a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd()),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){const t=i.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>this.rules.other.anyLine.test(e.raw)));i.loose=n}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!this.rules.other.tableDelimiter.test(t[2]))return;const n=te(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const e of r)this.rules.other.tableAlignRight.test(e)?o.align.push("right"):this.rules.other.tableAlignCenter.test(e)?o.align.push("center"):this.rules.other.tableAlignLeft.test(e)?o.align.push("left"):o.align.push(null);for(let e=0;e<n.length;e++)o.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:o.align[e]});for(const e of i)o.rows.push(te(e,o.header.length).map(((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]}))));return o}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;const t=ne(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=re(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){const e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),ie(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:r?r.replace(this.rules.inline.anyPunctuation,"$1"):r},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return ie(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&(!r[3]||!n.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[2]||!n||this.rules.inline.punctuation.exec(n))){const n=[...r[0]].length-1;let i,o,s=n,a=0;const l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(r=l.exec(t));){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){s+=o;continue}if((r[5]||r[6])&&n%3&&!((n+o)%3)){a+=o;continue}if(s-=o,s>0)continue;o=Math.min(o,o+s+a);const t=[...r[0]][0].length,l=e.slice(0,n+r.index+t+o);if(Math.min(n,o)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=t[1],n="mailto:"+e):(e=t[1],n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=t[0],n="mailto:"+e;else{let r;do{r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(r!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}}class ae{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||e.defaults,this.options.tokenizer=this.options.tokenizer||new se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:o,block:Y.normal,inline:$.normal};this.options.pedantic?(n.block=Y.pedantic,n.inline=$.pedantic):this.options.gfm&&(n.block=Y.gfm,this.options.breaks?n.inline=$.breaks:n.inline=$.gfm),this.tokenizer.rules=n}static get rules(){return{block:Y,inline:$}}static lex(e,t){return new ae(t).lex(e)}static lexInline(e,t){return new ae(t).inlineTokens(e)}lex(e){e=e.replace(o.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(o.tabCharGlobal," ").replace(o.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);const n=t.at(-1);1===r.raw.length&&void 0!==n?n.raw+="\n":t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);const n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+="\n"+r.raw,n.text+="\n"+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);const n=t.at(-1);"paragraph"===n?.type||"text"===n?.type?(n.raw+="\n"+r.raw,n.text+="\n"+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startBlock.forEach((e=>{r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){const o=t.at(-1);n&&"paragraph"===o?.type?(o.raw+="\n"+r.raw,o.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);const n=t.at(-1);"text"===n?.type?(n.raw+="\n"+r.raw,n.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(n));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(n));)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(n));)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i=!1,o="";for(;e;){let r;if(i||(o=""),i=!1,this.options.extensions?.inline?.some((n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);const n=t.at(-1);"text"===r.type&&"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startInline.forEach((e=>{r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(s)){e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(o=r.raw.slice(-1)),i=!0;const n=t.at(-1);"text"===n?.type?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}}class le{options;parser;constructor(t){this.options=t||e.defaults}space(e){return""}code({text:e,lang:t,escaped:n}){const r=(t||"").match(o.notSpaceStart)?.[0],i=e.replace(o.endingNewline,"")+"\n";return r?'<pre><code class="language-'+Z(r)+'">'+(n?i:Z(i,!0))+"</code></pre>\n":"<pre><code>"+(n?i:Z(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){const t=e.ordered,n=e.start;let r="";for(let t=0;t<e.items.length;t++){const n=e.items[t];r+=this.listitem(n)}const i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){let t="";if(e.task){const n=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+Z(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",n="";for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r="";for(let t=0;t<e.rows.length;t++){const i=e.rows[t];n="";for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Z(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const r=this.parser.parseInline(n),i=ee(e);if(null===i)return r;let o='<a href="'+(e=i)+'"';return t&&(o+=' title="'+Z(t)+'"'),o+=">"+r+"</a>",o}image({href:e,title:t,text:n}){const r=ee(e);if(null===r)return Z(n);let i=`<img src="${e=r}" alt="${n}"`;return t&&(i+=` title="${Z(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Z(e.text)}}class ce{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class ue{options;renderer;textRenderer;constructor(t){this.options=t||e.defaults,this.options.renderer=this.options.renderer||new le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ce}static parse(e,t){return new ue(t).parse(e)}static parseInline(e,t){return new ue(t).parseInline(e)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){const i=e[r];if(this.options.extensions?.renderers?.[i.type]){const e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}const o=i;switch(o.type){case"space":n+=this.renderer.space(o);continue;case"hr":n+=this.renderer.hr(o);continue;case"heading":n+=this.renderer.heading(o);continue;case"code":n+=this.renderer.code(o);continue;case"table":n+=this.renderer.table(o);continue;case"blockquote":n+=this.renderer.blockquote(o);continue;case"list":n+=this.renderer.list(o);continue;case"html":n+=this.renderer.html(o);continue;case"paragraph":n+=this.renderer.paragraph(o);continue;case"text":{let i=o,s=this.renderer.text(i);for(;r+1<e.length&&"text"===e[r+1].type;)i=e[++r],s+="\n"+this.renderer.text(i);n+=t?this.renderer.paragraph({type:"paragraph",raw:s,text:s,tokens:[{type:"text",raw:s,text:s,escaped:!0}]}):s;continue}default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){const i=e[r];if(this.options.extensions?.renderers?.[i.type]){const e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=e||"";continue}}const o=i;switch(o.type){case"escape":case"text":n+=t.text(o);break;case"html":n+=t.html(o);break;case"link":n+=t.link(o);break;case"image":n+=t.image(o);break;case"strong":n+=t.strong(o);break;case"em":n+=t.em(o);break;case"codespan":n+=t.codespan(o);break;case"br":n+=t.br(o);break;case"del":n+=t.del(o);break;default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class de{options;block;constructor(t){this.options=t||e.defaults}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?ae.lex:ae.lexInline}provideParser(){return this.block?ue.parse:ue.parseInline}}class he{defaults=t();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ue;Renderer=le;TextRenderer=ce;Lexer=ae;Tokenizer=se;Hooks=de;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{const e=r;for(const r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(const r of e.rows)for(const e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((r=>{const i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new le(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;const r=n,i=e.renderer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new se(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const r=n,i=e.tokenizer[r],o=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new de;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;const r=n,i=e.hooks[r],o=t[r];de.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then((e=>o.call(t,e)));const n=i.call(t,e);return o.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ae.lex(e,t??this.defaults)}parser(e,t){return ue.parse(e,t??this.defaults)}parseMarkdown(e){const t=(t,n)=>{const r={...n},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(null==t)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);const s=i.hooks?i.hooks.provideLexer():e?ae.lex:ae.lexInline,a=i.hooks?i.hooks.provideParser():e?ue.parse:ue.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then((e=>s(e,i))).then((e=>i.hooks?i.hooks.processAllTokens(e):e)).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>a(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(o);try{i.hooks&&(t=i.hooks.preprocess(t));let e=s(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let n=a(e,i);return i.hooks&&(n=i.hooks.postprocess(n)),n}catch(e){return o(e)}};return t}onError(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+Z(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}}const pe=new he;function me(e,t){return pe.parse(e,t)}me.options=me.setOptions=function(e){return pe.setOptions(e),me.defaults=pe.defaults,n(me.defaults),me},me.getDefaults=t,me.defaults=e.defaults,me.use=function(...e){return pe.use(...e),me.defaults=pe.defaults,n(me.defaults),me},me.walkTokens=function(e,t){return pe.walkTokens(e,t)},me.parseInline=pe.parseInline,me.Parser=ue,me.parser=ue.parse,me.Renderer=le,me.TextRenderer=ce,me.Lexer=ae,me.lexer=ae.lex,me.Tokenizer=se,me.Hooks=de,me.parse=me;const fe=me.options,ge=me.setOptions,ve=me.use,ye=me.walkTokens,Se=me.parseInline,_e=me,be=ue.parse,xe=ae.lex;e.Hooks=de,e.Lexer=ae,e.Marked=he,e.Parser=ue,e.Renderer=le,e.TextRenderer=ce,e.Tokenizer=se,e.getDefaults=t,e.lexer=xe,e.marked=me,e.options=fe,e.parse=_e,e.parseInline=Se,e.parser=be,e.setOptions=ge,e.use=ve,e.walkTokens=ye}(XN);var QN={};
245
- /*! @license DOMPurify 3.2.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.1/LICENSE */QN=function(){"use strict";const{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:r,getOwnPropertyDescriptor:i}=Object;let{freeze:o,seal:s,create:a}=Object,{apply:l,construct:c}="undefined"!=typeof Reflect&&Reflect;o||(o=function(e){return e}),s||(s=function(e){return e}),l||(l=function(e,t,n){return e.apply(t,n)}),c||(c=function(e,t){return new e(...t)});const u=x(Array.prototype.forEach),d=x(Array.prototype.pop),h=x(Array.prototype.push),p=x(String.prototype.toLowerCase),m=x(String.prototype.toString),f=x(String.prototype.match),g=x(String.prototype.replace),v=x(String.prototype.indexOf),y=x(String.prototype.trim),S=x(Object.prototype.hasOwnProperty),_=x(RegExp.prototype.test),b=w(TypeError);function x(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return l(e,t,r)}}function w(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return c(e,n)}}function C(e,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p;t&&t(e,null);let o=r.length;for(;o--;){let t=r[o];if("string"==typeof t){const e=i(t);e!==t&&(n(r)||(r[o]=e),t=e)}e[t]=!0}return e}function A(e){for(let t=0;t<e.length;t++)S(e,t)||(e[t]=null);return e}function E(t){const n=a(null);for(const[r,i]of e(t))S(t,r)&&(Array.isArray(i)?n[r]=A(i):i&&"object"==typeof i&&i.constructor===Object?n[r]=E(i):n[r]=i);return n}function T(e,t){for(;null!==e;){const n=i(e,t);if(n){if(n.get)return x(n.get);if("function"==typeof n.value)return x(n.value)}e=r(e)}function n(){return null}return n}const I=o(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),M=o(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),R=o(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P=o(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),N=o(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),O=o(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),D=o(["#text"]),k=o(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),L=o(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),B=o(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),z=o(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),F=s(/\{\{[\w\W]*|[\w\W]*\}\}/gm),U=s(/<%[\w\W]*|[\w\W]*%>/gm),j=s(/\${[\w\W]*}/gm),G=s(/^data-[\-\w.\u00B7-\uFFFF]/),H=s(/^aria-[\-\w]+$/),V=s(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),W=s(/^(?:\w+script|data):/i),q=s(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),J=s(/^html$/i),K=s(/^[a-z][.\w]*(-[.\w]+)+$/i);var Y=Object.freeze({__proto__:null,ARIA_ATTR:H,ATTR_WHITESPACE:q,CUSTOM_ELEMENT:K,DATA_ATTR:G,DOCTYPE_NAME:J,ERB_EXPR:U,IS_ALLOWED_URI:V,IS_SCRIPT_OR_DATA:W,MUSTACHE_EXPR:F,TMPLIT_EXPR:j});const $={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},X=function(){return"undefined"==typeof window?null:window},Q=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}};function Z(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X();const n=e=>Z(e);if(n.version="3.2.1",n.removed=[],!t||!t.document||t.document.nodeType!==$.document)return n.isSupported=!1,n;let{document:r}=t;const i=r,s=i.currentScript,{DocumentFragment:l,HTMLTemplateElement:c,Node:x,Element:w,NodeFilter:A,NamedNodeMap:F=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:U,DOMParser:j,trustedTypes:G}=t,H=w.prototype,W=T(H,"cloneNode"),q=T(H,"remove"),K=T(H,"nextSibling"),ee=T(H,"childNodes"),te=T(H,"parentNode");if("function"==typeof c){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let ne,re="";const{implementation:ie,createNodeIterator:oe,createDocumentFragment:se,getElementsByTagName:ae}=r,{importNode:le}=i;let ce={};n.isSupported="function"==typeof e&&"function"==typeof te&&ie&&void 0!==ie.createHTMLDocument;const{MUSTACHE_EXPR:ue,ERB_EXPR:de,TMPLIT_EXPR:he,DATA_ATTR:pe,ARIA_ATTR:me,IS_SCRIPT_OR_DATA:fe,ATTR_WHITESPACE:ge,CUSTOM_ELEMENT:ve}=Y;let{IS_ALLOWED_URI:ye}=Y,Se=null;const _e=C({},[...I,...M,...R,...N,...D]);let be=null;const xe=C({},[...k,...L,...B,...z]);let we=Object.seal(a(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ce=null,Ae=null,Ee=!0,Te=!0,Ie=!1,Me=!0,Re=!1,Pe=!0,Ne=!1,Oe=!1,De=!1,ke=!1,Le=!1,Be=!1,ze=!0,Fe=!1;const Ue="user-content-";let je=!0,Ge=!1,He={},Ve=null;const We=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let qe=null;const Je=C({},["audio","video","img","source","image","track"]);let Ke=null;const Ye=C({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$e="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",Qe="http://www.w3.org/1999/xhtml";let Ze=Qe,et=!1,tt=null;const nt=C({},[$e,Xe,Qe],m);let rt=C({},["mi","mo","mn","ms","mtext"]),it=C({},["annotation-xml"]);const ot=C({},["title","style","font","a","script"]);let st=null;const at=["application/xhtml+xml","text/html"],lt="text/html";let ct=null,ut=null;const dt=r.createElement("form"),ht=function(e){return e instanceof RegExp||e instanceof Function},pt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ut||ut!==e){if(e&&"object"==typeof e||(e={}),e=E(e),st=-1===at.indexOf(e.PARSER_MEDIA_TYPE)?lt:e.PARSER_MEDIA_TYPE,ct="application/xhtml+xml"===st?m:p,Se=S(e,"ALLOWED_TAGS")?C({},e.ALLOWED_TAGS,ct):_e,be=S(e,"ALLOWED_ATTR")?C({},e.ALLOWED_ATTR,ct):xe,tt=S(e,"ALLOWED_NAMESPACES")?C({},e.ALLOWED_NAMESPACES,m):nt,Ke=S(e,"ADD_URI_SAFE_ATTR")?C(E(Ye),e.ADD_URI_SAFE_ATTR,ct):Ye,qe=S(e,"ADD_DATA_URI_TAGS")?C(E(Je),e.ADD_DATA_URI_TAGS,ct):Je,Ve=S(e,"FORBID_CONTENTS")?C({},e.FORBID_CONTENTS,ct):We,Ce=S(e,"FORBID_TAGS")?C({},e.FORBID_TAGS,ct):{},Ae=S(e,"FORBID_ATTR")?C({},e.FORBID_ATTR,ct):{},He=!!S(e,"USE_PROFILES")&&e.USE_PROFILES,Ee=!1!==e.ALLOW_ARIA_ATTR,Te=!1!==e.ALLOW_DATA_ATTR,Ie=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Me=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Re=e.SAFE_FOR_TEMPLATES||!1,Pe=!1!==e.SAFE_FOR_XML,Ne=e.WHOLE_DOCUMENT||!1,ke=e.RETURN_DOM||!1,Le=e.RETURN_DOM_FRAGMENT||!1,Be=e.RETURN_TRUSTED_TYPE||!1,De=e.FORCE_BODY||!1,ze=!1!==e.SANITIZE_DOM,Fe=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,Ge=e.IN_PLACE||!1,ye=e.ALLOWED_URI_REGEXP||V,Ze=e.NAMESPACE||Qe,rt=e.MATHML_TEXT_INTEGRATION_POINTS||rt,it=e.HTML_INTEGRATION_POINTS||it,we=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ht(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(we.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ht(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(we.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(we.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Re&&(Te=!1),Le&&(ke=!0),He&&(Se=C({},D),be=[],!0===He.html&&(C(Se,I),C(be,k)),!0===He.svg&&(C(Se,M),C(be,L),C(be,z)),!0===He.svgFilters&&(C(Se,R),C(be,L),C(be,z)),!0===He.mathMl&&(C(Se,N),C(be,B),C(be,z))),e.ADD_TAGS&&(Se===_e&&(Se=E(Se)),C(Se,e.ADD_TAGS,ct)),e.ADD_ATTR&&(be===xe&&(be=E(be)),C(be,e.ADD_ATTR,ct)),e.ADD_URI_SAFE_ATTR&&C(Ke,e.ADD_URI_SAFE_ATTR,ct),e.FORBID_CONTENTS&&(Ve===We&&(Ve=E(Ve)),C(Ve,e.FORBID_CONTENTS,ct)),je&&(Se["#text"]=!0),Ne&&C(Se,["html","head","body"]),Se.table&&(C(Se,["tbody"]),delete Ce.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw b('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw b('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ne=e.TRUSTED_TYPES_POLICY,re=ne.createHTML("")}else void 0===ne&&(ne=Q(G,s)),null!==ne&&"string"==typeof re&&(re=ne.createHTML(""));o&&o(e),ut=e}},mt=C({},[...M,...R,...P]),ft=C({},[...N,...O]),gt=function(e){let t=te(e);t&&t.tagName||(t={namespaceURI:Ze,tagName:"template"});const n=p(e.tagName),r=p(t.tagName);return!!tt[e.namespaceURI]&&(e.namespaceURI===Xe?t.namespaceURI===Qe?"svg"===n:t.namespaceURI===$e?"svg"===n&&("annotation-xml"===r||rt[r]):Boolean(mt[n]):e.namespaceURI===$e?t.namespaceURI===Qe?"math"===n:t.namespaceURI===Xe?"math"===n&&it[r]:Boolean(ft[n]):e.namespaceURI===Qe?!(t.namespaceURI===Xe&&!it[r])&&!(t.namespaceURI===$e&&!rt[r])&&!ft[n]&&(ot[n]||!mt[n]):!("application/xhtml+xml"!==st||!tt[e.namespaceURI]))},vt=function(e){h(n.removed,{element:e});try{te(e).removeChild(e)}catch(t){q(e)}},yt=function(e,t){try{h(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){h(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!be[e])if(ke||Le)try{vt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},St=function(e){let t=null,n=null;if(De)e="<remove></remove>"+e;else{const t=f(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===st&&Ze===Qe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=ne?ne.createHTML(e):e;if(Ze===Qe)try{t=(new j).parseFromString(i,st)}catch(e){}if(!t||!t.documentElement){t=ie.createDocument(Ze,"template",null);try{t.documentElement.innerHTML=et?re:i}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),Ze===Qe?ae.call(t,Ne?"html":"body")[0]:Ne?t.documentElement:o},_t=function(e){return oe.call(e.ownerDocument||e,e,A.SHOW_ELEMENT|A.SHOW_COMMENT|A.SHOW_TEXT|A.SHOW_PROCESSING_INSTRUCTION|A.SHOW_CDATA_SECTION,null)},bt=function(e){return e instanceof U&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof F)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},xt=function(e){return"function"==typeof x&&e instanceof x};function wt(e,t,r){ce[e]&&u(ce[e],(e=>{e.call(n,t,r,ut)}))}const Ct=function(e){let t=null;if(wt("beforeSanitizeElements",e,null),bt(e))return vt(e),!0;const r=ct(e.nodeName);if(wt("uponSanitizeElement",e,{tagName:r,allowedTags:Se}),e.hasChildNodes()&&!xt(e.firstElementChild)&&_(/<[/\w]/g,e.innerHTML)&&_(/<[/\w]/g,e.textContent))return vt(e),!0;if(e.nodeType===$.progressingInstruction)return vt(e),!0;if(Pe&&e.nodeType===$.comment&&_(/<[/\w]/g,e.data))return vt(e),!0;if(!Se[r]||Ce[r]){if(!Ce[r]&&Et(r)){if(we.tagNameCheck instanceof RegExp&&_(we.tagNameCheck,r))return!1;if(we.tagNameCheck instanceof Function&&we.tagNameCheck(r))return!1}if(je&&!Ve[r]){const t=te(e)||e.parentNode,n=ee(e)||e.childNodes;if(n&&t)for(let r=n.length-1;r>=0;--r){const i=W(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,K(e))}}return vt(e),!0}return e instanceof w&&!gt(e)?(vt(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!_(/<\/no(script|embed|frames)/i,e.innerHTML)?(Re&&e.nodeType===$.text&&(t=e.textContent,u([ue,de,he],(e=>{t=g(t,e," ")})),e.textContent!==t&&(h(n.removed,{element:e.cloneNode()}),e.textContent=t)),wt("afterSanitizeElements",e,null),!1):(vt(e),!0)},At=function(e,t,n){if(ze&&("id"===t||"name"===t)&&(n in r||n in dt))return!1;if(Te&&!Ae[t]&&_(pe,t));else if(Ee&&_(me,t));else if(!be[t]||Ae[t]){if(!(Et(e)&&(we.tagNameCheck instanceof RegExp&&_(we.tagNameCheck,e)||we.tagNameCheck instanceof Function&&we.tagNameCheck(e))&&(we.attributeNameCheck instanceof RegExp&&_(we.attributeNameCheck,t)||we.attributeNameCheck instanceof Function&&we.attributeNameCheck(t))||"is"===t&&we.allowCustomizedBuiltInElements&&(we.tagNameCheck instanceof RegExp&&_(we.tagNameCheck,n)||we.tagNameCheck instanceof Function&&we.tagNameCheck(n))))return!1}else if(Ke[t]);else if(_(ye,g(n,ge,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==v(n,"data:")||!qe[e])if(Ie&&!_(fe,g(n,ge,"")));else if(n)return!1;return!0},Et=function(e){return"annotation-xml"!==e&&f(e,ve)},Tt=function(e){wt("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:be,forceKeepAttr:void 0};let i=t.length;for(;i--;){const o=t[i],{name:s,namespaceURI:a,value:l}=o,c=ct(s);let h="value"===s?l:y(l);if(r.attrName=c,r.attrValue=h,r.keepAttr=!0,r.forceKeepAttr=void 0,wt("uponSanitizeAttribute",e,r),h=r.attrValue,!Fe||"id"!==c&&"name"!==c||(yt(s,e),h=Ue+h),Pe&&_(/((--!?|])>)|<\/(style|title)/i,h)){yt(s,e);continue}if(r.forceKeepAttr)continue;if(yt(s,e),!r.keepAttr)continue;if(!Me&&_(/\/>/i,h)){yt(s,e);continue}Re&&u([ue,de,he],(e=>{h=g(h,e," ")}));const p=ct(e.nodeName);if(At(p,c,h)){if(ne&&"object"==typeof G&&"function"==typeof G.getAttributeType)if(a);else switch(G.getAttributeType(p,c)){case"TrustedHTML":h=ne.createHTML(h);break;case"TrustedScriptURL":h=ne.createScriptURL(h)}try{a?e.setAttributeNS(a,s,h):e.setAttribute(s,h),bt(e)?vt(e):d(n.removed)}catch(e){}}}wt("afterSanitizeAttributes",e,null)},It=function e(t){let n=null;const r=_t(t);for(wt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)wt("uponSanitizeShadowNode",n,null),Ct(n)||(n.content instanceof l&&e(n.content),Tt(n));wt("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,s=null,a=null;if(et=!e,et&&(e="\x3c!--\x3e"),"string"!=typeof e&&!xt(e)){if("function"!=typeof e.toString)throw b("toString is not a function");if("string"!=typeof(e=e.toString()))throw b("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Oe||pt(t),n.removed=[],"string"==typeof e&&(Ge=!1),Ge){if(e.nodeName){const t=ct(e.nodeName);if(!Se[t]||Ce[t])throw b("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof x)r=St("\x3c!----\x3e"),o=r.ownerDocument.importNode(e,!0),o.nodeType===$.element&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!ke&&!Re&&!Ne&&-1===e.indexOf("<"))return ne&&Be?ne.createHTML(e):e;if(r=St(e),!r)return ke?null:Be?re:""}r&&De&&vt(r.firstChild);const c=_t(Ge?e:r);for(;s=c.nextNode();)Ct(s)||(s.content instanceof l&&It(s.content),Tt(s));if(Ge)return e;if(ke){if(Le)for(a=se.call(r.ownerDocument);r.firstChild;)a.appendChild(r.firstChild);else a=r;return(be.shadowroot||be.shadowrootmode)&&(a=le.call(i,a,!0)),a}let d=Ne?r.outerHTML:r.innerHTML;return Ne&&Se["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&_(J,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),Re&&u([ue,de,he],(e=>{d=g(d,e," ")})),ne&&Be?ne.createHTML(d):d},n.setConfig=function(){pt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Oe=!0},n.clearConfig=function(){ut=null,Oe=!1},n.isValidAttribute=function(e,t,n){ut||pt({});const r=ct(e),i=ct(t);return At(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&(ce[e]=ce[e]||[],h(ce[e],t))},n.removeHook=function(e){if(ce[e])return d(ce[e])},n.removeHooks=function(e){ce[e]&&(ce[e]=[])},n.removeAllHooks=function(){ce={}},n}return Z()}();var ZN=({className:e,title:t})=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",className:e,"aria-label":t,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("path",{d:"M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"}),(0,s.jsx)("path",{d:"M12 17L12.01 17"})]});var eO=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",focusable:"false",role:"img",className:e,"aria-label":t,children:[(0,s.jsx)("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),(0,s.jsx)("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]});var tO=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",focusable:"false",role:"img",className:e,"aria-label":t,children:[(0,s.jsx)("path",{d:"M10 9.5 8 12l2 2.5"}),(0,s.jsx)("path",{d:"m14 9.5 2 2.5-2 2.5"}),(0,s.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})]});c=o("85Hg2"),c=o("85Hg2");var nO=({rows:e,className:n,innerClassName:r,btnClassName:i,lineHeightMultiplier:o=1.2,defaultExpanded:a=!1,expandSymbol:l=(()=>"..."),collapseSymbol:u=(e=>"it"===e?"Mostra meno":"Show less"),children:d})=>{const{i18n:h}=Ce(),p=h.language,m=u(p),f=l(p),[g,v]=(0,c.useState)(a),[y,S]=(0,c.useState)(!1),[_,b]=(0,c.useState)(16),x=(0,c.useRef)(null);return(0,c.useEffect)((()=>{if(x.current){let t=x.current.getBoundingClientRect().height,n=getComputedStyle(x.current),r=n.lineHeight,i="normal"!==r&&(null==r?void 0:r.length)?parseInt(r,10):o*parseInt(n.fontSize,10);console.table({rows:e,lineHeight:i,height:t,maxHeight:e*i,needsExpanding:t>e*i}),b(i),t&&t>e*i&&S(!0)}}),[e,x.current]),(0,s.jsxs)("div",{className:t(Cs)("memori-expandable",n),children:[(0,s.jsx)("div",{ref:x,className:t(Cs)("memori-expandable--inner",r),style:{maxHeight:g||!y?"9999px":_*e+"px"},children:d}),y&&!g&&(0,s.jsx)(Em,{ghost:!0,padded:!1,className:i,onClick:()=>v(!0),children:f}),y&&g&&(0,s.jsx)(Em,{ghost:!0,padded:!1,className:i,onClick:()=>v(!1),children:m})]})};const rO=new Map(Object.entries({TENANT_NOT_FOUND:-1,TENANT_REGISTRATION_DISABLED:-2,TENANT_MISSING_NAME:-3,TENANT_MAX_USERS_REACHED:-4,TENANT_MAX_ADMINS_REACHED:-5,TENANT_ALREADY_EXISTS:-6,TENANT_MISSING_DESCRIPTION:-7,TENANT_CANT_SET_COMPLETION_PROVIDER:-8,USER_NOT_CONFIRMED:-11,USER_NOT_FOUND:-12,USER_OR_PASSWORD_INVALID:-13,USER_MUST_CHANGE_PASSWORD:-14,USER_MUST_ENTER_VERIFICATION_CODE:-15,USER_MISSING_TENANT:-21,USER_MISSING_NAME:-22,USER_MISSING_PASSWORD:-23,USER_MISSING_EMAIL:-24,USER_MISSING_VERIFICATION_CODE:-25,USER_NAME_ALREADY_USED:-26,USER_PASSWORD_NOT_CONFORMING_TO_POLICY:-27,USER_EMAIL_ALREADY_USED:-28,USER_EMAIL_INVALID:-29,USER_VERIFICATION_CODE_INVALID:-30,USER_MISSING_NAME_OR_EMAIL:-31,USER_NAME_INVALID:-32,USER_HAS_ONE_OR_MORE_MEMORI:-33,USER_MISSING_NEW_PASSWORD:-34,USER_CANT_CREATE_MEMORI:-35,USER_MAX_MEMORI_REACHED:-36,USER_TOO_MANY_ATTEMPTS:-38,USER_MUST_ACCEPT_TNC_AND_PP:-39,USER_BIRTH_DATE_CANT_BE_CHANGED:-40,USER_CANT_SET_COMPLETION_PROVIDER:-41,USER_CANT_ENABLE_DEEP_THOUGHT:-42,USER_CANT_ENABLE_DCM_INTEGRATION:-43,USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS:-44,USER_CREATION_BILLING_DENIED_PERMISSION:-46,USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS:-47,USER_CANT_BE_DELETED:-48,MEMORI_NOT_FOUND:-51,MEMORI_NOT_ACCESSIBLE:-52,MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN:-53,SESSION_NOT_FOUND:-101,SESSION_IS_NOT_ADMINISTRATIVE:-102,SESSION_EXPIRED:-103,MEMORI_MISSING_CONFIGURATION:-201,MEMORI_CONFIGURATION_NOT_FOUND:-202,MEMORI_INVALID_PRIVACY_TYPE:-203,MEMORI_MISSING_PASSWORD:-204,MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS:-205,MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS:-206,MEMORI_INVALID_VOICE_TYPE:-207,MEMORI_MISSING_NAME:-208,MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS:-209,MEMORI_INVALID_ID:-210,MEMORI_NAME_ALREADY_USED:-211,MEMORI_INVALID_PIN:-212,MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION:-213,MEMORI_NO_PASSWORD_WHEN_PUBLIC:-214,MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS:-215,MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS:-216,MEMORI_INVALID_COMPLETION_CONFIG:-217,MEMORI_TRANSFER_MISSING_DESTINATION_USER:-231,MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID:-232,MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT:-233,MEMORI_TRANSFER_NOTHING_TO_DO:-234,MEMORI_CONFIGURATION_CANT_BE_CHANGED:-251,MEMORI_MISSING_NEW_PASSWORD:-252,MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT:-261,MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT:-262,MEMORI_FEATURE_REQUIRES_SUBSCRIPTION:-271,INTEGRATION_NOT_FOUND:-301,INTEGRATION_INVALID_TYPE:-401,INTEGRATION_ALREADY_EXISTS:-402,INTEGRATION_MEMORI_IS_NOT_PUBLIC:-403,INTEGRATION_MISSING_INVOCATION_TEXT:-404,INTEGRATION_MISSING_DEVICE_EMAILS:-405,INTEGRATION_MEMORI_IS_EMPTY:-406,INTEGRATION_MISSING_PRIVACY_POLICY:-407,INTEGRATION_MISSING_CATEGORY:-408,INTEGRATION_MISSING_DESCRIPTION:-409,INTEGRATION_INVALID_INVOCATION_TEXT:-410,INTEGRATION_GOOGLE_NO_MORE_AVAILABLE:-411,UPLOAD_REQUIRES_MULTIPART_ENCODING:-501,UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY:-502,UPLOAD_MAX_LENGTH_EXCEEDED:-503,UPLOAD_FILE_IS_EMPTY:-504,UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE:-505,UPLOAD_MISSING_FILE_NAME:-506,UPLOAD_INVALID_MEMORY_ID:-507,UPLOAD_MISSING_FILE_CONTENT:-508,ASSET_NOT_FOUND:-601,ASSET_NOT_ACCESSIBLE:-602,ASSET_MISSING_SESSION_ID:-603,ASSET_INVALID_FILE_NAME:-604,INVITATION_NOT_FOUND:-701,INVITATION_NOT_ACCESSIBLE:-702,INVITATION_ALREADY_ACCEPTED:-703,INVITATION_ALREADY_REJECTED:-704,INVITATION_MISSING_DESTINATION_EMAIL:-705,INVITATION_DESTINATION_EMAIL_INVALID:-706,INVITATION_MISSING_TAG:-707,INVITATION_MISSING_PIN:-708,INVITATION_INVALID_PIN:-709,INVITATION_INVALID_TYPE:-710,INVITATION_MISSING_DESTINATION_NAME:-711,INVITATION_TAG_PIN_CANT_BE_CHANGED:-712,INVITATION_CANT_BE_CHANGED:-713,ACTIONLOG_INVALID_USER_ID:-801,ACTIONLOG_INVALID_DATE_FROM_FORMAT:-802,ACTIONLOG_INVALID_DATE_TO_FORMAT:-803,ACTIONLOG_INVALID_MEMORI_ID:-804,CONSUMPTIONLOG_INVALID_TYPE:-901,CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT:-902,CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT:-903,CONSUMPTIONLOG_INVALID_USER_ID:-904,CONSUMPTIONLOG_INVALID_MEMORI_ID:-905,NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD:-1001,PROCESS_INVALID_TYPE:-1401,PROCESS_ALREADY_RUNNING:-1401,PROCESS_NOT_FOUND:-1402,IMPORTCSV_MISSING_ROWS:-1501,IMPORTCSV_MISSING_CSV:-1502,IMPORTCSV_MISSING_SEPARATOR:-1503,IMPORTCSV_INVALID_SEPARATOR:-1504,IMPORTCSV_MISSING_HEADERS:-1505,IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1506,IMPORTCSV_INVALID_RECEIVER_ID:-1507,IMPORTCSV_INVALID_MEDIA_LINK:-1508,IMPORTCSV_INVALID_LINK_TITLE_HANDLING:-1509,IMPORTCSV_UNDETECTABLE_CHAR_ENCODING:-1521,IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI:-1531,IMPORTTXT_MISSING_ROWS:-1601,IMPORTTXT_INVALID_GRANULARITY:-1602,IMPORTTXT_INVALID_RECEIVER_ID:-1603,IMPORTTXT_INVALID_MEDIA_LINK:-1604,IMPORTTXT_INVALID_LINK_TITLE_HANDLING:-1605,IMPORTTXT_UNDETECTABLE_CHAR_ENCODING:-1621,IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI:-1631,IMPORTTXT_IMPORT_LIMIT_EXCEEDED:-1632,IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY:-1633,IMPORTTXT_IMPORT_REQUIRES_PAYING:-1634,IMPORTTXT_BILLING_DENIED_PERMISSION:-1635,EXPORTCSV_MISSING_CSV_SPECS:-1801,EXPORTCSV_MISSING_SEPARATOR:-1802,EXPORTCSV_INVALID_SEPARATOR:-1803,EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1804,EXPORTCSV_MISSING_NEW_LINE_CHAR:-1805,EXPORTCSV_INVALID_NEW_LINE_CHAR:-1806,EXPORTCSV_MISSING_PASSWORD:-1811,EXPORTJSONL_MISSING_JSONL_SPECS:-1821,EXPORTJSONL_MISSING_PLATFORM:-1822,EXPORTJSONL_INVALID_PLATFORM:-1823,EXPORTJSONL_MISSING_PASSWORD:-1831,EXPORTJSONL_EXPORT_REQUIRES_PAYING:-1832,ANALYSIS_MISSING_QUERY:-1901,ANALYSIS_CANT_ANALYZE_SECRET_MEMORI:-1902,ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT:-1903,BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS:-2001,BADGE_ASSIGNMENT_MISSING_REF_ID:-2002,BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND:-2003,BADGE_ASSIGNMENT_MISSING_ASSERTION_URL:-2004,BADGE_ASSIGNMENT_MISSING_BADGE_URL:-2005,BADGE_ASSIGNMENT_MISSING_ISSUER_URL:-2006,BADGE_ASSIGNMENT_INVALID_URL:-2007,BADGE_ASSIGNMENT_MISSING_RECIPIENT:-2021,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE:-2022,BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY:-2023,BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE:-2024,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE:-2025,BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY:-2026,BADGE_NOT_FOUND:-2051,OUTCOME_NO_DCM_CONFIGURED:-2071,OUTCOME_USER_BADGES_DISABLED:-2072,COMPLETION_CONFIG_MISSING_NAME:-2401,COMPLETION_CONFIG_MISSING_PROVIDER:-2402,COMPLETION_CONFIG_MISSING_ENDPOINT:-2403,COMPLETION_CONFIG_MISSING_API_KEY:-2404,COMPLETION_CONFIG_MISSING_MODEL:-2405,COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED:-2406,COMPLETION_CONFIG_INVALID_NAME:-2407,COMPLETION_CONFIG_INVALID_PURPOSE:-2411,COMPLETION_CONFIG_INVALID_ENDPOINT:-2412,COMPLETION_CONFIG_INCONSISTENT_ENDPOINT:-2413,COMPLETION_CONFIG_INVALID_PROVIDER:-2414,COMPLETION_CONFIG_NOT_FOUND:-2421,COMPLETION_CONFIG_NOT_ACCESSIBLE:-2422,COMPLETION_CONFIG_NAME_RESERVED:-2441,COMPLETION_CONFIG_NAME_ALREADY_EXISTS:-2442,COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED:-2443}).map((([e,t])=>[t,e]))),iO=e=>{if(!e)return"error.generic";if(401===e||403===e)return"error.unauthorized";if(404===e)return"error.notFound";if(422===e)return"error.unprocessableEntity";if(500===e)return"internal server error";let t=rO.get(e);return t?`errors.${t}`:"error.generic"};c=o("85Hg2");const oO=[{value:"IT",label:"Italiano"},{value:"EN",label:"English"},{value:"DE",label:"Deutsch"},{value:"ES",label:"Español"},{value:"FR",label:"Français"},{value:"PT",label:"Português"},{value:"UK",label:"Українська"},{value:"RU",label:"Русский"},{value:"PL",label:"Polski"},{value:"FI",label:"Suomi"},{value:"EL",label:"Ελληνικά"},{value:"AR",label:"العربية"},{value:"JA",label:"中文"},{value:"ZH",label:"日本語"}],sO=["en","it","fr","es","de"],aO=["image/jpeg","image/png","image/jpg","image/gif","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/pdf","video/mp4","video/avi","audio/mpeg3","audio/wav","audio/mpeg","video/mpeg","model/gltf-binary"],lO="👤",cO=[{name:"text",lang:"text",mimeType:"text/plain",monacoLang:"plaintext",executable:!0},{name:"javascript/jsx",lang:"jsx",mimeType:"text/javascript",monacoLang:"javascript",executable:!0},{name:"typescript/tsx",lang:"tsx",mimeType:"text/ecmascript",monacoLang:"typescript",executable:!0},{name:"json",lang:"json",mimeType:"application/json",monacoLang:"json",executable:!0},{name:"css",lang:"scss",mimeType:"text/css",monacoLang:"css",executable:!0},{name:"html/xml",lang:"tsx",mimeType:"application/xml",monacoLang:"xml"},{name:"bash",lang:"bash",mimeType:"application/x-sh",monacoLang:"shell"},{name:"python",lang:"python",mimeType:"text/x-python",monacoLang:"python"},{name:"cpp/csharp",lang:"cpp",mimeType:"text/x-c++src",monacoLang:"cpp"},{name:"php",lang:"php",mimeType:"application/x-php",monacoLang:"php"},{name:"ruby",lang:"ruby",mimeType:"text/x-ruby",monacoLang:"ruby"},{name:"sql",lang:"sql",mimeType:"text/x-sql",monacoLang:"sql"}],uO={it:[{text:"",delayAfter:10},{text:"Cerco l'esperto più adatto",delayAfter:5},{text:"Contatto l'esperto",delayAfter:3},{text:"Spiego all'esperto la domanda",delayAfter:2},{text:"L'esperto sta preparando una risposta",delayAfter:6},{text:"Genero una risposta adatta",delayAfter:3}],en:[{text:"",delayAfter:10},{text:"I'm looking for the most suitable expert",delayAfter:5},{text:"I'm contacting the expert",delayAfter:3},{text:"I'm explaining the question to the expert",delayAfter:2},{text:"The expert is preparing an answer",delayAfter:6},{text:"I am generating a suitable answer",delayAfter:3}]};var dO=({medium:e,className:n,preview:r=!1,showCopyButton:i=!0})=>{var o,a,l,u,d;const{t:h}=Ce();return(0,c.useEffect)((()=>{(()=>{if(document.getElementById("memori-prism-script"))return;const e=document.createElement("script");e.src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/prism.min.js",e.async=!0,e.id="memori-prism-script";const t=document.createElement("script");t.src="https://cdn.jsdelivr.net/npm/prismjs@v1.29.0/plugins/autoloader/prism-autoloader.min.js",t.async=!0,t.id="memori-prism-autoloader-script";const n=document.createElement("link");n.rel="stylesheet",n.href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-tomorrow.min.css",document.head.appendChild(n),document.head.appendChild(e),document.head.appendChild(t)})()}),[]),(0,c.useEffect)((()=>{"Prism"in window&&window.Prism.highlightAll&&Prism.highlightAll()}),[e.content]),(0,s.jsxs)("div",{className:"memori-snippet",children:[(0,s.jsxs)("div",{className:"memori-snippet--content",children:[(0,s.jsx)("pre",{className:t(Cs)("line-numbers",n),"aria-labelledby":(null===(o=e.title)||void 0===o?void 0:o.length)?`#snippet-${e.mediumID}`:void 0,children:(0,s.jsx)("code",{className:`language-${null!==(l=null===(a=cO.find((t=>e.mimeType===t.mimeType)))||void 0===a?void 0:a.lang)&&void 0!==l?l:"text"}`,children:(null===(u=e.content)||void 0===u?void 0:u.length)&&e.content.length>200&&r?`${e.content.slice(0,200)}\n...`:`${e.content}`})}),i&&(0,s.jsx)(Em,{padded:!1,ghost:!0,className:"memori-snippet--copy-button",title:h("copy")||"Copy",icon:(0,s.jsx)(eO,{}),onClick:()=>{var t;return navigator.clipboard.writeText(null!==(t=e.content)&&void 0!==t?t:"")}})]}),!!(null===(d=e.title)||void 0===d?void 0:d.length)&&(0,s.jsx)("p",{id:`snippet-${e.mediumID}`,className:"memori-snippet--caption",children:e.title})]})};c=o("85Hg2"),c=o("85Hg2");var hO,pO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M574 665.4a8.03 8.03 0 0 0-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 0 0-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 0 0 0 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 0 0 0 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 0 0-11.3 0L372.3 598.7a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"})}),mO={};hO=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function n(e,n){var r=e.el,i=e.elStyle,o=e.elHeight,s=e.rowsLimit,a=e.rowsWrapped,l=e.options,c=e.buffer,u=c;if(a===s+1)return t({},e);var d=c,h=a,p=o;return r.innerHTML=u=c.length?""+c+l.delimiter+n+l.replaceStr:""+n+l.replaceStr,parseFloat(i.height)>parseFloat(o)&&(h++,p=i.height,h===s+1)?(r.innerHTML=u="."===d[d.length-1]&&"..."===l.replaceStr?d+"..":""+d+l.replaceStr,t({},e,{elHeight:p,rowsWrapped:h})):(r.innerHTML=u=d.length?""+d+l.delimiter+n:""+n,t({},e,{buffer:u,elHeight:p,rowsWrapped:h}))}e.disableResponsive=function(e){window.removeEventListener("resize",e)},e.ellipsis=function e(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s={replaceStr:"...",responsive:!1,debounceDelay:250,delimiter:" "},a=t({},s,o),l=r&&(r instanceof NodeList?r:1===r.nodeType?[r]:document.querySelectorAll(r)),c=[],u=0;u<l.length;u++){var d=l[u];c[u]=d.innerHTML;var h=d.innerHTML.split(a.delimiter);d.innerHTML="";var p=window.getComputedStyle(d);h.reduce(n,{el:d,buffer:d.innerHTML,elStyle:p,elHeight:0,rowsLimit:i,rowsWrapped:0,options:a})}if(a.responsive){var m=!1,f=window.innerWidth,g=function(){if(window.innerWidth!==f){f=window.innerWidth;for(var n=0;n<l.length;n++)l[n].innerHTML=c[n];e(r,i,t({},o,{responsive:!1}))}},v=function(){clearTimeout(m),m=setTimeout(g,a.debounceDelay)};return window.addEventListener("resize",v),v}}},"function"==typeof define&&define.amd?define(["exports"],hO):hO(mO);var fO=({loading:e=!1,className:n,title:r,description:i,cover:o,hoverable:a=!1,children:l})=>(0,s.jsx)("div",{className:t(Cs)("memori-card",n,{"memori-card--loading":e,"memori-card--with-cover":o,"memori-card--hoverable":a}),children:(0,s.jsxs)(Am,{spinning:e,children:[o&&(0,s.jsx)("div",{className:"memori-card--cover",children:o}),(0,s.jsxs)("div",{className:"memori-card--content",children:[r&&(0,s.jsx)("h3",{className:"memori-card--title",children:r}),i&&(0,s.jsx)("p",{className:"memori-card--description",children:i}),(0,s.jsx)("div",{className:"memori-card--children",children:l})]})]})});const gO=({isChild:e=!1,item:n,baseUrl:r,onLinkPreviewInfo:i,descriptionOneLine:o=!1})=>{var a,l,u,d;const[h,p]=(0,c.useState)(null),m=(null===(a=n.url)||void 0===a?void 0:a.startsWith("http"))||!n.url||0===(null===(l=n.url)||void 0===l?void 0:l.length)?n.url:`https://${n.url}`;(0,c.useEffect)((()=>{var e,t;let o=(null===(e=n.url)||void 0===e?void 0:e.startsWith("http"))||!n.url||0===(null===(t=n.url)||void 0===t?void 0:t.length)?n.url:`https://${n.url}`;o&&o!==(null==h?void 0:h.urlKey)&&(async(e,t)=>{try{const n=await fetch(`${t||"https://aisuru.com"}/api/linkpreview/${encodeURIComponent(e)}`);return await n.json()}catch(e){return console.error("getSiteInfo",e),null}})(o,r).then((e=>{p(e?{...e,urlKey:o}:null),i&&e&&i(e)}))}),[null==n?void 0:n.url,r,i]);const f=n.title&&n.title.length>0?n.title:null==h?void 0:h.title,g=null==h?void 0:h.description,v=null==h?void 0:h.video,y=null!==(u=null==h?void 0:h.image)&&void 0!==u?u:null===(d=null==h?void 0:h.images)||void 0===d?void 0:d[0];return(0,c.useEffect)((()=>{setTimeout((()=>{(0,mO.ellipsis)(".memori-link-item--card .memori-card--description",3,{responsive:!0})}),300)}),[g,n.mediumID]),(0,s.jsx)("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:t(Cs)("memori-link-item--link",{"memori-link-item--link--child":e}),onClick:t=>{e||(t.preventDefault(),t.stopPropagation(),window.open(m,"_blank",`toolbar=yes,top=${.1*window.innerHeight},left=${.1*window.innerWidth},width=${.8*window.innerWidth},height=${.8*window.innerHeight}`))},children:(0,s.jsx)(fO,{hoverable:!0,className:t(Cs)("memori-link-item--card",{"memori-link-item--card-description-oneline":o,"memori-link-item--card-has-image":y,"memori-link-item--card-has-video":v}),cover:v?(0,s.jsx)("iframe",{width:"100%",height:"100%",src:v,title:"Video player",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}):y?(0,s.jsx)("img",{className:"memori-link-item--card-cover-img",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg==",srcSet:y.includes("data:image")?void 0:y.startsWith("https")?y:`https://${y.replace("http://","")}`,alt:n.title}):(0,s.jsx)("div",{className:"memori-link-item--card-cover-icon",children:(0,s.jsx)(pO,{className:"memori-link-item--icon"})}),title:f,description:g})})};var vO=({items:e,baseUrl:t,descriptionOneLine:n=!1,onLinkPreviewInfo:r})=>(0,s.jsx)(lp,{appear:!0,show:!0,as:"div",className:"memori-link-items",children:(0,s.jsx)("div",{className:"memori-link-items--grid",children:e.map(((e,i)=>(0,s.jsx)(lp.Child,{as:"div",className:"memori-link-item",enter:"ease-out duration-500 delay-"+100*i,enterFrom:"opacity-0 scale-95",enterTo:"opacity-1 scale-100",leave:"ease-in duration-300",leaveFrom:"opacity-1 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsx)(gO,{item:e,baseUrl:t,descriptionOneLine:n,onLinkPreviewInfo:r})},e.mediumID)))})});c=o("85Hg2");const yO=["va bene","no grazie","si","no","sì","arrivederci","non c'entrava","non mi è piaciuto"],SO=async(e,t,n,r)=>{var i;let o=(e=>e.replaceAll(/<output.*?>(.*?)<\/output>/g,""))(e);const s=yO.indexOf(e.toLowerCase())>-1?"IT":null==n?void 0:n.toUpperCase(),a=t.toUpperCase(),l=await fetch(`${r||"https://www.aisuru.com"}/api/translate`,{cache:"no-cache",method:"POST",body:JSON.stringify({text:o,target_lang:a,source_lang:s}),headers:{Accept:"*/*","Content-Type":"application/json"}}),c=await l.json();return null===(i=null==c?void 0:c.translations)||void 0===i?void 0:i[0]};c=o("85Hg2");var _O=({src:e,poster:t,alt:n=""})=>((0,c.useEffect)((()=>{const e=document.createElement("script");return e.src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js",e.type="module",document.head.appendChild(e),()=>{document.head.removeChild(e)}}),[]),(0,s.jsx)("div",{className:"model-viewer",children:(0,s.jsx)("model-viewer",{src:e,"ios-src":"",poster:t,alt:n,"shadow-intensity":"1","disable-zoom":!0,"camera-controls":!0,autoplay:!0})}));var bO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"})});var xO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M531.3 574.4l.3-1.4c5.8-23.9 13.1-53.7 7.4-80.7-3.8-21.3-19.5-29.6-32.9-30.2-15.8-.7-29.9 8.3-33.4 21.4-6.6 24-.7 56.8 10.1 98.6-13.6 32.4-35.3 79.5-51.2 107.5-29.6 15.3-69.3 38.9-75.2 68.7-1.2 5.5.2 12.5 3.5 18.8 3.7 7 9.6 12.4 16.5 15 3 1.1 6.6 2 10.8 2 17.6 0 46.1-14.2 84.1-79.4 5.8-1.9 11.8-3.9 17.6-5.9 27.2-9.2 55.4-18.8 80.9-23.1 28.2 15.1 60.3 24.8 82.1 24.8 21.6 0 30.1-12.8 33.3-20.5 5.6-13.5 2.9-30.5-6.2-39.6-13.2-13-45.3-16.4-95.3-10.2-24.6-15-40.7-35.4-52.4-65.8zM421.6 726.3c-13.9 20.2-24.4 30.3-30.1 34.7 6.7-12.3 19.8-25.3 30.1-34.7zm87.6-235.5c5.2 8.9 4.5 35.8.5 49.4-4.9-19.9-5.6-48.1-2.7-51.4.8.1 1.5.7 2.2 2zm-1.6 120.5c10.7 18.5 24.2 34.4 39.1 46.2-21.6 4.9-41.3 13-58.9 20.2-4.2 1.7-8.3 3.4-12.3 5 13.3-24.1 24.4-51.4 32.1-71.4zm155.6 65.5c.1.2.2.5-.4.9h-.2l-.2.3c-.8.5-9 5.3-44.3-8.6 40.6-1.9 45 7.3 45.1 7.4zm191.4-388.2L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"})});var wO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0 0 10.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 0 0-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"})});var CO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 0 0-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 0 0-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"})});const AO=({isChild:e=!1,item:t,sessionID:n,tenantID:r,preview:i=!1,baseURL:o,apiURL:a,onClick:l,customMediaRenderer:c})=>{var u,d;const h=AN({resourceURI:t.url,sessionID:n,tenantID:r,baseURL:o,apiURL:a}),p=null==c?void 0:c(t.mimeType);if(p)return p;const m=(null===(u=t.url)||void 0===u?void 0:u.startsWith("rgb("))||(null===(d=t.url)||void 0===d?void 0:d.startsWith("rgba("));switch(t.mimeType){case"image/jpeg":case"image/png":case"image/jpg":case"image/gif":return m?(0,s.jsx)(fO,{hoverable:!0,className:"memori-media-item--card memori-media-item--image",cover:(0,s.jsxs)("picture",{className:"memori-media-item--figure",children:[(0,s.jsx)("div",{className:"memori-media-item--rgb-item",style:{backgroundColor:t.url}}),t.title&&(0,s.jsx)("figcaption",{className:"memori-media-item--figure-caption",children:t.title})]})}):(0,s.jsx)("a",{className:"memori-media-item--link",href:t.url,onClick:n=>{e&&n.preventDefault(),l&&(n.preventDefault(),l(t.mediumID))},target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,className:"memori-media-item--card memori-media-item--image",cover:(0,s.jsxs)("picture",{className:"memori-media-item--figure",children:[!i&&(0,s.jsx)("source",{srcSet:[h,t.url,t.content].join(", "),type:t.mimeType}),(0,s.jsx)("img",{alt:t.title,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="}),t.title&&(0,s.jsx)("figcaption",{className:"memori-media-item--figure-caption",children:t.title})]})})});case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsx)(CO,{className:"memori-media-item--icon"}),title:t.title})});case"application/vnd.ms-excel":case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsx)(wO,{className:"memori-media-item--icon"}),title:t.title})});case"application/pdf":return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsx)(xO,{className:"memori-media-item--icon"}),title:t.title})});case"video/mp4":case"video/quicktime":case"video/avi":case"video/mpeg":return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,onClick:n=>{e&&n.preventDefault(),l&&(n.preventDefault(),l(t.mediumID))},target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsxs)("video",{style:{width:"100%",height:"100%"},controls:!0,src:h,title:t.title,children:["video/quicktime"===t.mimeType&&(0,s.jsx)("source",{src:t.url,type:"video/mp4"}),(0,s.jsx)("source",{src:t.url,type:t.mimeType}),"Your browser does not support this video format.",(0,s.jsx)("br",{}),(0,s.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:"Download the video"})]}),title:t.title})});case"audio/mpeg3":case"audio/wav":case"audio/mpeg":return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsx)("audio",{style:{width:"100%",height:"100%"},controls:!0,src:h}),title:t.title})});case"model/gltf-binary":return(0,s.jsx)(_O,{src:h,alt:"",poster:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="});default:return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsx)(bO,{className:"memori-media-item--icon"}),title:t.title})})}};var EO=(0,c.memo)((({items:e,sessionID:t,tenantID:n,translateTo:r,baseURL:i,apiURL:o,customMediaRenderer:a})=>{const[l,u]=(0,c.useState)(e),[d,h]=(0,c.useState)(),p=(0,c.useCallback)((async()=>{if(!r)return;const t=await Promise.all((null!=e?e:[]).map((async e=>{var t;if(!e.title)return e;try{const n=await SO(e.title,r);return{...e,title:null!==(t=n.text)&&void 0!==t?t:e.title}}catch(t){return console.error(t),e}})));u(t)}),[r,e]);(0,c.useEffect)((()=>{r&&p()}),[r,p]);const m=l.filter((e=>{var t;return!(null===(t=e.properties)||void 0===t?void 0:t.executable)&&!cO.map((e=>e.mimeType)).includes(e.mimeType)})).sort(((e,t)=>e.creationTimestamp>t.creationTimestamp?1:e.creationTimestamp<t.creationTimestamp?-1:0)),f=l.filter((e=>{var t;return!(null===(t=e.properties)||void 0===t?void 0:t.executable)&&cO.map((e=>e.mimeType)).includes(e.mimeType)})),g=l.filter((e=>{var t;return"text/css"===e.mimeType&&!!(null===(t=e.properties)||void 0===t?void 0:t.executable)}));return(0,s.jsxs)(lp,{appear:!0,show:!0,as:"div",className:"memori-media-items",children:[!!m.length&&(0,s.jsx)("div",{className:"memori-media-items--grid",children:m.map(((e,r)=>(0,s.jsx)(lp.Child,{as:"div",className:"memori-media-item",enter:"ease-out duration-500 delay-"+100*r,enterFrom:"opacity-0 scale-95",enterTo:"opacity-1 scale-100",leave:"ease-in duration-300",leaveFrom:"opacity-1 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsx)(AO,{isChild:!0,sessionID:t,tenantID:n,baseURL:i,apiURL:o,onClick:e=>{h(l.find((t=>t.mediumID===e)))},item:{...e,title:e.title,url:e.url,content:e.content},customMediaRenderer:a})},e.url+"&index="+r)))}),f.map((e=>(0,s.jsx)(lp.Child,{as:"div",className:"memori-media-item--snippet",enter:"ease-out duration-500",enterFrom:"opacity-0 translate-y-1",enterTo:"opacity-1 translate-y-0",leave:"ease-in duration-300",leaveFrom:"opacity-1",leaveTo:"opacity-0",children:(0,s.jsx)(dO,{medium:e},e.mediumID)},e.mediumID))),g.map((e=>(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:e.content||""}},e.mediumID))),(null==d?void 0:d.mediumID)&&(0,s.jsx)(nP,{width:"100%",widthMd:"100%",className:"memori-media-item--modal",open:!!d,onClose:()=>h(void 0),footer:null,children:(0,s.jsx)(AO,{isChild:!0,sessionID:t,tenantID:n,baseURL:i,apiURL:o,item:{...d,title:d.title,url:d.url,content:d.content},customMediaRenderer:a})})]})}));var TO=(0,c.memo)((({hints:e=[],links:n=[],media:r=[],simulateUserPrompt:i=(()=>{}),sessionID:o,baseUrl:a,apiUrl:l,translateTo:u,customMediaRenderer:d})=>{const{t:h}=Ce(),[p,m]=(0,c.useState)(!0),[f,g]=(0,c.useState)(6);return(0,c.useEffect)((()=>{m(!0)}),[e]),(0,s.jsxs)("div",{className:"memori-media-widget",children:[(null==r?void 0:r.length)>0&&(0,s.jsx)(EO,{items:r,sessionID:o,translateTo:u,baseURL:a,apiURL:l,customMediaRenderer:d}),(null==n?void 0:n.length)>0&&(0,s.jsx)(vO,{items:n,baseUrl:a}),(null==e?void 0:e.length)>0&&p&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lp,{appear:!0,show:!0,as:"ul",className:"memori-media--hints",children:e.slice(0,f).map(((e,n)=>(0,s.jsx)(lp.Child,{as:"li",enter:"ease-out duration-500",enterFrom:"opacity-0 translate-y-1",enterTo:"opacity-1 translate-y-0",leave:"ease-in duration-300",leaveFrom:"opacity-1",leaveTo:"opacity-0",children:(0,s.jsx)(Em,{className:t(Cs)("memori-media--hint"),primary:!0,onClick:()=>{i(e.originalText,e.text),m(!1)},onTouchEnd:()=>{i(e.originalText,e.text),m(!1)},children:e.text},e.text+n)},e.text+n)))}),e.length>f&&(0,s.jsx)("div",{className:"memori-hints--show-more",children:(0,s.jsx)(Em,{className:"memori-hints--show-more-button",id:"showMoreHints",onClick:()=>g(f+6),children:h("expand")||"Expand"})})]})]})}));const IO=e=>e.endsWith("?")?e:`${e}?`;var MO=({message:e,apiURL:n,sessionID:r,visible:i=!0,initialMatches:o=[],closeDrawer:a,_TEST_loading:l=!1})=>{const{t:u}=Ce(),d=Z(n).search.searchMemory,[h,p]=(0,c.useState)(o),[m,f]=(0,c.useState)(l),g=(0,c.useCallback)((async()=>{if(f(!0),!l){try{const{matches:n,...i}=await d(r,{searchType:"Semantic",numberOfResults:3,text:e.questionAnswered,date:e.date,placeName:e.placeName,placeLatitude:e.placeLatitude,placeLongitude:e.placeLongitude,placeUncertaintyKm:e.placeUncertaintyKm,contextVars:e.contextVars,tag:e.tag,memoryTags:e.memoryTags});0!==i.resultCode?(console.error(i),t(ed).error(u(iO(i.resultCode)))):p(null!=n?n:[])}catch(e){console.error("WHYTHISANSWER/FETCH",e),p(null!=o?o:[])}f(!1)}}),[e,r]);return(0,c.useEffect)((()=>{g()}),[g,e,r]),(0,s.jsxs)(Im,{open:i,width:"80%",animated:!1,className:"memori-whythisanswer-drawer",onClose:()=>a(),title:u("whyThisAnswer"),children:[(0,s.jsx)("p",{children:u("whyThisAnswerHelper")}),e.questionAnswered&&(0,s.jsxs)("p",{className:"memori--whythisanswer-question-answered",children:[(0,s.jsxs)("strong",{children:[u("question")||"Question",":"]})," ",e.questionAnswered]}),(0,s.jsxs)(Am,{primary:!0,spinning:m,children:[!m&&0===h.length&&(0,s.jsx)("p",{role:"info",className:"memori--whythisanswer-no-results",children:u("nothingFound")}),m&&0===h.length&&(0,s.jsxs)("ul",{className:"memori--whythisanswer-list memori--whythisanswer-skeleton",children:[(0,s.jsxs)("li",{children:[(0,s.jsxs)("div",{className:"memori--whythisanswer-title",children:[(0,s.jsx)("span",{className:"memori--whythisanswer-confidence",children:(0,s.jsx)("span",{className:"memori--whythisanswer-skeleton-text"})}),(0,s.jsx)("div",{className:"memori--whythisanswer-title-text",children:(0,s.jsx)("p",{className:"memori--whythisanswer-skeleton-text"})})]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-text"}),(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-text"}),(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-text"})]}),(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-block"})]}),(0,s.jsxs)("li",{children:[(0,s.jsxs)("div",{className:"memori--whythisanswer-title",children:[(0,s.jsx)("span",{className:"memori--whythisanswer-confidence",children:(0,s.jsx)("span",{className:"memori--whythisanswer-skeleton-text"})}),(0,s.jsxs)("div",{className:"memori--whythisanswer-title-text",children:[(0,s.jsx)("p",{className:"memori--whythisanswer-skeleton-text"}),(0,s.jsx)("p",{className:"memori--whythisanswer-skeleton-text"})]})]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-text"}),(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-text"})]}),(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-block"})]})]}),h.length>0&&(0,s.jsx)("ul",{className:"memori--whythisanswer-list",children:h.map((e=>{var t,n,r,i,o,a,l;return(0,s.jsxs)("li",{children:[(0,s.jsxs)("div",{className:"memori--whythisanswer-title",children:[(0,s.jsx)("span",{className:"memori--whythisanswer-confidence",children:e.confidenceLevel}),(0,s.jsxs)("div",{className:"memori--whythisanswer-title-text",children:[(0,s.jsx)("p",{children:(0,s.jsx)("strong",{children:IO(null!==(t=e.memory.title)&&void 0!==t?t:"")})}),(0,s.jsx)("p",{children:null===(r=null===(n=e.memory.titleVariants)||void 0===n?void 0:n.map((e=>IO(e))))||void 0===r?void 0:r.join(" | ")})]})]}),null===(i=e.memory.answers)||void 0===i?void 0:i.map(((e,t)=>(0,s.jsx)("p",{className:"memori--whythisanswer-answer",children:(0,s.jsx)(nO,{rows:3,children:e.text})},t))),(0,s.jsx)(TO,{links:null===(o=e.memory.media)||void 0===o?void 0:o.filter((e=>"text/html"===e.mimeType))}),null===(l=null===(a=e.memory.media)||void 0===a?void 0:a.filter((e=>"text/plain"===e.mimeType)))||void 0===l?void 0:l.map((e=>(0,s.jsx)(nO,{rows:2,lineHeightMultiplier:2,innerClassName:"memori--whythisanswer-snippet-expandable",children:(0,s.jsx)(dO,{medium:e,showCopyButton:!1},e.mediumID)},e.mediumID)))]},e.memory.memoryID)}))})]})]})};c=o("85Hg2");var RO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"})});var PO=({previewFiles:e,removeFile:t,allowRemove:n=!0,isMessagePreview:r=!1})=>{const[i,o]=(0,c.useState)(null),[a,l]=(0,c.useState)(null);return(0,s.jsxs)(s.Fragment,{children:[e.length>0&&(0,s.jsx)("div",{className:"memori--preview-container "+(r?"memori--message-preview":"memori--absolute-preview"),children:(0,s.jsx)("div",{className:"memori--preview-list",children:e.map((e=>(0,s.jsxs)("div",{className:"memori--preview-item",onMouseEnter:()=>l(e.id),onMouseLeave:()=>l(null),onClick:()=>o(e),children:[(0,s.jsx)(RO,{className:"memori--preview-icon"}),(0,s.jsx)("span",{className:"memori--preview-filename",children:e.name}),n&&(0,s.jsx)(Em,{shape:"rounded",icon:(0,s.jsx)(Tm,{}),danger:!0,className:"memori--remove-button "+(a===e.id?"visible":""),onClick:n=>{n.stopPropagation(),t(e.id)}})]},e.id)))})}),(0,s.jsx)(nP,{width:"80%",widthMd:"80%",open:!!i,className:"memori--modal-preview-file",onClose:()=>o(null),closable:!0,title:null==i?void 0:i.name,children:(0,s.jsx)("div",{className:"memori--preview-content",style:{whiteSpace:"pre-wrap",maxHeight:"70vh",overflowY:"auto"},children:null==i?void 0:i.content})})]})},NO={};NO=function(){"use strict";var e=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,t=/[\0-\x1F\x7F-\x9F]/,n=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,r=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;function i(i){const o={};i=i||{},o.src_Any=e.source,o.src_Cc=t.source,o.src_Z=r.source,o.src_P=n.source,o.src_ZPCc=[o.src_Z,o.src_P,o.src_Cc].join("|"),o.src_ZCc=[o.src_Z,o.src_Cc].join("|");const s="[><|]";return o.src_pseudo_letter="(?:(?!"+s+"|"+o.src_ZPCc+")"+o.src_Any+")",o.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",o.src_auth="(?:(?:(?!"+o.src_ZCc+"|[@/\\[\\]()]).)+@)?",o.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",o.src_host_terminator="(?=$|"+s+"|"+o.src_ZPCc+")(?!"+(i["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+o.src_ZPCc+"))",o.src_path="(?:[/?#](?:(?!"+o.src_ZCc+"|"+s+"|[()[\\]{}.,\"'?!\\-;]).|\\[(?:(?!"+o.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+o.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+o.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+o.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+o.src_ZCc+"|[']).)+\\'|\\'(?="+o.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+o.src_ZCc+"|[.]|$)|"+(i["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+o.src_ZCc+"|$)|;(?!"+o.src_ZCc+"|$)|\\!+(?!"+o.src_ZCc+"|[!]|$)|\\?(?!"+o.src_ZCc+"|[?]|$))+|\\/)?",o.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',o.src_xn="xn--[a-z0-9\\-]{1,59}",o.src_domain_root="(?:"+o.src_xn+"|"+o.src_pseudo_letter+"{1,63})",o.src_domain="(?:"+o.src_xn+"|(?:"+o.src_pseudo_letter+")|(?:"+o.src_pseudo_letter+"(?:-|"+o.src_pseudo_letter+"){0,61}"+o.src_pseudo_letter+"))",o.src_host="(?:(?:(?:(?:"+o.src_domain+")\\.)*"+o.src_domain+"))",o.tpl_host_fuzzy="(?:"+o.src_ip4+"|(?:(?:(?:"+o.src_domain+")\\.)+(?:%TLDS%)))",o.tpl_host_no_ip_fuzzy="(?:(?:(?:"+o.src_domain+")\\.)+(?:%TLDS%))",o.src_host_strict=o.src_host+o.src_host_terminator,o.tpl_host_fuzzy_strict=o.tpl_host_fuzzy+o.src_host_terminator,o.src_host_port_strict=o.src_host+o.src_port+o.src_host_terminator,o.tpl_host_port_fuzzy_strict=o.tpl_host_fuzzy+o.src_port+o.src_host_terminator,o.tpl_host_port_no_ip_fuzzy_strict=o.tpl_host_no_ip_fuzzy+o.src_port+o.src_host_terminator,o.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+o.src_ZPCc+"|>|$))",o.tpl_email_fuzzy="(^|"+s+'|"|\\(|'+o.src_ZCc+")("+o.src_email_name+"@"+o.tpl_host_fuzzy_strict+")",o.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+o.src_ZPCc+"))((?![$+<=>^`||])"+o.tpl_host_port_fuzzy_strict+o.src_path+")",o.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+o.src_ZPCc+"))((?![$+<=>^`||])"+o.tpl_host_port_no_ip_fuzzy_strict+o.src_path+")",o}function o(e){return Array.prototype.slice.call(arguments,1).forEach((function(t){t&&Object.keys(t).forEach((function(n){e[n]=t[n]}))})),e}function s(e){return Object.prototype.toString.call(e)}function a(e){return"[object String]"===s(e)}function l(e){return"[object Object]"===s(e)}function c(e){return"[object RegExp]"===s(e)}function u(e){return"[object Function]"===s(e)}function d(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const h={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function p(e){return Object.keys(e||{}).reduce((function(e,t){return e||h.hasOwnProperty(t)}),!1)}const m={"http:":{validate:function(e,t,n){const r=e.slice(t);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,n){const r=e.slice(t);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?t>=3&&":"===e[t-3]||t>=3&&"/"===e[t-3]?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){const r=e.slice(t);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},f="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",g="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function v(e){e.__index__=-1,e.__text_cache__=""}function y(e){return function(t,n){const r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function S(){return function(e,t){t.normalize(e)}}function _(e){const t=e.re=i(e.__opts__),n=e.__tlds__.slice();function r(e){return e.replace("%TLDS%",t.src_tlds)}e.onCompile(),e.__tlds_replaced__||n.push(f),n.push(t.src_xn),t.src_tlds=n.join("|"),t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),"i");const o=[];function s(e,t){throw new Error('(LinkifyIt) Invalid schema "'+e+'": '+t)}e.__compiled__={},Object.keys(e.__schemas__).forEach((function(t){const n=e.__schemas__[t];if(null===n)return;const r={validate:null,link:null};if(e.__compiled__[t]=r,l(n))return c(n.validate)?r.validate=y(n.validate):u(n.validate)?r.validate=n.validate:s(t,n),void(u(n.normalize)?r.normalize=n.normalize:n.normalize?s(t,n):r.normalize=S());a(n)?o.push(t):s(t,n)})),o.forEach((function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)})),e.__compiled__[""]={validate:null,normalize:S()};const h=Object.keys(e.__compiled__).filter((function(t){return t.length>0&&e.__compiled__[t]})).map(d).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+h+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+h+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),v(e)}function b(e,t){const n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function x(e,t){const n=new b(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function w(e,t){if(!(this instanceof w))return new w(e,t);t||p(e)&&(t=e,e={}),this.__opts__=o({},h,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=o({},m,e),this.__compiled__={},this.__tlds__=g,this.__tlds_replaced__=!1,this.re={},_(this)}function C(e={},t={}){const n=new w(e,t);return E(n,t),{extensions:[{name:"autolink",level:"inline",start:e=>{const t=A(n,e);if(t)return t.index},tokenizer(e){if(this.lexer.state.inLink)return;const t=A(n,e);if(!t)return;let r;return 0===t.index?r=t.raw:1===t.index&&"<"===e.charAt(0)&&">"===e.charAt(t.lastIndex)&&(r=`<${t.raw}>`),r?{type:"link",raw:r,text:t.text,href:t.url,tokens:[{type:"text",raw:t.text,text:t.text}]}:void 0}}]}}function A(e,t){const n=e.match(t);if(n&&n.length)return n[0]}function E(e,t){const n=t.tlds;delete t.tlds;const r=t.tldsKeepOld;delete t.tldsKeepOld,n&&e.tlds(n,r)}return w.prototype.add=function(e,t){return this.__schemas__[e]=t,_(this),this},w.prototype.set=function(e){return this.__opts__=o(this.__opts__,e),this},w.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let t,n,r,i,o,s,a,l,c;if(this.re.schema_test.test(e))for(a=this.re.schema_search,a.lastIndex=0;null!==(t=a.exec(e));)if(i=this.testSchemaAt(e,t[2],a.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=e.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l<this.__index__)&&null!==(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(o=n.index+n[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(c=e.indexOf("@"),c>=0&&null!==(r=e.match(this.re.email_fuzzy))&&(o=r.index+r[1].length,s=r.index+r[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&s>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=s))),this.__index__>=0},w.prototype.pretest=function(e){return this.re.pretest.test(e)},w.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},w.prototype.match=function(e){const t=[];let n=0;this.__index__>=0&&this.__text_cache__===e&&(t.push(x(this,n)),n=this.__last_index__);let r=n?e.slice(n):e;for(;this.test(r);)t.push(x(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return t.length?t:null},w.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const t=this.re.schema_at_start.exec(e);if(!t)return null;const n=this.testSchemaAt(e,t[2],t[0].length);return n?(this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+n,x(this,0)):null},w.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter((function(e,t,n){return e!==n[t-1]})).reverse(),_(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,_(this),this)},w.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},w.prototype.onCompile=function(){},C}();var OO={};OO=function(e){"use strict";const t=/^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1(?=[\s?!\.,:?!。,:]|$)/,n=/^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1/,r=/^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;function i(e={}){return{extensions:[s(e,o(e,!1)),a(e,o(e,!0))]}}function o(t,n){return r=>e.renderToString(r.text,{...t,displayMode:r.displayMode})+(n?"\n":"")}function s(e,r){const i=e&&e.nonStandard,o=i?n:t;return{name:"inlineKatex",level:"inline",start(e){let t,n=e;for(;n;){if(t=n.indexOf("$"),-1===t)return;if((i?t>-1:0===t||" "===n.charAt(t-1))&&n.substring(t).match(o))return t;n=n.substring(t+1).replace(/^\$+/,"")}},tokenizer(e,t){const n=e.match(o);if(n)return{type:"inlineKatex",raw:n[0],text:n[2].trim(),displayMode:2===n[1].length}},renderer:r}}function a(e,t){return{name:"blockKatex",level:"block",tokenizer(e,t){const n=e.match(r);if(n)return{type:"blockKatex",raw:n[0],text:n[2].trim(),displayMode:2===n[1].length}},renderer:t}}return i}(o("kqAxc"));const DO=(e,t,n,r)=>{if(!t.rowspan)return"";return`${`<${n}`+(t.colspan>1?` colspan=${t.colspan}`:"")+(t.rowspan>1?` rowspan=${t.rowspan}`:"")+(r?` align=${r}`:"")+">"+e}</${n}>\n`},kO=(e,t,n=[])=>{var r,i,o;const s=[...e.matchAll(/(?:[^|\\]|\\.?)+(?:\|+|$)/g)].map((e=>e[0]));(null===(r=s[0])||void 0===r?void 0:r.trim())||s.shift(),(null===(i=s[s.length-1])||void 0===i?void 0:i.trim())||s.pop();let a,l,c,u,d,h=0;for(a=0;a<s.length;a++){if(c=s[a].split(/\|+$/)[0],s[a]={rowspan:1,colspan:Math.max(s[a].length-c.length,1),text:c.trim().replace(/\\\|/g,"|")},"^"===c.slice(-1)&&n.length)for(d=0,l=0;l<n.length;l++){if(u=n[l],d===h&&u.colspan===s[a].colspan){s[a].rowSpanTarget=null!==(o=u.rowSpanTarget)&&void 0!==o?o:u,s[a].rowSpanTarget.text+=` ${s[a].text.slice(0,-1)}`,s[a].rowSpanTarget.rowspan+=1,s[a].rowspan=0;break}if(d+=u.colspan,d>h)break}h+=s[a].colspan}if(h>t)s.splice(t);else for(;h<t;)s.push({colspan:1,text:""}),h+=1;return s};XN.marked.use({async:!1,gfm:!0,pedantic:!1,renderer:{link:({href:e,title:t,text:n})=>{const r=e?pR(e):null;if(null===r)return n;let i='<a href="'+(e=r)+'"';return t&&(i+=' title="'+t+'"'),i+=' target="_blank" rel="noopener noreferrer">'+n+"</a>",i}}}),XN.marked.use(t(NO)()),XN.marked.use({extensions:[{name:"spanTable",level:"block",start(e){var t;return null===(t=e.match(/^\n *([^\n ].*\|.*)\n/))||void 0===t?void 0:t.index},tokenizer(e,t){const n=new RegExp("^ *([^\\n ].*\\|.*\\n(?: *[^\\s].*\\n)*?) {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n| {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)| {0,3}#{1,6} | {0,3}>| {4}[^\\n]| {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n| {0,3}(?:[*+-]|1[.)]) |<\\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?: +|\\n|\\/?>)|<(?:script|pre|style|textarea|!--)).*(?:\\n|$))*)\\n*|$)").exec(e);if(n){const e={type:"spanTable",header:n[1].replace(/\n$/,"").split("\n"),align:n[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:n[3]?n[3].replace(/\n$/,"").split("\n"):[]};e.header[0]=kO(e.header[0]);const t=e.header[0].reduce(((e,t)=>e+t.colspan),0);if(t===e.align.length){let r,i,o,s;e.raw=n[0];let a=e.align.length;for(r=0;r<a;r++)/^ *-+: *$/.test(e.align[r])?e.align[r]="right":/^ *:-+: *$/.test(e.align[r])?e.align[r]="center":/^ *:-+ *$/.test(e.align[r])?e.align[r]="left":e.align[r]=null;for(a=e.header.length,r=1;r<a;r++)e.header[r]=kO(e.header[r],t,e.header[r-1]);for(a=e.rows.length,r=0;r<a;r++)e.rows[r]=kO(e.rows[r],t,e.rows[r-1]);for(a=e.header.length,i=0;i<a;i++)for(s=e.header[i],o=0;o<s.length;o++)s[o].tokens=[],this.lexer.inline(s[o].text,s[o].tokens);for(a=e.rows.length,i=0;i<a;i++)for(s=e.rows[i],o=0;o<s.length;o++)s[o].tokens=[],this.lexer.inline(s[o].text,s[o].tokens);return e}}},renderer(e){let t,n,r,i,o,s,a='<div class="memori--responsive-table-wrapper"><table class="memori--table memori--table--compact">';for(a+="<thead>",t=0;t<e.header.length;t++){r=e.header[t];let o=0;for(a+="<tr>",n=0;n<r.length;n++)i=r[n],s=this.parser.parseInline(i.tokens),a+=DO(s,i,"th",e.align[o]),o+=i.colspan;a+="</tr>"}if(a+="</thead>",e.rows.length){for(a+="<tbody>",t=0;t<e.rows.length;t++){for(r=e.rows[t],o=0,a+="<tr>",n=0;n<r.length;n++)i=r[n],s=this.parser.parseInline(i.tokens),a+=DO(s,i,"td",e.align[o]),o+=i.colspan;a+="</tr>"}a+="</tbody>"}return a+="</table></div>",a}}]});var LO=({message:e,memori:n,tenant:r,baseUrl:i,apiUrl:o,sessionID:a,showFeedback:l,showWhyThisAnswer:u=!0,showCopyButton:d=!0,showTranslationOriginal:h=!1,simulateUserPrompt:p,showAIicon:m=!0,isFirst:f=!1,useMathFormatting:g=!1,user:v,userAvatar:y,experts:S})=>{var _,b,x,w,C,A,E,T;const{t:I,i18n:M}=Ce(),R=M.language||"en",[P,N]=(0,c.useState)(!1);g&&XN.marked.use(t(OO)({throwOnError:!1,output:"htmlAndMathml"}));const O=e.translatedText||e.text,D=((e,n=!1)=>{try{let r=e.trim().replaceAll(/\[([^\]]+)\]\(([^\)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>').replaceAll(/```markdown([^```]+)```/g,"$1").replaceAll("($","( $").replaceAll(":$",": $").replaceAll("\frac","\\frac").replaceAll("\beta","\\beta").replaceAll("cdot","\\cdot");n&&(r=r.replace(/\\+\[(.*?)\\*\]/gs,((e,t)=>`$$${t}$$`)),r=r.replace(/\[([^[\]]+?)\]/g,((e,t)=>!/[\\+a-z0-9_{}^=\-\+\*\/]+/i.test(t)||e.startsWith("[http")||e.includes("](")?e:`$$${t}$$`)));let i=XN.marked.parse(r).toString().trim();return i=t(QN).sanitize(i,{ADD_ATTR:["target"]}),i.replace(/(<br>)+/g,"<br>").replace(/<p><\/p>/g,"<br>").replace(/<p><br><\/p>/g,"<br>")}catch(t){return console.error("Error rendering message:",t),e}})(O,g),k=e.fromUser?O:dR(uR(D));return(0,c.useLayoutEffect)((()=>{if("undefined"!=typeof window&&!e.fromUser&&g){const e=window.MathJax;(null==e?void 0:e.typesetPromise)&&e.typesetPromise([".memori-chat--bubble-content"])}}),[e.text,e.fromUser,g]),(0,s.jsxs)(s.Fragment,{children:[(e.initial||f)&&(0,s.jsx)("div",{className:"memori-chat--bubble-initial"}),(0,s.jsxs)(lp,{show:!0,appear:!0,as:"div",className:t(Cs)("memori-chat--bubble-container",{"memori-chat--bubble-from-user":!!e.fromUser,"memori-chat--with-addon":e.generatedByAI&&m||l&&p}),children:[!e.fromUser&&(0,s.jsx)(lp.Child,{as:"picture",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),title:(null===(_=e.emitter)||void 0===_?void 0:_.length)&&n.enableBoardOfExperts?e.emitter:n.name,children:(0,s.jsx)("img",{className:"memori-chat--bubble-avatar-img",alt:(null===(b=e.emitter)||void 0===b?void 0:b.length)&&n.enableBoardOfExperts?e.emitter:n.name,src:(null===(x=e.emitter)||void 0===x?void 0:x.length)&&n.enableBoardOfExperts&&(null==S?void 0:S.find((t=>t.name===e.emitter)))?`${new URL(null!=o?o:"/").origin}/api/v1/memoriai/memori/avatar/${null===(w=S.find((t=>t.name===e.emitter)))||void 0===w?void 0:w.expertMemoriID}`:n.avatarURL&&n.avatarURL.length>0?AN({type:"avatar",tenantID:null==r?void 0:r.id,resourceURI:n.avatarURL,baseURL:i,apiURL:o}):AN({tenantID:null==r?void 0:r.id,type:"avatar",baseURL:i||"https://www.aisuru.com",apiURL:o}),onError:e=>{e.currentTarget.src=n.avatarURL&&n.avatarURL.length>0?AN({type:"avatar",tenantID:null==r?void 0:r.id,resourceURI:n.avatarURL,baseURL:i}):AN({tenantID:null==r?void 0:r.id,type:"avatar",baseURL:i}),e.currentTarget.onerror=null}})}),(0,s.jsxs)(lp.Child,{as:"div",className:t(Cs)("memori-chat--bubble",{"memori-chat--user-bubble":!!e.fromUser,"memori-chat--with-addon":!e.fromUser&&d||e.generatedByAI&&m||l&&p,"memori-chat--ai-generated":e.generatedByAI&&m,"memori-chat--with-feedback":l}),enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-09 translate-x-"+(e.fromUser?"30":"-30"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-09 translate-x-"+(e.fromUser?"30":"-30"),children:[(0,s.jsx)("div",{dir:"auto",className:"memori-chat--bubble-content",dangerouslySetInnerHTML:{__html:D}}),(!e.fromUser&&d||e.generatedByAI&&m||l&&p)&&(0,s.jsxs)("div",{className:"memori-chat--bubble-addon",children:[!e.fromUser&&d&&(0,s.jsx)(Em,{ghost:!0,shape:"circle",title:I("copy")||"Copy",className:"memori-chat--bubble-action-icon",icon:(0,s.jsx)(eO,{"aria-label":I("copy")||"Copy"}),onClick:()=>navigator.clipboard.writeText(k)}),!e.fromUser&&d&&k!==e.text&&(0,s.jsx)(Em,{ghost:!0,shape:"circle",title:I("copyRawCode")||"Copy raw code",className:"memori-chat--bubble-action-icon",icon:(0,s.jsx)(tO,{"aria-label":I("copyRawCode")||"Copy raw code"}),onClick:()=>navigator.clipboard.writeText(e.text)}),l&&!!p&&(0,s.jsx)($N,{memori:n,className:"memori-chat--bubble-feedback",dropdown:!0,onNegativeClick:e=>{e&&p(e)}}),e.generatedByAI&&m&&(0,s.jsx)(MN,{align:"left",content:I("generatedByAI"),className:"memori-chat--bubble-action-icon memori-chat--bubble-action-icon--ai",children:(0,s.jsx)("span",{children:(0,s.jsx)(TN,{title:I("generatedByAI")||void 0})})}),h&&e.translatedText&&e.translatedText!==e.text&&(0,s.jsx)(MN,{align:"left",content:`${"it"===R?"Testo originale":"Original text"}: ${e.text}`,className:"memori-chat--bubble-action-icon memori-chat--bubble-action-icon--ai",children:(0,s.jsx)("span",{children:(0,s.jsx)(IN,{"aria-label":"it"===R?"Testo originale":"Original text"})})}),!e.fromUser&&e.questionAnswered&&o&&u&&(0,s.jsx)(Em,{ghost:!0,shape:"circle",title:I("whyThisAnswer")||void 0,className:"memori-chat--bubble-action-icon",onClick:()=>N(!0),disabled:P,icon:(0,s.jsx)(ZN,{title:I("whyThisAnswer")||void 0})})]}),e.fromUser&&e.media&&(null===(C=e.media)||void 0===C?void 0:C.length)>0&&(null===(A=e.media[0].properties)||void 0===A?void 0:A.isAttachedFile)&&(0,s.jsx)(PO,{previewFiles:e.media.map((e=>{var t,n;return{name:null!==(t=e.title)&&void 0!==t?t:"",id:e.mediumID,content:null!==(n=e.content)&&void 0!==n?n:""}})),removeFile:()=>{},allowRemove:!1,isMessagePreview:!0})]}),e.fromUser&&(0,s.jsx)(s.Fragment,{children:y&&"string"==typeof y||!y&&(null===(E=null==v?void 0:v.avatarURL)||void 0===E?void 0:E.length)?(0,s.jsx)(lp.Child,{as:"picture",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),children:(0,s.jsx)("img",{className:"memori-chat--bubble-avatar-img",alt:null!==(T=null==v?void 0:v.userName)&&void 0!==T?T:"User",src:null!=y?y:null==v?void 0:v.avatarURL})}):y?(0,s.jsx)(lp.Child,{as:"div",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),children:y}):(0,s.jsx)(lp.Child,{as:"div",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),children:(0,s.jsx)(EN,{})})})]}),P&&o&&(0,s.jsx)(MO,{visible:P,message:e,closeDrawer:()=>N(!1),apiURL:o,sessionID:a})]})};c=o("85Hg2"),c=o("85Hg2");var BO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 0 0 0 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0 0 13.5-4.7L863.9 169a7.9 7.9 0 0 0-8.9-8.9zM416.6 562.3a8.03 8.03 0 0 0-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 0 0-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"})});var zO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M391 240.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L200 146.3a8.03 8.03 0 0 0-11.3 0l-42.4 42.3a8.03 8.03 0 0 0 0 11.3L280 333.6l-43.9 43.9a8.01 8.01 0 0 0 4.7 13.6L401 410c5.1.6 9.5-3.7 8.9-8.9L391 240.9zm10.1 373.2L240.8 633c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L146.3 824a8.03 8.03 0 0 0 0 11.3l42.4 42.3c3.1 3.1 8.2 3.1 11.3 0L333.7 744l43.7 43.7A8.01 8.01 0 0 0 391 783l18.9-160.1c.6-5.1-3.7-9.4-8.8-8.8zm221.8-204.2L783.2 391c6.6-.8 9.4-8.9 4.7-13.6L744 333.6 877.7 200c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.3a8.03 8.03 0 0 0-11.3 0L690.3 279.9l-43.7-43.7a8.01 8.01 0 0 0-13.6 4.7L614.1 401c-.6 5.2 3.7 9.5 8.8 8.9zM744 690.4l43.9-43.9a8.01 8.01 0 0 0-4.7-13.6L623 614c-5.1-.6-9.5 3.7-8.9 8.9L633 783.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L824 877.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L744 690.4z"})});var FO=({disabled:e=!1,value:n,onChange:r,onPressEnter:i,onFocus:o,onBlur:a})=>{const{t:l}=Ce(),[u,d]=(0,c.useState)(!1);return(0,s.jsx)("div",{"data-testid":"chat-textarea",className:t(Cs)("memori-chat-textarea",{"memori-chat-textarea--expanded":u,"memori-chat-textarea--disabled":e}),children:(0,s.jsxs)("div",{className:"memori-chat-textarea--inner",children:[(0,s.jsx)("textarea",{className:"memori-chat-textarea--input",disabled:e,value:n,onChange:e=>{r(e.target.value)},onKeyDownCapture:e=>{"Enter"===e.key&&!e.shiftKey&&i&&i(e)},onFocus:o,onBlur:a,maxLength:1e5}),(0,s.jsx)("div",{className:"memori-chat-textarea--expand",children:(0,s.jsx)(Em,{className:t(Cs)("memori-chat-textarea--expand-button"),onClick:()=>d(!u),padded:!1,ghost:!0,title:u?l("collapse")||"Collapse":l("expand")||"Expand",icon:u?(0,s.jsx)(zO,{}):(0,s.jsx)(BO,{})})})]})})};var UO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2-8.5 2.1-13.8 10.7-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})});c=o("85Hg2");var jO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"})});var GO=({listening:e,stopAudio:n,startListening:r,stopListening:i})=>{const{t:o}=Ce(),[a,l]=(0,c.useState)(),u=(0,c.useRef)(null),d=e=>{e.preventDefault(),l(o("write_and_speak.holdToSpeak")||"Hold to record"),u.current||(u.current=setTimeout((()=>{n(),l(o("write_and_speak.releaseToEndListening")||"Release to end listening"),r()}),300))},h=()=>{u.current&&(clearTimeout(u.current),u.current=null),i(),l(void 0)};return(0,c.useEffect)((()=>()=>h()),[]),(0,s.jsx)(MN,{visible:!!a,content:(0,s.jsx)("span",{children:a||o("write_and_speak.pressAndHoldToSpeak")||"Press and hold to speak"}),align:"topLeft",className:"memori-mic-btn-tooltip",children:(0,s.jsx)(Em,{primary:!0,className:t(Cs)("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":e}),title:e?o("write_and_speak.micButtonPopoverListening")||"Listening":o("write_and_speak.micButtonPopover")||"Start listening",onMouseDown:d,onTouchStart:d,onMouseUp:h,onTouchEnd:h,shape:"circle",icon:(0,s.jsx)(jO,{})})})};c=o("85Hg2");var HO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"})});c=o("85Hg2");var VO=({open:e=!1,onClose:n,className:r,title:i,description:o,children:a,type:l="info",icon:u,closable:d=!0,duration:h=null,action:p,width:m="400px"})=>{const{t:f}=Ce();t(c).useEffect((()=>{if(h&&e){const e=setTimeout((()=>{n(!1)}),h);return()=>clearTimeout(e)}}),[h,e,n]);return(0,s.jsx)(lp,{show:e,as:t(c).Fragment,appear:!0,children:(0,s.jsxs)("div",{className:t(Cs)("memori-alert",(e=>{switch(e){case"success":return"memori-alert--success";case"warning":return"memori-alert--warning";case"error":return"memori-alert--error";default:return"memori-alert--info"}})(l),r),children:[(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-alert {\n --memori-alert--width: ${m};\n }\n `}}),(0,s.jsx)(lp.Child,{as:t(c).Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-4",children:(0,s.jsxs)("div",{className:"memori-alert--container",children:[u&&(0,s.jsx)("div",{className:"memori-alert--icon",children:u}),(0,s.jsxs)("div",{className:"memori-alert--content",children:[i&&(0,s.jsx)("div",{className:"memori-alert--title",children:i}),o&&(0,s.jsx)("div",{className:"memori-alert--description",children:o}),a]}),(0,s.jsxs)("div",{className:"memori-alert--actions",children:[p&&(0,s.jsx)("div",{className:"memori-alert--action",children:p}),d&&(0,s.jsx)(Em,{ghost:!0,padded:!0,shape:"circle",icon:(0,s.jsx)(Tm,{}),title:f("close")||"Close",onClick:()=>n(!1),className:"memori-alert--close"})]})]})})]})})};const WO=10485760,qO=1e5,JO="3.11.174",KO=`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${JO}/pdf.worker.min.js`,YO=`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${JO}/pdf.min.js`;var $O=({setPreviewFiles:e})=>{const[n,r]=(0,c.useState)(!1),[i,o]=(0,c.useState)([]),a=(0,c.useRef)(null),l=e=>{o((t=>t.filter((t=>t.message!==e))))},u=e=>{o((t=>[...t,e])),setTimeout((()=>{l(e.message)}),5e3)},d=e=>{var t;const n=`.${null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase()}`,r=[".pdf",".txt"];return r.includes(n)?!(e.size>WO)||(u({message:`File "${e.name}" exceeds 10MB limit`,severity:"error",fileId:e.name}),!1):(u({message:`File type "${n}" is not supported. Please use: ${r.join(", ")}`,severity:"error",fileId:e.name}),!1)},h=async e=>{var t;const n=(null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase())||"";try{let t=null;return"pdf"===n?t=await(async e=>{try{window.pdfjsLib||await new Promise(((e,t)=>{const n=document.createElement("script");n.src=YO,n.onload=()=>{window.pdfjsLib.GlobalWorkerOptions.workerSrc=KO,e(!0)},n.onerror=t,document.head.appendChild(n)}));const t=await e.arrayBuffer(),n=await window.pdfjsLib.getDocument({data:t}).promise;let r="";for(let e=1;e<=n.numPages;e++){const t=await n.getPage(e);r+=(await t.getTextContent()).items.filter((e=>e.str&&"string"==typeof e.str)).map((e=>e.str)).join(" ")+"\n"}return r}catch(e){throw new Error(`PDF extraction failed: ${e instanceof Error?e.message:"Unknown error"}`)}})(e):"txt"===n&&(t=await e.text()),t&&t.length>qO?(u({message:`File "${e.name}" content exceeds 100000 characters`,severity:"error",fileId:e.name}),null):t}catch(t){return u({message:`Failed to process "${e.name}": ${t instanceof Error?t.message:"Unknown error"}`,severity:"error",fileId:e.name}),null}};return(0,s.jsxs)("div",{className:"relative file-upload-wrapper",children:[(0,s.jsx)("input",{ref:a,type:"file",accept:".pdf,.txt",className:"memori--upload-file-input",onChange:async t=>{const n=Array.from(t.target.files||[]);if(0===n.length)return;r(!0),o([]);const i=[];for(const e of n){if(!d(e))continue;const t=Math.random().toString(36).substr(2,9),n=await h(e);n&&i.push({name:e.name,id:t,content:n})}i.length>0&&(e(i),i.length<n.length&&u({message:"Some files were not processed successfully",severity:"warning"})),r(!1),a.current&&(a.current.value="")},multiple:!0}),(0,s.jsx)("button",{className:t(Cs)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button","memori--conversation-button",{"memori--error":i.length>0}),onClick:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.click()},disabled:n,title:"Upload file",children:n?(0,s.jsx)(Am,{spinning:!0,className:"memori--upload-icon"}):(0,s.jsx)(HO,{className:"memori--upload-icon"})}),(0,s.jsx)("div",{className:"memori--error-message-container",children:i.map(((e,t)=>(0,s.jsx)(VO,{open:!0,type:e.severity,title:"File upload failed",description:e.message,onClose:()=>l(e.message),width:"350px"},`${e.message}-${t}`)))})]})};var XO=({dialogState:e,userMessage:n="",sendOnEnter:r,onChangeUserMessage:i,sendMessage:o,onTextareaFocus:a,onTextareaBlur:l,resetTranscript:u,showMicrophone:d=!1,microphoneMode:h="HOLD_TO_TALK",listening:p=!1,stopAudio:m,startListening:f,stopListening:g,showUpload:v=!1})=>{const{t:y}=Ce(),[S,_]=(0,c.useState)([]);return(0,s.jsxs)("fieldset",{id:"chat-fieldset",className:"memori-chat-inputs",disabled:"X2a"===(null==e?void 0:e.state)||"X3"===(null==e?void 0:e.state),children:[(0,s.jsx)(FO,{value:n,onChange:i,onPressEnter:()=>{"keypress"===r&&(null==n?void 0:n.length)>0&&(g(),o(n,S[0]?{mediumID:"",mimeType:"text/plain",content:S[0].content,title:S[0].name,properties:{isAttachedFile:!0}}:void 0),_([]),i(""),u())},onFocus:a,onBlur:l,disabled:["R2","R3","R4","R5","G3","X3"].includes((null==e?void 0:e.state)||"")}),v&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(PO,{previewFiles:S,removeFile:e=>{_((t=>t.filter((t=>t.id!==e))))}}),(0,s.jsx)($O,{setPreviewFiles:_})]}),(0,s.jsx)(Em,{shape:"circle",primary:!!(null==n?void 0:n.length),disabled:!n||0===n.length,className:"memori-chat-inputs--send",onClick:()=>{o(n,S[0]?{mediumID:"",mimeType:"text/plain",content:S[0].content,title:S[0].name,properties:{isAttachedFile:!0}}:void 0),_([]),m(),speechSynthesis.speak(new SpeechSynthesisUtterance(""))},title:y("send")||"Send",icon:(0,s.jsx)(UO,{})}),d&&"HOLD_TO_TALK"===h&&(0,s.jsx)(GO,{listening:p,startListening:f,stopListening:()=>{g(),(null==n?void 0:n.length)&&o(n)},stopAudio:m}),d&&"CONTINUOUS"===h&&(0,s.jsx)(Em,{primary:!0,className:t(Cs)("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":p}),title:p?y("write_and_speak.micButtonPopoverListening")||"Listening":y("write_and_speak.micButtonPopover")||"Start listening",onClick:()=>{p?g():(m(),f())},shape:"circle",icon:(0,s.jsx)(jO,{})})]})};c=o("85Hg2");const QO={en:[{delayAfter:3,text:"Generating an accurate and fancy response..."},{delayAfter:3,text:"Generating a response that will blow your mind..."},{delayAfter:3,text:"Generating a response that will make you smile..."},{delayAfter:3,text:"Thinking of a response..."},{delayAfter:3,text:"Thinking of a response that will make you smile..."},{delayAfter:3,text:"Gathering my thoughts..."},{delayAfter:3,text:"Gathering my thoughts to give you a response..."}],it:[{delayAfter:3,text:"Sto generando una risposta accurata e fantasiosa..."},{delayAfter:3,text:"Sto generando una risposta che ti farà impazzire..."},{delayAfter:3,text:"Sto generando una risposta che ti farà sorridere..."},{delayAfter:3,text:"Sto pensando ad una risposta..."},{delayAfter:3,text:"Sto pensando ad una risposta che ti farà sorridere..."},{delayAfter:3,text:"Sto raccogliendo i miei pensieri..."},{delayAfter:3,text:"Sto raccogliendo i miei pensieri per darti una risposta..."}]},ZO=(e=3)=>new Array(20*e).fill(" ").join("");var eD=({useDefaultSentences:e=!1,lang:t="en",sentence:n,sentences:r})=>{var i;const[o,a]=(0,c.useState)(0),[l,u]=(0,c.useState)((null===(i=null==r?void 0:r[t])||void 0===i?void 0:i.length)?`${r[t][0].text.endsWith("...")||!r[t][0].text.length?r[t][0].text:`${r[t][0].text}...`}${ZO(r[t][0].delayAfter)}`:n?`${n.endsWith("...")||!n.length?n:`${n}...`}${ZO()}`:""),[d,h]=(0,c.useState)("");return(0,c.useEffect)((()=>{const i=setInterval((()=>{var i;const s=l[d.length];if(void 0!==s&&l.length>0)h((e=>e+s));else if((null===(i=null==r?void 0:r[t])||void 0===i?void 0:i.length)&&o<r[t].length-1){const e=o+1,n=r[t][e];u(`${n.text.endsWith("...")||!n.text.length?n.text:`${n.text}...`}${ZO(n.delayAfter)}`),h(""),a(e)}else if(!r&&!n&&e){const e=QO[t][Math.floor(Math.random()*QO[t].length)];u(`${e.text}${ZO(e.delayAfter)}`),h("")}}),50);return()=>clearInterval(i)})),(0,s.jsx)("div",{className:"memori-chat--bubble",children:(0,s.jsxs)("div",{className:"memori-chat--bubble-typing",children:[(0,s.jsxs)("div",{id:"wave",children:[(0,s.jsx)("span",{className:"dot"}),(0,s.jsx)("span",{className:"dot"}),(0,s.jsx)("span",{className:"dot"})]}),l.length>0&&(0,s.jsx)("p",{children:d})]})})};var tD=(0,c.memo)((({memori:e,tenant:n,sessionID:r,baseUrl:i,apiUrl:o,translateTo:a,memoriTyping:l,typingText:u,showTypingText:d=!1,history:h=[],authToken:p,dialogState:m,simulateUserPrompt:f,showDates:g=!1,showContextPerLine:v=!1,showAIicon:y=!0,showWhyThisAnswer:S=!0,showCopyButton:_=!0,showTranslationOriginal:b=!1,preview:x=!1,instruct:w=!1,showInputs:C=!0,showMicrophone:A=!1,microphoneMode:E="HOLD_TO_TALK",sendOnEnter:T,setSendOnEnter:I,attachmentsMenuOpen:M,setAttachmentsMenuOpen:R,userMessage:P="",onChangeUserMessage:N,sendMessage:O,listening:D,setEnableFocusChatInput:k,isPlayingAudio:L,stopAudio:B,startListening:z,stopListening:F,resetTranscript:U,customMediaRenderer:j,user:G,userAvatar:H,showUpload:V=!1,experts:W,useMathFormatting:q=!1})=>{var J,K,Y,$,X,Q,Z;const ee=()=>{setTimeout((()=>{var e,t;let n=document.querySelectorAll(".memori-chat--bubble-container.memori-chat--bubble-from-user");null===(t=null===(e=n[n.length-1])||void 0===e?void 0:e.scrollIntoView)||void 0===t||t.call(e)}),200)};(0,c.useEffect)((()=>{!x&&ee()}),[h,x]);return(0,s.jsxs)("div",{className:t(Cs)("memori-chat--wrapper",{"memori-chat-wrapper--translate":a}),id:"chat-wrapper",lang:null==a?void 0:a.toUpperCase(),"data-memori-lang":null!==($=null===(Y=null===(K=null===(J=e.culture)||void 0===J?void 0:J.split("-"))||void 0===K?void 0:K[0])||void 0===Y?void 0:Y.toUpperCase())&&void 0!==$?$:"EN",children:[(0,s.jsx)("div",{className:t(Cs)("memori-chat--history",{"memori-chat--history-touch":nR()}),children:(0,s.jsxs)("div",{className:t(Cs)("memori-chat--content",{"memori-chat--content-touch":nR()}),children:[(0,s.jsx)("div",{className:t(Cs)("memori-chat--cover"),style:{backgroundImage:`url("${AN({type:"cover",tenantID:null==n?void 0:n.id,resourceURI:e.coverURL,baseURL:i,apiURL:o})}"), url("${AN({type:"cover",tenantID:null==n?void 0:n.id,baseURL:i||"https://www.aisuru.com",apiURL:o})}")`}}),h.map(((l,u)=>{var d,p,x,w;return(0,s.jsxs)(t(c).Fragment,{children:[(0,s.jsx)(LO,{isFirst:0===u,message:l,memori:e,tenant:n,baseUrl:i,apiUrl:o,sessionID:r,simulateUserPrompt:f,showAIicon:y,showWhyThisAnswer:S,showTranslationOriginal:b,showFeedback:u===h.length-1&&!l.fromUser&&(null==m?void 0:m.acceptsFeedback),user:G,userAvatar:H,experts:W,showCopyButton:_,useMathFormatting:q}),g&&!!l.timestamp&&(0,s.jsx)("small",{className:"memori-chat--timestamp "+(l.fromUser?"text-right":"text-left"),children:new Intl.DateTimeFormat("it",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(l.timestamp.endsWith("Z")?l.timestamp:`${l.timestamp}Z`))}),v&&!!Object.keys(null!==(d=l.contextVars)&&void 0!==d?d:{}).length&&(0,s.jsx)("div",{className:"memori-chat--context-vars",children:Object.keys(null!==(p=l.contextVars)&&void 0!==p?p:{}).map((e=>{var t,n,r;return"-"===(null===(t=l.contextVars)||void 0===t?void 0:t[e])?(0,s.jsx)("div",{className:"memori-chat--context-tag memori-chat--context-tag-canceled",children:(0,s.jsx)("span",{className:"memori-chat--context-tag-text",children:e})},e):"✔️"===(null===(n=l.contextVars)||void 0===n?void 0:n[e])?(0,s.jsx)("div",{className:"memori-chat--context-tag",children:(0,s.jsx)("span",{className:"memori-chat--context-tag-text",children:e})},e):(0,s.jsx)("div",{className:"memori-chat--context-tag",children:(0,s.jsxs)("span",{className:"memori-chat--context-tag-text",children:[e,": ",null===(r=l.contextVars)||void 0===r?void 0:r[e]]})},e)}))}),(0,s.jsx)(TO,{simulateUserPrompt:f,media:null===(x=null==l?void 0:l.media)||void 0===x?void 0:x.filter((e=>"text/html"!==e.mimeType&&"text/plain"!==e.mimeType)),links:null===(w=null==l?void 0:l.media)||void 0===w?void 0:w.filter((e=>"text/html"===e.mimeType)),sessionID:r,baseUrl:i,apiUrl:o,translateTo:a,customMediaRenderer:j})]},u)})),(null==m?void 0:m.hints)&&m.hints.length>0&&!l&&(0,s.jsx)(TO,{simulateUserPrompt:f,hints:m.translatedHints?m.translatedHints:m.hints.map((e=>({text:e,originalText:e})))}),!!l&&(0,s.jsx)(eD,{useDefaultSentences:d,lang:a?"it"===a.toLowerCase()?"it":"en":"it"===(null===(Z=null===(Q=null===(X=e.culture)||void 0===X?void 0:X.split("-"))||void 0===Q?void 0:Q[0])||void 0===Z?void 0:Z.toLowerCase())?"it":"en",sentence:u,sentences:e.enableBoardOfExperts?uO:void 0},u),(0,s.jsx)("div",{id:"end-messages-ref"})]})}),C&&(0,s.jsx)(XO,{resetTranscript:U,userMessage:P,onChangeUserMessage:N,dialogState:m,instruct:w,authToken:p,sendMessage:O,microphoneMode:E,sendOnEnter:T,setSendOnEnter:I,showUpload:V,attachmentsMenuOpen:M,setAttachmentsMenuOpen:R,onTextareaFocus:()=>{var e,t,n,r;F();const i=nR();i&&k(!0),i&&window.innerWidth<=768&&(null===(t=null===(e=document.getElementById("chat-wrapper"))||void 0===e?void 0:e.classList)||void 0===t||t.add("chat-focused"),null===(r=null===(n=document.querySelector(".memori.memori-widget"))||void 0===n?void 0:n.classList)||void 0===r||r.add("chat-focused"),setTimeout((()=>{ee()}),300))},onTextareaBlur:()=>{var e,t,n,r,i;(null===(t=null===(e=document.getElementById("chat-wrapper"))||void 0===e?void 0:e.classList)||void 0===t?void 0:t.contains("chat-focused"))&&(null===(n=document.getElementById("chat-wrapper"))||void 0===n||n.classList.remove("chat-focused"),null===(i=null===(r=document.querySelector(".memori.memori-widget"))||void 0===r?void 0:r.classList)||void 0===i||i.remove("chat-focused"),ee())},startListening:z,stopListening:F,stopAudio:B,listening:D,isPlayingAudio:L,showMicrophone:A})]})}));c=o("85Hg2");var nD=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"})});var rD=({memoriName:e,blockedUntil:t,notEnoughCredits:n=!1,showGiverInfo:r=!1,showTitle:i=!1,marginLeft:o=!1})=>{const{t:a}=Ce(),l=new Date(t||Date.now());return n||l>new Date(Date.now())?(0,s.jsx)(MN,{className:"blocked-memori-badge--tooltip",content:n?(0,s.jsx)(s.Fragment,{children:a("notEnoughCredits")}):(0,s.jsxs)(s.Fragment,{children:[!r&&a("memoriBlockedAnon",{name:e,date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(l)}),r&&a("memoriBlockedUntil",{date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(l)}),r&&` ${a("memoriBlockedReasonExceedChats")}`,r&&(0,s.jsx)("br",{}),r&&`\n${a("memoriBlockedGiverHelper")}`]}),children:(0,s.jsxs)("div",{className:"blocked-memori-badge--wrapper",children:[(0,s.jsx)("div",{className:"blocked-memori-badge "+(o?" margin-left":""),children:(0,s.jsx)(nD,{className:"blocked-memori-badge--icon"})}),i&&(0,s.jsx)("span",{className:"blocked-memori-badge--title",children:a("memoriBlockedTitle")})]})}):null};var iD=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",width:"20",height:"16",viewBox:"0 0 640 512",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M211.2 96a64 64 0 10-128 0 64 64 0 10128 0zM32 256c0 17.7 14.3 32 32 32h85.6c10.1-39.4 38.6-71.5 75.8-86.6-9.7-6-21.2-9.4-33.4-9.4H96c-35.3 0-64 28.7-64 64zm461.6 32H576c17.7 0 32-14.3 32-32 0-35.3-28.7-64-64-64h-96c-11.7 0-22.7 3.1-32.1 8.6 38.1 14.8 67.4 47.3 77.7 87.4zm-102.4-61.6c-6.9-1.6-14.2-2.4-21.6-2.4h-96c-8.5 0-16.7 1.1-24.5 3.1-30.8 8.1-55.6 31.1-66.1 60.9-3.5 10-5.5 20.8-5.5 32 0 17.7 14.3 32 32 32h224c17.7 0 32-14.3 32-32 0-11.2-1.9-22-5.5-32-10.8-30.7-36.8-54.2-68.9-61.6zM563.2 96a64 64 0 10-128 0 64 64 0 10128 0zm-241.6 96a80 80 0 100-160 80 80 0 100 160zM32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32h576c17.7 0 32-14.3 32-32s-14.3-32-32-32H32z"})});var oD=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",width:"20",height:"20",viewBox:"0 0 48 48",className:e,"aria-label":t,children:[(0,s.jsx)("path",{d:"M30.106 48v-2.745a2.213 2.213 0 012.213-2.212h6.11a2.392 2.392 0 002.326-2.466v-3.223a1.834 1.834 0 01.459-1.145 2.912 2.912 0 00.712-1.926l-.007-.667a1.016 1.016 0 01.651-.952h1.067a1.363 1.363 0 001.051-.456 1.304 1.304 0 00.19-1.395 67.032 67.032 0 01-3.037-7.51 4.767 4.767 0 01-.217-1.507l-.002-4.994a14.513 14.513 0 00-.552-3.963l-.006-.022a13.959 13.959 0 00-3.137-5.702q-.479-.516-1.006-1.003a17.67 17.67 0 00-.677-.623A18.303 18.303 0 0024.194 1a19.617 19.617 0 00-12.539 4.489 17.555 17.555 0 00-3.945 21.69C9.945 31.507 11.694 38.622 12.14 46v2",strokeMiterlimit:10}),(0,s.jsx)("path",{d:"M27.917 12L31.417 12"}),(0,s.jsx)("path",{d:"M27.917 26L31.417 26"}),(0,s.jsx)("path",{d:"M29.667 12L29.667 26"}),(0,s.jsx)("path",{d:"M23.992 26L19.904 12 19.226 12 15.159 26"}),(0,s.jsx)("path",{d:"M16.854 21.133L22.276 21.133"})]});c=o("85Hg2");const sD={OpenAI:{statusUrl:"https://status.openai.com/api/v2/summary.json",statusPage:"https://status.openai.com/"},Mistral:{statusUrl:"https://status.mistral-data.com/api/v2/summary.json",statusPage:"https://status.mistral-data.com/"},Anthropic:{statusUrl:"https://status.anthropic.com/api/v2/summary.json",statusPage:"https://status.anthropic.com/"}};var aD=({forceStatus:e,provider:t="OpenAI"})=>{const{t:n}=Ce(),[r,i]=(0,c.useState)(null!=e?e:"operational"),[o,a]=(0,c.useState)(!1),l=sD[t],u=(0,c.useCallback)((async()=>l?(async e=>{var t,n;try{const r=await fetch(e);if(!r.ok)return console.warn(`Status API returned ${r.status}`),"operational";const i=null===(t=(await r.json()).components)||void 0===t?void 0:t.find((e=>"API"===e.name));return null!==(n=null==i?void 0:i.status)&&void 0!==n?n:"operational"}catch(e){return console.error("Error fetching provider status:",e),"operational"}})(l.statusUrl):"operational"),[l]);return(0,c.useEffect)((()=>{let t=!0;const n=new AbortController;return(async()=>{if(!e){a(!0);try{const e=await u();t&&i(e)}catch(e){console.error("Failed to check status:",e),t&&i("operational")}finally{t&&a(!1)}}})(),()=>{t=!1,n.abort()}}),[e,u]),o?(0,s.jsx)("div",{className:"memori--completion-provider-status--loading",children:(0,s.jsx)(Am,{spinning:!0})}):r&&"operational"!==r?(0,s.jsx)(MN,{className:"memori--completion-provider-status--tooltip",align:"topLeft",content:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:n("completionProviderDown",{provider:null!=t?t:n("completionProviderFallbackName")})}),(null==l?void 0:l.statusPage)&&(0,s.jsx)("p",{children:(0,s.jsx)("a",{href:l.statusPage,rel:"noopener noreferrer",target:"_blank",children:n("completionProviderCheckStatusPage")})})]}),children:(0,s.jsx)(nD,{className:"memori--completion-provider-status--icon"})}):null};var lD=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",className:e,"aria-label":t,children:(0,s.jsx)("path",{fill:"currentColor",d:"M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"})});var cD=({memori:e,tenant:t,language:n,userLang:r,setUserLang:i,baseUrl:o,apiUrl:a,position:l,openPositionDrawer:u,instruct:d=!1,hasInitialSession:h=!1,clickedStart:p,onClickStart:m,initializeTTS:f,_TEST_forceProviderStatus:g,isUserLoggedIn:v=!1,user:y,showLogin:S=!1,setShowLoginDrawer:_,notEnoughCredits:b=!1,isMultilanguageEnabled:x})=>{var w,C;const{t:A,i18n:E}=Ce(),[T,I]=(0,c.useState)(e.description),[M,R]=(0,c.useState)(!0);return(0,c.useEffect)((()=>{var t,r,i,s,a,l;(null!==(r=null===(t=E.language)||void 0===t?void 0:t.toUpperCase())&&void 0!==r?r:"IT")===(null!==(i=null==n?void 0:n.toUpperCase())&&void 0!==i?i:"IT")&&T===e.description||!(null===(s=e.description)||void 0===s?void 0:s.length)||SO(e.description,null!==(l=null===(a=E.language)||void 0===a?void 0:a.toUpperCase())&&void 0!==l?l:"IT",n,o).then((e=>{I(e.text)})).catch(console.error)}),[E.language,n,e.description,o]),(0,s.jsxs)("div",{className:"memori--start-panel",children:[(0,s.jsxs)("div",{className:"memori--cover",style:{backgroundImage:`url("${AN({type:"cover",tenantID:null==t?void 0:t.id,resourceURI:e.coverURL,baseURL:o,apiURL:a})}"), url("${AN({type:"cover",tenantID:null==t?void 0:t.id,baseURL:o,apiURL:a})}")`},children:[!!e.enableCompletions&&!e.enableBoardOfExperts&&(0,s.jsx)("div",{className:"memori--completions-enabled",children:(0,s.jsx)(MN,{align:"left",content:A("completionsEnabled"),children:(0,s.jsx)("span",{"aria-label":A("completionsEnabled")||"Completions",children:(0,s.jsx)(TN,{})})})}),!!e.enableBoardOfExperts&&(0,s.jsx)("div",{className:"memori--board-of-experts",children:(0,s.jsx)(MN,{align:"left",content:A("boardOfExperts"),children:(0,s.jsx)("span",{"aria-label":A("boardOfExperts")||"Board of Experts",children:(0,s.jsx)(iD,{})})})}),!!e.nsfw&&(0,s.jsx)("div",{className:"memori--nsfw",children:(0,s.jsx)(MN,{align:"left",content:A("nsfw"),children:(0,s.jsx)("span",{title:A("nsfw")||"NSFW",children:"🔞"})})})]}),(0,s.jsxs)("picture",{className:"memori--avatar",children:[(0,s.jsx)("source",{src:null!==(w=e.avatarURL)&&void 0!==w?w:AN({type:"avatar",tenantID:null==t?void 0:t.id,resourceURI:e.avatarURL,baseURL:o,apiURL:a})}),(0,s.jsx)("img",{alt:e.name,src:e.avatarURL&&e.avatarURL.length>0?AN({type:"avatar",tenantID:null==t?void 0:t.id,resourceURI:e.avatarURL,baseURL:o,apiURL:a}):AN({type:"avatar",tenantID:null==t?void 0:t.id,baseURL:o,apiURL:a})})]}),(0,s.jsx)("h2",{className:"memori--title",children:e.name}),e.needsPosition&&!l&&(0,s.jsxs)("div",{className:"memori--needsPosition",children:[(0,s.jsx)("p",{children:A("write_and_speak.requirePositionHelp",{name:e.name})}),(0,s.jsx)(Em,{primary:!0,onClick:()=>u(),className:"memori--start-button",icon:(0,s.jsx)(lD,{}),children:A("widget.position")})]}),(e.needsPosition&&l||!e.needsPosition)&&(0,s.jsxs)("div",{className:"memori--description",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"memori--description-text",children:T&&M?T:e.description}),T!==e.description&&(0,s.jsx)(Em,{ghost:!0,className:"memori--translation-toggle",icon:(0,s.jsx)(IN,{}),onClick:()=>{R((e=>!e))},children:A(M?"showOriginalText":"showTranslatedText")})]}),x&&!d&&(0,s.jsxs)("div",{className:"memori--language-chooser",children:[(0,s.jsx)("label",{id:"user-lang-pref-label",htmlFor:"user-lang-pref",children:A("write_and_speak.iWantToTalkToIn",{name:e.name})}),(0,s.jsx)("select",{id:"user-lang-pref",className:"memori-select--button",value:(null!=r?r:E.language).toUpperCase(),"aria-labelledby":"user-lang-pref-label",onChange:e=>{i(e.target.value)},children:oO.map((e=>(0,s.jsx)("option",{value:e.value,"aria-label":e.label,children:e.label},e.value)))})]}),(0,s.jsx)(Em,{primary:!0,disabled:!!e.blockedUntil&&!e.isGiver||b,loading:p,onClick:e=>{try{window.speechSynthesis.speak(new SpeechSynthesisUtterance(""))}catch(e){console.error(e)}f&&f(),m&&m()},className:"memori--start-button",children:A("write_and_speak."+(d?"instructButton":h?"resumeButton":"tryMeButton"))}),(0,s.jsx)(aD,{provider:null===(C=null==e?void 0:e.completionConfigForQuestionAnswering)||void 0===C?void 0:C.provider,forceStatus:g}),(0,s.jsx)("p",{className:"memori--start-description",children:A(d?"write_and_speak.pageInstructExplanation":"write_and_speak.pageTryMeExplanation")}),(e.blockedUntil||b)&&(0,s.jsx)(rD,{memoriName:e.name,blockedUntil:e.blockedUntil,notEnoughCredits:b,showGiverInfo:e.isGiver,showTitle:!0,marginLeft:!0}),!!e.enableDeepThought&&!d&&(0,s.jsxs)("div",{className:"memori--deep-thought-disclaimer",children:[(0,s.jsx)(MN,{align:"left",content:A("deepThoughtHelper"),children:(0,s.jsx)(oD,{})}),(0,s.jsx)("h2",{children:v&&(null==y?void 0:y.pAndCUAccepted)?A("deepThoughtDisclaimerTitle"):A("deepThought")}),v&&!(null==y?void 0:y.pAndCUAccepted)&&(0,s.jsx)("p",{children:A("deepThoughtPreDisclaimerNotAllowed")}),!v&&(0,s.jsx)("p",{children:A("deepThoughtPreDisclaimerUnlogged")}),!v&&S&&(0,s.jsx)("p",{children:(0,s.jsx)(Em,{outlined:!0,padded:!1,onClick:()=>_(!0),children:"Login"})}),(0,s.jsx)("p",{className:"memori--deep-thought-disclaimer-text",children:A("deepThoughtDisclaimer")})]})]})]})},uD=(c=o("85Hg2"),c=o("85Hg2"),ee=o("hcaHr"),{}),dD={};(dD=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}).__esModule=!0,dD.default=dD,(uD=function(e,t){if(null==e)return{};var n,r,i=dD(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}).__esModule=!0,uD.default=uD;c=o("85Hg2");var hD=["forwardedRef"];function pD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function mD(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?pD(Object(r),!0).forEach((function(n){t(te)(e,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pD(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class fD extends c.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){console.error("Uncaught error:",e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,s.jsxs)("div",{style:{background:"rgba(255, 255, 255, 0.4)",color:"#000",padding:"2rem",borderRadius:"10px"},children:[(0,s.jsx)("h2",{children:this.props.t("error.generic")}),(0,s.jsx)(Em,{primary:!0,onClick:()=>this.setState({hasError:!1}),children:this.props.t("error.tryAgain")||"Try again"})]}):this.props.children}}var gD=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){function i(i){var o=i.forwardedRef,s=t(uD)(i,hD),a=Ce(e,mD(mD({},s),{},{keyPrefix:n.keyPrefix})),l=t(ee)(a,3),u=l[0],d=l[1],h=l[2],p=mD(mD({},s),{},{t:u,i18n:d,tReady:h});return n.withRef&&o?p.ref=o:!n.withRef&&o&&(p.forwardedRef=o),(0,c.createElement)(r,p)}i.displayName="withI18nextTranslation(".concat(_e(r),")"),i.WrappedComponent=r;return n.withRef?(0,c.forwardRef)((function(e,t){return(0,c.createElement)(i,Object.assign({},e,{forwardedRef:t}))})):i}}(["common"])(fD);var vD=({avatar:e,speaking:n=!1})=>(0,s.jsxs)("div",{className:t(Cs)("memori-blob",{"memori-blob--speaking":n}),children:[e&&(0,s.jsx)("figure",{children:(0,s.jsx)("img",{src:e,alt:"",role:"presentation"})}),(0,s.jsx)("div",{className:"mainDiv"}),(0,s.jsx)("div",{className:"mainDiv"}),(0,s.jsx)("div",{className:"mainDiv"}),(0,s.jsx)("div",{className:"mainDiv"}),(0,s.jsx)("div",{className:"mainDiv"})]});var yD=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"})});var SD=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:[(0,s.jsx)("path",{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}),(0,s.jsx)("path",{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"})]});var _D=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"})}),bD=(c=o("85Hg2"),c=o("85Hg2"),c=o("85Hg2"),{});Object.defineProperty(bD,"__esModule",{value:!0});c=o("85Hg2");function xD(e){var t,n=new Set,r=function(e,r){var i="function"==typeof e?e(t):e;if(i!==t){var o=t;t=r?i:Object.assign({},t,i),n.forEach((function(e){return e(t,o)}))}},i=function(){return t},o={setState:r,getState:i,subscribe:function(e,r,o){return r||o?function(e,r,o){void 0===r&&(r=i),void 0===o&&(o=Object.is),console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");var s=r(t);function a(){var n=r(t);if(!o(s,n)){var i=s;e(s=n,i)}}return n.add(a),function(){return n.delete(a)}}(e,r,o):(n.add(e),function(){return n.delete(e)})},destroy:function(){return n.clear()}};return t=e(r,i,o),o}var wD="undefined"==typeof window||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?c.useEffect:c.useLayoutEffect;bD.default=function(e){var t="function"==typeof e?xD(e):e,n=function(e,n){void 0===e&&(e=t.getState),void 0===n&&(n=Object.is);var r,i=c.useReducer((function(e){return e+1}),0)[1],o=t.getState(),s=c.useRef(o),a=c.useRef(e),l=c.useRef(n),u=c.useRef(!1),d=c.useRef();void 0===d.current&&(d.current=e(o));var h=!1;(s.current!==o||a.current!==e||l.current!==n||u.current)&&(r=e(o),h=!n(d.current,r)),wD((function(){h&&(d.current=r),s.current=o,a.current=e,l.current=n,u.current=!1}));var p=c.useRef(o);wD((function(){var e=function(){try{var e=t.getState(),n=a.current(e);l.current(d.current,n)||(s.current=e,d.current=n,i())}catch(e){u.current=!0,i()}},n=t.subscribe(e);return t.getState()!==p.current&&e(),n}),[]);var m=h?r:d.current;return c.useDebugValue(m),m};return Object.assign(n,t),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");var e=[n,t];return{next:function(){var t=e.length<=0;return{value:e.shift(),done:t}}}},n};var CD;CD=o("YtP34");var AD,ED=o("kMsGZ");AD=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var s=o[i];if(!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n};const TD=[];function ID(e,n,r,i=0,o=!1){for(const e of n)if(t(AD)(r,e.args)){if(o)return;if(e.error)throw e.error;if(e.response)return e.response;throw e.promise}const s={args:r,promise:e(...r).then((e=>s.response=null==e||e)).catch((e=>s.error=null!=e?e:"unknown error")).then((()=>{i>0&&setTimeout((()=>{const e=n.indexOf(s);-1!==e&&n.splice(e,1)}),i)}))};if(n.push(s),!o)throw s.promise}function MD(e,...n){if(void 0===n||0===n.length)e.splice(0,e.length);else{const r=e.find((e=>t(AD)(n,e.args)));if(r){const t=e.indexOf(r);-1!==t&&e.splice(t,1)}}}function RD(e,...t){return ID(e,TD,t,RD.lifespan)}RD.lifespan=0,RD.clear=(...e)=>MD(TD,...e),RD.preload=(e,...t)=>{ID(e,TD,t,RD.lifespan,!0)},RD.peek=(...e)=>{var n;return null==(n=TD.find((n=>t(AD)(e,n.args))))?void 0:n.response};var PD,ND=function(e){return function(t){e.forEach((function(e){"function"==typeof e?e(t):null!=e&&(e.current=t)}))}};c=o("85Hg2");function OD(e,t,n){var r,i,o,s,a;function l(){var c=Date.now()-s;c<t&&c>=0?r=setTimeout(l,t-c):(r=null,n||(a=e.apply(o,i),o=i=null))}null==t&&(t=100);var c=function(){o=this,i=arguments,s=Date.now();var c=n&&!r;return r||(r=setTimeout(l,t)),c&&(a=e.apply(o,i),o=i=null),a};return c.clear=function(){r&&(clearTimeout(r),r=null)},c.flush=function(){r&&(a=e.apply(o,i),o=i=null,clearTimeout(r),r=null)},c}function DD(e){let{debounce:n,scroll:r,polyfill:i,offsetSize:o}=void 0===e?{debounce:0,scroll:!1,offsetSize:!1}:e;const s=i||("undefined"==typeof window?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,l]=(0,c.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),u=(0,c.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a}),d=n?"number"==typeof n?n:n.scroll:null,h=n?"number"==typeof n?n:n.resize:null,p=(0,c.useRef)(!1);(0,c.useEffect)((()=>(p.current=!0,()=>{p.current=!1})));const[m,f,g]=(0,c.useMemo)((()=>{const e=()=>{if(!u.current.element)return;const{left:e,top:t,width:n,height:r,bottom:i,right:s,x:a,y:c}=u.current.element.getBoundingClientRect(),d={left:e,top:t,width:n,height:r,bottom:i,right:s,x:a,y:c};u.current.element instanceof HTMLElement&&o&&(d.height=u.current.element.offsetHeight,d.width=u.current.element.offsetWidth),Object.freeze(d),p.current&&!BD(u.current.lastBounds,d)&&l(u.current.lastBounds=d)};return[e,h?t(PD)(e,h):e,d?t(PD)(e,d):e]}),[l,o,d,h]);function v(){u.current.scrollContainers&&(u.current.scrollContainers.forEach((e=>e.removeEventListener("scroll",g,!0))),u.current.scrollContainers=null),u.current.resizeObserver&&(u.current.resizeObserver.disconnect(),u.current.resizeObserver=null)}function y(){u.current.element&&(u.current.resizeObserver=new s(g),u.current.resizeObserver.observe(u.current.element),r&&u.current.scrollContainers&&u.current.scrollContainers.forEach((e=>e.addEventListener("scroll",g,{capture:!0,passive:!0}))))}var S,_,b;return S=g,_=Boolean(r),(0,c.useEffect)((()=>{if(_){const e=S;return window.addEventListener("scroll",e,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",e,!0)}}}),[S,_]),b=f,(0,c.useEffect)((()=>{const e=b;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[b]),(0,c.useEffect)((()=>{v(),y()}),[r,g,f]),(0,c.useEffect)((()=>v),[]),[e=>{e&&e!==u.current.element&&(v(),u.current.element=e,u.current.scrollContainers=kD(e),y())},a,m]}function kD(e){const t=[];if(!e||e===document.body)return t;const{overflow:n,overflowX:r,overflowY:i}=window.getComputedStyle(e);return[n,r,i].some((e=>"auto"===e||"scroll"===e))&&t.push(e),[...t,...kD(e.parentElement)]}OD.debounce=OD,PD=OD;const LD=["x","y","top","bottom","left","right","width","height"],BD=(e,t)=>LD.every((n=>e[n]===t[n]));const zD={obj:e=>e===Object(e)&&!zD.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e,arr:e=>Array.isArray(e),equ(e,t){if(typeof e!=typeof t||!!e!=!!t)return!1;if(zD.str(e)||zD.num(e)||zD.obj(e))return e===t;if(zD.arr(e)&&e==t)return!0;let n;for(n in e)if(!(n in t))return!1;for(n in t)if(e[n]!==t[n])return!1;return!zD.und(n)||e===t}};function FD(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function UD(e,t,n,r){const i=n.get(t);i&&(n.delete(t),0===n.size&&(e.delete(r),i.target.releasePointerCapture(r)))}function jD(e){const t=new tf.Vector3;function n(e){return e.filter((e=>["Move","Over","Enter","Out","Leave"].some((t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))))}function r(t){const{internal:n}=e.getState();Array.from(n.hovered.values()).forEach((e=>{if(!t.length||!t.find((t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId))){const r=e.eventObject.__r3f,i=null==r?void 0:r.handlers;if(n.hovered.delete(FD(e)),null!=r&&r.eventCount){const n={...e,intersections:t||[]};null==i.onPointerOut||i.onPointerOut(n),null==i.onPointerLeave||i.onPointerLeave(n)}}}))}function i(e,t){t.forEach((t=>{var n;return null==(n=t.__r3f)||null==n.handlers.onPointerMissed?void 0:n.handlers.onPointerMissed(e)}))}return{handlePointer:o=>{switch(o){case"onPointerLeave":case"onPointerCancel":return()=>r([]);case"onLostPointerCapture":return t=>{const{internal:n}=e.getState();"pointerId"in t&&!n.capturedMap.has(t.pointerId)&&(n.capturedMap.delete(t.pointerId),r([]))}}return s=>{const{onPointerMissed:a,internal:l}=e.getState();!function(t){var n;const r=e.getState(),{raycaster:i,mouse:o,camera:s,size:a}=r,{offsetX:l,offsetY:c}=null!=(n=null==i.computeOffsets?void 0:i.computeOffsets(t,r))?n:t,{width:u,height:d}=a;o.set(l/u*2-1,-c/d*2+1),i.setFromCamera(o,s)}(s),l.lastEvent.current=s;const c="onPointerMove"===o,u="onClick"===o||"onContextMenu"===o||"onDoubleClick"===o,d=function(t,n){const{internal:r}=e.getState();if("pointerId"in n&&r.capturedMap.has(n.pointerId))for(let e of r.capturedMap.get(n.pointerId).values())t.push(e.intersection);return t}(function(t){const n=e.getState(),{raycaster:r,internal:i}=n;if(!r.enabled)return[];const o=new Set,s=[],a=t?t(i.interaction):i.interaction;let l=r.intersectObjects(a,!0).filter((e=>{const t=FD(e);return!o.has(t)&&(o.add(t),!0)}));r.filter&&(l=r.filter(l,n));for(const e of l){let t=e.object;for(;t;){var c;null!=(c=t.__r3f)&&c.eventCount&&s.push({...e,eventObject:t}),t=t.parent}}return s}(c?n:void 0),s),h=u?function(t){const{internal:n}=e.getState(),r=t.offsetX-n.initialClick[0],i=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(r*r+i*i))}(s):0;"onPointerDown"===o&&(l.initialClick=[s.offsetX,s.offsetY],l.initialHits=d.map((e=>e.eventObject))),u&&!d.length&&h<=2&&(i(s,l.interaction),a&&a(s)),c&&r(d),function(n,i,o,s){const{raycaster:a,mouse:l,camera:c,internal:u}=e.getState();if(n.length){const e=t.set(l.x,l.y,0).unproject(c),d={stopped:!1};for(const t of n){const h=e=>{var n,r;return null!=(n=null==(r=u.capturedMap.get(e))?void 0:r.has(t.eventObject))&&n},p=e=>{const n={intersection:t,target:i.target};u.capturedMap.has(e)?u.capturedMap.get(e).set(t.eventObject,n):u.capturedMap.set(e,new Map([[t.eventObject,n]])),i.target.setPointerCapture(e)},m=e=>{const n=u.capturedMap.get(e);n&&UD(u.capturedMap,t.eventObject,n,e)};let f={};for(let e in i){let t=i[e];"function"!=typeof t&&(f[e]=t)}let g={...t,...f,spaceX:l.x,spaceY:l.y,intersections:n,stopped:d.stopped,delta:o,unprojectedPoint:e,ray:a.ray,camera:c,stopPropagation:()=>{const e="pointerId"in i&&u.capturedMap.get(i.pointerId);(!e||e.has(t.eventObject))&&(g.stopped=d.stopped=!0,u.hovered.size&&Array.from(u.hovered.values()).find((e=>e.eventObject===t.eventObject)))&&r([...n.slice(0,n.indexOf(t)),t])},target:{hasPointerCapture:h,setPointerCapture:p,releasePointerCapture:m},currentTarget:{hasPointerCapture:h,setPointerCapture:p,releasePointerCapture:m},sourceEvent:i,nativeEvent:i};if(s(g),!0===d.stopped)break}}}(d,s,h,(e=>{const t=e.eventObject,n=t.__r3f,r=null==n?void 0:n.handlers;if(null!=n&&n.eventCount)if(c){if(r.onPointerOver||r.onPointerEnter||r.onPointerOut||r.onPointerLeave){const t=FD(e),n=l.hovered.get(t);n?n.stopped&&e.stopPropagation():(l.hovered.set(t,e),null==r.onPointerOver||r.onPointerOver(e),null==r.onPointerEnter||r.onPointerEnter(e))}null==r.onPointerMove||r.onPointerMove(e)}else{const n=r[o];n?u&&!l.initialHits.includes(t)||(i(s,l.interaction.filter((e=>!l.initialHits.includes(e)))),n(e)):u&&l.initialHits.includes(t)&&i(s,l.interaction.filter((e=>!l.initialHits.includes(e))))}}))}}}}const GD=e=>e&&!!e.getState,HD=(e,t)=>{var n,r;return{root:GD(e)?e:null!=(n=null==(r=e.__r3f)?void 0:r.root)?n:t.__r3f.root,container:GD(e)?e.getState().scene:e}},VD="__default",WD={};let qD={};function JD(e,t){const n=e;return(null!=t&&t.primitive||!n.__r3f)&&(n.__r3f={root:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...t}),e}const KD=e=>e&&e.isOrthographicCamera;function YD(e){return Array.isArray(e)?Math.min(Math.max(e[0],window.devicePixelRatio),e[1]):e}const $D=c.createContext(null);let XD,QD=[],ZD=[],ek=[];function tk(e,t){for(XD=0;XD<e.length;XD++)e[XD](t)}function nk(e,t){let n=t.clock.getDelta();for("never"===t.frameloop&&"number"==typeof e&&(n=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),XD=0;XD<t.internal.subscribers.length;XD++)t.internal.subscribers[XD].ref.current(t,n);return!t.internal.priority&&t.gl.render&&t.gl.render(t.scene,t.camera),t.internal.frames=Math.max(0,t.internal.frames-1),"always"===t.frameloop?1:t.internal.frames}function rk(e){const{handlePointer:t}=jD(e),n={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};return{connected:!1,handlers:Object.keys(n).reduce(((e,n)=>({...e,[n]:t(n)})),{}),connect:t=>{var r;const{set:i,events:o}=e.getState();null==o.disconnect||o.disconnect(),i((e=>({events:{...e.events,connected:t}}))),Object.entries(null!=(r=null==o?void 0:o.handlers)?r:[]).forEach((([e,r])=>{const[i,o]=n[e];t.addEventListener(i,r,{passive:o})}))},disconnect:()=>{const{set:t,events:r}=e.getState();var i;r.connected&&(Object.entries(null!=(i=r.handlers)?i:[]).forEach((([e,t])=>{if(r&&r.connected instanceof HTMLElement){const[i]=n[e];r.connected.removeEventListener(i,t)}})),t((e=>({events:{...e.events,connected:!1}}))))}}}const ik="undefined"!=typeof window?c.useLayoutEffect:c.useEffect;function ok({set:e}){return ik((()=>(e(new Promise((()=>null))),()=>e(!1))),[]),null}class sk extends c.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}sk.getDerivedStateFromError=()=>({error:!0});const ak=c.forwardRef((function({children:e,fallback:n,tabIndex:r,resize:i,id:o,style:s,className:a,events:l,...u},d){const[h,{width:p,height:m}]=DD({scroll:!0,debounce:{scroll:50,resize:0},...i}),f=c.useRef(null),[g,v]=c.useState(!1),[y,S]=c.useState(!1);if(g)throw g;if(y)throw y;return ik((()=>{p>0&&m>0&&function(e,n,{gl:r,size:i,mode:o=fk[1],events:s,onCreated:a,...l}={}){var u,d,h,p,m;i||(i={width:null!=(d=null==(h=n.parentElement)?void 0:h.clientWidth)?d:0,height:null!=(p=null==(m=n.parentElement)?void 0:m.clientHeight)?p:0});let f=mk.get(n),g=null==f?void 0:f.fiber,v=null==f?void 0:f.store,y=null==(u=v)?void 0:u.getState();if(g&&y){void 0===l.dpr||zD.equ(y.viewport.dpr,YD(l.dpr))||y.setDpr(l.dpr),y.size.width===i.width&&y.size.height===i.height||y.setSize(i.width,i.height),y.frameloop!==l.frameloop&&y.setFrameloop(l.frameloop);l.linear!==y.internal.lastProps.linear&&(bk(n),g=void 0)}if(!g){const e=((e,t)=>{const n="function"==typeof e?e(t):e;if(r=n,null!=r&&r.render)return n;var r;const i=new tf.WebGLRenderer({powerPreference:"high-performance",canvas:t,antialias:!0,alpha:!0,...e});i.outputEncoding=tf.sRGBEncoding,i.toneMapping=tf.ACESFilmicToneMapping,e&&Sk(i,e);return i})(r,n);l.vr&&(e.xr.enabled=!0,e.setAnimationLoop((e=>vk(e,!0)))),v=((e,n,r,i)=>{const{gl:o,size:s,shadows:a=!1,linear:l=!1,flat:u=!1,vr:d=!1,orthographic:h=!1,frameloop:p="always",dpr:m=1,performance:f,clock:g=new tf.Clock,raycaster:v,camera:y,onPointerMissed:S}=i;a&&(o.shadowMap.enabled=!0,"object"==typeof a?Object.assign(o.shadowMap,a):o.shadowMap.type=tf.PCFSoftShadowMap),l&&(o.outputEncoding=tf.LinearEncoding),u&&(o.toneMapping=tf.NoToneMapping),"never"===p&&(g.stop(),g.elapsedTime=0);const _=t(bD)(((t,s)=>{const a=new tf.Raycaster,{params:_,...b}=v||{};e(a,{enabled:!0,...b,params:{...a.params,..._}});const x=y instanceof tf.Camera,w=x?y:h?new tf.OrthographicCamera(0,0,0,0,.1,1e3):new tf.PerspectiveCamera(75,0,.1,1e3);x||(w.position.z=5,y&&e(w,y),null!=y&&y.rotation||w.lookAt(0,0,0));const C=YD(m),A=new tf.Vector3,E=new tf.Vector3,T=new tf.Vector3;function I(e=s().camera,t=E,n=s().size){const{width:r,height:i}=n,o=r/i;t instanceof tf.Vector3?T.copy(t):T.set(...t);const a=e.getWorldPosition(A).distanceTo(T);if(KD(e))return{width:r/e.zoom,height:i/e.zoom,factor:1,distance:a,aspect:o};{const t=e.fov*Math.PI/180,n=2*Math.tan(t/2)*a,s=n*(r/i);return{width:s,height:n,factor:r/s,distance:a,aspect:o}}}let M;const R=e=>t((t=>({performance:{...t.performance,current:e}})));return{gl:o,set:t,get:s,invalidate:()=>n(s()),advance:(e,t)=>r(e,t,s()),linear:l,flat:u,scene:JD(new tf.Scene),camera:w,controls:null,raycaster:a,clock:g,mouse:new tf.Vector2,vr:d,frameloop:p,onPointerMissed:S,performance:{current:1,min:.5,max:1,debounce:200,...f,regress:()=>{const e=s();M&&clearTimeout(M),e.performance.current!==e.performance.min&&R(e.performance.min),M=setTimeout((()=>R(s().performance.max)),e.performance.debounce)}},size:{width:0,height:0},viewport:{initialDpr:C,dpr:C,width:0,height:0,aspect:0,distance:0,factor:0,getCurrentViewport:I},setSize:(e,n)=>{const r={width:e,height:n};t((e=>({size:r,viewport:{...e.viewport,...I(w,E,r)}})))},setDpr:e=>t((t=>({viewport:{...t.viewport,dpr:YD(e)}}))),setFrameloop:(e="always")=>t((()=>({frameloop:e}))),events:{connected:!1},internal:{active:!1,priority:0,frames:0,lastProps:i,lastEvent:c.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(e,n=0)=>(t((({internal:t})=>({internal:{...t,priority:t.priority+(n>0?1:0),subscribers:[...t.subscribers,{ref:e,priority:n}].sort(((e,t)=>e.priority-t.priority))}}))),()=>{t((({internal:t})=>({internal:{...t,priority:t.priority-(n>0?1:0),subscribers:t.subscribers.filter((t=>t.ref!==e))}})))})}}})),b=_.getState();let x=b.size,w=b.viewport.dpr;return _.subscribe((()=>{const{camera:e,size:t,viewport:n,internal:r}=_.getState();t===x&&n.dpr===w||(e.manual||r.lastProps.camera instanceof tf.Camera||(KD(e)?(e.left=t.width/-2,e.right=t.width/2,e.top=t.height/2,e.bottom=t.height/-2):e.aspect=t.width/t.height,e.updateProjectionMatrix(),e.updateMatrixWorld()),o.setPixelRatio(n.dpr),o.setSize(t.width,t.height),x=t,w=n.dpr)})),s&&b.setSize(s.width,s.height),_.subscribe((e=>n(e))),_})(Sk,gk,vk,{gl:e,size:i,...l});const a=v.getState();g=yk.createContainer(v,fk.indexOf(o),!1,null),mk.set(n,{fiber:g,store:v}),s&&a.set({events:s(v)})}if(v&&g)return yk.updateContainer(c.createElement(_k,{store:v,element:e,onCreated:a,target:n}),g,null,(()=>{})),v;throw"Error creating root!"}(c.createElement(sk,{set:S},c.createElement(c.Suspense,{fallback:c.createElement(ok,{set:v})},e)),f.current,{...u,size:{width:p,height:m},events:l||rk})}),[p,m,e]),ik((()=>{const e=f.current;return()=>bk(e)}),[]),c.createElement("div",{ref:h,id:o,className:a,tabIndex:r,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",...s}},c.createElement("canvas",{ref:ND([f,d]),style:{display:"block"}},n))}));function lk(){const e=c.useContext($D);if(!e)throw"R3F hooks can only be used within the Canvas component!";return e}function ck(e=(e=>e),t){return lk()(e,t)}function uk(e,t=0){const n=lk().getState().internal.subscribe,r=c.useRef(e);return c.useLayoutEffect((()=>{r.current=e}),[e]),c.useLayoutEffect((()=>n(r,t)),[t,n]),null}function dk(e){const t={nodes:{},materials:{}};return e&&e.traverse((e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material)})),t}function hk(e,t){return function(n,...r){const i=new n;return e&&e(i),Promise.all(r.map((e=>new Promise(((n,r)=>i.load(e,(e=>{e.scene&&Object.assign(e,dk(e.scene)),n(e)}),t,(t=>r(`Could not load ${e}: ${t.message}`))))))))}}function pk(e,t,n,r){const i=Array.isArray(t)?t:[t],o=RD(hk(n,r),e,...i);return Array.isArray(t)?o:o[0]}pk.preload=function(e,t,n){const r=Array.isArray(t)?t:[t];return RD.preload(hk(n),e,...r)},pk.clear=function(e,t){const n=Array.isArray(t)?t:[t];return RD.clear(e,...n)};const mk=new Map,fk=["legacy","blocking","concurrent"],{invalidate:gk,advance:vk}=function(e){let t,n=!1;function r(i){if(n=!0,t=0,tk(QD,i),e.forEach((e=>{const n=e.store.getState();n.internal.active&&("always"===n.frameloop||n.internal.frames>0)&&(t+=nk(i,n))})),tk(ZD,i),t>0)return requestAnimationFrame(r);tk(ek,i),n=!1}return{loop:r,invalidate:function t(i){if(!i)return e.forEach((e=>t(e.store.getState())));!i.vr&&i.internal.active&&"never"!==i.frameloop&&(i.internal.frames=Math.min(60,i.internal.frames+1),n||(n=!0,requestAnimationFrame(r)))},advance:function(t,n=!0,r){n&&tk(QD,t),r?nk(t,r):e.forEach((e=>nk(t,e.store.getState()))),n&&tk(ZD,t)}}}(mk),{reconciler:yk,applyProps:Sk}=function(e){function n(e,{children:t,key:n,ref:r,...i},{children:o,key:s,ref:a,...l}={},c=!1){var u;const d=null!=(u=null==e?void 0:e.__r3f)?u:{},h=Object.entries(i),p=[];if(c){const e=Object.keys(l);for(let t=0;t<e.length;t++)i.hasOwnProperty(e[t])||h.unshift([e[t],VD+"remove"])}h.forEach((([t,n])=>{var r;if(null!=(r=e.__r3f)&&r.primitive&&"object"===t)return;if(function(e,t){return!(!zD.arr(e)||!zD.equ(e,t))||e===t}(n,l[t]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(t))return p.push([t,n,!0,[]]);let i=[];t.includes("-")&&(i=t.split("-")),p.push([t,n,!1,i])}));const m={...i};return d.memoizedProps&&d.memoizedProps.args&&(m.args=d.memoizedProps.args),d.memoizedProps&&d.memoizedProps.attach&&(m.attach=d.memoizedProps.attach),{accumulative:c,memoized:m,changes:p}}function r(e,t){var r,s,a;const l=null!=(r=null==e?void 0:e.__r3f)?r:{},c=l.root,u=null!=(s=null==c||null==c.getState?void 0:c.getState())?s:{},{memoized:d,changes:h}=(p=t)&&p.memoized&&p.changes?t:n(e,t);var p;const m=l.eventCount;if(e.__r3f&&(e.__r3f.memoizedProps=d),h.forEach((([t,n,r,o])=>{var s;let a=e,c=a[t];if(o.length&&(c=o.reduce(((e,t)=>e[t]),e),!c||!c.set)){const[n,...r]=o.reverse();a=r.reverse().reduce(((e,t)=>e[t]),e),t=n}if(n===VD+"remove")if(c&&c.constructor)n=new c.constructor(d.args);else if(a.constructor){const e=new a.constructor(a.__r3f.memoizedProps.args);n=e[c],e.dispose&&e.dispose()}else n=0;const h=(null==u||null==(s=u.gl)?void 0:s.outputEncoding)===tf.LinearEncoding;if(r)n?l.handlers[t]=n:delete l.handlers[t],l.eventCount=Object.keys(l.handlers).length;else if(c&&c.set&&(c.copy||c instanceof tf.Layers)){if(Array.isArray(n))c.fromArray?c.fromArray(n):c.set(...n);else if(c.copy&&n&&n.constructor&&c.constructor.name===n.constructor.name)c.copy(n);else if(void 0!==n){const e=c instanceof tf.Color;!e&&c.setScalar?c.setScalar(n):c instanceof tf.Layers&&n instanceof tf.Layers?c.mask=n.mask:c.set(n),!h&&e&&c.convertSRGBToLinear()}}else a[t]=n,!h&&a[t]instanceof tf.Texture&&(a[t].encoding=tf.sRGBEncoding);i(e)})),l.parent&&u.internal&&e.raycast&&m!==l.eventCount){const t=u.internal.interaction.indexOf(e);t>-1&&u.internal.interaction.splice(t,1),l.eventCount&&u.internal.interaction.push(e)}return h.length&&null!=(a=e.__r3f)&&a.parent&&o(e),e}function i(e){var t,n;const r=null==(t=e.__r3f)||null==(n=t.root)||null==n.getState?void 0:n.getState();r&&0===r.internal.frames&&r.invalidate()}function o(e){null==e.onUpdate||e.onUpdate(e)}function s(e,{args:t=[],...n},i,o,s){let a,l=`${e[0].toUpperCase()}${e.slice(1)}`;if(!GD(i)&&s){const e=t=>t.return?e(t.return):t.stateNode&&t.stateNode.containerInfo;i=e(s)}if(!i||!GD(i))throw`No valid root for ${l}!`;if("primitive"===e){if(void 0===n.object)throw"Primitives without 'object' are invalid!";a=JD(n.object,{root:i,primitive:!0})}else{const e=qD[l]||tf[l];if(!e)throw`${l} is not part of the THREE namespace! Did you forget to extend? See: https://github.com/pmndrs/react-three-fiber/blob/master/markdown/api.md#using-3rd-party-objects-declaratively`;if(!Array.isArray(t))throw"The args prop must be an array!";a=JD(new e(...t),{root:i,memoizedProps:{args:0===t.length?null:t}})}return"attachFns"in n||(l.endsWith("Geometry")?n={attach:"geometry",...n}:l.endsWith("Material")&&(n={attach:"material",...n})),r(a,n),a}function a(e,t){let n=!1;if(t){if(t.attachArray)zD.arr(e[t.attachArray])||(e[t.attachArray]=[]),e[t.attachArray].push(t);else if(t.attachObject)zD.obj(e[t.attachObject[0]])||(e[t.attachObject[0]]={}),e[t.attachObject[0]][t.attachObject[1]]=t;else if(t.attach&&!zD.fun(t.attach))e[t.attach]=t;else if(zD.arr(t.attachFns)){const[n]=t.attachFns;zD.str(n)&&zD.fun(e[n])?e[n](t):zD.fun(n)&&n(t,e)}else t.isObject3D&&e.isObject3D&&(e.add(t),n=!0);n||e.__r3f.objects.push(t),t.__r3f||JD(t,{}),t.__r3f.parent=e,o(t),i(t)}}function l(e,t,n){let r=!1;if(t){if(t.attachArray){const r=e[t.attachArray];zD.arr(r)||(e[t.attachArray]=[]),r.splice(r.indexOf(n),0,t)}else{if(t.attachObject||t.attach&&!zD.fun(t.attach))return a(e,t);if(t.isObject3D&&e.isObject3D){t.parent=e,t.dispatchEvent({type:"added"});const i=e.children.filter((e=>e!==t)),o=i.indexOf(n);e.children=[...i.slice(0,o),t,...i.slice(o)],r=!0}}r||e.__r3f.objects.push(t),t.__r3f||JD(t,{}),t.__r3f.parent=e,o(t),i(t)}}function c(e,t,n=!1){e&&[...e].forEach((e=>u(t,e,n)))}function u(e,t,n){if(t){var r,o;if(t.__r3f&&(t.__r3f.parent=null),null!=(r=e.__r3f)&&r.objects&&(e.__r3f.objects=e.__r3f.objects.filter((e=>e!==t))),t.attachArray)e[t.attachArray]=e[t.attachArray].filter((e=>e!==t));else if(t.attachObject)delete e[t.attachObject[0]][t.attachObject[1]];else if(t.attach&&!zD.fun(t.attach)&&e[t.attach]===t)e[t.attach]=null;else if(zD.arr(t.attachFns)){const[,n]=t.attachFns;zD.str(n)&&zD.fun(e[n])?e[n](t):zD.fun(n)&&n(t,e)}else if(t.isObject3D&&e.isObject3D){var s;e.remove(t),null!=(s=t.__r3f)&&s.root&&function(e,t){const{internal:n}=e.getState();n.interaction=n.interaction.filter((e=>e!==t)),n.initialHits=n.initialHits.filter((e=>e!==t)),n.hovered.forEach(((e,r)=>{e.eventObject!==t&&e.object!==t||n.hovered.delete(r)})),n.capturedMap.forEach(((e,r)=>{UD(n.capturedMap,t,e,r)}))}(t.__r3f.root,t)}const l=null==(o=t.__r3f)?void 0:o.primitive,u=void 0===n?null!==t.dispose&&!l:n;var a;if(!l)c(null==(a=t.__r3f)?void 0:a.objects,t,u),c(t.children,t,u);t.__r3f&&(delete t.__r3f.root,delete t.__r3f.objects,delete t.__r3f.handlers,delete t.__r3f.memoizedProps,l||delete t.__r3f),u&&t.dispose&&"Scene"!==t.type&&(0,ED.unstable_runWithPriority)(ED.unstable_IdlePriority,(()=>{try{t.dispose()}catch(e){}})),i(e)}}return{reconciler:t(CD)({now:ED.unstable_now,createInstance:s,removeChild:u,appendChild:a,appendInitialChild:a,insertBefore:l,warnsIfNotActing:!0,supportsMutation:!0,isPrimaryRenderer:!1,scheduleTimeout:zD.fun(setTimeout)?setTimeout:void 0,cancelTimeout:zD.fun(clearTimeout)?clearTimeout:void 0,setTimeout:zD.fun(setTimeout)?setTimeout:void 0,clearTimeout:zD.fun(clearTimeout)?clearTimeout:void 0,noTimeout:-1,appendChildToContainer:(e,t)=>{const{container:n,root:r}=HD(e,t);n.__r3f.root=r,a(n,t)},removeChildFromContainer:(e,t)=>u(HD(e,t).container,t),insertInContainerBefore:(e,t,n)=>l(HD(e,t).container,t,n),prepareUpdate(e,t,r,i){if(e.__r3f.primitive&&i.object&&i.object!==e)return[!0];{const{args:t=[],children:o,...s}=i,{args:l=[],children:c,...u}=r;if(!Array.isArray(t))throw"The args prop must be an array!";if(t.some(((e,t)=>e!==l[t])))return[!0];const d=n(e,s,u,!0);if(d.changes.length)return[!1,d];if(e.attach&&"function"!=typeof e.attach){const t=e.__r3f.parent;t&&t[e.attach]!==e&&a(t,e)}return null}},commitUpdate(e,[t,n],i,o,l,c){t?function(e,t,n,r){var i;const o=null==(i=e.__r3f)?void 0:i.parent;if(!o)return;const l=s(t,n,e.__r3f.root);"primitive"!==t&&e.children&&(e.children.forEach((e=>a(l,e))),e.children=[]),e.__r3f.objects.forEach((e=>a(l,e))),e.__r3f.objects=[],u(o,e),a(o,l),l.raycast&&l.__r3f.eventCount&&l.__r3f.root.getState().internal.interaction.push(l);[r,r.alternate].forEach((e=>{null!==e&&(e.stateNode=l,e.ref&&("function"==typeof e.ref?e.ref(l):e.ref.current=l))}))}(e,i,l,c):r(e,n)},hideInstance(e){e.isObject3D&&(e.visible=!1,i(e))},unhideInstance(e,t){(e.isObject3D&&null==t.visible||t.visible)&&(e.visible=!0,i(e))},hideTextInstance(){throw new Error("Text is not allowed in the R3F tree.")},getPublicInstance:e=>e,getRootHostContext:e=>WD,getChildHostContext:e=>e,createTextInstance(){},finalizeInitialChildren(e){var t;return!!(null!=(t=null==e?void 0:e.__r3f)?t:{}).handlers},commitMount(e){var t;const n=null!=(t=null==e?void 0:e.__r3f)?t:{};e.raycast&&n.handlers&&n.eventCount&&e.__r3f.root.getState().internal.interaction.push(e)},shouldDeprioritizeSubtree:()=>!1,prepareForCommit:()=>null,preparePortalMount(e){JD(e)},resetAfterCommit(){},shouldSetTextContent:()=>!1,clearContainer:()=>!1}),applyProps:r}}();function _k({store:e,element:t,onCreated:n,target:r}){return c.useEffect((()=>{const t=e.getState();t.set((e=>({internal:{...e.internal,active:!0}}))),null==t.events.connect||t.events.connect(r),n&&n(t)}),[]),c.createElement($D.Provider,{value:e},t)}function bk(e,t){const n=mk.get(e),r=null==n?void 0:n.fiber;if(r){const i=null==n?void 0:n.store.getState();i&&(i.internal.active=!1),yk.updateContainer(null,r,null,(()=>{i&&setTimeout((()=>{var n,r,o;null==i.events.disconnect||i.events.disconnect(),null==(n=i.gl)||null==(r=n.renderLists)||null==r.dispose||r.dispose(),null==(o=i.gl)||null==o.forceContextLoss||o.forceContextLoss(),function(e){e.dispose&&"Scene"!==e.type&&e.dispose();for(const r in e){var t,n;null==(t=(n=r).dispose)||t.call(n),delete e[r]}}(i),mk.delete(e),t&&t(e)}),500)}))}}yk.act;function xk(){return xk=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xk.apply(this,arguments)}yk.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:"17.0.2"});c=o("85Hg2");function wk(e){return wk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wk(e)}function Ck(e,t){if("object"!==wk(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==wk(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function Ak(e){var t=Ck(e,"string");return"symbol"===wk(t)?t:String(t)}function Ek(e,t,n){return(t=Ak(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Tk=(e,t)=>(e%t+t)%t;class Ik extends py{constructor(e,t){super(),Ek(this,"object",void 0),Ek(this,"domElement",void 0),Ek(this,"enabled",!0),Ek(this,"target",new oS),Ek(this,"minDistance",0),Ek(this,"maxDistance",1/0),Ek(this,"minZoom",0),Ek(this,"maxZoom",1/0),Ek(this,"minPolarAngle",0),Ek(this,"maxPolarAngle",Math.PI),Ek(this,"minAzimuthAngle",-1/0),Ek(this,"maxAzimuthAngle",1/0),Ek(this,"enableDamping",!1),Ek(this,"dampingFactor",.05),Ek(this,"enableZoom",!0),Ek(this,"zoomSpeed",1),Ek(this,"enableRotate",!0),Ek(this,"rotateSpeed",1),Ek(this,"enablePan",!0),Ek(this,"panSpeed",1),Ek(this,"screenSpacePanning",!0),Ek(this,"keyPanSpeed",7),Ek(this,"autoRotate",!1),Ek(this,"autoRotateSpeed",2),Ek(this,"reverseOrbit",!1),Ek(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Ek(this,"mouseButtons",{LEFT:rf.ROTATE,MIDDLE:rf.DOLLY,RIGHT:rf.PAN}),Ek(this,"touches",{ONE:of.ROTATE,TWO:of.DOLLY_PAN}),Ek(this,"target0",void 0),Ek(this,"position0",void 0),Ek(this,"zoom0",void 0),Ek(this,"_domElementKeyEvents",null),Ek(this,"getPolarAngle",void 0),Ek(this,"getAzimuthalAngle",void 0),Ek(this,"setPolarAngle",void 0),Ek(this,"setAzimuthalAngle",void 0),Ek(this,"getDistance",void 0),Ek(this,"listenToKeyEvents",void 0),Ek(this,"saveState",void 0),Ek(this,"reset",void 0),Ek(this,"update",void 0),Ek(this,"connect",void 0),Ek(this,"dispose",void 0),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object instanceof mb?this.object.zoom:1,this.getPolarAngle=()=>c.phi,this.getAzimuthalAngle=()=>c.theta,this.setPolarAngle=e=>{let t=Tk(e,2*Math.PI),r=c.phi;r<0&&(r+=2*Math.PI),t<0&&(t+=2*Math.PI);let i=Math.abs(t-r);2*Math.PI-i<i&&(t<r?t+=2*Math.PI:r+=2*Math.PI),u.phi=t-r,n.update()},this.setAzimuthalAngle=e=>{let t=Tk(e,2*Math.PI),r=c.theta;r<0&&(r+=2*Math.PI),t<0&&(t+=2*Math.PI);let i=Math.abs(t-r);2*Math.PI-i<i&&(t<r?t+=2*Math.PI:r+=2*Math.PI),u.theta=t-r,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=e=>{e.addEventListener("keydown",q),this._domElementKeyEvents=e},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object instanceof mb?n.object.zoom:1},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object instanceof mb&&(n.object.zoom=n.zoom0,n.object.updateProjectionMatrix()),n.dispatchEvent(r),n.update(),a=s.NONE},this.update=(()=>{const t=new oS,i=(new iS).setFromUnitVectors(e.up,new oS(0,1,0)),o=i.clone().invert(),m=new oS,f=new iS,g=2*Math.PI;return function(){const e=n.object.position;t.copy(e).sub(n.target),t.applyQuaternion(i),c.setFromVector3(t),n.autoRotate&&a===s.NONE&&E(2*Math.PI/60/60*n.autoRotateSpeed),n.enableDamping?(c.theta+=u.theta*n.dampingFactor,c.phi+=u.phi*n.dampingFactor):(c.theta+=u.theta,c.phi+=u.phi);let v=n.minAzimuthAngle,y=n.maxAzimuthAngle;return isFinite(v)&&isFinite(y)&&(v<-Math.PI?v+=g:v>Math.PI&&(v-=g),y<-Math.PI?y+=g:y>Math.PI&&(y-=g),c.theta=v<=y?Math.max(v,Math.min(y,c.theta)):c.theta>(v+y)/2?Math.max(v,c.theta):Math.min(y,c.theta)),c.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,c.phi)),c.makeSafe(),c.radius*=d,c.radius=Math.max(n.minDistance,Math.min(n.maxDistance,c.radius)),!0===n.enableDamping?n.target.addScaledVector(h,n.dampingFactor):n.target.add(h),t.setFromSpherical(c),t.applyQuaternion(o),e.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,h.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),h.set(0,0,0)),d=1,!!(p||m.distanceToSquared(n.object.position)>l||8*(1-f.dot(n.object.quaternion))>l)&&(n.dispatchEvent(r),m.copy(n.object.position),f.copy(n.object.quaternion),p=!1,!0)}})(),this.connect=e=>{e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),n.domElement=e,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",J),n.domElement.addEventListener("pointerdown",j),n.domElement.addEventListener("pointercancel",V),n.domElement.addEventListener("wheel",W)},this.dispose=()=>{var e,t,r,i,o,s;null===(e=n.domElement)||void 0===e||e.removeEventListener("contextmenu",J),null===(t=n.domElement)||void 0===t||t.removeEventListener("pointerdown",j),null===(r=n.domElement)||void 0===r||r.removeEventListener("pointercancel",V),null===(i=n.domElement)||void 0===i||i.removeEventListener("wheel",W),null===(o=n.domElement)||void 0===o||o.ownerDocument.removeEventListener("pointermove",G),null===(s=n.domElement)||void 0===s||s.ownerDocument.removeEventListener("pointerup",H),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",q)};const n=this,r={type:"change"},i={type:"start"},o={type:"end"},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let a=s.NONE;const l=1e-6,c=new WI,u=new WI;let d=1;const h=new oS;let p=!1;const m=new Iy,f=new Iy,g=new Iy,v=new Iy,y=new Iy,S=new Iy,_=new Iy,b=new Iy,x=new Iy,w=[],C={};function A(){return Math.pow(.95,n.zoomSpeed)}function E(e){n.reverseOrbit?u.theta+=e:u.theta-=e}function T(e){n.reverseOrbit?u.phi+=e:u.phi-=e}const I=(()=>{const e=new oS;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),h.add(e)}})(),M=(()=>{const e=new oS;return function(t,r){!0===n.screenSpacePanning?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),h.add(e)}})(),R=(()=>{const e=new oS;return function(t,r){const i=n.domElement;if(i&&n.object instanceof mb&&n.object.isPerspectiveCamera){const o=n.object.position;e.copy(o).sub(n.target);let s=e.length();s*=Math.tan(n.object.fov/2*Math.PI/180),I(2*t*s/i.clientHeight,n.object.matrix),M(2*r*s/i.clientHeight,n.object.matrix)}else i&&n.object instanceof zb&&n.object.isOrthographicCamera?(I(t*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),M(r*(n.object.top-n.object.bottom)/n.object.zoom/i.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function P(e){n.object instanceof mb&&n.object.isPerspectiveCamera?d/=e:n.object instanceof zb&&n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),p=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function N(e){n.object instanceof mb&&n.object.isPerspectiveCamera?d*=e:n.object instanceof zb&&n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),p=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function O(e){m.set(e.clientX,e.clientY)}function D(e){v.set(e.clientX,e.clientY)}function k(){if(1==w.length)m.set(w[0].pageX,w[0].pageY);else{const e=.5*(w[0].pageX+w[1].pageX),t=.5*(w[0].pageY+w[1].pageY);m.set(e,t)}}function L(){if(1==w.length)v.set(w[0].pageX,w[0].pageY);else{const e=.5*(w[0].pageX+w[1].pageX),t=.5*(w[0].pageY+w[1].pageY);v.set(e,t)}}function B(){const e=w[0].pageX-w[1].pageX,t=w[0].pageY-w[1].pageY,n=Math.sqrt(e*e+t*t);_.set(0,n)}function z(e){if(1==w.length)f.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);f.set(n,r)}g.subVectors(f,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;t&&(E(2*Math.PI*g.x/t.clientHeight),T(2*Math.PI*g.y/t.clientHeight)),m.copy(f)}function F(e){if(1==w.length)y.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);y.set(n,r)}S.subVectors(y,v).multiplyScalar(n.panSpeed),R(S.x,S.y),v.copy(y)}function U(e){const t=$(e),r=e.pageX-t.x,i=e.pageY-t.y,o=Math.sqrt(r*r+i*i);b.set(0,o),x.set(0,Math.pow(b.y/_.y,n.zoomSpeed)),P(x.y),_.copy(b)}function j(e){if(!1!==n.enabled){var t,r;if(0===w.length)null===(t=n.domElement)||void 0===t||t.ownerDocument.addEventListener("pointermove",G),null===(r=n.domElement)||void 0===r||r.ownerDocument.addEventListener("pointerup",H);!function(e){w.push(e)}(e),"touch"===e.pointerType?function(e){switch(Y(e),w.length){case 1:switch(n.touches.ONE){case of.ROTATE:if(!1===n.enableRotate)return;k(),a=s.TOUCH_ROTATE;break;case of.PAN:if(!1===n.enablePan)return;L(),a=s.TOUCH_PAN;break;default:a=s.NONE}break;case 2:switch(n.touches.TWO){case of.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&B(),n.enablePan&&L(),a=s.TOUCH_DOLLY_PAN;break;case of.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&B(),n.enableRotate&&k(),a=s.TOUCH_DOLLY_ROTATE;break;default:a=s.NONE}break;default:a=s.NONE}a!==s.NONE&&n.dispatchEvent(i)}(e):function(e){let t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case rf.DOLLY:if(!1===n.enableZoom)return;!function(e){_.set(e.clientX,e.clientY)}(e),a=s.DOLLY;break;case rf.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;D(e),a=s.PAN}else{if(!1===n.enableRotate)return;O(e),a=s.ROTATE}break;case rf.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;O(e),a=s.ROTATE}else{if(!1===n.enablePan)return;D(e),a=s.PAN}break;default:a=s.NONE}a!==s.NONE&&n.dispatchEvent(i)}(e)}}function G(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(Y(e),a){case s.TOUCH_ROTATE:if(!1===n.enableRotate)return;z(e),n.update();break;case s.TOUCH_PAN:if(!1===n.enablePan)return;F(e),n.update();break;case s.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&U(e),n.enablePan&&F(e)}(e),n.update();break;case s.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&U(e),n.enableRotate&&z(e)}(e),n.update();break;default:a=s.NONE}}(e):function(e){if(!1===n.enabled)return;switch(a){case s.ROTATE:if(!1===n.enableRotate)return;!function(e){f.set(e.clientX,e.clientY),g.subVectors(f,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;t&&(E(2*Math.PI*g.x/t.clientHeight),T(2*Math.PI*g.y/t.clientHeight)),m.copy(f),n.update()}(e);break;case s.DOLLY:if(!1===n.enableZoom)return;!function(e){b.set(e.clientX,e.clientY),x.subVectors(b,_),x.y>0?P(A()):x.y<0&&N(A()),_.copy(b),n.update()}(e);break;case s.PAN:if(!1===n.enablePan)return;!function(e){y.set(e.clientX,e.clientY),S.subVectors(y,v).multiplyScalar(n.panSpeed),R(S.x,S.y),v.copy(y),n.update()}(e)}}(e))}function H(e){var t,r,i;(K(e),0===w.length)&&(null===(t=n.domElement)||void 0===t||t.releasePointerCapture(e.pointerId),null===(r=n.domElement)||void 0===r||r.ownerDocument.removeEventListener("pointermove",G),null===(i=n.domElement)||void 0===i||i.ownerDocument.removeEventListener("pointerup",H));n.dispatchEvent(o),a=s.NONE}function V(e){K(e)}function W(e){!1===n.enabled||!1===n.enableZoom||a!==s.NONE&&a!==s.ROTATE||(e.preventDefault(),n.dispatchEvent(i),function(e){e.deltaY<0?N(A()):e.deltaY>0&&P(A()),n.update()}(e),n.dispatchEvent(o))}function q(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:R(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:R(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:R(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:R(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function J(e){!1!==n.enabled&&e.preventDefault()}function K(e){delete C[e.pointerId];for(let t=0;t<w.length;t++)if(w[t].pointerId==e.pointerId)return void w.splice(t,1)}function Y(e){let t=C[e.pointerId];void 0===t&&(t=new Iy,C[e.pointerId]=t),t.set(e.pageX,e.pageY)}function $(e){const t=e.pointerId===w[0].pointerId?w[1]:w[0];return C[t.pointerId]}void 0!==t&&this.connect(t),this.update()}}const Mk=c.forwardRef((({makeDefault:e,camera:t,regress:n,domElement:r,enableDamping:i=!0,onChange:o,onStart:s,onEnd:a,...l},u)=>{const d=ck((e=>e.invalidate)),h=ck((e=>e.camera)),p=ck((e=>e.gl)),m=ck((e=>e.events)),f=ck((e=>e.set)),g=ck((e=>e.get)),v=ck((e=>e.performance)),y=t||h,S=r||m.connected||p.domElement,_=c.useMemo((()=>new Ik(y)),[y]);return uk((()=>{_.enabled&&_.update()})),c.useEffect((()=>(_.connect(S),()=>{_.dispose()})),[S,n,_,d]),c.useEffect((()=>{const e=e=>{d(),n&&v.regress(),o&&o(e)};return _.addEventListener("change",e),s&&_.addEventListener("start",s),a&&_.addEventListener("end",a),()=>{s&&_.removeEventListener("start",s),a&&_.removeEventListener("end",a),_.removeEventListener("change",e)}}),[o,s,a]),c.useEffect((()=>{if(e){const e=g().controls;return f({controls:_}),()=>f({controls:e})}}),[e,_]),c.createElement("primitive",xk({ref:u,object:_,enableDamping:i},l))}));const Rk=(c=o("85Hg2")).forwardRef((({makeDefault:e,...t},n)=>{const r=ck((({set:e})=>e)),i=ck((({camera:e})=>e)),o=ck((({size:e})=>e)),s=c.useRef();return c.useLayoutEffect((()=>{const{current:e}=s;e&&!t.manual&&(e.aspect=o.width/o.height,e.updateProjectionMatrix())}),[o,t]),c.useLayoutEffect((()=>{if(e&&s.current){const e=i;return r((()=>({camera:s.current}))),()=>r((()=>({camera:e})))}}),[i,s,e,r]),c.createElement("perspectiveCamera",xk({ref:ND([s,n])},t))}));c=o("85Hg2"),c=o("85Hg2");
245
+ /*! @license DOMPurify 3.2.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.1/LICENSE */QN=function(){"use strict";const{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:r,getOwnPropertyDescriptor:i}=Object;let{freeze:o,seal:s,create:a}=Object,{apply:l,construct:c}="undefined"!=typeof Reflect&&Reflect;o||(o=function(e){return e}),s||(s=function(e){return e}),l||(l=function(e,t,n){return e.apply(t,n)}),c||(c=function(e,t){return new e(...t)});const u=x(Array.prototype.forEach),d=x(Array.prototype.pop),h=x(Array.prototype.push),p=x(String.prototype.toLowerCase),m=x(String.prototype.toString),f=x(String.prototype.match),g=x(String.prototype.replace),v=x(String.prototype.indexOf),y=x(String.prototype.trim),S=x(Object.prototype.hasOwnProperty),_=x(RegExp.prototype.test),b=w(TypeError);function x(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return l(e,t,r)}}function w(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return c(e,n)}}function C(e,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p;t&&t(e,null);let o=r.length;for(;o--;){let t=r[o];if("string"==typeof t){const e=i(t);e!==t&&(n(r)||(r[o]=e),t=e)}e[t]=!0}return e}function A(e){for(let t=0;t<e.length;t++)S(e,t)||(e[t]=null);return e}function E(t){const n=a(null);for(const[r,i]of e(t))S(t,r)&&(Array.isArray(i)?n[r]=A(i):i&&"object"==typeof i&&i.constructor===Object?n[r]=E(i):n[r]=i);return n}function T(e,t){for(;null!==e;){const n=i(e,t);if(n){if(n.get)return x(n.get);if("function"==typeof n.value)return x(n.value)}e=r(e)}function n(){return null}return n}const I=o(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),M=o(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),R=o(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),P=o(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),N=o(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),O=o(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),D=o(["#text"]),k=o(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),L=o(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),B=o(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),z=o(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),F=s(/\{\{[\w\W]*|[\w\W]*\}\}/gm),U=s(/<%[\w\W]*|[\w\W]*%>/gm),j=s(/\${[\w\W]*}/gm),G=s(/^data-[\-\w.\u00B7-\uFFFF]/),H=s(/^aria-[\-\w]+$/),V=s(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),W=s(/^(?:\w+script|data):/i),q=s(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),J=s(/^html$/i),K=s(/^[a-z][.\w]*(-[.\w]+)+$/i);var Y=Object.freeze({__proto__:null,ARIA_ATTR:H,ATTR_WHITESPACE:q,CUSTOM_ELEMENT:K,DATA_ATTR:G,DOCTYPE_NAME:J,ERB_EXPR:U,IS_ALLOWED_URI:V,IS_SCRIPT_OR_DATA:W,MUSTACHE_EXPR:F,TMPLIT_EXPR:j});const $={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},X=function(){return"undefined"==typeof window?null:window},Q=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}};function Z(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X();const n=e=>Z(e);if(n.version="3.2.1",n.removed=[],!t||!t.document||t.document.nodeType!==$.document)return n.isSupported=!1,n;let{document:r}=t;const i=r,s=i.currentScript,{DocumentFragment:l,HTMLTemplateElement:c,Node:x,Element:w,NodeFilter:A,NamedNodeMap:F=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:U,DOMParser:j,trustedTypes:G}=t,H=w.prototype,W=T(H,"cloneNode"),q=T(H,"remove"),K=T(H,"nextSibling"),ee=T(H,"childNodes"),te=T(H,"parentNode");if("function"==typeof c){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let ne,re="";const{implementation:ie,createNodeIterator:oe,createDocumentFragment:se,getElementsByTagName:ae}=r,{importNode:le}=i;let ce={};n.isSupported="function"==typeof e&&"function"==typeof te&&ie&&void 0!==ie.createHTMLDocument;const{MUSTACHE_EXPR:ue,ERB_EXPR:de,TMPLIT_EXPR:he,DATA_ATTR:pe,ARIA_ATTR:me,IS_SCRIPT_OR_DATA:fe,ATTR_WHITESPACE:ge,CUSTOM_ELEMENT:ve}=Y;let{IS_ALLOWED_URI:ye}=Y,Se=null;const _e=C({},[...I,...M,...R,...N,...D]);let be=null;const xe=C({},[...k,...L,...B,...z]);let we=Object.seal(a(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ce=null,Ae=null,Ee=!0,Te=!0,Ie=!1,Me=!0,Re=!1,Pe=!0,Ne=!1,Oe=!1,De=!1,ke=!1,Le=!1,Be=!1,ze=!0,Fe=!1;const Ue="user-content-";let je=!0,Ge=!1,He={},Ve=null;const We=C({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let qe=null;const Je=C({},["audio","video","img","source","image","track"]);let Ke=null;const Ye=C({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$e="http://www.w3.org/1998/Math/MathML",Xe="http://www.w3.org/2000/svg",Qe="http://www.w3.org/1999/xhtml";let Ze=Qe,et=!1,tt=null;const nt=C({},[$e,Xe,Qe],m);let rt=C({},["mi","mo","mn","ms","mtext"]),it=C({},["annotation-xml"]);const ot=C({},["title","style","font","a","script"]);let st=null;const at=["application/xhtml+xml","text/html"],lt="text/html";let ct=null,ut=null;const dt=r.createElement("form"),ht=function(e){return e instanceof RegExp||e instanceof Function},pt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!ut||ut!==e){if(e&&"object"==typeof e||(e={}),e=E(e),st=-1===at.indexOf(e.PARSER_MEDIA_TYPE)?lt:e.PARSER_MEDIA_TYPE,ct="application/xhtml+xml"===st?m:p,Se=S(e,"ALLOWED_TAGS")?C({},e.ALLOWED_TAGS,ct):_e,be=S(e,"ALLOWED_ATTR")?C({},e.ALLOWED_ATTR,ct):xe,tt=S(e,"ALLOWED_NAMESPACES")?C({},e.ALLOWED_NAMESPACES,m):nt,Ke=S(e,"ADD_URI_SAFE_ATTR")?C(E(Ye),e.ADD_URI_SAFE_ATTR,ct):Ye,qe=S(e,"ADD_DATA_URI_TAGS")?C(E(Je),e.ADD_DATA_URI_TAGS,ct):Je,Ve=S(e,"FORBID_CONTENTS")?C({},e.FORBID_CONTENTS,ct):We,Ce=S(e,"FORBID_TAGS")?C({},e.FORBID_TAGS,ct):{},Ae=S(e,"FORBID_ATTR")?C({},e.FORBID_ATTR,ct):{},He=!!S(e,"USE_PROFILES")&&e.USE_PROFILES,Ee=!1!==e.ALLOW_ARIA_ATTR,Te=!1!==e.ALLOW_DATA_ATTR,Ie=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Me=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Re=e.SAFE_FOR_TEMPLATES||!1,Pe=!1!==e.SAFE_FOR_XML,Ne=e.WHOLE_DOCUMENT||!1,ke=e.RETURN_DOM||!1,Le=e.RETURN_DOM_FRAGMENT||!1,Be=e.RETURN_TRUSTED_TYPE||!1,De=e.FORCE_BODY||!1,ze=!1!==e.SANITIZE_DOM,Fe=e.SANITIZE_NAMED_PROPS||!1,je=!1!==e.KEEP_CONTENT,Ge=e.IN_PLACE||!1,ye=e.ALLOWED_URI_REGEXP||V,Ze=e.NAMESPACE||Qe,rt=e.MATHML_TEXT_INTEGRATION_POINTS||rt,it=e.HTML_INTEGRATION_POINTS||it,we=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ht(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(we.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ht(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(we.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(we.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Re&&(Te=!1),Le&&(ke=!0),He&&(Se=C({},D),be=[],!0===He.html&&(C(Se,I),C(be,k)),!0===He.svg&&(C(Se,M),C(be,L),C(be,z)),!0===He.svgFilters&&(C(Se,R),C(be,L),C(be,z)),!0===He.mathMl&&(C(Se,N),C(be,B),C(be,z))),e.ADD_TAGS&&(Se===_e&&(Se=E(Se)),C(Se,e.ADD_TAGS,ct)),e.ADD_ATTR&&(be===xe&&(be=E(be)),C(be,e.ADD_ATTR,ct)),e.ADD_URI_SAFE_ATTR&&C(Ke,e.ADD_URI_SAFE_ATTR,ct),e.FORBID_CONTENTS&&(Ve===We&&(Ve=E(Ve)),C(Ve,e.FORBID_CONTENTS,ct)),je&&(Se["#text"]=!0),Ne&&C(Se,["html","head","body"]),Se.table&&(C(Se,["tbody"]),delete Ce.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw b('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw b('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');ne=e.TRUSTED_TYPES_POLICY,re=ne.createHTML("")}else void 0===ne&&(ne=Q(G,s)),null!==ne&&"string"==typeof re&&(re=ne.createHTML(""));o&&o(e),ut=e}},mt=C({},[...M,...R,...P]),ft=C({},[...N,...O]),gt=function(e){let t=te(e);t&&t.tagName||(t={namespaceURI:Ze,tagName:"template"});const n=p(e.tagName),r=p(t.tagName);return!!tt[e.namespaceURI]&&(e.namespaceURI===Xe?t.namespaceURI===Qe?"svg"===n:t.namespaceURI===$e?"svg"===n&&("annotation-xml"===r||rt[r]):Boolean(mt[n]):e.namespaceURI===$e?t.namespaceURI===Qe?"math"===n:t.namespaceURI===Xe?"math"===n&&it[r]:Boolean(ft[n]):e.namespaceURI===Qe?!(t.namespaceURI===Xe&&!it[r])&&!(t.namespaceURI===$e&&!rt[r])&&!ft[n]&&(ot[n]||!mt[n]):!("application/xhtml+xml"!==st||!tt[e.namespaceURI]))},vt=function(e){h(n.removed,{element:e});try{te(e).removeChild(e)}catch(t){q(e)}},yt=function(e,t){try{h(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){h(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!be[e])if(ke||Le)try{vt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},St=function(e){let t=null,n=null;if(De)e="<remove></remove>"+e;else{const t=f(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===st&&Ze===Qe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=ne?ne.createHTML(e):e;if(Ze===Qe)try{t=(new j).parseFromString(i,st)}catch(e){}if(!t||!t.documentElement){t=ie.createDocument(Ze,"template",null);try{t.documentElement.innerHTML=et?re:i}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(r.createTextNode(n),o.childNodes[0]||null),Ze===Qe?ae.call(t,Ne?"html":"body")[0]:Ne?t.documentElement:o},_t=function(e){return oe.call(e.ownerDocument||e,e,A.SHOW_ELEMENT|A.SHOW_COMMENT|A.SHOW_TEXT|A.SHOW_PROCESSING_INSTRUCTION|A.SHOW_CDATA_SECTION,null)},bt=function(e){return e instanceof U&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof F)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},xt=function(e){return"function"==typeof x&&e instanceof x};function wt(e,t,r){ce[e]&&u(ce[e],(e=>{e.call(n,t,r,ut)}))}const Ct=function(e){let t=null;if(wt("beforeSanitizeElements",e,null),bt(e))return vt(e),!0;const r=ct(e.nodeName);if(wt("uponSanitizeElement",e,{tagName:r,allowedTags:Se}),e.hasChildNodes()&&!xt(e.firstElementChild)&&_(/<[/\w]/g,e.innerHTML)&&_(/<[/\w]/g,e.textContent))return vt(e),!0;if(e.nodeType===$.progressingInstruction)return vt(e),!0;if(Pe&&e.nodeType===$.comment&&_(/<[/\w]/g,e.data))return vt(e),!0;if(!Se[r]||Ce[r]){if(!Ce[r]&&Et(r)){if(we.tagNameCheck instanceof RegExp&&_(we.tagNameCheck,r))return!1;if(we.tagNameCheck instanceof Function&&we.tagNameCheck(r))return!1}if(je&&!Ve[r]){const t=te(e)||e.parentNode,n=ee(e)||e.childNodes;if(n&&t)for(let r=n.length-1;r>=0;--r){const i=W(n[r],!0);i.__removalCount=(e.__removalCount||0)+1,t.insertBefore(i,K(e))}}return vt(e),!0}return e instanceof w&&!gt(e)?(vt(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!_(/<\/no(script|embed|frames)/i,e.innerHTML)?(Re&&e.nodeType===$.text&&(t=e.textContent,u([ue,de,he],(e=>{t=g(t,e," ")})),e.textContent!==t&&(h(n.removed,{element:e.cloneNode()}),e.textContent=t)),wt("afterSanitizeElements",e,null),!1):(vt(e),!0)},At=function(e,t,n){if(ze&&("id"===t||"name"===t)&&(n in r||n in dt))return!1;if(Te&&!Ae[t]&&_(pe,t));else if(Ee&&_(me,t));else if(!be[t]||Ae[t]){if(!(Et(e)&&(we.tagNameCheck instanceof RegExp&&_(we.tagNameCheck,e)||we.tagNameCheck instanceof Function&&we.tagNameCheck(e))&&(we.attributeNameCheck instanceof RegExp&&_(we.attributeNameCheck,t)||we.attributeNameCheck instanceof Function&&we.attributeNameCheck(t))||"is"===t&&we.allowCustomizedBuiltInElements&&(we.tagNameCheck instanceof RegExp&&_(we.tagNameCheck,n)||we.tagNameCheck instanceof Function&&we.tagNameCheck(n))))return!1}else if(Ke[t]);else if(_(ye,g(n,ge,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==v(n,"data:")||!qe[e])if(Ie&&!_(fe,g(n,ge,"")));else if(n)return!1;return!0},Et=function(e){return"annotation-xml"!==e&&f(e,ve)},Tt=function(e){wt("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:be,forceKeepAttr:void 0};let i=t.length;for(;i--;){const o=t[i],{name:s,namespaceURI:a,value:l}=o,c=ct(s);let h="value"===s?l:y(l);if(r.attrName=c,r.attrValue=h,r.keepAttr=!0,r.forceKeepAttr=void 0,wt("uponSanitizeAttribute",e,r),h=r.attrValue,!Fe||"id"!==c&&"name"!==c||(yt(s,e),h=Ue+h),Pe&&_(/((--!?|])>)|<\/(style|title)/i,h)){yt(s,e);continue}if(r.forceKeepAttr)continue;if(yt(s,e),!r.keepAttr)continue;if(!Me&&_(/\/>/i,h)){yt(s,e);continue}Re&&u([ue,de,he],(e=>{h=g(h,e," ")}));const p=ct(e.nodeName);if(At(p,c,h)){if(ne&&"object"==typeof G&&"function"==typeof G.getAttributeType)if(a);else switch(G.getAttributeType(p,c)){case"TrustedHTML":h=ne.createHTML(h);break;case"TrustedScriptURL":h=ne.createScriptURL(h)}try{a?e.setAttributeNS(a,s,h):e.setAttribute(s,h),bt(e)?vt(e):d(n.removed)}catch(e){}}}wt("afterSanitizeAttributes",e,null)},It=function e(t){let n=null;const r=_t(t);for(wt("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)wt("uponSanitizeShadowNode",n,null),Ct(n)||(n.content instanceof l&&e(n.content),Tt(n));wt("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,o=null,s=null,a=null;if(et=!e,et&&(e="\x3c!--\x3e"),"string"!=typeof e&&!xt(e)){if("function"!=typeof e.toString)throw b("toString is not a function");if("string"!=typeof(e=e.toString()))throw b("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Oe||pt(t),n.removed=[],"string"==typeof e&&(Ge=!1),Ge){if(e.nodeName){const t=ct(e.nodeName);if(!Se[t]||Ce[t])throw b("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof x)r=St("\x3c!----\x3e"),o=r.ownerDocument.importNode(e,!0),o.nodeType===$.element&&"BODY"===o.nodeName||"HTML"===o.nodeName?r=o:r.appendChild(o);else{if(!ke&&!Re&&!Ne&&-1===e.indexOf("<"))return ne&&Be?ne.createHTML(e):e;if(r=St(e),!r)return ke?null:Be?re:""}r&&De&&vt(r.firstChild);const c=_t(Ge?e:r);for(;s=c.nextNode();)Ct(s)||(s.content instanceof l&&It(s.content),Tt(s));if(Ge)return e;if(ke){if(Le)for(a=se.call(r.ownerDocument);r.firstChild;)a.appendChild(r.firstChild);else a=r;return(be.shadowroot||be.shadowrootmode)&&(a=le.call(i,a,!0)),a}let d=Ne?r.outerHTML:r.innerHTML;return Ne&&Se["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&_(J,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),Re&&u([ue,de,he],(e=>{d=g(d,e," ")})),ne&&Be?ne.createHTML(d):d},n.setConfig=function(){pt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Oe=!0},n.clearConfig=function(){ut=null,Oe=!1},n.isValidAttribute=function(e,t,n){ut||pt({});const r=ct(e),i=ct(t);return At(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&(ce[e]=ce[e]||[],h(ce[e],t))},n.removeHook=function(e){if(ce[e])return d(ce[e])},n.removeHooks=function(e){ce[e]&&(ce[e]=[])},n.removeAllHooks=function(){ce={}},n}return Z()}();var ZN=({className:e,title:t})=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",className:e,"aria-label":t,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("path",{d:"M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"}),(0,s.jsx)("path",{d:"M12 17L12.01 17"})]});var eO=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",focusable:"false",role:"img",className:e,"aria-label":t,children:[(0,s.jsx)("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),(0,s.jsx)("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]});var tO=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",focusable:"false",role:"img",className:e,"aria-label":t,children:[(0,s.jsx)("path",{d:"M10 9.5 8 12l2 2.5"}),(0,s.jsx)("path",{d:"m14 9.5 2 2.5-2 2.5"}),(0,s.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})]});c=o("85Hg2"),c=o("85Hg2");var nO=({rows:e,className:n,innerClassName:r,btnClassName:i,lineHeightMultiplier:o=1.2,defaultExpanded:a=!1,expandSymbol:l=(()=>"..."),collapseSymbol:u=(e=>"it"===e?"Mostra meno":"Show less"),children:d})=>{const{i18n:h}=Ce(),p=h.language,m=u(p),f=l(p),[g,v]=(0,c.useState)(a),[y,S]=(0,c.useState)(!1),[_,b]=(0,c.useState)(16),x=(0,c.useRef)(null);return(0,c.useEffect)((()=>{if(x.current){let t=x.current.getBoundingClientRect().height,n=getComputedStyle(x.current),r=n.lineHeight,i="normal"!==r&&(null==r?void 0:r.length)?parseInt(r,10):o*parseInt(n.fontSize,10);console.table({rows:e,lineHeight:i,height:t,maxHeight:e*i,needsExpanding:t>e*i}),b(i),t&&t>e*i&&S(!0)}}),[e,x.current]),(0,s.jsxs)("div",{className:t(Cs)("memori-expandable",n),children:[(0,s.jsx)("div",{ref:x,className:t(Cs)("memori-expandable--inner",r),style:{maxHeight:g||!y?"9999px":_*e+"px"},children:d}),y&&!g&&(0,s.jsx)(Em,{ghost:!0,padded:!1,className:i,onClick:()=>v(!0),children:f}),y&&g&&(0,s.jsx)(Em,{ghost:!0,padded:!1,className:i,onClick:()=>v(!1),children:m})]})};const rO=new Map(Object.entries({TENANT_NOT_FOUND:-1,TENANT_REGISTRATION_DISABLED:-2,TENANT_MISSING_NAME:-3,TENANT_MAX_USERS_REACHED:-4,TENANT_MAX_ADMINS_REACHED:-5,TENANT_ALREADY_EXISTS:-6,TENANT_MISSING_DESCRIPTION:-7,TENANT_CANT_SET_COMPLETION_PROVIDER:-8,USER_NOT_CONFIRMED:-11,USER_NOT_FOUND:-12,USER_OR_PASSWORD_INVALID:-13,USER_MUST_CHANGE_PASSWORD:-14,USER_MUST_ENTER_VERIFICATION_CODE:-15,USER_MISSING_TENANT:-21,USER_MISSING_NAME:-22,USER_MISSING_PASSWORD:-23,USER_MISSING_EMAIL:-24,USER_MISSING_VERIFICATION_CODE:-25,USER_NAME_ALREADY_USED:-26,USER_PASSWORD_NOT_CONFORMING_TO_POLICY:-27,USER_EMAIL_ALREADY_USED:-28,USER_EMAIL_INVALID:-29,USER_VERIFICATION_CODE_INVALID:-30,USER_MISSING_NAME_OR_EMAIL:-31,USER_NAME_INVALID:-32,USER_HAS_ONE_OR_MORE_MEMORI:-33,USER_MISSING_NEW_PASSWORD:-34,USER_CANT_CREATE_MEMORI:-35,USER_MAX_MEMORI_REACHED:-36,USER_TOO_MANY_ATTEMPTS:-38,USER_MUST_ACCEPT_TNC_AND_PP:-39,USER_BIRTH_DATE_CANT_BE_CHANGED:-40,USER_CANT_SET_COMPLETION_PROVIDER:-41,USER_CANT_ENABLE_DEEP_THOUGHT:-42,USER_CANT_ENABLE_DCM_INTEGRATION:-43,USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS:-44,USER_CREATION_BILLING_DENIED_PERMISSION:-46,USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS:-47,USER_CANT_BE_DELETED:-48,MEMORI_NOT_FOUND:-51,MEMORI_NOT_ACCESSIBLE:-52,MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN:-53,SESSION_NOT_FOUND:-101,SESSION_IS_NOT_ADMINISTRATIVE:-102,SESSION_EXPIRED:-103,MEMORI_MISSING_CONFIGURATION:-201,MEMORI_CONFIGURATION_NOT_FOUND:-202,MEMORI_INVALID_PRIVACY_TYPE:-203,MEMORI_MISSING_PASSWORD:-204,MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS:-205,MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS:-206,MEMORI_INVALID_VOICE_TYPE:-207,MEMORI_MISSING_NAME:-208,MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS:-209,MEMORI_INVALID_ID:-210,MEMORI_NAME_ALREADY_USED:-211,MEMORI_INVALID_PIN:-212,MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION:-213,MEMORI_NO_PASSWORD_WHEN_PUBLIC:-214,MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS:-215,MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS:-216,MEMORI_INVALID_COMPLETION_CONFIG:-217,MEMORI_TRANSFER_MISSING_DESTINATION_USER:-231,MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID:-232,MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT:-233,MEMORI_TRANSFER_NOTHING_TO_DO:-234,MEMORI_CONFIGURATION_CANT_BE_CHANGED:-251,MEMORI_MISSING_NEW_PASSWORD:-252,MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT:-261,MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT:-262,MEMORI_FEATURE_REQUIRES_SUBSCRIPTION:-271,INTEGRATION_NOT_FOUND:-301,INTEGRATION_INVALID_TYPE:-401,INTEGRATION_ALREADY_EXISTS:-402,INTEGRATION_MEMORI_IS_NOT_PUBLIC:-403,INTEGRATION_MISSING_INVOCATION_TEXT:-404,INTEGRATION_MISSING_DEVICE_EMAILS:-405,INTEGRATION_MEMORI_IS_EMPTY:-406,INTEGRATION_MISSING_PRIVACY_POLICY:-407,INTEGRATION_MISSING_CATEGORY:-408,INTEGRATION_MISSING_DESCRIPTION:-409,INTEGRATION_INVALID_INVOCATION_TEXT:-410,INTEGRATION_GOOGLE_NO_MORE_AVAILABLE:-411,UPLOAD_REQUIRES_MULTIPART_ENCODING:-501,UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY:-502,UPLOAD_MAX_LENGTH_EXCEEDED:-503,UPLOAD_FILE_IS_EMPTY:-504,UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE:-505,UPLOAD_MISSING_FILE_NAME:-506,UPLOAD_INVALID_MEMORY_ID:-507,UPLOAD_MISSING_FILE_CONTENT:-508,ASSET_NOT_FOUND:-601,ASSET_NOT_ACCESSIBLE:-602,ASSET_MISSING_SESSION_ID:-603,ASSET_INVALID_FILE_NAME:-604,INVITATION_NOT_FOUND:-701,INVITATION_NOT_ACCESSIBLE:-702,INVITATION_ALREADY_ACCEPTED:-703,INVITATION_ALREADY_REJECTED:-704,INVITATION_MISSING_DESTINATION_EMAIL:-705,INVITATION_DESTINATION_EMAIL_INVALID:-706,INVITATION_MISSING_TAG:-707,INVITATION_MISSING_PIN:-708,INVITATION_INVALID_PIN:-709,INVITATION_INVALID_TYPE:-710,INVITATION_MISSING_DESTINATION_NAME:-711,INVITATION_TAG_PIN_CANT_BE_CHANGED:-712,INVITATION_CANT_BE_CHANGED:-713,ACTIONLOG_INVALID_USER_ID:-801,ACTIONLOG_INVALID_DATE_FROM_FORMAT:-802,ACTIONLOG_INVALID_DATE_TO_FORMAT:-803,ACTIONLOG_INVALID_MEMORI_ID:-804,CONSUMPTIONLOG_INVALID_TYPE:-901,CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT:-902,CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT:-903,CONSUMPTIONLOG_INVALID_USER_ID:-904,CONSUMPTIONLOG_INVALID_MEMORI_ID:-905,NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD:-1001,PROCESS_INVALID_TYPE:-1401,PROCESS_ALREADY_RUNNING:-1401,PROCESS_NOT_FOUND:-1402,IMPORTCSV_MISSING_ROWS:-1501,IMPORTCSV_MISSING_CSV:-1502,IMPORTCSV_MISSING_SEPARATOR:-1503,IMPORTCSV_INVALID_SEPARATOR:-1504,IMPORTCSV_MISSING_HEADERS:-1505,IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1506,IMPORTCSV_INVALID_RECEIVER_ID:-1507,IMPORTCSV_INVALID_MEDIA_LINK:-1508,IMPORTCSV_INVALID_LINK_TITLE_HANDLING:-1509,IMPORTCSV_UNDETECTABLE_CHAR_ENCODING:-1521,IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI:-1531,IMPORTTXT_MISSING_ROWS:-1601,IMPORTTXT_INVALID_GRANULARITY:-1602,IMPORTTXT_INVALID_RECEIVER_ID:-1603,IMPORTTXT_INVALID_MEDIA_LINK:-1604,IMPORTTXT_INVALID_LINK_TITLE_HANDLING:-1605,IMPORTTXT_UNDETECTABLE_CHAR_ENCODING:-1621,IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI:-1631,IMPORTTXT_IMPORT_LIMIT_EXCEEDED:-1632,IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY:-1633,IMPORTTXT_IMPORT_REQUIRES_PAYING:-1634,IMPORTTXT_BILLING_DENIED_PERMISSION:-1635,EXPORTCSV_MISSING_CSV_SPECS:-1801,EXPORTCSV_MISSING_SEPARATOR:-1802,EXPORTCSV_INVALID_SEPARATOR:-1803,EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR:-1804,EXPORTCSV_MISSING_NEW_LINE_CHAR:-1805,EXPORTCSV_INVALID_NEW_LINE_CHAR:-1806,EXPORTCSV_MISSING_PASSWORD:-1811,EXPORTJSONL_MISSING_JSONL_SPECS:-1821,EXPORTJSONL_MISSING_PLATFORM:-1822,EXPORTJSONL_INVALID_PLATFORM:-1823,EXPORTJSONL_MISSING_PASSWORD:-1831,EXPORTJSONL_EXPORT_REQUIRES_PAYING:-1832,ANALYSIS_MISSING_QUERY:-1901,ANALYSIS_CANT_ANALYZE_SECRET_MEMORI:-1902,ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT:-1903,BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS:-2001,BADGE_ASSIGNMENT_MISSING_REF_ID:-2002,BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND:-2003,BADGE_ASSIGNMENT_MISSING_ASSERTION_URL:-2004,BADGE_ASSIGNMENT_MISSING_BADGE_URL:-2005,BADGE_ASSIGNMENT_MISSING_ISSUER_URL:-2006,BADGE_ASSIGNMENT_INVALID_URL:-2007,BADGE_ASSIGNMENT_MISSING_RECIPIENT:-2021,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE:-2022,BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY:-2023,BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE:-2024,BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE:-2025,BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY:-2026,BADGE_NOT_FOUND:-2051,OUTCOME_NO_DCM_CONFIGURED:-2071,OUTCOME_USER_BADGES_DISABLED:-2072,COMPLETION_CONFIG_MISSING_NAME:-2401,COMPLETION_CONFIG_MISSING_PROVIDER:-2402,COMPLETION_CONFIG_MISSING_ENDPOINT:-2403,COMPLETION_CONFIG_MISSING_API_KEY:-2404,COMPLETION_CONFIG_MISSING_MODEL:-2405,COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED:-2406,COMPLETION_CONFIG_INVALID_NAME:-2407,COMPLETION_CONFIG_INVALID_PURPOSE:-2411,COMPLETION_CONFIG_INVALID_ENDPOINT:-2412,COMPLETION_CONFIG_INCONSISTENT_ENDPOINT:-2413,COMPLETION_CONFIG_INVALID_PROVIDER:-2414,COMPLETION_CONFIG_NOT_FOUND:-2421,COMPLETION_CONFIG_NOT_ACCESSIBLE:-2422,COMPLETION_CONFIG_NAME_RESERVED:-2441,COMPLETION_CONFIG_NAME_ALREADY_EXISTS:-2442,COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED:-2443}).map((([e,t])=>[t,e]))),iO=e=>{if(!e)return"error.generic";if(401===e||403===e)return"error.unauthorized";if(404===e)return"error.notFound";if(422===e)return"error.unprocessableEntity";if(500===e)return"internal server error";let t=rO.get(e);return t?`errors.${t}`:"error.generic"};c=o("85Hg2");const oO=[{value:"IT",label:"Italiano"},{value:"EN",label:"English"},{value:"DE",label:"Deutsch"},{value:"ES",label:"Español"},{value:"FR",label:"Français"},{value:"PT",label:"Português"},{value:"UK",label:"Українська"},{value:"RU",label:"Русский"},{value:"PL",label:"Polski"},{value:"FI",label:"Suomi"},{value:"EL",label:"Ελληνικά"},{value:"AR",label:"العربية"},{value:"ZH",label:"中文"},{value:"JA",label:"日本語"}],sO=["en","it","fr","es","de"],aO=["image/jpeg","image/png","image/jpg","image/gif","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/pdf","video/mp4","video/avi","audio/mpeg3","audio/wav","audio/mpeg","video/mpeg","model/gltf-binary"],lO="👤",cO=[{name:"text",lang:"text",mimeType:"text/plain",monacoLang:"plaintext",executable:!0},{name:"javascript/jsx",lang:"jsx",mimeType:"text/javascript",monacoLang:"javascript",executable:!0},{name:"typescript/tsx",lang:"tsx",mimeType:"text/ecmascript",monacoLang:"typescript",executable:!0},{name:"json",lang:"json",mimeType:"application/json",monacoLang:"json",executable:!0},{name:"css",lang:"scss",mimeType:"text/css",monacoLang:"css",executable:!0},{name:"html/xml",lang:"tsx",mimeType:"application/xml",monacoLang:"xml"},{name:"bash",lang:"bash",mimeType:"application/x-sh",monacoLang:"shell"},{name:"python",lang:"python",mimeType:"text/x-python",monacoLang:"python"},{name:"cpp/csharp",lang:"cpp",mimeType:"text/x-c++src",monacoLang:"cpp"},{name:"php",lang:"php",mimeType:"application/x-php",monacoLang:"php"},{name:"ruby",lang:"ruby",mimeType:"text/x-ruby",monacoLang:"ruby"},{name:"sql",lang:"sql",mimeType:"text/x-sql",monacoLang:"sql"}],uO={it:[{text:"",delayAfter:10},{text:"Cerco l'esperto più adatto",delayAfter:5},{text:"Contatto l'esperto",delayAfter:3},{text:"Spiego all'esperto la domanda",delayAfter:2},{text:"L'esperto sta preparando una risposta",delayAfter:6},{text:"Genero una risposta adatta",delayAfter:3}],en:[{text:"",delayAfter:10},{text:"I'm looking for the most suitable expert",delayAfter:5},{text:"I'm contacting the expert",delayAfter:3},{text:"I'm explaining the question to the expert",delayAfter:2},{text:"The expert is preparing an answer",delayAfter:6},{text:"I am generating a suitable answer",delayAfter:3}]};var dO=({medium:e,className:n,preview:r=!1,showCopyButton:i=!0})=>{var o,a,l,u,d;const{t:h}=Ce();return(0,c.useEffect)((()=>{(()=>{if(document.getElementById("memori-prism-script"))return;const e=document.createElement("script");e.src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/prism.min.js",e.async=!0,e.id="memori-prism-script";const t=document.createElement("script");t.src="https://cdn.jsdelivr.net/npm/prismjs@v1.29.0/plugins/autoloader/prism-autoloader.min.js",t.async=!0,t.id="memori-prism-autoloader-script";const n=document.createElement("link");n.rel="stylesheet",n.href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-tomorrow.min.css",document.head.appendChild(n),document.head.appendChild(e),document.head.appendChild(t)})()}),[]),(0,c.useEffect)((()=>{"Prism"in window&&window.Prism.highlightAll&&Prism.highlightAll()}),[e.content]),(0,s.jsxs)("div",{className:"memori-snippet",children:[(0,s.jsxs)("div",{className:"memori-snippet--content",children:[(0,s.jsx)("pre",{className:t(Cs)("line-numbers",n),"aria-labelledby":(null===(o=e.title)||void 0===o?void 0:o.length)?`#snippet-${e.mediumID}`:void 0,children:(0,s.jsx)("code",{className:`language-${null!==(l=null===(a=cO.find((t=>e.mimeType===t.mimeType)))||void 0===a?void 0:a.lang)&&void 0!==l?l:"text"}`,children:(null===(u=e.content)||void 0===u?void 0:u.length)&&e.content.length>200&&r?`${e.content.slice(0,200)}\n...`:`${e.content}`})}),i&&(0,s.jsx)(Em,{padded:!1,ghost:!0,className:"memori-snippet--copy-button",title:h("copy")||"Copy",icon:(0,s.jsx)(eO,{}),onClick:()=>{var t;return navigator.clipboard.writeText(null!==(t=e.content)&&void 0!==t?t:"")}})]}),!!(null===(d=e.title)||void 0===d?void 0:d.length)&&(0,s.jsx)("p",{id:`snippet-${e.mediumID}`,className:"memori-snippet--caption",children:e.title})]})};c=o("85Hg2"),c=o("85Hg2");var hO,pO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M574 665.4a8.03 8.03 0 0 0-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 0 0-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 0 0 0 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 0 0 0 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 0 0-11.3 0L372.3 598.7a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z"})}),mO={};hO=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};function n(e,n){var r=e.el,i=e.elStyle,o=e.elHeight,s=e.rowsLimit,a=e.rowsWrapped,l=e.options,c=e.buffer,u=c;if(a===s+1)return t({},e);var d=c,h=a,p=o;return r.innerHTML=u=c.length?""+c+l.delimiter+n+l.replaceStr:""+n+l.replaceStr,parseFloat(i.height)>parseFloat(o)&&(h++,p=i.height,h===s+1)?(r.innerHTML=u="."===d[d.length-1]&&"..."===l.replaceStr?d+"..":""+d+l.replaceStr,t({},e,{elHeight:p,rowsWrapped:h})):(r.innerHTML=u=d.length?""+d+l.delimiter+n:""+n,t({},e,{buffer:u,elHeight:p,rowsWrapped:h}))}e.disableResponsive=function(e){window.removeEventListener("resize",e)},e.ellipsis=function e(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s={replaceStr:"...",responsive:!1,debounceDelay:250,delimiter:" "},a=t({},s,o),l=r&&(r instanceof NodeList?r:1===r.nodeType?[r]:document.querySelectorAll(r)),c=[],u=0;u<l.length;u++){var d=l[u];c[u]=d.innerHTML;var h=d.innerHTML.split(a.delimiter);d.innerHTML="";var p=window.getComputedStyle(d);h.reduce(n,{el:d,buffer:d.innerHTML,elStyle:p,elHeight:0,rowsLimit:i,rowsWrapped:0,options:a})}if(a.responsive){var m=!1,f=window.innerWidth,g=function(){if(window.innerWidth!==f){f=window.innerWidth;for(var n=0;n<l.length;n++)l[n].innerHTML=c[n];e(r,i,t({},o,{responsive:!1}))}},v=function(){clearTimeout(m),m=setTimeout(g,a.debounceDelay)};return window.addEventListener("resize",v),v}}},"function"==typeof define&&define.amd?define(["exports"],hO):hO(mO);var fO=({loading:e=!1,className:n,title:r,description:i,cover:o,hoverable:a=!1,children:l})=>(0,s.jsx)("div",{className:t(Cs)("memori-card",n,{"memori-card--loading":e,"memori-card--with-cover":o,"memori-card--hoverable":a}),children:(0,s.jsxs)(Am,{spinning:e,children:[o&&(0,s.jsx)("div",{className:"memori-card--cover",children:o}),(0,s.jsxs)("div",{className:"memori-card--content",children:[r&&(0,s.jsx)("h3",{className:"memori-card--title",children:r}),i&&(0,s.jsx)("p",{className:"memori-card--description",children:i}),(0,s.jsx)("div",{className:"memori-card--children",children:l})]})]})});const gO=({isChild:e=!1,item:n,baseUrl:r,onLinkPreviewInfo:i,descriptionOneLine:o=!1})=>{var a,l,u,d;const[h,p]=(0,c.useState)(null),m=(null===(a=n.url)||void 0===a?void 0:a.startsWith("http"))||!n.url||0===(null===(l=n.url)||void 0===l?void 0:l.length)?n.url:`https://${n.url}`;(0,c.useEffect)((()=>{var e,t;let o=(null===(e=n.url)||void 0===e?void 0:e.startsWith("http"))||!n.url||0===(null===(t=n.url)||void 0===t?void 0:t.length)?n.url:`https://${n.url}`;o&&o!==(null==h?void 0:h.urlKey)&&(async(e,t)=>{try{const n=await fetch(`${t||"https://aisuru.com"}/api/linkpreview/${encodeURIComponent(e)}`);return await n.json()}catch(e){return console.error("getSiteInfo",e),null}})(o,r).then((e=>{p(e?{...e,urlKey:o}:null),i&&e&&i(e)}))}),[null==n?void 0:n.url,r,i]);const f=n.title&&n.title.length>0?n.title:null==h?void 0:h.title,g=null==h?void 0:h.description,v=null==h?void 0:h.video,y=null!==(u=null==h?void 0:h.image)&&void 0!==u?u:null===(d=null==h?void 0:h.images)||void 0===d?void 0:d[0];return(0,c.useEffect)((()=>{setTimeout((()=>{(0,mO.ellipsis)(".memori-link-item--card .memori-card--description",3,{responsive:!0})}),300)}),[g,n.mediumID]),(0,s.jsx)("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:t(Cs)("memori-link-item--link",{"memori-link-item--link--child":e}),onClick:t=>{e||(t.preventDefault(),t.stopPropagation(),window.open(m,"_blank",`toolbar=yes,top=${.1*window.innerHeight},left=${.1*window.innerWidth},width=${.8*window.innerWidth},height=${.8*window.innerHeight}`))},children:(0,s.jsx)(fO,{hoverable:!0,className:t(Cs)("memori-link-item--card",{"memori-link-item--card-description-oneline":o,"memori-link-item--card-has-image":y,"memori-link-item--card-has-video":v}),cover:v?(0,s.jsx)("iframe",{width:"100%",height:"100%",src:v,title:"Video player",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}):y?(0,s.jsx)("img",{className:"memori-link-item--card-cover-img",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg==",srcSet:y.includes("data:image")?void 0:y.startsWith("https")?y:`https://${y.replace("http://","")}`,alt:n.title}):(0,s.jsx)("div",{className:"memori-link-item--card-cover-icon",children:(0,s.jsx)(pO,{className:"memori-link-item--icon"})}),title:f,description:g})})};var vO=({items:e,baseUrl:t,descriptionOneLine:n=!1,onLinkPreviewInfo:r})=>(0,s.jsx)(lp,{appear:!0,show:!0,as:"div",className:"memori-link-items",children:(0,s.jsx)("div",{className:"memori-link-items--grid",children:e.map(((e,i)=>(0,s.jsx)(lp.Child,{as:"div",className:"memori-link-item",enter:"ease-out duration-500 delay-"+100*i,enterFrom:"opacity-0 scale-95",enterTo:"opacity-1 scale-100",leave:"ease-in duration-300",leaveFrom:"opacity-1 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsx)(gO,{item:e,baseUrl:t,descriptionOneLine:n,onLinkPreviewInfo:r})},e.mediumID)))})});c=o("85Hg2");const yO=["va bene","no grazie","si","no","sì","arrivederci","non c'entrava","non mi è piaciuto"],SO=async(e,t,n,r)=>{var i;let o=(e=>e.replaceAll(/<output.*?>(.*?)<\/output>/g,""))(e);const s=yO.indexOf(e.toLowerCase())>-1?"IT":null==n?void 0:n.toUpperCase(),a=t.toUpperCase(),l=await fetch(`${r||"https://www.aisuru.com"}/api/translate`,{cache:"no-cache",method:"POST",body:JSON.stringify({text:o,target_lang:a,source_lang:s}),headers:{Accept:"*/*","Content-Type":"application/json"}}),c=await l.json();return null===(i=null==c?void 0:c.translations)||void 0===i?void 0:i[0]};c=o("85Hg2");var _O=({src:e,poster:t,alt:n=""})=>((0,c.useEffect)((()=>{const e=document.createElement("script");return e.src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js",e.type="module",document.head.appendChild(e),()=>{document.head.removeChild(e)}}),[]),(0,s.jsx)("div",{className:"model-viewer",children:(0,s.jsx)("model-viewer",{src:e,"ios-src":"",poster:t,alt:n,"shadow-intensity":"1","disable-zoom":!0,"camera-controls":!0,autoplay:!0})}));var bO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"})});var xO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M531.3 574.4l.3-1.4c5.8-23.9 13.1-53.7 7.4-80.7-3.8-21.3-19.5-29.6-32.9-30.2-15.8-.7-29.9 8.3-33.4 21.4-6.6 24-.7 56.8 10.1 98.6-13.6 32.4-35.3 79.5-51.2 107.5-29.6 15.3-69.3 38.9-75.2 68.7-1.2 5.5.2 12.5 3.5 18.8 3.7 7 9.6 12.4 16.5 15 3 1.1 6.6 2 10.8 2 17.6 0 46.1-14.2 84.1-79.4 5.8-1.9 11.8-3.9 17.6-5.9 27.2-9.2 55.4-18.8 80.9-23.1 28.2 15.1 60.3 24.8 82.1 24.8 21.6 0 30.1-12.8 33.3-20.5 5.6-13.5 2.9-30.5-6.2-39.6-13.2-13-45.3-16.4-95.3-10.2-24.6-15-40.7-35.4-52.4-65.8zM421.6 726.3c-13.9 20.2-24.4 30.3-30.1 34.7 6.7-12.3 19.8-25.3 30.1-34.7zm87.6-235.5c5.2 8.9 4.5 35.8.5 49.4-4.9-19.9-5.6-48.1-2.7-51.4.8.1 1.5.7 2.2 2zm-1.6 120.5c10.7 18.5 24.2 34.4 39.1 46.2-21.6 4.9-41.3 13-58.9 20.2-4.2 1.7-8.3 3.4-12.3 5 13.3-24.1 24.4-51.4 32.1-71.4zm155.6 65.5c.1.2.2.5-.4.9h-.2l-.2.3c-.8.5-9 5.3-44.3-8.6 40.6-1.9 45 7.3 45.1 7.4zm191.4-388.2L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z"})});var wO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0 0 10.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 0 0-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"})});var CO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 0 0-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 0 0-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"})});const AO=({isChild:e=!1,item:t,sessionID:n,tenantID:r,preview:i=!1,baseURL:o,apiURL:a,onClick:l,customMediaRenderer:c})=>{var u,d;const h=AN({resourceURI:t.url,sessionID:n,tenantID:r,baseURL:o,apiURL:a}),p=null==c?void 0:c(t.mimeType);if(p)return p;const m=(null===(u=t.url)||void 0===u?void 0:u.startsWith("rgb("))||(null===(d=t.url)||void 0===d?void 0:d.startsWith("rgba("));switch(t.mimeType){case"image/jpeg":case"image/png":case"image/jpg":case"image/gif":return m?(0,s.jsx)(fO,{hoverable:!0,className:"memori-media-item--card memori-media-item--image",cover:(0,s.jsxs)("picture",{className:"memori-media-item--figure",children:[(0,s.jsx)("div",{className:"memori-media-item--rgb-item",style:{backgroundColor:t.url}}),t.title&&(0,s.jsx)("figcaption",{className:"memori-media-item--figure-caption",children:t.title})]})}):(0,s.jsx)("a",{className:"memori-media-item--link",href:t.url,onClick:n=>{e&&n.preventDefault(),l&&(n.preventDefault(),l(t.mediumID))},target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,className:"memori-media-item--card memori-media-item--image",cover:(0,s.jsxs)("picture",{className:"memori-media-item--figure",children:[!i&&(0,s.jsx)("source",{srcSet:[h,t.url,t.content].join(", "),type:t.mimeType}),(0,s.jsx)("img",{alt:t.title,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="}),t.title&&(0,s.jsx)("figcaption",{className:"memori-media-item--figure-caption",children:t.title})]})})});case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsx)(CO,{className:"memori-media-item--icon"}),title:t.title})});case"application/vnd.ms-excel":case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsx)(wO,{className:"memori-media-item--icon"}),title:t.title})});case"application/pdf":return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsx)(xO,{className:"memori-media-item--icon"}),title:t.title})});case"video/mp4":case"video/quicktime":case"video/avi":case"video/mpeg":return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,onClick:n=>{e&&n.preventDefault(),l&&(n.preventDefault(),l(t.mediumID))},target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsxs)("video",{style:{width:"100%",height:"100%"},controls:!0,src:h,title:t.title,children:["video/quicktime"===t.mimeType&&(0,s.jsx)("source",{src:t.url,type:"video/mp4"}),(0,s.jsx)("source",{src:t.url,type:t.mimeType}),"Your browser does not support this video format.",(0,s.jsx)("br",{}),(0,s.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:"Download the video"})]}),title:t.title})});case"audio/mpeg3":case"audio/wav":case"audio/mpeg":return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsx)("audio",{style:{width:"100%",height:"100%"},controls:!0,src:h}),title:t.title})});case"model/gltf-binary":return(0,s.jsx)(_O,{src:h,alt:"",poster:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=="});default:return(0,s.jsx)("a",{className:"memori-media-item--link",href:h,target:"_blank",rel:"noopener noreferrer",title:t.title,children:(0,s.jsx)(fO,{hoverable:!0,cover:(0,s.jsx)(bO,{className:"memori-media-item--icon"}),title:t.title})})}};var EO=(0,c.memo)((({items:e,sessionID:t,tenantID:n,translateTo:r,baseURL:i,apiURL:o,customMediaRenderer:a})=>{const[l,u]=(0,c.useState)(e),[d,h]=(0,c.useState)(),p=(0,c.useCallback)((async()=>{if(!r)return;const t=await Promise.all((null!=e?e:[]).map((async e=>{var t;if(!e.title)return e;try{const n=await SO(e.title,r);return{...e,title:null!==(t=n.text)&&void 0!==t?t:e.title}}catch(t){return console.error(t),e}})));u(t)}),[r,e]);(0,c.useEffect)((()=>{r&&p()}),[r,p]);const m=l.filter((e=>{var t;return!(null===(t=e.properties)||void 0===t?void 0:t.executable)&&!cO.map((e=>e.mimeType)).includes(e.mimeType)})).sort(((e,t)=>e.creationTimestamp>t.creationTimestamp?1:e.creationTimestamp<t.creationTimestamp?-1:0)),f=l.filter((e=>{var t;return!(null===(t=e.properties)||void 0===t?void 0:t.executable)&&cO.map((e=>e.mimeType)).includes(e.mimeType)})),g=l.filter((e=>{var t;return"text/css"===e.mimeType&&!!(null===(t=e.properties)||void 0===t?void 0:t.executable)}));return(0,s.jsxs)(lp,{appear:!0,show:!0,as:"div",className:"memori-media-items",children:[!!m.length&&(0,s.jsx)("div",{className:"memori-media-items--grid",children:m.map(((e,r)=>(0,s.jsx)(lp.Child,{as:"div",className:"memori-media-item",enter:"ease-out duration-500 delay-"+100*r,enterFrom:"opacity-0 scale-95",enterTo:"opacity-1 scale-100",leave:"ease-in duration-300",leaveFrom:"opacity-1 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsx)(AO,{isChild:!0,sessionID:t,tenantID:n,baseURL:i,apiURL:o,onClick:e=>{h(l.find((t=>t.mediumID===e)))},item:{...e,title:e.title,url:e.url,content:e.content},customMediaRenderer:a})},e.url+"&index="+r)))}),f.map((e=>(0,s.jsx)(lp.Child,{as:"div",className:"memori-media-item--snippet",enter:"ease-out duration-500",enterFrom:"opacity-0 translate-y-1",enterTo:"opacity-1 translate-y-0",leave:"ease-in duration-300",leaveFrom:"opacity-1",leaveTo:"opacity-0",children:(0,s.jsx)(dO,{medium:e},e.mediumID)},e.mediumID))),g.map((e=>(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:e.content||""}},e.mediumID))),(null==d?void 0:d.mediumID)&&(0,s.jsx)(nP,{width:"100%",widthMd:"100%",className:"memori-media-item--modal",open:!!d,onClose:()=>h(void 0),footer:null,children:(0,s.jsx)(AO,{isChild:!0,sessionID:t,tenantID:n,baseURL:i,apiURL:o,item:{...d,title:d.title,url:d.url,content:d.content},customMediaRenderer:a})})]})}));var TO=(0,c.memo)((({hints:e=[],links:n=[],media:r=[],simulateUserPrompt:i=(()=>{}),sessionID:o,baseUrl:a,apiUrl:l,translateTo:u,customMediaRenderer:d})=>{const{t:h}=Ce(),[p,m]=(0,c.useState)(!0),[f,g]=(0,c.useState)(6);return(0,c.useEffect)((()=>{m(!0)}),[e]),(0,s.jsxs)("div",{className:"memori-media-widget",children:[(null==r?void 0:r.length)>0&&(0,s.jsx)(EO,{items:r,sessionID:o,translateTo:u,baseURL:a,apiURL:l,customMediaRenderer:d}),(null==n?void 0:n.length)>0&&(0,s.jsx)(vO,{items:n,baseUrl:a}),(null==e?void 0:e.length)>0&&p&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lp,{appear:!0,show:!0,as:"ul",className:"memori-media--hints",children:e.slice(0,f).map(((e,n)=>(0,s.jsx)(lp.Child,{as:"li",enter:"ease-out duration-500",enterFrom:"opacity-0 translate-y-1",enterTo:"opacity-1 translate-y-0",leave:"ease-in duration-300",leaveFrom:"opacity-1",leaveTo:"opacity-0",children:(0,s.jsx)(Em,{className:t(Cs)("memori-media--hint"),primary:!0,onClick:()=>{i(e.originalText,e.text),m(!1)},onTouchEnd:()=>{i(e.originalText,e.text),m(!1)},children:e.text},e.text+n)},e.text+n)))}),e.length>f&&(0,s.jsx)("div",{className:"memori-hints--show-more",children:(0,s.jsx)(Em,{className:"memori-hints--show-more-button",id:"showMoreHints",onClick:()=>g(f+6),children:h("expand")||"Expand"})})]})]})}));const IO=e=>e.endsWith("?")?e:`${e}?`;var MO=({message:e,apiURL:n,sessionID:r,visible:i=!0,initialMatches:o=[],closeDrawer:a,_TEST_loading:l=!1})=>{const{t:u}=Ce(),d=Z(n).search.searchMemory,[h,p]=(0,c.useState)(o),[m,f]=(0,c.useState)(l),g=(0,c.useCallback)((async()=>{if(f(!0),!l){try{const{matches:n,...i}=await d(r,{searchType:"Semantic",numberOfResults:3,text:e.questionAnswered,date:e.date,placeName:e.placeName,placeLatitude:e.placeLatitude,placeLongitude:e.placeLongitude,placeUncertaintyKm:e.placeUncertaintyKm,contextVars:e.contextVars,tag:e.tag,memoryTags:e.memoryTags});0!==i.resultCode?(console.error(i),t(ed).error(u(iO(i.resultCode)))):p(null!=n?n:[])}catch(e){console.error("WHYTHISANSWER/FETCH",e),p(null!=o?o:[])}f(!1)}}),[e,r]);return(0,c.useEffect)((()=>{g()}),[g,e,r]),(0,s.jsxs)(Im,{open:i,width:"80%",animated:!1,className:"memori-whythisanswer-drawer",onClose:()=>a(),title:u("whyThisAnswer"),children:[(0,s.jsx)("p",{children:u("whyThisAnswerHelper")}),e.questionAnswered&&(0,s.jsxs)("p",{className:"memori--whythisanswer-question-answered",children:[(0,s.jsxs)("strong",{children:[u("question")||"Question",":"]})," ",e.questionAnswered]}),(0,s.jsxs)(Am,{primary:!0,spinning:m,children:[!m&&0===h.length&&(0,s.jsx)("p",{role:"info",className:"memori--whythisanswer-no-results",children:u("nothingFound")}),m&&0===h.length&&(0,s.jsxs)("ul",{className:"memori--whythisanswer-list memori--whythisanswer-skeleton",children:[(0,s.jsxs)("li",{children:[(0,s.jsxs)("div",{className:"memori--whythisanswer-title",children:[(0,s.jsx)("span",{className:"memori--whythisanswer-confidence",children:(0,s.jsx)("span",{className:"memori--whythisanswer-skeleton-text"})}),(0,s.jsx)("div",{className:"memori--whythisanswer-title-text",children:(0,s.jsx)("p",{className:"memori--whythisanswer-skeleton-text"})})]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-text"}),(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-text"}),(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-text"})]}),(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-block"})]}),(0,s.jsxs)("li",{children:[(0,s.jsxs)("div",{className:"memori--whythisanswer-title",children:[(0,s.jsx)("span",{className:"memori--whythisanswer-confidence",children:(0,s.jsx)("span",{className:"memori--whythisanswer-skeleton-text"})}),(0,s.jsxs)("div",{className:"memori--whythisanswer-title-text",children:[(0,s.jsx)("p",{className:"memori--whythisanswer-skeleton-text"}),(0,s.jsx)("p",{className:"memori--whythisanswer-skeleton-text"})]})]}),(0,s.jsxs)("p",{children:[(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-text"}),(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-text"})]}),(0,s.jsx)("div",{className:"memori--whythisanswer-skeleton-block"})]})]}),h.length>0&&(0,s.jsx)("ul",{className:"memori--whythisanswer-list",children:h.map((e=>{var t,n,r,i,o,a,l;return(0,s.jsxs)("li",{children:[(0,s.jsxs)("div",{className:"memori--whythisanswer-title",children:[(0,s.jsx)("span",{className:"memori--whythisanswer-confidence",children:e.confidenceLevel}),(0,s.jsxs)("div",{className:"memori--whythisanswer-title-text",children:[(0,s.jsx)("p",{children:(0,s.jsx)("strong",{children:IO(null!==(t=e.memory.title)&&void 0!==t?t:"")})}),(0,s.jsx)("p",{children:null===(r=null===(n=e.memory.titleVariants)||void 0===n?void 0:n.map((e=>IO(e))))||void 0===r?void 0:r.join(" | ")})]})]}),null===(i=e.memory.answers)||void 0===i?void 0:i.map(((e,t)=>(0,s.jsx)("p",{className:"memori--whythisanswer-answer",children:(0,s.jsx)(nO,{rows:3,children:e.text})},t))),(0,s.jsx)(TO,{links:null===(o=e.memory.media)||void 0===o?void 0:o.filter((e=>"text/html"===e.mimeType))}),null===(l=null===(a=e.memory.media)||void 0===a?void 0:a.filter((e=>"text/plain"===e.mimeType)))||void 0===l?void 0:l.map((e=>(0,s.jsx)(nO,{rows:2,lineHeightMultiplier:2,innerClassName:"memori--whythisanswer-snippet-expandable",children:(0,s.jsx)(dO,{medium:e,showCopyButton:!1},e.mediumID)},e.mediumID)))]},e.memory.memoryID)}))})]})]})};c=o("85Hg2");var RO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"})});var PO=({previewFiles:e,removeFile:t,allowRemove:n=!0,isMessagePreview:r=!1})=>{const[i,o]=(0,c.useState)(null),[a,l]=(0,c.useState)(null);return(0,s.jsxs)(s.Fragment,{children:[e.length>0&&(0,s.jsx)("div",{className:"memori--preview-container "+(r?"memori--message-preview":"memori--absolute-preview"),children:(0,s.jsx)("div",{className:"memori--preview-list",children:e.map((e=>(0,s.jsxs)("div",{className:"memori--preview-item",onMouseEnter:()=>l(e.id),onMouseLeave:()=>l(null),onClick:()=>o(e),children:[(0,s.jsx)(RO,{className:"memori--preview-icon"}),(0,s.jsx)("span",{className:"memori--preview-filename",children:e.name}),n&&(0,s.jsx)(Em,{shape:"rounded",icon:(0,s.jsx)(Tm,{}),danger:!0,className:"memori--remove-button "+(a===e.id?"visible":""),onClick:n=>{n.stopPropagation(),t(e.id)}})]},e.id)))})}),(0,s.jsx)(nP,{width:"80%",widthMd:"80%",open:!!i,className:"memori--modal-preview-file",onClose:()=>o(null),closable:!0,title:null==i?void 0:i.name,children:(0,s.jsx)("div",{className:"memori--preview-content",style:{whiteSpace:"pre-wrap",maxHeight:"70vh",overflowY:"auto"},children:null==i?void 0:i.content})})]})},NO={};NO=function(){"use strict";var e=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,t=/[\0-\x1F\x7F-\x9F]/,n=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,r=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;function i(i){const o={};i=i||{},o.src_Any=e.source,o.src_Cc=t.source,o.src_Z=r.source,o.src_P=n.source,o.src_ZPCc=[o.src_Z,o.src_P,o.src_Cc].join("|"),o.src_ZCc=[o.src_Z,o.src_Cc].join("|");const s="[><|]";return o.src_pseudo_letter="(?:(?!"+s+"|"+o.src_ZPCc+")"+o.src_Any+")",o.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",o.src_auth="(?:(?:(?!"+o.src_ZCc+"|[@/\\[\\]()]).)+@)?",o.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",o.src_host_terminator="(?=$|"+s+"|"+o.src_ZPCc+")(?!"+(i["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+o.src_ZPCc+"))",o.src_path="(?:[/?#](?:(?!"+o.src_ZCc+"|"+s+"|[()[\\]{}.,\"'?!\\-;]).|\\[(?:(?!"+o.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+o.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+o.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+o.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+o.src_ZCc+"|[']).)+\\'|\\'(?="+o.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+o.src_ZCc+"|[.]|$)|"+(i["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+o.src_ZCc+"|$)|;(?!"+o.src_ZCc+"|$)|\\!+(?!"+o.src_ZCc+"|[!]|$)|\\?(?!"+o.src_ZCc+"|[?]|$))+|\\/)?",o.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',o.src_xn="xn--[a-z0-9\\-]{1,59}",o.src_domain_root="(?:"+o.src_xn+"|"+o.src_pseudo_letter+"{1,63})",o.src_domain="(?:"+o.src_xn+"|(?:"+o.src_pseudo_letter+")|(?:"+o.src_pseudo_letter+"(?:-|"+o.src_pseudo_letter+"){0,61}"+o.src_pseudo_letter+"))",o.src_host="(?:(?:(?:(?:"+o.src_domain+")\\.)*"+o.src_domain+"))",o.tpl_host_fuzzy="(?:"+o.src_ip4+"|(?:(?:(?:"+o.src_domain+")\\.)+(?:%TLDS%)))",o.tpl_host_no_ip_fuzzy="(?:(?:(?:"+o.src_domain+")\\.)+(?:%TLDS%))",o.src_host_strict=o.src_host+o.src_host_terminator,o.tpl_host_fuzzy_strict=o.tpl_host_fuzzy+o.src_host_terminator,o.src_host_port_strict=o.src_host+o.src_port+o.src_host_terminator,o.tpl_host_port_fuzzy_strict=o.tpl_host_fuzzy+o.src_port+o.src_host_terminator,o.tpl_host_port_no_ip_fuzzy_strict=o.tpl_host_no_ip_fuzzy+o.src_port+o.src_host_terminator,o.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+o.src_ZPCc+"|>|$))",o.tpl_email_fuzzy="(^|"+s+'|"|\\(|'+o.src_ZCc+")("+o.src_email_name+"@"+o.tpl_host_fuzzy_strict+")",o.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+o.src_ZPCc+"))((?![$+<=>^`||])"+o.tpl_host_port_fuzzy_strict+o.src_path+")",o.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+o.src_ZPCc+"))((?![$+<=>^`||])"+o.tpl_host_port_no_ip_fuzzy_strict+o.src_path+")",o}function o(e){return Array.prototype.slice.call(arguments,1).forEach((function(t){t&&Object.keys(t).forEach((function(n){e[n]=t[n]}))})),e}function s(e){return Object.prototype.toString.call(e)}function a(e){return"[object String]"===s(e)}function l(e){return"[object Object]"===s(e)}function c(e){return"[object RegExp]"===s(e)}function u(e){return"[object Function]"===s(e)}function d(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const h={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function p(e){return Object.keys(e||{}).reduce((function(e,t){return e||h.hasOwnProperty(t)}),!1)}const m={"http:":{validate:function(e,t,n){const r=e.slice(t);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,n){const r=e.slice(t);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?t>=3&&":"===e[t-3]||t>=3&&"/"===e[t-3]?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){const r=e.slice(t);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},f="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",g="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function v(e){e.__index__=-1,e.__text_cache__=""}function y(e){return function(t,n){const r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function S(){return function(e,t){t.normalize(e)}}function _(e){const t=e.re=i(e.__opts__),n=e.__tlds__.slice();function r(e){return e.replace("%TLDS%",t.src_tlds)}e.onCompile(),e.__tlds_replaced__||n.push(f),n.push(t.src_xn),t.src_tlds=n.join("|"),t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),"i");const o=[];function s(e,t){throw new Error('(LinkifyIt) Invalid schema "'+e+'": '+t)}e.__compiled__={},Object.keys(e.__schemas__).forEach((function(t){const n=e.__schemas__[t];if(null===n)return;const r={validate:null,link:null};if(e.__compiled__[t]=r,l(n))return c(n.validate)?r.validate=y(n.validate):u(n.validate)?r.validate=n.validate:s(t,n),void(u(n.normalize)?r.normalize=n.normalize:n.normalize?s(t,n):r.normalize=S());a(n)?o.push(t):s(t,n)})),o.forEach((function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)})),e.__compiled__[""]={validate:null,normalize:S()};const h=Object.keys(e.__compiled__).filter((function(t){return t.length>0&&e.__compiled__[t]})).map(d).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+h+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+t.src_ZPCc+"))("+h+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),v(e)}function b(e,t){const n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function x(e,t){const n=new b(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function w(e,t){if(!(this instanceof w))return new w(e,t);t||p(e)&&(t=e,e={}),this.__opts__=o({},h,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=o({},m,e),this.__compiled__={},this.__tlds__=g,this.__tlds_replaced__=!1,this.re={},_(this)}function C(e={},t={}){const n=new w(e,t);return E(n,t),{extensions:[{name:"autolink",level:"inline",start:e=>{const t=A(n,e);if(t)return t.index},tokenizer(e){if(this.lexer.state.inLink)return;const t=A(n,e);if(!t)return;let r;return 0===t.index?r=t.raw:1===t.index&&"<"===e.charAt(0)&&">"===e.charAt(t.lastIndex)&&(r=`<${t.raw}>`),r?{type:"link",raw:r,text:t.text,href:t.url,tokens:[{type:"text",raw:t.text,text:t.text}]}:void 0}}]}}function A(e,t){const n=e.match(t);if(n&&n.length)return n[0]}function E(e,t){const n=t.tlds;delete t.tlds;const r=t.tldsKeepOld;delete t.tldsKeepOld,n&&e.tlds(n,r)}return w.prototype.add=function(e,t){return this.__schemas__[e]=t,_(this),this},w.prototype.set=function(e){return this.__opts__=o(this.__opts__,e),this},w.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let t,n,r,i,o,s,a,l,c;if(this.re.schema_test.test(e))for(a=this.re.schema_search,a.lastIndex=0;null!==(t=a.exec(e));)if(i=this.testSchemaAt(e,t[2],a.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=e.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l<this.__index__)&&null!==(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(o=n.index+n[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(c=e.indexOf("@"),c>=0&&null!==(r=e.match(this.re.email_fuzzy))&&(o=r.index+r[1].length,s=r.index+r[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&s>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=s))),this.__index__>=0},w.prototype.pretest=function(e){return this.re.pretest.test(e)},w.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},w.prototype.match=function(e){const t=[];let n=0;this.__index__>=0&&this.__text_cache__===e&&(t.push(x(this,n)),n=this.__last_index__);let r=n?e.slice(n):e;for(;this.test(r);)t.push(x(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return t.length?t:null},w.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const t=this.re.schema_at_start.exec(e);if(!t)return null;const n=this.testSchemaAt(e,t[2],t[0].length);return n?(this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+n,x(this,0)):null},w.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter((function(e,t,n){return e!==n[t-1]})).reverse(),_(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,_(this),this)},w.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},w.prototype.onCompile=function(){},C}();var OO={};OO=function(e){"use strict";const t=/^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1(?=[\s?!\.,:?!。,:]|$)/,n=/^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\1/,r=/^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;function i(e={}){return{extensions:[s(e,o(e,!1)),a(e,o(e,!0))]}}function o(t,n){return r=>e.renderToString(r.text,{...t,displayMode:r.displayMode})+(n?"\n":"")}function s(e,r){const i=e&&e.nonStandard,o=i?n:t;return{name:"inlineKatex",level:"inline",start(e){let t,n=e;for(;n;){if(t=n.indexOf("$"),-1===t)return;if((i?t>-1:0===t||" "===n.charAt(t-1))&&n.substring(t).match(o))return t;n=n.substring(t+1).replace(/^\$+/,"")}},tokenizer(e,t){const n=e.match(o);if(n)return{type:"inlineKatex",raw:n[0],text:n[2].trim(),displayMode:2===n[1].length}},renderer:r}}function a(e,t){return{name:"blockKatex",level:"block",tokenizer(e,t){const n=e.match(r);if(n)return{type:"blockKatex",raw:n[0],text:n[2].trim(),displayMode:2===n[1].length}},renderer:t}}return i}(o("kqAxc"));const DO=(e,t,n,r)=>{if(!t.rowspan)return"";return`${`<${n}`+(t.colspan>1?` colspan=${t.colspan}`:"")+(t.rowspan>1?` rowspan=${t.rowspan}`:"")+(r?` align=${r}`:"")+">"+e}</${n}>\n`},kO=(e,t,n=[])=>{var r,i,o;const s=[...e.matchAll(/(?:[^|\\]|\\.?)+(?:\|+|$)/g)].map((e=>e[0]));(null===(r=s[0])||void 0===r?void 0:r.trim())||s.shift(),(null===(i=s[s.length-1])||void 0===i?void 0:i.trim())||s.pop();let a,l,c,u,d,h=0;for(a=0;a<s.length;a++){if(c=s[a].split(/\|+$/)[0],s[a]={rowspan:1,colspan:Math.max(s[a].length-c.length,1),text:c.trim().replace(/\\\|/g,"|")},"^"===c.slice(-1)&&n.length)for(d=0,l=0;l<n.length;l++){if(u=n[l],d===h&&u.colspan===s[a].colspan){s[a].rowSpanTarget=null!==(o=u.rowSpanTarget)&&void 0!==o?o:u,s[a].rowSpanTarget.text+=` ${s[a].text.slice(0,-1)}`,s[a].rowSpanTarget.rowspan+=1,s[a].rowspan=0;break}if(d+=u.colspan,d>h)break}h+=s[a].colspan}if(h>t)s.splice(t);else for(;h<t;)s.push({colspan:1,text:""}),h+=1;return s};XN.marked.use({async:!1,gfm:!0,pedantic:!1,renderer:{link:({href:e,title:t,text:n})=>{const r=e?pR(e):null;if(null===r)return n;let i='<a href="'+(e=r)+'"';return t&&(i+=' title="'+t+'"'),i+=' target="_blank" rel="noopener noreferrer">'+n+"</a>",i}}}),XN.marked.use(t(NO)()),XN.marked.use({extensions:[{name:"spanTable",level:"block",start(e){var t;return null===(t=e.match(/^\n *([^\n ].*\|.*)\n/))||void 0===t?void 0:t.index},tokenizer(e,t){const n=new RegExp("^ *([^\\n ].*\\|.*\\n(?: *[^\\s].*\\n)*?) {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n| {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)| {0,3}#{1,6} | {0,3}>| {4}[^\\n]| {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n| {0,3}(?:[*+-]|1[.)]) |<\\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?: +|\\n|\\/?>)|<(?:script|pre|style|textarea|!--)).*(?:\\n|$))*)\\n*|$)").exec(e);if(n){const e={type:"spanTable",header:n[1].replace(/\n$/,"").split("\n"),align:n[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:n[3]?n[3].replace(/\n$/,"").split("\n"):[]};e.header[0]=kO(e.header[0]);const t=e.header[0].reduce(((e,t)=>e+t.colspan),0);if(t===e.align.length){let r,i,o,s;e.raw=n[0];let a=e.align.length;for(r=0;r<a;r++)/^ *-+: *$/.test(e.align[r])?e.align[r]="right":/^ *:-+: *$/.test(e.align[r])?e.align[r]="center":/^ *:-+ *$/.test(e.align[r])?e.align[r]="left":e.align[r]=null;for(a=e.header.length,r=1;r<a;r++)e.header[r]=kO(e.header[r],t,e.header[r-1]);for(a=e.rows.length,r=0;r<a;r++)e.rows[r]=kO(e.rows[r],t,e.rows[r-1]);for(a=e.header.length,i=0;i<a;i++)for(s=e.header[i],o=0;o<s.length;o++)s[o].tokens=[],this.lexer.inline(s[o].text,s[o].tokens);for(a=e.rows.length,i=0;i<a;i++)for(s=e.rows[i],o=0;o<s.length;o++)s[o].tokens=[],this.lexer.inline(s[o].text,s[o].tokens);return e}}},renderer(e){let t,n,r,i,o,s,a='<div class="memori--responsive-table-wrapper"><table class="memori--table memori--table--compact">';for(a+="<thead>",t=0;t<e.header.length;t++){r=e.header[t];let o=0;for(a+="<tr>",n=0;n<r.length;n++)i=r[n],s=this.parser.parseInline(i.tokens),a+=DO(s,i,"th",e.align[o]),o+=i.colspan;a+="</tr>"}if(a+="</thead>",e.rows.length){for(a+="<tbody>",t=0;t<e.rows.length;t++){for(r=e.rows[t],o=0,a+="<tr>",n=0;n<r.length;n++)i=r[n],s=this.parser.parseInline(i.tokens),a+=DO(s,i,"td",e.align[o]),o+=i.colspan;a+="</tr>"}a+="</tbody>"}return a+="</table></div>",a}}]});var LO=({message:e,memori:n,tenant:r,baseUrl:i,apiUrl:o,sessionID:a,showFeedback:l,showWhyThisAnswer:u=!0,showCopyButton:d=!0,showTranslationOriginal:h=!1,simulateUserPrompt:p,showAIicon:m=!0,isFirst:f=!1,useMathFormatting:g=!1,user:v,userAvatar:y,experts:S})=>{var _,b,x,w,C,A,E,T;const{t:I,i18n:M}=Ce(),R=M.language||"en",[P,N]=(0,c.useState)(!1);(0,c.useEffect)((()=>{"undefined"==typeof window||window.MathJax||fR()}),[]),g&&XN.marked.use(t(OO)({throwOnError:!1,output:"htmlAndMathml"}));const O=e.translatedText||e.text,D=((e,n=!1)=>{try{let r=e.trim().replaceAll(/\[([^\]]+)\]\(([^\)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>').replaceAll(/```markdown([^```]+)```/g,"$1").replaceAll("($","( $").replaceAll(":$",": $").replaceAll("\frac","\\frac").replaceAll("\beta","\\beta").replaceAll("cdot","\\cdot");n&&(r=r.replace(/\\+\[(.*?)\\*\]/gs,((e,t)=>`$$${t}$$`)),r=r.replace(/\[([^[\]]+?)\]/g,((e,t)=>!/[\\+a-z0-9_{}^=\-\+\*\/]+/i.test(t)||e.startsWith("[http")||e.includes("](")?e:`$$${t}$$`)));let i=XN.marked.parse(r).toString().trim();return i=t(QN).sanitize(i,{ADD_ATTR:["target"]}),i.replace(/(<br>)+/g,"<br>").replace(/<p><\/p>/g,"<br>").replace(/<p><br><\/p>/g,"<br>")}catch(t){return console.error("Error rendering message:",t),e}})(O,g),k=e.fromUser?O:dR(uR(D));return(0,c.useLayoutEffect)((()=>{if("undefined"!=typeof window&&!e.fromUser){const e=setTimeout((()=>{if(window.MathJax&&window.MathJax.typesetPromise)try{document.querySelectorAll(".memori-chat--bubble-content").length>0&&window.MathJax.typesetPromise([".memori-chat--bubble-content"]).catch((e=>console.error("MathJax typesetting failed:",e)))}catch(e){console.error("Error during MathJax typesetting:",e)}}),100);return()=>clearTimeout(e)}}),[e.text,e.fromUser,D]),(0,s.jsxs)(s.Fragment,{children:[(e.initial||f)&&(0,s.jsx)("div",{className:"memori-chat--bubble-initial"}),(0,s.jsxs)(lp,{show:!0,appear:!0,as:"div",className:t(Cs)("memori-chat--bubble-container",{"memori-chat--bubble-from-user":!!e.fromUser,"memori-chat--with-addon":e.generatedByAI&&m||l&&p}),children:[!e.fromUser&&(0,s.jsx)(lp.Child,{as:"picture",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),title:(null===(_=e.emitter)||void 0===_?void 0:_.length)&&n.enableBoardOfExperts?e.emitter:n.name,children:(0,s.jsx)("img",{className:"memori-chat--bubble-avatar-img",alt:(null===(b=e.emitter)||void 0===b?void 0:b.length)&&n.enableBoardOfExperts?e.emitter:n.name,src:(null===(x=e.emitter)||void 0===x?void 0:x.length)&&n.enableBoardOfExperts&&(null==S?void 0:S.find((t=>t.name===e.emitter)))?`${new URL(null!=o?o:"/").origin}/api/v1/memoriai/memori/avatar/${null===(w=S.find((t=>t.name===e.emitter)))||void 0===w?void 0:w.expertMemoriID}`:n.avatarURL&&n.avatarURL.length>0?AN({type:"avatar",tenantID:null==r?void 0:r.id,resourceURI:n.avatarURL,baseURL:i,apiURL:o}):AN({tenantID:null==r?void 0:r.id,type:"avatar",baseURL:i||"https://www.aisuru.com",apiURL:o}),onError:e=>{e.currentTarget.src=n.avatarURL&&n.avatarURL.length>0?AN({type:"avatar",tenantID:null==r?void 0:r.id,resourceURI:n.avatarURL,baseURL:i}):AN({tenantID:null==r?void 0:r.id,type:"avatar",baseURL:i}),e.currentTarget.onerror=null}})}),(0,s.jsxs)(lp.Child,{as:"div",className:t(Cs)("memori-chat--bubble",{"memori-chat--user-bubble":!!e.fromUser,"memori-chat--with-addon":!e.fromUser&&d||e.generatedByAI&&m||l&&p,"memori-chat--ai-generated":e.generatedByAI&&m,"memori-chat--with-feedback":l}),enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-09 translate-x-"+(e.fromUser?"30":"-30"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-09 translate-x-"+(e.fromUser?"30":"-30"),children:[(0,s.jsx)("div",{dir:"auto",className:"memori-chat--bubble-content",dangerouslySetInnerHTML:{__html:D}}),(!e.fromUser&&d||e.generatedByAI&&m||l&&p)&&(0,s.jsxs)("div",{className:"memori-chat--bubble-addon",children:[!e.fromUser&&d&&(0,s.jsx)(Em,{ghost:!0,shape:"circle",title:I("copy")||"Copy",className:"memori-chat--bubble-action-icon",icon:(0,s.jsx)(eO,{"aria-label":I("copy")||"Copy"}),onClick:()=>navigator.clipboard.writeText(k)}),!e.fromUser&&d&&k!==e.text&&(0,s.jsx)(Em,{ghost:!0,shape:"circle",title:I("copyRawCode")||"Copy raw code",className:"memori-chat--bubble-action-icon",icon:(0,s.jsx)(tO,{"aria-label":I("copyRawCode")||"Copy raw code"}),onClick:()=>navigator.clipboard.writeText(e.text)}),l&&!!p&&(0,s.jsx)($N,{memori:n,className:"memori-chat--bubble-feedback",dropdown:!0,onNegativeClick:e=>{e&&p(e)}}),e.generatedByAI&&m&&(0,s.jsx)(MN,{align:"left",content:I("generatedByAI"),className:"memori-chat--bubble-action-icon memori-chat--bubble-action-icon--ai",children:(0,s.jsx)("span",{children:(0,s.jsx)(TN,{title:I("generatedByAI")||void 0})})}),h&&e.translatedText&&e.translatedText!==e.text&&(0,s.jsx)(MN,{align:"left",content:`${"it"===R?"Testo originale":"Original text"}: ${e.text}`,className:"memori-chat--bubble-action-icon memori-chat--bubble-action-icon--ai",children:(0,s.jsx)("span",{children:(0,s.jsx)(IN,{"aria-label":"it"===R?"Testo originale":"Original text"})})}),!e.fromUser&&e.questionAnswered&&o&&u&&(0,s.jsx)(Em,{ghost:!0,shape:"circle",title:I("whyThisAnswer")||void 0,className:"memori-chat--bubble-action-icon",onClick:()=>N(!0),disabled:P,icon:(0,s.jsx)(ZN,{title:I("whyThisAnswer")||void 0})})]}),e.fromUser&&e.media&&(null===(C=e.media)||void 0===C?void 0:C.length)>0&&(null===(A=e.media[0].properties)||void 0===A?void 0:A.isAttachedFile)&&(0,s.jsx)(PO,{previewFiles:e.media.map((e=>{var t,n;return{name:null!==(t=e.title)&&void 0!==t?t:"",id:e.mediumID,content:null!==(n=e.content)&&void 0!==n?n:""}})),removeFile:()=>{},allowRemove:!1,isMessagePreview:!0})]}),e.fromUser&&(0,s.jsx)(s.Fragment,{children:y&&"string"==typeof y||!y&&(null===(E=null==v?void 0:v.avatarURL)||void 0===E?void 0:E.length)?(0,s.jsx)(lp.Child,{as:"picture",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),children:(0,s.jsx)("img",{className:"memori-chat--bubble-avatar-img",alt:null!==(T=null==v?void 0:v.userName)&&void 0!==T?T:"User",src:null!=y?y:null==v?void 0:v.avatarURL})}):y?(0,s.jsx)(lp.Child,{as:"div",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),children:y}):(0,s.jsx)(lp.Child,{as:"div",className:"memori-chat--bubble-avatar",enter:"transition ease-in-out duration-300",enterFrom:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),enterTo:"opacity-1 scale-1 translate-x-0",leave:"transition ease-in-out duration-300",leaveFrom:"opacity-1 scale-1 translate-x-0",leaveTo:"opacity-0 scale-075 "+(e.fromUser?"translate-x-15":"translate-x--15"),children:(0,s.jsx)(EN,{})})})]}),P&&o&&(0,s.jsx)(MO,{visible:P,message:e,closeDrawer:()=>N(!1),apiURL:o,sessionID:a})]})};c=o("85Hg2"),c=o("85Hg2");var BO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M855 160.1l-189.2 23.5c-6.6.8-9.3 8.8-4.7 13.5l54.7 54.7-153.5 153.5a8.03 8.03 0 0 0 0 11.3l45.1 45.1c3.1 3.1 8.2 3.1 11.3 0l153.6-153.6 54.7 54.7a7.94 7.94 0 0 0 13.5-4.7L863.9 169a7.9 7.9 0 0 0-8.9-8.9zM416.6 562.3a8.03 8.03 0 0 0-11.3 0L251.8 715.9l-54.7-54.7a7.94 7.94 0 0 0-13.5 4.7L160.1 855c-.6 5.2 3.7 9.5 8.9 8.9l189.2-23.5c6.6-.8 9.3-8.8 4.7-13.5l-54.7-54.7 153.6-153.6c3.1-3.1 3.1-8.2 0-11.3l-45.2-45z"})});var zO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M391 240.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L200 146.3a8.03 8.03 0 0 0-11.3 0l-42.4 42.3a8.03 8.03 0 0 0 0 11.3L280 333.6l-43.9 43.9a8.01 8.01 0 0 0 4.7 13.6L401 410c5.1.6 9.5-3.7 8.9-8.9L391 240.9zm10.1 373.2L240.8 633c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L146.3 824a8.03 8.03 0 0 0 0 11.3l42.4 42.3c3.1 3.1 8.2 3.1 11.3 0L333.7 744l43.7 43.7A8.01 8.01 0 0 0 391 783l18.9-160.1c.6-5.1-3.7-9.4-8.8-8.8zm221.8-204.2L783.2 391c6.6-.8 9.4-8.9 4.7-13.6L744 333.6 877.7 200c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.3a8.03 8.03 0 0 0-11.3 0L690.3 279.9l-43.7-43.7a8.01 8.01 0 0 0-13.6 4.7L614.1 401c-.6 5.2 3.7 9.5 8.8 8.9zM744 690.4l43.9-43.9a8.01 8.01 0 0 0-4.7-13.6L623 614c-5.1-.6-9.5 3.7-8.9 8.9L633 783.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L824 877.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L744 690.4z"})});var FO=({disabled:e=!1,value:n,onChange:r,onPressEnter:i,onFocus:o,onBlur:a})=>{const{t:l}=Ce(),[u,d]=(0,c.useState)(!1);return(0,s.jsx)("div",{"data-testid":"chat-textarea",className:t(Cs)("memori-chat-textarea",{"memori-chat-textarea--expanded":u,"memori-chat-textarea--disabled":e}),children:(0,s.jsxs)("div",{className:"memori-chat-textarea--inner",children:[(0,s.jsx)("textarea",{className:"memori-chat-textarea--input",disabled:e,value:n,onChange:e=>{r(e.target.value)},onKeyDownCapture:e=>{"Enter"===e.key&&!e.shiftKey&&i&&i(e)},onFocus:o,onBlur:a,maxLength:1e5}),(0,s.jsx)("div",{className:"memori-chat-textarea--expand",children:(0,s.jsx)(Em,{className:t(Cs)("memori-chat-textarea--expand-button"),onClick:()=>d(!u),padded:!1,ghost:!0,title:u?l("collapse")||"Collapse":l("expand")||"Expand",icon:u?(0,s.jsx)(zO,{}):(0,s.jsx)(BO,{})})})]})})};var UO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2-8.5 2.1-13.8 10.7-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})});c=o("85Hg2");var jO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"})});var GO=({listening:e,stopAudio:n,startListening:r,stopListening:i})=>{const{t:o}=Ce(),[a,l]=(0,c.useState)(),u=(0,c.useRef)(null),d=e=>{e.preventDefault(),l(o("write_and_speak.holdToSpeak")||"Hold to record"),u.current||(u.current=setTimeout((()=>{n(),l(o("write_and_speak.releaseToEndListening")||"Release to end listening"),r()}),300))},h=()=>{u.current&&(clearTimeout(u.current),u.current=null),i(),l(void 0)};return(0,c.useEffect)((()=>()=>h()),[]),(0,s.jsx)(MN,{visible:!!a,content:(0,s.jsx)("span",{children:a||o("write_and_speak.pressAndHoldToSpeak")||"Press and hold to speak"}),align:"topLeft",className:"memori-mic-btn-tooltip",children:(0,s.jsx)(Em,{primary:!0,className:t(Cs)("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":e}),title:e?o("write_and_speak.micButtonPopoverListening")||"Listening":o("write_and_speak.micButtonPopover")||"Start listening",onMouseDown:d,onTouchStart:d,onMouseUp:h,onTouchEnd:h,shape:"circle",icon:(0,s.jsx)(jO,{})})})};c=o("85Hg2");var HO=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"})});c=o("85Hg2");var VO=({open:e=!1,onClose:n,className:r,title:i,description:o,children:a,type:l="info",icon:u,closable:d=!0,duration:h=null,action:p,width:m="400px"})=>{const{t:f}=Ce();t(c).useEffect((()=>{if(h&&e){const e=setTimeout((()=>{n(!1)}),h);return()=>clearTimeout(e)}}),[h,e,n]);return(0,s.jsx)(lp,{show:e,as:t(c).Fragment,appear:!0,children:(0,s.jsxs)("div",{className:t(Cs)("memori-alert",(e=>{switch(e){case"success":return"memori-alert--success";case"warning":return"memori-alert--warning";case"error":return"memori-alert--error";default:return"memori-alert--info"}})(l),r),children:[(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n .memori-alert {\n --memori-alert--width: ${m};\n }\n `}}),(0,s.jsx)(lp.Child,{as:t(c).Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 translate-y-4",children:(0,s.jsxs)("div",{className:"memori-alert--container",children:[u&&(0,s.jsx)("div",{className:"memori-alert--icon",children:u}),(0,s.jsxs)("div",{className:"memori-alert--content",children:[i&&(0,s.jsx)("div",{className:"memori-alert--title",children:i}),o&&(0,s.jsx)("div",{className:"memori-alert--description",children:o}),a]}),(0,s.jsxs)("div",{className:"memori-alert--actions",children:[p&&(0,s.jsx)("div",{className:"memori-alert--action",children:p}),d&&(0,s.jsx)(Em,{ghost:!0,padded:!0,shape:"circle",icon:(0,s.jsx)(Tm,{}),title:f("close")||"Close",onClick:()=>n(!1),className:"memori-alert--close"})]})]})})]})})};const WO=10485760,qO=1e5,JO="3.11.174",KO=`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${JO}/pdf.worker.min.js`,YO=`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${JO}/pdf.min.js`;var $O=({setPreviewFiles:e})=>{const[n,r]=(0,c.useState)(!1),[i,o]=(0,c.useState)([]),a=(0,c.useRef)(null),l=e=>{o((t=>t.filter((t=>t.message!==e))))},u=e=>{o((t=>[...t,e])),setTimeout((()=>{l(e.message)}),5e3)},d=e=>{var t;const n=`.${null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase()}`,r=[".pdf",".txt"];return r.includes(n)?!(e.size>WO)||(u({message:`File "${e.name}" exceeds 10MB limit`,severity:"error",fileId:e.name}),!1):(u({message:`File type "${n}" is not supported. Please use: ${r.join(", ")}`,severity:"error",fileId:e.name}),!1)},h=async e=>{var t;const n=(null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase())||"";try{let t=null;return"pdf"===n?t=await(async e=>{try{window.pdfjsLib||await new Promise(((e,t)=>{const n=document.createElement("script");n.src=YO,n.onload=()=>{window.pdfjsLib.GlobalWorkerOptions.workerSrc=KO,e(!0)},n.onerror=t,document.head.appendChild(n)}));const t=await e.arrayBuffer(),n=await window.pdfjsLib.getDocument({data:t}).promise;let r="";for(let e=1;e<=n.numPages;e++){const t=await n.getPage(e);r+=(await t.getTextContent()).items.filter((e=>e.str&&"string"==typeof e.str)).map((e=>e.str)).join(" ")+"\n"}return r}catch(e){throw new Error(`PDF extraction failed: ${e instanceof Error?e.message:"Unknown error"}`)}})(e):"txt"===n&&(t=await e.text()),t&&t.length>qO?(u({message:`File "${e.name}" content exceeds 100000 characters`,severity:"error",fileId:e.name}),null):t}catch(t){return u({message:`Failed to process "${e.name}": ${t instanceof Error?t.message:"Unknown error"}`,severity:"error",fileId:e.name}),null}};return(0,s.jsxs)("div",{className:"relative file-upload-wrapper",children:[(0,s.jsx)("input",{ref:a,type:"file",accept:".pdf,.txt",className:"memori--upload-file-input",onChange:async t=>{const n=Array.from(t.target.files||[]);if(0===n.length)return;r(!0),o([]);const i=[];for(const e of n){if(!d(e))continue;const t=Math.random().toString(36).substr(2,9),n=await h(e);n&&i.push({name:e.name,id:t,content:n})}i.length>0&&(e(i),i.length<n.length&&u({message:"Some files were not processed successfully",severity:"warning"})),r(!1),a.current&&(a.current.value="")},multiple:!0}),(0,s.jsx)("button",{className:t(Cs)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button","memori--conversation-button",{"memori--error":i.length>0}),onClick:()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.click()},disabled:n,title:"Upload file",children:n?(0,s.jsx)(Am,{spinning:!0,className:"memori--upload-icon"}):(0,s.jsx)(HO,{className:"memori--upload-icon"})}),(0,s.jsx)("div",{className:"memori--error-message-container",children:i.map(((e,t)=>(0,s.jsx)(VO,{open:!0,type:e.severity,title:"File upload failed",description:e.message,onClose:()=>l(e.message),width:"350px"},`${e.message}-${t}`)))})]})};var XO=({dialogState:e,userMessage:n="",sendOnEnter:r,onChangeUserMessage:i,sendMessage:o,onTextareaFocus:a,onTextareaBlur:l,resetTranscript:u,showMicrophone:d=!1,microphoneMode:h="HOLD_TO_TALK",listening:p=!1,stopAudio:m,startListening:f,stopListening:g,showUpload:v=!1})=>{const{t:y}=Ce(),[S,_]=(0,c.useState)([]);return(0,s.jsxs)("fieldset",{id:"chat-fieldset",className:"memori-chat-inputs",disabled:"X2a"===(null==e?void 0:e.state)||"X3"===(null==e?void 0:e.state),children:[(0,s.jsx)(FO,{value:n,onChange:i,onPressEnter:()=>{"keypress"===r&&(null==n?void 0:n.length)>0&&(g(),o(n,S[0]?{mediumID:"",mimeType:"text/plain",content:S[0].content,title:S[0].name,properties:{isAttachedFile:!0}}:void 0),_([]),i(""),u())},onFocus:a,onBlur:l,disabled:["R2","R3","R4","R5","G3","X3"].includes((null==e?void 0:e.state)||"")}),v&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(PO,{previewFiles:S,removeFile:e=>{_((t=>t.filter((t=>t.id!==e))))}}),(0,s.jsx)($O,{setPreviewFiles:_})]}),(0,s.jsx)(Em,{shape:"circle",primary:!!(null==n?void 0:n.length),disabled:!n||0===n.length,className:"memori-chat-inputs--send",onClick:()=>{o(n,S[0]?{mediumID:"",mimeType:"text/plain",content:S[0].content,title:S[0].name,properties:{isAttachedFile:!0}}:void 0),_([]),m(),speechSynthesis.speak(new SpeechSynthesisUtterance(""))},title:y("send")||"Send",icon:(0,s.jsx)(UO,{})}),d&&"HOLD_TO_TALK"===h&&(0,s.jsx)(GO,{listening:p,startListening:f,stopListening:()=>{g(),(null==n?void 0:n.length)&&o(n)},stopAudio:m}),d&&"CONTINUOUS"===h&&(0,s.jsx)(Em,{primary:!0,className:t(Cs)("memori-chat-inputs--mic",{"memori-chat-inputs--mic--listening":p}),title:p?y("write_and_speak.micButtonPopoverListening")||"Listening":y("write_and_speak.micButtonPopover")||"Start listening",onClick:()=>{p?g():(m(),f())},shape:"circle",icon:(0,s.jsx)(jO,{})})]})};c=o("85Hg2");const QO={en:[{delayAfter:3,text:"Generating an accurate and fancy response..."},{delayAfter:3,text:"Generating a response that will blow your mind..."},{delayAfter:3,text:"Generating a response that will make you smile..."},{delayAfter:3,text:"Thinking of a response..."},{delayAfter:3,text:"Thinking of a response that will make you smile..."},{delayAfter:3,text:"Gathering my thoughts..."},{delayAfter:3,text:"Gathering my thoughts to give you a response..."}],it:[{delayAfter:3,text:"Sto generando una risposta accurata e fantasiosa..."},{delayAfter:3,text:"Sto generando una risposta che ti farà impazzire..."},{delayAfter:3,text:"Sto generando una risposta che ti farà sorridere..."},{delayAfter:3,text:"Sto pensando ad una risposta..."},{delayAfter:3,text:"Sto pensando ad una risposta che ti farà sorridere..."},{delayAfter:3,text:"Sto raccogliendo i miei pensieri..."},{delayAfter:3,text:"Sto raccogliendo i miei pensieri per darti una risposta..."}]},ZO=(e=3)=>new Array(20*e).fill(" ").join("");var eD=({useDefaultSentences:e=!1,lang:t="en",sentence:n,sentences:r})=>{var i;const[o,a]=(0,c.useState)(0),[l,u]=(0,c.useState)((null===(i=null==r?void 0:r[t])||void 0===i?void 0:i.length)?`${r[t][0].text.endsWith("...")||!r[t][0].text.length?r[t][0].text:`${r[t][0].text}...`}${ZO(r[t][0].delayAfter)}`:n?`${n.endsWith("...")||!n.length?n:`${n}...`}${ZO()}`:""),[d,h]=(0,c.useState)("");return(0,c.useEffect)((()=>{const i=setInterval((()=>{var i;const s=l[d.length];if(void 0!==s&&l.length>0)h((e=>e+s));else if((null===(i=null==r?void 0:r[t])||void 0===i?void 0:i.length)&&o<r[t].length-1){const e=o+1,n=r[t][e];u(`${n.text.endsWith("...")||!n.text.length?n.text:`${n.text}...`}${ZO(n.delayAfter)}`),h(""),a(e)}else if(!r&&!n&&e){const e=QO[t][Math.floor(Math.random()*QO[t].length)];u(`${e.text}${ZO(e.delayAfter)}`),h("")}}),50);return()=>clearInterval(i)})),(0,s.jsx)("div",{className:"memori-chat--bubble",children:(0,s.jsxs)("div",{className:"memori-chat--bubble-typing",children:[(0,s.jsxs)("div",{id:"wave",children:[(0,s.jsx)("span",{className:"dot"}),(0,s.jsx)("span",{className:"dot"}),(0,s.jsx)("span",{className:"dot"})]}),l.length>0&&(0,s.jsx)("p",{children:d})]})})};var tD=(0,c.memo)((({memori:e,tenant:n,sessionID:r,baseUrl:i,apiUrl:o,translateTo:a,memoriTyping:l,typingText:u,showTypingText:d=!1,history:h=[],authToken:p,dialogState:m,simulateUserPrompt:f,showDates:g=!1,showContextPerLine:v=!1,showAIicon:y=!0,showWhyThisAnswer:S=!0,showCopyButton:_=!0,showTranslationOriginal:b=!1,preview:x=!1,instruct:w=!1,showInputs:C=!0,showMicrophone:A=!1,microphoneMode:E="HOLD_TO_TALK",sendOnEnter:T,setSendOnEnter:I,attachmentsMenuOpen:M,setAttachmentsMenuOpen:R,userMessage:P="",onChangeUserMessage:N,sendMessage:O,listening:D,setEnableFocusChatInput:k,isPlayingAudio:L,stopAudio:B,startListening:z,stopListening:F,resetTranscript:U,customMediaRenderer:j,user:G,userAvatar:H,showUpload:V=!1,experts:W,useMathFormatting:q=!1})=>{var J,K,Y,$,X,Q,Z;const ee=()=>{setTimeout((()=>{var e,t;let n=document.querySelectorAll(".memori-chat--bubble-container.memori-chat--bubble-from-user");null===(t=null===(e=n[n.length-1])||void 0===e?void 0:e.scrollIntoView)||void 0===t||t.call(e)}),200)};(0,c.useEffect)((()=>{!x&&ee()}),[h,x]);return(0,s.jsxs)("div",{className:t(Cs)("memori-chat--wrapper",{"memori-chat-wrapper--translate":a}),id:"chat-wrapper",lang:null==a?void 0:a.toUpperCase(),"data-memori-lang":null!==($=null===(Y=null===(K=null===(J=e.culture)||void 0===J?void 0:J.split("-"))||void 0===K?void 0:K[0])||void 0===Y?void 0:Y.toUpperCase())&&void 0!==$?$:"EN",children:[(0,s.jsx)("div",{className:t(Cs)("memori-chat--history",{"memori-chat--history-touch":nR()}),children:(0,s.jsxs)("div",{className:t(Cs)("memori-chat--content",{"memori-chat--content-touch":nR()}),children:[(0,s.jsx)("div",{className:t(Cs)("memori-chat--cover"),style:{backgroundImage:`url("${AN({type:"cover",tenantID:null==n?void 0:n.id,resourceURI:e.coverURL,baseURL:i,apiURL:o})}"), url("${AN({type:"cover",tenantID:null==n?void 0:n.id,baseURL:i||"https://www.aisuru.com",apiURL:o})}")`}}),h.map(((l,u)=>{var d,p,x,w;return(0,s.jsxs)(t(c).Fragment,{children:[(0,s.jsx)(LO,{isFirst:0===u,message:l,memori:e,tenant:n,baseUrl:i,apiUrl:o,sessionID:r,simulateUserPrompt:f,showAIicon:y,showWhyThisAnswer:S,showTranslationOriginal:b,showFeedback:u===h.length-1&&!l.fromUser&&(null==m?void 0:m.acceptsFeedback),user:G,userAvatar:H,experts:W,showCopyButton:_,useMathFormatting:q}),g&&!!l.timestamp&&(0,s.jsx)("small",{className:"memori-chat--timestamp "+(l.fromUser?"text-right":"text-left"),children:new Intl.DateTimeFormat("it",{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(l.timestamp.endsWith("Z")?l.timestamp:`${l.timestamp}Z`))}),v&&!!Object.keys(null!==(d=l.contextVars)&&void 0!==d?d:{}).length&&(0,s.jsx)("div",{className:"memori-chat--context-vars",children:Object.keys(null!==(p=l.contextVars)&&void 0!==p?p:{}).map((e=>{var t,n,r;return"-"===(null===(t=l.contextVars)||void 0===t?void 0:t[e])?(0,s.jsx)("div",{className:"memori-chat--context-tag memori-chat--context-tag-canceled",children:(0,s.jsx)("span",{className:"memori-chat--context-tag-text",children:e})},e):"✔️"===(null===(n=l.contextVars)||void 0===n?void 0:n[e])?(0,s.jsx)("div",{className:"memori-chat--context-tag",children:(0,s.jsx)("span",{className:"memori-chat--context-tag-text",children:e})},e):(0,s.jsx)("div",{className:"memori-chat--context-tag",children:(0,s.jsxs)("span",{className:"memori-chat--context-tag-text",children:[e,": ",null===(r=l.contextVars)||void 0===r?void 0:r[e]]})},e)}))}),(0,s.jsx)(TO,{simulateUserPrompt:f,media:null===(x=null==l?void 0:l.media)||void 0===x?void 0:x.filter((e=>"text/html"!==e.mimeType&&"text/plain"!==e.mimeType)),links:null===(w=null==l?void 0:l.media)||void 0===w?void 0:w.filter((e=>"text/html"===e.mimeType)),sessionID:r,baseUrl:i,apiUrl:o,translateTo:a,customMediaRenderer:j})]},u)})),(null==m?void 0:m.hints)&&m.hints.length>0&&!l&&(0,s.jsx)(TO,{simulateUserPrompt:f,hints:m.translatedHints?m.translatedHints:m.hints.map((e=>({text:e,originalText:e})))}),!!l&&(0,s.jsx)(eD,{useDefaultSentences:d,lang:a?"it"===a.toLowerCase()?"it":"en":"it"===(null===(Z=null===(Q=null===(X=e.culture)||void 0===X?void 0:X.split("-"))||void 0===Q?void 0:Q[0])||void 0===Z?void 0:Z.toLowerCase())?"it":"en",sentence:u,sentences:e.enableBoardOfExperts?uO:void 0},u),(0,s.jsx)("div",{id:"end-messages-ref"})]})}),C&&(0,s.jsx)(XO,{resetTranscript:U,userMessage:P,onChangeUserMessage:N,dialogState:m,instruct:w,authToken:p,sendMessage:O,microphoneMode:E,sendOnEnter:T,setSendOnEnter:I,showUpload:V,attachmentsMenuOpen:M,setAttachmentsMenuOpen:R,onTextareaFocus:()=>{var e,t,n,r;F();const i=nR();i&&k(!0),i&&window.innerWidth<=768&&(null===(t=null===(e=document.getElementById("chat-wrapper"))||void 0===e?void 0:e.classList)||void 0===t||t.add("chat-focused"),null===(r=null===(n=document.querySelector(".memori.memori-widget"))||void 0===n?void 0:n.classList)||void 0===r||r.add("chat-focused"),setTimeout((()=>{ee()}),300))},onTextareaBlur:()=>{var e,t,n,r,i;(null===(t=null===(e=document.getElementById("chat-wrapper"))||void 0===e?void 0:e.classList)||void 0===t?void 0:t.contains("chat-focused"))&&(null===(n=document.getElementById("chat-wrapper"))||void 0===n||n.classList.remove("chat-focused"),null===(i=null===(r=document.querySelector(".memori.memori-widget"))||void 0===r?void 0:r.classList)||void 0===i||i.remove("chat-focused"),ee())},startListening:z,stopListening:F,stopAudio:B,listening:D,isPlayingAudio:L,showMicrophone:A})]})}));c=o("85Hg2");var nD=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"})});var rD=({memoriName:e,blockedUntil:t,notEnoughCredits:n=!1,showGiverInfo:r=!1,showTitle:i=!1,marginLeft:o=!1})=>{const{t:a}=Ce(),l=new Date(t||Date.now());return n||l>new Date(Date.now())?(0,s.jsx)(MN,{className:"blocked-memori-badge--tooltip",content:n?(0,s.jsx)(s.Fragment,{children:a("notEnoughCredits")}):(0,s.jsxs)(s.Fragment,{children:[!r&&a("memoriBlockedAnon",{name:e,date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(l)}),r&&a("memoriBlockedUntil",{date:new Intl.DateTimeFormat("it",{day:"numeric",month:"long",year:"numeric"}).format(l)}),r&&` ${a("memoriBlockedReasonExceedChats")}`,r&&(0,s.jsx)("br",{}),r&&`\n${a("memoriBlockedGiverHelper")}`]}),children:(0,s.jsxs)("div",{className:"blocked-memori-badge--wrapper",children:[(0,s.jsx)("div",{className:"blocked-memori-badge "+(o?" margin-left":""),children:(0,s.jsx)(nD,{className:"blocked-memori-badge--icon"})}),i&&(0,s.jsx)("span",{className:"blocked-memori-badge--title",children:a("memoriBlockedTitle")})]})}):null};var iD=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",width:"20",height:"16",viewBox:"0 0 640 512",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M211.2 96a64 64 0 10-128 0 64 64 0 10128 0zM32 256c0 17.7 14.3 32 32 32h85.6c10.1-39.4 38.6-71.5 75.8-86.6-9.7-6-21.2-9.4-33.4-9.4H96c-35.3 0-64 28.7-64 64zm461.6 32H576c17.7 0 32-14.3 32-32 0-35.3-28.7-64-64-64h-96c-11.7 0-22.7 3.1-32.1 8.6 38.1 14.8 67.4 47.3 77.7 87.4zm-102.4-61.6c-6.9-1.6-14.2-2.4-21.6-2.4h-96c-8.5 0-16.7 1.1-24.5 3.1-30.8 8.1-55.6 31.1-66.1 60.9-3.5 10-5.5 20.8-5.5 32 0 17.7 14.3 32 32 32h224c17.7 0 32-14.3 32-32 0-11.2-1.9-22-5.5-32-10.8-30.7-36.8-54.2-68.9-61.6zM563.2 96a64 64 0 10-128 0 64 64 0 10128 0zm-241.6 96a80 80 0 100-160 80 80 0 100 160zM32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32h576c17.7 0 32-14.3 32-32s-14.3-32-32-32H32z"})});var oD=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",width:"20",height:"20",viewBox:"0 0 48 48",className:e,"aria-label":t,children:[(0,s.jsx)("path",{d:"M30.106 48v-2.745a2.213 2.213 0 012.213-2.212h6.11a2.392 2.392 0 002.326-2.466v-3.223a1.834 1.834 0 01.459-1.145 2.912 2.912 0 00.712-1.926l-.007-.667a1.016 1.016 0 01.651-.952h1.067a1.363 1.363 0 001.051-.456 1.304 1.304 0 00.19-1.395 67.032 67.032 0 01-3.037-7.51 4.767 4.767 0 01-.217-1.507l-.002-4.994a14.513 14.513 0 00-.552-3.963l-.006-.022a13.959 13.959 0 00-3.137-5.702q-.479-.516-1.006-1.003a17.67 17.67 0 00-.677-.623A18.303 18.303 0 0024.194 1a19.617 19.617 0 00-12.539 4.489 17.555 17.555 0 00-3.945 21.69C9.945 31.507 11.694 38.622 12.14 46v2",strokeMiterlimit:10}),(0,s.jsx)("path",{d:"M27.917 12L31.417 12"}),(0,s.jsx)("path",{d:"M27.917 26L31.417 26"}),(0,s.jsx)("path",{d:"M29.667 12L29.667 26"}),(0,s.jsx)("path",{d:"M23.992 26L19.904 12 19.226 12 15.159 26"}),(0,s.jsx)("path",{d:"M16.854 21.133L22.276 21.133"})]});c=o("85Hg2");const sD={OpenAI:{statusUrl:"https://status.openai.com/api/v2/summary.json",statusPage:"https://status.openai.com/"},Mistral:{statusUrl:"https://status.mistral-data.com/api/v2/summary.json",statusPage:"https://status.mistral-data.com/"},Anthropic:{statusUrl:"https://status.anthropic.com/api/v2/summary.json",statusPage:"https://status.anthropic.com/"}};var aD=({forceStatus:e,provider:t="OpenAI"})=>{const{t:n}=Ce(),[r,i]=(0,c.useState)(null!=e?e:"operational"),[o,a]=(0,c.useState)(!1),l=sD[t],u=(0,c.useCallback)((async()=>l?(async e=>{var t,n;try{const r=await fetch(e);if(!r.ok)return console.warn(`Status API returned ${r.status}`),"operational";const i=null===(t=(await r.json()).components)||void 0===t?void 0:t.find((e=>"API"===e.name));return null!==(n=null==i?void 0:i.status)&&void 0!==n?n:"operational"}catch(e){return console.error("Error fetching provider status:",e),"operational"}})(l.statusUrl):"operational"),[l]);return(0,c.useEffect)((()=>{let t=!0;const n=new AbortController;return(async()=>{if(!e){a(!0);try{const e=await u();t&&i(e)}catch(e){console.error("Failed to check status:",e),t&&i("operational")}finally{t&&a(!1)}}})(),()=>{t=!1,n.abort()}}),[e,u]),o?(0,s.jsx)("div",{className:"memori--completion-provider-status--loading",children:(0,s.jsx)(Am,{spinning:!0})}):r&&"operational"!==r?(0,s.jsx)(MN,{className:"memori--completion-provider-status--tooltip",align:"topLeft",content:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:n("completionProviderDown",{provider:null!=t?t:n("completionProviderFallbackName")})}),(null==l?void 0:l.statusPage)&&(0,s.jsx)("p",{children:(0,s.jsx)("a",{href:l.statusPage,rel:"noopener noreferrer",target:"_blank",children:n("completionProviderCheckStatusPage")})})]}),children:(0,s.jsx)(nD,{className:"memori--completion-provider-status--icon"})}):null};var lD=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",className:e,"aria-label":t,children:(0,s.jsx)("path",{fill:"currentColor",d:"M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"})});var cD=({memori:e,tenant:t,language:n,userLang:r,setUserLang:i,baseUrl:o,apiUrl:a,position:l,openPositionDrawer:u,instruct:d=!1,hasInitialSession:h=!1,clickedStart:p,onClickStart:m,initializeTTS:f,_TEST_forceProviderStatus:g,isUserLoggedIn:v=!1,user:y,showLogin:S=!1,setShowLoginDrawer:_,notEnoughCredits:b=!1,isMultilanguageEnabled:x})=>{var w,C;const{t:A,i18n:E}=Ce(),[T,I]=(0,c.useState)(e.description),[M,R]=(0,c.useState)(!0);return(0,c.useEffect)((()=>{var t,r,i,s,a,l;(null!==(r=null===(t=E.language)||void 0===t?void 0:t.toUpperCase())&&void 0!==r?r:"IT")===(null!==(i=null==n?void 0:n.toUpperCase())&&void 0!==i?i:"IT")&&T===e.description||!(null===(s=e.description)||void 0===s?void 0:s.length)||SO(e.description,null!==(l=null===(a=E.language)||void 0===a?void 0:a.toUpperCase())&&void 0!==l?l:"IT",n,o).then((e=>{I(e.text)})).catch(console.error)}),[E.language,n,e.description,o]),(0,s.jsxs)("div",{className:"memori--start-panel",children:[(0,s.jsxs)("div",{className:"memori--cover",style:{backgroundImage:`url("${AN({type:"cover",tenantID:null==t?void 0:t.id,resourceURI:e.coverURL,baseURL:o,apiURL:a})}"), url("${AN({type:"cover",tenantID:null==t?void 0:t.id,baseURL:o,apiURL:a})}")`},children:[!!e.enableCompletions&&!e.enableBoardOfExperts&&(0,s.jsx)("div",{className:"memori--completions-enabled",children:(0,s.jsx)(MN,{align:"left",content:A("completionsEnabled"),children:(0,s.jsx)("span",{"aria-label":A("completionsEnabled")||"Completions",children:(0,s.jsx)(TN,{})})})}),!!e.enableBoardOfExperts&&(0,s.jsx)("div",{className:"memori--board-of-experts",children:(0,s.jsx)(MN,{align:"left",content:A("boardOfExperts"),children:(0,s.jsx)("span",{"aria-label":A("boardOfExperts")||"Board of Experts",children:(0,s.jsx)(iD,{})})})}),!!e.nsfw&&(0,s.jsx)("div",{className:"memori--nsfw",children:(0,s.jsx)(MN,{align:"left",content:A("nsfw"),children:(0,s.jsx)("span",{title:A("nsfw")||"NSFW",children:"🔞"})})})]}),(0,s.jsxs)("picture",{className:"memori--avatar",children:[(0,s.jsx)("source",{src:null!==(w=e.avatarURL)&&void 0!==w?w:AN({type:"avatar",tenantID:null==t?void 0:t.id,resourceURI:e.avatarURL,baseURL:o,apiURL:a})}),(0,s.jsx)("img",{alt:e.name,src:e.avatarURL&&e.avatarURL.length>0?AN({type:"avatar",tenantID:null==t?void 0:t.id,resourceURI:e.avatarURL,baseURL:o,apiURL:a}):AN({type:"avatar",tenantID:null==t?void 0:t.id,baseURL:o,apiURL:a})})]}),(0,s.jsx)("h2",{className:"memori--title",children:e.name}),e.needsPosition&&!l&&(0,s.jsxs)("div",{className:"memori--needsPosition",children:[(0,s.jsx)("p",{children:A("write_and_speak.requirePositionHelp",{name:e.name})}),(0,s.jsx)(Em,{primary:!0,onClick:()=>u(),className:"memori--start-button",icon:(0,s.jsx)(lD,{}),children:A("widget.position")})]}),(e.needsPosition&&l||!e.needsPosition)&&(0,s.jsxs)("div",{className:"memori--description",children:[(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"memori--description-text",children:T&&M?T:e.description}),T!==e.description&&(0,s.jsx)(Em,{ghost:!0,className:"memori--translation-toggle",icon:(0,s.jsx)(IN,{}),onClick:()=>{R((e=>!e))},children:A(M?"showOriginalText":"showTranslatedText")})]}),x&&!d&&(0,s.jsxs)("div",{className:"memori--language-chooser",children:[(0,s.jsx)("label",{id:"user-lang-pref-label",htmlFor:"user-lang-pref",children:A("write_and_speak.iWantToTalkToIn",{name:e.name})}),(0,s.jsx)("select",{id:"user-lang-pref",className:"memori-select--button",value:(null!=r?r:E.language).toUpperCase(),"aria-labelledby":"user-lang-pref-label",onChange:e=>{i(e.target.value)},children:oO.map((e=>(0,s.jsx)("option",{value:e.value,"aria-label":e.label,children:e.label},e.value)))})]}),(0,s.jsx)(Em,{primary:!0,disabled:!!e.blockedUntil&&!e.isGiver||b,loading:p,onClick:e=>{try{window.speechSynthesis.speak(new SpeechSynthesisUtterance(""))}catch(e){console.error(e)}f&&f(),m&&m()},className:"memori--start-button",children:A("write_and_speak."+(d?"instructButton":h?"resumeButton":"tryMeButton"))}),(0,s.jsx)(aD,{provider:null===(C=null==e?void 0:e.completionConfigForQuestionAnswering)||void 0===C?void 0:C.provider,forceStatus:g}),(0,s.jsx)("p",{className:"memori--start-description",children:A(d?"write_and_speak.pageInstructExplanation":"write_and_speak.pageTryMeExplanation")}),(e.blockedUntil||b)&&(0,s.jsx)(rD,{memoriName:e.name,blockedUntil:e.blockedUntil,notEnoughCredits:b,showGiverInfo:e.isGiver,showTitle:!0,marginLeft:!0}),!!e.enableDeepThought&&!d&&(0,s.jsxs)("div",{className:"memori--deep-thought-disclaimer",children:[(0,s.jsx)(MN,{align:"left",content:A("deepThoughtHelper"),children:(0,s.jsx)(oD,{})}),(0,s.jsx)("h2",{children:v&&(null==y?void 0:y.pAndCUAccepted)?A("deepThoughtDisclaimerTitle"):A("deepThought")}),v&&!(null==y?void 0:y.pAndCUAccepted)&&(0,s.jsx)("p",{children:A("deepThoughtPreDisclaimerNotAllowed")}),!v&&(0,s.jsx)("p",{children:A("deepThoughtPreDisclaimerUnlogged")}),!v&&S&&(0,s.jsx)("p",{children:(0,s.jsx)(Em,{outlined:!0,padded:!1,onClick:()=>_(!0),children:"Login"})}),(0,s.jsx)("p",{className:"memori--deep-thought-disclaimer-text",children:A("deepThoughtDisclaimer")})]})]})]})},uD=(c=o("85Hg2"),c=o("85Hg2"),ee=o("hcaHr"),{}),dD={};(dD=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}).__esModule=!0,dD.default=dD,(uD=function(e,t){if(null==e)return{};var n,r,i=dD(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}).__esModule=!0,uD.default=uD;c=o("85Hg2");var hD=["forwardedRef"];function pD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function mD(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?pD(Object(r),!0).forEach((function(n){t(te)(e,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pD(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class fD extends c.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){console.error("Uncaught error:",e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,s.jsxs)("div",{style:{background:"rgba(255, 255, 255, 0.4)",color:"#000",padding:"2rem",borderRadius:"10px"},children:[(0,s.jsx)("h2",{children:this.props.t("error.generic")}),(0,s.jsx)(Em,{primary:!0,onClick:()=>this.setState({hasError:!1}),children:this.props.t("error.tryAgain")||"Try again"})]}):this.props.children}}var gD=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){function i(i){var o=i.forwardedRef,s=t(uD)(i,hD),a=Ce(e,mD(mD({},s),{},{keyPrefix:n.keyPrefix})),l=t(ee)(a,3),u=l[0],d=l[1],h=l[2],p=mD(mD({},s),{},{t:u,i18n:d,tReady:h});return n.withRef&&o?p.ref=o:!n.withRef&&o&&(p.forwardedRef=o),(0,c.createElement)(r,p)}i.displayName="withI18nextTranslation(".concat(_e(r),")"),i.WrappedComponent=r;return n.withRef?(0,c.forwardRef)((function(e,t){return(0,c.createElement)(i,Object.assign({},e,{forwardedRef:t}))})):i}}(["common"])(fD);var vD=({avatar:e,speaking:n=!1})=>(0,s.jsxs)("div",{className:t(Cs)("memori-blob",{"memori-blob--speaking":n}),children:[e&&(0,s.jsx)("figure",{children:(0,s.jsx)("img",{src:e,alt:"",role:"presentation"})}),(0,s.jsx)("div",{className:"mainDiv"}),(0,s.jsx)("div",{className:"mainDiv"}),(0,s.jsx)("div",{className:"mainDiv"}),(0,s.jsx)("div",{className:"mainDiv"}),(0,s.jsx)("div",{className:"mainDiv"})]});var yD=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"})});var SD=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:[(0,s.jsx)("path",{d:"M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"}),(0,s.jsx)("path",{d:"M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"})]});var _D=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"})}),bD=(c=o("85Hg2"),c=o("85Hg2"),c=o("85Hg2"),{});Object.defineProperty(bD,"__esModule",{value:!0});c=o("85Hg2");function xD(e){var t,n=new Set,r=function(e,r){var i="function"==typeof e?e(t):e;if(i!==t){var o=t;t=r?i:Object.assign({},t,i),n.forEach((function(e){return e(t,o)}))}},i=function(){return t},o={setState:r,getState:i,subscribe:function(e,r,o){return r||o?function(e,r,o){void 0===r&&(r=i),void 0===o&&(o=Object.is),console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");var s=r(t);function a(){var n=r(t);if(!o(s,n)){var i=s;e(s=n,i)}}return n.add(a),function(){return n.delete(a)}}(e,r,o):(n.add(e),function(){return n.delete(e)})},destroy:function(){return n.clear()}};return t=e(r,i,o),o}var wD="undefined"==typeof window||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?c.useEffect:c.useLayoutEffect;bD.default=function(e){var t="function"==typeof e?xD(e):e,n=function(e,n){void 0===e&&(e=t.getState),void 0===n&&(n=Object.is);var r,i=c.useReducer((function(e){return e+1}),0)[1],o=t.getState(),s=c.useRef(o),a=c.useRef(e),l=c.useRef(n),u=c.useRef(!1),d=c.useRef();void 0===d.current&&(d.current=e(o));var h=!1;(s.current!==o||a.current!==e||l.current!==n||u.current)&&(r=e(o),h=!n(d.current,r)),wD((function(){h&&(d.current=r),s.current=o,a.current=e,l.current=n,u.current=!1}));var p=c.useRef(o);wD((function(){var e=function(){try{var e=t.getState(),n=a.current(e);l.current(d.current,n)||(s.current=e,d.current=n,i())}catch(e){u.current=!0,i()}},n=t.subscribe(e);return t.getState()!==p.current&&e(),n}),[]);var m=h?r:d.current;return c.useDebugValue(m),m};return Object.assign(n,t),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");var e=[n,t];return{next:function(){var t=e.length<=0;return{value:e.shift(),done:t}}}},n};var CD;CD=o("YtP34");var AD,ED=o("kMsGZ");AD=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var s=o[i];if(!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n};const TD=[];function ID(e,n,r,i=0,o=!1){for(const e of n)if(t(AD)(r,e.args)){if(o)return;if(e.error)throw e.error;if(e.response)return e.response;throw e.promise}const s={args:r,promise:e(...r).then((e=>s.response=null==e||e)).catch((e=>s.error=null!=e?e:"unknown error")).then((()=>{i>0&&setTimeout((()=>{const e=n.indexOf(s);-1!==e&&n.splice(e,1)}),i)}))};if(n.push(s),!o)throw s.promise}function MD(e,...n){if(void 0===n||0===n.length)e.splice(0,e.length);else{const r=e.find((e=>t(AD)(n,e.args)));if(r){const t=e.indexOf(r);-1!==t&&e.splice(t,1)}}}function RD(e,...t){return ID(e,TD,t,RD.lifespan)}RD.lifespan=0,RD.clear=(...e)=>MD(TD,...e),RD.preload=(e,...t)=>{ID(e,TD,t,RD.lifespan,!0)},RD.peek=(...e)=>{var n;return null==(n=TD.find((n=>t(AD)(e,n.args))))?void 0:n.response};var PD,ND=function(e){return function(t){e.forEach((function(e){"function"==typeof e?e(t):null!=e&&(e.current=t)}))}};c=o("85Hg2");function OD(e,t,n){var r,i,o,s,a;function l(){var c=Date.now()-s;c<t&&c>=0?r=setTimeout(l,t-c):(r=null,n||(a=e.apply(o,i),o=i=null))}null==t&&(t=100);var c=function(){o=this,i=arguments,s=Date.now();var c=n&&!r;return r||(r=setTimeout(l,t)),c&&(a=e.apply(o,i),o=i=null),a};return c.clear=function(){r&&(clearTimeout(r),r=null)},c.flush=function(){r&&(a=e.apply(o,i),o=i=null,clearTimeout(r),r=null)},c}function DD(e){let{debounce:n,scroll:r,polyfill:i,offsetSize:o}=void 0===e?{debounce:0,scroll:!1,offsetSize:!1}:e;const s=i||("undefined"==typeof window?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,l]=(0,c.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),u=(0,c.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a}),d=n?"number"==typeof n?n:n.scroll:null,h=n?"number"==typeof n?n:n.resize:null,p=(0,c.useRef)(!1);(0,c.useEffect)((()=>(p.current=!0,()=>{p.current=!1})));const[m,f,g]=(0,c.useMemo)((()=>{const e=()=>{if(!u.current.element)return;const{left:e,top:t,width:n,height:r,bottom:i,right:s,x:a,y:c}=u.current.element.getBoundingClientRect(),d={left:e,top:t,width:n,height:r,bottom:i,right:s,x:a,y:c};u.current.element instanceof HTMLElement&&o&&(d.height=u.current.element.offsetHeight,d.width=u.current.element.offsetWidth),Object.freeze(d),p.current&&!BD(u.current.lastBounds,d)&&l(u.current.lastBounds=d)};return[e,h?t(PD)(e,h):e,d?t(PD)(e,d):e]}),[l,o,d,h]);function v(){u.current.scrollContainers&&(u.current.scrollContainers.forEach((e=>e.removeEventListener("scroll",g,!0))),u.current.scrollContainers=null),u.current.resizeObserver&&(u.current.resizeObserver.disconnect(),u.current.resizeObserver=null)}function y(){u.current.element&&(u.current.resizeObserver=new s(g),u.current.resizeObserver.observe(u.current.element),r&&u.current.scrollContainers&&u.current.scrollContainers.forEach((e=>e.addEventListener("scroll",g,{capture:!0,passive:!0}))))}var S,_,b;return S=g,_=Boolean(r),(0,c.useEffect)((()=>{if(_){const e=S;return window.addEventListener("scroll",e,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",e,!0)}}}),[S,_]),b=f,(0,c.useEffect)((()=>{const e=b;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[b]),(0,c.useEffect)((()=>{v(),y()}),[r,g,f]),(0,c.useEffect)((()=>v),[]),[e=>{e&&e!==u.current.element&&(v(),u.current.element=e,u.current.scrollContainers=kD(e),y())},a,m]}function kD(e){const t=[];if(!e||e===document.body)return t;const{overflow:n,overflowX:r,overflowY:i}=window.getComputedStyle(e);return[n,r,i].some((e=>"auto"===e||"scroll"===e))&&t.push(e),[...t,...kD(e.parentElement)]}OD.debounce=OD,PD=OD;const LD=["x","y","top","bottom","left","right","width","height"],BD=(e,t)=>LD.every((n=>e[n]===t[n]));const zD={obj:e=>e===Object(e)&&!zD.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e,arr:e=>Array.isArray(e),equ(e,t){if(typeof e!=typeof t||!!e!=!!t)return!1;if(zD.str(e)||zD.num(e)||zD.obj(e))return e===t;if(zD.arr(e)&&e==t)return!0;let n;for(n in e)if(!(n in t))return!1;for(n in t)if(e[n]!==t[n])return!1;return!zD.und(n)||e===t}};function FD(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function UD(e,t,n,r){const i=n.get(t);i&&(n.delete(t),0===n.size&&(e.delete(r),i.target.releasePointerCapture(r)))}function jD(e){const t=new tf.Vector3;function n(e){return e.filter((e=>["Move","Over","Enter","Out","Leave"].some((t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))))}function r(t){const{internal:n}=e.getState();Array.from(n.hovered.values()).forEach((e=>{if(!t.length||!t.find((t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId))){const r=e.eventObject.__r3f,i=null==r?void 0:r.handlers;if(n.hovered.delete(FD(e)),null!=r&&r.eventCount){const n={...e,intersections:t||[]};null==i.onPointerOut||i.onPointerOut(n),null==i.onPointerLeave||i.onPointerLeave(n)}}}))}function i(e,t){t.forEach((t=>{var n;return null==(n=t.__r3f)||null==n.handlers.onPointerMissed?void 0:n.handlers.onPointerMissed(e)}))}return{handlePointer:o=>{switch(o){case"onPointerLeave":case"onPointerCancel":return()=>r([]);case"onLostPointerCapture":return t=>{const{internal:n}=e.getState();"pointerId"in t&&!n.capturedMap.has(t.pointerId)&&(n.capturedMap.delete(t.pointerId),r([]))}}return s=>{const{onPointerMissed:a,internal:l}=e.getState();!function(t){var n;const r=e.getState(),{raycaster:i,mouse:o,camera:s,size:a}=r,{offsetX:l,offsetY:c}=null!=(n=null==i.computeOffsets?void 0:i.computeOffsets(t,r))?n:t,{width:u,height:d}=a;o.set(l/u*2-1,-c/d*2+1),i.setFromCamera(o,s)}(s),l.lastEvent.current=s;const c="onPointerMove"===o,u="onClick"===o||"onContextMenu"===o||"onDoubleClick"===o,d=function(t,n){const{internal:r}=e.getState();if("pointerId"in n&&r.capturedMap.has(n.pointerId))for(let e of r.capturedMap.get(n.pointerId).values())t.push(e.intersection);return t}(function(t){const n=e.getState(),{raycaster:r,internal:i}=n;if(!r.enabled)return[];const o=new Set,s=[],a=t?t(i.interaction):i.interaction;let l=r.intersectObjects(a,!0).filter((e=>{const t=FD(e);return!o.has(t)&&(o.add(t),!0)}));r.filter&&(l=r.filter(l,n));for(const e of l){let t=e.object;for(;t;){var c;null!=(c=t.__r3f)&&c.eventCount&&s.push({...e,eventObject:t}),t=t.parent}}return s}(c?n:void 0),s),h=u?function(t){const{internal:n}=e.getState(),r=t.offsetX-n.initialClick[0],i=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(r*r+i*i))}(s):0;"onPointerDown"===o&&(l.initialClick=[s.offsetX,s.offsetY],l.initialHits=d.map((e=>e.eventObject))),u&&!d.length&&h<=2&&(i(s,l.interaction),a&&a(s)),c&&r(d),function(n,i,o,s){const{raycaster:a,mouse:l,camera:c,internal:u}=e.getState();if(n.length){const e=t.set(l.x,l.y,0).unproject(c),d={stopped:!1};for(const t of n){const h=e=>{var n,r;return null!=(n=null==(r=u.capturedMap.get(e))?void 0:r.has(t.eventObject))&&n},p=e=>{const n={intersection:t,target:i.target};u.capturedMap.has(e)?u.capturedMap.get(e).set(t.eventObject,n):u.capturedMap.set(e,new Map([[t.eventObject,n]])),i.target.setPointerCapture(e)},m=e=>{const n=u.capturedMap.get(e);n&&UD(u.capturedMap,t.eventObject,n,e)};let f={};for(let e in i){let t=i[e];"function"!=typeof t&&(f[e]=t)}let g={...t,...f,spaceX:l.x,spaceY:l.y,intersections:n,stopped:d.stopped,delta:o,unprojectedPoint:e,ray:a.ray,camera:c,stopPropagation:()=>{const e="pointerId"in i&&u.capturedMap.get(i.pointerId);(!e||e.has(t.eventObject))&&(g.stopped=d.stopped=!0,u.hovered.size&&Array.from(u.hovered.values()).find((e=>e.eventObject===t.eventObject)))&&r([...n.slice(0,n.indexOf(t)),t])},target:{hasPointerCapture:h,setPointerCapture:p,releasePointerCapture:m},currentTarget:{hasPointerCapture:h,setPointerCapture:p,releasePointerCapture:m},sourceEvent:i,nativeEvent:i};if(s(g),!0===d.stopped)break}}}(d,s,h,(e=>{const t=e.eventObject,n=t.__r3f,r=null==n?void 0:n.handlers;if(null!=n&&n.eventCount)if(c){if(r.onPointerOver||r.onPointerEnter||r.onPointerOut||r.onPointerLeave){const t=FD(e),n=l.hovered.get(t);n?n.stopped&&e.stopPropagation():(l.hovered.set(t,e),null==r.onPointerOver||r.onPointerOver(e),null==r.onPointerEnter||r.onPointerEnter(e))}null==r.onPointerMove||r.onPointerMove(e)}else{const n=r[o];n?u&&!l.initialHits.includes(t)||(i(s,l.interaction.filter((e=>!l.initialHits.includes(e)))),n(e)):u&&l.initialHits.includes(t)&&i(s,l.interaction.filter((e=>!l.initialHits.includes(e))))}}))}}}}const GD=e=>e&&!!e.getState,HD=(e,t)=>{var n,r;return{root:GD(e)?e:null!=(n=null==(r=e.__r3f)?void 0:r.root)?n:t.__r3f.root,container:GD(e)?e.getState().scene:e}},VD="__default",WD={};let qD={};function JD(e,t){const n=e;return(null!=t&&t.primitive||!n.__r3f)&&(n.__r3f={root:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...t}),e}const KD=e=>e&&e.isOrthographicCamera;function YD(e){return Array.isArray(e)?Math.min(Math.max(e[0],window.devicePixelRatio),e[1]):e}const $D=c.createContext(null);let XD,QD=[],ZD=[],ek=[];function tk(e,t){for(XD=0;XD<e.length;XD++)e[XD](t)}function nk(e,t){let n=t.clock.getDelta();for("never"===t.frameloop&&"number"==typeof e&&(n=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),XD=0;XD<t.internal.subscribers.length;XD++)t.internal.subscribers[XD].ref.current(t,n);return!t.internal.priority&&t.gl.render&&t.gl.render(t.scene,t.camera),t.internal.frames=Math.max(0,t.internal.frames-1),"always"===t.frameloop?1:t.internal.frames}function rk(e){const{handlePointer:t}=jD(e),n={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};return{connected:!1,handlers:Object.keys(n).reduce(((e,n)=>({...e,[n]:t(n)})),{}),connect:t=>{var r;const{set:i,events:o}=e.getState();null==o.disconnect||o.disconnect(),i((e=>({events:{...e.events,connected:t}}))),Object.entries(null!=(r=null==o?void 0:o.handlers)?r:[]).forEach((([e,r])=>{const[i,o]=n[e];t.addEventListener(i,r,{passive:o})}))},disconnect:()=>{const{set:t,events:r}=e.getState();var i;r.connected&&(Object.entries(null!=(i=r.handlers)?i:[]).forEach((([e,t])=>{if(r&&r.connected instanceof HTMLElement){const[i]=n[e];r.connected.removeEventListener(i,t)}})),t((e=>({events:{...e.events,connected:!1}}))))}}}const ik="undefined"!=typeof window?c.useLayoutEffect:c.useEffect;function ok({set:e}){return ik((()=>(e(new Promise((()=>null))),()=>e(!1))),[]),null}class sk extends c.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}sk.getDerivedStateFromError=()=>({error:!0});const ak=c.forwardRef((function({children:e,fallback:n,tabIndex:r,resize:i,id:o,style:s,className:a,events:l,...u},d){const[h,{width:p,height:m}]=DD({scroll:!0,debounce:{scroll:50,resize:0},...i}),f=c.useRef(null),[g,v]=c.useState(!1),[y,S]=c.useState(!1);if(g)throw g;if(y)throw y;return ik((()=>{p>0&&m>0&&function(e,n,{gl:r,size:i,mode:o=fk[1],events:s,onCreated:a,...l}={}){var u,d,h,p,m;i||(i={width:null!=(d=null==(h=n.parentElement)?void 0:h.clientWidth)?d:0,height:null!=(p=null==(m=n.parentElement)?void 0:m.clientHeight)?p:0});let f=mk.get(n),g=null==f?void 0:f.fiber,v=null==f?void 0:f.store,y=null==(u=v)?void 0:u.getState();if(g&&y){void 0===l.dpr||zD.equ(y.viewport.dpr,YD(l.dpr))||y.setDpr(l.dpr),y.size.width===i.width&&y.size.height===i.height||y.setSize(i.width,i.height),y.frameloop!==l.frameloop&&y.setFrameloop(l.frameloop);l.linear!==y.internal.lastProps.linear&&(bk(n),g=void 0)}if(!g){const e=((e,t)=>{const n="function"==typeof e?e(t):e;if(r=n,null!=r&&r.render)return n;var r;const i=new tf.WebGLRenderer({powerPreference:"high-performance",canvas:t,antialias:!0,alpha:!0,...e});i.outputEncoding=tf.sRGBEncoding,i.toneMapping=tf.ACESFilmicToneMapping,e&&Sk(i,e);return i})(r,n);l.vr&&(e.xr.enabled=!0,e.setAnimationLoop((e=>vk(e,!0)))),v=((e,n,r,i)=>{const{gl:o,size:s,shadows:a=!1,linear:l=!1,flat:u=!1,vr:d=!1,orthographic:h=!1,frameloop:p="always",dpr:m=1,performance:f,clock:g=new tf.Clock,raycaster:v,camera:y,onPointerMissed:S}=i;a&&(o.shadowMap.enabled=!0,"object"==typeof a?Object.assign(o.shadowMap,a):o.shadowMap.type=tf.PCFSoftShadowMap),l&&(o.outputEncoding=tf.LinearEncoding),u&&(o.toneMapping=tf.NoToneMapping),"never"===p&&(g.stop(),g.elapsedTime=0);const _=t(bD)(((t,s)=>{const a=new tf.Raycaster,{params:_,...b}=v||{};e(a,{enabled:!0,...b,params:{...a.params,..._}});const x=y instanceof tf.Camera,w=x?y:h?new tf.OrthographicCamera(0,0,0,0,.1,1e3):new tf.PerspectiveCamera(75,0,.1,1e3);x||(w.position.z=5,y&&e(w,y),null!=y&&y.rotation||w.lookAt(0,0,0));const C=YD(m),A=new tf.Vector3,E=new tf.Vector3,T=new tf.Vector3;function I(e=s().camera,t=E,n=s().size){const{width:r,height:i}=n,o=r/i;t instanceof tf.Vector3?T.copy(t):T.set(...t);const a=e.getWorldPosition(A).distanceTo(T);if(KD(e))return{width:r/e.zoom,height:i/e.zoom,factor:1,distance:a,aspect:o};{const t=e.fov*Math.PI/180,n=2*Math.tan(t/2)*a,s=n*(r/i);return{width:s,height:n,factor:r/s,distance:a,aspect:o}}}let M;const R=e=>t((t=>({performance:{...t.performance,current:e}})));return{gl:o,set:t,get:s,invalidate:()=>n(s()),advance:(e,t)=>r(e,t,s()),linear:l,flat:u,scene:JD(new tf.Scene),camera:w,controls:null,raycaster:a,clock:g,mouse:new tf.Vector2,vr:d,frameloop:p,onPointerMissed:S,performance:{current:1,min:.5,max:1,debounce:200,...f,regress:()=>{const e=s();M&&clearTimeout(M),e.performance.current!==e.performance.min&&R(e.performance.min),M=setTimeout((()=>R(s().performance.max)),e.performance.debounce)}},size:{width:0,height:0},viewport:{initialDpr:C,dpr:C,width:0,height:0,aspect:0,distance:0,factor:0,getCurrentViewport:I},setSize:(e,n)=>{const r={width:e,height:n};t((e=>({size:r,viewport:{...e.viewport,...I(w,E,r)}})))},setDpr:e=>t((t=>({viewport:{...t.viewport,dpr:YD(e)}}))),setFrameloop:(e="always")=>t((()=>({frameloop:e}))),events:{connected:!1},internal:{active:!1,priority:0,frames:0,lastProps:i,lastEvent:c.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(e,n=0)=>(t((({internal:t})=>({internal:{...t,priority:t.priority+(n>0?1:0),subscribers:[...t.subscribers,{ref:e,priority:n}].sort(((e,t)=>e.priority-t.priority))}}))),()=>{t((({internal:t})=>({internal:{...t,priority:t.priority-(n>0?1:0),subscribers:t.subscribers.filter((t=>t.ref!==e))}})))})}}})),b=_.getState();let x=b.size,w=b.viewport.dpr;return _.subscribe((()=>{const{camera:e,size:t,viewport:n,internal:r}=_.getState();t===x&&n.dpr===w||(e.manual||r.lastProps.camera instanceof tf.Camera||(KD(e)?(e.left=t.width/-2,e.right=t.width/2,e.top=t.height/2,e.bottom=t.height/-2):e.aspect=t.width/t.height,e.updateProjectionMatrix(),e.updateMatrixWorld()),o.setPixelRatio(n.dpr),o.setSize(t.width,t.height),x=t,w=n.dpr)})),s&&b.setSize(s.width,s.height),_.subscribe((e=>n(e))),_})(Sk,gk,vk,{gl:e,size:i,...l});const a=v.getState();g=yk.createContainer(v,fk.indexOf(o),!1,null),mk.set(n,{fiber:g,store:v}),s&&a.set({events:s(v)})}if(v&&g)return yk.updateContainer(c.createElement(_k,{store:v,element:e,onCreated:a,target:n}),g,null,(()=>{})),v;throw"Error creating root!"}(c.createElement(sk,{set:S},c.createElement(c.Suspense,{fallback:c.createElement(ok,{set:v})},e)),f.current,{...u,size:{width:p,height:m},events:l||rk})}),[p,m,e]),ik((()=>{const e=f.current;return()=>bk(e)}),[]),c.createElement("div",{ref:h,id:o,className:a,tabIndex:r,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",...s}},c.createElement("canvas",{ref:ND([f,d]),style:{display:"block"}},n))}));function lk(){const e=c.useContext($D);if(!e)throw"R3F hooks can only be used within the Canvas component!";return e}function ck(e=(e=>e),t){return lk()(e,t)}function uk(e,t=0){const n=lk().getState().internal.subscribe,r=c.useRef(e);return c.useLayoutEffect((()=>{r.current=e}),[e]),c.useLayoutEffect((()=>n(r,t)),[t,n]),null}function dk(e){const t={nodes:{},materials:{}};return e&&e.traverse((e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material)})),t}function hk(e,t){return function(n,...r){const i=new n;return e&&e(i),Promise.all(r.map((e=>new Promise(((n,r)=>i.load(e,(e=>{e.scene&&Object.assign(e,dk(e.scene)),n(e)}),t,(t=>r(`Could not load ${e}: ${t.message}`))))))))}}function pk(e,t,n,r){const i=Array.isArray(t)?t:[t],o=RD(hk(n,r),e,...i);return Array.isArray(t)?o:o[0]}pk.preload=function(e,t,n){const r=Array.isArray(t)?t:[t];return RD.preload(hk(n),e,...r)},pk.clear=function(e,t){const n=Array.isArray(t)?t:[t];return RD.clear(e,...n)};const mk=new Map,fk=["legacy","blocking","concurrent"],{invalidate:gk,advance:vk}=function(e){let t,n=!1;function r(i){if(n=!0,t=0,tk(QD,i),e.forEach((e=>{const n=e.store.getState();n.internal.active&&("always"===n.frameloop||n.internal.frames>0)&&(t+=nk(i,n))})),tk(ZD,i),t>0)return requestAnimationFrame(r);tk(ek,i),n=!1}return{loop:r,invalidate:function t(i){if(!i)return e.forEach((e=>t(e.store.getState())));!i.vr&&i.internal.active&&"never"!==i.frameloop&&(i.internal.frames=Math.min(60,i.internal.frames+1),n||(n=!0,requestAnimationFrame(r)))},advance:function(t,n=!0,r){n&&tk(QD,t),r?nk(t,r):e.forEach((e=>nk(t,e.store.getState()))),n&&tk(ZD,t)}}}(mk),{reconciler:yk,applyProps:Sk}=function(e){function n(e,{children:t,key:n,ref:r,...i},{children:o,key:s,ref:a,...l}={},c=!1){var u;const d=null!=(u=null==e?void 0:e.__r3f)?u:{},h=Object.entries(i),p=[];if(c){const e=Object.keys(l);for(let t=0;t<e.length;t++)i.hasOwnProperty(e[t])||h.unshift([e[t],VD+"remove"])}h.forEach((([t,n])=>{var r;if(null!=(r=e.__r3f)&&r.primitive&&"object"===t)return;if(function(e,t){return!(!zD.arr(e)||!zD.equ(e,t))||e===t}(n,l[t]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(t))return p.push([t,n,!0,[]]);let i=[];t.includes("-")&&(i=t.split("-")),p.push([t,n,!1,i])}));const m={...i};return d.memoizedProps&&d.memoizedProps.args&&(m.args=d.memoizedProps.args),d.memoizedProps&&d.memoizedProps.attach&&(m.attach=d.memoizedProps.attach),{accumulative:c,memoized:m,changes:p}}function r(e,t){var r,s,a;const l=null!=(r=null==e?void 0:e.__r3f)?r:{},c=l.root,u=null!=(s=null==c||null==c.getState?void 0:c.getState())?s:{},{memoized:d,changes:h}=(p=t)&&p.memoized&&p.changes?t:n(e,t);var p;const m=l.eventCount;if(e.__r3f&&(e.__r3f.memoizedProps=d),h.forEach((([t,n,r,o])=>{var s;let a=e,c=a[t];if(o.length&&(c=o.reduce(((e,t)=>e[t]),e),!c||!c.set)){const[n,...r]=o.reverse();a=r.reverse().reduce(((e,t)=>e[t]),e),t=n}if(n===VD+"remove")if(c&&c.constructor)n=new c.constructor(d.args);else if(a.constructor){const e=new a.constructor(a.__r3f.memoizedProps.args);n=e[c],e.dispose&&e.dispose()}else n=0;const h=(null==u||null==(s=u.gl)?void 0:s.outputEncoding)===tf.LinearEncoding;if(r)n?l.handlers[t]=n:delete l.handlers[t],l.eventCount=Object.keys(l.handlers).length;else if(c&&c.set&&(c.copy||c instanceof tf.Layers)){if(Array.isArray(n))c.fromArray?c.fromArray(n):c.set(...n);else if(c.copy&&n&&n.constructor&&c.constructor.name===n.constructor.name)c.copy(n);else if(void 0!==n){const e=c instanceof tf.Color;!e&&c.setScalar?c.setScalar(n):c instanceof tf.Layers&&n instanceof tf.Layers?c.mask=n.mask:c.set(n),!h&&e&&c.convertSRGBToLinear()}}else a[t]=n,!h&&a[t]instanceof tf.Texture&&(a[t].encoding=tf.sRGBEncoding);i(e)})),l.parent&&u.internal&&e.raycast&&m!==l.eventCount){const t=u.internal.interaction.indexOf(e);t>-1&&u.internal.interaction.splice(t,1),l.eventCount&&u.internal.interaction.push(e)}return h.length&&null!=(a=e.__r3f)&&a.parent&&o(e),e}function i(e){var t,n;const r=null==(t=e.__r3f)||null==(n=t.root)||null==n.getState?void 0:n.getState();r&&0===r.internal.frames&&r.invalidate()}function o(e){null==e.onUpdate||e.onUpdate(e)}function s(e,{args:t=[],...n},i,o,s){let a,l=`${e[0].toUpperCase()}${e.slice(1)}`;if(!GD(i)&&s){const e=t=>t.return?e(t.return):t.stateNode&&t.stateNode.containerInfo;i=e(s)}if(!i||!GD(i))throw`No valid root for ${l}!`;if("primitive"===e){if(void 0===n.object)throw"Primitives without 'object' are invalid!";a=JD(n.object,{root:i,primitive:!0})}else{const e=qD[l]||tf[l];if(!e)throw`${l} is not part of the THREE namespace! Did you forget to extend? See: https://github.com/pmndrs/react-three-fiber/blob/master/markdown/api.md#using-3rd-party-objects-declaratively`;if(!Array.isArray(t))throw"The args prop must be an array!";a=JD(new e(...t),{root:i,memoizedProps:{args:0===t.length?null:t}})}return"attachFns"in n||(l.endsWith("Geometry")?n={attach:"geometry",...n}:l.endsWith("Material")&&(n={attach:"material",...n})),r(a,n),a}function a(e,t){let n=!1;if(t){if(t.attachArray)zD.arr(e[t.attachArray])||(e[t.attachArray]=[]),e[t.attachArray].push(t);else if(t.attachObject)zD.obj(e[t.attachObject[0]])||(e[t.attachObject[0]]={}),e[t.attachObject[0]][t.attachObject[1]]=t;else if(t.attach&&!zD.fun(t.attach))e[t.attach]=t;else if(zD.arr(t.attachFns)){const[n]=t.attachFns;zD.str(n)&&zD.fun(e[n])?e[n](t):zD.fun(n)&&n(t,e)}else t.isObject3D&&e.isObject3D&&(e.add(t),n=!0);n||e.__r3f.objects.push(t),t.__r3f||JD(t,{}),t.__r3f.parent=e,o(t),i(t)}}function l(e,t,n){let r=!1;if(t){if(t.attachArray){const r=e[t.attachArray];zD.arr(r)||(e[t.attachArray]=[]),r.splice(r.indexOf(n),0,t)}else{if(t.attachObject||t.attach&&!zD.fun(t.attach))return a(e,t);if(t.isObject3D&&e.isObject3D){t.parent=e,t.dispatchEvent({type:"added"});const i=e.children.filter((e=>e!==t)),o=i.indexOf(n);e.children=[...i.slice(0,o),t,...i.slice(o)],r=!0}}r||e.__r3f.objects.push(t),t.__r3f||JD(t,{}),t.__r3f.parent=e,o(t),i(t)}}function c(e,t,n=!1){e&&[...e].forEach((e=>u(t,e,n)))}function u(e,t,n){if(t){var r,o;if(t.__r3f&&(t.__r3f.parent=null),null!=(r=e.__r3f)&&r.objects&&(e.__r3f.objects=e.__r3f.objects.filter((e=>e!==t))),t.attachArray)e[t.attachArray]=e[t.attachArray].filter((e=>e!==t));else if(t.attachObject)delete e[t.attachObject[0]][t.attachObject[1]];else if(t.attach&&!zD.fun(t.attach)&&e[t.attach]===t)e[t.attach]=null;else if(zD.arr(t.attachFns)){const[,n]=t.attachFns;zD.str(n)&&zD.fun(e[n])?e[n](t):zD.fun(n)&&n(t,e)}else if(t.isObject3D&&e.isObject3D){var s;e.remove(t),null!=(s=t.__r3f)&&s.root&&function(e,t){const{internal:n}=e.getState();n.interaction=n.interaction.filter((e=>e!==t)),n.initialHits=n.initialHits.filter((e=>e!==t)),n.hovered.forEach(((e,r)=>{e.eventObject!==t&&e.object!==t||n.hovered.delete(r)})),n.capturedMap.forEach(((e,r)=>{UD(n.capturedMap,t,e,r)}))}(t.__r3f.root,t)}const l=null==(o=t.__r3f)?void 0:o.primitive,u=void 0===n?null!==t.dispose&&!l:n;var a;if(!l)c(null==(a=t.__r3f)?void 0:a.objects,t,u),c(t.children,t,u);t.__r3f&&(delete t.__r3f.root,delete t.__r3f.objects,delete t.__r3f.handlers,delete t.__r3f.memoizedProps,l||delete t.__r3f),u&&t.dispose&&"Scene"!==t.type&&(0,ED.unstable_runWithPriority)(ED.unstable_IdlePriority,(()=>{try{t.dispose()}catch(e){}})),i(e)}}return{reconciler:t(CD)({now:ED.unstable_now,createInstance:s,removeChild:u,appendChild:a,appendInitialChild:a,insertBefore:l,warnsIfNotActing:!0,supportsMutation:!0,isPrimaryRenderer:!1,scheduleTimeout:zD.fun(setTimeout)?setTimeout:void 0,cancelTimeout:zD.fun(clearTimeout)?clearTimeout:void 0,setTimeout:zD.fun(setTimeout)?setTimeout:void 0,clearTimeout:zD.fun(clearTimeout)?clearTimeout:void 0,noTimeout:-1,appendChildToContainer:(e,t)=>{const{container:n,root:r}=HD(e,t);n.__r3f.root=r,a(n,t)},removeChildFromContainer:(e,t)=>u(HD(e,t).container,t),insertInContainerBefore:(e,t,n)=>l(HD(e,t).container,t,n),prepareUpdate(e,t,r,i){if(e.__r3f.primitive&&i.object&&i.object!==e)return[!0];{const{args:t=[],children:o,...s}=i,{args:l=[],children:c,...u}=r;if(!Array.isArray(t))throw"The args prop must be an array!";if(t.some(((e,t)=>e!==l[t])))return[!0];const d=n(e,s,u,!0);if(d.changes.length)return[!1,d];if(e.attach&&"function"!=typeof e.attach){const t=e.__r3f.parent;t&&t[e.attach]!==e&&a(t,e)}return null}},commitUpdate(e,[t,n],i,o,l,c){t?function(e,t,n,r){var i;const o=null==(i=e.__r3f)?void 0:i.parent;if(!o)return;const l=s(t,n,e.__r3f.root);"primitive"!==t&&e.children&&(e.children.forEach((e=>a(l,e))),e.children=[]),e.__r3f.objects.forEach((e=>a(l,e))),e.__r3f.objects=[],u(o,e),a(o,l),l.raycast&&l.__r3f.eventCount&&l.__r3f.root.getState().internal.interaction.push(l);[r,r.alternate].forEach((e=>{null!==e&&(e.stateNode=l,e.ref&&("function"==typeof e.ref?e.ref(l):e.ref.current=l))}))}(e,i,l,c):r(e,n)},hideInstance(e){e.isObject3D&&(e.visible=!1,i(e))},unhideInstance(e,t){(e.isObject3D&&null==t.visible||t.visible)&&(e.visible=!0,i(e))},hideTextInstance(){throw new Error("Text is not allowed in the R3F tree.")},getPublicInstance:e=>e,getRootHostContext:e=>WD,getChildHostContext:e=>e,createTextInstance(){},finalizeInitialChildren(e){var t;return!!(null!=(t=null==e?void 0:e.__r3f)?t:{}).handlers},commitMount(e){var t;const n=null!=(t=null==e?void 0:e.__r3f)?t:{};e.raycast&&n.handlers&&n.eventCount&&e.__r3f.root.getState().internal.interaction.push(e)},shouldDeprioritizeSubtree:()=>!1,prepareForCommit:()=>null,preparePortalMount(e){JD(e)},resetAfterCommit(){},shouldSetTextContent:()=>!1,clearContainer:()=>!1}),applyProps:r}}();function _k({store:e,element:t,onCreated:n,target:r}){return c.useEffect((()=>{const t=e.getState();t.set((e=>({internal:{...e.internal,active:!0}}))),null==t.events.connect||t.events.connect(r),n&&n(t)}),[]),c.createElement($D.Provider,{value:e},t)}function bk(e,t){const n=mk.get(e),r=null==n?void 0:n.fiber;if(r){const i=null==n?void 0:n.store.getState();i&&(i.internal.active=!1),yk.updateContainer(null,r,null,(()=>{i&&setTimeout((()=>{var n,r,o;null==i.events.disconnect||i.events.disconnect(),null==(n=i.gl)||null==(r=n.renderLists)||null==r.dispose||r.dispose(),null==(o=i.gl)||null==o.forceContextLoss||o.forceContextLoss(),function(e){e.dispose&&"Scene"!==e.type&&e.dispose();for(const r in e){var t,n;null==(t=(n=r).dispose)||t.call(n),delete e[r]}}(i),mk.delete(e),t&&t(e)}),500)}))}}yk.act;function xk(){return xk=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xk.apply(this,arguments)}yk.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:"17.0.2"});c=o("85Hg2");function wk(e){return wk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wk(e)}function Ck(e,t){if("object"!==wk(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==wk(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function Ak(e){var t=Ck(e,"string");return"symbol"===wk(t)?t:String(t)}function Ek(e,t,n){return(t=Ak(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Tk=(e,t)=>(e%t+t)%t;class Ik extends py{constructor(e,t){super(),Ek(this,"object",void 0),Ek(this,"domElement",void 0),Ek(this,"enabled",!0),Ek(this,"target",new oS),Ek(this,"minDistance",0),Ek(this,"maxDistance",1/0),Ek(this,"minZoom",0),Ek(this,"maxZoom",1/0),Ek(this,"minPolarAngle",0),Ek(this,"maxPolarAngle",Math.PI),Ek(this,"minAzimuthAngle",-1/0),Ek(this,"maxAzimuthAngle",1/0),Ek(this,"enableDamping",!1),Ek(this,"dampingFactor",.05),Ek(this,"enableZoom",!0),Ek(this,"zoomSpeed",1),Ek(this,"enableRotate",!0),Ek(this,"rotateSpeed",1),Ek(this,"enablePan",!0),Ek(this,"panSpeed",1),Ek(this,"screenSpacePanning",!0),Ek(this,"keyPanSpeed",7),Ek(this,"autoRotate",!1),Ek(this,"autoRotateSpeed",2),Ek(this,"reverseOrbit",!1),Ek(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Ek(this,"mouseButtons",{LEFT:rf.ROTATE,MIDDLE:rf.DOLLY,RIGHT:rf.PAN}),Ek(this,"touches",{ONE:of.ROTATE,TWO:of.DOLLY_PAN}),Ek(this,"target0",void 0),Ek(this,"position0",void 0),Ek(this,"zoom0",void 0),Ek(this,"_domElementKeyEvents",null),Ek(this,"getPolarAngle",void 0),Ek(this,"getAzimuthalAngle",void 0),Ek(this,"setPolarAngle",void 0),Ek(this,"setAzimuthalAngle",void 0),Ek(this,"getDistance",void 0),Ek(this,"listenToKeyEvents",void 0),Ek(this,"saveState",void 0),Ek(this,"reset",void 0),Ek(this,"update",void 0),Ek(this,"connect",void 0),Ek(this,"dispose",void 0),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object instanceof mb?this.object.zoom:1,this.getPolarAngle=()=>c.phi,this.getAzimuthalAngle=()=>c.theta,this.setPolarAngle=e=>{let t=Tk(e,2*Math.PI),r=c.phi;r<0&&(r+=2*Math.PI),t<0&&(t+=2*Math.PI);let i=Math.abs(t-r);2*Math.PI-i<i&&(t<r?t+=2*Math.PI:r+=2*Math.PI),u.phi=t-r,n.update()},this.setAzimuthalAngle=e=>{let t=Tk(e,2*Math.PI),r=c.theta;r<0&&(r+=2*Math.PI),t<0&&(t+=2*Math.PI);let i=Math.abs(t-r);2*Math.PI-i<i&&(t<r?t+=2*Math.PI:r+=2*Math.PI),u.theta=t-r,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=e=>{e.addEventListener("keydown",q),this._domElementKeyEvents=e},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object instanceof mb?n.object.zoom:1},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object instanceof mb&&(n.object.zoom=n.zoom0,n.object.updateProjectionMatrix()),n.dispatchEvent(r),n.update(),a=s.NONE},this.update=(()=>{const t=new oS,i=(new iS).setFromUnitVectors(e.up,new oS(0,1,0)),o=i.clone().invert(),m=new oS,f=new iS,g=2*Math.PI;return function(){const e=n.object.position;t.copy(e).sub(n.target),t.applyQuaternion(i),c.setFromVector3(t),n.autoRotate&&a===s.NONE&&E(2*Math.PI/60/60*n.autoRotateSpeed),n.enableDamping?(c.theta+=u.theta*n.dampingFactor,c.phi+=u.phi*n.dampingFactor):(c.theta+=u.theta,c.phi+=u.phi);let v=n.minAzimuthAngle,y=n.maxAzimuthAngle;return isFinite(v)&&isFinite(y)&&(v<-Math.PI?v+=g:v>Math.PI&&(v-=g),y<-Math.PI?y+=g:y>Math.PI&&(y-=g),c.theta=v<=y?Math.max(v,Math.min(y,c.theta)):c.theta>(v+y)/2?Math.max(v,c.theta):Math.min(y,c.theta)),c.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,c.phi)),c.makeSafe(),c.radius*=d,c.radius=Math.max(n.minDistance,Math.min(n.maxDistance,c.radius)),!0===n.enableDamping?n.target.addScaledVector(h,n.dampingFactor):n.target.add(h),t.setFromSpherical(c),t.applyQuaternion(o),e.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,h.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),h.set(0,0,0)),d=1,!!(p||m.distanceToSquared(n.object.position)>l||8*(1-f.dot(n.object.quaternion))>l)&&(n.dispatchEvent(r),m.copy(n.object.position),f.copy(n.object.quaternion),p=!1,!0)}})(),this.connect=e=>{e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),n.domElement=e,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",J),n.domElement.addEventListener("pointerdown",j),n.domElement.addEventListener("pointercancel",V),n.domElement.addEventListener("wheel",W)},this.dispose=()=>{var e,t,r,i,o,s;null===(e=n.domElement)||void 0===e||e.removeEventListener("contextmenu",J),null===(t=n.domElement)||void 0===t||t.removeEventListener("pointerdown",j),null===(r=n.domElement)||void 0===r||r.removeEventListener("pointercancel",V),null===(i=n.domElement)||void 0===i||i.removeEventListener("wheel",W),null===(o=n.domElement)||void 0===o||o.ownerDocument.removeEventListener("pointermove",G),null===(s=n.domElement)||void 0===s||s.ownerDocument.removeEventListener("pointerup",H),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",q)};const n=this,r={type:"change"},i={type:"start"},o={type:"end"},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let a=s.NONE;const l=1e-6,c=new WI,u=new WI;let d=1;const h=new oS;let p=!1;const m=new Iy,f=new Iy,g=new Iy,v=new Iy,y=new Iy,S=new Iy,_=new Iy,b=new Iy,x=new Iy,w=[],C={};function A(){return Math.pow(.95,n.zoomSpeed)}function E(e){n.reverseOrbit?u.theta+=e:u.theta-=e}function T(e){n.reverseOrbit?u.phi+=e:u.phi-=e}const I=(()=>{const e=new oS;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),h.add(e)}})(),M=(()=>{const e=new oS;return function(t,r){!0===n.screenSpacePanning?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),h.add(e)}})(),R=(()=>{const e=new oS;return function(t,r){const i=n.domElement;if(i&&n.object instanceof mb&&n.object.isPerspectiveCamera){const o=n.object.position;e.copy(o).sub(n.target);let s=e.length();s*=Math.tan(n.object.fov/2*Math.PI/180),I(2*t*s/i.clientHeight,n.object.matrix),M(2*r*s/i.clientHeight,n.object.matrix)}else i&&n.object instanceof zb&&n.object.isOrthographicCamera?(I(t*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),M(r*(n.object.top-n.object.bottom)/n.object.zoom/i.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function P(e){n.object instanceof mb&&n.object.isPerspectiveCamera?d/=e:n.object instanceof zb&&n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),p=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function N(e){n.object instanceof mb&&n.object.isPerspectiveCamera?d*=e:n.object instanceof zb&&n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),p=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function O(e){m.set(e.clientX,e.clientY)}function D(e){v.set(e.clientX,e.clientY)}function k(){if(1==w.length)m.set(w[0].pageX,w[0].pageY);else{const e=.5*(w[0].pageX+w[1].pageX),t=.5*(w[0].pageY+w[1].pageY);m.set(e,t)}}function L(){if(1==w.length)v.set(w[0].pageX,w[0].pageY);else{const e=.5*(w[0].pageX+w[1].pageX),t=.5*(w[0].pageY+w[1].pageY);v.set(e,t)}}function B(){const e=w[0].pageX-w[1].pageX,t=w[0].pageY-w[1].pageY,n=Math.sqrt(e*e+t*t);_.set(0,n)}function z(e){if(1==w.length)f.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);f.set(n,r)}g.subVectors(f,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;t&&(E(2*Math.PI*g.x/t.clientHeight),T(2*Math.PI*g.y/t.clientHeight)),m.copy(f)}function F(e){if(1==w.length)y.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);y.set(n,r)}S.subVectors(y,v).multiplyScalar(n.panSpeed),R(S.x,S.y),v.copy(y)}function U(e){const t=$(e),r=e.pageX-t.x,i=e.pageY-t.y,o=Math.sqrt(r*r+i*i);b.set(0,o),x.set(0,Math.pow(b.y/_.y,n.zoomSpeed)),P(x.y),_.copy(b)}function j(e){if(!1!==n.enabled){var t,r;if(0===w.length)null===(t=n.domElement)||void 0===t||t.ownerDocument.addEventListener("pointermove",G),null===(r=n.domElement)||void 0===r||r.ownerDocument.addEventListener("pointerup",H);!function(e){w.push(e)}(e),"touch"===e.pointerType?function(e){switch(Y(e),w.length){case 1:switch(n.touches.ONE){case of.ROTATE:if(!1===n.enableRotate)return;k(),a=s.TOUCH_ROTATE;break;case of.PAN:if(!1===n.enablePan)return;L(),a=s.TOUCH_PAN;break;default:a=s.NONE}break;case 2:switch(n.touches.TWO){case of.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&B(),n.enablePan&&L(),a=s.TOUCH_DOLLY_PAN;break;case of.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&B(),n.enableRotate&&k(),a=s.TOUCH_DOLLY_ROTATE;break;default:a=s.NONE}break;default:a=s.NONE}a!==s.NONE&&n.dispatchEvent(i)}(e):function(e){let t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case rf.DOLLY:if(!1===n.enableZoom)return;!function(e){_.set(e.clientX,e.clientY)}(e),a=s.DOLLY;break;case rf.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;D(e),a=s.PAN}else{if(!1===n.enableRotate)return;O(e),a=s.ROTATE}break;case rf.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;O(e),a=s.ROTATE}else{if(!1===n.enablePan)return;D(e),a=s.PAN}break;default:a=s.NONE}a!==s.NONE&&n.dispatchEvent(i)}(e)}}function G(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(Y(e),a){case s.TOUCH_ROTATE:if(!1===n.enableRotate)return;z(e),n.update();break;case s.TOUCH_PAN:if(!1===n.enablePan)return;F(e),n.update();break;case s.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&U(e),n.enablePan&&F(e)}(e),n.update();break;case s.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&U(e),n.enableRotate&&z(e)}(e),n.update();break;default:a=s.NONE}}(e):function(e){if(!1===n.enabled)return;switch(a){case s.ROTATE:if(!1===n.enableRotate)return;!function(e){f.set(e.clientX,e.clientY),g.subVectors(f,m).multiplyScalar(n.rotateSpeed);const t=n.domElement;t&&(E(2*Math.PI*g.x/t.clientHeight),T(2*Math.PI*g.y/t.clientHeight)),m.copy(f),n.update()}(e);break;case s.DOLLY:if(!1===n.enableZoom)return;!function(e){b.set(e.clientX,e.clientY),x.subVectors(b,_),x.y>0?P(A()):x.y<0&&N(A()),_.copy(b),n.update()}(e);break;case s.PAN:if(!1===n.enablePan)return;!function(e){y.set(e.clientX,e.clientY),S.subVectors(y,v).multiplyScalar(n.panSpeed),R(S.x,S.y),v.copy(y),n.update()}(e)}}(e))}function H(e){var t,r,i;(K(e),0===w.length)&&(null===(t=n.domElement)||void 0===t||t.releasePointerCapture(e.pointerId),null===(r=n.domElement)||void 0===r||r.ownerDocument.removeEventListener("pointermove",G),null===(i=n.domElement)||void 0===i||i.ownerDocument.removeEventListener("pointerup",H));n.dispatchEvent(o),a=s.NONE}function V(e){K(e)}function W(e){!1===n.enabled||!1===n.enableZoom||a!==s.NONE&&a!==s.ROTATE||(e.preventDefault(),n.dispatchEvent(i),function(e){e.deltaY<0?N(A()):e.deltaY>0&&P(A()),n.update()}(e),n.dispatchEvent(o))}function q(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:R(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:R(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:R(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:R(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function J(e){!1!==n.enabled&&e.preventDefault()}function K(e){delete C[e.pointerId];for(let t=0;t<w.length;t++)if(w[t].pointerId==e.pointerId)return void w.splice(t,1)}function Y(e){let t=C[e.pointerId];void 0===t&&(t=new Iy,C[e.pointerId]=t),t.set(e.pageX,e.pageY)}function $(e){const t=e.pointerId===w[0].pointerId?w[1]:w[0];return C[t.pointerId]}void 0!==t&&this.connect(t),this.update()}}const Mk=c.forwardRef((({makeDefault:e,camera:t,regress:n,domElement:r,enableDamping:i=!0,onChange:o,onStart:s,onEnd:a,...l},u)=>{const d=ck((e=>e.invalidate)),h=ck((e=>e.camera)),p=ck((e=>e.gl)),m=ck((e=>e.events)),f=ck((e=>e.set)),g=ck((e=>e.get)),v=ck((e=>e.performance)),y=t||h,S=r||m.connected||p.domElement,_=c.useMemo((()=>new Ik(y)),[y]);return uk((()=>{_.enabled&&_.update()})),c.useEffect((()=>(_.connect(S),()=>{_.dispose()})),[S,n,_,d]),c.useEffect((()=>{const e=e=>{d(),n&&v.regress(),o&&o(e)};return _.addEventListener("change",e),s&&_.addEventListener("start",s),a&&_.addEventListener("end",a),()=>{s&&_.removeEventListener("start",s),a&&_.removeEventListener("end",a),_.removeEventListener("change",e)}}),[o,s,a]),c.useEffect((()=>{if(e){const e=g().controls;return f({controls:_}),()=>f({controls:e})}}),[e,_]),c.createElement("primitive",xk({ref:u,object:_,enableDamping:i},l))}));const Rk=(c=o("85Hg2")).forwardRef((({makeDefault:e,...t},n)=>{const r=ck((({set:e})=>e)),i=ck((({camera:e})=>e)),o=ck((({size:e})=>e)),s=c.useRef();return c.useLayoutEffect((()=>{const{current:e}=s;e&&!t.manual&&(e.aspect=o.width/o.height,e.updateProjectionMatrix())}),[o,t]),c.useLayoutEffect((()=>{if(e&&s.current){const e=i;return r((()=>({camera:s.current}))),()=>r((()=>({camera:e})))}}),[i,s,e,r]),c.createElement("perspectiveCamera",xk({ref:ND([s,n])},t))}));c=o("85Hg2"),c=o("85Hg2");
246
246
  /**
247
247
  * lil-gui
248
248
  * https://lil-gui.georgealways.com
@@ -255,4 +255,4 @@ class Pk{constructor(e,t,n,r,i="div"){this.parent=e,this.object=t,this.property=
255
255
  * @license qrcode.react
256
256
  * Copyright (c) Paul O'Shannessy
257
257
  * SPDX-License-Identifier: ISC
258
- */function kF(e,t=0){const n=[];return e.forEach((function(e,r){let i=null;e.forEach((function(o,s){if(!o&&null!==i)return n.push(`M${i+t} ${r+t}h${s-i}v1H${i+t}z`),void(i=null);if(s!==e.length-1)o&&null===i&&(i=s);else{if(!o)return;null===i?n.push(`M${s+t},${r+t} h1v1H${s+t}z`):n.push(`M${i+t},${r+t} h${s+1-i}v1H${i+t}z`)}}))})),n.join("")}function LF(e,t){return e.slice().map(((e,n)=>n<t.y||n>=t.y+t.h?e:e.map(((e,n)=>(n<t.x||n>=t.x+t.w)&&e))))}function BF(e,t,n,r){if(null==r)return null;const i=n?4:0,o=e.length+2*i,s=Math.floor(.1*t),a=o/t,l=(r.width||s)*a,c=(r.height||s)*a,u=null==r.x?e.length/2-l/2:r.x*a,d=null==r.y?e.length/2-c/2:r.y*a;let h=null;if(r.excavate){let e=Math.floor(u),t=Math.floor(d);h={x:e,y:t,w:Math.ceil(l+u-e),h:Math.ceil(c+d-t)}}return{x:u,y:d,h:c,w:l,excavation:h}}var zF=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}();function FF(e){const n=e,{value:r,size:i=RF,level:o=PF,bgColor:s=NF,fgColor:a=OF,includeMargin:l=DF,style:u,imageSettings:d}=n,h=TF(n,["value","size","level","bgColor","fgColor","includeMargin","style","imageSettings"]),p=null==d?void 0:d.src,m=(0,c.useRef)(null),f=(0,c.useRef)(null),[g,v]=(0,c.useState)(!1);(0,c.useEffect)((()=>{if(null!=m.current){const e=m.current,t=e.getContext("2d");if(!t)return;let n=IF.QrCode.encodeText(r,MF[o]).getModules();const c=l?4:0,u=n.length+2*c,h=BF(n,i,l,d),p=f.current,g=null!=h&&null!==p&&p.complete&&0!==p.naturalHeight&&0!==p.naturalWidth;g&&null!=h.excavation&&(n=LF(n,h.excavation));const v=window.devicePixelRatio||1;e.height=e.width=i*v;const y=i/u*v;t.scale(y,y),t.fillStyle=s,t.fillRect(0,0,u,u),t.fillStyle=a,zF?t.fill(new Path2D(kF(n,c))):n.forEach((function(e,n){e.forEach((function(e,r){e&&t.fillRect(r+c,n+c,1,1)}))})),g&&t.drawImage(p,h.x+c,h.y+c,h.w,h.h)}})),(0,c.useEffect)((()=>{v(!1)}),[p]);const y=EF({height:i,width:i},u);let S=null;return null!=p&&(S=t(c).createElement("img",{src:p,key:p,style:{display:"none"},onLoad:()=>{v(!0)},ref:f})),t(c).createElement(t(c).Fragment,null,t(c).createElement("canvas",EF({style:y,height:i,width:i,ref:m},h)),S)}var UF=({tenant:e,url:n,title:r="",className:i,baseUrl:o,primary:a=!0,showQrCode:l=!0,align:u="right"})=>{const{t:d}=Ce(),[h,p]=(0,c.useState)(n),m=(0,c.useMemo)((()=>(null==e?void 0:e.theme)?`${null!=o?o:"https://aisuru.com"}/images/${e.theme}/square_logo.png`:`${null!=o?o:"https://aisuru.com"}/images/memori_logo.png`),[e,o]);(0,c.useEffect)((()=>{n||p(window.location.href)}),[n]);const f=[{id:"facebook",title:"Facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${h}`,icon:hF},{id:"twitter",title:"Twitter",url:`https://twitter.com/intent/tweet?url=${h}`,icon:pF},{id:"linkedin",title:"LinkedIn",url:`https://www.linkedin.com/shareArticle?mini=true&title=${r}&url=${h}`,icon:mF},{id:"whatsapp",title:"Whatsapp",url:`https://api.whatsapp.com/send?phone=&text=${h}`,icon:fF},{id:"telegram",title:"Telegram",url:`https://t.me/share/url?text=${r}&url=${h}`,icon:_F},{id:"email",title:"Email",url:`mailto:?subject=${(null==r?void 0:r.length)>0?r:n}&body=${h}`,icon:gF}];return(0,s.jsxs)(WN,{as:"div",className:t(Cs)("memori-share-button",{"memori-share-button--align-left":"left"===u}),children:[(0,s.jsx)(WN.Button,{className:t(Cs)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button",i,{"memori-button--primary":a}),title:d("widget.share")||void 0,children:(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)(vF,{})})}),(0,s.jsxs)(WN.Items,{className:"memori-share-button--overlay",as:"ul",children:[(0,s.jsx)(WN.Item,{as:"li",className:"memori-share-button--li",children:(0,s.jsx)(Em,{className:"memori-share-button--link",ghost:!0,icon:(0,s.jsx)(pO,{}),onClick:()=>{h&&navigator.clipboard.writeText(h)},children:d("copyToClipboard")||void 0})},"copy"),f.map((e=>{var n;return(0,s.jsx)(WN.Item,{as:"li",className:"memori-share-button--li",children:(0,s.jsxs)("a",{className:t(Cs)("memori-button","memori-button--with-icon","memori-button--ghost","memori-button--padded","memori-share-button--link"),href:null!==(n=e.url)&&void 0!==n?n:"",target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)(e.icon,{})}),e.title]})},e.id)})),l&&(0,s.jsxs)(WN.Item,{as:"li",className:"memori-share-button--li-qr-code",children:[(0,s.jsx)(FF,{id:"qr-canvas",value:null!=h?h:"",size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H",includeMargin:!1,imageSettings:{src:m,x:void 0,y:void 0,height:32,width:32,excavate:!0}}),(0,s.jsx)("div",{children:(0,s.jsx)(Em,{onClick:()=>{const e=document.getElementById("qr-canvas");if(!e)return;const t=document.createElement("a");t.href=e.toDataURL(),t.download=`memori-${r}-share.png`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},icon:(0,s.jsx)(yF,{}),title:"Download QR",children:"Download"})})]},"qrcode")]})]})};var jF=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M290 236.4l43.9-43.9a8.01 8.01 0 0 0-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0 0 13.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 0 0 0 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 0 0-11.3 0l-42.4 42.3a8.03 8.03 0 0 0 0 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 0 0 4.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 0 0-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 0 0-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z"})});var GF=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",focusable:"false",role:"img",className:e,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2","aria-label":t,children:[(0,s.jsx)("path",{d:"M23 4L23 10 17 10"}),(0,s.jsx)("path",{d:"M1 20L1 14 7 14"}),(0,s.jsx)("path",{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"})]});var HF=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6c-.3 1.5-.4 3-.4 4.4 0 14.4 11.6 26 26 26h723c1.5 0 3-.1 4.4-.4 14.2-2.4 23.7-15.9 21.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"})});var VF=({className:e,memori:n,tenant:r,history:i,position:o,setShowPositionDrawer:a,setShowSettingsDrawer:l,setShowKnownFactsDrawer:u,setShowExpertsDrawer:d,enableAudio:h=!0,speakerMuted:p,setSpeakerMuted:m,hasUserActivatedSpeak:f=!1,showShare:g=!0,showSettings:v=!0,showSpeaker:y=!0,showReload:S=!1,showClear:_=!1,showLogin:b=!0,setShowLoginDrawer:x,clearHistory:w,loginToken:C,user:A,sessionID:E})=>{const{t:T}=Ce(),[I,M]=(0,c.useState)(!1),[R,P]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{document.fullscreenEnabled&&M(!0)}),[]),(0,s.jsxs)("div",{className:t(Cs)("memori-header",e),children:[n.needsPosition&&o&&(0,s.jsxs)("div",{className:"memori-header--position",children:[0!==o.latitude&&0!==o.longitude&&(0,s.jsx)("span",{className:"memori-header--position-placeName",children:o.placeName}),(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--position",title:T("widget.position")||"Position",icon:(0,s.jsx)(lD,{}),onClick:()=>a(!0)})]}),S&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--reload",title:T("reload")||"Reload",icon:(0,s.jsx)(GF,{}),onClick:()=>{window.location.reload()}}),_&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--clear",title:T("clearHistory")||"Clear chat",icon:(0,s.jsx)(HF,{}),onClick:w}),I&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--fullscreen",title:R?T("fullscreenExit")||"Exit fullscreen":T("fullscreenEnter")||"Enter fullscreen",icon:R?(0,s.jsx)(zO,{}):(0,s.jsx)(jF,{}),onClick:()=>{if(document.fullscreenElement){if(document.exitFullscreen){const e=document.querySelector(".memori-widget");e&&(e.style.backgroundColor=""),document.exitFullscreen().catch((e=>{console.warn("Error attempting to exit fullscreen:",e)})),P(!1)}}else{const e=document.querySelector(".memori-widget");e&&(e.style.backgroundColor="#FFFFFF",e.requestFullscreen().catch((e=>{console.warn("Error attempting to enable fullscreen:",e)}))),P(!0)}}}),n.enableDeepThought&&!!C&&(null==A?void 0:A.pAndCUAccepted)&&(0,s.jsx)(Em,{primary:!!E&&!!f,shape:"circle",icon:(0,s.jsx)(oD,{}),className:"memori-header--button memori-header--button--knownfacts",disabled:!f||!E,onClick:()=>u(!0),title:T("knownFacts.title")||"Known facts"}),n.enableBoardOfExperts&&(0,s.jsx)(Em,{primary:!0,shape:"circle",icon:(0,s.jsx)(iD,{}),className:"memori-header--button memori-header--button--experts",disabled:!f||!E,onClick:()=>d(!0),title:T("widget.showExpertsInTheBoard")||"Experts in this board"}),h&&y&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--speaker",icon:p?(0,s.jsx)(jz,{}):(0,s.jsx)(Hz,{}),onClick:()=>m(!p),title:T("widget.sound")||"Sound"}),(0,s.jsx)(uF,{history:i,memori:n,className:"memori-header--button memori-header--button--export",disabled:!f||0===i.length}),v&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button-settings",icon:(0,s.jsx)(dF,{}),onClick:()=>l(!0),title:T("widget.settings")||"Settings"}),g&&(0,s.jsx)(UF,{className:"memori-header--button memori-header--button-share",title:n.name,tenant:r,showQrCode:!0,align:"left"}),b&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button-login",icon:(0,s.jsx)(EN,{}),onClick:()=>x(!0),title:C?T("login.user")||"User":T("login.login")||"Login"})]})};var WF=({tenant:e,userLang:t="en",integrationID:n,memoriHash:r})=>{const i="memorytwin"===(null==e?void 0:e.theme)?"memorytwin":"twincreator"===(null==e?void 0:e.theme)?"twincreator":"aisuru";return(0,s.jsxs)("div",{className:"memori--powered-by",children:[(0,s.jsx)("img",{src:`https://aisuru.com/images/${i}/logo.png`,alt:""}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"sr-only",children:"Powered by"}),(0,s.jsx)("a",{href:`https://memori.ai/${"it"===(null==t?void 0:t.toLowerCase())?"it":"en"}${n?`?integrationID=${n}`:""}${r?`${n?"&":"?"}memori=${r}`:""}`,target:"_blank",rel:"noopener noreferrer",children:"Memori.AI"})]})]})};c=o("85Hg2");var qF=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false",role:"img",className:e,fill:"currentColor","aria-label":t,children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z",clipRule:"evenodd"})});const JF={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},KF=(0,c.memo)((({defaultDate:e,onChange:t,disabled:n=!1})=>{const{t:r,i18n:i}=Ce(),[o,a]=(0,c.useState)(e?"string"==typeof e?As.DateTime.fromISO(e):As.DateTime.fromJSDate(e):As.DateTime.now());return(0,c.useEffect)((()=>{t(o)}),[o,t]),(0,s.jsxs)("div",{className:"memori--date-selector",children:[(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(tz,{value:o,onChange:e=>{a(e)},disabled:n,name:"day",children:[(0,s.jsxs)(tz.Label,{className:"memori--date-selector__select-label",children:[r("day"),":"]}),(0,s.jsxs)(tz.Button,{"aria-label":r("day"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:o.day}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(qF,{})})]}),(0,s.jsx)(lp,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(tz.Options,{className:"memori--date-selector__select-options",children:[...Array(31).keys()].map((e=>(0,s.jsx)(tz.Option,{value:o.set({day:e+1}),className:"memori--date-selector__select-option",children:e+1},e)))})})]})}),(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(tz,{value:o,onChange:e=>{a(e)},disabled:n,name:"month",children:[(0,s.jsxs)(tz.Label,{className:"memori--date-selector__select-label",children:[r("month"),":"]}),(0,s.jsxs)(tz.Button,{"aria-label":r("month"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:JF["it"===i.language?"it":"en"][o.month-1]}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(qF,{})})]}),(0,s.jsx)(lp,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(tz.Options,{className:"memori--date-selector__select-options",children:JF["it"===i.language?"it":"en"].map((e=>(0,s.jsx)(tz.Option,{className:"memori--date-selector__select-option",value:o.set({month:JF["it"===i.language?"it":"en"].findIndex((t=>t===e))+1}),children:e},e)))})})]})}),(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(tz,{value:o,onChange:e=>{a(e)},disabled:n,name:"year",children:[(0,s.jsxs)(tz.Label,{className:"memori--date-selector__select-label",children:[r("year"),":"]}),(0,s.jsxs)(tz.Button,{"aria-label":r("year"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:o.year}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(qF,{})})]}),(0,s.jsx)(lp,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(tz.Options,{className:"memori--date-selector__select-options",children:[...Array(As.DateTime.now().year-1899).keys()].sort(((e,t)=>t-e)).map((e=>(0,s.jsx)(tz.Option,{value:o.set({year:e+1900}),className:"memori--date-selector__select-option",children:e+1900},e)))})})]})})]})}));KF.displayName="DateSelector";var YF=KF;c=o("85Hg2");var $F=({visible:e=!1,onClose:n,minAge:r})=>{const{t:i}=Ce(),[o,a]=(0,c.useState)(),[l,u]=(0,c.useState)(),[d,h]=(0,c.useState)(!1),p=(0,c.useCallback)((()=>{if(h(!0),!o)return t(ed).error(i("requiredField")),u(i("requiredField")||"Required field"),void h(!1);if(As.DateTime.now().diff(o,"years").years<r)return t(ed).error(i("underageTwinSession",{age:r})),u(i("underageTwinSession",{age:r})||`You must be at least ${r} years old to interact with this Agent`),void h(!1);n(o.toJSDate().toISOString())}),[o,r,n,i]);return(0,s.jsxs)(nP,{open:e,title:i("ageVerification"),className:"age-verification-modal",closable:!0,onClose:()=>n(),children:[(0,s.jsx)("p",{children:i("ageVerificationText",{minAge:r})}),(0,s.jsxs)("form",{className:"age-verification-form",onSubmit:e=>{e.preventDefault(),p()},children:[(0,s.jsx)("div",{className:"form-item",children:(0,s.jsxs)("fieldset",{name:"birthDate",children:[(0,s.jsx)("legend",{className:"sr-only",children:i("birthDate")}),(0,s.jsx)(YF,{defaultDate:new Date(Date.now()),onChange:e=>{a(e)}}),(0,s.jsx)("p",{className:"form-item-help",children:i("birthDateHelper")}),l&&(0,s.jsx)("p",{className:"form-item-error",children:l})]})}),(0,s.jsx)("div",{className:"form-item form-submit",children:(0,s.jsx)(Em,{primary:!0,htmlType:"submit",className:"age-verification-submit",loading:d,disabled:!o,children:i("confirm")})})]})]})};c=o("85Hg2");var XF=({label:e,className:n,disabled:r=!1,indeterminate:i=!1,checked:o,children:a,onChange:l,name:u,...d})=>{const h=(0,c.useRef)(null);return(0,c.useEffect)((()=>{h.current&&(h.current.indeterminate=i)}),[h,i]),(0,s.jsxs)("label",{className:t(Cs)("memori-checkbox",n,{"memori-checkbox--disabled":r,"memori-checkbox--indeterminate":i}),children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{ref:h,type:"checkbox",...d,name:u,disabled:r,checked:o||i,className:"memori-checkbox--input",onChange:l}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),!!(null==e?void 0:e.length)&&(0,s.jsx)("span",{className:"memori-checkbox--text",children:e})]})};c=o("85Hg2");var QF=({className:e,value:n,name:r,displayValue:i,options:o,onChange:a,disabled:l=!1,label:u,placeholder:d})=>(0,s.jsx)("div",{className:t(Cs)("memori-select",e),children:(0,s.jsxs)(tz,{value:n,onChange:e=>{a(e)},disabled:l,name:r,children:[u&&(0,s.jsxs)(tz.Label,{className:"memori-select--label",children:[u,":"]}),(0,s.jsxs)(tz.Button,{"aria-label":u,className:"memori-select--button",children:[(0,s.jsx)("span",{className:t(Cs)("memori-select--value",{"memori-select--value-placeholder":!n}),children:n?i||n:d}),(0,s.jsx)("span",{className:"memori-select--icon",children:(0,s.jsx)(qF,{})})]}),(0,s.jsx)(lp,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(tz.Options,{className:"memori-select--options",children:o.map((e=>(0,s.jsx)(tz.Option,{value:e.value,className:"memori-select--option",children:e.label},e.value)))})})]})});c=o("85Hg2"),c=o("85Hg2");function ZF(e=0){let[t,n]=(0,c.useState)(e),r=(0,c.useCallback)((e=>n((t=>t|e))),[t]),i=(0,c.useCallback)((e=>Boolean(t&e)),[t]),o=(0,c.useCallback)((e=>n((t=>t&~e))),[n]),s=(0,c.useCallback)((e=>n((t=>t^e))),[n]);return{addFlag:r,hasFlag:i,removeFlag:o,toggleFlag:s}}let eU=(0,(c=o("85Hg2")).createContext)(null);function tU(){let e=(0,c.useContext)(eU);if(null===e){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,tU),e}return e}function nU(){let[e,n]=(0,c.useState)([]);return[e.length>0?e.join(" "):void 0,(0,c.useMemo)((()=>function(e){let r=Dh((e=>(n((t=>[...t,e])),()=>n((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),i=(0,c.useMemo)((()=>({register:r,slot:e.slot,name:e.name,props:e.props})),[r,e.slot,e.name,e.props]);return t(c).createElement(eU.Provider,{value:i},e.children)}),[n])]}let rU=bh((function(e,t){let{passive:n=!1,...r}=e,i=tU(),o=`headlessui-label-${fp()}`,s=Bh(t);Mh((()=>i.register(o)),[o,i.register]);let a={ref:s,...i.props,id:o};return n&&("onClick"in a&&delete a.onClick,"onClick"in r&&delete r.onClick),yh({ourProps:a,theirProps:r,slot:i.slot||{},defaultTag:"label",name:i.name||"Label"})}));var iU,oU=((iU=oU||{})[iU.RegisterOption=0]="RegisterOption",iU[iU.UnregisterOption=1]="UnregisterOption",iU);let sU={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:Rp(n,(e=>e.element.current))}},1(e,t){let n=e.options.slice(),r=e.options.findIndex((e=>e.id===t.id));return-1===r?e:(n.splice(r,1),{...e,options:n})}},aU=(0,c.createContext)(null);function lU(e){let t=(0,c.useContext)(aU);if(null===t){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,lU),t}return t}function cU(e,t){return mh(t.type,sU,e,t)}aU.displayName="RadioGroupContext";let uU=bh((function(e,n){let{value:r,defaultValue:i,name:o,onChange:s,by:a=((e,t)=>e===t),disabled:l=!1,...u}=e,d=Dh("string"==typeof a?(e,t)=>{let n=a;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:a),[h,p]=(0,c.useReducer)(cU,{options:[]}),m=h.options,[f,g]=nU(),[v,y]=rm(),S=`headlessui-radiogroup-${fp()}`,_=(0,c.useRef)(null),b=Bh(_,n),[x,w]=MR(r,s,i),C=(0,c.useMemo)((()=>m.find((e=>!e.propsRef.current.disabled))),[m]),A=(0,c.useMemo)((()=>m.some((e=>d(e.propsRef.current.value,x)))),[m,x]),E=Dh((e=>{var t;if(l||d(e,x))return!1;let n=null==(t=m.find((t=>d(t.propsRef.current.value,e))))?void 0:t.propsRef.current;return(null==n||!n.disabled)&&(null==w||w(e),!0)}));xR({container:_.current,accept:e=>"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let T=Dh((e=>{let t=_.current;if(!t)return;let n=yp(t),r=m.filter((e=>!1===e.propsRef.current.disabled)).map((e=>e.element.current));switch(e.key){case up.Enter:IR(e.currentTarget);break;case up.ArrowLeft:case up.ArrowUp:if(e.preventDefault(),e.stopPropagation(),Np(r,bp.Previous|bp.WrapAround)===xp.Success){let e=m.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&E(e.propsRef.current.value)}break;case up.ArrowRight:case up.ArrowDown:if(e.preventDefault(),e.stopPropagation(),Np(r,bp.Next|bp.WrapAround)===xp.Success){let e=m.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&E(e.propsRef.current.value)}break;case up.Space:{e.preventDefault(),e.stopPropagation();let t=m.find((e=>e.element.current===(null==n?void 0:n.activeElement)));t&&E(t.propsRef.current.value)}}})),I=Dh((e=>(p({type:0,...e}),()=>p({type:1,id:e.id})))),M=(0,c.useMemo)((()=>({registerOption:I,firstOption:C,containsCheckedOption:A,change:E,disabled:l,value:x,compare:d})),[I,C,A,E,l,x,d]),R={ref:b,id:S,role:"radiogroup","aria-labelledby":f,"aria-describedby":v,onKeyDown:T},P=(0,c.useMemo)((()=>({value:x})),[x]);return t(c).createElement(y,{name:"RadioGroup.Description"},t(c).createElement(g,{name:"RadioGroup.Label"},t(c).createElement(aU.Provider,{value:M},null!=o&&null!=x&&AR({[o]:x}).map((([e,n])=>t(c).createElement(vp,{features:gp.Hidden,...xh({key:e,as:"input",type:"radio",checked:null!=n,hidden:!0,readOnly:!0,name:e,value:n})}))),yh({ourProps:R,theirProps:u,slot:P,defaultTag:"div",name:"RadioGroup"}))))}));var dU=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(dU||{});let hU=bh((function(e,n){let r=(0,c.useRef)(null),i=Bh(r,n),o=`headlessui-radiogroup-option-${fp()}`,[s,a]=nU(),[l,u]=rm(),{addFlag:d,removeFlag:h,hasFlag:p}=ZF(1),{value:m,disabled:f=!1,...g}=e,v=(0,c.useRef)({value:m,disabled:f});Mh((()=>{v.current.value=m}),[m,v]),Mh((()=>{v.current.disabled=f}),[f,v]);let{registerOption:y,disabled:S,change:_,firstOption:b,containsCheckedOption:x,value:w,compare:C}=lU("RadioGroup.Option");Mh((()=>y({id:o,element:r,propsRef:v})),[o,y,r,e]);let A=Dh((e=>{var t;if(dp(e.currentTarget))return e.preventDefault();!_(m)||(d(2),null==(t=r.current)||t.focus())})),E=Dh((e=>{if(dp(e.currentTarget))return e.preventDefault();d(2)})),T=Dh((()=>h(2))),I=(null==b?void 0:b.id)===o,M=S||f,R=C(w,m),P={ref:i,id:o,role:"radio","aria-checked":R?"true":"false","aria-labelledby":s,"aria-describedby":l,"aria-disabled":!!M||void 0,tabIndex:M?-1:R||!x&&I?0:-1,onClick:M?void 0:A,onFocus:M?void 0:E,onBlur:M?void 0:T},N=(0,c.useMemo)((()=>({checked:R,disabled:M,active:p(2)})),[R,M,p]);return t(c).createElement(u,{name:"RadioGroup.Description"},t(c).createElement(a,{name:"RadioGroup.Label"},yh({ourProps:P,theirProps:g,slot:N,defaultTag:"div",name:"RadioGroup.Option"})))})),pU=Object.assign(uU,{Option:hU,Label:rU,Description:im});const mU=[2,3,5,10,15,20,30,60];var fU=({open:e,layout:t="DEFAULT",onClose:n,speakerMuted:r,microphoneMode:i="HOLD_TO_TALK",continuousSpeechTimeout:o,setMicrophoneMode:a,setContinuousSpeechTimeout:l,controlsPosition:c,setControlsPosition:u,hideEmissions:d,setHideEmissions:h,additionalSettings:p,avatarType:m,setAvatarType:f,enablePositionControls:g,setEnablePositionControls:v,isAvatar3d:y})=>{const{t:S}=Ce();return(0,s.jsxs)(Im,{className:"memori-settings-drawer",open:e,onClose:n,title:S("widget.settings")||"Settings",description:S("write_and_speak.settingsHeaderLabel"),children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"#microphoneMode",children:[S("write_and_speak.microphoneMode")||"Microphone mode",":"]}),(0,s.jsxs)(pU,{id:"microphoneMode",name:"microphoneMode",value:i,defaultValue:i,className:"memori-settings-drawer--microphoneMode-radio",onChange:e=>{let t="CONTINUOUS"===e?"CONTINUOUS":"HOLD_TO_TALK";a(t),BB("microphoneMode",t)},children:[(0,s.jsx)(pU.Option,{value:"HOLD_TO_TALK",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,children:S("write_and_speak.holdToSpeak")||"Hold to speak"})}),(0,s.jsx)(MN,{content:r?S("write_and_speak.continuousSpeechDisabled"):"",disabled:!r,children:(0,s.jsx)(pU.Option,{value:"CONTINUOUS",className:"memori-settings-drawer--microphoneMode-radio-button "+(r?"memori-settings-drawer--microphoneMode-radio-button-disabled":""),children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,disabled:r,children:S("write_and_speak.continuousSpeechLabel")||"Continuous speech"})})})]})]}),"CONTINUOUS"===i&&(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(QF,{label:S("write_and_speak.secondsLabel")||"Seconds",placeholder:S("write_and_speak.secondsLabel")||"Seconds",options:mU.map((e=>({value:e,label:e}))),value:o,onChange:e=>{l(e),BB("continuousSpeechTimeout",e)}})}),"TOTEM"===t&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"#controlsPosition",children:[S("write_and_speak.controlsPosition")||"Controls",":"]}),(0,s.jsxs)(pU,{id:"controlsPosition",name:"controlsPosition",value:c,defaultValue:c,className:"memori-settings-drawer--controlsposition-radio",onChange:e=>{u(e),BB("controlsPosition",e)},children:[(0,s.jsx)(pU.Option,{value:"center",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,children:S("center")||"Center"})}),(0,s.jsx)(pU.Option,{value:"bottom",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,children:S("bottom")||"Bottom"})})]})]}),y&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"avatarType",className:"memori-settings-drawer-label",children:[S("write_and_speak.avatarType")||"Avatar type",":"]}),(0,s.jsxs)(pU,{id:"avatarType",name:"avatarType",value:m,defaultValue:m,className:"memori-settings-drawer--avatarType-radio",onChange:e=>{f&&f(e),BB("avatarType",e)},children:[(0,s.jsx)(pU.Option,{value:"blob",className:"memori-settings-drawer--avatarType-radio-button",children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,children:S("write_and_speak.blob")||"Blob"})}),(0,s.jsx)(pU.Option,{value:"avatar3d",className:"memori-settings-drawer--avatarType-radio-button",children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,children:S("write_and_speak.avatar3d")||"Avatar 3D"})})]})]}),(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(XF,{label:S("write_and_speak.enablePositionControls")||"Enable position controls",name:"enablePositionControls",checked:g,onChange:e=>{v(e.target.checked)}})})]}),(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(XF,{label:S("write_and_speak.hideEmissionsLabel")||"Hide emissions",name:"hideControls",checked:d,onChange:e=>{h(e.target.checked),BB("hideEmissions",e.target.checked)}})})]}),p&&(0,s.jsx)("div",{className:"memori-settings-drawer--field controls",children:p})]})};c=o("85Hg2");var gU=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"})});var vU=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M15 18L9 12 15 6"})});var yU=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M9 18L15 12 9 6"})});var SU=({apiClient:e,sessionID:n,memori:r,visible:i=!0,initialKnownFacts:o=[],closeDrawer:a})=>{var l;const{t:u}=Ce(),{getKnownFactsPaginated:d,deleteKnownFact:h}=e.knownFacts,[p,m]=(0,c.useState)(o),[f,g]=(0,c.useState)(25),[v,y]=(0,c.useState)(0),[S,_]=(0,c.useState)(null!==(l=null==o?void 0:o.length)&&void 0!==l?l:0),[b,x]=(0,c.useState)(!1),w=async(e,r,i)=>{if(n||e){x(!0);try{const{knownFacts:o,count:s,...a}=await d(null!=e?e:n,null!=r?r:v,null!=i?i:f);m(null!=o?o:[]),_(null!=s?s:0),0!==a.resultCode&&(console.error(a),t(ed).error(u(iO(a.resultCode))))}catch(e){console.error("KNOWN_FACTS/FETCH",e),m(null!=o?o:[])}x(!1)}};(0,c.useEffect)((()=>{w()}),[]);const[C,A]=(0,c.useState)(!1),[E,T]=(0,c.useState)(),[I,M]=(0,c.useState)([]);return(0,s.jsxs)(Im,{open:i,width:"80%",className:"memori-known-facts-drawer",onClose:()=>a(),title:u("knownFacts.title"),children:[(0,s.jsx)("p",{children:u("knownFacts.description",{memoriName:r.name})}),(0,s.jsxs)(Am,{spinning:b,children:[(0,s.jsxs)("div",{className:"memori-known-facts-actions",children:[(0,s.jsxs)(Em,{primary:!0,danger:!0,onClick:()=>{A(!0)},className:"memori-known-facts-delete-selected",disabled:0===(null==I?void 0:I.length),icon:(0,s.jsx)(gU,{}),loading:b,children:[u("selected")," (",null==I?void 0:I.length,")"]}),(0,s.jsx)(nP,{className:"memori-known-facts-modal",open:C,closable:!0,title:I.length>1?u("knownFacts.deleteSelectedConfirmTitle"):u("knownFacts.deleteConfirmTitle"),description:I.length>1?u("knownFacts.deleteSelectedConfirmMessage",{number:I.length}):u("knownFacts.deleteConfirmMessage"),onClose:()=>{A(!1)},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Em,{ghost:!0,onClick:()=>{A(!1)},children:u("cancel")}),(0,s.jsx)(Em,{primary:!0,danger:!0,onClick:async()=>{try{const e=I.map((e=>h(n,e)));Promise.all(e).then((e=>{if(e.every((e=>0===e.resultCode)))t(ed).success(u("knownFacts.deleteSuccess")),M([]),w(),A(!1);else{let n=e.find((e=>0!==e.resultCode));console.error(n),void 0!==(null==n?void 0:n.resultCode)&&t(ed).error(u(iO(null==n?void 0:n.resultCode)))}}))}catch(e){let n=e;t(ed).error(u("Error")+n.message)}},children:u("confirm")})]})})]}),S>25&&(0,s.jsxs)("nav",{className:"memori--table--pagination",children:[S>f&&(0,s.jsxs)("div",{className:"memori--table--pagination--pages",children:[(0,s.jsx)(Em,{shape:"circle",disabled:0===v||v<f,padded:!1,title:u("previous")||"Previous",icon:(0,s.jsx)(vU,{}),onClick:()=>{let e=(v/f-1)*f;y(e),w(void 0,e,f)}}),(0,s.jsxs)("span",{className:"memori--table--pagination--pages--current",children:[Math.ceil(v/f)+1," /"," ",Math.ceil(S/f)]}),(0,s.jsx)(Em,{shape:"circle",padded:!1,title:u("next")||"Next",icon:(0,s.jsx)(yU,{}),disabled:(v/f+1)*f>=S,onClick:()=>{let e=(v/f+1)*f;y(e),w(void 0,e,f)}})]}),(0,s.jsx)(QF,{options:[{label:`25 / ${u("page")||"page"}`,value:25},{label:`50 / ${u("page")||"page"}`,value:50},{label:`100 / ${u("page")||"page"}`,value:100}],value:f,displayValue:`${f} / ${u("page")||"page"}`,onChange:e=>{g(e),y(0),w(void 0,0,e)}})]}),(0,s.jsxs)("table",{className:"memori--table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"memori--table--column-centered",children:(0,s.jsx)(XF,{checked:!!(null==p?void 0:p.length)&&(null==I?void 0:I.length)===p.length,indeterminate:!!(null==p?void 0:p.length)&&!!(null==I?void 0:I.length)&&(null==I?void 0:I.length)!==(null==p?void 0:p.length),onChange:e=>{e.target.checked?M(p.map((e=>e.knownFactID))):M([])}})}),(0,s.jsx)("th",{children:u("knownFacts.text")}),(0,s.jsx)("th",{className:"mobile-hidden",children:u("createdAt")}),(0,s.jsx)("th",{className:"memori--table--column-right",children:u("actions")})]})}),(0,s.jsx)("tbody",{children:p.map((e=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"memori--table--column-centered",children:(0,s.jsx)(XF,{checked:null==I?void 0:I.includes(e.knownFactID),onChange:t=>{t.target.checked?M((t=>[...new Set([...t,e.knownFactID])])):M((t=>t.filter((t=>t!==e.knownFactID))))}})}),(0,s.jsx)("td",{children:e.text}),(0,s.jsx)("td",{className:"mobile-hidden",children:(0,s.jsx)("span",{className:"memori--table--date",children:e.creationTimestamp?new Intl.DateTimeFormat("it",{dateStyle:"short",timeStyle:"short"}).format(new Date(e.creationTimestamp)):"-"})}),(0,s.jsx)("td",{className:"memori--table--column-right",children:(0,s.jsxs)("div",{className:"memori--table--action-column",children:[(0,s.jsx)(Em,{danger:!0,ghost:!0,shape:"circle",icon:(0,s.jsx)(gU,{}),disabled:(null==I?void 0:I.length)>0,title:u("delete")||"Delete",onClick:()=>T(e.knownFactID)}),(0,s.jsx)(nP,{className:"memori-known-facts-modal",open:E===e.knownFactID,closable:!0,title:u("knownFacts.deleteConfirmTitle"),description:u("knownFacts.deleteConfirmMessage"),onClose:()=>{T(void 0)},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Em,{ghost:!0,onClick:()=>{T(void 0)},children:u("cancel")}),(0,s.jsx)(Em,{primary:!0,danger:!0,onClick:async()=>{try{const r=await h(n,e.knownFactID);0===r.resultCode?(t(ed).success(u("knownFacts.deleteSuccess")),M([]),w(),T(void 0)):(console.error(r),t(ed).error(u(iO(r.resultCode),{ns:"common"})))}catch(e){let n=e;t(ed).error(u("Error")+n.message)}},children:u("confirm")})]})})]})})]},e.knownFactID)))})]})]})]})};var _U=({open:e=!1,baseUrl:t,apiUrl:n,tenant:r,experts:i,onClose:o})=>{const{t:a}=Ce();return(0,s.jsx)(Im,{open:e,onClose:o,className:"memori--experts-drawer",title:(0,s.jsx)("h2",{className:"memori--experts-drawer--title",children:a("widget.expertsInTheBoard")}),children:(0,s.jsx)("ul",{className:"memori--experts-drawer--list",children:i.map((e=>(0,s.jsxs)("li",{className:"memori--experts-drawer--item",children:[(0,s.jsx)("figure",{className:"memori--experts-drawer--avatar",children:(0,s.jsx)("img",{src:`${new URL(n).origin}/api/v1/memoriai/memori/avatar/${e.expertMemoriID}`,alt:e.name,onError:e=>{e.currentTarget.src=AN({tenantID:null==r?void 0:r.id,type:"avatar",baseURL:t}),e.currentTarget.onerror=null}})}),(0,s.jsxs)("div",{className:"memori--experts-drawer--content",children:[(0,s.jsx)("h3",{className:"memori--experts-drawer--name",children:e.name}),(0,s.jsx)("p",{className:"memori--experts-drawer--description",children:e.description})]})]},e.expertID)))})})};c=o("85Hg2"),c=o("85Hg2");const bU=["memori","private","public","api","404","500","it","en","account","auth","logout","privacy_and_cookie","unauthorized","users","virtual_spaces"];var xU=({tenant:e,apiClient:n,onLogin:r,goToLogin:i,__TEST__waitingForOtp:o=!1})=>{const{t:a,i18n:l}=Ce(),u="it"===l.language?"it":"en",{userSignUp:d,userConfirmSignUp:h,resendVerificationCode:p}=n.backend,[m,f]=(0,c.useState)(),[g,v]=(0,c.useState)(),[y,S]=(0,c.useState)(),[_,b]=(0,c.useState)(),x=!y||y&&rR.test(y),w=x&&y&&y.length>=24,C=!y||0===y.length,A=!x||C?0:y.length<8?15:y.length>=32?100:(y.length-8)*(50/24)+50,[E,T]=(0,c.useState)(!1),[I,M]=(0,c.useState)(!1),[R,P]=(0,c.useState)(o),[N,O]=(0,c.useState)(null),[D,k]=(0,c.useState)();(0,c.useEffect)((()=>{k(window.location.href)}),[]);return R?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async n=>{var i,o,s;n.preventDefault();const l=n.currentTarget,c=null!==(i=l.tenant.value)&&void 0!==i?i:e.id,u=null!==(o=l.userName.value)&&void 0!==o?o:g,d=null!==(s=l.password.value)&&void 0!==s?s:y,p=l.verificationCode.value;T(!0),O(null);try{const{user:e,token:n,...i}=await h({tenant:c,userName:u,password:d,verificationCode:p});0!==i.resultCode?(console.error(i),t(ed).error(a(iO(i.resultCode)))):e&&n&&(t(ed).success(a("success")),r(e,n))}catch(e){let n=e;console.error("[validate otp]",n),(null==n?void 0:n.message)&&t(ed).error(n.message)}finally{T(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"userName",value:g}),(0,s.jsx)("input",{type:"hidden",name:"password",value:y}),(0,s.jsx)("input",{type:"hidden",name:"tenant",value:e.id}),(0,s.jsxs)("label",{htmlFor:"#verificationCode",children:[a("login.otpCode"),(0,s.jsx)("input",{id:"verificationCode",name:"verificationCode",type:"text",required:!0,autoComplete:"one-time-code",placeholder:a("login.otpCode")||"OTP"})]}),(0,s.jsx)("p",{children:(0,s.jsx)(Em,{outlined:!0,onClick:async n=>{if(n.preventDefault(),g){M(!0);try{const n=await p({tenant:null==e?void 0:e.id,userName:g});0===n.resultCode?t(ed).success(a("resentVerificationCode")):(console.error(n),t(ed).error(a(iO(n.resultCode))))}catch(e){let n=e;console.error("[resend otp]",n),(null==n?void 0:n.message)&&t(ed).error(n.message)}finally{M(!1)}}},loading:I,children:a("login.resendVerificationCode")})}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:E,children:a("confirm")})]}),N&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:N})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async n=>{var r,i,o,s,l,c,u;n.preventDefault();const h=n.currentTarget,p=null!==(r=h.tenant.value)&&void 0!==r?r:e.id,f=(null!==(i=h.eMail.value)&&void 0!==i?i:m).toLowerCase(),v=null!==(o=h.userName.value)&&void 0!==o?o:g,y=h.password.value,S=new Date(null===(s=h.birthDate)||void 0===s?void 0:s.value).toISOString(),_=null===(l=h.tnCAndPPAccepted)||void 0===l?void 0:l.checked,b=null===(c=h.pAndCUAccepted)||void 0===c?void 0:c.checked,x=null===(u=h.referral)||void 0===u?void 0:u.value;if(!(f&&v&&y&&S&&_))return void O(a("missingData"));T(!0),O(null);if(((new Date).getTime()-new Date(S).getTime())/1e3/60/60/24/365<14)return t(ed).error(a("login.underage",{age:14})),void O(a("login.underage",{age:14}));try{const{user:e,...n}=await d({tenant:p,eMail:f,userName:v,password:y,birthDate:S,tnCAndPPAccepted:_,tnCAndPPAcceptanceDate:(new Date).toISOString(),pAndCUAccepted:b,pAndCUAcceptanceDate:(new Date).toISOString(),referral:x});0!==n.resultCode?(console.error(n),t(ed).error(a(iO(n.resultCode)))):e&&(t(ed).success(a("success")),P(!0))}catch(e){let n=e;console.error("[signup]",n),(null==n?void 0:n.message)&&t(ed).error(n.message)}finally{T(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"tenant",value:e.id}),(0,s.jsx)("input",{type:"hidden",name:"referral",value:D}),(0,s.jsxs)("label",{htmlFor:"#eMail",children:[a("login.email"),(0,s.jsx)("input",{type:"email",name:"eMail",id:"eMail",required:!0,autoComplete:"email",placeholder:a("login.email")||"Email",onChange:e=>f(e.target.value),"aria-invalid":!!(null==m?void 0:m.length)&&!iR.test(m)})]}),!!(null==m?void 0:m.length)&&!iR.test(m)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.emailFormatError")}),(0,s.jsxs)("label",{htmlFor:"userName",children:[a("login.username"),(0,s.jsx)("input",{type:"text",name:"userName",id:"userName",required:!0,autoComplete:"username",placeholder:a("login.username")||"Username",onFocus:()=>{if(!(null==g?void 0:g.length)&&(null==m?void 0:m.length)){let e=(e=>e.split("@")[0].replace(/[^a-zA-Z0-9]/g,""))(m);const t=document.getElementById("userName");t&&(t.value=e,v(e))}},onChange:e=>v(e.target.value),"aria-invalid":!!(null==g?void 0:g.length)&&(bU.includes(g.toLowerCase())||!oR.test(g))})]}),!!(null==g?void 0:g.length)&&bU.includes(g.toLowerCase())&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.usernameContainsReservedWord")}),!!(null==g?void 0:g.length)&&!oR.test(g)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.usernameFormatError")}),(0,s.jsxs)("label",{htmlFor:"#birthDate",children:[a("login.birthDate"),(0,s.jsx)("input",{id:"birthDate",name:"birthDate",type:"date",required:!0,autoComplete:"bday"})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:a("login.birthDateHelper")})}),(0,s.jsxs)("label",{htmlFor:"#password",children:[a("login.password"),(0,s.jsx)("input",{id:"password",name:"password",type:"password",required:!0,autoComplete:"new-password",placeholder:a("login.password")||"Password",onChange:e=>S(e.target.value),"aria-invalid":!x})]}),!x&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[a("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:a("login.confirmPassword")||"Password",onChange:e=>b(e.target.value),"aria-invalid":!!(null==y?void 0:y.length)&&!!(null==_?void 0:_.length)&&y!==_})]}),!!(null==y?void 0:y.length)&&!!(null==_?void 0:_.length)&&y!==_&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:A,id:"password-strength-meter"}),(0,s.jsx)("small",{children:a("login.pwd"+(w?"Strong":x?"Acceptable":"Weak"))}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",required:!0,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[a("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${u}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:a("login.privacyAndCookiePolicy")})," ",a("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${u}/tos`,target:"_blank",rel:"noopener noreferrer",children:a("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[a("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",a("login.optional"),")"]})})]})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:a("login.deepThoughtExplaination")})}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:E,children:a("login.signUp")}),(0,s.jsxs)("p",{className:"memori--login-drawer--signup",children:[a("login.alreadyHaveAnAccount")," ",(0,s.jsx)(Em,{outlined:!0,onClick:i,children:a("login.backToLogin")})]})]}),N&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:N})]})};c=o("85Hg2");const wU=["image/jpeg","image/png","image/jpg","image/gif"];var CU=({user:e,loginToken:n,apiClient:r,onUserUpdate:i})=>{const{t:o,i18n:a}=Ce(),l="it"===a.language?"it":"en",{updateUser:u,uploadAsset:d}=r.backend,[h,p]=(0,c.useState)(),[m,f]=(0,c.useState)(),[g,v]=(0,c.useState)(),y=!m||m&&rR.test(m),S=y&&m&&m.length>=24,_=!m||0===m.length,b=!y||_?0:m.length<8?15:m.length>=32?100:(m.length-8)*(50/24)+50,[x,w]=(0,c.useState)(!1),[C,A]=(0,c.useState)(null),E=async(e,r)=>{try{const{user:s,...a}=await u(n,e,r);0!==a.resultCode?(console.error(a),t(ed).error(o(iO(a.resultCode)))):s&&(t(ed).success(o("success")),i(s))}catch(e){let n=e;console.error("[signup]",n),(null==n?void 0:n.message)&&t(ed).error(n.message)}finally{w(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{className:"memori--login-drawer--edit-account-title",children:o("login.editAccount")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form memori--login-drawer--account-form",onSubmit:async r=>{var i,s,a,l,c;if(r.preventDefault(),!e.userID)return;const u=e.userID,p=r.currentTarget,f=null!==(i=p.eMail.value)&&void 0!==i?i:h,g=null!==(s=p.newPassword.value)&&void 0!==s?s:m,v=p.password.value,y=p.confirmPassword.value,S=null===(a=p.pAndCUAccepted)||void 0===a?void 0:a.checked,_=null===(c=null===(l=p.avatar)||void 0===l?void 0:l.files)||void 0===c?void 0:c[0];if(w(!0),A(null),(null==g?void 0:g.length)&&g!==y)return A(o("login.passwordMatchingError")),void w(!1);let b={...(null==f?void 0:f.length)&&f!==e.eMail?{eMail:f}:{},...g?{password:v,newPassword:g}:{},...void 0!==S&&S!==e.pAndCUAccepted?{pAndCUAccepted:S,pAndCUAcceptanceDate:(new Date).toISOString()}:{}};if(0===Object.values(b).length&&!_)return console.debug("No changes to submit"),void w(!1);if(_){const e=new FileReader;e.onload=async e=>{var r,i;try{const{asset:s,...a}=await d(null!==(r=_.name)&&void 0!==r?r:"avatar",null===(i=e.target)||void 0===i?void 0:i.result,n);0!==a.resultCode?(console.error(a),t(ed).error(o(iO(a.resultCode)))):s&&(b.avatarURL=s.assetURL,await E(u,b))}catch(e){let n=e;console.error("[avatar upload]",n),(null==n?void 0:n.message)&&t(ed).error(n.message)}},e.readAsDataURL(_)}else await E(u,b)},children:[(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.emailChange")}),(0,s.jsxs)("label",{htmlFor:"#eMail",children:[o("login.email"),(0,s.jsx)("input",{type:"email",name:"eMail",id:"eMail",autoComplete:"email",placeholder:e.eMail,onChange:e=>p(e.target.value),"aria-invalid":!!(null==h?void 0:h.length)&&!iR.test(h)})]}),!!(null==h?void 0:h.length)&&!iR.test(h)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.emailFormatError")})]}),(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.passwordChange")}),(0,s.jsxs)("label",{htmlFor:"#password",children:[o("login.currentPassword"),(0,s.jsx)("input",{id:"password",name:"password",type:"password",autoComplete:"password",placeholder:o("login.currentPassword")||"Password"})]}),(0,s.jsxs)("label",{htmlFor:"#newPassword",children:[o("login.newPassword"),(0,s.jsx)("input",{id:"newPassword",name:"newPassword",type:"password",autoComplete:"new-password",placeholder:o("login.password")||"Password",onChange:e=>f(e.target.value),"aria-invalid":!y})]}),!y&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[o("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",autoComplete:"new-password",placeholder:o("login.confirmPassword")||"Password",onChange:e=>v(e.target.value),"aria-invalid":!!(null==m?void 0:m.length)&&!!(null==g?void 0:g.length)&&m!==g})]}),!!(null==m?void 0:m.length)&&!!(null==g?void 0:g.length)&&m!==g&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:b,id:"password-strength-meter"}),(0,s.jsx)("small",{children:o("login.pwd"+(S?"Strong":y?"Acceptable":"Weak"))})]}),(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.avatarChange")}),(0,s.jsxs)("label",{htmlFor:"#avatar",children:["Avatar",(0,s.jsx)("input",{type:"file",name:"avatar",id:"avatar",accept:wU.join(", "),placeholder:e.avatarURL})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox memori-checkbox--disabled",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",disabled:!0,defaultChecked:e.tnCAndPPAccepted,checked:e.tnCAndPPAccepted,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[o("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${l}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:o("login.privacyAndCookiePolicy")})," ",o("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${l}/tos`,target:"_blank",rel:"noopener noreferrer",children:o("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",className:"memori-checkbox--input",defaultChecked:e.pAndCUAccepted}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsx)(MN,{align:"left",content:o("login.deepThoughtExplaination"),children:(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[o("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",o("login.optional"),")"]})})]})})]}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:x,children:o("login.save")})]}),C&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:C})]})};var AU=({open:e=!1,onClose:n,onLogin:r,onLogout:i,user:o,loginToken:a,tenant:l,apiClient:u,__TEST__signup:d=!1,__TEST__needMissingData:h=!1,__TEST__waitingForOtp:p=!1,__TEST__changePwd:m=!1})=>{var f,g;const{t:v,i18n:y}=Ce(),S="it"===y.language?"it":"en",{userLogin:_,updateUser:b}=u.backend,x=(null==o?void 0:o.userID)&&a,[w,C]=(0,c.useState)(!1),[A,E]=(0,c.useState)(null),[T,I]=(0,c.useState)(d),[M,R]=(0,c.useState)(m?{flowID:"flowID",tenant:l.id,eMail:"email",userName:"username",password:"password"}:void 0),[P,N]=(0,c.useState)(h?{token:"token",birthDate:!0,tnCAndPPAccepted:!0}:{}),[O,D]=(0,c.useState)(),[k,L]=(0,c.useState)(),B=!O||O&&rR.test(O),z=B&&O&&O.length>=24,F=!O||0===O.length,U=!B||F?0:O.length<8?15:O.length>=32?100:(O.length-8)*(50/24)+50;return(0,s.jsx)(Im,{open:e,onClose:n,className:t(Cs)("memori--login-drawer",{"memori--login-drawer--logged":x,"memori--login-drawer--signup":T}),title:(0,s.jsx)("span",{className:"memori--login-drawer--title",children:x?v("login.loggedDrawerTitle",{name:o.userName}):v(T?"login.signupDrawerTitle":"login.loginDrawerTitle")}),children:x?(0,s.jsxs)("div",{className:"memori--login-drawer--logged",children:[o.avatarURL&&(0,s.jsx)("figure",{className:"memori--login-drawer--avatar",children:(0,s.jsx)("img",{src:o.avatarURL,alt:o.userName})}),(0,s.jsx)(Em,{primary:!0,onClick:()=>{i()},children:v("login.logout")}),(0,s.jsx)(CU,{user:o,loginToken:a,apiClient:u,onUserUpdate:e=>r(e,a)})]}):(null===(f=null==P?void 0:P.token)||void 0===f?void 0:f.length)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{children:v("login.missingData")}),(0,s.jsx)("p",{children:v("login.missingDataHelper")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async e=>{var n,i,s;e.preventDefault();const a=e.currentTarget,l=null===(n=a.birthDate)||void 0===n?void 0:n.value,c=null===(i=a.tnCAndPPAccepted)||void 0===i?void 0:i.checked,u=null===(s=a.pAndCUAccepted)||void 0===s?void 0:s.checked;if(!(null==o?void 0:o.userID)||!(null==P?void 0:P.token))return;if(!l||!c)return void E(v("missingData"));let d={userID:o.userID,birthDate:(null==o?void 0:o.birthDate)||!P.birthDate?void 0:l,tnCAndPPAccepted:c||(null==o?void 0:o.tnCAndPPAccepted),tnCAndPPAcceptanceDate:c?(new Date).toISOString():void 0,pAndCUAccepted:u||(null==o?void 0:o.pAndCUAccepted),pAndCUAcceptanceDate:u?(new Date).toISOString():void 0};const{user:h,...p}=await b(P.token,o.userID,d);0!==p.resultCode?(console.error(p),t(ed).error(v(iO(p.resultCode))),E(p.resultMessage)):(t(ed).success(v("success")),r(h||d,P.token))},children:[P.birthDate&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("label",{htmlFor:"#birthDate",children:[v("login.birthDate"),(0,s.jsx)("input",{id:"birthDate",name:"birthDate",type:"date",required:!0,autoComplete:"bday"})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.birthDateHelper")})})]}),(null==P?void 0:P.tnCAndPPAccepted)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[v("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${S}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:v("login.privacyAndCookiePolicy")})," ",v("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${S}/tos`,target:"_blank",rel:"noopener noreferrer",children:v("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",defaultChecked:null==o?void 0:o.pAndCUAccepted,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[v("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",v("login.optional"),")"]})})]})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.goToAccountToChangeYourPreferences")})}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.deepThoughtExplaination")})})]}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:w,children:v("login.save")})]})]}):(null==M?void 0:M.flowID)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:v("login.mustChangePassword")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async e=>{var n,i,o,s,a;e.preventDefault();const c=e.currentTarget,u=null!==(n=c.tenant.value)&&void 0!==n?n:l.id,d=null!==(i=c.flowID.value)&&void 0!==i?i:null==M?void 0:M.flowID,h=null!==(o=c.eMail.value)&&void 0!==o?o:null==M?void 0:M.eMail,p=null!==(s=c.userName.value)&&void 0!==s?s:null==M?void 0:M.userName,m=null!==(a=c.password.value)&&void 0!==a?a:null==M?void 0:M.password,f=c.newPassword.value;if(!(null==f?void 0:f.length)||!B)return void E(v("login.passwordFormatError"));C(!0);const g={tenant:u,flowID:d,eMail:h,userName:p,password:m,newPassword:f};try{const{user:e,token:n,...i}=await _(g);0!==i.resultCode?(console.error(i),t(ed).error(v(iO(i.resultCode))),E(i.resultMessage)):e&&n&&(t(ed).success(v("success")),r(e||g,n))}catch(e){let n=e;console.error("[LOGIN/CHANGE PWD]",n),n.message&&(t(ed).error(n.message),E(n.message))}finally{C(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"tenant",value:null!==(g=M.tenant)&&void 0!==g?g:null==l?void 0:l.id}),(0,s.jsx)("input",{type:"hidden",name:"flowID",value:M.flowID}),(0,s.jsx)("input",{type:"hidden",name:"eMail",value:M.eMail}),(0,s.jsx)("input",{type:"hidden",name:"userName",value:M.userName}),(0,s.jsx)("input",{type:"hidden",name:"password",value:M.password}),(0,s.jsxs)("label",{htmlFor:"#newPassword",children:[v("login.password"),(0,s.jsx)("input",{id:"newPassword",name:"newPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:v("login.password")||"Password",onChange:e=>D(e.target.value),"aria-invalid":!B})]}),!B&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:v("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[v("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:v("login.confirmPassword")||"Password",onChange:e=>L(e.target.value),"aria-invalid":!!(null==O?void 0:O.length)&&!!(null==k?void 0:k.length)&&O!==k})]}),!!(null==O?void 0:O.length)&&!!(null==k?void 0:k.length)&&O!==k&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:v("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:U,id:"password-strength-meter"}),(0,s.jsx)("small",{children:v("login.pwd"+(z?"Strong":B?"Acceptable":"Weak"))}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:w,children:v("confirm")})]})]}):T?(0,s.jsx)(xU,{tenant:l,apiClient:u,onLogin:r,goToLogin:()=>I(!1),__TEST__waitingForOtp:p}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:e=>{e.preventDefault();const n=e.currentTarget,i=n.userNameOrEmail.value,o=n.password.value,s=iR.test(i),a=s?{tenant:null==l?void 0:l.id,eMail:i,password:o}:{tenant:null==l?void 0:l.id,userName:i,password:o};C(!0),E(null),_(a).then((e=>{var n,a,c,u,d;-14===e.resultCode?R({tenant:l.id,eMail:s?i:void 0,userName:s?void 0:i,password:o,flowID:e.flowID||(null===(n=e.user)||void 0===n?void 0:n.flowID)}):0!==e.resultCode?(console.error(e),t(ed).error(v(iO(e.resultCode))),E(e.resultMessage)):e.user&&e.token&&((null===(a=e.user)||void 0===a?void 0:a.tnCAndPPAccepted)&&(null===(c=e.user)||void 0===c?void 0:c.birthDate)?r(e.user,e.token):N({token:e.token,birthDate:!(null===(u=e.user)||void 0===u?void 0:u.birthDate),tnCAndPPAccepted:!(null===(d=e.user)||void 0===d?void 0:d.tnCAndPPAccepted)}))})).catch((e=>{console.error("[LOGIN]",e),e.message&&(t(ed).error(e.message),E(e.message))})).finally((()=>{C(!1)}))},children:[(0,s.jsxs)("label",{htmlFor:"#userNameOrEmail",children:[v("login.userNameOrEmail"),(0,s.jsx)("input",{id:"userNameOrEmail",name:"userNameOrEmail",required:!0,autoComplete:"email",placeholder:"Username/email"})]}),(0,s.jsxs)("label",{htmlFor:"#password",children:["Password",(0,s.jsx)("input",{id:"password",name:"password",type:"password",required:!0,autoComplete:"password",placeholder:"Password"})]}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:w,children:v("login.login")}),(null==l?void 0:l.disableRegistration)?l.adminEmail?(0,s.jsxs)("div",{className:"memori--login-drawer--signup",children:[(0,s.jsx)("p",{children:v("login.registrationDisabled")}),(0,s.jsxs)("p",{children:[v("login.contactAdmin"),":"," ",(0,s.jsx)("a",{href:`mailto:${l.adminEmail}`,children:l.adminEmail})]})]}):null:(0,s.jsxs)("p",{className:"memori--login-drawer--signup",children:[v("login.newUserSignUp")," ",(0,s.jsx)(Em,{outlined:!0,onClick:()=>I(!0),children:v("login.signUp")})]})]}),A&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:A})]})})};var EU=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,sessionId:d,hasUserActivatedSpeak:h,loading:p=!1,poweredBy:m})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(Am,{spinning:p,children:[e&&t&&(0,s.jsx)(e,{...t}),(0,s.jsxs)("div",{className:"memori--grid",children:[(0,s.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[n&&r&&(0,s.jsx)(n,{chatProps:o,...r}),(0,s.jsx)("div",{id:"extension"})]}),(0,s.jsx)("div",{className:"memori--grid-column memori--grid-column-right",children:d&&h&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null}),m]})]})]});var TU=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,sessionId:d,hasUserActivatedSpeak:h,loading:p=!1,poweredBy:m})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(Am,{spinning:p,className:"memori-totem-layout",children:[m,(0,s.jsx)("div",{className:"memori-totem-layout--header",children:e&&t&&(0,s.jsx)(e,{...t})}),(0,s.jsx)("div",{className:"memori-totem-layout--avatar",children:n&&r&&(0,s.jsx)(n,{chatProps:o,...r,isTotem:!0})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-totem-layout--controls",children:d&&h&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null})]})]});var IU=({Header:e,headerProps:t,Chat:n,chatProps:r,StartPanel:i,startPanelProps:o,integrationStyle:a,integrationBackground:l,sessionId:c,hasUserActivatedSpeak:u,loading:d=!1,poweredBy:h})=>(0,s.jsxs)(s.Fragment,{children:[a,l,(0,s.jsxs)(Am,{spinning:d,className:"memori-chat-layout",children:[h,(0,s.jsx)("div",{className:"memori-chat-layout--header",children:e&&t&&(0,s.jsx)(e,{...t})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-chat-layout--controls",children:c&&u&&n&&r?(0,s.jsx)(n,{...r}):o?(0,s.jsx)(i,{...o}):null})]})]});c=o("85Hg2"),c=o("85Hg2");var MU=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:u,sessionId:d,hasUserActivatedSpeak:h,loading:p=!1,poweredBy:m})=>{var f,g;const{t:v}=Ce(),[y,S]=(0,c.useState)(!0),[_,b]=(0,c.useState)(),x=(0,c.useMemo)((()=>null==o?void 0:o.stopAudio),[null==o?void 0:o.stopAudio]),w=e=>{S(e),b(e?void 0:(new Date).toISOString());try{null==x||x()}catch(e){console.log(e)}};return(0,s.jsx)("div",{className:"memori-website_assistant--"+(y?"collapsed":"expanded"),children:y?(0,s.jsx)("div",{className:"memori-website_assistant--trigger",children:(0,s.jsx)(Em,{className:"memori-website_assistant--trigger-button",ghost:!0,shape:"circle",onClick:()=>w(!1),title:v("expand")||"Expand",children:(0,s.jsx)(vD,{avatar:null==r?void 0:r.memori.avatarURL})})}):(0,s.jsxs)(s.Fragment,{children:[u,(0,s.jsxs)(Am,{spinning:p,className:"memori-website_assistant-layout",children:[m,(0,s.jsx)("div",{className:"memori-website_assistant--close-button-wrapper",children:(0,s.jsx)(Em,{className:"memori-website_assistant--close-button",primary:!0,shape:"circle",onClick:()=>w(!0),icon:(0,s.jsx)(Tm,{}),title:v("close")||"Close"})}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--header",children:e&&t&&(0,s.jsx)(e,{...t,showSettings:!1,showReload:!1})}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--avatar",children:n&&r&&(0,c.createElement)(n,{...r,integrationConfig:r.integrationConfig?{...r.integrationConfig,avatarURL:(null===(f=r.integrationConfig)||void 0===f?void 0:f.avatarURL)?`${null===(g=r.integrationConfig)||void 0===g?void 0:g.avatarURL.split("#")[0]}#${_}`:void 0}:{},key:_})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--controls",children:d&&h&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null})]})]})})};c=o("85Hg2");var RU=({Header:e,headerProps:t,Chat:n,chatProps:r,startPanelProps:i,sessionId:o,hasUserActivatedSpeak:a})=>{const{t:l}=Ce(),[u,d]=(0,c.useState)(!1);(0,c.useEffect)((()=>{const e=document.body;e&&(u?(e.style.width="calc(100% - 350px)",e.style.marginRight="300px",e.style.transition="all 0.5s"):(e.style.width="100%",e.style.marginLeft="0"))}),[u]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("input",{type:"checkbox",id:"memori-sidebar-toggle",className:"memori-sidebar-toggle",checked:u,onChange:()=>{d(!u),(()=>{try{window.speechSynthesis.speak(new SpeechSynthesisUtterance(""))}catch(e){console.error(e)}i&&(null==i?void 0:i.initializeTTS)&&(null==i||i.initializeTTS()),i&&(null==i?void 0:i.onClickStart)&&(null==i||i.onClickStart())})()}}),(0,s.jsxs)("div",{className:"memori-sidebar-container",children:[(0,s.jsx)("label",{htmlFor:"memori-sidebar-toggle",className:"memori-sidebar-toggle-label memori-open-label",children:(0,s.jsx)(ZN,{className:"memori-icon","aria-label":l("expand")})}),(0,s.jsxs)("aside",{className:"memori-sidebar",children:[(0,s.jsx)("label",{htmlFor:"memori-sidebar-toggle",className:"memori-sidebar-toggle-label memori-close-label",children:(0,s.jsx)("span",{children:(0,s.jsx)(Tm,{className:"memori-icon-close","aria-label":l("collapse")})})}),(0,s.jsx)("div",{className:"memori-sidebar-content",children:(0,s.jsx)("div",{className:"memori-hidden-chat-layout--header",children:e&&t&&(0,s.jsx)(e,{position:{latitude:0,longitude:0,placeName:""},...t,className:"memori-hidden-chat-layout-header--layout"})})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-hidden-chat-layout--controls",children:o&&a&&n&&r?(0,s.jsx)(n,{...r}):(0,s.jsx)("div",{className:"memori-loading",children:(0,s.jsx)(Am,{})})})]})]})]})};c=o("85Hg2");var PU=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:u,integrationBackground:d,sessionId:h,hasUserActivatedSpeak:p,loading:m=!1,poweredBy:f})=>((0,c.useEffect)((()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""})),[]),(0,s.jsxs)(s.Fragment,{children:[u,d,(0,s.jsxs)(Am,{className:"memori-spin--zoomed-full-body",spinning:m,children:[e&&t&&(0,s.jsx)(e,{...t}),(0,s.jsxs)("div",{className:"memori--grid",children:[(0,s.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[n&&r&&(0,s.jsx)(n,{chatProps:o,isZoomed:!0,...r}),(0,s.jsx)("div",{id:"extension"})]}),(0,s.jsx)("div",{className:"memori--grid-column memori--grid-column--zoomed-full-body memori--grid-column-right",children:h&&p&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null}),(0,s.jsx)("div",{className:"memori--powered-by-custom",children:f})]})]})]}));const NU=async({operation:e="session_creation",baseUrl:t,userID:n,userName:r,tenant:i})=>{if(!n&&!r)throw new Error("Either userID or userName must be provided");const o=await fetch(`${t}/api/verify-tokens`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operation:e,userID:n,userName:r,tenant:i})});if(!o.ok)throw new Error("Failed to fetch credits");return o.json()},OU=(e,t=!0,n=!1,r,i=!1,o=!1)=>{const s=new CustomEvent("MemoriTextEntered",{detail:{text:e,waitForPrevious:t,hidden:n,typingText:r,useLoaderTextAsMsg:i,hasBatchQueued:o}});document.dispatchEvent(s);window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak"))}),300)};let DU,kU,LU,BU,zU,FU;window.getMemoriState=e=>{var t,n,r,i,o;let s=e?document.querySelector(`.memori-widget[data-memori-integration="${e}"]`)||(null===(n=null===(t=document.querySelector("memori-client"))||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector(".memori-widget[data-memori-integration]")):document.querySelector(".memori-widget")||(null===(i=null===(r=document.querySelector("memori-client"))||void 0===r?void 0:r.shadowRoot)||void 0===i?void 0:i.querySelector(".memori-widget"));if(!s)return null;let a=null===(o=s.dataset)||void 0===o?void 0:o.memoriEngineState;return a?JSON.parse(a):null},window.typeMessage=OU,window.typeMessageHidden=(e,t=!0,n,r=!1,i=!1)=>OU(e,t,!0,n,r,i),window.typeBatchMessages=e=>{function t(){var e,t,n,r;null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e||e.setAttribute("disabled","");const i="opacity: 0.5; touch-action: none; pointer-events: none;";null===(t=document.querySelector("textarea.memori-chat-textarea--input"))||void 0===t||t.setAttribute("style",i),null===(n=document.querySelector("button.memori-chat-inputs--send"))||void 0===n||n.setAttribute("style",i),null===(r=document.querySelector("button.memori-chat-inputs--mic"))||void 0===r||r.setAttribute("style",i)}function n(){var e,t,n,r;null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e||e.removeAttribute("disabled"),null===(t=document.querySelector("textarea.memori-chat-textarea--input"))||void 0===t||t.removeAttribute("style"),null===(n=document.querySelector("button.memori-chat-inputs--send"))||void 0===n||n.removeAttribute("style"),null===(r=document.querySelector("button.memori-chat-inputs--mic"))||void 0===r||r.removeAttribute("style")}function r(){var e;return!!(null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e?void 0:e.hasAttribute("disabled"))}const i=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent),o=function*(){yield*e}();t();const s=()=>{const e=o.next(),a=e.value;if(a){r()||t();let o=a.waitForPrevious;i&&(o=!1),OU(a.message,o,a.hidden,a.typingText,a.useLoaderTextAsMsg,!e.done),i&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak")),n()}),3e3)}else r()&&n();if(e.done)return document.removeEventListener("MemoriEndSpeak",s),void(r()&&n())};document.addEventListener("MemoriEndSpeak",s),s()};let UU,jU=!1,GU=!1;var HU=({memori:e,memoriConfigs:n,ownerUserID:r,ownerUserName:i,tenantID:o,memoriLang:a,multilingual:l,integration:u,layout:d,customLayout:h,showShare:p,preview:m=!1,embed:f=!1,showCopyButton:g=!0,showTranslationOriginal:v=!1,showInputs:y=!0,showDates:S=!1,showContextPerLine:_=!1,showSettings:b=!0,showTypingText:x=!1,showClear:w=!1,showLogin:C=!1,showUpload:A,showOnlyLastMessages:E,height:T="100vh",secret:I,baseUrl:M="https://aisuru.com",apiURL:R="https://backend.memori.ai",engineURL:P="https://engine.memori.ai",initialContextVars:N,initialQuestion:O,ogImage:D,sessionID:k,tenant:L,personification:B,authToken:z,AZURE_COGNITIVE_SERVICES_TTS_KEY:F,enableAudio:U,defaultSpeakerActive:j=!0,disableTextEnteredEvents:G=!1,onStateChange:H,additionalInfo:V,additionalSettings:W,customMediaRenderer:q,userAvatar:J,useMathFormatting:K=!1,autoStart:Y=!1,applyVarsToRoot:$=!1})=>{var X,Q,ee,te,ne,re,ie,oe,se,ae,le,ce,ue,de,he,pe,me,fe,ge,ve,ye,Se,_e,be,xe,we;const{t:Ae,i18n:Ee}=Ce(),[Te,Ie]=(0,c.useState)(!1);(0,c.useEffect)((()=>{Ie(!0)}),[]);const Me=Z(R,P),{initSession:Re,postTextEnteredEvent:Pe,postPlaceChangedEvent:Ne,postDateChangedEvent:Oe,postTimeoutEvent:De,postTagChangedEvent:ke,getSession:Le,getExpertReferences:Be,getSessionChatLogs:ze}=Me,[Fe,Ue]=(0,c.useState)(!1),[je,Ge]=(0,c.useState)(!0),[He,Ve]=(0,c.useState)(null!==(X=null==V?void 0:V.loginToken)&&void 0!==X?X:z),[We,qe]=(0,c.useState)({avatarURL:"string"==typeof J?J:void 0});(0,c.useEffect)((()=>{He&&!(null==We?void 0:We.userID)&&C&&Me.backend.getCurrentUser(He).then((({user:e,resultCode:t})=>{e&&0===t?(qe(e),BB("loginToken",He),!pn&&e.birthDate&&(mn(e.birthDate),BB("birthDate",e.birthDate))):zB("loginToken")}))}),[He,null==We?void 0:We.userID]);const[Je,Ke]=(0,c.useState)(!1),[Ye,$e]=(0,c.useState)(!1),[Xe,Qe]=(0,c.useState)(!1),Ze=(null===(te=null===(ee=null===(Q=e.culture)||void 0===Q?void 0:Q.split("-"))||void 0===ee?void 0:ee[0])||void 0===te?void 0:te.toUpperCase())||(null===(oe=null===(ie=null===(re=null===(ne=null==n?void 0:n.find((t=>t.memoriConfigID===e.memoriConfigurationID)))||void 0===ne?void 0:ne.culture)||void 0===re?void 0:re.split("-"))||void 0===ie?void 0:ie[0])||void 0===oe?void 0:oe.toUpperCase()),et=(null==u?void 0:u.customData)?JSON.parse(u.customData):null,tt=void 0!==l?l:!!(null==et?void 0:et.multilanguage),nt=null==et?void 0:et.forcedTimeout,[rt,it]=(0,c.useState)(null!==(ce=null!==(le=null!==(ae=null!==(se=null!=a?a:null==et?void 0:et.lang)&&void 0!==se?se:Ze)&&void 0!==ae?ae:null==et?void 0:et.uiLang)&&void 0!==le?le:Ee.language)&&void 0!==ce?ce:"IT"),ot=void 0!==K?K:!!(null==et?void 0:et.useMathFormatting);(0,c.useEffect)((()=>{ot&&fR()}),[ot]),(0,c.useEffect)((()=>{tt&&rt&&sO.includes(rt.toLowerCase())&&Ee.changeLanguage(rt.toLowerCase())}),[rt]);const[st,at]=(0,c.useState)(!1),[lt,ct]=(0,c.useState)(!1),[ut,dt]=(0,c.useState)(),ht=d||(null==et?void 0:et.layout)||"DEFAULT",pt=null!==(ue=null!=U?U:null==et?void 0:et.enableAudio)&&void 0!==ue&&ue,[mt,ft]=(0,c.useState)(!1),[gt,vt]=(0,c.useState)(!1),[yt,St]=(0,c.useState)(!1),[_t,bt]=(0,c.useState)(!1),[xt,wt]=(0,c.useState)(!1),[Ct,At]=(0,c.useState)(!1),[Et,Tt]=(0,c.useState)(!pt||!j||Y),[It,Mt]=(0,c.useState)(!1),[Rt,Pt]=(0,c.useState)(2),[Nt,Ot]=(0,c.useState)(!1),[Dt,kt]=(0,c.useState)("center"),[Lt,Bt]=(0,c.useState)(!1),[zt,Ft]=(0,c.useState)(null),[Ut,jt]=(0,c.useState)(!1),{startProcessing:Gt,setAudioContext:Ht,addViseme:Vt,stopProcessing:Wt,resetVisemeQueue:qt}=Fz();(0,c.useEffect)((()=>{GU=!!LU}),[LU]),(0,c.useEffect)((()=>{let e="bottom",t=LB("microphoneMode","HOLD_TO_TALK");window.innerWidth<=768?(e="bottom",t="HOLD_TO_TALK"):e=window.matchMedia("(orientation: portrait)").matches||window.innerHeight>window.innerWidth?"center":"bottom";const n=Y||LB("muteSpeaker",!pt||!j||Y);Tt(n),jU=n,Mt(!n&&"CONTINUOUS"===t),Pt(LB("continuousSpeechTimeout",2)),kt(LB("controlsPosition",e)),Ft(LB("avatarType","avatar3d")),jt(LB("hideEmissions",!1)),(null==V?void 0:V.loginToken)||z||(Ve(LB("loginToken",void 0)),UU=LB("loginToken",void 0),mn(LB("birthDate",void 0)))}),[]);const[Jt,Kt]=(0,c.useState)(I),[Yt,$t]=(0,c.useState)(),[Xt,Qt]=(0,c.useState)(null),[Zt,en]=(0,c.useState)(),tn=async(e,t)=>{var n;const r=null!=t?t:vn;if(e&&r){const{currentState:t,...i}=await Ne({sessionId:r,placeName:e.placeName,latitude:e.latitude,longitude:e.longitude,uncertaintyKm:null!==(n=e.uncertainty)&&void 0!==n?n:0});t&&0===i.resultCode&&_n((e=>{var n;return{...e,...t,hints:(null===(n=t.hints)||void 0===n?void 0:n.length)?t.hints:null==e?void 0:e.hints}}))}};(0,c.useEffect)((()=>{const e=LB("position",void 0);e&&en(e)}),[]);const[nn,rn]=(0,c.useState)(""),[on,sn]=(0,c.useState)(!1),[an,ln]=(0,c.useState)([]),cn=e=>{ln((t=>{var n,r;return[...t,{...e,media:null!==(r=null===(n=e.media)||void 0===n?void 0:n.filter((e=>{var t;return!("text/javascript"===e.mimeType&&(null===(t=e.properties)||void 0===t?void 0:t.executable))})))&&void 0!==r?r:[]}]}))},un=async(t,n,r,i=!0,o,s=!1,a,l=!1,c=!1)=>{var u,d,h,p,m,f;const g=r||vn||(null===(u=window.getMemoriState())||void 0===u?void 0:u.sessionID);if(!g||!(null==t?void 0:t.length))return;s||cn({text:t,translatedText:o,fromUser:!0,media:null!=n?n:[],initial:vn?!!r&&r!==vn:!!r}),ct(!0),dt(a);let v=t,y=!1;try{if(!s&&i&&tt&&rt.toUpperCase()!==Ze.toUpperCase()){v=(await SO(t,Ze,rt,M)).text}(null==n?void 0:n.length)&&(null===(h=null===(d=n[0])||void 0===d?void 0:d.properties)||void 0===h?void 0:h.isAttachedFile)&&(v=v+" "+n[0].content);const{currentState:r,...o}=await Pe({sessionId:g,text:v});if(0===o.resultCode&&r){const e=l&&a?a:null!==(p=r.emission)&&void 0!==p?p:null==Sn?void 0:Sn.emission;rt.toLowerCase()!==Ze.toLowerCase()&&e&&tt?dn(r,rt,v).then((e=>{let t=e.translatedEmission||e.emission;t&&Fn(t)})):(bn({...r,emission:e}),e&&(cn({text:e,emitter:r.emitter,media:r.media,fromUser:!1,questionAnswered:v,generatedByAI:!!r.completion,contextVars:r.contextVars,date:r.currentDate,placeName:r.currentPlaceName,placeLatitude:r.currentLatitude,placeLongitude:r.currentLongitude,placeUncertaintyKm:r.currentUncertaintyKm,tag:r.currentTag,memoryTags:r.memoryTags}),Fn(e)))}else 404===o.resultCode&&(ln((e=>[...e.slice(0,e.length-1)])),wn(!1,Jt||e.secretToken,Yt,void 0,void 0,{PATHNAME:window.location.pathname,ROUTE:(null===(f=null===(m=window.location.pathname)||void 0===m?void 0:m.split("/"))||void 0===f?void 0:f.pop())||"",...N||{}},O).then((e=>{console.info("session timeout"),(null==e?void 0:e.sessionID)&&setTimeout((()=>{un(t,n,null==e?void 0:e.sessionID)}),500)})))}catch(e){console.error(e),y=!0,dt(void 0),ct(!1)}c||(dt(void 0),ct(!1))},dn=async(e,t,n,r=!1)=>{var i,o,s;const a=null!==(i=null==e?void 0:e.emission)&&void 0!==i?i:null==Sn?void 0:Sn.emission;let l={...e},c=null;if(a&&Ze.toUpperCase()!==t.toUpperCase()&&tt&&!r)try{const r=await SO(a,t,Ze,M);if(e.hints&&e.hints.length>0){const n=await Promise.all((null!==(o=e.hints)&&void 0!==o?o:[]).map((async e=>{var n;const r=await SO(e,t,Ze,M);return{text:null!==(n=null==r?void 0:r.text)&&void 0!==n?n:e,originalText:e}})));l={...e,emission:r.text,translatedHints:n}}else l={...e,emission:a,translatedEmission:r.text,hints:null!==(s=e.hints)&&void 0!==s?s:"G1"===e.state?null==Sn?void 0:Sn.hints:[]};r.text.length>0&&(c={text:a,translatedText:r.text,emitter:e.emitter,media:e.media,fromUser:!1,questionAnswered:n,generatedByAI:!!e.completion,contextVars:e.contextVars,date:e.currentDate,placeName:e.currentPlaceName,placeLatitude:e.currentLatitude,placeLongitude:e.currentLongitude,placeUncertaintyKm:e.currentUncertaintyKm,tag:e.currentTag,memoryTags:e.memoryTags})}catch(t){console.error("[TRANSLATE] Error during translation:",t),l={...e,emission:a},c={text:a,emitter:e.emitter,media:e.media,fromUser:!1,questionAnswered:n,contextVars:e.contextVars,date:e.currentDate,placeName:e.currentPlaceName,placeLatitude:e.currentLatitude,placeLongitude:e.currentLongitude,placeUncertaintyKm:e.currentUncertaintyKm,tag:e.currentTag,memoryTags:e.memoryTags}}else l={...e,emission:a},a&&(c={text:a,emitter:e.emitter,media:e.media,fromUser:!1,questionAnswered:n,contextVars:e.contextVars,date:e.currentDate,placeName:e.currentPlaceName,placeLatitude:e.currentLatitude,placeLongitude:e.currentLongitude,placeUncertaintyKm:e.currentUncertaintyKm,tag:e.currentTag,memoryTags:e.memoryTags});return bn(l),!r&&c&&cn(c),l},hn=void 0!==e.ageRestriction?e.ageRestriction:e.nsfw?18:e.enableCompletions?14:0,[pn,mn]=(0,c.useState)(),[fn,gn]=(0,c.useState)(!1),[vn,yn]=(0,c.useState)(k),[Sn,_n]=(0,c.useState)(),bn=e=>{var t;_n(e),H&&H(e);const n=new CustomEvent("MemoriNewDialogState",{detail:e});document.dispatchEvent(n);const r=null===(t=null==e?void 0:e.media)||void 0===t?void 0:t.filter((e=>{var t;return"text/javascript"===e.mimeType&&!!(null===(t=e.properties)||void 0===t?void 0:t.executable)}));null==r||r.forEach((e=>{try{setTimeout((()=>{var t;console.log("snippet",e),new Function(null!==(t=e.content)&&void 0!==t?t:"")(),setTimeout((()=>{var e,t,n;null===(e=document.querySelector(".memori-chat--content"))||void 0===e||e.scrollTo(0,null!==(n=null===(t=document.querySelector(".memori-chat--content"))||void 0===t?void 0:t.scrollHeight)&&void 0!==n?n:0)}),400)}),1e3)}catch(e){console.warn(e)}}))},xn=async n=>{var r,i,o,a,l;let c=LB("birthDate",void 0),u=null!==(r=null!=pn?pn:n.birthDate)&&void 0!==r?r:c;if(u||!hn)if("PUBLIC"===e.privacyType||e.secretToken||Jt||Yt){at(!0);try{let r;try{r=window.location.href}catch(e){console.debug(e)}const c=await Re({...n,birthDate:u,tag:null!==(i=n.tag)&&void 0!==i?i:null==B?void 0:B.tag,pin:null!==(o=n.pin)&&void 0!==o?o:null==B?void 0:B.pin,additionalInfo:{...V||{},loginToken:null!==(l=null!==(a=null!=UU?UU:He)&&void 0!==a?a:null==V?void 0:V.loginToken)&&void 0!==l?l:z,language:kn(rt),referral:r,timeZoneOffset:(new Date).getTimezoneOffset().toString()}});if((null==c?void 0:c.sessionID)&&(null==c?void 0:c.currentState)&&0===c.resultCode)return yn(c.sessionID),Ue((null==Sn?void 0:Sn.currentTag)===e.giverTag),Zt&&tn(Zt,c.sessionID),at(!1),{dialogState:c.currentState,sessionID:c.sessionID};if(!(null==c?void 0:c.resultMessage.startsWith("This Memori is aged restricted")))return 403===(null==c?void 0:c.resultCode)?(Kt(void 0),Qt("password"),c):(console.warn(c),t(ed).error((e=>(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:Ae(iO(null==c?void 0:c.resultCode))}),(0,s.jsx)(Em,{outlined:!0,padded:!1,onClick:()=>t(ed).dismiss(e.id),icon:(0,s.jsx)(Tm,{}),children:Ae("close")})]})),{duration:1/0}),Qe(!0),c);console.warn(c),t(ed).error(Ae("underageTwinSession",{age:hn})),Qe(!0)}catch(e){console.error(e)}}else Qt("password");else gn(!0)},wn=async(n=!1,r,i,o,s,a,l,c)=>{var u,d,h,p,m;at(!0);let f=LB("birthDate",void 0),g=null!=c?c:f;try{if(!g&&hn)return void gn(!0);if(!("PUBLIC"===e.privacyType||r||e.secretToken||Jt||i||Yt))return void Qt("password");let c;try{c=window.location.href,console.log("[REOPEN_SESSION] Got referral:",c)}catch(e){console.debug("[REOPEN_SESSION] Error getting referral:",e)}const{sessionID:f,currentState:v,...y}=await Re({memoriID:null!==(u=e.engineMemoriID)&&void 0!==u?u:"",password:r||Jt||e.secretToken,recoveryTokens:i||Yt,tag:null!=o?o:null==B?void 0:B.tag,pin:null!=s?s:null==B?void 0:B.pin,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:(null===(h=null===(d=window.location.pathname)||void 0===d?void 0:d.split("/"))||void 0===h?void 0:h.pop())||"",...a||{}},initialQuestion:l,birthDate:g,additionalInfo:{...V||{},loginToken:null!==(m=null!==(p=null!=UU?UU:He)&&void 0!==p?p:null==V?void 0:V.loginToken)&&void 0!==m?m:z,language:kn(rt),referral:c,timeZoneOffset:(new Date).getTimezoneOffset().toString()}});if(f&&v&&0===y.resultCode)return yn(f),n&&(bn(v),v.emission&&(an.length<=1?ln([{text:v.emission,emitter:v.emitter,media:v.media,fromUser:!1,initial:!0,contextVars:v.contextVars,date:v.currentDate,placeName:v.currentPlaceName,placeLatitude:v.currentLatitude,placeLongitude:v.currentLongitude,placeUncertaintyKm:v.currentUncertaintyKm,tag:v.currentTag,memoryTags:v.memoryTags}]):cn({text:v.emission,emitter:v.emitter,media:v.media,fromUser:!1,initial:!0,contextVars:v.contextVars,date:v.currentDate,placeName:v.currentPlaceName,placeLatitude:v.currentLatitude,placeLongitude:v.currentLongitude,placeUncertaintyKm:v.currentUncertaintyKm,tag:v.currentTag,memoryTags:v.memoryTags}))),Zt&&tn(Zt,f),e.needsDateTime&&An({sessionID:f,state:v}),at(!1),{dialogState:v,sessionID:f};(null==y?void 0:y.resultMessage.startsWith("This Memori is aged restricted"))?(console.error("[REOPEN_SESSION] Age restriction error:",y),t(ed).error(Ae("underageTwinSession",{age:hn})),Qe(!0)):403===(null==y?void 0:y.resultCode)?(console.error("[REOPEN_SESSION] Authentication error"),Kt(void 0),Qt("password")):(console.error("[REOPEN_SESSION] Other error:",y),t(ed).error(Ae(iO(y.resultCode))),Qe(!0))}catch(e){console.error("[REOPEN_SESSION] Caught error:",e)}return at(!1),null},Cn=async(t,n,r,i)=>{var o,s,a,l,c;if(!t||!n)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState:t,resultCode:u}=await ke(n,null!=r?r:lO);if(0===u){let d=0;if(r!==lO&&i&&("X1a"===t.state||"X1b"===t.state)){const{resultCode:e}=await Pe({sessionId:n,text:null!=i?i:""});d=e}if(0===d){const{currentState:e,...t}=await Le(n);if(0===t.resultCode&&e)return{currentState:e,sessionId:n,...t}}else if([400,401,403,404,500].includes(u)){console.warn("[APPCONTEXT/CHANGETAG]",u);let t,n=LB("birthDate",void 0);try{t=window.location.href}catch(e){console.debug(e)}xn({memoriID:null!==(o=e.engineMemoriID)&&void 0!==o?o:"",password:I||Jt||e.secretToken,tag:null!=r?r:null==B?void 0:B.tag,pin:null!=i?i:null==B?void 0:B.pin,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:(null===(a=null===(s=window.location.pathname)||void 0===s?void 0:s.split("/"))||void 0===a?void 0:a.pop())||"",...N||{}},initialQuestion:O,birthDate:pn||n||void 0,additionalInfo:{...V||{},loginToken:null!==(c=null!==(l=null!=UU?UU:He)&&void 0!==l?l:null==V?void 0:V.loginToken)&&void 0!==c?c:z,language:kn(rt),referral:t,timeZoneOffset:(new Date).getTimezoneOffset().toString()}})}else if(t)return{currentState:t,sessionId:n,resultCode:u}}}catch(e){let t=e;return console.warn("[APPCONTEXT/CHANGETAG]",t),Promise.reject(t)}return null},An=(0,c.useCallback)((async({sessionID:t,date:n,state:r})=>{var i;const o=null!=t?t:vn,s=null!=r?r:Sn;if(!o||!e.needsDateTime||(null===(i=null==s?void 0:s.hints)||void 0===i?void 0:i.length))return;const a=(n?As.DateTime.fromISO(n):As.DateTime.now()).toUTC().toFormat("yyyy/MM/dd HH:mm:ss ZZ").split(":").slice(0,-1).join(":"),{currentState:l,...c}=await Oe(o,a);0===c.resultCode&&l&&_n((e=>{var t;return{...e,...l,hints:(null===(t=l.hints)||void 0===t?void 0:t.length)?l.hints:null==e?void 0:e.hints}}))}),[Sn,e.needsDateTime,vn]);(0,c.useEffect)((()=>{if(vn&&e.needsDateTime){An({sessionID:vn,state:Sn});let e=setInterval((()=>{An({sessionID:vn})}),6e4);return()=>{clearInterval(e)}}}),[e.needsDateTime,vn]);const[En,Tn]=(0,c.useState)(),In=(0,c.useRef)(),Mn=()=>{En&&(clearTimeout(En),Tn(void 0)),(null==In?void 0:In.current)&&(clearTimeout(In.current),In.current=void 0)},Rn=()=>{Mn(),Nt||nn.length||lt||on||Nn()},Pn=async()=>{var e;if(!mt||Nt||nn.length||lt||on)Rn();else if(vn&&mt&&(null==Sn?void 0:Sn.acceptsTimeout)){const{currentState:t,...n}=await De(vn);if(0===n.resultCode&&t){const n=t.emission;if(tt&&rt!==(null==Ee?void 0:Ee.language)&&n&&n.length>0)dn({...t,emission:n},rt).then((e=>{let t=e.translatedEmission||e.emission;t&&Fn(t)}));else{if(!(n&&n.length>0))return void Rn();cn({text:n,emitter:t.emitter,media:t.media,fromUser:!1,generatedByAI:!!t.completion,contextVars:t.contextVars,date:t.currentDate,placeName:t.currentPlaceName,placeLatitude:t.currentLatitude,placeLongitude:t.currentLongitude,placeUncertaintyKm:t.currentUncertaintyKm,tag:t.currentTag,memoryTags:t.memoryTags}),Fn(n),bn({...t,hints:null!==(e=t.hints)&&void 0!==e?e:"G1"===t.state?null==Sn?void 0:Sn.hints:[]})}}}},Nn=()=>{let e=null==Sn?void 0:Sn.timeout;if(!e){let t=40,n=25;if(e=Math.floor(Math.random()*(t-n))+n,null==Sn?void 0:Sn.emission){e+=Sn.emission.length/26.5}}if(nt&&(e=nt,null==Sn?void 0:Sn.emission)){e+=Sn.emission.length/26.5}let t=setTimeout(Pn,1e3*e);Tn(t),In.current=t};(0,c.useEffect)((()=>{(nn.length||Nt||lt)&&Mn(),vn&&!nn.length&&Rn()}),[null==Sn?void 0:Sn.acceptsTimeout,null==Sn?void 0:Sn.timeout,null==Sn?void 0:Sn.state,Nt,vn,an,nn,lt,mt]),(0,c.useEffect)((()=>()=>{ft(!1),$e(!1),Mn(),In.current=void 0}),[]);const On=()=>{if(!F)return;kU=bs.SpeechConfig.fromSubscription(F,"westeurope"),kU.speechSynthesisLanguage=kn(rt),kU.speechSynthesisVoiceName=Dn(rt),kU.speechRecognitionLanguage=kn(rt),kU.setProperty("speechSynthesis.outputFormat","viseme"),nR()&&(kU.speechSynthesisOutputFormat=bs.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3),zU=new Xo;let e=zU.createBuffer(1,1e4,22050),t=zU.createBufferSource();t.buffer=e,t.connect(zU.destination),BU=new bs.SpeakerAudioDestination;let n=bs.AudioConfig.fromSpeakerOutput(BU);LU=new bs.SpeechSynthesizer(kU,n)},Dn=(0,c.useCallback)((t=>{var n,r,i,o;let s="",a=(null!==(o=null!==(i=null!=t?t:null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])&&void 0!==i?i:Ee.language)&&void 0!==o?o:"IT").toUpperCase(),l=e.voiceType;if(e.enableBoardOfExperts&&(null==Sn?void 0:Sn.emitter)){null==Cr||Cr.find((e=>e.name===(null==Sn?void 0:Sn.emitter)))}switch(a){case"IT":s=""+("MALE"===l?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":s=""+("MALE"===l?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":s=""+("MALE"===l?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":s=""+("MALE"===l?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":s=""+("MALE"===l?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":s=""+("MALE"===l?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":s=""+("MALE"===l?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":s=""+("MALE"===l?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;case"PL":s=""+("MALE"===l?"pl-PL-MarekNeural":"pl-PL-AgnieszkaNeural");break;case"FI":s=""+("MALE"===l?"fi-FI-HarriNeural":"fi-FI-SelmaNeural");break;case"EL":s=""+("MALE"===l?"el-GR-NestorasNeural":"el-GR-AthinaNeural");break;case"AR":s=""+("MALE"===l?"ar-SA-HamedNeural":"ar-SA-ZariyahNeural");break;case"ZH":s=""+("MALE"===l?"zh-CN-YunxiNeural":"zh-CN-XiaoxiaoNeural");break;case"JA":s=""+("MALE"===l?"ja-JP-KeitaNeural":"ja-JP-NanamiNeural");break;default:s=""+("MALE"===l?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return s}),[e.voiceType,e.enableBoardOfExperts,null==Sn?void 0:Sn.emitter,Ee.language,e.culture]),kn=t=>{var n,r;let i="";switch((t||(null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])||Ee.language||"IT").toUpperCase()){case"IT":default:i="it-IT";break;case"DE":i="de-DE";break;case"EN":i="en-GB";break;case"ES":i="es-ES";break;case"FR":i="fr-FR";break;case"PT":i="pt-PT";break;case"UK":i="uk-UK";break;case"RU":i="ru-RU";break;case"PL":i="pl-PL";break;case"FI":i="fi-FI";break;case"EL":i="el-GR";break;case"AR":i="ar-SA";break;case"ZH":i="zh-CN";break;case"JA":i="ja-JP"}return i},[Ln,Bn]=(0,c.useState)();(0,c.useEffect)((()=>{(async()=>{try{const e=await fetch(`${M||"https://aisuru.com"}/api/lexiconmap`);return await e.json()}catch(e){console.error(e)}})().then((e=>{Bn(e)}))}),[]);const zn=()=>{const e=new CustomEvent("MemoriEndSpeak");document.dispatchEvent(e)},Fn=e=>{if(console.debug("speak called with text:",e),!F||m)return console.debug("No TTS key or preview mode, emitting end speak event"),void zn();if(console.debug("Stopping listening before speaking"),rr(),m)return void console.debug("Preview mode, returning early");if(jU)return console.debug("Speaker muted, skipping speech synthesis"),GU=!1,ct(!1),zn(),void(It&&(console.debug("Setting listening timeout for continuous speech"),$n()));BU&&(console.debug("Pausing existing audio destination"),BU.pause());let t=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome"),n=/iPad|iPhone|iPod/.test(navigator.userAgent);if(console.debug("Browser detection - Safari:",t,"iOS:",n),"interrupted"===zU.state)return console.debug("Audio context interrupted, attempting resume"),void zU.resume().then((()=>Fn(e)));if("closed"===zU.state){console.debug("Audio context closed, creating new context"),zU=new Xo;let e=zU.createBuffer(1,1e4,22050),t=zU.createBufferSource();t.buffer=e,t.connect(zU.destination)}else if("suspended"===zU.state){console.debug("Audio context suspended, stopping audio and creating new context"),Gn(),zU=new Xo;let e=zU.createBuffer(1,1e4,22050),t=zU.createBufferSource();t.buffer=e,t.connect(zU.destination)}LU||On();const r=zU.createBufferSource();r.addEventListener("ended",(()=>{console.debug("Audio source ended"),Ot(!1),GU=!1})),BU.onAudioEnd=()=>{console.debug("Audio destination ended"),Ot(!1),GU=!1,r.disconnect(),zn(),lr()},console.debug("Resetting viseme queue"),qt(),LU&&(LU.visemeReceived=function(e,t){console.debug("Viseme received:",t.visemeId,"at offset:",t.audioOffset),Vt(t.visemeId,t.audioOffset)});const i=hR(cR(lR(dR(uR(e)))));console.debug("Processed text to speak:",i),setTimeout((()=>{LU&&(console.debug("Starting speech synthesis"),LU.speakSsmlAsync(`<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" xml:lang="${kn(rt)}"><voice name="${Dn(rt)}"><s>${((e,t)=>{var n;if(!Ln)return e;const r={...null!==(n=Ln.common)&&void 0!==n?n:{},...(null==L?void 0:L.id)&&Ln[L.id]?Ln[L.id]:{}},i=Object.keys(r).map((e=>{var n;return{word:e,phoneme:null!==(n=r[e][t.toLowerCase()])&&void 0!==n?n:r[e].default,caseSensitive:r[e].caseSensitive}}));return i.reduce(((e,{word:t,phoneme:n,caseSensitive:r})=>e.replace(new RegExp(`\\b${t}\\b`,r?"g":"gi"),`<phoneme alphabet="ipa" ph="${n}">${t}</phoneme>`)),e)})(i,rt.toLowerCase())}</s></voice></speak>`,(i=>{if(i){console.debug("Speech synthesis successful"),Ot(!0),GU=!0,Gt(zU);try{console.debug("Decoding audio data"),zU.decodeAudioData(i.audioData,(function(e){console.debug("Audio data decoded successfully"),r.buffer=e,r.connect(zU.destination),(an.length<1||t&&n)&&(console.debug("Starting audio playback"),r.start(0))})),zU.onstatechange=()=>{console.debug("Audio context state changed to:",zU.state),"suspended"===zU.state||"closed"===zU.state?(r.disconnect(),Ot(!1),Wt(),qt(),GU=!1):"interrupted"===zU.state&&zU.resume()},zU.resume(),LU&&(console.debug("Closing speech synthesizer"),LU.close(),LU=null)}catch(t){console.error("Error processing audio data:",t),Un(e)}}else console.debug("No result from speech synthesis, using fallback"),Un(e)}),(t=>{console.error("Speak error:",t),Un(e)})))}),100),ct(!1)},Un=e=>{window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),jn()},jn=()=>{Ot(!1),Wt(),qt(),GU=!1;try{if(LU){const e=LU;LU=null,console.debug("Closing speech synthesizer"),e.close()}}catch(e){console.debug("Error during synthesizer cleanup:",e),LU=null}zn()},Gn=async()=>{Ot(!1),GU=!1;try{if(LU){const e=LU;LU=null;try{e.close()}catch(e){console.debug("Error closing speech synthesizer:",e)}}"closed"!==(null==zU?void 0:zU.state)&&zU.close(),BU&&(BU.pause(),BU.close())}catch(e){console.debug("stopAudio error: ",e)}};(0,c.useEffect)((()=>{"TOTEM"!==ht&&(()=>{let e=document.querySelector("#chat-fieldset textarea");e&&je?e.focus():null==e||e.blur()})()}),[null==Sn?void 0:Sn.emission]);const[Hn,Vn]=(0,c.useState)(""),[Wn,qn]=(0,c.useState)(null),[Jn,Kn]=(0,c.useState)(!1),Yn=()=>{Vn("")},$n=()=>{Xn();const e=setTimeout(nr,1e3*Rt+300);qn(e)},Xn=()=>{Wn&&(clearTimeout(Wn),qn(null))};(0,c.useEffect)((()=>{Jn||(Xn(),It&&$n(),Rn())}),[Hn,Jn]),(0,c.useEffect)((()=>()=>{Xn()}),[]);const Qn=async()=>{if(!F)throw new Error("No TTS key available");if(!vn)throw new Error("No session ID available");jn(),Yn();try{await navigator.mediaDevices.getUserMedia({audio:!0});vt(!0),kU=Zn(F);const e=bs.AudioConfig.fromDefaultMicrophoneInput();DU=new bs.SpeechRecognizer(kU,e),er(DU),sn(!0),DU.startContinuousRecognitionAsync(),DU.canceled=(e,t)=>{t.reason===bs.CancellationReason.Error&&(console.debug(`"CANCELED: ErrorCode=${t.errorCode}`),console.debug(`"CANCELED: ErrorDetails=${t.errorDetails}`),console.debug("CANCELED: Did you set the speech resource key and region values?"),rr(),jn()),rr()},DU.sessionStopped=(e,t)=>{rr(),Yn()}}catch(e){throw console.error("Error in startListening:",e),rr(),e}},Zn=e=>(kU=bs.SpeechConfig.fromSubscription(e,"westeurope"),kU.speechRecognitionLanguage=kn(rt),kU.speechSynthesisLanguage=kn(rt),kU.speechSynthesisVoiceName=Dn(rt),kU),er=e=>{e&&(e.recognized=(e,t)=>{tr(t.result.text)},e.properties.setProperty("SpeechServiceResponse_JsonResult","true"),e.properties.setProperty("SpeechServiceConnection_NoiseSuppression","true"),e.properties.setProperty("SpeechServiceConnection_SNRThresholdDb","10.0"))},tr=e=>{if(console.debug("Handling recognized speech:",e),!e||0===e.trim().length)return void console.debug("No valid text received from speech recognition");Vn(e),Kn(!1);const t=aR(e);console.debug("Stripped message:",t),t.length>0&&rn(t)},nr=()=>{const e=aR(Hn);e.length>0&&on?(un(e),Yn(),rn(""),ir()):on&&Rn()},rr=()=>{console.debug("Stopping speech recognition"),DU&&(DU.stopContinuousRecognitionAsync(),DU.close(),DU=null),sn(!1)},ir=()=>{rr(),Xn(),Kn(!1)},or=()=>{try{ir(),Mn(),$e(!1),In.current=void 0,Gn()}catch(e){console.log("Error: resetUIEffects",e)}};(0,c.useEffect)((()=>()=>{or()}),[]),(0,c.useEffect)((()=>(document.addEventListener("MemoriResetUIEffects",or),()=>{document.removeEventListener("MemoriResetUIEffects",or)})),[]),(0,c.useEffect)((()=>{"Z0"===(null==Sn?void 0:Sn.state)&&ir()}),[null==Sn?void 0:Sn.state]);const[sr,ar]=(0,c.useState)(!1),lr=(0,c.useCallback)((e=>{Nt&&LU&&(LU.close(),LU=null),!It||!gt&&sr||(ar(!0),Qn())}),[It,gt]);(0,c.useEffect)((()=>{Nt||!It||!gt&&sr||!vn?Nt&&on&&rr():Qn()}),[Nt,gt]),(0,c.useEffect)((()=>{on&&(ir(),Yn(),rn(""),Qn())}),[Ze]);const[cr,ur]=(0,c.useState)("keypress");(0,c.useEffect)((()=>{window.innerWidth<=768&&nR()?ur("click"):ur("keypress")}),[]);const[dr,hr]=(0,c.useState)(),pr=null==et?void 0:et.globalBackground,mr=pr?`url(${pr})`:null,fr=u?{"--memori-chat-bubble-bg":"#fff",...et&&!Fe?{"--memori-text-color":null!==(de=et.textColor)&&void 0!==de?de:"#000"}:{},...(null==et?void 0:et.buttonBgColor)?{"--memori-button-bg":et.buttonBgColor,"--memori-primary":et.buttonBgColor}:{},...(null==et?void 0:et.buttonTextColor)?{"--memori-button-text":et.buttonTextColor}:{},...(null==et?void 0:et.blurBackground)?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...(null==et?void 0:et.innerBgColor)?{"--memori-inner-bg":`rgba(${"dark"===et.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(he=et.innerBgAlpha)&&void 0!==he?he:.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===et.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(pe=null==et?void 0:et.innerBgAlpha)&&void 0!==pe?pe:.4})`}:{"--memori-inner-content-pad":"0px"}}:{},gr=`\n ${m?"#preview, ":$?":root, ":""}memori-client, .memori-widget, .memori-drawer, .memori-modal {\n ${Object.entries(fr).map((([e,t])=>`${e}: ${t};`)).join("\n")}\n }\n `,vr=void 0===(null==et?void 0:et.showAIicon)||(null==et?void 0:et.showAIicon),yr=!!(null!=A?A:null==et?void 0:et.showUpload),Sr=void 0===(null==et?void 0:et.showWhyThisAnswer)||(null==et?void 0:et.showWhyThisAnswer),[_r,br]=(0,c.useState)(!1);(0,c.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===ht||"FULLPAGE"!==ht)&&br(!0)}),[]),(0,c.useEffect)((()=>{if(null==et?void 0:et.seoTitle){let e=document.createElement("meta");e.setAttribute("property","og:title"),e.setAttribute("content",et.seoTitle),document.head.append(e)}if(null==et?void 0:et.seoDescription){let e=document.createElement("meta");e.setAttribute("property","og:description"),e.setAttribute("content",et.seoDescription),document.head.append(e)}if(null==et?void 0:et.seoUrl){let e=document.createElement("meta");e.setAttribute("property","og:url"),e.setAttribute("content",et.seoUrl),document.head.append(e)}let t=D||e.avatarURL;if((null==et?void 0:et.seoImageShowAvatar)&&t){let e=document.createElement("meta");e.setAttribute("property","og:image"),e.setAttribute("content",t),document.head.append(e)}}),[et,e.avatarURL,D]);const xr=(0,c.useCallback)((e=>{if(G)return;const{text:t,waitForPrevious:n,hidden:r,typingText:i,useLoaderTextAsMsg:o,hasBatchQueued:s}=e.detail;t&&(n&&!jU&&(GU||lt)?setTimeout((()=>{xr(e)}),1e3):(rr(),Gn(),un(t,void 0,void 0,void 0,void 0,r,i,o,s)))}),[vn,Nt,lt,rt,G]);(0,c.useEffect)((()=>(G?document.removeEventListener("MemoriTextEntered",xr):document.addEventListener("MemoriTextEntered",xr),()=>{document.removeEventListener("MemoriTextEntered",xr)})),[vn,rt,G]);const wr=(0,c.useCallback)((async(t,n=!1)=>{var r,i,o,s,a,l,c,u,d,h,p,m,f,g,v,y;const S=(null==t?void 0:t.sessionID)||vn,_=(null==t?void 0:t.dialogState)||Sn;$e(!0);let b=[],x=document.getElementById("memori-audio"),w=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome");x&&w&&(x.muted=!1,x.play().catch((e=>{console.warn("error playing intro audio",e)})));let C=LB("birthDate",void 0),A=pn||C||(null==We?void 0:We.birthDate);if(!A&&Y&&k&&(A="1970-01-01T10:24:03.845Z"),S||!hn||A){if(!S&&"PUBLIC"!==e.privacyType&&!e.secretToken&&!Jt&&!Yt||!S&&Xe)return Qt("password"),void $e(!1);if(!S||n){$e(!1),Qe(!1);const t=await xn({memoriID:e.engineMemoriID,password:I||Jt||e.secretToken,tag:null==B?void 0:B.tag,pin:null==B?void 0:B.pin,initialContextVars:{PATHNAME:null===(r=window.location.pathname)||void 0===r?void 0:r.toUpperCase(),ROUTE:(null===(s=null===(o=null===(i=window.location.pathname)||void 0===i?void 0:i.split("/"))||void 0===o?void 0:o.pop())||void 0===s?void 0:s.toUpperCase())||"",...N||{}},initialQuestion:O,birthDate:A,additionalInfo:{...V||{},loginToken:null!==(l=null!==(a=null!=UU?UU:He)&&void 0!==a?a:null==V?void 0:V.loginToken)&&void 0!==l?l:z,language:kn(rt),timeZoneOffset:(new Date).getTimezoneOffset().toString()}});return void((null==t?void 0:t.dialogState)?(ln([]),dn(t.dialogState,rt).then((e=>{let t=e.translatedEmission||e.emission;t&&Fn(t)})).finally((()=>{ft(!0)}))):0===(null==t?void 0:t.resultCode)?await wr(t||void 0):at(!1))}if(k){console.debug("[CLICK_START] Handling initial session");const{currentState:t,...n}=await Le(S);if(0!==n.resultCode||!t)return console.debug("[CLICK_START] Session expired, opening new session"),Qe(!0),yn(void 0),$e(!1),void await wr(void 0,!0);if(ln([]),Zt&&tn(Zt,S),e.needsDateTime&&An({sessionID:S,state:t}),B&&t.currentTag!==B.tag)try{console.debug("[CLICK_START] Changing tag for personification",B,t),await Cn(e.engineMemoriID,S,"-");const n=await Cn(e.engineMemoriID,S,B.tag,B.pin);if(!n||0!==n.resultCode)throw console.error("[CLICK_START] Session error:",n),new Error("No session");dn(n.currentState,rt).then((e=>{let t=e.translatedEmission||e.emission;t&&Fn(t)})).finally((()=>{ft(!0)}))}catch(t){console.error("[CLICK_START] Error changing tag:",t),wn(!0,null==e?void 0:e.secretToken,void 0,B.tag,B.pin,{PATHNAME:null===(c=window.location.pathname)||void 0===c?void 0:c.toUpperCase(),ROUTE:(null===(h=null===(d=null===(u=window.location.pathname)||void 0===u?void 0:u.split("/"))||void 0===d?void 0:d.pop())||void 0===h?void 0:h.toUpperCase())||"",...N||{}},O,A).then((()=>{ft(!0)}))}else if(!B&&(null==t?void 0:t.currentTag)&&(null==t?void 0:t.currentTag)!==lO&&"-"!==(null==t?void 0:t.currentTag))try{console.debug("[CLICK_START] Changing to anonymous tag"),await Cn(e.engineMemoriID,S,"-");const t=await Cn(e.engineMemoriID,S,lO);if(!t||0!==t.resultCode)throw console.error("[CLICK_START] Session error:",t),new Error("No session");dn(t.currentState,rt).then((e=>{let t=e.translatedEmission||e.emission;t&&Fn(t)})).finally((()=>{ft(!0)}))}catch(t){console.error("[CLICK_START] Error changing tag:",t),wn(!0,null==e?void 0:e.secretToken,void 0,void 0,void 0,{PATHNAME:null===(p=window.location.pathname)||void 0===p?void 0:p.toUpperCase(),ROUTE:(null===(g=null===(f=null===(m=window.location.pathname)||void 0===m?void 0:m.split("/"))||void 0===f?void 0:f.pop())||void 0===g?void 0:g.toUpperCase())||"",...N||{}},O,A).then((()=>{ft(!0)}))}else{try{console.debug("[CLICK_START] Getting chat history");const{chatLogs:e,...n}=await ze(S,S),r=null===(v=null==e?void 0:e[0])||void 0===v?void 0:v.lines.map(((e,t)=>{var n,r;return{text:e.text,media:null===(r=null===(n=e.media)||void 0===n?void 0:n.filter((e=>aO.includes(e.mimeType))))||void 0===r?void 0:r.map((e=>({mediumID:`${t}-${e.mimeType}`,...e}))),fromUser:e.inbound,timestamp:e.timestamp,emitter:e.emitter,initial:0===t}}));if(b=null!=r?r:[],Ze.toUpperCase()!==rt.toUpperCase()&&tt)try{console.debug("[CLICK_START] Translating messages"),b=await Promise.all(r.map((async e=>({...e,originalText:e.text,text:(await SO(e.text,rt,Ze,M)).text}))))}catch(e){}ln(b),console.debug("[CLICK_START] props currentState:",t,"userLang:",rt,"translatedMessages:",b,"history:",an)}catch(e){console.log("[CLICK_START] Error retrieving chat logs:",e)}if((null==b?void 0:b.length)&&b.length>1||!O)console.log("[CLICK_START] Using existing chat history"),dn(t,rt,void 0,!!(null==b?void 0:b.length)).then((e=>{let t=e.translatedEmission||e.emission;t&&Fn(t)})).finally((()=>{ft(!0)}));else{console.log("[CLICK_START] Using existing chat history with message from initial question"),b=[],ln([]),ct(!0);const e=await Pe({sessionId:S,text:O});dn(null!==(y=e.currentState)&&void 0!==y?y:t,rt,void 0,!1).then((e=>{let t=e.translatedEmission||e.emission;t&&Fn(t)})).finally((()=>{ct(!1),ft(!0)}))}}Zt&&tn(Zt,S),e.needsDateTime&&An({sessionID:S,state:t})}else console.debug("[CLICK_START] Using existing session"),ln([]),dn(_,rt).then((e=>{let t=e.translatedEmission||e.emission;t&&Fn(t)})).finally((()=>{ft(!0)}))}else gn(!0),$e(!1)}),[Jt,e,Yt,pn,vn,rt,Zt]);(0,c.useEffect)((()=>{!Ye&&Y&&(F&&!LU&&On(),wr())}),[Ye,Y]),(0,c.useEffect)((()=>{const t=document.querySelector(`memori-client[memoriname="${e.name}"]`)||document.querySelector(`memori-client[memoriid="${e.memoriID}"]`)||document.querySelector("memori-client");if(!t)return;const n=new MutationObserver(((e,t)=>{var n,r,i;for(const t of e)"attributes"===t.type&&"authtoken"===(null===(n=t.attributeName)||void 0===n?void 0:n.toLowerCase())&&("MEMORI-CLIENT"===t.target.nodeName?(Ve(t.target.getAttribute("authtoken")||void 0),UU=t.target.getAttribute("authtoken")||void 0):(Ve((null===(i=null===(r=t.target)||void 0===r?void 0:r.parentElement)||void 0===i?void 0:i.getAttribute("authtoken"))||void 0),UU=t.target.getAttribute("authtoken")||void 0))}));return n.observe(t,{attributes:!0,childList:!1,subtree:!1}),()=>{n.disconnect()}}),[]);const[Cr,Ar]=(0,c.useState)(),Er=(0,c.useCallback)((async()=>{if(vn&&(null==e?void 0:e.enableBoardOfExperts))try{const{experts:e,count:t,...n}=await Be(vn);0===n.resultCode?Ar(e):console.warn("Error fetching experts",n)}catch(e){console.warn(e)}}),[vn,null==e?void 0:e.enableBoardOfExperts]);(0,c.useEffect)((()=>{Er()}),[vn,Er]);const Tr=e.enableDeepThought&&!!He&&!!(null==We?void 0:We.userID)&&(null==We?void 0:We.pAndCUAccepted),Ir=null==L?void 0:L.billingDelegation,[Mr,Rr]=(0,c.useState)(!0),Pr=(0,c.useCallback)((async()=>{if(null==L?void 0:L.billingDelegation)try{const e=await NU({operation:Tr?"dt_session_creation":"session_creation",baseUrl:M,userID:r,userName:i,tenant:o});e.enough?Rr(!0):(Rr(!1),console.warn("Not enough credits. Required:",e.required))}catch(e){let t=e;console.debug(t)}}),[null==L?void 0:L.billingDelegation,Tr]);(0,c.useEffect)((()=>{(null==L?void 0:L.billingDelegation)&&Pr()}),[null==L?void 0:L.billingDelegation,Tr]);const Nr=void 0===E?"TOTEM"!==ht&&"WEBSITE_ASSISTANT"!==ht&&"HIDDEN_CHAT"!==ht:!E,Or={memori:e,tenant:L,history:an,showShare:null===(me=null!=p?p:null==et?void 0:et.showShare)||void 0===me||me,position:Zt,setShowPositionDrawer:St,setShowSettingsDrawer:bt,setShowKnownFactsDrawer:wt,setShowExpertsDrawer:At,enableAudio:null===(fe=null!=U?U:null==et?void 0:et.enableAudio)||void 0===fe||fe,showSpeaker:!!F,speakerMuted:Et||jU,setSpeakerMuted:e=>{if(jU=!!e,Tt(e),"CONTINUOUS"===LB("microphoneMode","HOLD_TO_TALK")&&e&&(Mt(!1),BB("microphoneMode","HOLD_TO_TALK")),BB("muteSpeaker",!!e),e)Gn();else{zU=new Xo;let e=zU.createBuffer(1,1e4,22050),t=zU.createBufferSource();t.buffer=e,t.connect(zU.destination)}},showSettings:b,hasUserActivatedSpeak:mt,showReload:"TOTEM"===ht,showClear:w,clearHistory:()=>ln((e=>e.slice(-1))),showLogin:C,setShowLoginDrawer:Ke,loginToken:He,user:We,sessionID:vn},Dr={memori:e,integration:u,integrationConfig:et,tenant:L,instruct:Fe,avatar3dVisible:_r,setAvatar3dVisible:br,hasUserActivatedSpeak:mt,isPlayingAudio:Nt&&!Et,loading:!!lt,baseUrl:M,apiUrl:Me.constants.BACKEND_URL,enablePositionControls:Lt,setEnablePositionControls:Bt,avatarType:zt},kr={memori:e,tenant:L,language:Ze,userLang:rt,setUserLang:it,baseUrl:M,apiUrl:Me.constants.BACKEND_URL,position:Zt,openPositionDrawer:()=>St(!0),integrationConfig:et,instruct:Fe,sessionId:vn,clickedStart:Ye,isMultilanguageEnabled:tt,onClickStart:wr,initializeTTS:On,isUserLoggedIn:!!He&&!!(null==We?void 0:We.userID),hasInitialSession:!!k,notEnoughCredits:Ir&&!Mr,showLogin:C,setShowLoginDrawer:Ke,user:We},Lr={memori:e,sessionID:vn||"",tenant:L,translateTo:tt&&rt.toUpperCase()!==(null===(_e=null!==(Se=null!==(ye=null===(ve=null===(ge=e.culture)||void 0===ge?void 0:ge.split("-"))||void 0===ve?void 0:ve[0])&&void 0!==ye?ye:Ee.language)&&void 0!==Se?Se:"IT")||void 0===_e?void 0:_e.toUpperCase())?rt:void 0,baseUrl:M,apiUrl:Me.constants.BACKEND_URL,layout:d,memoriTyping:lt,typingText:ut,showTypingText:x,history:Nr?an:an.slice(-2),authToken:null!==(xe=null!==(be=null!=He?He:UU)&&void 0!==be?be:null==V?void 0:V.loginToken)&&void 0!==xe?xe:z,dialogState:Sn,setDialogState:bn,pushMessage:cn,simulateUserPrompt:(e,t)=>{rr(),Gn(),un(e,void 0,void 0,!1,t)},showDates:S,showContextPerLine:_,showAIicon:vr,showUpload:yr,showWhyThisAnswer:Sr,showCopyButton:g,showTranslationOriginal:v,client:Me,instruct:Fe,preview:m,sendOnEnter:cr,setSendOnEnter:ur,microphoneMode:It?"CONTINUOUS":"HOLD_TO_TALK",attachmentsMenuOpen:dr,setAttachmentsMenuOpen:hr,showInputs:y,showMicrophone:!!F,userMessage:nn,onChangeUserMessage:e=>{if(!e||"\n"===e||""===e.trim())return rn(""),void Rn();rn(e),Mn()},sendMessage:(e,t)=>{Gn(),rr(),un(e,t?[{mediumID:t.mediumID,mimeType:t.mimeType,content:t.content,title:t.title,properties:t.properties}]:void 0),rn(""),Yn()},stopListening:ir,startListening:Qn,stopAudio:Gn,resetTranscript:Yn,listening:on,setEnableFocusChatInput:Ge,isPlayingAudio:Nt,customMediaRenderer:q,user:We,userAvatar:J,experts:Cr,useMathFormatting:ot},Br=u&&mr?(0,s.jsx)("div",{className:"memori--global-background",children:(0,s.jsx)("div",{className:"memori--global-background-image",style:{backgroundImage:mr}})}):(0,s.jsx)("div",{className:"memori--global-background no-background-image"}),zr=u?(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:gr}}):null,Fr=(0,s.jsx)(WF,{tenant:L,userLang:rt,integrationID:null==u?void 0:u.integrationID,memoriHash:`${e.ownerTenantName}-${e.ownerUserName}-${e.name}`}),Ur=h||("TOTEM"===ht?TU:"CHAT"===ht?IU:"FULLPAGE"===ht?EU:"WEBSITE_ASSISTANT"===ht?MU:"HIDDEN_CHAT"===ht?RU:"ZOOMED_FULL_BODY"===ht?PU:EU);return(0,s.jsxs)("div",{className:t(Cs)("memori","memori-widget",`memori-layout-${ht.toLowerCase()}`,`memori-controls-${Dt.toLowerCase()}`,`memori--avatar-${(null==et?void 0:et.avatar)||"default"}`,{"memori--auto-start":Y,"memori--preview":m,"memori--embed":f,"memori--with-integration":u,"memori--with-speechkey":!!F,"memori--active":mt,"memori--hide-emissions":Ut,"memori--has-active-session":!!vn}),"data-memori-name":null==e?void 0:e.name,"data-memori-id":null==e?void 0:e.engineMemoriID,"data-memori-secondary-id":null==e?void 0:e.memoriID,"data-memori-session-id":vn,"data-memori-integration":null==u?void 0:u.integrationID,"data-memori-engine-state":JSON.stringify({...Sn,sessionID:vn}),style:{height:T},children:[(0,s.jsx)(Ur,{Header:VF,headerProps:Or,Avatar:Uz,avatarProps:Dr,Chat:tD,chatProps:Lr,StartPanel:cD,startPanelProps:kr,integrationStyle:zr,integrationBackground:Br,poweredBy:Fr,sessionId:vn,hasUserActivatedSpeak:mt,loading:st}),(0,s.jsx)("audio",{id:"memori-audio",style:{display:"none"},src:"https://aisuru.com/intro.mp3"}),Te&&(0,s.jsx)(CN,{withModal:!0,pwdOrTokens:Xt,openModal:!!Xt,setPwdOrTokens:Qt,showTokens:"SECRET"===e.privacyType,onFinish:async e=>{var t,n,r,i;e.password&&Kt(e.password),e.password&&(FU=e.password),e.tokens&&$t(e.tokens),wn(!vn,e.password,e.tokens,null==B?void 0:B.tag,null==B?void 0:B.pin,{PATHNAME:null===(t=window.location.pathname)||void 0===t?void 0:t.toUpperCase(),ROUTE:(null===(i=null===(r=null===(n=window.location.pathname)||void 0===n?void 0:n.split("/"))||void 0===r?void 0:r.pop())||void 0===i?void 0:i.toUpperCase())||"",...N||{}},O,pn).then((e=>{Qt(null),wr(e||void 0)})).catch((()=>{Qt(null),Qe(!0)}))},minimumNumberOfRecoveryTokens:null!==(we=null==e?void 0:e.minimumNumberOfRecoveryTokens)&&void 0!==we?we:1}),Te&&(0,s.jsx)($F,{visible:fn,minAge:hn,onClose:t=>{var n,r,i,o;t?(mn(t),BB("birthDate",t),wn(!vn,FU||Jt||(null==e?void 0:e.secretToken),Yt,null==B?void 0:B.tag,null==B?void 0:B.pin,{PATHNAME:null===(n=window.location.pathname)||void 0===n?void 0:n.toUpperCase(),ROUTE:(null===(o=null===(i=null===(r=window.location.pathname)||void 0===r?void 0:r.split("/"))||void 0===i?void 0:i.pop())||void 0===o?void 0:o.toUpperCase())||"",...N||{}},O,t).then((e=>{gn(!1),Qt(null),wr(e||void 0)})).catch((()=>{gn(!1),Qe(!0)}))):(gn(!1),$e(!1))}}),_t&&(0,s.jsx)(fU,{layout:ht,open:!!_t,onClose:()=>bt(!1),microphoneMode:It?"CONTINUOUS":"HOLD_TO_TALK",continuousSpeechTimeout:Rt,setMicrophoneMode:e=>Mt("CONTINUOUS"===e),setContinuousSpeechTimeout:Pt,controlsPosition:Dt,setControlsPosition:kt,hideEmissions:Ut,setHideEmissions:jt,avatarType:zt,setAvatarType:Ft,enablePositionControls:Lt,setEnablePositionControls:Bt,isAvatar3d:!!(null==et?void 0:et.avatarURL),additionalSettings:W,speakerMuted:jU}),yt&&(0,s.jsx)(tP,{memori:e,open:!!yt,venue:Zt,setVenue:e=>{en(e),tn(e),e?BB("position",JSON.stringify(e)):zB("position")},onClose:e=>{e&&tn(e),St(!1)}}),xt&&vn&&(0,s.jsx)(SU,{apiClient:Me,memori:e,sessionID:vn,visible:xt,closeDrawer:()=>wt(!1)}),Ct&&!!Cr&&(0,s.jsx)(_U,{apiUrl:Me.constants.BACKEND_URL,baseUrl:M,tenant:L,experts:Cr,open:Ct,onClose:()=>At(!1)}),Je&&(null==L?void 0:L.id)&&(0,s.jsx)(AU,{tenant:L,apiClient:Me,open:!!Je,user:We,loginToken:He,onClose:()=>Ke(!1),onLogin:(e,t)=>{qe(e),Ve(t),UU=t,Ke(!1),BB("loginToken",t)},onLogout:()=>{He&&Me.backend.userLogout(He).then((()=>{Ke(!1),qe(void 0),Ve(void 0),UU=void 0,zB("loginToken")}))}})]})};const VU={id:"aisuru.com",theme:"aisuru",config:{name:"Memori",showNewUser:!1,requirePosition:!1}},WU=async(e,t)=>{const n=t?new URL(`${t.startsWith("http")?"":t.includes("localhost")?"http://":"https://"}${t}`).origin:"https://aisuru.com";try{const t=await fetch(`${n}/api/tenant/${e}`),{tenant:r}=await t.json();return r||{...VU,tenantID:e}}catch(t){return{...VU,tenantID:e}}};function qU(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function JU(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ak(r.key),r)}}function KU(e,t,n){return t&&JU(e.prototype,t),n&&JU(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function YU(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $U(e,t){return $U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},$U(e,t)}function XU(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$U(e,t)}function QU(e,t){if(t&&("object"===wk(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return YU(e)}function ZU(e){return ZU=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ZU(e)}function ej(e){if(Array.isArray(e))return e}function tj(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function nj(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function rj(e,t){if(e){if("string"==typeof e)return nj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nj(e,t):void 0}}function ij(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function oj(e){return ej(e)||tj(e)||rj(e)||ij()}function sj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function aj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sj(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sj(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var lj={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},cj=new(function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};qU(this,e),this.init(t,n)}return KU(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||lj,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,r){return r&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,aj(aj({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}()),uj=function(){function e(){qU(this,e),this.observers={}}return KU(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){var i=[].concat(this.observers[e]);i.forEach((function(e){e.apply(void 0,n)}))}if(this.observers["*"]){var o=[].concat(this.observers["*"]);o.forEach((function(t){t.apply(t,[e].concat(n))}))}}}]),e}();function dj(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function hj(e){return null==e?"":""+e}function pj(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e])}))}function mj(e,t,n){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var s=r(o.shift());!e[s]&&n&&(e[s]=new n),e=Object.prototype.hasOwnProperty.call(e,s)?e[s]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function fj(e,t,n){var r=mj(e,t,Object);r.obj[r.k]=n}function gj(e,t){var n=mj(e,t),r=n.obj,i=n.k;if(r)return r[i]}function vj(e,t,n){var r=gj(e,n);return void 0!==r?r:gj(t,n)}function yj(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):yj(e[r],t[r],n):e[r]=t[r]);return e}function Sj(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var _j={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function bj(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return _j[e]})):e}var xj="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,wj=[" ",",","?","!",";"];function Cj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Aj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cj(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cj(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ej(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ZU(e);if(t){var i=ZU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return QU(this,n)}}function Tj(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;o<r.length;++o){if(!i)return;if("string"==typeof i[r[o]]&&o+1<r.length)return;if(void 0===i[r[o]]){for(var s=2,a=r.slice(o,o+s).join(n),l=i[a];void 0===l&&r.length>o+s;)s++,l=i[a=r.slice(o,o+s).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(a)){if("string"==typeof l)return l;if(a&&"string"==typeof l[a])return l[a]}var c=r.slice(o+s).join(n);return c?Tj(l,c,n):void 0}i=i[r[o]]}return i}}var Ij=function(e){XU(n,e);var t=Ej(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return qU(this,n),r=t.call(this),xj&&uj.call(YU(r)),r.data=e||{},r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),void 0===r.options.ignoreJSONStructure&&(r.options.ignoreJSONStructure=!0),r}return KU(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,s=[e,t];n&&"string"!=typeof n&&(s=s.concat(n)),n&&"string"==typeof n&&(s=s.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(s=e.split("."));var a=gj(this.data,s);return a||!o||"string"!=typeof n?a:Tj(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var s=[e,t];n&&(s=s.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(s=e.split("."))[1]),this.addNamespaces(t),fj(this.data,s,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},s=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(s=e.split("."))[1]),this.addNamespaces(t);var a=gj(this.data,s)||{};r?yj(a,n,i):a=Aj(Aj({},a),n),fj(this.data,s,a),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?Aj(Aj({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(uj),Mj={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))})),t}};function Rj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Pj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rj(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rj(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nj(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ZU(e);if(t){var i=ZU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return QU(this,n)}}var Oj={},Dj=function(e){XU(n,e);var t=Nj(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return qU(this,n),r=t.call(this),xj&&uj.call(YU(r)),pj(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,YU(r)),r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=cj.create("translator"),r}return KU(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,s=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=wj.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===r.length)return!0;var i=new RegExp("(".concat(r.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),o=!i.test(e);if(!o){var s=e.indexOf(n);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o}(e,n,r));if(o&&!s){var a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:i};var l=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(l[0])>-1)&&(i=l.shift()),e=l.join(r)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,r){var i=this;if("object"!==wk(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,s=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],t),l=a.key,c=a.namespaces,u=c[c.length-1],d=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(h){var p=t.nsSeparator||this.options.nsSeparator;return o?(m.res="".concat(u).concat(p).concat(l),m):"".concat(u).concat(p).concat(l)}return o?(m.res=l,m):l}var m=this.resolve(e,t),f=m&&m.res,g=m&&m.usedKey||l,v=m&&m.exactUsedKey||l,y=Object.prototype.toString.apply(f),S=["[object Number]","[object Function]","[object RegExp]"],_=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,x="string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f;if(b&&f&&x&&S.indexOf(y)<0&&("string"!=typeof _||"[object Array]"!==y)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var w=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,f,Pj(Pj({},t),{},{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return o?(m.res=w,m):w}if(s){var C="[object Array]"===y,A=C?[]:{},E=C?v:g;for(var T in f)if(Object.prototype.hasOwnProperty.call(f,T)){var I="".concat(E).concat(s).concat(T);A[T]=this.translate(I,Pj(Pj({},t),{joinArrays:!1,ns:c})),A[T]===I&&(A[T]=f[T])}f=A}}else if(b&&"string"==typeof _&&"[object Array]"===y)(f=f.join(_))&&(f=this.extendTranslation(f,e,t,r));else{var M=!1,R=!1,P=void 0!==t.count&&"string"!=typeof t.count,N=n.hasDefaultValue(t),O=P?this.pluralResolver.getSuffix(d,t.count,t):"",D=t["defaultValue".concat(O)]||t.defaultValue;!this.isValidLookup(f)&&N&&(M=!0,f=D),this.isValidLookup(f)||(R=!0,f=l);var k=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,L=k&&R?void 0:f,B=N&&D!==f&&this.options.updateMissing;if(R||M||B){if(this.logger.log(B?"updateKey":"missingKey",d,u,l,B?D:f),s){var z=this.resolve(l,Pj(Pj({},t),{},{keySeparator:!1}));z&&z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var F=[],U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&U&&U[0])for(var j=0;j<U.length;j++)F.push(U[j]);else"all"===this.options.saveMissingTo?F=this.languageUtils.toResolveHierarchy(t.lng||this.language):F.push(t.lng||this.language);var G=function(e,n,r){var o=N&&r!==f?r:L;i.options.missingKeyHandler?i.options.missingKeyHandler(e,u,n,o,B,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,u,n,o,B,t),i.emit("missingKey",e,u,n,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?F.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(n){G([e],l+n,t["defaultValue".concat(n)]||D)}))})):G(F,l,D))}f=this.extendTranslation(f,e,t,m,r),R&&f===l&&this.options.appendNamespaceToMissingKey&&(f="".concat(u,":").concat(l)),(R||M)&&this.options.parseMissingKeyHandler&&(f="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(u,":").concat(l):l,M?f:void 0):this.options.parseMissingKeyHandler(f))}return o?(m.res=f,m):f}},{key:"extendTranslation",value:function(e,t,n,r,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,Pj(Pj({},this.options.interpolation.defaultVariables),n),r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(Pj(Pj({},n),{interpolation:Pj(Pj({},this.options.interpolation),n.interpolation)}));var s,a="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){var l=e.match(this.interpolator.nestingRegexp);s=l&&l.length}var c=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(c=Pj(Pj({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,n.lng||this.language,n),a){var u=e.match(this.interpolator.nestingRegexp);s<(u&&u.length)&&(n.nest=!1)}!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return i&&i[0]===r[0]&&!n.context?(o.logger.warn("It seems you are nesting recursively key: ".concat(r[0]," in key: ").concat(t[0])),null):o.translate.apply(o,r.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var d=n.postProcess||this.options.postProcess,h="string"==typeof d?[d]:d;return null!=e&&h&&h.length&&!1!==n.applyPostProcessor&&(e=Mj.handle(h,e,t,this.options&&this.options.postProcessPassResolved?Pj({i18nResolved:r},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,r,i,o,s=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!s.isValidLookup(t)){var l=s.extractFromKey(e,a),c=l.key;n=c;var u=l.namespaces;s.options.fallbackNS&&(u=u.concat(s.options.fallbackNS));var d=void 0!==a.count&&"string"!=typeof a.count,h=d&&!a.ordinal&&0===a.count&&s.pluralResolver.shouldUseIntlApi(),p=void 0!==a.context&&("string"==typeof a.context||"number"==typeof a.context)&&""!==a.context,m=a.lngs?a.lngs:s.languageUtils.toResolveHierarchy(a.lng||s.language,a.fallbackLng);u.forEach((function(e){s.isValidLookup(t)||(o=e,!Oj["".concat(m[0],"-").concat(e)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(o)&&(Oj["".concat(m[0],"-").concat(e)]=!0,s.logger.warn('key "'.concat(n,'" for languages "').concat(m.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach((function(n){if(!s.isValidLookup(t)){i=n;var o,l=[c];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(l,c,n,e,a);else{var u;d&&(u=s.pluralResolver.getSuffix(n,a.count,a));var m="".concat(s.options.pluralSeparator,"zero");if(d&&(l.push(c+u),h&&l.push(c+m)),p){var f="".concat(c).concat(s.options.contextSeparator).concat(a.context);l.push(f),d&&(l.push(f+u),h&&l.push(f+m))}}for(;o=l.pop();)s.isValidLookup(t)||(r=o,t=s.getResource(n,e,o,a))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}]),n}(uj);function kj(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Lj=function(){function e(t){qU(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=cj.create("languageUtils")}return KU(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=kj(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=kj(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=kj(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),r.forEach((function(e){i.indexOf(e)<0&&o(n.formatLanguageCode(e))})),i}}]),e}(),Bj=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],zj={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},Fj=["v1","v2","v3"],Uj={zero:0,one:1,two:2,few:3,many:4,other:5};function jj(){var e={};return Bj.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:zj[t.fc]}}))})),e}var Gj=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};qU(this,e),this.languageUtils=t,this.options=n,this.logger=cj.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=jj()}return KU(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((function(e,t){return Uj[e]-Uj[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):r.numbers.map((function(r){return t.getSuffix(e,r,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var o=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!Fj.includes(this.options.compatibilityJSON)}}]),e}();function Hj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Vj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hj(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hj(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Wj=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};qU(this,e),this.logger=cj.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return KU(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:bj,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Sj(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Sj(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?Sj(t.nestingPrefix):t.nestingPrefixEscaped||Sj("$t("),this.nestingSuffix=t.nestingSuffix?Sj(t.nestingSuffix):t.nestingSuffixEscaped||Sj(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,s,a=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(e.indexOf(a.formatSeparator)<0){var i=vj(t,l,e);return a.alwaysFormat?a.format(i,void 0,n,Vj(Vj(Vj({},r),t),{},{interpolationkey:e})):i}var o=e.split(a.formatSeparator),s=o.shift().trim(),c=o.join(a.formatSeparator).trim();return a.format(vj(t,l,s),c,n,Vj(Vj(Vj({},r),t),{},{interpolationkey:s}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,h=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return a.escapeValue?c(a.escape(e)):c(e)}}].forEach((function(t){for(s=0;i=t.regex.exec(e);){var n=i[1].trim();if(void 0===(o=u(n)))if("function"==typeof d){var l=d(e,i,r);o="string"==typeof l?l:""}else if(r&&r.hasOwnProperty(n))o="";else{if(h){o=i[0];continue}a.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}else"string"==typeof o||a.useRawValueToEscape||(o=hj(o));var c=t.safeValue(o);if(e=e.replace(i[0],c),h?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++s>=a.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=Vj({},o);function a(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),i="{".concat(r[1]);e=r[0];var o=(i=this.interpolate(i,s)).match(/'/g),a=i.match(/"/g);(o&&o.length%2==0&&!a||a.length%2!=0)&&(i=i.replace(/'/g,'"'));try{s=JSON.parse(i),t&&(s=Vj(Vj({},t),s))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(i)}return delete s.defaultValue,e}for(s.applyPostProcessor=!1,delete s.defaultValue;n=this.nestingRegexp.exec(e);){var l=[],c=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var u=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=u.shift(),l=u,c=!0}if((r=t(a.call(this,n[1].trim(),s),s))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=hj(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),c&&(r=l.reduce((function(e,t){return i.format(e,t,o.lng,Vj(Vj({},o),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function qj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Jj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qj(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qj(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Kj(e){var t={};return function(n,r,i){var o=r+JSON.stringify(i),s=t[o];return s||(s=e(r,i),t[o]=s),s(n)}}var Yj=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};qU(this,e),this.logger=cj.create("formatter"),this.options=t,this.formats={number:Kj((function(e,t){var n=new Intl.NumberFormat(e,t);return function(e){return n.format(e)}})),currency:Kj((function(e,t){var n=new Intl.NumberFormat(e,Jj(Jj({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:Kj((function(e,t){var n=new Intl.DateTimeFormat(e,Jj({},t));return function(e){return n.format(e)}})),relativetime:Kj((function(e,t){var n=new Intl.RelativeTimeFormat(e,Jj({},t));return function(e){return n.format(e,t.range||"day")}})),list:Kj((function(e,t){var n=new Intl.ListFormat(e,Jj({},t));return function(e){return n.format(e)}}))},this.init(t)}return KU(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=t.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=Kj(t)}},{key:"format",value:function(e,t,n,r){var i=this,o=t.split(this.formatSeparator).reduce((function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);"currency"===t&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=oj(e.split(":")),r=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[r.trim()]||(n[r.trim()]=i),"false"===i&&(n[r.trim()]=!1),"true"===i&&(n[r.trim()]=!0),isNaN(i)||(n[r.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:n}}(t),s=o.formatName,a=o.formatOptions;if(i.formats[s]){var l=e;try{var c=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},u=c.locale||c.lng||r.locale||r.lng||n;l=i.formats[s](e,u,Jj(Jj(Jj({},a),r),c))}catch(e){i.logger.warn(e)}return l}return i.logger.warn("there was no format function for ".concat(s)),e}),e);return o}}]),e}();function $j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$j(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Qj(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ZU(e);if(t){var i=ZU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return QU(this,n)}}var Zj=function(e){XU(n,e);var t=Qj(n);function n(e,r,i){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return qU(this,n),o=t.call(this),xj&&uj.call(YU(o)),o.backend=e,o.store=r,o.services=i,o.languageUtils=i.languageUtils,o.options=s,o.logger=cj.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=s.maxParallelReads||10,o.readingCalls=0,o.maxRetries=s.maxRetries>=0?s.maxRetries:5,o.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,s.backend,s),o}return KU(n,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},s={},a={},l={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var a="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[a]=2:i.state[a]<0||(1===i.state[a]?void 0===s[a]&&(s[a]=!0):(i.state[a]=1,r=!1,void 0===s[a]&&(s[a]=!0),void 0===o[a]&&(o[a]=!0),void 0===l[t]&&(l[t]=!0)))})),r||(a[e]=!0)})),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var s={};this.queue.forEach((function(n){var r,a,l,c,u,d;r=n.loaded,a=o,c=mj(r,[i],Object),u=c.obj,d=c.k,u[d]=u[d]||[],l&&(u[d]=u[d].concat(a)),l||u[d].push(a),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){s[e]||(s[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===s[e][t]&&(s[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",s),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;return e.length?this.readingCalls>=this.maxParallelReads?void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:i,wait:o,callback:s}):(this.readingCalls++,this.backend[n](e,t,(function(a,l){if(r.readingCalls--,r.waitingReads.length>0){var c=r.waitingReads.shift();r.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}a&&l&&i<r.maxRetries?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,s)}),o):s(a,l)}))):s(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(function(r,s){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&s&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),s),t.loaded(e,r,s)}))}},{key:"saveMissing",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,r,null,Xj(Xj({},o),{},{isUpdate:i})),e&&e[0]&&this.store.addResource(e[0],t,n,r))}}]),n}(uj);function eG(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===wk(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===wk(e[2])||"object"===wk(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function tG(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function nG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function rG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nG(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nG(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function iG(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ZU(e);if(t){var i=ZU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return QU(this,n)}}function oG(){}function sG(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var aG=function(e){XU(n,e);var t=iG(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(qU(this,n),e=t.call(this),xj&&uj.call(YU(e)),e.options=tG(r),e.services={},e.logger=cj,e.modules={external:[]},sG(YU(e)),i&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,i),QU(e,YU(e));setTimeout((function(){e.init(r,i)}),0)}return e}return KU(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var r=eG();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=rG(rG(rG({},r),this.options),tG(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=rG(rG({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var o;this.modules.logger?cj.init(i(this.modules.logger),this.options):cj.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=Yj);var s=new Lj(this.options);this.store=new Ij(this.options.resources,this.options);var a=this.services;a.logger=cj,a.resourceStore=this.store,a.languageUtils=s,a.pluralResolver=new Gj(s,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(a.formatter=i(o),a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new Wj(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new Zj(i(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.languageDetector&&(a.languageDetector=i(this.modules.languageDetector),a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=i(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new Dj(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=oG),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var c=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];c.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}));var u=["addResource","addResources","addResourceBundle","removeResourceBundle"];u.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var d=dj(),h=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),d.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),d}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oG,r=n,i="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return r();var o=[],s=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){o.indexOf(e)<0&&o.push(e)}))};if(i)s(i);else{var a=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);a.forEach((function(e){return s(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return s(e)})),this.services.backendConnector.load(o,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),r(e)}))}else r(null)}},{key:"reloadResources",value:function(e,t,n){var r=dj();return e||(e=this.languages),t||(t=this.options.ns),n||(n=oG),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Mj.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=dj();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(o){e||o||!n.services.languageDetector||(o=[]);var s="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);s&&(n.language||i(s),n.translator.language||n.translator.changeLanguage(s),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(s)),n.loadResources(s,(function(e){!function(e,o){o?(i(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,s)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,i=function e(t,i){var o;if("object"!==wk(i)){for(var s=arguments.length,a=new Array(s>2?s-2:0),l=2;l<s;l++)a[l-2]=arguments[l];o=r.options.overloadTranslationOptionHandler([t,i].concat(a))}else o=rG({},i);o.lng=o.lng||e.lng,o.lngs=o.lngs||e.lngs,o.ns=o.ns||e.ns,o.keyPrefix=o.keyPrefix||n||e.keyPrefix;var c=r.options.keySeparator||".",u=o.keyPrefix?"".concat(o.keyPrefix).concat(c).concat(t):t;return r.t(u,o)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=n,i}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var s=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var a=n.precheck(this,s);if(void 0!==a)return a}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!s(r,e)||i&&!s(o,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=dj();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=dj();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter((function(e){return r.indexOf(e)<0}));return i.length?(this.options.preload=r.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oG,i=rG(rG(rG({},this.options),t),{isClone:!0}),o=new n(i);void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t));var s=["store","services","language"];return s.forEach((function(t){o[t]=e[t]})),o.services=rG({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new Dj(o.services,o.options),o.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit.apply(o,[e].concat(n))})),o.init(i,r),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(uj);Ek(aG,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new aG(e,t)}));var lG=aG.createInstance();lG.createInstance=aG.createInstance;var cG,uG=lG.createInstance;lG.init,lG.loadResources,lG.reloadResources,lG.use,lG.changeLanguage,lG.getFixedT,lG.t,lG.exists,lG.setDefaultNamespace,lG.hasLoadedNamespace,lG.loadNamespaces,lG.loadLanguages;cG=JSON.parse('{"yes":"Si","no":"No","confirm":"Conferma","apply":"Applica","cancel":"Annulla","show":"Mostra","hide":"Nascondi","send":"Invia","close":"Chiudi","edit":"Modifica","delete":"Elimina","loading":"Caricamento","expand":"Espandi","collapse":"Riduci","fullscreenEnter":"Passa a schermo intero","fullscreenExit":"Esci da schermo intero","center":"Centro","bottom":"In basso","hidden":"Nascosto","day":"Giorno","month":"Mese","year":"Anno","createdAt":"Data creazione","selected":"Selezionati","page":"pagina","actions":"Azioni","next":"Successivo","previous":"Precedente","copy":"Copia","copyRawCode":"Copia codice sorgente","copyToClipboard":"Copia negli appunti","showOriginalText":"Mostra originale","showTranslatedText":"Mostra traduzione","exactPosition":"Posizione esatta","uncertain":"Incertezza","question":"Domanda","nothingFound":"Nessun risultato","venue":"Luogo","searchVenue":"Cerca luogo...","memoriBlockedTitle":"Bloccato","memoriBlockedUntil":"Agente bloccato fino al {{date}}","memoriBlockedAnon":"Attualmente \\"{{name}}\\" non può rispondere, torna qui il {{date}}","memoriBlockedReasonExceedChats":"perchè ha superato la soglia mensile di chat ammesse.","memoriBlockedGiverHelper":"Puoi sempre gestirlo in qualità di amministratore, ma altri utenti non potranno interrogarlo.","generatedByAI":"Risposta generata da IA, può talvolta generare informazioni non corrette","whyThisAnswer":"Perché questa risposta?","whyThisAnswerHelper":"Questa risposta è stata generata automaticamente da un\'intelligenza artificiale sulla base di questi contenuti verificati.","completionsEnabled":"IA evoluta, può rispondere con risposte generate automaticamente che talvolta potrebbero contenere informazioni non corrette","completionProviderDown":"Questo agente è integrato con una IA generativa di {{provider}}, ma al momento non è disponibile. Riprova più tardi.","completionProviderFallbackName":"un provider esterno","completionProviderCheckStatusPage":"Vedi pagina di stato","boardOfExperts":"Gruppo di esperti","birthDate":"Data di nascita","birthDateHelper":"Ti chiediamo la data di nascita esclusivamente per abilitare o disabilitare le funzionalità che hanno restrizioni in base all\'età","underage":"Devi avere almeno {{age}} anni per registrarti.","underageTwinSession":"Devi avere almeno {{age}} anni per interagire con questo agente.","errorFetchingSession":"Errore durante il caricamento della sessione","errorGettingReferralURL":"Errore durante il caricamento del riferimento","errorReopeningSession":"Errore durante il riapertura della sessione","ageVerification":"Verifica dell\'età","ageVerificationText":"Per interagire con questo agente, devi aver almeno {{minAge}} anni.","nsfw":"NSFW: Questo agente contiene contenuti per adulti","deepThought":"Pensiero profondo","deepThoughtHelper":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme.","deepThoughtDisclaimerTitle":"Pensiero profondo abilitato","deepThoughtDisclaimer":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme.","deepThoughtPreDisclaimerUnlogged":"Accedi per abilitare Pensiero Profondo.","deepThoughtPreDisclaimerNotAllowed":"Pensiero Profondo è disabilitato poiché non hai acconsentito al suo utilizzo, puoi cambiare la tua scelta in qualsiasi momento nelle impostazioni del tuo account.","notEnoughCredits":"L\'autore di questo agente non ha abbastanza crediti per rispondere alla tua domanda.","knownFacts":{"title":"Fatti noti","description":"Dettagli delle informazioni condivise tra te e {{memoriName}}","type":"Tipo","typeShortTerm":"Breve termine","typeLongTerm":"Lungo termine","typeHelper":"Tipi:\\n- Breve termine: questo fatto noto è sempre utilizzato durante le conversazioni\\n- Lungo termine: questo fatto noto è utilizzato durante le conversazioni solo se rilevante per la domanda corrente","text":"Testo","deleteSuccess":"Fatto noto eliminato","deleteConfirmTitle":"Elimina il fatto noto","deleteConfirmMessage":"Confermi di voler eliminare questo fatto noto?","deleteSelectedConfirmTitle":"Elimina i fatti noti selezionati","deleteSelectedConfirmMessage":"Confermi di voler eliminare i fatti noti selezionati?"},"auth":{"title":"Autenticazione","useRecoveryTokens":"Utilizza i token di recupero","tokens":"Token","addToken":"Aggiungi token","usePassword":"Utilizza la password","atLeast":"Almeno"},"widget":{"instruct":"Istruisci","test":"Prova","sound":"Audio","position":"Preferenze posizione","settings":"Impostazioni","share":"Condividi","sendOnKeypress":"Premi Invio per inviare","sendOnClick":"Clicca sul bottone di invio","boardOfExperts":"Gruppo di esperti","showExpertsInTheBoard":"Mostra gli esperti di questo gruppo","expertsInTheBoard":"Esperti di questo gruppo","goToIntegrationsToCustomizeAvatar":"Per personalizzare l\'avatar, vai a Condividimi e configura la pagina pubblica"},"write_and_speak":{"micButtonPopover":"Premi il pulsante per parlare","micButtonPopoverListening":"Premi il pulsante per smettere di parlare","pageInstructExplanation":"Per insegnarmi nuove cose clicca sul pulsante ISTRUISCIMI per cominciare","pageTryMeExplanation":"Per parlare con me clicca sul pulsante INIZIAMO per cominciare","instructButton":"ISTRUISCIMI","tryMeButton":"INIZIAMO","resumeButton":"RIPRENDI","chatHistory":"Cronologia chat","exportChatHistory":"Esporta la cronologia chat","exportChatHistoryMessage":"Vuoi esportare la cronologia chat?","chatBotButtonText":"CLICCA QUI PER APRIRE LA CHAT","conversationStartedLabel":"Conversazione avvenuta il","settingsHeaderLabel":"Configura qui se vuoi impostare una conversazione continua. Setta i secondi di silenzio prima dell\'invio.","continuousSpeechLabel":"Conversazione continua","continuousSpeechDisabled":"Conversazione continua disabilitata poichè l\'agente è in modalità muta","holdToSpeak":"Tieni premuto per parlare","releaseToEndListening":"Rilascia per smettere di parlare","pressAndHoldToSpeak":"Premi e tieni premuto per parlare","microphoneMode":"Modalità microfono","hideEmissionsLabel":"Nascondi testo emesso dall\'agente","secondsLabel":"Secondi","controlsPosition":"Posizione dei controlli","avatarControls":"Controlli Avatar","height":"Altezza","depth":"Profondità","avatarType":"Tipo Avatar","blob":"Blob","avatar3d":"Avatar 3D","zoomed":"Vicino","normal":"Normale","far":"Lontano","suggestions":"Usa le frecce per regolare l\'altezza dell\'avatar\\nUsa +/- per regolare la profondità dell\'avatar","enablePositionControls":"Abilita controlli posizione","tryMeHeaderLabel":"PROVA","unknownPosition":"Posizione sconosciuta","fieldPlace":"Indica la posizione (es \'Milano\')","showMapLinkFor":"Visualizza sulla mappa la posizione","useMyPosition":"Usa la mia posizione","myPosition":"Posizione corrente","updatingPosition":"Aggiorno la posizione...","placeNotFound":"Luogo sconosciuto!","requirePositionHelp":"Per parlare con {{name}} devi decidere se fornire o meno la tua posizione. Questo perchè diverse risposte che potrà fornirti potrebbero dipendere da dove ti trovi.","dontWantToProvidePosition":"Non voglio fornire la mia posizione","attachmentsLabel":"Arricchisci il tuo messaggio","iWantToTalkToIn":"Voglio parlare con {{name}} in"},"media":{"title":"Titolo","editAttributes":"Modifica attributi media","uploadMimeTypeNotAllowed":"Il tipo di file non è permesso","uploadSizeLimitMessage":"Il file caricato è troppo grande (max {{size}}MB)","uploadWrongResolutionMessage":"La risoluzione deve essere {{width}}x{{height}} pixel","memoriNameAlreadyUsed":"Hai già un Agente con questo nome","uploadHelperImages":"Caricare un file con estensione png, jpg, jpeg o gif e con dimensione massima di {{size}}MB","uploadHelper":"Caricare un file di dimensione massima di {{size}}MB","uploadError":"Errore nel caricamento","square":"quadrato","scaleRatio":"Proporzioni","addMediaLabel":"Aggiungi media","insertThisMediaMsg":"Inserisci questi media","mediaUploadMessage":"Clicca per caricare un nuovo media","addLinkLabel":"Aggiungi un link","linkKey":"URL","linkValue":"Titolo link","insertThisLink":"Inserisci un link a {{url}} con titolo {{title}}"},"gamification":{"level":"Livello","points":"punti","memoriReachedLevel":"è diventato più evoluto ed ha raggiunto il livello","levelGoToStatistics":"{{memori}} è al livello {{level}} con {{points}} punti. Clicca per andare alle statistiche.","congratulationsNewLevel":"Congratulazioni, hai raggiunto un nuovo livello!","congratulationsNewLevelDescription":"Il tuo agente è diventato più evoluto con {{points}} punti, guarda le","statistics":"statistiche"},"login":{"login":"Accedi","logout":"Esci","user":"Utente","loggedDrawerTitle":"Ciao, {{name}}!","loginDrawerTitle":"Accedi","signupDrawerTitle":"Registrati","newUserSignUp":"Sei un nuovo utente?","signUp":"Registrati!","alreadyHaveAnAccount":"Hai già un account?","backToLogin":"Torna al login","registrationDisabled":"La registrazione è disabilitata.","contactAdmin":"Contatta l\'amministratore per richiedere l\'accesso","userNameOrEmail":"Nome utente o email","email":"Email","emailFormatError":"Per favore, inserisci una mail valida","username":"Nome utente","usernameContainsReservedWord":"Il nome utente contiene una parola riservata, per favore cambia il nome utente","usernameFormatError":"Il nome utente deve essere lungo almeno 3 caratteri e può contenere solo lettere, numeri e _","otpCode":"Codice di verifica","resendVerificationCode":"Invia di nuovo","resentVerificationCode":"Codice di verifica inviato! Controlla la tua mail.","password":"Password","newPassword":"Nuova password","confirmPassword":"Conferma la password","currentPassword":"Password attuale","passwordMatchingError":"Le password non coincidono.","passwordFormatError":"La password deve essere lunga almeno 8 caratteri e contenere almeno un numero, una lettera maiuscola, una minuscola e un simbolo","pwdWeak":"Debole","pwdAcceptable":"Accettabile","pwdStrong":"Forte","mustChangePassword":"Devi cambiare la password","passwordChange":"Cambio password","emailChange":"Cambio email","avatarChange":"Cambio avatar","underage":"Devi avere almeno {{age}} anni per registrarti.","optional":"opzionale","birthDate":"Data di nascita","birthDateHelper":"Ti chiediamo la data di nascita esclusivamente per abilitare o disabilitare le funzionalità che hanno restrizioni in base all\'età","missingData":"Informazioni mancanti","missingDataHelper":"Sappiamo che questo è un po\' fastidioso, ma abbiamo bisogno di alcune informazioni in più per completare la tua registrazione.","goToAccountToChangeYourPreferences":"Puoi cambiare la tua scelta in qualsiasi momento dalla tua pagina Account.","deepThoughtExplaination":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme. Consenti all\'autore dell\'agente di contattarti per offerte commerciali riguardanti prodotti su cui hai espresso interesse.","tnCAndPPAcceptedHelper":"Dall\'ultimo accesso, i T&C e l\'Informativa sulla privacy sono stati modificati. Si prega di accettarle, altrimenti non sarà possibile apportare modifiche ai propri gemelli. Puoi sempre cancellare il tuo account nella pagina del tuo profilo utente.","privacyLabel":"Ho letto e accettato l\'","privacyAndCookiePolicy":"informativa sui cookie e sulla privacy","and":"e","termsOfService":"i termini del servizio","pAndCUAccepted":"Accetto le condizioni di utilizzo relative a Pensiero Profondo","editAccount":"Modifica account","save":"Salva"},"success":"Operazione andata a buon fine","Error":"Errore","internal server error":"Ops, scusa... qualcosa è andato storto nel server","error":"Errore","error.loading":"Errore durante il caricamento dei contenuti.","error.notFound":"Ops, non abbiamo trovato ciò che cercavi.","error.generic":"Ops, qualcosa è andato storto.","error.serverNotResponding":"Stiamo facendo manutenzione o rilasciando aggiornamenti. Riprova più tardi.","error.unprocessableEntity":"Errore durante il salvataggio dei dati. Ricontrolla i dati inseriti.","error.goBackTo":"Prova a tornare alla","error.reloadPage":"Ricarica la pagina","error.tryAgain":"Riprova","error.unauthorized":"Non sei autorizzato a visualizzare questo contenuto.","errors":{"TENANT_NOT_FOUND":"Tenant non trovato","TENANT_REGISTRATION_DISABLED":"La registrazione su questa piattaforma è disabilitata","TENANT_MISSING_NAME":"Tenant: nome mancante","TENANT_MAX_USERS_REACHED":"Numero massimo di utenti raggiunto","TENANT_MAX_ADMINS_REACHED":"Numero massimo di utenti amministratori raggiunto","TENANT_ALREADY_EXISTS":"Tenant già esistente","TENANT_MISSING_DESCRIPTION":"Tenant: descrizione mancante","TENANT_CANT_SET_COMPLETION_PROVIDER":"Tenant: non abilitato a gestire il provider di completamento","USER_NOT_CONFIRMED":"Utente ancora non confermato","USER_NOT_FOUND":"Utente non trovato","USER_OR_PASSWORD_INVALID":"Utente o password non validi","USER_MUST_CHANGE_PASSWORD":"Devi cambiare la password","USER_MUST_ENTER_VERIFICATION_CODE":"Devi inserire il codice di verifica","USER_MISSING_TENANT":"Utente: tenant mancante","USER_MISSING_NAME":"Utente: nome mancante","USER_MISSING_PASSWORD":"Utente: password mancante","USER_MISSING_EMAIL":"Utente: email mancante","USER_MISSING_VERIFICATION_CODE":"Utente: codice di verifica mancante","USER_NAME_ALREADY_USED":"Nome utente già in uso","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"La password non rispetta le regole di sicurezza","USER_EMAIL_ALREADY_USED":"Email già in uso","USER_EMAIL_INVALID":"Email non valida","USER_VERIFICATION_CODE_INVALID":"Codice di verifica non valido","USER_MISSING_NAME_OR_EMAIL":"Nome utente o email mancante","USER_NAME_INVALID":"Nome utente non valido","USER_HAS_ONE_OR_MORE_MEMORI":"L\'utente ha uno o più Agenti","USER_MISSING_NEW_PASSWORD":"Utente: nuova password mancante","USER_NOTHING_TO_DO":"Niente da fare","USER_CANT_CREATE_MEMORI":"Utente non abilitato a creare Agenti","USER_MAX_MEMORI_REACHED":"Massimo numero di Agenti raggiunto","USER_TOO_MANY_ATTEMPTS":"Troppi tentativi","USER_MUST_ACCEPT_TNC_AND_PP":"Devi accettare i termini e le condizioni","USER_BIRTH_DATE_CANT_BE_CHANGED":"Data di nascita non può essere cambiata","USER_CANT_SET_COMPLETION_PROVIDER":"Utente: non abilitato a gestire il provider di completamento","USER_CANT_ENABLE_DEEP_THOUGHT":"Utente: non abilitato a gestire Pensiero Profondo","USER_CANT_ENABLE_DCM_INTEGRATION":"Utente: non abilitato a gestire l\'integrazione con DCM","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"Utente: non abilitato a gestire la concatenazione o il gruppo di esperti","USER_CREATION_BILLING_DENIED_PERMISSION":"Non hai crediti sufficienti per creare un agente","USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS":"L\'utente ha una o più configurazioni completions","USER_CANT_BE_DELETED":"Utente non può essere cancellato","MEMORI_NOT_FOUND":"Agente non trovato","MEMORI_NOT_ACCESSIBLE":"Agente non accessibile","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Solo il proprietario può cambiare il tag e il pin","SESSION_NOT_FOUND":"Sessione non trovata","SESSION_IS_NOT_ADMINISTRATIVE":"Sessione non amministrativa","SESSION_EXPIRED":"Sessione scaduta","MEMORI_MISSING_CONFIGURATION":"Agente: configurazione mancante","MEMORI_CONFIGURATION_NOT_FOUND":"Agente: configurazione non trovata","MEMORI_INVALID_PRIVACY_TYPE":"Agente: tipo di privacy non valido","MEMORI_MISSING_PASSWORD":"Agente: password mancante","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Agente: numero totale di token di recupero non valido","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Agente: numero minimo di token di recupero non valido","MEMORI_INVALID_VOICE_TYPE":"Agente: tipo di voce non valido","MEMORI_MISSING_NAME":"Agente: nome mancante","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Agente: password o token di recupero mancanti","MEMORI_INVALID_ID":"Agente: ID non valido","MEMORI_NAME_ALREADY_USED":"Nome Agente già in uso","MEMORI_INVALID_PIN":"Agente: PIN non valido","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Agente: cambio TAG e PIN richiedono operazioni separate","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Agente: password non richiesta su agente pubblico","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Pensiero Profondo richiede l\'abilitazione delle completions","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"Il gruppo di esperti richiede l\'abilitazione delle completions","MEMORI_INVALID_COMPLETION_CONFIG":"Agente: configurazione completions non valida","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Trasferimento: utente di destinazione mancante","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Trasferimento: ID utente di destinazione non valido","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Trasferimento: dati utente di destinazione non validi","MEMORI_TRANSFER_NOTHING_TO_DO":"Trasferimento: alcuna operazione da fare","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Agente: la configurazione non può essere modificata","MEMORI_MISSING_NEW_PASSWORD":"Agente: nuova password mancante","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Formato non valido data a partire da","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Formato non valido data fino a","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"Agente: funzionalità richiede un abbonamento","INTEGRATION_NOT_FOUND":"Integrazione non trovata","INTEGRATION_INVALID_TYPE":"Tipo integrazione non valido","INTEGRATION_ALREADY_EXISTS":"Integrazione già esistente","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Agenti non pubblici non possono essere integrati","INTEGRATION_MISSING_INVOCATION_TEXT":"Integrazione: testo di invocazione mancante","INTEGRATION_MISSING_DEVICE_EMAILS":"Integrazione: email del dispositivo mancante","INTEGRATION_MEMORI_IS_EMPTY":"Agenti vuoti non possono essere integrati","INTEGRATION_MISSING_PRIVACY_POLICY":"Integrazione: privacy policy mancante","INTEGRATION_MISSING_CATEGORY":"Categoria integrazione mancante","INTEGRATION_MISSING_DESCRIPTION":"Descrizione integrazione mancante","INTEGRATION_INVALID_INVOCATION_TEXT":"Testo di invocazione non valido","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home non più disponibile","UPLOAD_REQUIRES_MULTIPART_ENCODING":"L\'upload richiede l\'encoding multipart","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: manca il content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: dimensione massima superata","UPLOAD_FILE_IS_EMPTY":"Upload: file vuoto","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: tipo di file o firma non validi","UPLOAD_MISSING_FILE_NAME":"Upload: nome file mancante","UPLOAD_INVALID_MEMORY_ID":"Upload: ID contenuto non valido","UPLOAD_MISSING_FILE_CONTENT":"Upload: contenuto file mancante","ASSET_NOT_FOUND":"Asset non trovato","ASSET_NOT_ACCESSIBLE":"Asset non accessibile","ASSET_MISSING_SESSION_ID":"Asset: ID sessione mancante","ASSET_INVALID_FILE_NAME":"Asset: nome file non valido","INVITATION_NOT_FOUND":"Invito non trovato","INVITATION_NOT_ACCESSIBLE":"Invito non accessibile","INVITATION_ALREADY_ACCEPTED":"Invito già accettato","INVITATION_ALREADY_REJECTED":"Invito già rifiutato","INVITATION_MISSING_DESTINATION_EMAIL":"Invito: email di destinazione mancante","INVITATION_DESTINATION_EMAIL_INVALID":"Invito: email di destinazione non valida","INVITATION_MISSING_TAG":"Invito: tag mancante","INVITATION_MISSING_PIN":"Invito: PIN mancante","INVITATION_INVALID_PIN":"Invito: PIN non valido","INVITATION_INVALID_TYPE":"Invito: tipo non valido","INVITATION_MISSING_DESTINATION_NAME":"Invito: nome destinatario mancante","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invito: tag e pin non possono essere cambiati","INVITATION_CANT_BE_CHANGED":"Invito: non può essere modificato","ACTIONLOG_INVALID_USER_ID":"ID utente non valido","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","ACTIONLOG_INVALID_MEMORI_ID":"ID agente non valido","CONSUMPTIONLOG_INVALID_TYPE":"Tipo di log non valido","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","CONSUMPTIONLOG_INVALID_USER_ID":"ID utente non valido","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Memori ID non valido","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notifiche: Periodo di estrazione chatlog non valido","PROCESS_INVALID_TYPE":"Tipo di processo non valido","PROCESS_ALREADY_RUNNING":"Processo già in esecuzione","PROCESS_NOT_FOUND":"Processo non trovato","IMPORTCSV_MISSING_ROWS":"Importazione CSV: righe mancanti","IMPORTCSV_MISSING_CSV":"Importazione CSV: CSV mancante","IMPORTCSV_MISSING_SEPARATOR":"Importazione CSV: separatore mancante","IMPORTCSV_INVALID_SEPARATOR":"Importazione CSV: separatore non valido","IMPORTCSV_MISSING_HEADERS":"Importazione CSV: intestazioni mancanti","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Importazione CSV: separatore varianti titolo mancante","IMPORTCSV_INVALID_RECEIVER_ID":"Importazione CSV: ID receiver non valido","IMPORTCSV_INVALID_MEDIA_LINK":"Importazione CSV: link media non valido","IMPORTCSV_INVALID_LINK_TITLE_HANDLING":"Importazione CSV: titolo link non valido","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"Importazione CSV: encoding caratteri non rilevabile","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"Importazione CSV: impossibile importare in agenti segreti","IMPORTTXT_MISSING_ROWS":"Importazione TXT: righe mancanti","IMPORTTXT_INVALID_GRANULARITY":"Importazione TXT: granularità non valida","IMPORTTXT_INVALID_RECEIVER_ID":"Importazione TXT: ID receiver non valido","IMPORTTXT_INVALID_MEDIA_LINK":"Importazione TXT: link media non valido","IMPORTTXT_INVALID_LINK_TITLE_HANDLING":"Importazione TXT: titolo link non valido","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"Importazione TXT: encoding caratteri non rilevabile","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"Importazione TXT: impossibile importare in agenti segreti","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Importazione TXT: limite importazione superato","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Importazione TXT: importazione su GPT-4 richiede API key","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Importazione TXT: importazione richiede un piano a pagamento","IMPORTTXT_BILLING_DENIED_PERMISSION":"Importazione TXT: non hai crediti sufficienti per l\'operazione","EXPORTCSV_MISSING_CSV_SPECS":"Esportazione CSV: specifiche CSV mancanti","EXPORTCSV_MISSING_SEPARATOR":"Esportazione CSV: separatore mancante","EXPORTCSV_INVALID_SEPARATOR":"Esportazione CSV: separatore non valido","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Esportazione CSV: separatore varianti titolo mancante","EXPORTCSV_MISSING_NEW_LINE_CHAR":"Esportazione CSV: carattere di nuova riga mancante","EXPORTCSV_INVALID_NEW_LINE_CHAR":"Esportazione CSV: carattere di nuova riga non valido","EXPORTCSV_MISSING_PASSWORD":"Esportazione CSV: password mancante","EXPORTJSONL_MISSING_JSONL_SPECS":"Esportazione JSONL: specifiche JSONL mancanti","EXPORTJSONL_MISSING_PLATFORM":"Esportazione JSONL: piattaforma mancante","EXPORTJSONL_INVALID_PLATFORM":"Esportazione JSONL: piattaforma non valida","EXPORTJSONL_MISSING_PASSWORD":"Esportazione JSONL: password mancante","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"Esportazione JSONL: esportazione richiede un piano a pagamento","ANALYSIS_MISSING_QUERY":"Analisi: query mancante","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analisi: impossibile analizzare agenti segreti","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analisi: corrispondenza query utente richiede Pensiero Profondo","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Assegnazione badge: credenziali errate o mancanti","BADGE_ASSIGNMENT_MISSING_REF_ID":"Assegnazione badge: ID ref mancante","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Assegnazione badge: esito non trovato","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Assegnazione badge: URL di asserzione mancante","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Assegnazione badge: URL badge mancante","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Assegnazione badge: URL issuer mancante","BADGE_ASSIGNMENT_INVALID_URL":"Assegnazione badge: URL non valido","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Assegnazione badge: destinatario mancante","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Assegnazione badge: tipo destinatario sconosciuto","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Assegnazione badge: identità destinatario mancante","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Assegnazione badge: tipo hash destinatario mancante","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Assegnazione badge: tipo hash destinatario sconosciuto","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Assegnazione badge: identità destinatario errata","BADGE_NOT_FOUND":"Badge non trovato","OUTCOME_NO_DCM_CONFIGURED":"Outcome: nessun DCM configurato","OUTCOME_USER_BADGES_DISABLED":"Outcome: badge utente disabilitati","COMPLETION_CONFIG_MISSING_NAME":"Configurazione completions: nome mancante","COMPLETION_CONFIG_MISSING_PROVIDER":"Configurazione completions: provider mancante","COMPLETION_CONFIG_MISSING_ENDPOINT":"Configurazione completions: endpoint mancante","COMPLETION_CONFIG_MISSING_API_KEY":"Configurazione completions: API key mancante","COMPLETION_CONFIG_MISSING_MODEL":"Configurazione completions: modello mancante","COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED":"Configurazione completions: almeno un tipo di completions deve essere specificato","COMPLETION_CONFIG_INVALID_NAME":"Configurazione completions: nome non valido","COMPLETION_CONFIG_INVALID_PURPOSE":"Configurazione completions: tipo di completions non valido","COMPLETION_CONFIG_INVALID_ENDPOINT":"Configurazione completions: endpoint non valido","COMPLETION_CONFIG_INCONSISTENT_ENDPOINT":"Configurazione completions: endpoint incoerente","COMPLETION_CONFIG_INVALID_PROVIDER":"Configurazione completions: provider non valido","COMPLETION_CONFIG_NOT_FOUND":"Configurazione completions: non trovata","COMPLETION_CONFIG_NOT_ACCESSIBLE":"Configurazione completions: non accessibile","COMPLETION_CONFIG_NAME_RESERVED":"Configurazione completions: nome riservato","COMPLETION_CONFIG_NAME_ALREADY_EXISTS":"Configurazione completions: nome già esistente","COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED":"Configurazione completions: cambiamento visibilità non consentito"}}');var dG;dG=JSON.parse('{"yes":"Yes","no":"No","confirm":"Confirm","apply":"Apply","cancel":"Cancel","show":"Show","hide":"Hide","send":"Send","close":"Close","edit":"Edit","delete":"Delete","loading":"Loading","expand":"Expand","collapse":"Collapse","fullscreenEnter":"Enter fullscreen","fullscreenExit":"Exit fullscreen","center":"Center","bottom":"Bottom","hidden":"Hidden","day":"Day","month":"Month","year":"Year","createdAt":"Creation date","selected":"Selected","page":"page","actions":"Actions","next":"Next","previous":"Previous","copy":"Copy","copyRawCode":"Copy raw code","copyToClipboard":"Copy to clipboard","showOriginalText":"Show original","showTranslatedText":"Show translation","exactPosition":"Exact position","uncertain":"Uncertain","question":"Question","nothingFound":"Nothing found","venue":"Venue","searchVenue":"Search venue...","memoriBlockedTitle":"Blocked","memoriBlockedUntil":"Agent blocked until {{date}}","memoriBlockedAnon":"Currently \\"{{name}}\\" can\'t answer, come back here on {{date}}","memoriBlockedReasonExceedChats":"because it has exceeded the monthly threshold of allowed chats.","memoriBlockedGiverHelper":"You can still manage it as administrator, but other users will not be able to interact with it.","generatedByAI":"Answer generated by AI, may occasionally generate incorrect informations","whyThisAnswer":"Why this answer?","whyThisAnswerHelper":"This answer was generated automatically by an artificial intelligence based on these verified contents.","completionsEnabled":"Advanced AI, can respond with automatically generated answers that may sometimes contain incorrect information","completionProviderDown":"This agent is integrated with a generative AI from {{provider}}, but it is currently unavailable. Try again later.","completionProviderFallbackName":"an external provider","completionProviderCheckStatusPage":"Check status page","boardOfExperts":"Board of experts","birthDate":"Birth date","birthDateHelper":"We ask for your birth date only to enable or disable functionalities that have age restrictions","underage":"You must be at least {{age}} years old to sign up.","underageTwinSession":"You must be at least {{age}} years old to interact with this agent.","errorFetchingSession":"Error during session loading","errorGettingReferralURL":"Error during referral loading","errorReopeningSession":"Error during session reopening","ageVerification":"Age verification","ageVerificationText":"To interact with this agent, you must be at least {{minAge}} years old.","nsfw":"NSFW: This agent contains adult contents","deepThought":"Deep Thought","deepThoughtHelper":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together. Allow the agent\'s author to contact you for commercial offers regarding products you have shown interest in.","deepThoughtDisclaimerTitle":"Deep Thought enabled","deepThoughtDisclaimer":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together.","deepThoughtPreDisclaimerUnlogged":"Log in to enable Deep Thought.","deepThoughtPreDisclaimerNotAllowed":"Deep Thought is disabled since you didn\'t consent its usage, you can change this any time in your account settings.","notEnoughCredits":"The author of this agent does not have enough credits to answer your question.","knownFacts":{"title":"Known facts","description":"Details of the information shared between you and {{memoriName}}","type":"Type","typeShortTerm":"Short term","typeLongTerm":"Long term","typeHelper":"Types:\\n- Short Term: this Known Fact is always used during conversations\\n- Long Term: this Known Fact is used during conversations only if relevant to the current question","text":"Text","deleteSuccess":"Known fact deleted","deleteConfirmTitle":"Delete known fact","deleteConfirmMessage":"Are you sure you want to delete this known fact?","deleteSelectedConfirmTitle":"Delete selected known facts","deleteSelectedConfirmMessage":"Are you sure you want to delete the selected known facts?"},"auth":{"title":"Authentication","useRecoveryTokens":"Use recovery tokens","tokens":"Tokens","addToken":"Add token","usePassword":"Use password","atLeast":"At least"},"widget":{"instruct":"Instruct","test":"Test","sound":"Sound","position":"Position preferences","settings":"Settings","share":"Share","sendOnKeypress":"Hit Enter to send","sendOnClick":"Click on Submit","boardOfExperts":"Board of experts","showExpertsInTheBoard":"Show experts in this board","expertsInTheBoard":"Experts in this board","goToIntegrationsToCustomizeAvatar":"To customize the avatar, go to Share and customize the public page"},"write_and_speak":{"micButtonPopover":"Click the button to speak","micButtonPopoverListening":"Click the button to stop speak","pageInstructExplanation":"To teach me new things click on the INSTRUCT ME button to get started","pageTryMeExplanation":"To talk to me click on the START button to get started","instructButton":"INSTRUCT ME","tryMeButton":"START","resumeButton":"RESUME","chatHistory":"Chat history","exportChatHistory":"Export chat history","exportChatHistoryMessage":"Do you want to export chat history?","chatBotButtonText":"CLICK HERE TO OPEN CHATBOT","conversationStartedLabel":"Conversation started on","settingsHeaderLabel":"Setup here if you want to set the continuous speech, and change the silence seconds if you want to customize them.","continuousSpeechLabel":"Continuous speech","continuousSpeechDisabled":"Continuous speech disabled because the agent is in mute mode","holdToSpeak":"Hold to speak","releaseToEndListening":"Release to end listening","pressAndHoldToSpeak":"Press and hold to speak","microphoneMode":"Microphone mode","hideEmissionsLabel":"Hide text emitted by the agent","secondsLabel":"Set seconds","controlsPosition":"Controls position","avatarControls":"Avatar controls","height":"Height","depth":"Depth","avatarType":"Avatar type","suggestions":"Use the arrow keys to adjust the avatar height\\nUse +/- to adjust the avatar depth","blob":"Blob","avatar3d":"3D Avatar","zoomed":"Zoomed","normal":"Normal","far":"Far","enablePositionControls":"Enable position controls","tryMeHeaderLabel":"TRY","unknownPosition":"Unknown position","fieldPlace":"Write the place (eg \'Milano\')","showMapLinkFor":"Show the position on the map","useMyPosition":"Use my position","myPosition":"Your position","updatingPosition":"Updating position...","placeNotFound":"Place not found!","requirePosition":"Insert your position before start","requirePositionHelp":"To talk to {{name}} you have to decide whether to provide your position or not. This is because different answers that it can provide you may depend on where you are.","dontWantToProvidePosition":"I don\'t want to provide my position","attachmentsLabel":"Enrich your message","iWantToTalkToIn":"I want to talk to {{name}} in"},"media":{"title":"Title","editAttributes":"Edit media attributes","uploadMimeTypeNotAllowed":"The file type is not allowed","uploadSizeLimitMessage":"The uploaded size is too big (max {{size}}MB)","uploadWrongResolutionMessage":"The resolution must be {{width}}x{{height}} pixel","memoriNameAlreadyUsed":"You already have an agent with this name","uploadHelperImages":"Upload a file with extension png, jpg, jpeg or gif, and having at maximum a size of {{size}}MB","uploadHelper":"Upload a file having at maximum a size of {{size}}MB","uploadError":"Upload failed","square":"square","scaleRatio":"Scale ratio","addMediaLabel":"Add a media","insertThisMediaMsg":"Insert these media","mediaUploadMessage":"Click to load a new media","addLinkLabel":"Add a link","linkKey":"URL","linkValue":"Link title","insertThisLink":"Insert a link to {{url}} with title {{title}}"},"gamification":{"level":"Level","points":"points","memoriReachedLevel":"became more evolved and reached level","levelGoToStatistics":"{{memori}} is at level {{level}} with {{points}} points. Click to go to statistics.","congratulationsNewLevel":"Congratulations, you have reached a new level!","congratulationsNewLevelDescription":"Your agent became more evolved with {{points}} points, look at the","statistics":"statistics"},"login":{"login":"Login","logout":"Logout","user":"User","loggedDrawerTitle":"Hi, {{name}}!","loginDrawerTitle":"Login","signupDrawerTitle":"Sign up","newUserSignUp":"New user?","signUp":"Sign up!","alreadyHaveAnAccount":"Already have an account?","backToLogin":"Back to login","registrationDisabled":"Registration is disabled","contactAdmin":"Contact the administrator to request access","userNameOrEmail":"Username or email","email":"Email","emailFormatError":"Please, insert a valid email","username":"Username","usernameContainsReservedWord":"Username contains a reserved word, please choose another one","usernameFormatError":"Username must be at least 3 characters long and contain only letters, numbers and _","otpCode":"Verification code","resendVerificationCode":"Resend code","resentVerificationCode":"Confirmation code sent! Please check your email.","password":"Password","newPassword":"New password","confirmPassword":"Confirm Password","currentPassword":"Current password","passwordMatchingError":"Passwords do not match.","passwordFormatError":"Password must be at least 8 characters long and contain at least a number, an upper case letter, a lower case letter and a symbol","pwdWeak":"Weak","pwdAcceptable":"Acceptable","pwdStrong":"Strong","mustChangePassword":"You must change your password","passwordChange":"Change password","emailChange":"Change email","avatarChange":"Change avatar","underage":"You must be at least {{age}} years old to sign up.","optional":"Optional","birthDate":"Birth date","birthDateHelper":"We ask for your birth date only to enable or disable functionalities that have age restrictions","missingData":"Missing informations","missingDataHelper":"We know that this is a bit annoying, but we need some more informations to complete your registration.","goToAccountToChangeYourPreferences":"You can change your choice at any time from your Account page.","deepThoughtExplaination":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together. Allow the agent\'s author to contact you for commercial offers regarding products you have shown interest in.","tnCAndPPAcceptedHelper":"Since your last login, T&C and Privacy Policy have changed. Please accept them, otherwise you won\'t be able to make changes to your Twins. You can always delete your account in your user profile page.","privacyLabel":"I have read and accepted the","privacyAndCookiePolicy":"Privacy e Cookie Policy","and":"and","termsOfService":"Terms of Service","pAndCUAccepted":"I accept the terms of service about Deep Thought","editAccount":"Edit account","save":"Save"},"success":"Success","Error":"Error","internal server error":"Oupsie, sorry... Something went wrong on the server","error":"Error","error.loading":"Error while loading content.","error.generic":"Oupsie, sorry... something went wrong.","error.serverNotResponding":"We are doing maintenance or releasing updates. Please try again later.","error.notFound":"Oupsie, we didn\'t find the page you were looking for.","error.goBackTo":"You can try to go back to the","error.reloadPage":"Reload the page","error.tryAgain":"Try again","error.unauthorized":"You are unauthorized to view this content.","error.unprocessableEntity":"Error while processing the request. Check the data you entered.","errors":{"TENANT_NOT_FOUND":"Tenant not found","TENANT_REGISTRATION_DISABLED":"Registration on this platform is disabled","TENANT_MISSING_NAME":"Tenant: name missing","TENANT_MAX_USERS_REACHED":"Maximum number of users reached","TENANT_MAX_ADMINS_REACHED":"Maximum number of admin users reached","TENANT_ALREADY_EXISTS":"Tenant already exists","TENANT_MISSING_DESCRIPTION":"Tenant: description missing","TENANT_CANT_SET_COMPLETION_PROVIDER":"Tenant: can\'t set completion provider","USER_NOT_CONFIRMED":"User still not confirmed","USER_NOT_FOUND":"User not found","USER_OR_PASSWORD_INVALID":"Invalid user or password","USER_MUST_CHANGE_PASSWORD":"You must change your password","USER_MUST_ENTER_VERIFICATION_CODE":"You must enter the verification code","USER_MISSING_TENANT":"User: missing tenant","USER_MISSING_NAME":"User: name is missing","USER_MISSING_PASSWORD":"User: password missing","USER_MISSING_EMAIL":"User: Missing email","USER_MISSING_VERIFICATION_CODE":"User: Missing verification code","USER_NAME_ALREADY_USED":"User name already in use","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"The password does not meet the security rules","USER_EMAIL_ALREADY_USED":"Email already in use","USER_EMAIL_INVALID":"Invalid email","USER_VERIFICATION_CODE_INVALID":"Invalid verification code","USER_MISSING_NAME_OR_EMAIL":"Missing username or email","USER_NAME_INVALID":"Invalid user name","USER_HAS_ONE_OR_MORE_MEMORI":"The user has one or more memories","USER_MISSING_NEW_PASSWORD":"User: new password missing","USER_NOTHING_TO_DO":"Nothing to do","USER_CANT_CREATE_MEMORI":"User not allowed to create agents","USER_MAX_MEMORI_REACHED":"Maximum number of agents reached","USER_TOO_MANY_ATTEMPTS":"Too many attempts","USER_MUST_ACCEPT_TNC_AND_PP":"You must accept the terms and conditions","USER_BIRTH_DATE_CANT_BE_CHANGED":"Date of birth cannot be changed","USER_CANT_SET_COMPLETION_PROVIDER":"User: not allowed to manage completion provider","USER_CANT_ENABLE_DEEP_THOUGHT":"User: not enabled to manage Deep Thought","USER_CANT_ENABLE_DCM_INTEGRATION":"User: not enabled to manage DCM integration","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"User: not allowed to manage chaining or expert group","USER_CREATION_BILLING_DENIED_PERMISSION":"You don\'t have enough credits to create an agent","USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS":"The user has one or more completion configurations","USER_CANT_BE_DELETED":"User can\'t be deleted","MEMORI_NOT_FOUND":"Agent not found","MEMORI_NOT_ACCESSIBLE":"Agent not accessible","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Only owner can change tag or pin","SESSION_NOT_FOUND":"Session not found","SESSION_IS_NOT_ADMINISTRATIVE":"Non-administrative session","SESSION_EXPIRED":"Session expired","MEMORI_MISSING_CONFIGURATION":"Agent: missing configuration","MEMORI_CONFIGURATION_NOT_FOUND":"Agent: configuration not found","MEMORI_INVALID_PRIVACY_TYPE":"Agent: invalid privacy type","MEMORI_MISSING_PASSWORD":"Agent: missing password","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Agent: total number of invalid recovery tokens","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Agent: minimum number of invalid recovery tokens","MEMORI_INVALID_VOICE_TYPE":"Agent: invalid voice type","MEMORI_MISSING_NAME":"Agent: missing name","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Agent: missing password or recovery token","MEMORI_INVALID_ID":"Agent: invalid ID","MEMORI_NAME_ALREADY_USED":"Agent name already in use","MEMORI_INVALID_PIN":"Agent: Invalid PIN","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Agent: TAG and PIN change require separate operations","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Agent: no password required when public","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Deep Thought requires completions to be enabled","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"The expert group requires completions to be enabled","MEMORI_INVALID_COMPLETION_CONFIG":"Agent: invalid completions configuration","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Transfer: missing destination user","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Transfer: invalid destination user ID","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Transfer: invalid destination user data","MEMORI_TRANSFER_NOTHING_TO_DO":"Transfer: nothing to do","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Agent: configuration cannot be changed","MEMORI_MISSING_NEW_PASSWORD":"Agent: new password missing","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"Feature requires subscription","INTEGRATION_NOT_FOUND":"Integration not found","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Invalid date from format","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Invalid date to format","INTEGRATION_INVALID_TYPE":"Invalid integration type","INTEGRATION_ALREADY_EXISTS":"Integration already exists","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Non-public memories cannot be integrated","INTEGRATION_MISSING_INVOCATION_TEXT":"Integration: missing invocation text","INTEGRATION_MISSING_DEVICE_EMAILS":"Integration: missing device email","INTEGRATION_MEMORI_IS_EMPTY":"Empty memories cannot be integrated","INTEGRATION_MISSING_PRIVACY_POLICY":"Integration: privacy policy missing","INTEGRATION_MISSING_CATEGORY":"Integration category missing","INTEGRATION_MISSING_DESCRIPTION":"Missing integration description","INTEGRATION_INVALID_INVOCATION_TEXT":"Invalid invocation text","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home no more available","UPLOAD_REQUIRES_MULTIPART_ENCODING":"Upload requires multipart encoding","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: missing content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: maximum size exceeded","UPLOAD_FILE_IS_EMPTY":"Upload: empty file","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: invalid file type or signature","UPLOAD_MISSING_FILE_NAME":"Upload: missing file name","UPLOAD_INVALID_MEMORY_ID":"Upload: Invalid content ID","UPLOAD_MISSING_FILE_CONTENT":"Upload: Missing file content","ASSET_NOT_FOUND":"Asset not found","ASSET_NOT_ACCESSIBLE":"Asset not accessible","ASSET_MISSING_SESSION_ID":"Asset: missing session ID","ASSET_INVALID_FILE_NAME":"Asset: invalid file name","INVITATION_NOT_FOUND":"Invitation not found","INVITATION_NOT_ACCESSIBLE":"Invitation not accessible","INVITATION_ALREADY_ACCEPTED":"Invitation already accepted","INVITATION_ALREADY_REJECTED":"Invitation already rejected","INVITATION_MISSING_DESTINATION_EMAIL":"Invitation: missing destination email","INVITATION_DESTINATION_EMAIL_INVALID":"Invitation: destination email invalid","INVITATION_MISSING_TAG":"Invitation: missing tag","INVITATION_MISSING_PIN":"Invitation: PIN missing","INVITATION_INVALID_PIN":"Invitation: invalid PIN","INVITATION_INVALID_TYPE":"Invitation: invalid type","INVITATION_MISSING_DESTINATION_NAME":"Invitation: destination name missing","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invitation: tag and pin can\'t be changed","INVITATION_CANT_BE_CHANGED":"Intation: can\'t be changed","ACTIONLOG_INVALID_USER_ID":"Invalid user ID","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","ACTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID","CONSUMPTIONLOG_INVALID_TYPE":"Invalid log type","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","CONSUMPTIONLOG_INVALID_USER_ID":"Invalid user ID","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notifications: Invalid chat log extraction period","PROCESS_INVALID_TYPE":"Invalid process type","PROCESS_ALREADY_RUNNING":"Process already running","PROCESS_NOT_FOUND":"Process not found","IMPORTCSV_MISSING_ROWS":"CSV import: missing rows","IMPORTCSV_MISSING_CSV":"CSV Import: Missing CSV","IMPORTCSV_MISSING_SEPARATOR":"CSV import: missing separator","IMPORTCSV_INVALID_SEPARATOR":"CSV import: invalid separator","IMPORTCSV_MISSING_HEADERS":"CSV import: missing headers","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV import: missing title variant separator","IMPORTCSV_INVALID_RECEIVER_ID":"CSV import: invalid receiver ID","IMPORTCSV_INVALID_MEDIA_LINK":"CSV import: invalid media link","IMPORTCSV_INVALID_LINK_TITLE_HANDLING":"CSV import: invalid link title","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"CSV import: undetectable character encoding","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"CSV Import: Cannot import to Secret Memories","IMPORTTXT_MISSING_ROWS":"Importing TXT: missing rows","IMPORTTXT_INVALID_GRANULARITY":"Import TXT: invalid granularity","IMPORTTXT_INVALID_RECEIVER_ID":"Import TXT: invalid receiver ID","IMPORTTXT_INVALID_MEDIA_LINK":"Import TXT: invalid media link","IMPORTTXT_INVALID_LINK_TITLE_HANDLING":"Import TXT: invalid link title","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"TXT import: undetectable character encoding","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"TXT Import: Cannot import to Secret Memories","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Import TXT: import limit exceeded","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Import TXT: import on GPT-4 requires API key","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Import TXT: Import requires a paying plan","IMPORTTXT_BILLING_DENIED_PERMISSION":"Import TXT: you don\'t have enough credits for the operation","EXPORTCSV_MISSING_CSV_SPECS":"CSV export: missing CSV specifications","EXPORTCSV_MISSING_SEPARATOR":"CSV export: missing separator","EXPORTCSV_INVALID_SEPARATOR":"CSV export: invalid separator","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV export: missing title variant separator","EXPORTCSV_MISSING_NEW_LINE_CHAR":"CSV export: missing newline character","EXPORTCSV_INVALID_NEW_LINE_CHAR":"CSV export: invalid newline character","EXPORTCSV_MISSING_PASSWORD":"CSV export: missing password","EXPORTJSONL_MISSING_JSONL_SPECS":"JSONL export: missing JSONL specifications","EXPORTJSONL_MISSING_PLATFORM":"JSONL export: missing platform","EXPORTJSONL_INVALID_PLATFORM":"JSONL export: invalid platform","EXPORTJSONL_MISSING_PASSWORD":"JSONL export: missing password","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"JSONL Export: Export requires a paid plan","ANALYSIS_MISSING_QUERY":"Analysis: missing query","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analysis: Unable to analyze Secret Memories","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analysis: matching user query requires Deep Thinking","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Badge assignment: incorrect or missing credentials","BADGE_ASSIGNMENT_MISSING_REF_ID":"Badge assignment: ref ID missing","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Badge assignment: result not found","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Badge assignment: Missing assertion URL","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Badge Assignment: Missing Badge URL","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Badge assignment: missing issuer URL","BADGE_ASSIGNMENT_INVALID_URL":"Badge assignment: Invalid URL","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Badge assignment: missing recipient","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Badge assignment: unknown recipient type","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Badge assignment: missing recipient identity","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Badge assignment: missing recipient hash type","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Badge assignment: recipient hash type unknown","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Badge assignment: incorrect recipient identity","BADGE_NOT_FOUND":"Badge not found","OUTCOME_NO_DCM_CONFIGURED":"Outcome: no DCM configured","OUTCOME_USER_BADGES_DISABLED":"Outcome: user badges disabled","COMPLETION_CONFIG_MISSING_NAME":"Completions configuration: missing name","COMPLETION_CONFIG_MISSING_PROVIDER":"Completions configuration: missing provider","COMPLETION_CONFIG_MISSING_ENDPOINT":"Completions configuration: missing endpoint","COMPLETION_CONFIG_MISSING_API_KEY":"Completions configuration: missing API key","COMPLETION_CONFIG_MISSING_MODEL":"Completions configuration: missing model","COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED":"Completions configuration: at least one completions type must be specified","COMPLETION_CONFIG_INVALID_NAME":"Completions configuration: invalid name","COMPLETION_CONFIG_INVALID_PURPOSE":"Completions configuration: invalid completions type","COMPLETION_CONFIG_INVALID_ENDPOINT":"Completions configuration: invalid endpoint","COMPLETION_CONFIG_INCONSISTENT_ENDPOINT":"Completions configuration: inconsistent endpoint","COMPLETION_CONFIG_INVALID_PROVIDER":"Completions configuration: invalid provider","COMPLETION_CONFIG_NOT_FOUND":"Completions configuration: not found","COMPLETION_CONFIG_NOT_ACCESSIBLE":"Completions configuration: not accessible","COMPLETION_CONFIG_NAME_RESERVED":"Completions configuration: name reserved","COMPLETION_CONFIG_NAME_ALREADY_EXISTS":"Completions configuration: name already exists","COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED":"Completions configuration: visibility change not allowed"}}');var hG;hG=JSON.parse('{"yes":"Oui","no":"Non","confirm":"Confirmer","apply":"Appliquer","cancel":"Annuler","show":"Montrer","hide":"Cacher","send":"Envoyer","close":"Fermer","edit":"Modifier","delete":"Supprimer","loading":"Chargement","expand":"Développer","collapse":"Effondrement","fullscreenEnter":"Entrez en plein écran","fullscreenExit":"Quitter le plein écran","center":"Centre","bottom":"Bas","hidden":"Caché","day":"Jour","month":"Mois","year":"Année","createdAt":"Date de création","selected":"Choisi","page":"page","actions":"Actes","next":"Suivant","previous":"Précédent","copy":"Copie","copyRawCode":"Copier le code brut","copyToClipboard":"Copier dans le presse-papier","showOriginalText":"Afficher l\'original","showTranslatedText":"Afficher la traduction","exactPosition":"Position exacte","uncertain":"Incertain","question":"Question","nothingFound":"Rien trouvé","venue":"Lieu","searchVenue":"Rechercher un lieu...","memoriBlockedTitle":"Bloqué","memoriBlockedUntil":"Agent bloqué jusqu\'à {{date}}","memoriBlockedAnon":"Actuellement \\"{{name}}\\"Je ne peux pas répondre, reviens ici {{date}}","memoriBlockedReasonExceedChats":"car il a dépassé le seuil mensuel de chats autorisés.","memoriBlockedGiverHelper":"Vous pouvez toujours le gérer en tant qu\'administrateur, mais les autres utilisateurs ne pourront pas interagir avec lui.","generatedByAI":"Réponse générée par l\'IA, peut occasionnellement générer des informations incorrectes","whyThisAnswer":"Pourquoi cette réponse ?","whyThisAnswerHelper":"Cette réponse a été générée automatiquement par une intelligence artificielle basée sur ces contenus vérifiés.","completionsEnabled":"L\'IA avancée peut répondre avec des réponses générées automatiquement qui peuvent parfois contenir des informations incorrectes","completionProviderDown":"Ce Agent est intégré à une IA générative de {{provider}}, mais il est actuellement indisponible. ","completionProviderFallbackName":"un prestataire externe","completionProviderCheckStatusPage":"Vérifier la page d\'état","boardOfExperts":"Conseil d\'experts","birthDate":"Date de naissance","birthDateHelper":"Nous demandons votre date de naissance uniquement pour activer ou désactiver les fonctionnalités qui ont des restrictions d\'âge","underage":"Vous devez être au moins {{age}} ans pour s\'inscrire.","underageTwinSession":"Vous devez être au moins {{age}} ans pour interagir avec ce Agent.","errorFetchingSession":"Erreur lors du chargement de la session","errorGettingReferralURL":"Erreur lors du chargement du référent","errorReopeningSession":"Erreur lors de la re-ouverture de la session","ageVerification":"Vérification de l\'âge","ageVerificationText":"Pour interagir avec ce Agent, vous devez être au minimum {{minAge}} ans.","nsfw":"NSFW : Ce jumeau contient du contenu pour adultes","deepThought":"Pensée profonde","deepThoughtHelper":"Deep Thought est une fonctionnalité avancée de l\'IA qui vous permettra d\'exploiter pleinement vos conversations en les gardant une trace. ","deepThoughtDisclaimerTitle":"Pensée profonde activée","deepThoughtDisclaimer":"Deep Thought est une fonctionnalité avancée de l\'IA qui vous permettra d\'exploiter pleinement vos conversations en les gardant une trace. ","deepThoughtPreDisclaimerUnlogged":"Connectez-vous pour activer Deep Thought.","deepThoughtPreDisclaimerNotAllowed":"Deep Thought est désactivé car vous n\'avez pas consenti à son utilisation, vous pouvez le modifier à tout moment dans les paramètres de votre compte.","notEnoughCredits":"L\'auteur de ce Agent n\'a pas suffisamment de crédits pour répondre à votre question.","knownFacts":{"title":"Faits connus","description":"Détails des informations partagées entre vous et {{memoriName}}","type":"Taper","typeShortTerm":"Court terme","typeLongTerm":"Long terme","typeHelper":"Types :\\n","text":"Texte","deleteSuccess":"Fait connu supprimé","deleteConfirmTitle":"Supprimer un fait connu","deleteConfirmMessage":"Êtes-vous sûr de vouloir supprimer ce fait connu ?","deleteSelectedConfirmTitle":"Supprimer les faits connus sélectionnés","deleteSelectedConfirmMessage":"Etes-vous sûr de vouloir supprimer les faits connus sélectionnés ?"},"auth":{"title":"Authentification","useRecoveryTokens":"Utiliser des jetons de récupération","tokens":"Jetons","addToken":"Ajouter un jeton","usePassword":"Utiliser le mot de passe","atLeast":"Au moins"},"widget":{"instruct":"Instruire","test":"Test","sound":"Son","position":"Préférences de position","settings":"Paramètres","share":"Partager","sendOnKeypress":"Appuyez sur Entrée pour envoyer","sendOnClick":"Cliquez sur Soumettre","boardOfExperts":"Conseil d\'experts","showExpertsInTheBoard":"Afficher les experts dans ce forum","expertsInTheBoard":"Experts dans ce forum","goToIntegrationsToCustomizeAvatar":"Pour personnaliser l\'avatar, allez dans Partager et personnalisez la page publique"},"write_and_speak":{"micButtonPopover":"Cliquez sur le bouton pour parler","micButtonPopoverListening":"Cliquez sur le bouton pour arrêter de parler","pageInstructExplanation":"Pour m\'apprendre de nouvelles choses, cliquez sur le bouton INSTRUCTEZ-MOI pour commencer","pageTryMeExplanation":"Pour me parler, cliquez sur le bouton START pour commencer","instructButton":"INSTRUCTEZ-MOI","tryMeButton":"COMMENCER","chatHistory":"Historique des discussions","exportChatHistory":"Exporter l\'historique des discussions","exportChatHistoryMessage":"Voulez-vous exporter l’historique des discussions ?","chatBotButtonText":"CLIQUEZ ICI POUR OUVRIR LE CHATBOT","conversationStartedLabel":"La conversation a commencé le","settingsHeaderLabel":"Configurez ici si vous souhaitez définir la mémoire comme parole continue et modifiez les secondes de silence si vous souhaitez les personnaliser.","continuousSpeechLabel":"Discours continu","continuousSpeechDisabled":"Discours continu désactivé car l\'agente est en mode muté","holdToSpeak":"Attends pour parler","releaseToEndListening":"Relâcher pour terminer l\'écoute","pressAndHoldToSpeak":"Appuyez et maintenez pour parler","microphoneMode":"Mode micro","hideEmissionsLabel":"Masquer le texte émis par le Agent","secondsLabel":"Régler les secondes","controlsPosition":"Position des commandes","tryMeHeaderLabel":"ESSAYER","unknownPosition":"Position inconnue","fieldPlace":"Écrivez le lieu (par exemple « Milano »)","showMapLinkFor":"Afficher la position sur la carte","useMyPosition":"Utiliser ma position","myPosition":"Votre poste","updatingPosition":"Mise à jour du poste...","placeNotFound":"Lieu introuvable !","requirePosition":"Insérez votre position avant de commencer","requirePositionHelp":"Pour parler à {{name}} vous devez décider si vous souhaitez ou non fournir votre poste. ","dontWantToProvidePosition":"Je ne veux pas donner ma position","attachmentsLabel":"Enrichissez votre message","iWantToTalkToIn":"je veux parler à {{name}} dans"},"media":{"title":"Titre","editAttributes":"Modifier les attributs du média","uploadMimeTypeNotAllowed":"Le type de fichier n\'est pas autorisé","uploadSizeLimitMessage":"La taille téléchargée est trop grande (max {{size}}Mo)","uploadWrongResolutionMessage":"La résolution doit être {{width}}x{{height}} pixels","memoriNameAlreadyUsed":"Vous avez déjà un jumeau portant ce nom","uploadHelperImages":"Téléchargez un fichier avec l\'extension png, jpg, jpeg ou gif, et ayant au maximum une taille de {{size}}Mo","uploadHelper":"Téléchargez un fichier ayant au maximum une taille de {{size}}Mo","uploadError":"Échec du téléchargement","square":"carré","scaleRatio":"Rapport d\'échelle","addMediaLabel":"Ajouter un média","insertThisMediaMsg":"Insérez ces médias","mediaUploadMessage":"Cliquez pour charger un nouveau média","addLinkLabel":"Ajouter un lien","linkKey":"URL","linkValue":"Titre du lien","insertThisLink":"Insérer un lien vers {{url}} avec titre {{title}}"},"gamification":{"level":"Niveau","points":"points","memoriReachedLevel":"est devenu plus évolué et a atteint le niveau","levelGoToStatistics":"{{Agent}} est au niveau {{level}} avec {{points}} points. ","congratulationsNewLevel":"Félicitations, vous avez atteint un nouveau niveau !","congratulationsNewLevelDescription":"Votre Agent est devenu plus évolué avec {{points}} points, regardez le","statistics":"statistiques"},"login":{"login":"Se connecter","logout":"Déconnexion","user":"Utilisateur","loggedDrawerTitle":"Salut, {{name}}!","loginDrawerTitle":"Se connecter","signupDrawerTitle":"S\'inscrire","newUserSignUp":"Nouvel utilisateur ?","signUp":"S\'inscrire!","alreadyHaveAnAccount":"Vous avez déjà un compte ?","backToLogin":"Retour à la connexion","registrationDisabled":"L\'inscription est désactivée","contactAdmin":"Contacter l\'administrateur pour demander l\'accès","userNameOrEmail":"Nom d\'utilisateur ou email","email":"E-mail","emailFormatError":"Veuillez insérer un email valide","username":"Nom d\'utilisateur","usernameContainsReservedWord":"Le nom d\'utilisateur contient un mot réservé, veuillez en choisir un autre","usernameFormatError":"Le nom d\'utilisateur doit comporter au moins 3 caractères et contenir uniquement des lettres, des chiffres et _","otpCode":"Le code de vérification","resendVerificationCode":"Renvoyer le code","resentVerificationCode":"Code de confirmation envoyé ! ","password":"Mot de passe","newPassword":"Nouveau mot de passe","confirmPassword":"Confirmez le mot de passe","currentPassword":"Mot de passe actuel","passwordMatchingError":"Les mots de passe ne correspondent pas.","passwordFormatError":"Le mot de passe doit comporter au moins 8 caractères et contenir au moins un chiffre, une lettre majuscule, une lettre minuscule et un symbole.","pwdWeak":"Faible","pwdAcceptable":"Acceptable","pwdStrong":"Fort","mustChangePassword":"Vous devez changer votre mot de passe","passwordChange":"Changer le mot de passe","emailChange":"Changer d\'e-mail","avatarChange":"Changer d\'avatar","underage":"Vous devez être au moins {{age}} ans pour s\'inscrire.","optional":"Facultatif","birthDate":"Date de naissance","birthDateHelper":"Nous demandons votre date de naissance uniquement pour activer ou désactiver les fonctionnalités qui ont des restrictions d\'âge","missingData":"Informations manquantes","missingDataHelper":"Nous savons que c\'est un peu ennuyeux, mais nous avons besoin de plus d\'informations pour finaliser votre inscription.","goToAccountToChangeYourPreferences":"Vous pouvez modifier votre choix à tout moment depuis la page de votre compte.","deepThoughtExplaination":"Deep Thought est une fonctionnalité avancée de l\'IA qui vous permettra d\'exploiter pleinement vos conversations en les gardant une trace. ","tnCAndPPAcceptedHelper":"Depuis votre dernière connexion, les conditions générales et la politique de confidentialité ont changé. ","privacyLabel":"J\'ai lu et accepté le","privacyAndCookiePolicy":"Politique de confidentialité et de cookies","and":"et","termsOfService":"Conditions d\'utilisation","pAndCUAccepted":"J\'accepte les conditions d\'utilisation de Deep Thought","editAccount":"Modifier le compte","save":"Sauvegarder"},"success":"Succès","Error":"Erreur","internal server error":"Oupsie, désolé... Quelque chose s\'est mal passé sur le serveur","error":"Erreur","error.loading":"Erreur lors du chargement du contenu.","error.generic":"Oupsie, désolé... quelque chose s\'est mal passé.","error.serverNotResponding":"Nous effectuons une maintenance ou publions des mises à jour. ","error.notFound":"Oupsie, nous n\'avons pas trouvé la page que vous cherchiez.","error.goBackTo":"Vous pouvez essayer de revenir au","error.reloadPage":"Recharger la page","error.tryAgain":"Essayer à nouveau","error.unauthorized":"Vous n\'êtes pas autorisé à consulter ce contenu.","error.unprocessableEntity":"Erreur lors du traitement de la demande. ","errors":{"TENANT_NOT_FOUND":"Locataire introuvable","TENANT_REGISTRATION_DISABLED":"L\'inscription sur cette plateforme est désactivée","TENANT_MISSING_NAME":"Locataire : nom manquant","TENANT_MAX_USERS_REACHED":"Nombre maximum d\'utilisateurs atteint","TENANT_MAX_ADMINS_REACHED":"Nombre maximum d\'utilisateurs administrateurs atteint","TENANT_ALREADY_EXISTS":"Le locataire existe déjà","TENANT_MISSING_DESCRIPTION":"Locataire : description manquante","TENANT_CANT_SET_COMPLETION_PROVIDER":"Locataire : impossible de définir le fournisseur de complétion","USER_NOT_CONFIRMED":"L\'utilisateur n\'est toujours pas confirmé","USER_NOT_FOUND":"Utilisateur introuvable","USER_OR_PASSWORD_INVALID":"Utilisateur ou mot de passe invalide","USER_MUST_CHANGE_PASSWORD":"Vous devez changer votre mot de passe","USER_MUST_ENTER_VERIFICATION_CODE":"Vous devez entrer le code de vérification","USER_MISSING_TENANT":"Utilisateur : locataire manquant","USER_MISSING_NAME":"Utilisateur : le nom est manquant","USER_MISSING_PASSWORD":"Utilisateur : mot de passe manquant","USER_MISSING_EMAIL":"Utilisateur : E-mail manquant","USER_MISSING_VERIFICATION_CODE":"Utilisateur : Code de vérification manquant","USER_NAME_ALREADY_USED":"Nom d\'utilisateur déjà utilisé","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"Le mot de passe ne répond pas aux règles de sécurité","USER_EMAIL_ALREADY_USED":"E-mail déjà utilisé","USER_EMAIL_INVALID":"E-mail invalide","USER_VERIFICATION_CODE_INVALID":"Code de vérification invalide","USER_MISSING_NAME_OR_EMAIL":"Nom d\'utilisateur ou e-mail manquant","USER_NAME_INVALID":"Nom d\'utilisateur invalide","USER_HAS_ONE_OR_MORE_MEMORI":"L\'utilisateur possède une ou plusieurs mémoires","USER_MISSING_NEW_PASSWORD":"Utilisateur : nouveau mot de passe manquant","USER_NOTHING_TO_DO":"Rien à faire","USER_CANT_CREATE_MEMORI":"L\'utilisateur n\'est pas autorisé à créer des Agent","USER_MAX_MEMORI_REACHED":"Nombre maximum de Agent atteint","USER_TOO_MANY_ATTEMPTS":"Trop de tentatives","USER_MUST_ACCEPT_TNC_AND_PP":"Vous devez accepter les termes et conditions","USER_BIRTH_DATE_CANT_BE_CHANGED":"La date de naissance ne peut pas être modifiée","USER_CANT_SET_COMPLETION_PROVIDER":"Utilisateur : non autorisé à gérer le fournisseur de complétion","USER_CANT_ENABLE_DEEP_THOUGHT":"Utilisateur : non autorisé à gérer Deep Thought","USER_CANT_ENABLE_DCM_INTEGRATION":"Utilisateur : non autorisé à gérer l\'intégration DCM","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"Utilisateur : non autorisé à gérer des chaînages ou des groupes d\'experts","USER_CREATION_BILLING_DENIED_PERMISSION":"Vous n\'avez pas assez de crédits pour créer un Agent","USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS":"L\'utilisateur dispose d\'une ou plusieurs configurations de complétion","USER_CANT_BE_DELETED":"L\'utilisateur ne peut pas être supprimé","MEMORI_NOT_FOUND":"Mémoire introuvable","MEMORI_NOT_ACCESSIBLE":"Mémoires non accessibles","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Seul le propriétaire peut modifier le tag ou le code PIN","SESSION_NOT_FOUND":"Séance introuvable","SESSION_IS_NOT_ADMINISTRATIVE":"Séance non administrative","SESSION_EXPIRED":"Session expirée","MEMORI_MISSING_CONFIGURATION":"Agent : configuration manquante","MEMORI_CONFIGURATION_NOT_FOUND":"Agent : configuration introuvable","MEMORI_INVALID_PRIVACY_TYPE":"Agent : type de confidentialité non valide","MEMORI_MISSING_PASSWORD":"Agent : mot de passe manquant","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Agent : nombre total de jetons de récupération invalides","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Agent : nombre minimum de jetons de récupération invalides","MEMORI_INVALID_VOICE_TYPE":"Agent : type de voix invalide","MEMORI_MISSING_NAME":"Jumeau : nom manquant","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Agent : mot de passe ou jeton de récupération manquant","MEMORI_INVALID_ID":"Jumeau : pièce d\'identité invalide","MEMORI_NAME_ALREADY_USED":"Nom jumeau déjà utilisé","MEMORI_INVALID_PIN":"Agent : code PIN invalide","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Agent : le changement de TAG et de PIN nécessite des opérations distinctes","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Agent : aucun mot de passe requis lorsqu\'il est public","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Deep Thought nécessite que les complétions soient activées","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"Le groupe d\'experts exige que les complétions soient activées","MEMORI_INVALID_COMPLETION_CONFIG":"Agent : configuration des complétions non valide","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Transfert : utilisateur de destination manquant","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Transfert : ID utilisateur de destination non valide","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Transfert : données utilisateur de destination non valides","MEMORI_TRANSFER_NOTHING_TO_DO":"Transfert : rien à faire","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Mémoires : la configuration ne peut pas être modifiée","MEMORI_MISSING_NEW_PASSWORD":"Souvenirs : nouveau mot de passe manquant","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"La fonctionnalité nécessite un abonnement","INTEGRATION_NOT_FOUND":"Intégration introuvable","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Date invalide du format","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Date à formater invalide","INTEGRATION_INVALID_TYPE":"Type d\'intégration invalide","INTEGRATION_ALREADY_EXISTS":"L\'intégration existe déjà","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Les mémoires non publiques ne peuvent pas être intégrées","INTEGRATION_MISSING_INVOCATION_TEXT":"Intégration : texte d\'invocation manquant","INTEGRATION_MISSING_DEVICE_EMAILS":"Intégration : e-mail de l\'appareil manquant","INTEGRATION_MEMORI_IS_EMPTY":"Les mémoires vides ne peuvent pas être intégrées","INTEGRATION_MISSING_PRIVACY_POLICY":"Intégration : politique de confidentialité manquante","INTEGRATION_MISSING_CATEGORY":"Catégorie d\'intégration manquante","INTEGRATION_MISSING_DESCRIPTION":"Description de l\'intégration manquante","INTEGRATION_INVALID_INVOCATION_TEXT":"Texte d\'appel invalide","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home n\'est plus disponible","UPLOAD_REQUIRES_MULTIPART_ENCODING":"Le téléchargement nécessite un codage en plusieurs parties","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Téléchargement : limite de type de contenu manquante","UPLOAD_MAX_LENGTH_EXCEEDED":"Téléchargement : taille maximale dépassée","UPLOAD_FILE_IS_EMPTY":"Télécharger : fichier vide","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Téléchargement : type de fichier ou signature non valide","UPLOAD_MISSING_FILE_NAME":"Télécharger : nom de fichier manquant","UPLOAD_INVALID_MEMORY_ID":"Télécharger : ID de contenu invalide","UPLOAD_MISSING_FILE_CONTENT":"Télécharger : contenu du fichier manquant","ASSET_NOT_FOUND":"Actif introuvable","ASSET_NOT_ACCESSIBLE":"Actif non accessible","ASSET_MISSING_SESSION_ID":"Élément : ID de session manquant","ASSET_INVALID_FILE_NAME":"Élément : nom de fichier non valide","INVITATION_NOT_FOUND":"Invitation introuvable","INVITATION_NOT_ACCESSIBLE":"Invitation non accessible","INVITATION_ALREADY_ACCEPTED":"Invitation déjà acceptée","INVITATION_ALREADY_REJECTED":"Invitation déjà rejetée","INVITATION_MISSING_DESTINATION_EMAIL":"Invitation : e-mail de destination manquant","INVITATION_DESTINATION_EMAIL_INVALID":"Invitation : e-mail de destination invalide","INVITATION_MISSING_TAG":"Invitation : étiquette manquante","INVITATION_MISSING_PIN":"Invitation : code PIN manquant","INVITATION_INVALID_PIN":"Invitation : code PIN invalide","INVITATION_INVALID_TYPE":"Invitation : type non valide","INVITATION_MISSING_DESTINATION_NAME":"Invitation : le nom de la destination est manquant","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invitation : le tag et le code PIN ne peuvent pas être modifiés","INVITATION_CANT_BE_CHANGED":"Intation : ne peut pas être modifié","ACTIONLOG_INVALID_USER_ID":"ID utilisateur invalide","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Date de : format non valide","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Date de : format non valide","ACTIONLOG_INVALID_MEMORI_ID":"Identifiant Agent invalide","CONSUMPTIONLOG_INVALID_TYPE":"Type de journal invalide","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Date de : format non valide","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Date de : format non valide","CONSUMPTIONLOG_INVALID_USER_ID":"ID utilisateur invalide","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Identifiant Agent invalide","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notifications : période d\'extraction du journal de discussion non valide","PROCESS_INVALID_TYPE":"Type de processus invalide","PROCESS_ALREADY_RUNNING":"Processus déjà en cours","PROCESS_NOT_FOUND":"Processus introuvable","IMPORTCSV_MISSING_ROWS":"Import CSV : lignes manquantes","IMPORTCSV_MISSING_CSV":"Importation CSV : CSV manquant","IMPORTCSV_MISSING_SEPARATOR":"Import CSV : séparateur manquant","IMPORTCSV_INVALID_SEPARATOR":"Importation CSV : séparateur non valide","IMPORTCSV_MISSING_HEADERS":"Import CSV : en-têtes manquants","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Import CSV : séparateur de variante de titre manquant","IMPORTCSV_INVALID_RECEIVER_ID":"Importation CSV : ID de destinataire non valide","IMPORTCSV_INVALID_MEDIA_LINK":"Importation CSV : lien média non valide","IMPORTCSV_INVALID_LINK_TITLE_HANDLING":"Importation CSV : titre du lien invalide","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"Import CSV : encodage de caractères indétectable","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"Importation CSV : impossible d\'importer dans les mémoires secrètes","IMPORTTXT_MISSING_ROWS":"Importation de TXT : lignes manquantes","IMPORTTXT_INVALID_GRANULARITY":"Importer TXT : granularité invalide","IMPORTTXT_INVALID_RECEIVER_ID":"Importer TXT : ID de destinataire invalide","IMPORTTXT_INVALID_MEDIA_LINK":"Importer TXT : lien média non valide","IMPORTTXT_INVALID_LINK_TITLE_HANDLING":"Importer TXT : titre du lien invalide","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"Import TXT : encodage de caractères indétectable","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"Importation TXT : impossible d\'importer vers les mémoires secrètes","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Importer TXT : limite d\'importation dépassée","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Importer TXT : l\'importation sur GPT-4 nécessite une clé API","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Importer TXT : l\'importation nécessite un forfait payant","IMPORTTXT_BILLING_DENIED_PERMISSION":"Importer TXT : vous n\'avez pas assez de crédits pour l\'opération","EXPORTCSV_MISSING_CSV_SPECS":"Exportation CSV : spécifications CSV manquantes","EXPORTCSV_MISSING_SEPARATOR":"Export CSV : séparateur manquant","EXPORTCSV_INVALID_SEPARATOR":"Exportation CSV : séparateur non valide","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Exportation CSV : séparateur de variante de titre manquant","EXPORTCSV_MISSING_NEW_LINE_CHAR":"Exportation CSV : caractère de nouvelle ligne manquant","EXPORTCSV_INVALID_NEW_LINE_CHAR":"Exportation CSV : caractère de nouvelle ligne non valide","EXPORTCSV_MISSING_PASSWORD":"Export CSV : mot de passe manquant","EXPORTJSONL_MISSING_JSONL_SPECS":"Export JSONL : spécifications JSONL manquantes","EXPORTJSONL_MISSING_PLATFORM":"Export JSONL : plateforme manquante","EXPORTJSONL_INVALID_PLATFORM":"Export JSONL : plateforme non valide","EXPORTJSONL_MISSING_PASSWORD":"Export JSONL : mot de passe manquant","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"Exportation JSONL : l\'exportation nécessite un forfait payant","ANALYSIS_MISSING_QUERY":"Analyse : requête manquante","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analyse : impossible d\'analyser les souvenirs secrets","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analyse : la correspondance avec la requête de l\'utilisateur nécessite une réflexion approfondie","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Attribution des badges : identifiants incorrects ou manquants","BADGE_ASSIGNMENT_MISSING_REF_ID":"Affectation du badge : ID de référence manquant","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Attribution des badges : résultat introuvable","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Attribution du badge : URL d\'assertion manquante","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Attribution du badge : URL du badge manquante","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Attribution du badge : URL de l\'émetteur manquante","BADGE_ASSIGNMENT_INVALID_URL":"Attribution du badge : URL invalide","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Affectation du badge : destinataire manquant","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Attribution du badge : type de destinataire inconnu","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Attribution du badge : identité du destinataire manquante","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Attribution du badge : type de hachage du destinataire manquant","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Attribution du badge : type de hachage du destinataire inconnu","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Attribution du badge : identité du destinataire incorrecte","BADGE_NOT_FOUND":"Badge introuvable","OUTCOME_NO_DCM_CONFIGURED":"Résultat : aucun DCM configuré","OUTCOME_USER_BADGES_DISABLED":"Résultat : badges utilisateur désactivés","COMPLETION_CONFIG_MISSING_NAME":"Configuration des complétions : nom manquant","COMPLETION_CONFIG_MISSING_PROVIDER":"Configuration des complétions : fournisseur manquant","COMPLETION_CONFIG_MISSING_ENDPOINT":"Configuration des complétions : point de terminaison manquant","COMPLETION_CONFIG_MISSING_API_KEY":"Configuration des complétions : clé API manquante","COMPLETION_CONFIG_MISSING_MODEL":"Configuration des complétions : modèle manquant","COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED":"Configuration des complétions : au moins un type de complétions doit être spécifié","COMPLETION_CONFIG_INVALID_NAME":"Configuration des complétions: nom non valide","COMPLETION_CONFIG_INVALID_PURPOSE":"Configuration des complétions : type de complétions non valide","COMPLETION_CONFIG_INVALID_ENDPOINT":"Configuration des achèvements : point de terminaison non valide","COMPLETION_CONFIG_INCONSISTENT_ENDPOINT":"Configuration des complétions : point de terminaison incohérent","COMPLETION_CONFIG_INVALID_PROVIDER":"Configuration des complétions : fournisseur non valide","COMPLETION_CONFIG_NOT_FOUND":"Configuration des complétions : introuvable","COMPLETION_CONFIG_NOT_ACCESSIBLE":"Configuration des complétions : non accessible","COMPLETION_CONFIG_NAME_RESERVED":"Configuration des complétions : nom réservé","COMPLETION_CONFIG_NAME_ALREADY_EXISTS":"Configuration des complétions : le nom existe déjà","COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED":"Configuration des complétions : changement de visibilité non autorisé"}}');var pG;pG=JSON.parse('{"yes":"Ja","no":"NEIN","confirm":"Bestätigen","apply":"Anwenden","cancel":"Stornieren","show":"Zeigen","hide":"Verstecken","send":"Schicken","close":"Schließen","edit":"Bearbeiten","delete":"Löschen","loading":"Laden","expand":"Expandieren","collapse":"Zusammenbruch","fullscreenEnter":"Geben Sie den Vollbildmodus ein","fullscreenExit":"Beenden Sie den Vollbildmodus","center":"Center","bottom":"Unten","hidden":"Versteckt","day":"Tag","month":"Monat","year":"Jahr","createdAt":"Erstellungsdatum","selected":"Ausgewählt","page":"Seite","actions":"Aktionen","next":"Nächste","previous":"Vorherige","copy":"Kopie","copyRawCode":"Rohcode kopieren","copyToClipboard":"In die Zwischenablage kopieren","showOriginalText":"Original anzeigen","showTranslatedText":"Übersetzung anzeigen","exactPosition":"Genaue Position","uncertain":"Unsicher","question":"Frage","nothingFound":"Nichts gefunden","venue":"Veranstaltungsort","searchVenue":"Veranstaltungsort suchen...","memoriBlockedTitle":"Blockiert","memoriBlockedUntil":"Agent blockiert bis {{date}}","memoriBlockedAnon":"Momentan \\"{{name}}„Kann nicht antworten, komm hierher zurück {{date}}","memoriBlockedReasonExceedChats":"weil der monatliche Schwellenwert für erlaubte Chats überschritten wurde.","memoriBlockedGiverHelper":"Sie können es weiterhin als Administrator verwalten, andere Benutzer können jedoch nicht damit interagieren.","generatedByAI":"Von KI generierte Antworten können gelegentlich falsche Informationen generieren","whyThisAnswer":"Warum diese Antwort?","whyThisAnswerHelper":"Diese Antwort wurde automatisch von einer künstlichen Intelligenz auf Basis dieser verifizierten Inhalte generiert.","completionsEnabled":"Fortschrittliche KI kann mit automatisch generierten Antworten reagieren, die manchmal falsche Informationen enthalten können","completionProviderDown":"Dieser Zwilling ist mit einer generativen KI von integriert {{provider}}, aber es ist derzeit nicht verfügbar. ","completionProviderFallbackName":"ein externer Anbieter","completionProviderCheckStatusPage":"Überprüfen Sie die Statusseite","boardOfExperts":"Expertengremium","birthDate":"Geburtsdatum","birthDateHelper":"Wir fragen nur nach Ihrem Geburtsdatum, um Funktionen zu aktivieren oder zu deaktivieren, für die Altersbeschränkungen gelten","underage":"Das müssen Sie mindestens sein {{age}} Jahre alt, um sich anzumelden.","underageTwinSession":"Das müssen Sie mindestens sein {{age}} Jahre alt, um mit diesem Zwilling zu interagieren.","errorFetchingSession":"Fehler beim Laden der Sitzung","errorGettingReferralURL":"Fehler beim Laden des Referrals","errorReopeningSession":"Fehler beim erneuten Öffnen der Sitzung","ageVerification":"Altersüberprüfung","ageVerificationText":"Um mit diesem Zwilling interagieren zu können, müssen Sie mindestens sein {{minAge}} Jahre alt.","nsfw":"NSFW: Dieser Agent enthält Inhalte für Erwachsene","deepThought":"Tiefer Gedanke","deepThoughtHelper":"Deep Thought ist eine erweiterte Funktion der KI, die es Ihnen ermöglicht, Ihre Gespräche voll auszuschöpfen, indem Sie sie verfolgen. ","deepThoughtDisclaimerTitle":"Deep Thought aktiviert","deepThoughtDisclaimer":"Deep Thought ist eine erweiterte Funktion der KI, die es Ihnen ermöglicht, Ihre Gespräche voll auszuschöpfen, indem Sie sie verfolgen. ","deepThoughtPreDisclaimerUnlogged":"Melden Sie sich an, um Deep Thought zu aktivieren.","deepThoughtPreDisclaimerNotAllowed":"Deep Thought ist deaktiviert, da Sie der Nutzung nicht zugestimmt haben. Sie können dies jederzeit in Ihren Kontoeinstellungen ändern.","notEnoughCredits":"Der Autor dieses Zwillings verfügt nicht über genügend Credits, um Ihre Frage zu beantworten.","knownFacts":{"title":"Bekannte Fakten","description":"Einzelheiten zu den Informationen, die zwischen Ihnen und geteilt werden {{memoriName}}","type":"Typ","typeShortTerm":"Kurzfristig","typeLongTerm":"Langfristig","typeHelper":"Typen:\\n","text":"Text","deleteSuccess":"Bekannte Tatsache gelöscht","deleteConfirmTitle":"Bekannte Tatsache löschen","deleteConfirmMessage":"Sind Sie sicher, dass Sie diese bekannte Tatsache löschen möchten?","deleteSelectedConfirmTitle":"Ausgewählte bekannte Fakten löschen","deleteSelectedConfirmMessage":"Sind Sie sicher, dass Sie die ausgewählten bekannten Fakten löschen möchten?"},"auth":{"title":"Authentifizierung","useRecoveryTokens":"Verwenden Sie Wiederherstellungstoken","tokens":"Token","addToken":"Token hinzufügen","usePassword":"Passwort verwenden","atLeast":"Mindestens"},"widget":{"instruct":"Anweisen","test":"Prüfen","sound":"Klang","position":"Positionspräferenzen","settings":"Einstellungen","share":"Aktie","sendOnKeypress":"Drücken Sie zum Senden die Eingabetaste","sendOnClick":"Klicken Sie auf Senden","boardOfExperts":"Expertengremium","showExpertsInTheBoard":"Experten in diesem Forum anzeigen","expertsInTheBoard":"Experten in diesem Forum","goToIntegrationsToCustomizeAvatar":"Um den Avatar anzupassen, gehen Sie zu „Teilen“ und passen Sie die öffentliche Seite an"},"write_and_speak":{"micButtonPopover":"Klicken Sie auf die Schaltfläche, um zu sprechen","micButtonPopoverListening":"Klicken Sie auf die Schaltfläche, um das Sprechen zu stoppen","pageInstructExplanation":"Um mir neue Dinge beizubringen, klicken Sie auf die Schaltfläche „ANLEITEN“, um zu beginnen","pageTryMeExplanation":"Um mit mir zu sprechen, klicken Sie auf die Schaltfläche START, um zu beginnen","instructButton":"WEISE MICH AN","tryMeButton":"START","chatHistory":"Chatverlauf","exportChatHistory":"Chatverlauf exportieren","exportChatHistoryMessage":"Möchten Sie den Chatverlauf exportieren?","chatBotButtonText":"KLICKEN SIE HIER, UM CHATBOT ZU ÖFFNEN","conversationStartedLabel":"Das Gespräch begann am","settingsHeaderLabel":"Richten Sie hier ein, wenn Sie die Agent als Dauerrede einstellen möchten, und ändern Sie die Stillesekunden, wenn Sie sie anpassen möchten.","continuousSpeechLabel":"Kontinuierliche Rede","continuousSpeechDisabled":"Kontinuierliche Rede deaktiviert, da der Agent im Stummschaltmodus ist","holdToSpeak":"Halten Sie gedrückt, um zu sprechen","releaseToEndListening":"Lassen Sie los, um das Hören zu beenden","pressAndHoldToSpeak":"Zum Sprechen gedrückt halten","microphoneMode":"Mikrofonmodus","hideEmissionsLabel":"Vom Zwilling ausgegebenen Text ausblenden","secondsLabel":"Sekunden einstellen","controlsPosition":"Steuert die Position","tryMeHeaderLabel":"VERSUCHEN","unknownPosition":"Unbekannte Position","fieldPlace":"Geben Sie den Ort ein (z. B. „Mailand“)","showMapLinkFor":"Zeigen Sie die Position auf der Karte an","useMyPosition":"Nutzen Sie meine Position","myPosition":"Ihre Position","updatingPosition":"Position wird aktualisiert...","placeNotFound":"Ort nicht gefunden!","requirePosition":"Geben Sie vor dem Start Ihre Position ein","requirePositionHelp":"Zum Reden {{name}} Sie müssen entscheiden, ob Sie Ihre Position angeben oder nicht. ","dontWantToProvidePosition":"Ich möchte meine Position nicht bekannt geben","attachmentsLabel":"Bereichern Sie Ihre Botschaft","iWantToTalkToIn":"Ich möchte mit reden {{name}} In"},"media":{"title":"Titel","editAttributes":"Medienattribute bearbeiten","uploadMimeTypeNotAllowed":"Der Dateityp ist nicht zulässig","uploadSizeLimitMessage":"Die hochgeladene Größe ist zu groß (max {{size}}MB)","uploadWrongResolutionMessage":"Die Auflösung muss sein {{width}}X{{height}} Pixel","memoriNameAlreadyUsed":"Du hast bereits einen Zwilling mit diesem Namen","uploadHelperImages":"Laden Sie eine Datei mit der Erweiterung PNG, JPG, JPEG oder GIF hoch und darf maximal eine Größe von haben {{size}}MB","uploadHelper":"Laden Sie eine Datei mit einer maximalen Größe von hoch {{size}}MB","uploadError":"Der Upload ist fehlgeschlagen","square":"Quadrat","scaleRatio":"Maßstabsverhältnis","addMediaLabel":"Fügen Sie ein Medium hinzu","insertThisMediaMsg":"Legen Sie diese Medien ein","mediaUploadMessage":"Klicken Sie hier, um ein neues Medium zu laden","addLinkLabel":"Fügen Sie einen Link hinzu","linkKey":"URL","linkValue":"Linktitel","insertThisLink":"Fügen Sie einen Link ein {{url}} mit Titel {{title}}"},"gamification":{"level":"Ebene","points":"Punkte","memoriReachedLevel":"entwickelte sich weiter und erreichte ein höheres Niveau","levelGoToStatistics":"{{memori}} ist auf gleicher Höhe {{level}} mit {{points}} Punkte. ","congratulationsNewLevel":"Herzlichen Glückwunsch, Sie haben ein neues Level erreicht!","congratulationsNewLevelDescription":"Ihre Agent wurden mit weiterentwickelt {{points}} Punkte, schauen Sie sich die an","statistics":"Statistiken"},"login":{"login":"Login","logout":"Abmelden","user":"Benutzer","loggedDrawerTitle":"Hallo, {{name}}!","loginDrawerTitle":"Login","signupDrawerTitle":"Melden Sie sich an","newUserSignUp":"Neuer Benutzer?","signUp":"Melden Sie sich an!","alreadyHaveAnAccount":"Sie haben bereits ein Konto?","backToLogin":"Zurück zum Login","registrationDisabled":"Die Registrierung ist deaktiviert","contactAdmin":"Wenden Sie sich an den Administrator, um Zugriff anzufordern","userNameOrEmail":"Benutzername oder E-Mail","email":"E-Mail","emailFormatError":"Bitte geben Sie eine gültige E-Mail-Adresse ein","username":"Benutzername","usernameContainsReservedWord":"Der Benutzername enthält ein reserviertes Wort. Bitte wählen Sie ein anderes","usernameFormatError":"Der Benutzername muss mindestens 3 Zeichen lang sein und darf nur Buchstaben, Zahlen und _ enthalten.","otpCode":"Bestätigungscode","resendVerificationCode":"Code erneut senden","resentVerificationCode":"Bestätigungscode gesendet! ","password":"Passwort","newPassword":"Neues Passwort","confirmPassword":"Passwort bestätigen","currentPassword":"Aktuelles Passwort","passwordMatchingError":"Passwörter stimmen nicht überein.","passwordFormatError":"Das Passwort muss mindestens 8 Zeichen lang sein und mindestens eine Zahl, einen Großbuchstaben, einen Kleinbuchstaben und ein Symbol enthalten","pwdWeak":"Schwach","pwdAcceptable":"Akzeptabel","pwdStrong":"Stark","mustChangePassword":"Sie müssen Ihr Passwort ändern","passwordChange":"Kennwort ändern","emailChange":"E-Mail ändern","avatarChange":"Avatar ändern","underage":"Das müssen Sie mindestens sein {{age}} Jahre alt, um sich anzumelden.","optional":"Optional","birthDate":"Geburtsdatum","birthDateHelper":"Wir fragen nur nach Ihrem Geburtsdatum, um Funktionen zu aktivieren oder zu deaktivieren, für die Altersbeschränkungen gelten","missingData":"Fehlende Informationen","missingDataHelper":"Wir wissen, dass dies etwas nervig ist, benötigen jedoch noch einige weitere Informationen, um Ihre Registrierung abzuschließen.","goToAccountToChangeYourPreferences":"Sie können Ihre Auswahl jederzeit auf Ihrer Kontoseite ändern.","deepThoughtExplaination":"Deep Thought ist eine erweiterte Funktion der KI, die es Ihnen ermöglicht, Ihre Gespräche voll auszuschöpfen, indem Sie sie verfolgen. ","tnCAndPPAcceptedHelper":"Seit Ihrer letzten Anmeldung haben sich die AGB und Datenschutzbestimmungen geändert. ","privacyLabel":"Ich habe die gelesen und akzeptiert","privacyAndCookiePolicy":"Datenschutz und Cookie-Richtlinie","and":"Und","termsOfService":"Nutzungsbedingungen","pAndCUAccepted":"Ich akzeptiere die Nutzungsbedingungen von Deep Thought","editAccount":"Konto bearbeiten","save":"Speichern"},"success":"Erfolg","Error":"Fehler","internal server error":"Oupsie, tut mir leid... Auf dem Server ist ein Fehler aufgetreten","error":"Fehler","error.loading":"Fehler beim Laden des Inhalts.","error.generic":"Oupsie, tut mir leid ... etwas ist schief gelaufen.","error.serverNotResponding":"Wir führen Wartungsarbeiten durch oder veröffentlichen Updates. ","error.notFound":"Oupsie, wir haben die von Ihnen gesuchte Seite nicht gefunden.","error.goBackTo":"Sie können versuchen, dorthin zurückzukehren","error.reloadPage":"Laden Sie die Seite neu","error.tryAgain":"Versuchen Sie es erneut","error.unauthorized":"Es ist Ihnen nicht gestattet, diesen Inhalt anzuzeigen.","error.unprocessableEntity":"Fehler beim Verarbeiten der Anfrage. ","errors":{"TENANT_NOT_FOUND":"Mieter nicht gefunden","TENANT_REGISTRATION_DISABLED":"Die Registrierung auf dieser Plattform ist deaktiviert","TENANT_MISSING_NAME":"Mieter: Name fehlt","TENANT_MAX_USERS_REACHED":"Maximale Anzahl Benutzer erreicht","TENANT_MAX_ADMINS_REACHED":"Maximale Anzahl an Admin-Benutzern erreicht","TENANT_ALREADY_EXISTS":"Mieter existiert bereits","TENANT_MISSING_DESCRIPTION":"Mieter: Beschreibung fehlt","TENANT_CANT_SET_COMPLETION_PROVIDER":"Mandant: Abschlussanbieter kann nicht festgelegt werden","USER_NOT_CONFIRMED":"Benutzer noch nicht bestätigt","USER_NOT_FOUND":"Benutzer nicht gefunden","USER_OR_PASSWORD_INVALID":"Ungültiger Benutzer oder Passwort","USER_MUST_CHANGE_PASSWORD":"Sie müssen Ihr Passwort ändern","USER_MUST_ENTER_VERIFICATION_CODE":"Sie müssen den Bestätigungscode eingeben","USER_MISSING_TENANT":"Benutzer: Mieter fehlt","USER_MISSING_NAME":"Benutzer: Name fehlt","USER_MISSING_PASSWORD":"Benutzer: Passwort fehlt","USER_MISSING_EMAIL":"Benutzer: Fehlende E-Mail","USER_MISSING_VERIFICATION_CODE":"Benutzer: Fehlender Bestätigungscode","USER_NAME_ALREADY_USED":"Benutzername wird bereits verwendet","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"Das Passwort entspricht nicht den Sicherheitsregeln","USER_EMAIL_ALREADY_USED":"E-Mail wird bereits verwendet","USER_EMAIL_INVALID":"Ungültige E-Mail","USER_VERIFICATION_CODE_INVALID":"Ungültiger Bestätigungscode","USER_MISSING_NAME_OR_EMAIL":"Benutzername oder E-Mail fehlen","USER_NAME_INVALID":"Ungültiger Benutzername","USER_HAS_ONE_OR_MORE_MEMORI":"Der Benutzer verfügt über eine oder mehrere Erinnerungen","USER_MISSING_NEW_PASSWORD":"Benutzer: Neues Passwort fehlt","USER_NOTHING_TO_DO":"Nichts zu tun","USER_CANT_CREATE_MEMORI":"Benutzer darf Agent nicht erstellen","USER_MAX_MEMORI_REACHED":"Maximale Anzahl an Agent erreicht","USER_TOO_MANY_ATTEMPTS":"Zu viele Versuche","USER_MUST_ACCEPT_TNC_AND_PP":"Sie müssen die Allgemeinen Geschäftsbedingungen akzeptieren","USER_BIRTH_DATE_CANT_BE_CHANGED":"Das Geburtsdatum kann nicht geändert werden","USER_CANT_SET_COMPLETION_PROVIDER":"Benutzer: darf den Vervollständigungsanbieter nicht verwalten","USER_CANT_ENABLE_DEEP_THOUGHT":"Benutzer: nicht für die Verwaltung von Deep Thought aktiviert","USER_CANT_ENABLE_DCM_INTEGRATION":"Benutzer: nicht für die Verwaltung der DCM-Integration aktiviert","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"Benutzer: darf die Verkettung oder Expertengruppe nicht verwalten","USER_CREATION_BILLING_DENIED_PERMISSION":"Sie haben nicht genügend Credits, um einen Zwilling zu erstellen","USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS":"Der Benutzer verfügt über eine oder mehrere Abschlusskonfigurationen","USER_CANT_BE_DELETED":"Benutzer kann nicht gelöscht werden","MEMORI_NOT_FOUND":"Erinnerungen nicht gefunden","MEMORI_NOT_ACCESSIBLE":"Agent nicht zugänglich","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Nur der Eigentümer kann das Tag oder die PIN ändern","SESSION_NOT_FOUND":"Sitzung nicht gefunden","SESSION_IS_NOT_ADMINISTRATIVE":"Nicht-administrative Sitzung","SESSION_EXPIRED":"Sitzung abgelaufen","MEMORI_MISSING_CONFIGURATION":"Zwilling: fehlende Konfiguration","MEMORI_CONFIGURATION_NOT_FOUND":"Zwilling: Konfiguration nicht gefunden","MEMORI_INVALID_PRIVACY_TYPE":"Agent: ungültiger Datenschutztyp","MEMORI_MISSING_PASSWORD":"Zwilling: Passwort fehlt","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Agent: Gesamtzahl ungültiger Wiederherstellungstokens","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Agent: Mindestanzahl ungültiger Wiederherstellungstokens","MEMORI_INVALID_VOICE_TYPE":"Zwilling: ungültiger Stimmtyp","MEMORI_MISSING_NAME":"Zwilling: fehlender Name","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Zwilling: Fehlendes Passwort oder Wiederherstellungstoken","MEMORI_INVALID_ID":"Zwilling: ungültige ID","MEMORI_NAME_ALREADY_USED":"Zwillingsname wird bereits verwendet","MEMORI_INVALID_PIN":"Zwilling: Ungültige PIN","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Zwilling: TAG- und PIN-Änderung erfordern separate Vorgänge","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Zwilling: Im öffentlichen Zustand ist kein Passwort erforderlich","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Für „Deep Thought“ müssen Vervollständigungen aktiviert sein","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"Für die Expertengruppe müssen Vervollständigungen aktiviert sein","MEMORI_INVALID_COMPLETION_CONFIG":"Zwilling: Ungültige Abschlusskonfiguration","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Übertragung: Zielbenutzer fehlt","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Übertragung: Ungültige Zielbenutzer-ID","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Übertragung: Ungültige Zielbenutzerdaten","MEMORI_TRANSFER_NOTHING_TO_DO":"Transfer: nichts zu tun","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Speicher: Konfiguration kann nicht geändert werden","MEMORI_MISSING_NEW_PASSWORD":"Erinnerungen: Neues Passwort fehlt","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"Für die Funktion ist ein Abonnement erforderlich","INTEGRATION_NOT_FOUND":"Integration nicht gefunden","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Ungültiges Datum aus Format","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Ungültiges Datum zum Formatieren","INTEGRATION_INVALID_TYPE":"Ungültiger Integrationstyp","INTEGRATION_ALREADY_EXISTS":"Die Integration ist bereits vorhanden","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Nicht-öffentliche Erinnerungen können nicht integriert werden","INTEGRATION_MISSING_INVOCATION_TEXT":"Integration: fehlender Aufruftext","INTEGRATION_MISSING_DEVICE_EMAILS":"Integration: Fehlende Geräte-E-Mail","INTEGRATION_MEMORI_IS_EMPTY":"Leere Erinnerungen können nicht integriert werden","INTEGRATION_MISSING_PRIVACY_POLICY":"Integration: Datenschutzrichtlinie fehlt","INTEGRATION_MISSING_CATEGORY":"Integrationskategorie fehlt","INTEGRATION_MISSING_DESCRIPTION":"Fehlende Integrationsbeschreibung","INTEGRATION_INVALID_INVOCATION_TEXT":"Ungültiger Aufruftext","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home nicht mehr verfügbar","UPLOAD_REQUIRES_MULTIPART_ENCODING":"Für den Upload ist eine mehrteilige Kodierung erforderlich","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Hochladen: Inhaltstypgrenze fehlt","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: Maximale Größe überschritten","UPLOAD_FILE_IS_EMPTY":"Hochladen: leere Datei","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Hochladen: Ungültiger Dateityp oder ungültige Signatur","UPLOAD_MISSING_FILE_NAME":"Hochladen: Dateiname fehlt","UPLOAD_INVALID_MEMORY_ID":"Hochladen: Ungültige Inhalts-ID","UPLOAD_MISSING_FILE_CONTENT":"Hochladen: Dateiinhalt fehlt","ASSET_NOT_FOUND":"Asset nicht gefunden","ASSET_NOT_ACCESSIBLE":"Asset nicht zugänglich","ASSET_MISSING_SESSION_ID":"Asset: Sitzungs-ID fehlt","ASSET_INVALID_FILE_NAME":"Asset: ungültiger Dateiname","INVITATION_NOT_FOUND":"Einladung nicht gefunden","INVITATION_NOT_ACCESSIBLE":"Einladung nicht zugänglich","INVITATION_ALREADY_ACCEPTED":"Einladung bereits angenommen","INVITATION_ALREADY_REJECTED":"Einladung bereits abgelehnt","INVITATION_MISSING_DESTINATION_EMAIL":"Einladung: Ziel-E-Mail fehlt","INVITATION_DESTINATION_EMAIL_INVALID":"Einladung: Ziel-E-Mail-Adresse ungültig","INVITATION_MISSING_TAG":"Einladung: Tag fehlt","INVITATION_MISSING_PIN":"Einladung: PIN fehlt","INVITATION_INVALID_PIN":"Einladung: ungültige PIN","INVITATION_INVALID_TYPE":"Einladung: ungültiger Typ","INVITATION_MISSING_DESTINATION_NAME":"Einladung: Zielname fehlt","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Einladung: Tag und Pin können nicht geändert werden","INVITATION_CANT_BE_CHANGED":"Absicht: kann nicht geändert werden","ACTIONLOG_INVALID_USER_ID":"Ungültige Benutzer-ID","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Datum von: ungültiges Format","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Datum bis: ungültiges Format","ACTIONLOG_INVALID_MEMORI_ID":"Ungültige Memori-ID","CONSUMPTIONLOG_INVALID_TYPE":"Ungültiger Protokolltyp","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Datum von: ungültiges Format","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Datum bis: ungültiges Format","CONSUMPTIONLOG_INVALID_USER_ID":"Ungültige Benutzer-ID","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Ungültige Memori-ID","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Benachrichtigungen: Ungültiger Chat-Protokoll-Extraktionszeitraum","PROCESS_INVALID_TYPE":"Ungültiger Prozesstyp","PROCESS_ALREADY_RUNNING":"Prozess läuft bereits","PROCESS_NOT_FOUND":"Prozess nicht gefunden","IMPORTCSV_MISSING_ROWS":"CSV-Import: fehlende Zeilen","IMPORTCSV_MISSING_CSV":"CSV-Import: CSV fehlt","IMPORTCSV_MISSING_SEPARATOR":"CSV-Import: fehlendes Trennzeichen","IMPORTCSV_INVALID_SEPARATOR":"CSV-Import: Ungültiges Trennzeichen","IMPORTCSV_MISSING_HEADERS":"CSV-Import: fehlende Header","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV-Import: Titelvariantentrennzeichen fehlt","IMPORTCSV_INVALID_RECEIVER_ID":"CSV-Import: ungültige Empfänger-ID","IMPORTCSV_INVALID_MEDIA_LINK":"CSV-Import: Ungültiger Medienlink","IMPORTCSV_INVALID_LINK_TITLE_HANDLING":"CSV-Import: Ungültiger Linktitel","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"CSV-Import: Nicht erkennbare Zeichenkodierung","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"CSV-Import: Der Import in Secret Memories ist nicht möglich","IMPORTTXT_MISSING_ROWS":"TXT wird importiert: Zeilen fehlen","IMPORTTXT_INVALID_GRANULARITY":"TXT importieren: ungültige Granularität","IMPORTTXT_INVALID_RECEIVER_ID":"TXT importieren: ungültige Empfänger-ID","IMPORTTXT_INVALID_MEDIA_LINK":"TXT importieren: Ungültiger Medienlink","IMPORTTXT_INVALID_LINK_TITLE_HANDLING":"TXT importieren: ungültiger Linktitel","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"TXT-Import: Nicht erkennbare Zeichenkodierung","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"TXT-Import: Der Import in Secret Memories ist nicht möglich","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"TXT importieren: Importlimit überschritten","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"TXT importieren: Für den Import auf GPT-4 ist ein API-Schlüssel erforderlich","IMPORTTXT_IMPORT_REQUIRES_PAYING":"TXT importieren: Für den Import ist ein kostenpflichtiger Plan erforderlich","IMPORTTXT_BILLING_DENIED_PERMISSION":"TXT importieren: Sie haben nicht genügend Credits für den Vorgang","EXPORTCSV_MISSING_CSV_SPECS":"CSV-Export: CSV-Spezifikationen fehlen","EXPORTCSV_MISSING_SEPARATOR":"CSV-Export: fehlendes Trennzeichen","EXPORTCSV_INVALID_SEPARATOR":"CSV-Export: Ungültiges Trennzeichen","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV-Export: fehlendes Titelvarianten-Trennzeichen","EXPORTCSV_MISSING_NEW_LINE_CHAR":"CSV-Export: Fehlendes Zeilenumbruchzeichen","EXPORTCSV_INVALID_NEW_LINE_CHAR":"CSV-Export: Ungültiges Zeilenumbruchzeichen","EXPORTCSV_MISSING_PASSWORD":"CSV-Export: Passwort fehlt","EXPORTJSONL_MISSING_JSONL_SPECS":"JSONL-Export: JSONL-Spezifikationen fehlen","EXPORTJSONL_MISSING_PLATFORM":"JSONL-Export: fehlende Plattform","EXPORTJSONL_INVALID_PLATFORM":"JSONL-Export: ungültige Plattform","EXPORTJSONL_MISSING_PASSWORD":"JSONL-Export: Passwort fehlt","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"JSONL-Export: Für den Export ist ein kostenpflichtiger Plan erforderlich","ANALYSIS_MISSING_QUERY":"Analyse: fehlende Abfrage","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analyse: Geheime Erinnerungen können nicht analysiert werden","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analyse: Passende Benutzeranfragen erfordern tiefes Denken","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Ausweiszuweisung: falsche oder fehlende Zugangsdaten","BADGE_ASSIGNMENT_MISSING_REF_ID":"Badge-Zuordnung: Referenz-ID fehlt","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Badge-Zuweisung: Ergebnis nicht gefunden","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Badge-Zuweisung: Fehlende Behauptungs-URL","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Badge-Zuweisung: Badge-URL fehlt","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Badge-Zuweisung: Aussteller-URL fehlt","BADGE_ASSIGNMENT_INVALID_URL":"Badge-Zuweisung: Ungültige URL","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Ausweiszuordnung: fehlender Empfänger","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Badge-Zuordnung: unbekannter Empfängertyp","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Ausweiszuordnung: Empfängeridentität fehlt","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Badge-Zuweisung: Empfänger-Hash-Typ fehlt","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Badge-Zuweisung: Empfänger-Hash-Typ unbekannt","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Badge-Zuordnung: Falsche Empfängeridentität","BADGE_NOT_FOUND":"Abzeichen nicht gefunden","OUTCOME_NO_DCM_CONFIGURED":"Ergebnis: kein DCM konfiguriert","OUTCOME_USER_BADGES_DISABLED":"Ergebnis: Benutzerausweise deaktiviert","COMPLETION_CONFIG_MISSING_NAME":"Vervollständigungskonfiguration: Name fehlt","COMPLETION_CONFIG_MISSING_PROVIDER":"Vervollständigungskonfiguration: fehlender Anbieter","COMPLETION_CONFIG_MISSING_ENDPOINT":"Abschlusskonfiguration: fehlender Endpunkt","COMPLETION_CONFIG_MISSING_API_KEY":"Vervollständigungskonfiguration: fehlender API-Schlüssel","COMPLETION_CONFIG_MISSING_MODEL":"Vervollständigungskonfiguration: fehlendes Modell","COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED":"Vervollständigungskonfiguration: Es muss mindestens ein Vervollständigungstyp angegeben werden","COMPLETION_CONFIG_INVALID_NAME":"Vervollständigungskonfiguration: ungültiger Name","COMPLETION_CONFIG_INVALID_PURPOSE":"Vervollständigungskonfiguration: Ungültiger Vervollständigungstyp","COMPLETION_CONFIG_INVALID_ENDPOINT":"Abschlusskonfiguration: Ungültiger Endpunkt","COMPLETION_CONFIG_INCONSISTENT_ENDPOINT":"Abschlusskonfiguration: inkonsistenter Endpunkt","COMPLETION_CONFIG_INVALID_PROVIDER":"Vervollständigungskonfiguration: ungültiger Anbieter","COMPLETION_CONFIG_NOT_FOUND":"Vervollständigungskonfiguration: nicht gefunden","COMPLETION_CONFIG_NOT_ACCESSIBLE":"Vervollständigungskonfiguration: nicht zugänglich","COMPLETION_CONFIG_NAME_RESERVED":"Vervollständigungskonfiguration: Name reserviert","COMPLETION_CONFIG_NAME_ALREADY_EXISTS":"Vervollständigungskonfiguration: Name existiert bereits","COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED":"Vervollständigungskonfiguration: Änderung der Sichtbarkeit nicht zulässig"}}');var mG;mG=JSON.parse('{"yes":"Sí","no":"No","confirm":"Confirmar","apply":"Aplicar","cancel":"Cancelar","show":"Espectáculo","hide":"Esconder","send":"Enviar","close":"Cerca","edit":"Editar","delete":"Borrar","loading":"Cargando","expand":"Expandir","collapse":"Colapsar","fullscreenEnter":"Entrar en pantalla completa","fullscreenExit":"Salir de pantalla completa","center":"Centro","bottom":"Abajo","hidden":"Oculto","day":"Día","month":"Mes","year":"Año","createdAt":"Fecha de creación","selected":"Seleccionado","page":"página","actions":"Comportamiento","next":"Próximo","previous":"Anterior","copy":"Copiar","copyRawCode":"Copiar código sin formato","copyToClipboard":"Copiar al portapapeles","showOriginalText":"Mostrar original","showTranslatedText":"Mostrar traducción","exactPosition":"Posición exacta","uncertain":"Incierto","question":"Pregunta","nothingFound":"No se encontró nada","venue":"Evento","searchVenue":"Buscar lugar...","memoriBlockedTitle":"Obstruido","memoriBlockedUntil":"Agent bloqueado hasta {{date}}","memoriBlockedAnon":"Actualmente \\"{{name}}\\"No puedo responder, vuelve aquí. {{date}}","memoriBlockedReasonExceedChats":"porque ha superado el umbral mensual de chats permitidos.","memoriBlockedGiverHelper":"Aún podrás administrarlo como administrador, pero otros usuarios no podrán interactuar con él.","generatedByAI":"La respuesta generada por IA, ocasionalmente puede generar información incorrecta","whyThisAnswer":"¿Por qué esta respuesta?","whyThisAnswerHelper":"Esta respuesta fue generada automáticamente por una inteligencia artificial basada en estos contenidos verificados.","completionsEnabled":"La IA avanzada puede responder con respuestas generadas automáticamente que a veces pueden contener información incorrecta.","completionProviderDown":"Este Agent está integrado con una IA generativa de {{provider}}, pero actualmente no está disponible. ","completionProviderFallbackName":"un proveedor externo","completionProviderCheckStatusPage":"Comprobar página de estado","boardOfExperts":"junta de expertos","birthDate":"Fecha de nacimiento","birthDateHelper":"Solicitamos tu fecha de nacimiento únicamente para habilitar o deshabilitar funcionalidades que tienen restricciones de edad.","underage":"Debes ser al menos {{age}} años para inscribirse.","underageTwinSession":"Debes ser al menos {{age}} años para interactuar con este gemelo.","errorFetchingSession":"Error durante el cargamento de la sesión","errorGettingReferralURL":"Error durante el cargamento del référent","errorReopeningSession":"Error durante el re-abrir la sesión","ageVerification":"Verificación de edad","ageVerificationText":"Para interactuar con este Gemelo, debes tener al menos {{minAge}} años.","nsfw":"NSFW: Este gemelo contiene contenido para adultos","deepThought":"pensamiento profundo","deepThoughtHelper":"Deep Thought es una característica avanzada de la IA que te permitirá explotar al máximo tus conversaciones al realizar un seguimiento de ellas. ","deepThoughtDisclaimerTitle":"Pensamiento profundo habilitado","deepThoughtDisclaimer":"Deep Thought es una característica avanzada de la IA que te permitirá explotar al máximo tus conversaciones al realizar un seguimiento de ellas. ","deepThoughtPreDisclaimerUnlogged":"Inicie sesión para habilitar Pensamiento profundo.","deepThoughtPreDisclaimerNotAllowed":"Deep Thought está deshabilitado porque usted no dio su consentimiento para su uso; puede cambiar esto en cualquier momento en la configuración de su cuenta.","notEnoughCredits":"El autor de este Gemelo no tiene suficientes créditos para responder a tu pregunta.","knownFacts":{"title":"hechos conocidos","description":"Detalles de la información compartida entre usted y {{memoriName}}","type":"Tipo","typeShortTerm":"Corto plazo","typeLongTerm":"Largo plazo","typeHelper":"Tipos:\\n","text":"Texto","deleteSuccess":"Hecho conocido eliminado","deleteConfirmTitle":"Eliminar hecho conocido","deleteConfirmMessage":"¿Está seguro de que desea eliminar este hecho conocido?","deleteSelectedConfirmTitle":"Eliminar hechos conocidos seleccionados","deleteSelectedConfirmMessage":"¿Está seguro de que desea eliminar los hechos conocidos seleccionados?"},"auth":{"title":"Autenticación","useRecoveryTokens":"Utilice tokens de recuperación","tokens":"Fichas","addToken":"Agregar token","usePassword":"Usar contraseña","atLeast":"Al menos"},"widget":{"instruct":"Instruir","test":"Prueba","sound":"Sonido","position":"Preferencias de posición","settings":"Ajustes","share":"Compartir","sendOnKeypress":"Presiona Enter para enviar","sendOnClick":"Haga clic en Enviar","boardOfExperts":"junta de expertos","showExpertsInTheBoard":"Mostrar expertos en este foro","expertsInTheBoard":"Expertos en este foro","goToIntegrationsToCustomizeAvatar":"Para personalizar el avatar, vaya a Compartir y personalice la página pública."},"write_and_speak":{"micButtonPopover":"Haga clic en el botón para hablar","micButtonPopoverListening":"Haga clic en el botón para dejar de hablar.","pageInstructExplanation":"Para enseñarme cosas nuevas, haga clic en el botón INSTRUIRME para comenzar.","pageTryMeExplanation":"Para hablar conmigo haga clic en el botón INICIO para comenzar","instructButton":"INSTRUÍME","tryMeButton":"COMENZAR","chatHistory":"Historial de chat","exportChatHistory":"Exportar historial de chat","exportChatHistoryMessage":"¿Quieres exportar el historial de chat?","chatBotButtonText":"HAGA CLIC AQUÍ PARA ABRIR EL CHATBOT","conversationStartedLabel":"La conversación comenzó el","settingsHeaderLabel":"Configure aquí si desea configurar la memoria como voz continua y cambie los segundos de silencio si desea personalizarlos.","continuousSpeechLabel":"discurso continuo","continuousSpeechDisabled":"Discurso continuo deshabilitado porque el agente está en modo silencioso","holdToSpeak":"Mantenga para hablar","releaseToEndListening":"Suelte para finalizar la escucha","pressAndHoldToSpeak":"Mantenga presionado para hablar","microphoneMode":"Modo micrófono","hideEmissionsLabel":"Ocultar texto emitido por el Agent","secondsLabel":"Establecer segundos","controlsPosition":"Posición de los controles","tryMeHeaderLabel":"INTENTAR","unknownPosition":"Posición desconocida","fieldPlace":"Escribe el lugar (por ejemplo, \'Milano\')","showMapLinkFor":"Mostrar la posición en el mapa.","useMyPosition":"Usa mi posición","myPosition":"Tu posición","updatingPosition":"Actualizando posición...","placeNotFound":"¡Lugar no encontrado!","requirePosition":"Inserte su posición antes de comenzar","requirePositionHelp":"para hablar con {{name}} usted tiene que decidir si proporciona su puesto o no. ","dontWantToProvidePosition":"No quiero proporcionar mi puesto.","attachmentsLabel":"Enriquece tu mensaje","iWantToTalkToIn":"quiero hablar con {{name}} en"},"media":{"title":"Título","editAttributes":"Editar atributos de medios","uploadMimeTypeNotAllowed":"El tipo de archivo no está permitido.","uploadSizeLimitMessage":"El tamaño subido es demasiado grande (máx. {{size}}MEGABYTE)","uploadWrongResolutionMessage":"La resolución debe ser {{width}}incógnita{{height}} píxel","memoriNameAlreadyUsed":"Ya tienes un gemelo con este nombre.","uploadHelperImages":"Sube un archivo con extensión png, jpg, jpeg o gif, y que tenga como máximo un tamaño de {{size}}MEGABYTE","uploadHelper":"Cargue un archivo que tenga como máximo un tamaño de {{size}}MEGABYTE","uploadError":"Error al subir","square":"cuadrado","scaleRatio":"Relación de escala","addMediaLabel":"Agregar un medio","insertThisMediaMsg":"Inserte estos medios","mediaUploadMessage":"Haga clic para cargar un nuevo medio","addLinkLabel":"Agregar un enlace","linkKey":"URL","linkValue":"Título del enlace","insertThisLink":"Insertar un enlace a {{url}} con titulo {{title}}"},"gamification":{"level":"Nivel","points":"agujas","memoriReachedLevel":"se volvió más evolucionado y alcanzó el nivel","levelGoToStatistics":"{{Agent}} esta al nivel {{level}} con {{points}} agujas. ","congratulationsNewLevel":"¡Felicitaciones, has alcanzado un nuevo nivel!","congratulationsNewLevelDescription":"Tu Agent se volvió más evolucionado con {{points}} puntos, mira el","statistics":"estadística"},"login":{"login":"Acceso","logout":"Cerrar sesión","user":"Usuario","loggedDrawerTitle":"Hola, {{name}}!","loginDrawerTitle":"Acceso","signupDrawerTitle":"Inscribirse","newUserSignUp":"¿Nuevo usuario?","signUp":"¡Inscribirse!","alreadyHaveAnAccount":"¿Ya tienes una cuenta?","backToLogin":"Volver a iniciar sesión","registrationDisabled":"El registro está deshabilitado","contactAdmin":"Póngase en contacto con el administrador para solicitar acceso","userNameOrEmail":"Nombre de usuario o correo electrónico","email":"Correo electrónico","emailFormatError":"Por favor, inserte un correo electrónico válido","username":"Nombre de usuario","usernameContainsReservedWord":"El nombre de usuario contiene una palabra reservada, elija otra","usernameFormatError":"El nombre de usuario debe tener al menos 3 caracteres y contener solo letras, números y _","otpCode":"Código de verificación","resendVerificationCode":"Reenviar código","resentVerificationCode":"¡Código de confirmación enviado! ","password":"Contraseña","newPassword":"Nueva contraseña","confirmPassword":"confirmar Contraseña","currentPassword":"Contraseña actual","passwordMatchingError":"Las contraseñas no coinciden.","passwordFormatError":"La contraseña debe tener al menos 8 caracteres y contener al menos un número, una letra mayúscula, una letra minúscula y un símbolo.","pwdWeak":"Débil","pwdAcceptable":"Aceptable","pwdStrong":"Fuerte","mustChangePassword":"Debes cambiar tu contraseña","passwordChange":"Cambiar la contraseña","emailChange":"Cambiar correo electrónico","avatarChange":"Cambiar avatar","underage":"Debes ser al menos {{age}} años para inscribirse.","optional":"Opcional","birthDate":"Fecha de nacimiento","birthDateHelper":"Solicitamos tu fecha de nacimiento únicamente para habilitar o deshabilitar funcionalidades que tienen restricciones de edad.","missingData":"Información faltante","missingDataHelper":"Sabemos que esto es un poco molesto, pero necesitamos más información para completar tu registro.","goToAccountToChangeYourPreferences":"Puede cambiar su elección en cualquier momento desde la página de su Cuenta.","deepThoughtExplaination":"Deep Thought es una característica avanzada de la IA que te permitirá explotar al máximo tus conversaciones al realizar un seguimiento de ellas. ","tnCAndPPAcceptedHelper":"Desde su último inicio de sesión, los Términos y condiciones y la Política de privacidad han cambiado. ","privacyLabel":"He leído y acepto el","privacyAndCookiePolicy":"Política de privacidad y cookies","and":"y","termsOfService":"Términos de servicio","pAndCUAccepted":"Acepto los términos de servicio sobre Deep Thought","editAccount":"Editar cuenta","save":"Ahorrar"},"success":"Éxito","Error":"Error","internal server error":"Oupsie, lo siento... Algo salió mal en el servidor.","error":"Error","error.loading":"Error al cargar contenido.","error.generic":"Oupsie, lo siento... algo salió mal.","error.serverNotResponding":"Estamos realizando mantenimiento o lanzando actualizaciones. ","error.notFound":"Oupsie, no encontramos la página que buscabas.","error.goBackTo":"Puedes intentar volver al","error.reloadPage":"recargar la pagina","error.tryAgain":"Intentar otra vez","error.unauthorized":"No estás autorizado a ver este contenido.","error.unprocessableEntity":"Error al procesar la solicitud. ","errors":{"TENANT_NOT_FOUND":"Inquilino no encontrado","TENANT_REGISTRATION_DISABLED":"El registro en esta plataforma está deshabilitado","TENANT_MISSING_NAME":"Inquilino: falta el nombre","TENANT_MAX_USERS_REACHED":"Número máximo de usuarios alcanzado","TENANT_MAX_ADMINS_REACHED":"Número máximo de usuarios administradores alcanzado","TENANT_ALREADY_EXISTS":"El inquilino ya existe","TENANT_MISSING_DESCRIPTION":"Inquilino: falta descripción","TENANT_CANT_SET_COMPLETION_PROVIDER":"Inquilino: no se puede configurar el proveedor de finalización","USER_NOT_CONFIRMED":"Usuario aún no confirmado","USER_NOT_FOUND":"Usuario no encontrado","USER_OR_PASSWORD_INVALID":"Usuario o contraseña no válidos","USER_MUST_CHANGE_PASSWORD":"Debes cambiar tu contraseña","USER_MUST_ENTER_VERIFICATION_CODE":"Debes ingresar el código de verificación","USER_MISSING_TENANT":"Usuario: inquilino desaparecido","USER_MISSING_NAME":"Usuario: falta el nombre","USER_MISSING_PASSWORD":"Usuario: falta contraseña","USER_MISSING_EMAIL":"Usuario: Falta correo electrónico","USER_MISSING_VERIFICATION_CODE":"Usuario: Falta el código de verificación","USER_NAME_ALREADY_USED":"Nombre de usuario ya en uso","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"La contraseña no cumple con las reglas de seguridad.","USER_EMAIL_ALREADY_USED":"Correo electrónico ya en uso","USER_EMAIL_INVALID":"Correo electrónico no válido","USER_VERIFICATION_CODE_INVALID":"Código de verificación no válido","USER_MISSING_NAME_OR_EMAIL":"Falta nombre de usuario o correo electrónico","USER_NAME_INVALID":"Nombre de usuario no válido","USER_HAS_ONE_OR_MORE_MEMORI":"El usuario tiene uno o más recuerdos.","USER_MISSING_NEW_PASSWORD":"Usuario: falta nueva contraseña","USER_NOTHING_TO_DO":"Nada que hacer","USER_CANT_CREATE_MEMORI":"Usuario no autorizado a crear Agent","USER_MAX_MEMORI_REACHED":"Número máximo de Agent alcanzado","USER_TOO_MANY_ATTEMPTS":"demasiados intentos","USER_MUST_ACCEPT_TNC_AND_PP":"Debes aceptar los términos y condiciones.","USER_BIRTH_DATE_CANT_BE_CHANGED":"La fecha de nacimiento no se puede cambiar.","USER_CANT_SET_COMPLETION_PROVIDER":"Usuario: no tiene permiso para gestionar el proveedor de finalización","USER_CANT_ENABLE_DEEP_THOUGHT":"Usuario: no habilitado para gestionar Deep Thought","USER_CANT_ENABLE_DCM_INTEGRATION":"Usuario: no habilitado para gestionar la integración de DCM","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"Usuario: no se le permite gestionar encadenamiento o grupo de expertos","USER_CREATION_BILLING_DENIED_PERMISSION":"No tienes suficientes créditos para crear un gemelo","USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS":"El usuario tiene una o más configuraciones de finalización.","USER_CANT_BE_DELETED":"Usuario: no se puede eliminar","MEMORI_NOT_FOUND":"Memoria no encontrada","MEMORI_NOT_ACCESSIBLE":"Memorias no accesibles","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Sólo el propietario puede cambiar la etiqueta o el pin","SESSION_NOT_FOUND":"Sesión no encontrada","SESSION_IS_NOT_ADMINISTRATIVE":"Sesión no administrativa","SESSION_EXPIRED":"La sesión expiró","MEMORI_MISSING_CONFIGURATION":"Gemelo: falta configuración","MEMORI_CONFIGURATION_NOT_FOUND":"Gemelo: configuración no encontrada","MEMORI_INVALID_PRIVACY_TYPE":"Gemelo: tipo de privacidad no válido","MEMORI_MISSING_PASSWORD":"Gemelo: falta contraseña","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Gemelo: número total de tokens de recuperación no válidos","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Gemelo: número mínimo de tokens de recuperación no válidos","MEMORI_INVALID_VOICE_TYPE":"Gemelo: tipo de voz no válido","MEMORI_MISSING_NAME":"Gemelo: falta nombre","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Gemelo: falta contraseña o token de recuperación","MEMORI_INVALID_ID":"Gemelo: identificación no válida","MEMORI_NAME_ALREADY_USED":"Nombre gemelo ya en uso","MEMORI_INVALID_PIN":"Gemelo: PIN no válido","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Gemelo: el cambio de TAG y PIN requiere operaciones separadas","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Agent: no se requiere contraseña cuando es público","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Deep Thought requiere que las completaciones estén habilitadas","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"El grupo de expertos requiere que se habiliten las completaciones.","MEMORI_INVALID_COMPLETION_CONFIG":"Gemelo: configuración de finalizaciones no válidas","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Transferencia: falta usuario de destino","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Transferencia: ID de usuario de destino no válido","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Transferencia: datos de usuario de destino no válidos","MEMORI_TRANSFER_NOTHING_TO_DO":"Transferencia: nada que hacer","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Memorias: la configuración no se puede cambiar","MEMORI_MISSING_NEW_PASSWORD":"Recuerdos: falta nueva contraseña","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"La función requiere suscripción","INTEGRATION_NOT_FOUND":"Integración no encontrada","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Fecha no válida del formato","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Fecha no válida para formatear","INTEGRATION_INVALID_TYPE":"Tipo de integración no válido","INTEGRATION_ALREADY_EXISTS":"La integración ya existe","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Las memorias no públicas no se pueden integrar","INTEGRATION_MISSING_INVOCATION_TEXT":"Integración: falta texto de invocación","INTEGRATION_MISSING_DEVICE_EMAILS":"Integración: correo electrónico del dispositivo perdido","INTEGRATION_MEMORI_IS_EMPTY":"Los recuerdos vacíos no se pueden integrar","INTEGRATION_MISSING_PRIVACY_POLICY":"Integración: falta la política de privacidad","INTEGRATION_MISSING_CATEGORY":"Falta categoría de integración","INTEGRATION_MISSING_DESCRIPTION":"Falta descripción de integración","INTEGRATION_INVALID_INVOCATION_TEXT":"Texto de invocación no válido","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home ya no está disponible","UPLOAD_REQUIRES_MULTIPART_ENCODING":"La carga requiere codificación multiparte","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Subir: falta límite de tipo de contenido","UPLOAD_MAX_LENGTH_EXCEEDED":"Subir: se superó el tamaño máximo","UPLOAD_FILE_IS_EMPTY":"Subir: archivo vacío","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Subir: tipo de archivo o firma no válidos","UPLOAD_MISSING_FILE_NAME":"Subir: falta el nombre del archivo","UPLOAD_INVALID_MEMORY_ID":"Subir: ID de contenido no válido","UPLOAD_MISSING_FILE_CONTENT":"Subir: Falta contenido del archivo","ASSET_NOT_FOUND":"Activo no encontrado","ASSET_NOT_ACCESSIBLE":"Activo no accesible","ASSET_MISSING_SESSION_ID":"Activo: ID de sesión faltante","ASSET_INVALID_FILE_NAME":"Activo: nombre de archivo no válido","INVITATION_NOT_FOUND":"Invitación no encontrada","INVITATION_NOT_ACCESSIBLE":"Invitación no accesible","INVITATION_ALREADY_ACCEPTED":"Invitación ya aceptada","INVITATION_ALREADY_REJECTED":"Invitación ya rechazada","INVITATION_MISSING_DESTINATION_EMAIL":"Invitación: falta el correo electrónico de destino","INVITATION_DESTINATION_EMAIL_INVALID":"Invitación: correo electrónico de destino no válido","INVITATION_MISSING_TAG":"Invitación: falta etiqueta","INVITATION_MISSING_PIN":"Invitación: falta el PIN","INVITATION_INVALID_PIN":"Invitación: PIN no válido","INVITATION_INVALID_TYPE":"Invitación: tipo no válido","INVITATION_MISSING_DESTINATION_NAME":"Invitación: falta el nombre del destino","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invitación: la etiqueta y el pin no se pueden cambiar","INVITATION_CANT_BE_CHANGED":"Intación: no se puede cambiar","ACTIONLOG_INVALID_USER_ID":"ID de usuario no válido","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Fecha de: formato no válido","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Fecha hasta: formato no válido","ACTIONLOG_INVALID_MEMORI_ID":"ID de memoria no válida","CONSUMPTIONLOG_INVALID_TYPE":"Tipo de registro no válido","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Fecha de: formato no válido","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Fecha hasta: formato no válido","CONSUMPTIONLOG_INVALID_USER_ID":"ID de usuario no válido","CONSUMPTIONLOG_INVALID_MEMORI_ID":"ID de memoria no válida","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notificaciones: Período de extracción del registro de chat no válido","PROCESS_INVALID_TYPE":"Tipo de proceso no válido","PROCESS_ALREADY_RUNNING":"Proceso ya en ejecución","PROCESS_NOT_FOUND":"Proceso no encontrado","IMPORTCSV_MISSING_ROWS":"Importación CSV: filas faltantes","IMPORTCSV_MISSING_CSV":"Importación CSV: Falta CSV","IMPORTCSV_MISSING_SEPARATOR":"Importación CSV: falta separador","IMPORTCSV_INVALID_SEPARATOR":"Importación CSV: separador no válido","IMPORTCSV_MISSING_HEADERS":"Importación CSV: faltan encabezados","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Importación CSV: falta el separador de variante de título","IMPORTCSV_INVALID_RECEIVER_ID":"Importación CSV: ID de receptor no válido","IMPORTCSV_INVALID_MEDIA_LINK":"Importación CSV: enlace multimedia no válido","IMPORTCSV_INVALID_LINK_TITLE_HANDLING":"Importación CSV: título del enlace no válido","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"Importación CSV: codificación de caracteres indetectable","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"Importación CSV: no se puede importar a Secret Memories","IMPORTTXT_MISSING_ROWS":"Importando TXT: filas faltantes","IMPORTTXT_INVALID_GRANULARITY":"Importar TXT: granularidad no válida","IMPORTTXT_INVALID_RECEIVER_ID":"Importar TXT: ID de receptor no válido","IMPORTTXT_INVALID_MEDIA_LINK":"Importar TXT: enlace multimedia no válido","IMPORTTXT_INVALID_LINK_TITLE_HANDLING":"Importar TXT: título del enlace no válido","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"Importación TXT: codificación de caracteres indetectable","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"Importación TXT: No se puede importar a Secret Memories","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Importar TXT: límite de importación excedido","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Importar TXT: la importación en GPT-4 requiere una clave API","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Importar TXT: la importación requiere un plan de pago","IMPORTTXT_BILLING_DENIED_PERMISSION":"Importar TXT: no tienes suficientes créditos para la operación","EXPORTCSV_MISSING_CSV_SPECS":"Exportación CSV: faltan especificaciones CSV","EXPORTCSV_MISSING_SEPARATOR":"Exportación CSV: falta separador","EXPORTCSV_INVALID_SEPARATOR":"Exportación CSV: separador no válido","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Exportación CSV: falta el separador de variante de título","EXPORTCSV_MISSING_NEW_LINE_CHAR":"Exportación CSV: falta un carácter de nueva línea","EXPORTCSV_INVALID_NEW_LINE_CHAR":"Exportación CSV: carácter de nueva línea no válido","EXPORTCSV_MISSING_PASSWORD":"Exportación CSV: falta contraseña","EXPORTJSONL_MISSING_JSONL_SPECS":"Exportación JSONL: faltan especificaciones JSONL","EXPORTJSONL_MISSING_PLATFORM":"Exportación JSONL: plataforma faltante","EXPORTJSONL_INVALID_PLATFORM":"Exportación JSONL: plataforma no válida","EXPORTJSONL_MISSING_PASSWORD":"Exportación JSONL: falta contraseña","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"Exportación JSONL: la exportación requiere un plan pago","ANALYSIS_MISSING_QUERY":"Análisis: consulta faltante","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Análisis: No se pueden analizar recuerdos secretos","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Análisis: hacer coincidir la consulta del usuario requiere un pensamiento profundo","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Asignación de insignia: credenciales incorrectas o faltantes","BADGE_ASSIGNMENT_MISSING_REF_ID":"Asignación de insignia: falta el ID de referencia","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Asignación de insignia: resultado no encontrado","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Asignación de insignia: falta la URL de aserción","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Asignación de insignia: URL de insignia faltante","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Asignación de insignia: falta la URL del emisor","BADGE_ASSIGNMENT_INVALID_URL":"Asignación de insignia: URL no válida","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Asignación de insignia: destinatario faltante","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Asignación de insignia: tipo de destinatario desconocido","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Asignación de insignia: falta la identidad del destinatario","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Asignación de insignia: falta el tipo de hash del destinatario","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Asignación de insignia: tipo de hash del destinatario desconocido","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Asignación de insignia: identidad del destinatario incorrecta","BADGE_NOT_FOUND":"Insignia no encontrada","OUTCOME_NO_DCM_CONFIGURED":"Resultado: no hay ningún DCM configurado","OUTCOME_USER_BADGES_DISABLED":"Resultado: insignias de usuario deshabilitadas","COMPLETION_CONFIG_MISSING_NAME":"Configuración de terminaciones: falta nombre","COMPLETION_CONFIG_MISSING_PROVIDER":"Configuración de terminaciones: falta proveedor","COMPLETION_CONFIG_MISSING_ENDPOINT":"Configuración de terminaciones: falta punto final","COMPLETION_CONFIG_MISSING_API_KEY":"Configuración de terminaciones: falta clave API","COMPLETION_CONFIG_MISSING_MODEL":"Configuración de terminaciones: modelo faltante","COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED":"Configuración de terminaciones: se debe especificar al menos un tipo de terminaciones","COMPLETION_CONFIG_INVALID_NAME":"Configuración de terminaciones: nombre no válido","COMPLETION_CONFIG_INVALID_PURPOSE":"Configuración de terminaciones: tipo de terminaciones no válidas","COMPLETION_CONFIG_INVALID_ENDPOINT":"Configuración de terminaciones: punto final no válido","COMPLETION_CONFIG_INCONSISTENT_ENDPOINT":"Configuración de terminaciones: punto final inconsistente","COMPLETION_CONFIG_INVALID_PROVIDER":"Configuración de terminaciones: proveedor no válido","COMPLETION_CONFIG_NOT_FOUND":"Configuración de terminaciones: no encontrada","COMPLETION_CONFIG_NOT_ACCESSIBLE":"Configuración de terminaciones: no accesible","COMPLETION_CONFIG_NAME_RESERVED":"Configuración de terminaciones: nombre reservado","COMPLETION_CONFIG_NAME_ALREADY_EXISTS":"Configuración de terminaciones: el nombre ya existe","COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED":"Configuración de terminaciones: cambio de visibilidad no permitido"}}');const fG=uG({resources:{en:{translation:t(dG)},it:{translation:t(cG)},es:{translation:t(mG)},fr:{translation:t(hG)},de:{translation:t(pG)}},lng:"en",fallbackLng:"it",supportedLngs:["en","it","fr","es","de"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1}});fG.init();var gG=fG;c=o("85Hg2");function vG(e){var t=e.i18n,n=e.defaultNS,r=e.children,i=(0,c.useMemo)((function(){return{i18n:t,defaultNS:n}}),[t,n]);return(0,c.createElement)(ue.Provider,{value:i},r)}var yG=({children:e})=>(0,s.jsx)(vG,{i18n:gG,children:e});const SG=({ownerUserName:e,ownerUserID:t,memoriName:n,memoriID:r,integration:i,integrationID:o,tenantID:a,secretToken:l,sessionID:u,layout:d,customLayout:h,showShare:p=!0,showCopyButton:m=!0,showTranslationOriginal:f=!1,showSettings:g=!0,showTypingText:v=!1,showClear:y=!1,showOnlyLastMessages:S,showInputs:_=!0,showDates:b=!1,showContextPerLine:x=!1,showUpload:w,showLogin:C,height:A="100%",baseURL:E,apiURL:T="https://backend.memori.ai",engineURL:I="https://engine.memori.ai",tag:M,pin:R,context:P,initialQuestion:N,uiLang:O,spokenLang:D,multilingual:k,authToken:L,enableAudio:B,defaultSpeakerActive:z=!0,disableTextEnteredEvents:F=!1,onStateChange:U,additionalInfo:j,customMediaRenderer:G,additionalSettings:H,userAvatar:V,useMathFormatting:W=!1,autoStart:q=!1,applyVarsToRoot:J=!1})=>{var K,Y,$,X;const[Q,ee]=(0,c.useState)(),[te,ne]=(0,c.useState)(),[re,ie]=(0,c.useState)(),{t:oe}=Ce();if(!(r&&t||n&&e))throw new Error("Identifier pair required: please provide either memoriID and ownerUserID or memoriName and ownerUserName");const se=Z(T,I),ae=(0,c.useCallback)((async()=>{const e=E||(a.startsWith("https://")?a:`https://${a}`);try{const t=await fetch(`${e}/api/speechkey`),n=await t.json();n.AZURE_COGNITIVE_SERVICES_TTS_KEY?ie(n.AZURE_COGNITIVE_SERVICES_TTS_KEY):console.log("AZURE_COGNITIVE_SERVICES_TTS_KEY not found")}catch(e){console.error("Error fetching speech key",e)}}),[]);(0,c.useEffect)((()=>{ae()}),[]);const le=(0,c.useCallback)((async()=>{if(r&&t){const{memori:e,...n}=await se.backend.getMemoriByUserAndId(a,t,r);0===n.resultCode&&e?ee(e):console.error("[MEMORI]",n,e)}else if(n&&e){const{memori:t,...r}=await se.backend.getMemori(a,e,n);0===r.resultCode&&t?ee(t):console.error("[MEMORI]",r,t)}}),[r,t,n,e,a]);(0,c.useEffect)((()=>{le()}),[le,a]);const ce=(0,c.useCallback)((async()=>{const e=await WU(a,E);e&&ne(e)}),[a,T]);(0,c.useEffect)((()=>{ce()}),[ce]),(0,c.useEffect)((()=>{if(O)gG.changeLanguage(O.toLowerCase());else{const{lng:e,fallbackLng:t}=(()=>{const e=navigator.language;if(e){let t=e.split("-")[0];if(["en","it"].includes(t))return{lng:t,fallbackLng:"en"===t?"it":"en"}}return{lng:"en",fallbackLng:"it"}})();gG.changeLanguage(e).catch((()=>{gG.changeLanguage(t)}))}}),[O]);const ue=null!=i?i:null===(K=null==Q?void 0:Q.integrations)||void 0===K?void 0:K.find((e=>o?e.integrationID===o:!!e.publish&&"LANDING_EXPERIENCE"===e.type)),de=yR(null!==(Y=null==ue?void 0:ue.customData)&&void 0!==Y?Y:"{}"),he=null!=P?P:(e=>{var t;if(!e)return{};const n=null===(t=null==e?void 0:e.split(","))||void 0===t?void 0:t.reduce(((e,t)=>{const[n,r]=t.split(":").map((e=>e.trim()));return{...e,[n]:r}}),{});return n})(de.contextVars),pe=null!=N?N:de.initialQuestion;return(0,s.jsx)(yG,{children:(0,s.jsxs)(zz,{children:[(0,s.jsx)(ed.Toaster,{position:"top-center",reverseOrder:!0}),Q?(0,s.jsx)(HU,{layout:d,customLayout:h,height:A,baseUrl:E||(a.startsWith("https://")?a:`https://${a}`),apiURL:T,engineURL:I,memori:{...Q,secretToken:l},ownerUserName:null!=e?e:Q.ownerUserName,ownerUserID:null!=t?t:Q.ownerUserID,tenantID:a,memoriLang:null!=D?D:null===(X=null===($=Q.culture)||void 0===$?void 0:$.split("-"))||void 0===X?void 0:X[0],multilingual:k,tenant:te,secret:l,sessionID:u,showShare:p,showCopyButton:m,showTranslationOriginal:f,showSettings:g,showTypingText:v,showClear:y,showOnlyLastMessages:S,showInputs:_,showDates:b,showContextPerLine:x,showLogin:null!=C?C:null==Q?void 0:Q.enableDeepThought,showUpload:w,integration:ue,initialContextVars:he,initialQuestion:pe,authToken:L,AZURE_COGNITIVE_SERVICES_TTS_KEY:re,autoStart:q,enableAudio:B&&!!re,defaultSpeakerActive:z,disableTextEnteredEvents:F,onStateChange:U,additionalInfo:j,customMediaRenderer:G,additionalSettings:H,userAvatar:V,useMathFormatting:W,applyVarsToRoot:J,...M&&R?{personification:{tag:M,pin:R}}:{}}):(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,s.jsxs)("p",{style:{textAlign:"center",margin:"2rem auto",textTransform:"capitalize"},children:[oe("loading")||"Loading","..."]})})]})})};SG.propTypes={memoriName:t(l).string,memoriID:t(l).string,ownerUserName:t(l).string,ownerUserID:t(l).string,integrationID:t(l).string,integration:t(l).any,tenantID:t(l).string.isRequired,secretToken:t(l).string,sessionID:t(l).string,layout:t(l).oneOf(["DEFAULT","FULLPAGE","TOTEM","WEBSITE_ASSISTANT","CHAT","HIDDEN_CHAT","ZOOMED_FULL_BODY"]),customLayout:t(l).any,showShare:t(l).bool,showCopyButton:t(l).bool,showTranslationOriginal:t(l).bool,showInputs:t(l).bool,showDates:t(l).bool,showContextPerLine:t(l).bool,showSettings:t(l).bool,showClear:t(l).bool,showOnlyLastMessages:t(l).bool,showTypingText:t(l).bool,showLogin:t(l).bool,showUpload:t(l).bool,height:t(l).oneOfType([t(l).string,t(l).number]),baseURL:t(l).string,apiURL:t(l).string,engineURL:t(l).string,tag:t(l).string,pin:t(l).string,context:t(l).objectOf(t(l).any),initialQuestion:t(l).string,uiLang:t(l).oneOf(["en","it","fr","es","de","EN","IT","FR","ES","DE"]),spokenLang:t(l).string,multilingual:t(l).bool,authToken:t(l).string,enableAudio:t(l).bool,defaultSpeakerActive:t(l).bool,disableTextEnteredEvents:t(l).bool,onStateChange:t(l).func,additionalInfo:t(l).objectOf(t(l).any),customMediaRenderer:t(l).func,additionalSettings:t(l).any,userAvatar:t(l).oneOfType([t(l).string,t(l).any]),useMathFormatting:t(l).bool,autoStart:t(l).bool,applyVarsToRoot:t(l).bool};var _G=SG;const bG=e=>{try{return JSON.parse(e)}catch(e){return null}};class xG extends HTMLElement{connectedCallback(){const e=document.createElement("div"),n=document.createElement("div");n.setAttribute("id","memori-root"),e.appendChild(n),this.appendChild(e);const r=Object.keys(_G.propTypes).reduce(((e,t)=>(this.hasAttribute(t)&&(e[t]=this.getAttribute(t),"true"!==e[t]&&"false"!==e[t]||(e[t]="true"===e[t])),e)),{}),i=this.getAttribute("tenantId"),o=this.getAttribute("context")?.split(",")?.reduce(((e,t)=>{const[n,r]=t.split(":").map((e=>e.trim()));return{...e,[n]:r}}),{}),l=bG(this.getAttribute("additionalInfo")||"{}")||{},c=this.getAttribute("integration"),u=c&&bG(c)||void 0;i?t(a).render((0,s.jsx)(_G,{...r,context:o,tenantID:i,additionalInfo:l,integration:u}),n):console.error("No tenantId attribute found")}}customElements.define("memori-client",xG)})();
258
+ */function kF(e,t=0){const n=[];return e.forEach((function(e,r){let i=null;e.forEach((function(o,s){if(!o&&null!==i)return n.push(`M${i+t} ${r+t}h${s-i}v1H${i+t}z`),void(i=null);if(s!==e.length-1)o&&null===i&&(i=s);else{if(!o)return;null===i?n.push(`M${s+t},${r+t} h1v1H${s+t}z`):n.push(`M${i+t},${r+t} h${s+1-i}v1H${i+t}z`)}}))})),n.join("")}function LF(e,t){return e.slice().map(((e,n)=>n<t.y||n>=t.y+t.h?e:e.map(((e,n)=>(n<t.x||n>=t.x+t.w)&&e))))}function BF(e,t,n,r){if(null==r)return null;const i=n?4:0,o=e.length+2*i,s=Math.floor(.1*t),a=o/t,l=(r.width||s)*a,c=(r.height||s)*a,u=null==r.x?e.length/2-l/2:r.x*a,d=null==r.y?e.length/2-c/2:r.y*a;let h=null;if(r.excavate){let e=Math.floor(u),t=Math.floor(d);h={x:e,y:t,w:Math.ceil(l+u-e),h:Math.ceil(c+d-t)}}return{x:u,y:d,h:c,w:l,excavation:h}}var zF=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}();function FF(e){const n=e,{value:r,size:i=RF,level:o=PF,bgColor:s=NF,fgColor:a=OF,includeMargin:l=DF,style:u,imageSettings:d}=n,h=TF(n,["value","size","level","bgColor","fgColor","includeMargin","style","imageSettings"]),p=null==d?void 0:d.src,m=(0,c.useRef)(null),f=(0,c.useRef)(null),[g,v]=(0,c.useState)(!1);(0,c.useEffect)((()=>{if(null!=m.current){const e=m.current,t=e.getContext("2d");if(!t)return;let n=IF.QrCode.encodeText(r,MF[o]).getModules();const c=l?4:0,u=n.length+2*c,h=BF(n,i,l,d),p=f.current,g=null!=h&&null!==p&&p.complete&&0!==p.naturalHeight&&0!==p.naturalWidth;g&&null!=h.excavation&&(n=LF(n,h.excavation));const v=window.devicePixelRatio||1;e.height=e.width=i*v;const y=i/u*v;t.scale(y,y),t.fillStyle=s,t.fillRect(0,0,u,u),t.fillStyle=a,zF?t.fill(new Path2D(kF(n,c))):n.forEach((function(e,n){e.forEach((function(e,r){e&&t.fillRect(r+c,n+c,1,1)}))})),g&&t.drawImage(p,h.x+c,h.y+c,h.w,h.h)}})),(0,c.useEffect)((()=>{v(!1)}),[p]);const y=EF({height:i,width:i},u);let S=null;return null!=p&&(S=t(c).createElement("img",{src:p,key:p,style:{display:"none"},onLoad:()=>{v(!0)},ref:f})),t(c).createElement(t(c).Fragment,null,t(c).createElement("canvas",EF({style:y,height:i,width:i,ref:m},h)),S)}var UF=({tenant:e,url:n,title:r="",className:i,baseUrl:o,primary:a=!0,showQrCode:l=!0,align:u="right"})=>{const{t:d}=Ce(),[h,p]=(0,c.useState)(n),m=(0,c.useMemo)((()=>(null==e?void 0:e.theme)?`${null!=o?o:"https://aisuru.com"}/images/${e.theme}/square_logo.png`:`${null!=o?o:"https://aisuru.com"}/images/memori_logo.png`),[e,o]);(0,c.useEffect)((()=>{n||p(window.location.href)}),[n]);const f=[{id:"facebook",title:"Facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${h}`,icon:hF},{id:"twitter",title:"Twitter",url:`https://twitter.com/intent/tweet?url=${h}`,icon:pF},{id:"linkedin",title:"LinkedIn",url:`https://www.linkedin.com/shareArticle?mini=true&title=${r}&url=${h}`,icon:mF},{id:"whatsapp",title:"Whatsapp",url:`https://api.whatsapp.com/send?phone=&text=${h}`,icon:fF},{id:"telegram",title:"Telegram",url:`https://t.me/share/url?text=${r}&url=${h}`,icon:_F},{id:"email",title:"Email",url:`mailto:?subject=${(null==r?void 0:r.length)>0?r:n}&body=${h}`,icon:gF}];return(0,s.jsxs)(WN,{as:"div",className:t(Cs)("memori-share-button",{"memori-share-button--align-left":"left"===u}),children:[(0,s.jsx)(WN.Button,{className:t(Cs)("memori-button","memori-button--circle","memori-button--icon-only","memori-share-button--button",i,{"memori-button--primary":a}),title:d("widget.share")||void 0,children:(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)(vF,{})})}),(0,s.jsxs)(WN.Items,{className:"memori-share-button--overlay",as:"ul",children:[(0,s.jsx)(WN.Item,{as:"li",className:"memori-share-button--li",children:(0,s.jsx)(Em,{className:"memori-share-button--link",ghost:!0,icon:(0,s.jsx)(pO,{}),onClick:()=>{h&&navigator.clipboard.writeText(h)},children:d("copyToClipboard")||void 0})},"copy"),f.map((e=>{var n;return(0,s.jsx)(WN.Item,{as:"li",className:"memori-share-button--li",children:(0,s.jsxs)("a",{className:t(Cs)("memori-button","memori-button--with-icon","memori-button--ghost","memori-button--padded","memori-share-button--link"),href:null!==(n=e.url)&&void 0!==n?n:"",target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)("div",{className:"memori-button--icon",children:(0,s.jsx)(e.icon,{})}),e.title]})},e.id)})),l&&(0,s.jsxs)(WN.Item,{as:"li",className:"memori-share-button--li-qr-code",children:[(0,s.jsx)(FF,{id:"qr-canvas",value:null!=h?h:"",size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H",includeMargin:!1,imageSettings:{src:m,x:void 0,y:void 0,height:32,width:32,excavate:!0}}),(0,s.jsx)("div",{children:(0,s.jsx)(Em,{onClick:()=>{const e=document.getElementById("qr-canvas");if(!e)return;const t=document.createElement("a");t.href=e.toDataURL(),t.download=`memori-${r}-share.png`,document.body.appendChild(t),t.click(),document.body.removeChild(t)},icon:(0,s.jsx)(yF,{}),title:"Download QR",children:"Download"})})]},"qrcode")]})]})};var jF=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M290 236.4l43.9-43.9a8.01 8.01 0 0 0-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0 0 13.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 0 0 0 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 0 0-11.3 0l-42.4 42.3a8.03 8.03 0 0 0 0 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 0 0 4.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 0 0-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 0 0-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z"})});var GF=({className:e,title:t})=>(0,s.jsxs)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",focusable:"false",role:"img",className:e,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2","aria-label":t,children:[(0,s.jsx)("path",{d:"M23 4L23 10 17 10"}),(0,s.jsx)("path",{d:"M1 20L1 14 7 14"}),(0,s.jsx)("path",{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"})]});var HF=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6c-.3 1.5-.4 3-.4 4.4 0 14.4 11.6 26 26 26h723c1.5 0 3-.1 4.4-.4 14.2-2.4 23.7-15.9 21.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z"})});var VF=({className:e,memori:n,tenant:r,history:i,position:o,setShowPositionDrawer:a,setShowSettingsDrawer:l,setShowKnownFactsDrawer:u,setShowExpertsDrawer:d,enableAudio:h=!0,speakerMuted:p,setSpeakerMuted:m,hasUserActivatedSpeak:f=!1,showShare:g=!0,showSettings:v=!0,showSpeaker:y=!0,showReload:S=!1,showClear:_=!1,showLogin:b=!0,setShowLoginDrawer:x,clearHistory:w,loginToken:C,user:A,sessionID:E})=>{const{t:T}=Ce(),[I,M]=(0,c.useState)(!1),[R,P]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{document.fullscreenEnabled&&M(!0)}),[]),(0,s.jsxs)("div",{className:t(Cs)("memori-header",e),children:[n.needsPosition&&o&&(0,s.jsxs)("div",{className:"memori-header--position",children:[0!==o.latitude&&0!==o.longitude&&(0,s.jsx)("span",{className:"memori-header--position-placeName",children:o.placeName}),(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--position",title:T("widget.position")||"Position",icon:(0,s.jsx)(lD,{}),onClick:()=>a(!0)})]}),S&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--reload",title:T("reload")||"Reload",icon:(0,s.jsx)(GF,{}),onClick:()=>{window.location.reload()}}),_&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--clear",title:T("clearHistory")||"Clear chat",icon:(0,s.jsx)(HF,{}),onClick:w}),I&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--fullscreen",title:R?T("fullscreenExit")||"Exit fullscreen":T("fullscreenEnter")||"Enter fullscreen",icon:R?(0,s.jsx)(zO,{}):(0,s.jsx)(jF,{}),onClick:()=>{if(document.fullscreenElement){if(document.exitFullscreen){const e=document.querySelector(".memori-widget");e&&(e.style.backgroundColor=""),document.exitFullscreen().catch((e=>{console.warn("Error attempting to exit fullscreen:",e)})),P(!1)}}else{const e=document.querySelector(".memori-widget");e&&(e.style.backgroundColor="#FFFFFF",e.requestFullscreen().catch((e=>{console.warn("Error attempting to enable fullscreen:",e)}))),P(!0)}}}),n.enableDeepThought&&!!C&&(null==A?void 0:A.pAndCUAccepted)&&(0,s.jsx)(Em,{primary:!!E&&!!f,shape:"circle",icon:(0,s.jsx)(oD,{}),className:"memori-header--button memori-header--button--knownfacts",disabled:!f||!E,onClick:()=>u(!0),title:T("knownFacts.title")||"Known facts"}),n.enableBoardOfExperts&&(0,s.jsx)(Em,{primary:!0,shape:"circle",icon:(0,s.jsx)(iD,{}),className:"memori-header--button memori-header--button--experts",disabled:!f||!E,onClick:()=>d(!0),title:T("widget.showExpertsInTheBoard")||"Experts in this board"}),h&&y&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button--speaker",icon:p?(0,s.jsx)(jz,{}):(0,s.jsx)(Hz,{}),onClick:()=>m(!p),title:T("widget.sound")||"Sound"}),(0,s.jsx)(uF,{history:i,memori:n,className:"memori-header--button memori-header--button--export",disabled:!f||0===i.length}),v&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button-settings",icon:(0,s.jsx)(dF,{}),onClick:()=>l(!0),title:T("widget.settings")||"Settings"}),g&&(0,s.jsx)(UF,{className:"memori-header--button memori-header--button-share",title:n.name,tenant:r,showQrCode:!0,align:"left"}),b&&(0,s.jsx)(Em,{primary:!0,shape:"circle",className:"memori-header--button memori-header--button-login",icon:(0,s.jsx)(EN,{}),onClick:()=>x(!0),title:C?T("login.user")||"User":T("login.login")||"Login"})]})};var WF=({tenant:e,userLang:t="en",integrationID:n,memoriHash:r})=>{const i="memorytwin"===(null==e?void 0:e.theme)?"memorytwin":"twincreator"===(null==e?void 0:e.theme)?"twincreator":"aisuru";return(0,s.jsxs)("div",{className:"memori--powered-by",children:[(0,s.jsx)("img",{src:`https://aisuru.com/images/${i}/logo.png`,alt:""}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"sr-only",children:"Powered by"}),(0,s.jsx)("a",{href:`https://memori.ai/${"it"===(null==t?void 0:t.toLowerCase())?"it":"en"}${n?`?integrationID=${n}`:""}${r?`${n?"&":"?"}memori=${r}`:""}`,target:"_blank",rel:"noopener noreferrer",children:"Memori.AI"})]})]})};c=o("85Hg2");var qF=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false",role:"img",className:e,fill:"currentColor","aria-label":t,children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z",clipRule:"evenodd"})});const JF={en:["January","February","March","April","May","June","July","August","September","October","November","December"],it:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},KF=(0,c.memo)((({defaultDate:e,onChange:t,disabled:n=!1})=>{const{t:r,i18n:i}=Ce(),[o,a]=(0,c.useState)(e?"string"==typeof e?As.DateTime.fromISO(e):As.DateTime.fromJSDate(e):As.DateTime.now());return(0,c.useEffect)((()=>{t(o)}),[o,t]),(0,s.jsxs)("div",{className:"memori--date-selector",children:[(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(tz,{value:o,onChange:e=>{a(e)},disabled:n,name:"day",children:[(0,s.jsxs)(tz.Label,{className:"memori--date-selector__select-label",children:[r("day"),":"]}),(0,s.jsxs)(tz.Button,{"aria-label":r("day"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:o.day}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(qF,{})})]}),(0,s.jsx)(lp,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(tz.Options,{className:"memori--date-selector__select-options",children:[...Array(31).keys()].map((e=>(0,s.jsx)(tz.Option,{value:o.set({day:e+1}),className:"memori--date-selector__select-option",children:e+1},e)))})})]})}),(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(tz,{value:o,onChange:e=>{a(e)},disabled:n,name:"month",children:[(0,s.jsxs)(tz.Label,{className:"memori--date-selector__select-label",children:[r("month"),":"]}),(0,s.jsxs)(tz.Button,{"aria-label":r("month"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:JF["it"===i.language?"it":"en"][o.month-1]}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(qF,{})})]}),(0,s.jsx)(lp,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(tz.Options,{className:"memori--date-selector__select-options",children:JF["it"===i.language?"it":"en"].map((e=>(0,s.jsx)(tz.Option,{className:"memori--date-selector__select-option",value:o.set({month:JF["it"===i.language?"it":"en"].findIndex((t=>t===e))+1}),children:e},e)))})})]})}),(0,s.jsx)("div",{className:"memori--date-selector__select",children:(0,s.jsxs)(tz,{value:o,onChange:e=>{a(e)},disabled:n,name:"year",children:[(0,s.jsxs)(tz.Label,{className:"memori--date-selector__select-label",children:[r("year"),":"]}),(0,s.jsxs)(tz.Button,{"aria-label":r("year"),className:"memori--date-selector__select-button",children:[(0,s.jsx)("span",{className:"memori--date-selector__select--value",children:o.year}),(0,s.jsx)("span",{className:"memori--date-selector__select--icon",children:(0,s.jsx)(qF,{})})]}),(0,s.jsx)(lp,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(tz.Options,{className:"memori--date-selector__select-options",children:[...Array(As.DateTime.now().year-1899).keys()].sort(((e,t)=>t-e)).map((e=>(0,s.jsx)(tz.Option,{value:o.set({year:e+1900}),className:"memori--date-selector__select-option",children:e+1900},e)))})})]})})]})}));KF.displayName="DateSelector";var YF=KF;c=o("85Hg2");var $F=({visible:e=!1,onClose:n,minAge:r})=>{const{t:i}=Ce(),[o,a]=(0,c.useState)(),[l,u]=(0,c.useState)(),[d,h]=(0,c.useState)(!1),p=(0,c.useCallback)((()=>{if(h(!0),!o)return t(ed).error(i("requiredField")),u(i("requiredField")||"Required field"),void h(!1);if(As.DateTime.now().diff(o,"years").years<r)return t(ed).error(i("underageTwinSession",{age:r})),u(i("underageTwinSession",{age:r})||`You must be at least ${r} years old to interact with this Agent`),void h(!1);n(o.toJSDate().toISOString())}),[o,r,n,i]);return(0,s.jsxs)(nP,{open:e,title:i("ageVerification"),className:"age-verification-modal",closable:!0,onClose:()=>n(),children:[(0,s.jsx)("p",{children:i("ageVerificationText",{minAge:r})}),(0,s.jsxs)("form",{className:"age-verification-form",onSubmit:e=>{e.preventDefault(),p()},children:[(0,s.jsx)("div",{className:"form-item",children:(0,s.jsxs)("fieldset",{name:"birthDate",children:[(0,s.jsx)("legend",{className:"sr-only",children:i("birthDate")}),(0,s.jsx)(YF,{defaultDate:new Date(Date.now()),onChange:e=>{a(e)}}),(0,s.jsx)("p",{className:"form-item-help",children:i("birthDateHelper")}),l&&(0,s.jsx)("p",{className:"form-item-error",children:l})]})}),(0,s.jsx)("div",{className:"form-item form-submit",children:(0,s.jsx)(Em,{primary:!0,htmlType:"submit",className:"age-verification-submit",loading:d,disabled:!o,children:i("confirm")})})]})]})};c=o("85Hg2");var XF=({label:e,className:n,disabled:r=!1,indeterminate:i=!1,checked:o,children:a,onChange:l,name:u,...d})=>{const h=(0,c.useRef)(null);return(0,c.useEffect)((()=>{h.current&&(h.current.indeterminate=i)}),[h,i]),(0,s.jsxs)("label",{className:t(Cs)("memori-checkbox",n,{"memori-checkbox--disabled":r,"memori-checkbox--indeterminate":i}),children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{ref:h,type:"checkbox",...d,name:u,disabled:r,checked:o||i,className:"memori-checkbox--input",onChange:l}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),!!(null==e?void 0:e.length)&&(0,s.jsx)("span",{className:"memori-checkbox--text",children:e})]})};c=o("85Hg2");var QF=({className:e,value:n,name:r,displayValue:i,options:o,onChange:a,disabled:l=!1,label:u,placeholder:d})=>(0,s.jsx)("div",{className:t(Cs)("memori-select",e),children:(0,s.jsxs)(tz,{value:n,onChange:e=>{a(e)},disabled:l,name:r,children:[u&&(0,s.jsxs)(tz.Label,{className:"memori-select--label",children:[u,":"]}),(0,s.jsxs)(tz.Button,{"aria-label":u,className:"memori-select--button",children:[(0,s.jsx)("span",{className:t(Cs)("memori-select--value",{"memori-select--value-placeholder":!n}),children:n?i||n:d}),(0,s.jsx)("span",{className:"memori-select--icon",children:(0,s.jsx)(qF,{})})]}),(0,s.jsx)(lp,{as:c.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)(tz.Options,{className:"memori-select--options",children:o.map((e=>(0,s.jsx)(tz.Option,{value:e.value,className:"memori-select--option",children:e.label},e.value)))})})]})});c=o("85Hg2"),c=o("85Hg2");function ZF(e=0){let[t,n]=(0,c.useState)(e),r=(0,c.useCallback)((e=>n((t=>t|e))),[t]),i=(0,c.useCallback)((e=>Boolean(t&e)),[t]),o=(0,c.useCallback)((e=>n((t=>t&~e))),[n]),s=(0,c.useCallback)((e=>n((t=>t^e))),[n]);return{addFlag:r,hasFlag:i,removeFlag:o,toggleFlag:s}}let eU=(0,(c=o("85Hg2")).createContext)(null);function tU(){let e=(0,c.useContext)(eU);if(null===e){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,tU),e}return e}function nU(){let[e,n]=(0,c.useState)([]);return[e.length>0?e.join(" "):void 0,(0,c.useMemo)((()=>function(e){let r=Dh((e=>(n((t=>[...t,e])),()=>n((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),i=(0,c.useMemo)((()=>({register:r,slot:e.slot,name:e.name,props:e.props})),[r,e.slot,e.name,e.props]);return t(c).createElement(eU.Provider,{value:i},e.children)}),[n])]}let rU=bh((function(e,t){let{passive:n=!1,...r}=e,i=tU(),o=`headlessui-label-${fp()}`,s=Bh(t);Mh((()=>i.register(o)),[o,i.register]);let a={ref:s,...i.props,id:o};return n&&("onClick"in a&&delete a.onClick,"onClick"in r&&delete r.onClick),yh({ourProps:a,theirProps:r,slot:i.slot||{},defaultTag:"label",name:i.name||"Label"})}));var iU,oU=((iU=oU||{})[iU.RegisterOption=0]="RegisterOption",iU[iU.UnregisterOption=1]="UnregisterOption",iU);let sU={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:Rp(n,(e=>e.element.current))}},1(e,t){let n=e.options.slice(),r=e.options.findIndex((e=>e.id===t.id));return-1===r?e:(n.splice(r,1),{...e,options:n})}},aU=(0,c.createContext)(null);function lU(e){let t=(0,c.useContext)(aU);if(null===t){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,lU),t}return t}function cU(e,t){return mh(t.type,sU,e,t)}aU.displayName="RadioGroupContext";let uU=bh((function(e,n){let{value:r,defaultValue:i,name:o,onChange:s,by:a=((e,t)=>e===t),disabled:l=!1,...u}=e,d=Dh("string"==typeof a?(e,t)=>{let n=a;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:a),[h,p]=(0,c.useReducer)(cU,{options:[]}),m=h.options,[f,g]=nU(),[v,y]=rm(),S=`headlessui-radiogroup-${fp()}`,_=(0,c.useRef)(null),b=Bh(_,n),[x,w]=MR(r,s,i),C=(0,c.useMemo)((()=>m.find((e=>!e.propsRef.current.disabled))),[m]),A=(0,c.useMemo)((()=>m.some((e=>d(e.propsRef.current.value,x)))),[m,x]),E=Dh((e=>{var t;if(l||d(e,x))return!1;let n=null==(t=m.find((t=>d(t.propsRef.current.value,e))))?void 0:t.propsRef.current;return(null==n||!n.disabled)&&(null==w||w(e),!0)}));xR({container:_.current,accept:e=>"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let T=Dh((e=>{let t=_.current;if(!t)return;let n=yp(t),r=m.filter((e=>!1===e.propsRef.current.disabled)).map((e=>e.element.current));switch(e.key){case up.Enter:IR(e.currentTarget);break;case up.ArrowLeft:case up.ArrowUp:if(e.preventDefault(),e.stopPropagation(),Np(r,bp.Previous|bp.WrapAround)===xp.Success){let e=m.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&E(e.propsRef.current.value)}break;case up.ArrowRight:case up.ArrowDown:if(e.preventDefault(),e.stopPropagation(),Np(r,bp.Next|bp.WrapAround)===xp.Success){let e=m.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&E(e.propsRef.current.value)}break;case up.Space:{e.preventDefault(),e.stopPropagation();let t=m.find((e=>e.element.current===(null==n?void 0:n.activeElement)));t&&E(t.propsRef.current.value)}}})),I=Dh((e=>(p({type:0,...e}),()=>p({type:1,id:e.id})))),M=(0,c.useMemo)((()=>({registerOption:I,firstOption:C,containsCheckedOption:A,change:E,disabled:l,value:x,compare:d})),[I,C,A,E,l,x,d]),R={ref:b,id:S,role:"radiogroup","aria-labelledby":f,"aria-describedby":v,onKeyDown:T},P=(0,c.useMemo)((()=>({value:x})),[x]);return t(c).createElement(y,{name:"RadioGroup.Description"},t(c).createElement(g,{name:"RadioGroup.Label"},t(c).createElement(aU.Provider,{value:M},null!=o&&null!=x&&AR({[o]:x}).map((([e,n])=>t(c).createElement(vp,{features:gp.Hidden,...xh({key:e,as:"input",type:"radio",checked:null!=n,hidden:!0,readOnly:!0,name:e,value:n})}))),yh({ourProps:R,theirProps:u,slot:P,defaultTag:"div",name:"RadioGroup"}))))}));var dU=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(dU||{});let hU=bh((function(e,n){let r=(0,c.useRef)(null),i=Bh(r,n),o=`headlessui-radiogroup-option-${fp()}`,[s,a]=nU(),[l,u]=rm(),{addFlag:d,removeFlag:h,hasFlag:p}=ZF(1),{value:m,disabled:f=!1,...g}=e,v=(0,c.useRef)({value:m,disabled:f});Mh((()=>{v.current.value=m}),[m,v]),Mh((()=>{v.current.disabled=f}),[f,v]);let{registerOption:y,disabled:S,change:_,firstOption:b,containsCheckedOption:x,value:w,compare:C}=lU("RadioGroup.Option");Mh((()=>y({id:o,element:r,propsRef:v})),[o,y,r,e]);let A=Dh((e=>{var t;if(dp(e.currentTarget))return e.preventDefault();!_(m)||(d(2),null==(t=r.current)||t.focus())})),E=Dh((e=>{if(dp(e.currentTarget))return e.preventDefault();d(2)})),T=Dh((()=>h(2))),I=(null==b?void 0:b.id)===o,M=S||f,R=C(w,m),P={ref:i,id:o,role:"radio","aria-checked":R?"true":"false","aria-labelledby":s,"aria-describedby":l,"aria-disabled":!!M||void 0,tabIndex:M?-1:R||!x&&I?0:-1,onClick:M?void 0:A,onFocus:M?void 0:E,onBlur:M?void 0:T},N=(0,c.useMemo)((()=>({checked:R,disabled:M,active:p(2)})),[R,M,p]);return t(c).createElement(u,{name:"RadioGroup.Description"},t(c).createElement(a,{name:"RadioGroup.Label"},yh({ourProps:P,theirProps:g,slot:N,defaultTag:"div",name:"RadioGroup.Option"})))})),pU=Object.assign(uU,{Option:hU,Label:rU,Description:im});const mU=[2,3,5,10,15,20,30,60];var fU=({open:e,layout:t="DEFAULT",onClose:n,speakerMuted:r,microphoneMode:i="HOLD_TO_TALK",continuousSpeechTimeout:o,setMicrophoneMode:a,setContinuousSpeechTimeout:l,controlsPosition:c,setControlsPosition:u,hideEmissions:d,setHideEmissions:h,additionalSettings:p,avatarType:m,setAvatarType:f,enablePositionControls:g,setEnablePositionControls:v,isAvatar3d:y})=>{const{t:S}=Ce();return(0,s.jsxs)(Im,{className:"memori-settings-drawer",open:e,onClose:n,title:S("widget.settings")||"Settings",description:S("write_and_speak.settingsHeaderLabel"),children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"#microphoneMode",children:[S("write_and_speak.microphoneMode")||"Microphone mode",":"]}),(0,s.jsxs)(pU,{id:"microphoneMode",name:"microphoneMode",value:i,defaultValue:i,className:"memori-settings-drawer--microphoneMode-radio",onChange:e=>{let t="CONTINUOUS"===e?"CONTINUOUS":"HOLD_TO_TALK";a(t),BB("microphoneMode",t)},children:[(0,s.jsx)(pU.Option,{value:"HOLD_TO_TALK",className:"memori-settings-drawer--microphoneMode-radio-button",children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,children:S("write_and_speak.holdToSpeak")||"Hold to speak"})}),(0,s.jsx)(MN,{content:r?S("write_and_speak.continuousSpeechDisabled"):"",disabled:!r,children:(0,s.jsx)(pU.Option,{value:"CONTINUOUS",className:"memori-settings-drawer--microphoneMode-radio-button "+(r?"memori-settings-drawer--microphoneMode-radio-button-disabled":""),children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,disabled:r,children:S("write_and_speak.continuousSpeechLabel")||"Continuous speech"})})})]})]}),"CONTINUOUS"===i&&(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(QF,{label:S("write_and_speak.secondsLabel")||"Seconds",placeholder:S("write_and_speak.secondsLabel")||"Seconds",options:mU.map((e=>({value:e,label:e}))),value:o,onChange:e=>{l(e),BB("continuousSpeechTimeout",e)}})}),"TOTEM"===t&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"#controlsPosition",children:[S("write_and_speak.controlsPosition")||"Controls",":"]}),(0,s.jsxs)(pU,{id:"controlsPosition",name:"controlsPosition",value:c,defaultValue:c,className:"memori-settings-drawer--controlsposition-radio",onChange:e=>{u(e),BB("controlsPosition",e)},children:[(0,s.jsx)(pU.Option,{value:"center",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,children:S("center")||"Center"})}),(0,s.jsx)(pU.Option,{value:"bottom",className:"memori-settings-drawer--controlsposition-radio-button",children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,children:S("bottom")||"Bottom"})})]})]}),y&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"memori-settings-drawer--field controls",children:[(0,s.jsxs)("label",{htmlFor:"avatarType",className:"memori-settings-drawer-label",children:[S("write_and_speak.avatarType")||"Avatar type",":"]}),(0,s.jsxs)(pU,{id:"avatarType",name:"avatarType",value:m,defaultValue:m,className:"memori-settings-drawer--avatarType-radio",onChange:e=>{f&&f(e),BB("avatarType",e)},children:[(0,s.jsx)(pU.Option,{value:"blob",className:"memori-settings-drawer--avatarType-radio-button",children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,children:S("write_and_speak.blob")||"Blob"})}),(0,s.jsx)(pU.Option,{value:"avatar3d",className:"memori-settings-drawer--avatarType-radio-button",children:({checked:e})=>(0,s.jsx)(Em,{primary:e,outlined:!e,children:S("write_and_speak.avatar3d")||"Avatar 3D"})})]})]}),(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(XF,{label:S("write_and_speak.enablePositionControls")||"Enable position controls",name:"enablePositionControls",checked:g,onChange:e=>{v(e.target.checked)}})})]}),(0,s.jsx)("div",{className:"memori-settings-drawer--field",children:(0,s.jsx)(XF,{label:S("write_and_speak.hideEmissionsLabel")||"Hide emissions",name:"hideControls",checked:d,onChange:e=>{h(e.target.checked),BB("hideEmissions",e.target.checked)}})})]}),p&&(0,s.jsx)("div",{className:"memori-settings-drawer--field controls",children:p})]})};c=o("85Hg2");var gU=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",focusable:"false",role:"img",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"})});var vU=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M15 18L9 12 15 6"})});var yU=({className:e,title:t})=>(0,s.jsx)("svg",{...t?{}:{"aria-hidden":"true"},focusable:"false",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",className:e,"aria-label":t,children:(0,s.jsx)("path",{d:"M9 18L15 12 9 6"})});var SU=({apiClient:e,sessionID:n,memori:r,visible:i=!0,initialKnownFacts:o=[],closeDrawer:a})=>{var l;const{t:u}=Ce(),{getKnownFactsPaginated:d,deleteKnownFact:h}=e.knownFacts,[p,m]=(0,c.useState)(o),[f,g]=(0,c.useState)(25),[v,y]=(0,c.useState)(0),[S,_]=(0,c.useState)(null!==(l=null==o?void 0:o.length)&&void 0!==l?l:0),[b,x]=(0,c.useState)(!1),w=async(e,r,i)=>{if(n||e){x(!0);try{const{knownFacts:o,count:s,...a}=await d(null!=e?e:n,null!=r?r:v,null!=i?i:f);m(null!=o?o:[]),_(null!=s?s:0),0!==a.resultCode&&(console.error(a),t(ed).error(u(iO(a.resultCode))))}catch(e){console.error("KNOWN_FACTS/FETCH",e),m(null!=o?o:[])}x(!1)}};(0,c.useEffect)((()=>{w()}),[]);const[C,A]=(0,c.useState)(!1),[E,T]=(0,c.useState)(),[I,M]=(0,c.useState)([]);return(0,s.jsxs)(Im,{open:i,width:"80%",className:"memori-known-facts-drawer",onClose:()=>a(),title:u("knownFacts.title"),children:[(0,s.jsx)("p",{children:u("knownFacts.description",{memoriName:r.name})}),(0,s.jsxs)(Am,{spinning:b,children:[(0,s.jsxs)("div",{className:"memori-known-facts-actions",children:[(0,s.jsxs)(Em,{primary:!0,danger:!0,onClick:()=>{A(!0)},className:"memori-known-facts-delete-selected",disabled:0===(null==I?void 0:I.length),icon:(0,s.jsx)(gU,{}),loading:b,children:[u("selected")," (",null==I?void 0:I.length,")"]}),(0,s.jsx)(nP,{className:"memori-known-facts-modal",open:C,closable:!0,title:I.length>1?u("knownFacts.deleteSelectedConfirmTitle"):u("knownFacts.deleteConfirmTitle"),description:I.length>1?u("knownFacts.deleteSelectedConfirmMessage",{number:I.length}):u("knownFacts.deleteConfirmMessage"),onClose:()=>{A(!1)},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Em,{ghost:!0,onClick:()=>{A(!1)},children:u("cancel")}),(0,s.jsx)(Em,{primary:!0,danger:!0,onClick:async()=>{try{const e=I.map((e=>h(n,e)));Promise.all(e).then((e=>{if(e.every((e=>0===e.resultCode)))t(ed).success(u("knownFacts.deleteSuccess")),M([]),w(),A(!1);else{let n=e.find((e=>0!==e.resultCode));console.error(n),void 0!==(null==n?void 0:n.resultCode)&&t(ed).error(u(iO(null==n?void 0:n.resultCode)))}}))}catch(e){let n=e;t(ed).error(u("Error")+n.message)}},children:u("confirm")})]})})]}),S>25&&(0,s.jsxs)("nav",{className:"memori--table--pagination",children:[S>f&&(0,s.jsxs)("div",{className:"memori--table--pagination--pages",children:[(0,s.jsx)(Em,{shape:"circle",disabled:0===v||v<f,padded:!1,title:u("previous")||"Previous",icon:(0,s.jsx)(vU,{}),onClick:()=>{let e=(v/f-1)*f;y(e),w(void 0,e,f)}}),(0,s.jsxs)("span",{className:"memori--table--pagination--pages--current",children:[Math.ceil(v/f)+1," /"," ",Math.ceil(S/f)]}),(0,s.jsx)(Em,{shape:"circle",padded:!1,title:u("next")||"Next",icon:(0,s.jsx)(yU,{}),disabled:(v/f+1)*f>=S,onClick:()=>{let e=(v/f+1)*f;y(e),w(void 0,e,f)}})]}),(0,s.jsx)(QF,{options:[{label:`25 / ${u("page")||"page"}`,value:25},{label:`50 / ${u("page")||"page"}`,value:50},{label:`100 / ${u("page")||"page"}`,value:100}],value:f,displayValue:`${f} / ${u("page")||"page"}`,onChange:e=>{g(e),y(0),w(void 0,0,e)}})]}),(0,s.jsxs)("table",{className:"memori--table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"memori--table--column-centered",children:(0,s.jsx)(XF,{checked:!!(null==p?void 0:p.length)&&(null==I?void 0:I.length)===p.length,indeterminate:!!(null==p?void 0:p.length)&&!!(null==I?void 0:I.length)&&(null==I?void 0:I.length)!==(null==p?void 0:p.length),onChange:e=>{e.target.checked?M(p.map((e=>e.knownFactID))):M([])}})}),(0,s.jsx)("th",{children:u("knownFacts.text")}),(0,s.jsx)("th",{className:"mobile-hidden",children:u("createdAt")}),(0,s.jsx)("th",{className:"memori--table--column-right",children:u("actions")})]})}),(0,s.jsx)("tbody",{children:p.map((e=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"memori--table--column-centered",children:(0,s.jsx)(XF,{checked:null==I?void 0:I.includes(e.knownFactID),onChange:t=>{t.target.checked?M((t=>[...new Set([...t,e.knownFactID])])):M((t=>t.filter((t=>t!==e.knownFactID))))}})}),(0,s.jsx)("td",{children:e.text}),(0,s.jsx)("td",{className:"mobile-hidden",children:(0,s.jsx)("span",{className:"memori--table--date",children:e.creationTimestamp?new Intl.DateTimeFormat("it",{dateStyle:"short",timeStyle:"short"}).format(new Date(e.creationTimestamp)):"-"})}),(0,s.jsx)("td",{className:"memori--table--column-right",children:(0,s.jsxs)("div",{className:"memori--table--action-column",children:[(0,s.jsx)(Em,{danger:!0,ghost:!0,shape:"circle",icon:(0,s.jsx)(gU,{}),disabled:(null==I?void 0:I.length)>0,title:u("delete")||"Delete",onClick:()=>T(e.knownFactID)}),(0,s.jsx)(nP,{className:"memori-known-facts-modal",open:E===e.knownFactID,closable:!0,title:u("knownFacts.deleteConfirmTitle"),description:u("knownFacts.deleteConfirmMessage"),onClose:()=>{T(void 0)},footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Em,{ghost:!0,onClick:()=>{T(void 0)},children:u("cancel")}),(0,s.jsx)(Em,{primary:!0,danger:!0,onClick:async()=>{try{const r=await h(n,e.knownFactID);0===r.resultCode?(t(ed).success(u("knownFacts.deleteSuccess")),M([]),w(),T(void 0)):(console.error(r),t(ed).error(u(iO(r.resultCode),{ns:"common"})))}catch(e){let n=e;t(ed).error(u("Error")+n.message)}},children:u("confirm")})]})})]})})]},e.knownFactID)))})]})]})]})};var _U=({open:e=!1,baseUrl:t,apiUrl:n,tenant:r,experts:i,onClose:o})=>{const{t:a}=Ce();return(0,s.jsx)(Im,{open:e,onClose:o,className:"memori--experts-drawer",title:(0,s.jsx)("h2",{className:"memori--experts-drawer--title",children:a("widget.expertsInTheBoard")}),children:(0,s.jsx)("ul",{className:"memori--experts-drawer--list",children:i.map((e=>(0,s.jsxs)("li",{className:"memori--experts-drawer--item",children:[(0,s.jsx)("figure",{className:"memori--experts-drawer--avatar",children:(0,s.jsx)("img",{src:`${new URL(n).origin}/api/v1/memoriai/memori/avatar/${e.expertMemoriID}`,alt:e.name,onError:e=>{e.currentTarget.src=AN({tenantID:null==r?void 0:r.id,type:"avatar",baseURL:t}),e.currentTarget.onerror=null}})}),(0,s.jsxs)("div",{className:"memori--experts-drawer--content",children:[(0,s.jsx)("h3",{className:"memori--experts-drawer--name",children:e.name}),(0,s.jsx)("p",{className:"memori--experts-drawer--description",children:e.description})]})]},e.expertID)))})})};c=o("85Hg2"),c=o("85Hg2");const bU=["memori","private","public","api","404","500","it","en","account","auth","logout","privacy_and_cookie","unauthorized","users","virtual_spaces"];var xU=({tenant:e,apiClient:n,onLogin:r,goToLogin:i,__TEST__waitingForOtp:o=!1})=>{const{t:a,i18n:l}=Ce(),u="it"===l.language?"it":"en",{userSignUp:d,userConfirmSignUp:h,resendVerificationCode:p}=n.backend,[m,f]=(0,c.useState)(),[g,v]=(0,c.useState)(),[y,S]=(0,c.useState)(),[_,b]=(0,c.useState)(),x=!y||y&&rR.test(y),w=x&&y&&y.length>=24,C=!y||0===y.length,A=!x||C?0:y.length<8?15:y.length>=32?100:(y.length-8)*(50/24)+50,[E,T]=(0,c.useState)(!1),[I,M]=(0,c.useState)(!1),[R,P]=(0,c.useState)(o),[N,O]=(0,c.useState)(null),[D,k]=(0,c.useState)();(0,c.useEffect)((()=>{k(window.location.href)}),[]);return R?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async n=>{var i,o,s;n.preventDefault();const l=n.currentTarget,c=null!==(i=l.tenant.value)&&void 0!==i?i:e.id,u=null!==(o=l.userName.value)&&void 0!==o?o:g,d=null!==(s=l.password.value)&&void 0!==s?s:y,p=l.verificationCode.value;T(!0),O(null);try{const{user:e,token:n,...i}=await h({tenant:c,userName:u,password:d,verificationCode:p});0!==i.resultCode?(console.error(i),t(ed).error(a(iO(i.resultCode)))):e&&n&&(t(ed).success(a("success")),r(e,n))}catch(e){let n=e;console.error("[validate otp]",n),(null==n?void 0:n.message)&&t(ed).error(n.message)}finally{T(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"userName",value:g}),(0,s.jsx)("input",{type:"hidden",name:"password",value:y}),(0,s.jsx)("input",{type:"hidden",name:"tenant",value:e.id}),(0,s.jsxs)("label",{htmlFor:"#verificationCode",children:[a("login.otpCode"),(0,s.jsx)("input",{id:"verificationCode",name:"verificationCode",type:"text",required:!0,autoComplete:"one-time-code",placeholder:a("login.otpCode")||"OTP"})]}),(0,s.jsx)("p",{children:(0,s.jsx)(Em,{outlined:!0,onClick:async n=>{if(n.preventDefault(),g){M(!0);try{const n=await p({tenant:null==e?void 0:e.id,userName:g});0===n.resultCode?t(ed).success(a("resentVerificationCode")):(console.error(n),t(ed).error(a(iO(n.resultCode))))}catch(e){let n=e;console.error("[resend otp]",n),(null==n?void 0:n.message)&&t(ed).error(n.message)}finally{M(!1)}}},loading:I,children:a("login.resendVerificationCode")})}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:E,children:a("confirm")})]}),N&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:N})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async n=>{var r,i,o,s,l,c,u;n.preventDefault();const h=n.currentTarget,p=null!==(r=h.tenant.value)&&void 0!==r?r:e.id,f=(null!==(i=h.eMail.value)&&void 0!==i?i:m).toLowerCase(),v=null!==(o=h.userName.value)&&void 0!==o?o:g,y=h.password.value,S=new Date(null===(s=h.birthDate)||void 0===s?void 0:s.value).toISOString(),_=null===(l=h.tnCAndPPAccepted)||void 0===l?void 0:l.checked,b=null===(c=h.pAndCUAccepted)||void 0===c?void 0:c.checked,x=null===(u=h.referral)||void 0===u?void 0:u.value;if(!(f&&v&&y&&S&&_))return void O(a("missingData"));T(!0),O(null);if(((new Date).getTime()-new Date(S).getTime())/1e3/60/60/24/365<14)return t(ed).error(a("login.underage",{age:14})),void O(a("login.underage",{age:14}));try{const{user:e,...n}=await d({tenant:p,eMail:f,userName:v,password:y,birthDate:S,tnCAndPPAccepted:_,tnCAndPPAcceptanceDate:(new Date).toISOString(),pAndCUAccepted:b,pAndCUAcceptanceDate:(new Date).toISOString(),referral:x});0!==n.resultCode?(console.error(n),t(ed).error(a(iO(n.resultCode)))):e&&(t(ed).success(a("success")),P(!0))}catch(e){let n=e;console.error("[signup]",n),(null==n?void 0:n.message)&&t(ed).error(n.message)}finally{T(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"tenant",value:e.id}),(0,s.jsx)("input",{type:"hidden",name:"referral",value:D}),(0,s.jsxs)("label",{htmlFor:"#eMail",children:[a("login.email"),(0,s.jsx)("input",{type:"email",name:"eMail",id:"eMail",required:!0,autoComplete:"email",placeholder:a("login.email")||"Email",onChange:e=>f(e.target.value),"aria-invalid":!!(null==m?void 0:m.length)&&!iR.test(m)})]}),!!(null==m?void 0:m.length)&&!iR.test(m)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.emailFormatError")}),(0,s.jsxs)("label",{htmlFor:"userName",children:[a("login.username"),(0,s.jsx)("input",{type:"text",name:"userName",id:"userName",required:!0,autoComplete:"username",placeholder:a("login.username")||"Username",onFocus:()=>{if(!(null==g?void 0:g.length)&&(null==m?void 0:m.length)){let e=(e=>e.split("@")[0].replace(/[^a-zA-Z0-9]/g,""))(m);const t=document.getElementById("userName");t&&(t.value=e,v(e))}},onChange:e=>v(e.target.value),"aria-invalid":!!(null==g?void 0:g.length)&&(bU.includes(g.toLowerCase())||!oR.test(g))})]}),!!(null==g?void 0:g.length)&&bU.includes(g.toLowerCase())&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.usernameContainsReservedWord")}),!!(null==g?void 0:g.length)&&!oR.test(g)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.usernameFormatError")}),(0,s.jsxs)("label",{htmlFor:"#birthDate",children:[a("login.birthDate"),(0,s.jsx)("input",{id:"birthDate",name:"birthDate",type:"date",required:!0,autoComplete:"bday"})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:a("login.birthDateHelper")})}),(0,s.jsxs)("label",{htmlFor:"#password",children:[a("login.password"),(0,s.jsx)("input",{id:"password",name:"password",type:"password",required:!0,autoComplete:"new-password",placeholder:a("login.password")||"Password",onChange:e=>S(e.target.value),"aria-invalid":!x})]}),!x&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[a("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:a("login.confirmPassword")||"Password",onChange:e=>b(e.target.value),"aria-invalid":!!(null==y?void 0:y.length)&&!!(null==_?void 0:_.length)&&y!==_})]}),!!(null==y?void 0:y.length)&&!!(null==_?void 0:_.length)&&y!==_&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:a("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:A,id:"password-strength-meter"}),(0,s.jsx)("small",{children:a("login.pwd"+(w?"Strong":x?"Acceptable":"Weak"))}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",required:!0,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[a("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${u}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:a("login.privacyAndCookiePolicy")})," ",a("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${u}/tos`,target:"_blank",rel:"noopener noreferrer",children:a("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[a("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",a("login.optional"),")"]})})]})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:a("login.deepThoughtExplaination")})}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:E,children:a("login.signUp")}),(0,s.jsxs)("p",{className:"memori--login-drawer--signup",children:[a("login.alreadyHaveAnAccount")," ",(0,s.jsx)(Em,{outlined:!0,onClick:i,children:a("login.backToLogin")})]})]}),N&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:N})]})};c=o("85Hg2");const wU=["image/jpeg","image/png","image/jpg","image/gif"];var CU=({user:e,loginToken:n,apiClient:r,onUserUpdate:i})=>{const{t:o,i18n:a}=Ce(),l="it"===a.language?"it":"en",{updateUser:u,uploadAsset:d}=r.backend,[h,p]=(0,c.useState)(),[m,f]=(0,c.useState)(),[g,v]=(0,c.useState)(),y=!m||m&&rR.test(m),S=y&&m&&m.length>=24,_=!m||0===m.length,b=!y||_?0:m.length<8?15:m.length>=32?100:(m.length-8)*(50/24)+50,[x,w]=(0,c.useState)(!1),[C,A]=(0,c.useState)(null),E=async(e,r)=>{try{const{user:s,...a}=await u(n,e,r);0!==a.resultCode?(console.error(a),t(ed).error(o(iO(a.resultCode)))):s&&(t(ed).success(o("success")),i(s))}catch(e){let n=e;console.error("[signup]",n),(null==n?void 0:n.message)&&t(ed).error(n.message)}finally{w(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{className:"memori--login-drawer--edit-account-title",children:o("login.editAccount")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form memori--login-drawer--account-form",onSubmit:async r=>{var i,s,a,l,c;if(r.preventDefault(),!e.userID)return;const u=e.userID,p=r.currentTarget,f=null!==(i=p.eMail.value)&&void 0!==i?i:h,g=null!==(s=p.newPassword.value)&&void 0!==s?s:m,v=p.password.value,y=p.confirmPassword.value,S=null===(a=p.pAndCUAccepted)||void 0===a?void 0:a.checked,_=null===(c=null===(l=p.avatar)||void 0===l?void 0:l.files)||void 0===c?void 0:c[0];if(w(!0),A(null),(null==g?void 0:g.length)&&g!==y)return A(o("login.passwordMatchingError")),void w(!1);let b={...(null==f?void 0:f.length)&&f!==e.eMail?{eMail:f}:{},...g?{password:v,newPassword:g}:{},...void 0!==S&&S!==e.pAndCUAccepted?{pAndCUAccepted:S,pAndCUAcceptanceDate:(new Date).toISOString()}:{}};if(0===Object.values(b).length&&!_)return console.debug("No changes to submit"),void w(!1);if(_){const e=new FileReader;e.onload=async e=>{var r,i;try{const{asset:s,...a}=await d(null!==(r=_.name)&&void 0!==r?r:"avatar",null===(i=e.target)||void 0===i?void 0:i.result,n);0!==a.resultCode?(console.error(a),t(ed).error(o(iO(a.resultCode)))):s&&(b.avatarURL=s.assetURL,await E(u,b))}catch(e){let n=e;console.error("[avatar upload]",n),(null==n?void 0:n.message)&&t(ed).error(n.message)}},e.readAsDataURL(_)}else await E(u,b)},children:[(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.emailChange")}),(0,s.jsxs)("label",{htmlFor:"#eMail",children:[o("login.email"),(0,s.jsx)("input",{type:"email",name:"eMail",id:"eMail",autoComplete:"email",placeholder:e.eMail,onChange:e=>p(e.target.value),"aria-invalid":!!(null==h?void 0:h.length)&&!iR.test(h)})]}),!!(null==h?void 0:h.length)&&!iR.test(h)&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.emailFormatError")})]}),(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.passwordChange")}),(0,s.jsxs)("label",{htmlFor:"#password",children:[o("login.currentPassword"),(0,s.jsx)("input",{id:"password",name:"password",type:"password",autoComplete:"password",placeholder:o("login.currentPassword")||"Password"})]}),(0,s.jsxs)("label",{htmlFor:"#newPassword",children:[o("login.newPassword"),(0,s.jsx)("input",{id:"newPassword",name:"newPassword",type:"password",autoComplete:"new-password",placeholder:o("login.password")||"Password",onChange:e=>f(e.target.value),"aria-invalid":!y})]}),!y&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[o("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",autoComplete:"new-password",placeholder:o("login.confirmPassword")||"Password",onChange:e=>v(e.target.value),"aria-invalid":!!(null==m?void 0:m.length)&&!!(null==g?void 0:g.length)&&m!==g})]}),!!(null==m?void 0:m.length)&&!!(null==g?void 0:g.length)&&m!==g&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:o("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:b,id:"password-strength-meter"}),(0,s.jsx)("small",{children:o("login.pwd"+(S?"Strong":y?"Acceptable":"Weak"))})]}),(0,s.jsxs)("details",{className:"memori--details",children:[(0,s.jsx)("summary",{children:o("login.avatarChange")}),(0,s.jsxs)("label",{htmlFor:"#avatar",children:["Avatar",(0,s.jsx)("input",{type:"file",name:"avatar",id:"avatar",accept:wU.join(", "),placeholder:e.avatarURL})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox memori-checkbox--disabled",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",disabled:!0,defaultChecked:e.tnCAndPPAccepted,checked:e.tnCAndPPAccepted,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[o("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${l}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:o("login.privacyAndCookiePolicy")})," ",o("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${l}/tos`,target:"_blank",rel:"noopener noreferrer",children:o("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",className:"memori-checkbox--input",defaultChecked:e.pAndCUAccepted}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsx)(MN,{align:"left",content:o("login.deepThoughtExplaination"),children:(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[o("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",o("login.optional"),")"]})})]})})]}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:x,children:o("login.save")})]}),C&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:C})]})};var AU=({open:e=!1,onClose:n,onLogin:r,onLogout:i,user:o,loginToken:a,tenant:l,apiClient:u,__TEST__signup:d=!1,__TEST__needMissingData:h=!1,__TEST__waitingForOtp:p=!1,__TEST__changePwd:m=!1})=>{var f,g;const{t:v,i18n:y}=Ce(),S="it"===y.language?"it":"en",{userLogin:_,updateUser:b}=u.backend,x=(null==o?void 0:o.userID)&&a,[w,C]=(0,c.useState)(!1),[A,E]=(0,c.useState)(null),[T,I]=(0,c.useState)(d),[M,R]=(0,c.useState)(m?{flowID:"flowID",tenant:l.id,eMail:"email",userName:"username",password:"password"}:void 0),[P,N]=(0,c.useState)(h?{token:"token",birthDate:!0,tnCAndPPAccepted:!0}:{}),[O,D]=(0,c.useState)(),[k,L]=(0,c.useState)(),B=!O||O&&rR.test(O),z=B&&O&&O.length>=24,F=!O||0===O.length,U=!B||F?0:O.length<8?15:O.length>=32?100:(O.length-8)*(50/24)+50;return(0,s.jsx)(Im,{open:e,onClose:n,className:t(Cs)("memori--login-drawer",{"memori--login-drawer--logged":x,"memori--login-drawer--signup":T}),title:(0,s.jsx)("span",{className:"memori--login-drawer--title",children:x?v("login.loggedDrawerTitle",{name:o.userName}):v(T?"login.signupDrawerTitle":"login.loginDrawerTitle")}),children:x?(0,s.jsxs)("div",{className:"memori--login-drawer--logged",children:[o.avatarURL&&(0,s.jsx)("figure",{className:"memori--login-drawer--avatar",children:(0,s.jsx)("img",{src:o.avatarURL,alt:o.userName})}),(0,s.jsx)(Em,{primary:!0,onClick:()=>{i()},children:v("login.logout")}),(0,s.jsx)(CU,{user:o,loginToken:a,apiClient:u,onUserUpdate:e=>r(e,a)})]}):(null===(f=null==P?void 0:P.token)||void 0===f?void 0:f.length)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{children:v("login.missingData")}),(0,s.jsx)("p",{children:v("login.missingDataHelper")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async e=>{var n,i,s;e.preventDefault();const a=e.currentTarget,l=null===(n=a.birthDate)||void 0===n?void 0:n.value,c=null===(i=a.tnCAndPPAccepted)||void 0===i?void 0:i.checked,u=null===(s=a.pAndCUAccepted)||void 0===s?void 0:s.checked;if(!(null==o?void 0:o.userID)||!(null==P?void 0:P.token))return;if(!l||!c)return void E(v("missingData"));let d={userID:o.userID,birthDate:(null==o?void 0:o.birthDate)||!P.birthDate?void 0:l,tnCAndPPAccepted:c||(null==o?void 0:o.tnCAndPPAccepted),tnCAndPPAcceptanceDate:c?(new Date).toISOString():void 0,pAndCUAccepted:u||(null==o?void 0:o.pAndCUAccepted),pAndCUAcceptanceDate:u?(new Date).toISOString():void 0};const{user:h,...p}=await b(P.token,o.userID,d);0!==p.resultCode?(console.error(p),t(ed).error(v(iO(p.resultCode))),E(p.resultMessage)):(t(ed).success(v("success")),r(h||d,P.token))},children:[P.birthDate&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("label",{htmlFor:"#birthDate",children:[v("login.birthDate"),(0,s.jsx)("input",{id:"birthDate",name:"birthDate",type:"date",required:!0,autoComplete:"bday"})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.birthDateHelper")})})]}),(null==P?void 0:P.tnCAndPPAccepted)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"tnCAndPPAccepted",className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[v("login.privacyLabel")," ",(0,s.jsx)("a",{href:`https://memori.ai/${S}/privacy_and_cookie`,target:"_blank",rel:"noopener noreferrer",children:v("login.privacyAndCookiePolicy")})," ",v("login.and")," ",(0,s.jsx)("a",{href:`https://memori.ai/${S}/tos`,target:"_blank",rel:"noopener noreferrer",children:v("login.termsOfService")})]})]}),(0,s.jsxs)("label",{className:"memori-checkbox",children:[(0,s.jsxs)("span",{className:"memori-checkbox--input-wrapper",children:[(0,s.jsx)("input",{type:"checkbox",name:"pAndCUAccepted",defaultChecked:null==o?void 0:o.pAndCUAccepted,className:"memori-checkbox--input"}),(0,s.jsx)("span",{className:"memori-checkbox--inner"})]}),(0,s.jsxs)("span",{className:"memori-checkbox--text",children:[v("login.pAndCUAccepted")," ",(0,s.jsx)("small",{children:(0,s.jsxs)("em",{children:["(",v("login.optional"),")"]})})]})]}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.goToAccountToChangeYourPreferences")})}),(0,s.jsx)("p",{children:(0,s.jsx)("small",{children:v("login.deepThoughtExplaination")})})]}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:w,children:v("login.save")})]})]}):(null==M?void 0:M.flowID)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:v("login.mustChangePassword")}),(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:async e=>{var n,i,o,s,a;e.preventDefault();const c=e.currentTarget,u=null!==(n=c.tenant.value)&&void 0!==n?n:l.id,d=null!==(i=c.flowID.value)&&void 0!==i?i:null==M?void 0:M.flowID,h=null!==(o=c.eMail.value)&&void 0!==o?o:null==M?void 0:M.eMail,p=null!==(s=c.userName.value)&&void 0!==s?s:null==M?void 0:M.userName,m=null!==(a=c.password.value)&&void 0!==a?a:null==M?void 0:M.password,f=c.newPassword.value;if(!(null==f?void 0:f.length)||!B)return void E(v("login.passwordFormatError"));C(!0);const g={tenant:u,flowID:d,eMail:h,userName:p,password:m,newPassword:f};try{const{user:e,token:n,...i}=await _(g);0!==i.resultCode?(console.error(i),t(ed).error(v(iO(i.resultCode))),E(i.resultMessage)):e&&n&&(t(ed).success(v("success")),r(e||g,n))}catch(e){let n=e;console.error("[LOGIN/CHANGE PWD]",n),n.message&&(t(ed).error(n.message),E(n.message))}finally{C(!1)}},children:[(0,s.jsx)("input",{type:"hidden",name:"tenant",value:null!==(g=M.tenant)&&void 0!==g?g:null==l?void 0:l.id}),(0,s.jsx)("input",{type:"hidden",name:"flowID",value:M.flowID}),(0,s.jsx)("input",{type:"hidden",name:"eMail",value:M.eMail}),(0,s.jsx)("input",{type:"hidden",name:"userName",value:M.userName}),(0,s.jsx)("input",{type:"hidden",name:"password",value:M.password}),(0,s.jsxs)("label",{htmlFor:"#newPassword",children:[v("login.password"),(0,s.jsx)("input",{id:"newPassword",name:"newPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:v("login.password")||"Password",onChange:e=>D(e.target.value),"aria-invalid":!B})]}),!B&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:v("login.passwordFormatError")}),(0,s.jsxs)("label",{htmlFor:"#confirm-password",children:[v("login.confirmPassword"),(0,s.jsx)("input",{id:"confirm-password",name:"confirmPassword",type:"password",required:!0,autoComplete:"new-password",placeholder:v("login.confirmPassword")||"Password",onChange:e=>L(e.target.value),"aria-invalid":!!(null==O?void 0:O.length)&&!!(null==k?void 0:k.length)&&O!==k})]}),!!(null==O?void 0:O.length)&&!!(null==k?void 0:k.length)&&O!==k&&(0,s.jsx)("p",{className:"memori--login-drawer--inline-error",children:v("login.passwordMatchingError")}),(0,s.jsx)("meter",{className:"memori--login-drawer--password-meter",min:0,low:33,high:66,optimum:80,max:100,value:U,id:"password-strength-meter"}),(0,s.jsx)("small",{children:v("login.pwd"+(z?"Strong":B?"Acceptable":"Weak"))}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:w,children:v("confirm")})]})]}):T?(0,s.jsx)(xU,{tenant:l,apiClient:u,onLogin:r,goToLogin:()=>I(!1),__TEST__waitingForOtp:p}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("form",{className:"memori--login-drawer--form",onSubmit:e=>{e.preventDefault();const n=e.currentTarget,i=n.userNameOrEmail.value,o=n.password.value,s=iR.test(i),a=s?{tenant:null==l?void 0:l.id,eMail:i,password:o}:{tenant:null==l?void 0:l.id,userName:i,password:o};C(!0),E(null),_(a).then((e=>{var n,a,c,u,d;-14===e.resultCode?R({tenant:l.id,eMail:s?i:void 0,userName:s?void 0:i,password:o,flowID:e.flowID||(null===(n=e.user)||void 0===n?void 0:n.flowID)}):0!==e.resultCode?(console.error(e),t(ed).error(v(iO(e.resultCode))),E(e.resultMessage)):e.user&&e.token&&((null===(a=e.user)||void 0===a?void 0:a.tnCAndPPAccepted)&&(null===(c=e.user)||void 0===c?void 0:c.birthDate)?r(e.user,e.token):N({token:e.token,birthDate:!(null===(u=e.user)||void 0===u?void 0:u.birthDate),tnCAndPPAccepted:!(null===(d=e.user)||void 0===d?void 0:d.tnCAndPPAccepted)}))})).catch((e=>{console.error("[LOGIN]",e),e.message&&(t(ed).error(e.message),E(e.message))})).finally((()=>{C(!1)}))},children:[(0,s.jsxs)("label",{htmlFor:"#userNameOrEmail",children:[v("login.userNameOrEmail"),(0,s.jsx)("input",{id:"userNameOrEmail",name:"userNameOrEmail",required:!0,autoComplete:"email",placeholder:"Username/email"})]}),(0,s.jsxs)("label",{htmlFor:"#password",children:["Password",(0,s.jsx)("input",{id:"password",name:"password",type:"password",required:!0,autoComplete:"password",placeholder:"Password"})]}),(0,s.jsx)(Em,{htmlType:"submit",primary:!0,loading:w,children:v("login.login")}),(null==l?void 0:l.disableRegistration)?l.adminEmail?(0,s.jsxs)("div",{className:"memori--login-drawer--signup",children:[(0,s.jsx)("p",{children:v("login.registrationDisabled")}),(0,s.jsxs)("p",{children:[v("login.contactAdmin"),":"," ",(0,s.jsx)("a",{href:`mailto:${l.adminEmail}`,children:l.adminEmail})]})]}):null:(0,s.jsxs)("p",{className:"memori--login-drawer--signup",children:[v("login.newUserSignUp")," ",(0,s.jsx)(Em,{outlined:!0,onClick:()=>I(!0),children:v("login.signUp")})]})]}),A&&(0,s.jsx)("p",{role:"alert",className:"memori--login-drawer--error",children:A})]})})};var EU=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,sessionId:d,hasUserActivatedSpeak:h,loading:p=!1,poweredBy:m})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(Am,{spinning:p,children:[e&&t&&(0,s.jsx)(e,{...t}),(0,s.jsxs)("div",{className:"memori--grid",children:[(0,s.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[n&&r&&(0,s.jsx)(n,{chatProps:o,...r}),(0,s.jsx)("div",{id:"extension"})]}),(0,s.jsx)("div",{className:"memori--grid-column memori--grid-column-right",children:d&&h&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null}),m]})]})]});var TU=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:c,integrationBackground:u,sessionId:d,hasUserActivatedSpeak:h,loading:p=!1,poweredBy:m})=>(0,s.jsxs)(s.Fragment,{children:[c,u,(0,s.jsxs)(Am,{spinning:p,className:"memori-totem-layout",children:[m,(0,s.jsx)("div",{className:"memori-totem-layout--header",children:e&&t&&(0,s.jsx)(e,{...t})}),(0,s.jsx)("div",{className:"memori-totem-layout--avatar",children:n&&r&&(0,s.jsx)(n,{chatProps:o,...r,isTotem:!0})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-totem-layout--controls",children:d&&h&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null})]})]});var IU=({Header:e,headerProps:t,Chat:n,chatProps:r,StartPanel:i,startPanelProps:o,integrationStyle:a,integrationBackground:l,sessionId:c,hasUserActivatedSpeak:u,loading:d=!1,poweredBy:h})=>(0,s.jsxs)(s.Fragment,{children:[a,l,(0,s.jsxs)(Am,{spinning:d,className:"memori-chat-layout",children:[h,(0,s.jsx)("div",{className:"memori-chat-layout--header",children:e&&t&&(0,s.jsx)(e,{...t})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-chat-layout--controls",children:c&&u&&n&&r?(0,s.jsx)(n,{...r}):o?(0,s.jsx)(i,{...o}):null})]})]});c=o("85Hg2"),c=o("85Hg2");var MU=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:u,sessionId:d,hasUserActivatedSpeak:h,loading:p=!1,poweredBy:m})=>{var f,g;const{t:v}=Ce(),[y,S]=(0,c.useState)(!0),[_,b]=(0,c.useState)(),x=(0,c.useMemo)((()=>null==o?void 0:o.stopAudio),[null==o?void 0:o.stopAudio]),w=e=>{S(e),b(e?void 0:(new Date).toISOString());try{null==x||x()}catch(e){console.log(e)}};return(0,s.jsx)("div",{className:"memori-website_assistant--"+(y?"collapsed":"expanded"),children:y?(0,s.jsx)("div",{className:"memori-website_assistant--trigger",children:(0,s.jsx)(Em,{className:"memori-website_assistant--trigger-button",ghost:!0,shape:"circle",onClick:()=>w(!1),title:v("expand")||"Expand",children:(0,s.jsx)(vD,{avatar:null==r?void 0:r.memori.avatarURL})})}):(0,s.jsxs)(s.Fragment,{children:[u,(0,s.jsxs)(Am,{spinning:p,className:"memori-website_assistant-layout",children:[m,(0,s.jsx)("div",{className:"memori-website_assistant--close-button-wrapper",children:(0,s.jsx)(Em,{className:"memori-website_assistant--close-button",primary:!0,shape:"circle",onClick:()=>w(!0),icon:(0,s.jsx)(Tm,{}),title:v("close")||"Close"})}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--header",children:e&&t&&(0,s.jsx)(e,{...t,showSettings:!1,showReload:!1})}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--avatar",children:n&&r&&(0,c.createElement)(n,{...r,integrationConfig:r.integrationConfig?{...r.integrationConfig,avatarURL:(null===(f=r.integrationConfig)||void 0===f?void 0:f.avatarURL)?`${null===(g=r.integrationConfig)||void 0===g?void 0:g.avatarURL.split("#")[0]}#${_}`:void 0}:{},key:_})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-website_assistant-layout--controls",children:d&&h&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null})]})]})})};c=o("85Hg2");var RU=({Header:e,headerProps:t,Chat:n,chatProps:r,startPanelProps:i,sessionId:o,hasUserActivatedSpeak:a})=>{const{t:l}=Ce(),[u,d]=(0,c.useState)(!1);(0,c.useEffect)((()=>{const e=document.body;e&&(u?(e.style.width="calc(100% - 350px)",e.style.marginRight="300px",e.style.transition="all 0.5s"):(e.style.width="100%",e.style.marginLeft="0"))}),[u]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("input",{type:"checkbox",id:"memori-sidebar-toggle",className:"memori-sidebar-toggle",checked:u,onChange:()=>{d(!u),(()=>{try{window.speechSynthesis.speak(new SpeechSynthesisUtterance(""))}catch(e){console.error(e)}i&&(null==i?void 0:i.initializeTTS)&&(null==i||i.initializeTTS()),i&&(null==i?void 0:i.onClickStart)&&(null==i||i.onClickStart())})()}}),(0,s.jsxs)("div",{className:"memori-sidebar-container",children:[(0,s.jsx)("label",{htmlFor:"memori-sidebar-toggle",className:"memori-sidebar-toggle-label memori-open-label",children:(0,s.jsx)(ZN,{className:"memori-icon","aria-label":l("expand")})}),(0,s.jsxs)("aside",{className:"memori-sidebar",children:[(0,s.jsx)("label",{htmlFor:"memori-sidebar-toggle",className:"memori-sidebar-toggle-label memori-close-label",children:(0,s.jsx)("span",{children:(0,s.jsx)(Tm,{className:"memori-icon-close","aria-label":l("collapse")})})}),(0,s.jsx)("div",{className:"memori-sidebar-content",children:(0,s.jsx)("div",{className:"memori-hidden-chat-layout--header",children:e&&t&&(0,s.jsx)(e,{position:{latitude:0,longitude:0,placeName:""},...t,className:"memori-hidden-chat-layout-header--layout"})})}),(0,s.jsx)("div",{id:"extension"}),(0,s.jsx)("div",{className:"memori-hidden-chat-layout--controls",children:o&&a&&n&&r?(0,s.jsx)(n,{...r}):(0,s.jsx)("div",{className:"memori-loading",children:(0,s.jsx)(Am,{})})})]})]})]})};c=o("85Hg2");var PU=({Header:e,headerProps:t,Avatar:n,avatarProps:r,Chat:i,chatProps:o,StartPanel:a,startPanelProps:l,integrationStyle:u,integrationBackground:d,sessionId:h,hasUserActivatedSpeak:p,loading:m=!1,poweredBy:f})=>((0,c.useEffect)((()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow=""})),[]),(0,s.jsxs)(s.Fragment,{children:[u,d,(0,s.jsxs)(Am,{className:"memori-spin--zoomed-full-body",spinning:m,children:[e&&t&&(0,s.jsx)(e,{...t}),(0,s.jsxs)("div",{className:"memori--grid",children:[(0,s.jsxs)("div",{className:"memori--grid-column memori--grid-column-left",children:[n&&r&&(0,s.jsx)(n,{chatProps:o,isZoomed:!0,...r}),(0,s.jsx)("div",{id:"extension"})]}),(0,s.jsx)("div",{className:"memori--grid-column memori--grid-column--zoomed-full-body memori--grid-column-right",children:h&&p&&i&&o?(0,s.jsx)(i,{...o}):l?(0,s.jsx)(a,{...l}):null}),(0,s.jsx)("div",{className:"memori--powered-by-custom",children:f})]})]})]}));const NU=async({operation:e="session_creation",baseUrl:t,userID:n,userName:r,tenant:i})=>{if(!n&&!r)throw new Error("Either userID or userName must be provided");const o=await fetch(`${t}/api/verify-tokens`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operation:e,userID:n,userName:r,tenant:i})});if(!o.ok)throw new Error("Failed to fetch credits");return o.json()},OU=(e,t=!0,n=!1,r,i=!1,o=!1)=>{const s=new CustomEvent("MemoriTextEntered",{detail:{text:e,waitForPrevious:t,hidden:n,typingText:r,useLoaderTextAsMsg:i,hasBatchQueued:o}});document.dispatchEvent(s);window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak"))}),300)};let DU,kU,LU,BU,zU,FU;window.getMemoriState=e=>{var t,n,r,i,o;let s=e?document.querySelector(`.memori-widget[data-memori-integration="${e}"]`)||(null===(n=null===(t=document.querySelector("memori-client"))||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector(".memori-widget[data-memori-integration]")):document.querySelector(".memori-widget")||(null===(i=null===(r=document.querySelector("memori-client"))||void 0===r?void 0:r.shadowRoot)||void 0===i?void 0:i.querySelector(".memori-widget"));if(!s)return null;let a=null===(o=s.dataset)||void 0===o?void 0:o.memoriEngineState;return a?JSON.parse(a):null},window.typeMessage=OU,window.typeMessageHidden=(e,t=!0,n,r=!1,i=!1)=>OU(e,t,!0,n,r,i),window.typeBatchMessages=e=>{function t(){var e,t,n,r;null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e||e.setAttribute("disabled","");const i="opacity: 0.5; touch-action: none; pointer-events: none;";null===(t=document.querySelector("textarea.memori-chat-textarea--input"))||void 0===t||t.setAttribute("style",i),null===(n=document.querySelector("button.memori-chat-inputs--send"))||void 0===n||n.setAttribute("style",i),null===(r=document.querySelector("button.memori-chat-inputs--mic"))||void 0===r||r.setAttribute("style",i)}function n(){var e,t,n,r;null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e||e.removeAttribute("disabled"),null===(t=document.querySelector("textarea.memori-chat-textarea--input"))||void 0===t||t.removeAttribute("style"),null===(n=document.querySelector("button.memori-chat-inputs--send"))||void 0===n||n.removeAttribute("style"),null===(r=document.querySelector("button.memori-chat-inputs--mic"))||void 0===r||r.removeAttribute("style")}function r(){var e;return!!(null===(e=document.querySelector("fieldset#chat-fieldset"))||void 0===e?void 0:e.hasAttribute("disabled"))}const i=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&/iPad|iPhone|iPod/.test(navigator.userAgent),o=function*(){yield*e}();t();const s=()=>{const e=o.next(),a=e.value;if(a){r()||t();let o=a.waitForPrevious;i&&(o=!1),OU(a.message,o,a.hidden,a.typingText,a.useLoaderTextAsMsg,!e.done),i&&setTimeout((()=>{document.dispatchEvent(new CustomEvent("MemoriEndSpeak")),n()}),3e3)}else r()&&n();if(e.done)return document.removeEventListener("MemoriEndSpeak",s),void(r()&&n())};document.addEventListener("MemoriEndSpeak",s),s()};let UU,jU=!1,GU=!1;var HU=({memori:e,memoriConfigs:n,ownerUserID:r,ownerUserName:i,tenantID:o,memoriLang:a,multilingual:l,integration:u,layout:d,customLayout:h,showShare:p,preview:m=!1,embed:f=!1,showCopyButton:g=!0,showTranslationOriginal:v=!1,showInputs:y=!0,showDates:S=!1,showContextPerLine:_=!1,showSettings:b=!0,showTypingText:x=!1,showClear:w=!1,showLogin:C=!1,showUpload:A,showOnlyLastMessages:E,height:T="100vh",secret:I,baseUrl:M="https://aisuru.com",apiURL:R="https://backend.memori.ai",engineURL:P="https://engine.memori.ai",initialContextVars:N,initialQuestion:O,ogImage:D,sessionID:k,tenant:L,personification:B,authToken:z,AZURE_COGNITIVE_SERVICES_TTS_KEY:F,enableAudio:U,defaultSpeakerActive:j=!0,disableTextEnteredEvents:G=!1,onStateChange:H,additionalInfo:V,additionalSettings:W,customMediaRenderer:q,userAvatar:J,useMathFormatting:K=!1,autoStart:Y=!1,applyVarsToRoot:$=!1})=>{var X,Q,ee,te,ne,re,ie,oe,se,ae,le,ce,ue,de,he,pe,me,fe,ge,ve,ye,Se,_e,be,xe,we,Ae;const{t:Ee,i18n:Te}=Ce(),[Ie,Me]=(0,c.useState)(!1);(0,c.useEffect)((()=>{Me(!0)}),[]);const Re=Z(R,P),{initSession:Pe,postTextEnteredEvent:Ne,postPlaceChangedEvent:Oe,postDateChangedEvent:De,postTimeoutEvent:ke,postTagChangedEvent:Le,getSession:Be,getExpertReferences:ze,getSessionChatLogs:Fe}=Re,[Ue,je]=(0,c.useState)(!1),[Ge,He]=(0,c.useState)(!0),[Ve,We]=(0,c.useState)(null!==(X=null==V?void 0:V.loginToken)&&void 0!==X?X:z),[qe,Je]=(0,c.useState)({avatarURL:"string"==typeof J?J:void 0});(0,c.useEffect)((()=>{Ve&&!(null==qe?void 0:qe.userID)&&C&&Re.backend.getCurrentUser(Ve).then((({user:e,resultCode:t})=>{e&&0===t?(Je(e),BB("loginToken",Ve),!mn&&e.birthDate&&(fn(e.birthDate),BB("birthDate",e.birthDate))):zB("loginToken")}))}),[Ve,null==qe?void 0:qe.userID]);const[Ke,Ye]=(0,c.useState)(!1),[$e,Xe]=(0,c.useState)(!1),[Qe,Ze]=(0,c.useState)(!1),et=(null===(te=null===(ee=null===(Q=e.culture)||void 0===Q?void 0:Q.split("-"))||void 0===ee?void 0:ee[0])||void 0===te?void 0:te.toUpperCase())||(null===(oe=null===(ie=null===(re=null===(ne=null==n?void 0:n.find((t=>t.memoriConfigID===e.memoriConfigurationID)))||void 0===ne?void 0:ne.culture)||void 0===re?void 0:re.split("-"))||void 0===ie?void 0:ie[0])||void 0===oe?void 0:oe.toUpperCase()),tt=(null==u?void 0:u.customData)?JSON.parse(u.customData):null,nt=void 0!==l?l:!!(null==tt?void 0:tt.multilanguage),rt=null==tt?void 0:tt.forcedTimeout,[it,ot]=(0,c.useState)(null!==(ce=null!==(le=null!==(ae=null!==(se=null!=a?a:null==tt?void 0:tt.lang)&&void 0!==se?se:et)&&void 0!==ae?ae:null==tt?void 0:tt.uiLang)&&void 0!==le?le:Te.language)&&void 0!==ce?ce:"IT"),st=void 0!==K?K:!!(null==tt?void 0:tt.useMathFormatting);(0,c.useEffect)((()=>{st&&fR()}),[st]),(0,c.useEffect)((()=>{nt&&it&&sO.includes(it.toLowerCase())&&Te.changeLanguage(it.toLowerCase())}),[it]);const[at,lt]=(0,c.useState)(!1),[ct,ut]=(0,c.useState)(!1),[dt,ht]=(0,c.useState)(),pt=d||(null==tt?void 0:tt.layout)||"DEFAULT",mt=null!==(ue=null!=U?U:null==tt?void 0:tt.enableAudio)&&void 0!==ue&&ue,[ft,gt]=(0,c.useState)(!1),[vt,yt]=(0,c.useState)(!1),[St,_t]=(0,c.useState)(!1),[bt,xt]=(0,c.useState)(!1),[wt,Ct]=(0,c.useState)(!1),[At,Et]=(0,c.useState)(!1),[Tt,It]=(0,c.useState)(!mt||!j||Y),[Mt,Rt]=(0,c.useState)(!1),[Pt,Nt]=(0,c.useState)(2),[Ot,Dt]=(0,c.useState)(!1),[kt,Lt]=(0,c.useState)("center"),[Bt,zt]=(0,c.useState)(!1),[Ft,Ut]=(0,c.useState)(null),[jt,Gt]=(0,c.useState)(!1),{startProcessing:Ht,setAudioContext:Vt,addViseme:Wt,stopProcessing:qt,resetVisemeQueue:Jt}=Fz();(0,c.useEffect)((()=>{GU=!!LU}),[LU]),(0,c.useEffect)((()=>{let e="bottom",t=LB("microphoneMode","HOLD_TO_TALK");window.innerWidth<=768?(e="bottom",t="HOLD_TO_TALK"):e=window.matchMedia("(orientation: portrait)").matches||window.innerHeight>window.innerWidth?"center":"bottom";const n=Y||LB("muteSpeaker",!mt||!j||Y);It(n),jU=n,Rt(!n&&"CONTINUOUS"===t),Nt(LB("continuousSpeechTimeout",2)),Lt(LB("controlsPosition",e)),Ut(LB("avatarType","avatar3d")),Gt(LB("hideEmissions",!1)),(null==V?void 0:V.loginToken)||z||(We(LB("loginToken",void 0)),UU=LB("loginToken",void 0),fn(LB("birthDate",void 0)))}),[]);const[Kt,Yt]=(0,c.useState)(I),[$t,Xt]=(0,c.useState)(),[Qt,Zt]=(0,c.useState)(null),[en,tn]=(0,c.useState)(),nn=async(e,t)=>{var n;const r=null!=t?t:yn;if(e&&r){const{currentState:t,...i}=await Oe({sessionId:r,placeName:e.placeName,latitude:e.latitude,longitude:e.longitude,uncertaintyKm:null!==(n=e.uncertainty)&&void 0!==n?n:0});t&&0===i.resultCode&&bn((e=>{var n;return{...e,...t,hints:(null===(n=t.hints)||void 0===n?void 0:n.length)?t.hints:null==e?void 0:e.hints}}))}};(0,c.useEffect)((()=>{const e=LB("position",void 0);e&&tn(e)}),[]);const[rn,on]=(0,c.useState)(""),[sn,an]=(0,c.useState)(!1),[ln,cn]=(0,c.useState)([]),un=e=>{cn((t=>{var n,r;return[...t,{...e,media:null!==(r=null===(n=e.media)||void 0===n?void 0:n.filter((e=>{var t;return!("text/javascript"===e.mimeType&&(null===(t=e.properties)||void 0===t?void 0:t.executable))})))&&void 0!==r?r:[]}]}))},dn=async(t,n,r,i=!0,o,s=!1,a,l=!1,c=!1)=>{var u,d,h,p,m,f;const g=r||yn||(null===(u=window.getMemoriState())||void 0===u?void 0:u.sessionID);if(!g||!(null==t?void 0:t.length))return;s||un({text:t,translatedText:o,fromUser:!0,media:null!=n?n:[],initial:yn?!!r&&r!==yn:!!r}),ut(!0),ht(a);let v=t,y=!1;try{if(!s&&i&&nt&&it.toUpperCase()!==et.toUpperCase()){v=(await SO(t,et,it,M)).text}(null==n?void 0:n.length)&&(null===(h=null===(d=n[0])||void 0===d?void 0:d.properties)||void 0===h?void 0:h.isAttachedFile)&&(v=v+" "+n[0].content);const{currentState:r,...o}=await Ne({sessionId:g,text:v});if(0===o.resultCode&&r){const e=l&&a?a:null!==(p=r.emission)&&void 0!==p?p:null==_n?void 0:_n.emission;it.toLowerCase()!==et.toLowerCase()&&e&&nt?hn(r,it,v).then((e=>{let t=e.translatedEmission||e.emission;t&&Un(t)})):(xn({...r,emission:e}),e&&(un({text:e,emitter:r.emitter,media:r.media,fromUser:!1,questionAnswered:v,generatedByAI:!!r.completion,contextVars:r.contextVars,date:r.currentDate,placeName:r.currentPlaceName,placeLatitude:r.currentLatitude,placeLongitude:r.currentLongitude,placeUncertaintyKm:r.currentUncertaintyKm,tag:r.currentTag,memoryTags:r.memoryTags}),Un(e)))}else 404===o.resultCode&&(cn((e=>[...e.slice(0,e.length-1)])),Cn(!1,Kt||e.secretToken,$t,void 0,void 0,{PATHNAME:window.location.pathname,ROUTE:(null===(f=null===(m=window.location.pathname)||void 0===m?void 0:m.split("/"))||void 0===f?void 0:f.pop())||"",...N||{}},O).then((e=>{console.info("session timeout"),(null==e?void 0:e.sessionID)&&setTimeout((()=>{dn(t,n,null==e?void 0:e.sessionID)}),500)})))}catch(e){console.error(e),y=!0,ht(void 0),ut(!1)}c||(ht(void 0),ut(!1))},hn=async(e,t,n,r=!1)=>{var i,o,s;const a=null!==(i=null==e?void 0:e.emission)&&void 0!==i?i:null==_n?void 0:_n.emission;let l={...e},c=null;if(a&&et.toUpperCase()!==t.toUpperCase()&&nt&&!r)try{const r=await SO(a,t,et,M);if(e.hints&&e.hints.length>0){const n=await Promise.all((null!==(o=e.hints)&&void 0!==o?o:[]).map((async e=>{var n;const r=await SO(e,t,et,M);return{text:null!==(n=null==r?void 0:r.text)&&void 0!==n?n:e,originalText:e}})));l={...e,emission:r.text,translatedHints:n}}else l={...e,emission:a,translatedEmission:r.text,hints:null!==(s=e.hints)&&void 0!==s?s:"G1"===e.state?null==_n?void 0:_n.hints:[]};r.text.length>0&&(c={text:a,translatedText:r.text,emitter:e.emitter,media:e.media,fromUser:!1,questionAnswered:n,generatedByAI:!!e.completion,contextVars:e.contextVars,date:e.currentDate,placeName:e.currentPlaceName,placeLatitude:e.currentLatitude,placeLongitude:e.currentLongitude,placeUncertaintyKm:e.currentUncertaintyKm,tag:e.currentTag,memoryTags:e.memoryTags})}catch(t){console.error("[TRANSLATE] Error during translation:",t),l={...e,emission:a},c={text:a,emitter:e.emitter,media:e.media,fromUser:!1,questionAnswered:n,contextVars:e.contextVars,date:e.currentDate,placeName:e.currentPlaceName,placeLatitude:e.currentLatitude,placeLongitude:e.currentLongitude,placeUncertaintyKm:e.currentUncertaintyKm,tag:e.currentTag,memoryTags:e.memoryTags}}else l={...e,emission:a},a&&(c={text:a,emitter:e.emitter,media:e.media,fromUser:!1,questionAnswered:n,contextVars:e.contextVars,date:e.currentDate,placeName:e.currentPlaceName,placeLatitude:e.currentLatitude,placeLongitude:e.currentLongitude,placeUncertaintyKm:e.currentUncertaintyKm,tag:e.currentTag,memoryTags:e.memoryTags});return xn(l),!r&&c&&un(c),l},pn=void 0!==e.ageRestriction?e.ageRestriction:e.nsfw?18:e.enableCompletions?14:0,[mn,fn]=(0,c.useState)(),[gn,vn]=(0,c.useState)(!1),[yn,Sn]=(0,c.useState)(k),[_n,bn]=(0,c.useState)(),xn=e=>{var t;bn(e),H&&H(e);const n=new CustomEvent("MemoriNewDialogState",{detail:e});document.dispatchEvent(n);const r=null===(t=null==e?void 0:e.media)||void 0===t?void 0:t.filter((e=>{var t;return"text/javascript"===e.mimeType&&!!(null===(t=e.properties)||void 0===t?void 0:t.executable)}));null==r||r.forEach((e=>{try{setTimeout((()=>{var t;console.log("snippet",e),new Function(null!==(t=e.content)&&void 0!==t?t:"")(),setTimeout((()=>{var e,t,n;null===(e=document.querySelector(".memori-chat--content"))||void 0===e||e.scrollTo(0,null!==(n=null===(t=document.querySelector(".memori-chat--content"))||void 0===t?void 0:t.scrollHeight)&&void 0!==n?n:0)}),400)}),1e3)}catch(e){console.warn(e)}}))},wn=async n=>{var r,i,o,a,l;let c=LB("birthDate",void 0),u=null!==(r=null!=mn?mn:n.birthDate)&&void 0!==r?r:c;if(u||!pn)if("PUBLIC"===e.privacyType||e.secretToken||Kt||$t){lt(!0);try{let r;try{r=window.location.href}catch(e){console.debug(e)}const c=await Pe({...n,birthDate:u,tag:null!==(i=n.tag)&&void 0!==i?i:null==B?void 0:B.tag,pin:null!==(o=n.pin)&&void 0!==o?o:null==B?void 0:B.pin,additionalInfo:{...V||{},loginToken:null!==(l=null!==(a=null!=UU?UU:Ve)&&void 0!==a?a:null==V?void 0:V.loginToken)&&void 0!==l?l:z,language:Ln(it),referral:r,timeZoneOffset:(new Date).getTimezoneOffset().toString()}});if((null==c?void 0:c.sessionID)&&(null==c?void 0:c.currentState)&&0===c.resultCode)return Sn(c.sessionID),je((null==_n?void 0:_n.currentTag)===e.giverTag),en&&nn(en,c.sessionID),lt(!1),{dialogState:c.currentState,sessionID:c.sessionID};if(!(null==c?void 0:c.resultMessage.startsWith("This Memori is aged restricted")))return 403===(null==c?void 0:c.resultCode)?(Yt(void 0),Zt("password"),c):(console.warn(c),t(ed).error((e=>(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:Ee(iO(null==c?void 0:c.resultCode))}),(0,s.jsx)(Em,{outlined:!0,padded:!1,onClick:()=>t(ed).dismiss(e.id),icon:(0,s.jsx)(Tm,{}),children:Ee("close")})]})),{duration:1/0}),Ze(!0),c);console.warn(c),t(ed).error(Ee("underageTwinSession",{age:pn})),Ze(!0)}catch(e){console.error(e)}}else Zt("password");else vn(!0)},Cn=async(n=!1,r,i,o,s,a,l,c)=>{var u,d,h,p,m;lt(!0);let f=LB("birthDate",void 0),g=null!=c?c:f;try{if(!g&&pn)return void vn(!0);if(!("PUBLIC"===e.privacyType||r||e.secretToken||Kt||i||$t))return void Zt("password");let c;try{c=window.location.href,console.log("[REOPEN_SESSION] Got referral:",c)}catch(e){console.debug("[REOPEN_SESSION] Error getting referral:",e)}const{sessionID:f,currentState:v,...y}=await Pe({memoriID:null!==(u=e.engineMemoriID)&&void 0!==u?u:"",password:r||Kt||e.secretToken,recoveryTokens:i||$t,tag:null!=o?o:null==B?void 0:B.tag,pin:null!=s?s:null==B?void 0:B.pin,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:(null===(h=null===(d=window.location.pathname)||void 0===d?void 0:d.split("/"))||void 0===h?void 0:h.pop())||"",...a||{}},initialQuestion:l,birthDate:g,additionalInfo:{...V||{},loginToken:null!==(m=null!==(p=null!=UU?UU:Ve)&&void 0!==p?p:null==V?void 0:V.loginToken)&&void 0!==m?m:z,language:Ln(it),referral:c,timeZoneOffset:(new Date).getTimezoneOffset().toString()}});if(f&&v&&0===y.resultCode)return Sn(f),n&&(xn(v),v.emission&&(ln.length<=1?cn([{text:v.emission,emitter:v.emitter,media:v.media,fromUser:!1,initial:!0,contextVars:v.contextVars,date:v.currentDate,placeName:v.currentPlaceName,placeLatitude:v.currentLatitude,placeLongitude:v.currentLongitude,placeUncertaintyKm:v.currentUncertaintyKm,tag:v.currentTag,memoryTags:v.memoryTags}]):un({text:v.emission,emitter:v.emitter,media:v.media,fromUser:!1,initial:!0,contextVars:v.contextVars,date:v.currentDate,placeName:v.currentPlaceName,placeLatitude:v.currentLatitude,placeLongitude:v.currentLongitude,placeUncertaintyKm:v.currentUncertaintyKm,tag:v.currentTag,memoryTags:v.memoryTags}))),en&&nn(en,f),e.needsDateTime&&En({sessionID:f,state:v}),lt(!1),{dialogState:v,sessionID:f};(null==y?void 0:y.resultMessage.startsWith("This Memori is aged restricted"))?(console.error("[REOPEN_SESSION] Age restriction error:",y),t(ed).error(Ee("underageTwinSession",{age:pn})),Ze(!0)):403===(null==y?void 0:y.resultCode)?(console.error("[REOPEN_SESSION] Authentication error"),Yt(void 0),Zt("password")):(console.error("[REOPEN_SESSION] Other error:",y),t(ed).error(Ee(iO(y.resultCode))),Ze(!0))}catch(e){console.error("[REOPEN_SESSION] Caught error:",e)}return lt(!1),null},An=async(t,n,r,i)=>{var o,s,a,l,c;if(!t||!n)return console.error("CHANGETAG/Session not found"),Promise.reject("Session not found");try{const{currentState:t,resultCode:u}=await Le(n,null!=r?r:lO);if(0===u){let d=0;if(r!==lO&&i&&("X1a"===t.state||"X1b"===t.state)){const{resultCode:e}=await Ne({sessionId:n,text:null!=i?i:""});d=e}if(0===d){const{currentState:e,...t}=await Be(n);if(0===t.resultCode&&e)return{currentState:e,sessionId:n,...t}}else if([400,401,403,404,500].includes(u)){console.warn("[APPCONTEXT/CHANGETAG]",u);let t,n=LB("birthDate",void 0);try{t=window.location.href}catch(e){console.debug(e)}wn({memoriID:null!==(o=e.engineMemoriID)&&void 0!==o?o:"",password:I||Kt||e.secretToken,tag:null!=r?r:null==B?void 0:B.tag,pin:null!=i?i:null==B?void 0:B.pin,initialContextVars:{PATHNAME:window.location.pathname,ROUTE:(null===(a=null===(s=window.location.pathname)||void 0===s?void 0:s.split("/"))||void 0===a?void 0:a.pop())||"",...N||{}},initialQuestion:O,birthDate:mn||n||void 0,additionalInfo:{...V||{},loginToken:null!==(c=null!==(l=null!=UU?UU:Ve)&&void 0!==l?l:null==V?void 0:V.loginToken)&&void 0!==c?c:z,language:Ln(it),referral:t,timeZoneOffset:(new Date).getTimezoneOffset().toString()}})}else if(t)return{currentState:t,sessionId:n,resultCode:u}}}catch(e){let t=e;return console.warn("[APPCONTEXT/CHANGETAG]",t),Promise.reject(t)}return null},En=(0,c.useCallback)((async({sessionID:t,date:n,state:r})=>{var i;const o=null!=t?t:yn,s=null!=r?r:_n;if(!o||!e.needsDateTime||(null===(i=null==s?void 0:s.hints)||void 0===i?void 0:i.length))return;const a=(n?As.DateTime.fromISO(n):As.DateTime.now()).toUTC().toFormat("yyyy/MM/dd HH:mm:ss ZZ").split(":").slice(0,-1).join(":"),{currentState:l,...c}=await De(o,a);0===c.resultCode&&l&&bn((e=>{var t;return{...e,...l,hints:(null===(t=l.hints)||void 0===t?void 0:t.length)?l.hints:null==e?void 0:e.hints}}))}),[_n,e.needsDateTime,yn]);(0,c.useEffect)((()=>{if(yn&&e.needsDateTime){En({sessionID:yn,state:_n});let e=setInterval((()=>{En({sessionID:yn})}),6e4);return()=>{clearInterval(e)}}}),[e.needsDateTime,yn]);const[Tn,In]=(0,c.useState)(),Mn=(0,c.useRef)(),Rn=()=>{Tn&&(clearTimeout(Tn),In(void 0)),(null==Mn?void 0:Mn.current)&&(clearTimeout(Mn.current),Mn.current=void 0)},Pn=()=>{Rn(),Ot||rn.length||ct||sn||On()},Nn=async()=>{var e;if(!ft||Ot||rn.length||ct||sn)Pn();else if(yn&&ft&&(null==_n?void 0:_n.acceptsTimeout)){const{currentState:t,...n}=await ke(yn);if(0===n.resultCode&&t){const n=t.emission;if(nt&&it!==(null==Te?void 0:Te.language)&&n&&n.length>0)hn({...t,emission:n},it).then((e=>{let t=e.translatedEmission||e.emission;t&&Un(t)}));else{if(!(n&&n.length>0))return void Pn();un({text:n,emitter:t.emitter,media:t.media,fromUser:!1,generatedByAI:!!t.completion,contextVars:t.contextVars,date:t.currentDate,placeName:t.currentPlaceName,placeLatitude:t.currentLatitude,placeLongitude:t.currentLongitude,placeUncertaintyKm:t.currentUncertaintyKm,tag:t.currentTag,memoryTags:t.memoryTags}),Un(n),xn({...t,hints:null!==(e=t.hints)&&void 0!==e?e:"G1"===t.state?null==_n?void 0:_n.hints:[]})}}}},On=()=>{let e=null==_n?void 0:_n.timeout;if(!e){let t=40,n=25;if(e=Math.floor(Math.random()*(t-n))+n,null==_n?void 0:_n.emission){e+=_n.emission.length/26.5}}if(rt&&(e=rt,null==_n?void 0:_n.emission)){e+=_n.emission.length/26.5}let t=setTimeout(Nn,1e3*e);In(t),Mn.current=t};(0,c.useEffect)((()=>{(rn.length||Ot||ct)&&Rn(),yn&&!rn.length&&Pn()}),[null==_n?void 0:_n.acceptsTimeout,null==_n?void 0:_n.timeout,null==_n?void 0:_n.state,Ot,yn,ln,rn,ct,ft]),(0,c.useEffect)((()=>()=>{gt(!1),Xe(!1),Rn(),Mn.current=void 0}),[]);const Dn=()=>{if(!F)return;kU=bs.SpeechConfig.fromSubscription(F,"westeurope"),kU.speechSynthesisLanguage=Ln(it),kU.speechSynthesisVoiceName=kn(it),kU.speechRecognitionLanguage=Ln(it),kU.setProperty("speechSynthesis.outputFormat","viseme"),nR()&&(kU.speechSynthesisOutputFormat=bs.SpeechSynthesisOutputFormat.Audio16Khz32KBitRateMonoMp3),zU=new Xo;let e=zU.createBuffer(1,1e4,22050),t=zU.createBufferSource();t.buffer=e,t.connect(zU.destination),BU=new bs.SpeakerAudioDestination;let n=bs.AudioConfig.fromSpeakerOutput(BU);LU=new bs.SpeechSynthesizer(kU,n)},kn=(0,c.useCallback)((t=>{var n,r,i,o;let s="",a=(null!==(o=null!==(i=null!=t?t:null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])&&void 0!==i?i:Te.language)&&void 0!==o?o:"IT").toUpperCase(),l=e.voiceType;if(e.enableBoardOfExperts&&(null==_n?void 0:_n.emitter)){null==Ar||Ar.find((e=>e.name===(null==_n?void 0:_n.emitter)))}switch(a){case"IT":s=""+("MALE"===l?"it-IT-DiegoNeural":"it-IT-ElsaNeural");break;case"DE":s=""+("MALE"===l?"de-DE-ConradNeural":"de-DE-KatjaNeural");break;case"EN":s=""+("MALE"===l?"en-GB-RyanNeural":"en-GB-SoniaNeural");break;case"ES":s=""+("MALE"===l?"es-ES-AlvaroNeural":"es-ES-ElviraNeural");break;case"FR":s=""+("MALE"===l?"fr-FR-HenriNeural":"fr-FR-DeniseNeural");break;case"PT":s=""+("MALE"===l?"pt-PT-DuarteNeural":"pt-PT-RaquelNeural");break;case"UK":s=""+("MALE"===l?"uk-UA-OstapNeural":"uk-UA-PolinaNeural");break;case"RU":s=""+("MALE"===l?"ru-RU-DmitryNeural":"ru-RU-SvetlanaNeural");break;case"PL":s=""+("MALE"===l?"pl-PL-MarekNeural":"pl-PL-AgnieszkaNeural");break;case"FI":s=""+("MALE"===l?"fi-FI-HarriNeural":"fi-FI-SelmaNeural");break;case"EL":s=""+("MALE"===l?"el-GR-NestorasNeural":"el-GR-AthinaNeural");break;case"AR":s=""+("MALE"===l?"ar-SA-HamedNeural":"ar-SA-ZariyahNeural");break;case"ZH":s=""+("MALE"===l?"zh-CN-YunxiNeural":"zh-CN-XiaoxiaoNeural");break;case"JA":s=""+("MALE"===l?"ja-JP-KeitaNeural":"ja-JP-NanamiNeural");break;default:s=""+("MALE"===l?"it-IT-DiegoNeural":"it-IT-IsabellaNeural")}return s}),[e.voiceType,e.enableBoardOfExperts,null==_n?void 0:_n.emitter,Te.language,e.culture]),Ln=t=>{var n,r;let i="";switch((t||(null===(r=null===(n=e.culture)||void 0===n?void 0:n.split("-"))||void 0===r?void 0:r[0])||Te.language||"IT").toUpperCase()){case"IT":default:i="it-IT";break;case"DE":i="de-DE";break;case"EN":i="en-GB";break;case"ES":i="es-ES";break;case"FR":i="fr-FR";break;case"PT":i="pt-PT";break;case"UK":i="uk-UK";break;case"RU":i="ru-RU";break;case"PL":i="pl-PL";break;case"FI":i="fi-FI";break;case"EL":i="el-GR";break;case"AR":i="ar-SA";break;case"ZH":i="zh-CN";break;case"JA":i="ja-JP"}return i},[Bn,zn]=(0,c.useState)();(0,c.useEffect)((()=>{(async()=>{try{const e=await fetch(`${M||"https://aisuru.com"}/api/lexiconmap`);return await e.json()}catch(e){console.error(e)}})().then((e=>{zn(e)}))}),[]);const Fn=()=>{const e=new CustomEvent("MemoriEndSpeak");document.dispatchEvent(e)},Un=e=>{if(console.debug("speak called with text:",e),!F||m)return console.debug("No TTS key or preview mode, emitting end speak event"),void Fn();if(console.debug("Stopping listening before speaking"),ir(),m)return void console.debug("Preview mode, returning early");if(jU)return console.debug("Speaker muted, skipping speech synthesis"),GU=!1,ut(!1),Fn(),void(Mt&&(console.debug("Setting listening timeout for continuous speech"),Xn()));BU&&(console.debug("Pausing existing audio destination"),BU.pause());let t=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome"),n=/iPad|iPhone|iPod/.test(navigator.userAgent);if(console.debug("Browser detection - Safari:",t,"iOS:",n),"interrupted"===zU.state)return console.debug("Audio context interrupted, attempting resume"),void zU.resume().then((()=>Un(e)));if("closed"===zU.state){console.debug("Audio context closed, creating new context"),zU=new Xo;let e=zU.createBuffer(1,1e4,22050),t=zU.createBufferSource();t.buffer=e,t.connect(zU.destination)}else if("suspended"===zU.state){console.debug("Audio context suspended, stopping audio and creating new context"),Hn(),zU=new Xo;let e=zU.createBuffer(1,1e4,22050),t=zU.createBufferSource();t.buffer=e,t.connect(zU.destination)}LU||Dn();const r=zU.createBufferSource();r.addEventListener("ended",(()=>{console.debug("Audio source ended"),Dt(!1),GU=!1})),BU.onAudioEnd=()=>{console.debug("Audio destination ended"),Dt(!1),GU=!1,r.disconnect(),Fn(),cr()},console.debug("Resetting viseme queue"),Jt(),LU&&(LU.visemeReceived=function(e,t){console.debug("Viseme received:",t.visemeId,"at offset:",t.audioOffset),Wt(t.visemeId,t.audioOffset)});const i=hR(cR(lR(dR(uR(e)))));console.debug("Processed text to speak:",i),setTimeout((()=>{LU&&(console.debug("Starting speech synthesis"),LU.speakSsmlAsync(`<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" xml:lang="${Ln(it)}"><voice name="${kn(it)}"><s>${((e,t)=>{var n;if(!Bn)return e;const r={...null!==(n=Bn.common)&&void 0!==n?n:{},...(null==L?void 0:L.id)&&Bn[L.id]?Bn[L.id]:{}},i=Object.keys(r).map((e=>{var n;return{word:e,phoneme:null!==(n=r[e][t.toLowerCase()])&&void 0!==n?n:r[e].default,caseSensitive:r[e].caseSensitive}}));return i.reduce(((e,{word:t,phoneme:n,caseSensitive:r})=>e.replace(new RegExp(`\\b${t}\\b`,r?"g":"gi"),`<phoneme alphabet="ipa" ph="${n}">${t}</phoneme>`)),e)})(i,it.toLowerCase())}</s></voice></speak>`,(i=>{if(i){console.debug("Speech synthesis successful"),Dt(!0),GU=!0,Ht(zU);try{console.debug("Decoding audio data"),zU.decodeAudioData(i.audioData,(function(e){console.debug("Audio data decoded successfully"),r.buffer=e,r.connect(zU.destination),(ln.length<1||t&&n)&&(console.debug("Starting audio playback"),r.start(0))})),zU.onstatechange=()=>{console.debug("Audio context state changed to:",zU.state),"suspended"===zU.state||"closed"===zU.state?(r.disconnect(),Dt(!1),qt(),Jt(),GU=!1):"interrupted"===zU.state&&zU.resume()},zU.resume(),LU&&(console.debug("Closing speech synthesizer"),LU.close(),LU=null)}catch(t){console.error("Error processing audio data:",t),jn(e)}}else console.debug("No result from speech synthesis, using fallback"),jn(e)}),(t=>{console.error("Speak error:",t),jn(e)})))}),100),ut(!1)},jn=e=>{window.speechSynthesis.speak(new SpeechSynthesisUtterance(e)),Gn()},Gn=()=>{Dt(!1),qt(),Jt(),GU=!1;try{if(LU){const e=LU;LU=null,console.debug("Closing speech synthesizer"),e.close()}}catch(e){console.debug("Error during synthesizer cleanup:",e),LU=null}Fn()},Hn=async()=>{Dt(!1),GU=!1;try{if(LU){const e=LU;LU=null;try{e.close()}catch(e){console.debug("Error closing speech synthesizer:",e)}}"closed"!==(null==zU?void 0:zU.state)&&zU.close(),BU&&(BU.pause(),BU.close())}catch(e){console.debug("stopAudio error: ",e)}};(0,c.useEffect)((()=>{"TOTEM"!==pt&&(()=>{let e=document.querySelector("#chat-fieldset textarea");e&&Ge?e.focus():null==e||e.blur()})()}),[null==_n?void 0:_n.emission]);const[Vn,Wn]=(0,c.useState)(""),[qn,Jn]=(0,c.useState)(null),[Kn,Yn]=(0,c.useState)(!1),$n=()=>{Wn("")},Xn=()=>{Qn();const e=setTimeout(rr,1e3*Pt+300);Jn(e)},Qn=()=>{qn&&(clearTimeout(qn),Jn(null))};(0,c.useEffect)((()=>{Kn||(Qn(),Mt&&Xn(),Pn())}),[Vn,Kn]),(0,c.useEffect)((()=>()=>{Qn()}),[]);const Zn=async()=>{if(!F)throw new Error("No TTS key available");if(!yn)throw new Error("No session ID available");Gn(),$n();try{await navigator.mediaDevices.getUserMedia({audio:!0});yt(!0),kU=er(F);const e=bs.AudioConfig.fromDefaultMicrophoneInput();DU=new bs.SpeechRecognizer(kU,e),tr(DU),an(!0),DU.startContinuousRecognitionAsync(),DU.canceled=(e,t)=>{t.reason===bs.CancellationReason.Error&&(console.debug(`"CANCELED: ErrorCode=${t.errorCode}`),console.debug(`"CANCELED: ErrorDetails=${t.errorDetails}`),console.debug("CANCELED: Did you set the speech resource key and region values?"),ir(),Gn()),ir()},DU.sessionStopped=(e,t)=>{ir(),$n()}}catch(e){throw console.error("Error in startListening:",e),ir(),e}},er=e=>(kU=bs.SpeechConfig.fromSubscription(e,"westeurope"),kU.speechRecognitionLanguage=Ln(it),kU.speechSynthesisLanguage=Ln(it),kU.speechSynthesisVoiceName=kn(it),kU),tr=e=>{e&&(e.recognized=(e,t)=>{nr(t.result.text)},e.properties.setProperty("SpeechServiceResponse_JsonResult","true"),e.properties.setProperty("SpeechServiceConnection_NoiseSuppression","true"),e.properties.setProperty("SpeechServiceConnection_SNRThresholdDb","10.0"))},nr=e=>{if(console.debug("Handling recognized speech:",e),!e||0===e.trim().length)return void console.debug("No valid text received from speech recognition");Wn(e),Yn(!1);const t=aR(e);console.debug("Stripped message:",t),t.length>0&&on(t)},rr=()=>{const e=aR(Vn);e.length>0&&sn?(dn(e),$n(),on(""),or()):sn&&Pn()},ir=()=>{console.debug("Stopping speech recognition"),DU&&(DU.stopContinuousRecognitionAsync(),DU.close(),DU=null),an(!1)},or=()=>{ir(),Qn(),Yn(!1)},sr=()=>{try{or(),Rn(),Xe(!1),Mn.current=void 0,Hn()}catch(e){console.log("Error: resetUIEffects",e)}};(0,c.useEffect)((()=>()=>{sr()}),[]),(0,c.useEffect)((()=>(document.addEventListener("MemoriResetUIEffects",sr),()=>{document.removeEventListener("MemoriResetUIEffects",sr)})),[]),(0,c.useEffect)((()=>{"Z0"===(null==_n?void 0:_n.state)&&or()}),[null==_n?void 0:_n.state]);const[ar,lr]=(0,c.useState)(!1),cr=(0,c.useCallback)((e=>{Ot&&LU&&(LU.close(),LU=null),!Mt||!vt&&ar||(lr(!0),Zn())}),[Mt,vt]);(0,c.useEffect)((()=>{Ot||!Mt||!vt&&ar||!yn?Ot&&sn&&ir():Zn()}),[Ot,vt]),(0,c.useEffect)((()=>{sn&&(or(),$n(),on(""),Zn())}),[et]);const[ur,dr]=(0,c.useState)("keypress");(0,c.useEffect)((()=>{window.innerWidth<=768&&nR()?dr("click"):dr("keypress")}),[]);const[hr,pr]=(0,c.useState)(),mr=null==tt?void 0:tt.globalBackground,fr=mr?`url(${mr})`:null,gr=u?{"--memori-chat-bubble-bg":"#fff",...tt&&!Ue?{"--memori-text-color":null!==(de=tt.textColor)&&void 0!==de?de:"#000"}:{},...(null==tt?void 0:tt.buttonBgColor)?{"--memori-button-bg":tt.buttonBgColor,"--memori-primary":tt.buttonBgColor}:{},...(null==tt?void 0:tt.buttonTextColor)?{"--memori-button-text":tt.buttonTextColor}:{},...(null==tt?void 0:tt.blurBackground)?{"--memori-blur-background":"5px"}:{"--memori-blur-background":"0px"},...(null==tt?void 0:tt.innerBgColor)?{"--memori-inner-bg":`rgba(${"dark"===tt.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(he=tt.innerBgAlpha)&&void 0!==he?he:.4})`,"--memori-inner-content-pad":"1.5rem","--memori-nav-bg-image":"none","--memori-nav-bg":`rgba(${"dark"===tt.innerBgColor?"0, 0, 0":"255, 255, 255"}, ${null!==(pe=null==tt?void 0:tt.innerBgAlpha)&&void 0!==pe?pe:.4})`}:{"--memori-inner-content-pad":"0px"}}:{},vr=`\n ${m?"#preview, ":$?":root, ":""}memori-client, .memori-widget, .memori-drawer, .memori-modal {\n ${Object.entries(gr).map((([e,t])=>`${e}: ${t};`)).join("\n")}\n }\n `,yr=void 0===(null==tt?void 0:tt.showAIicon)||(null==tt?void 0:tt.showAIicon),Sr=!!(null!=A?A:null==tt?void 0:tt.showUpload),_r=void 0===(null==tt?void 0:tt.showWhyThisAnswer)||(null==tt?void 0:tt.showWhyThisAnswer),[br,xr]=(0,c.useState)(!1);(0,c.useEffect)((()=>{(window.innerWidth>=768&&"FULLPAGE"===pt||"FULLPAGE"!==pt)&&xr(!0)}),[]),(0,c.useEffect)((()=>{if(null==tt?void 0:tt.seoTitle){let e=document.createElement("meta");e.setAttribute("property","og:title"),e.setAttribute("content",tt.seoTitle),document.head.append(e)}if(null==tt?void 0:tt.seoDescription){let e=document.createElement("meta");e.setAttribute("property","og:description"),e.setAttribute("content",tt.seoDescription),document.head.append(e)}if(null==tt?void 0:tt.seoUrl){let e=document.createElement("meta");e.setAttribute("property","og:url"),e.setAttribute("content",tt.seoUrl),document.head.append(e)}let t=D||e.avatarURL;if((null==tt?void 0:tt.seoImageShowAvatar)&&t){let e=document.createElement("meta");e.setAttribute("property","og:image"),e.setAttribute("content",t),document.head.append(e)}}),[tt,e.avatarURL,D]);const wr=(0,c.useCallback)((e=>{if(G)return;const{text:t,waitForPrevious:n,hidden:r,typingText:i,useLoaderTextAsMsg:o,hasBatchQueued:s}=e.detail;t&&(n&&!jU&&(GU||ct)?setTimeout((()=>{wr(e)}),1e3):(ir(),Hn(),dn(t,void 0,void 0,void 0,void 0,r,i,o,s)))}),[yn,Ot,ct,it,G]);(0,c.useEffect)((()=>(G?document.removeEventListener("MemoriTextEntered",wr):document.addEventListener("MemoriTextEntered",wr),()=>{document.removeEventListener("MemoriTextEntered",wr)})),[yn,it,G]);const Cr=(0,c.useCallback)((async(t,n=!1)=>{var r,i,o,s,a,l,c,u,d,h,p,m,f,g,v,y;const S=(null==t?void 0:t.sessionID)||yn,_=(null==t?void 0:t.dialogState)||_n;Xe(!0);let b=[],x=document.getElementById("memori-audio"),w=window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome");x&&w&&(x.muted=!1,x.play().catch((e=>{console.warn("error playing intro audio",e)})));let C=LB("birthDate",void 0),A=mn||C||(null==qe?void 0:qe.birthDate);if(!A&&Y&&k&&(A="1970-01-01T10:24:03.845Z"),S||!pn||A){if(!S&&"PUBLIC"!==e.privacyType&&!e.secretToken&&!Kt&&!$t||!S&&Qe)return Zt("password"),void Xe(!1);if(!S||n){Xe(!1),Ze(!1);const t=await wn({memoriID:e.engineMemoriID,password:I||Kt||e.secretToken,tag:null==B?void 0:B.tag,pin:null==B?void 0:B.pin,initialContextVars:{PATHNAME:null===(r=window.location.pathname)||void 0===r?void 0:r.toUpperCase(),ROUTE:(null===(s=null===(o=null===(i=window.location.pathname)||void 0===i?void 0:i.split("/"))||void 0===o?void 0:o.pop())||void 0===s?void 0:s.toUpperCase())||"",...N||{}},initialQuestion:O,birthDate:A,additionalInfo:{...V||{},loginToken:null!==(l=null!==(a=null!=UU?UU:Ve)&&void 0!==a?a:null==V?void 0:V.loginToken)&&void 0!==l?l:z,language:Ln(it),timeZoneOffset:(new Date).getTimezoneOffset().toString()}});return void((null==t?void 0:t.dialogState)?(cn([]),hn(t.dialogState,it).then((e=>{let t=e.translatedEmission||e.emission;t&&Un(t)})).finally((()=>{gt(!0)}))):0===(null==t?void 0:t.resultCode)?await Cr(t||void 0):lt(!1))}if(k){console.debug("[CLICK_START] Handling initial session");const{currentState:t,...n}=await Be(S);if(0!==n.resultCode||!t)return console.debug("[CLICK_START] Session expired, opening new session"),Ze(!0),Sn(void 0),Xe(!1),void await Cr(void 0,!0);if(cn([]),en&&nn(en,S),e.needsDateTime&&En({sessionID:S,state:t}),B&&t.currentTag!==B.tag)try{console.debug("[CLICK_START] Changing tag for personification",B,t),await An(e.engineMemoriID,S,"-");const n=await An(e.engineMemoriID,S,B.tag,B.pin);if(!n||0!==n.resultCode)throw console.error("[CLICK_START] Session error:",n),new Error("No session");hn(n.currentState,it).then((e=>{let t=e.translatedEmission||e.emission;t&&Un(t)})).finally((()=>{gt(!0)}))}catch(t){console.error("[CLICK_START] Error changing tag:",t),Cn(!0,null==e?void 0:e.secretToken,void 0,B.tag,B.pin,{PATHNAME:null===(c=window.location.pathname)||void 0===c?void 0:c.toUpperCase(),ROUTE:(null===(h=null===(d=null===(u=window.location.pathname)||void 0===u?void 0:u.split("/"))||void 0===d?void 0:d.pop())||void 0===h?void 0:h.toUpperCase())||"",...N||{}},O,A).then((()=>{gt(!0)}))}else if(!B&&(null==t?void 0:t.currentTag)&&(null==t?void 0:t.currentTag)!==lO&&"-"!==(null==t?void 0:t.currentTag))try{console.debug("[CLICK_START] Changing to anonymous tag"),await An(e.engineMemoriID,S,"-");const t=await An(e.engineMemoriID,S,lO);if(!t||0!==t.resultCode)throw console.error("[CLICK_START] Session error:",t),new Error("No session");hn(t.currentState,it).then((e=>{let t=e.translatedEmission||e.emission;t&&Un(t)})).finally((()=>{gt(!0)}))}catch(t){console.error("[CLICK_START] Error changing tag:",t),Cn(!0,null==e?void 0:e.secretToken,void 0,void 0,void 0,{PATHNAME:null===(p=window.location.pathname)||void 0===p?void 0:p.toUpperCase(),ROUTE:(null===(g=null===(f=null===(m=window.location.pathname)||void 0===m?void 0:m.split("/"))||void 0===f?void 0:f.pop())||void 0===g?void 0:g.toUpperCase())||"",...N||{}},O,A).then((()=>{gt(!0)}))}else{try{console.debug("[CLICK_START] Getting chat history");const{chatLogs:e,...n}=await Fe(S,S),r=null===(v=null==e?void 0:e[0])||void 0===v?void 0:v.lines.map(((e,t)=>{var n,r;return{text:e.text,media:null===(r=null===(n=e.media)||void 0===n?void 0:n.filter((e=>aO.includes(e.mimeType))))||void 0===r?void 0:r.map((e=>({mediumID:`${t}-${e.mimeType}`,...e}))),fromUser:e.inbound,timestamp:e.timestamp,emitter:e.emitter,initial:0===t}}));if(b=null!=r?r:[],et.toUpperCase()!==it.toUpperCase()&&nt)try{console.debug("[CLICK_START] Translating messages"),b=await Promise.all(r.map((async e=>({...e,originalText:e.text,text:(await SO(e.text,it,et,M)).text}))))}catch(e){}cn(b),console.debug("[CLICK_START] props currentState:",t,"userLang:",it,"translatedMessages:",b,"history:",ln)}catch(e){console.log("[CLICK_START] Error retrieving chat logs:",e)}if((null==b?void 0:b.length)&&b.length>1||!O)console.log("[CLICK_START] Using existing chat history"),hn(t,it,void 0,!!(null==b?void 0:b.length)).then((e=>{let t=e.translatedEmission||e.emission;t&&Un(t)})).finally((()=>{gt(!0)}));else{console.log("[CLICK_START] Using existing chat history with message from initial question"),b=[],cn([]),ut(!0);const e=await Ne({sessionId:S,text:O});hn(null!==(y=e.currentState)&&void 0!==y?y:t,it,void 0,!1).then((e=>{let t=e.translatedEmission||e.emission;t&&Un(t)})).finally((()=>{ut(!1),gt(!0)}))}}en&&nn(en,S),e.needsDateTime&&En({sessionID:S,state:t})}else console.debug("[CLICK_START] Using existing session"),cn([]),hn(_,it).then((e=>{let t=e.translatedEmission||e.emission;t&&Un(t)})).finally((()=>{gt(!0)}))}else vn(!0),Xe(!1)}),[Kt,e,$t,mn,yn,it,en]);(0,c.useEffect)((()=>{!$e&&Y&&(F&&!LU&&Dn(),Cr())}),[$e,Y]),(0,c.useEffect)((()=>{const t=document.querySelector(`memori-client[memoriname="${e.name}"]`)||document.querySelector(`memori-client[memoriid="${e.memoriID}"]`)||document.querySelector("memori-client");if(!t)return;const n=new MutationObserver(((e,t)=>{var n,r,i;for(const t of e)"attributes"===t.type&&"authtoken"===(null===(n=t.attributeName)||void 0===n?void 0:n.toLowerCase())&&("MEMORI-CLIENT"===t.target.nodeName?(We(t.target.getAttribute("authtoken")||void 0),UU=t.target.getAttribute("authtoken")||void 0):(We((null===(i=null===(r=t.target)||void 0===r?void 0:r.parentElement)||void 0===i?void 0:i.getAttribute("authtoken"))||void 0),UU=t.target.getAttribute("authtoken")||void 0))}));return n.observe(t,{attributes:!0,childList:!1,subtree:!1}),()=>{n.disconnect()}}),[]);const[Ar,Er]=(0,c.useState)(),Tr=(0,c.useCallback)((async()=>{if(yn&&(null==e?void 0:e.enableBoardOfExperts))try{const{experts:e,count:t,...n}=await ze(yn);0===n.resultCode?Er(e):console.warn("Error fetching experts",n)}catch(e){console.warn(e)}}),[yn,null==e?void 0:e.enableBoardOfExperts]);(0,c.useEffect)((()=>{Tr()}),[yn,Tr]);const Ir=e.enableDeepThought&&!!Ve&&!!(null==qe?void 0:qe.userID)&&(null==qe?void 0:qe.pAndCUAccepted),Mr=null==L?void 0:L.billingDelegation,[Rr,Pr]=(0,c.useState)(!0),Nr=(0,c.useCallback)((async()=>{if(null==L?void 0:L.billingDelegation)try{const e=await NU({operation:Ir?"dt_session_creation":"session_creation",baseUrl:M,userID:r,userName:i,tenant:o});e.enough?Pr(!0):(Pr(!1),console.warn("Not enough credits. Required:",e.required))}catch(e){let t=e;console.debug(t)}}),[null==L?void 0:L.billingDelegation,Ir]);(0,c.useEffect)((()=>{(null==L?void 0:L.billingDelegation)&&Nr()}),[null==L?void 0:L.billingDelegation,Ir]);const Or=void 0===E?"TOTEM"!==pt&&"WEBSITE_ASSISTANT"!==pt&&"HIDDEN_CHAT"!==pt:!E,Dr={memori:e,tenant:L,history:ln,showShare:null===(me=null!=p?p:null==tt?void 0:tt.showShare)||void 0===me||me,position:en,setShowPositionDrawer:_t,setShowSettingsDrawer:xt,setShowKnownFactsDrawer:Ct,setShowExpertsDrawer:Et,enableAudio:null===(fe=null!=U?U:null==tt?void 0:tt.enableAudio)||void 0===fe||fe,showSpeaker:!!F,speakerMuted:Tt||jU,setSpeakerMuted:e=>{if(jU=!!e,It(e),"CONTINUOUS"===LB("microphoneMode","HOLD_TO_TALK")&&e&&(Rt(!1),BB("microphoneMode","HOLD_TO_TALK")),BB("muteSpeaker",!!e),e)Hn();else{zU=new Xo;let e=zU.createBuffer(1,1e4,22050),t=zU.createBufferSource();t.buffer=e,t.connect(zU.destination)}},showSettings:null===(ge=null!=b?b:null==tt?void 0:tt.showSettings)||void 0===ge||ge,hasUserActivatedSpeak:ft,showReload:"TOTEM"===pt,showClear:w,clearHistory:()=>cn((e=>e.slice(-1))),showLogin:C,setShowLoginDrawer:Ye,loginToken:Ve,user:qe,sessionID:yn},kr={memori:e,integration:u,integrationConfig:tt,tenant:L,instruct:Ue,avatar3dVisible:br,setAvatar3dVisible:xr,hasUserActivatedSpeak:ft,isPlayingAudio:Ot&&!Tt,loading:!!ct,baseUrl:M,apiUrl:Re.constants.BACKEND_URL,enablePositionControls:Bt,setEnablePositionControls:zt,avatarType:Ft},Lr={memori:e,tenant:L,language:et,userLang:it,setUserLang:ot,baseUrl:M,apiUrl:Re.constants.BACKEND_URL,position:en,openPositionDrawer:()=>_t(!0),integrationConfig:tt,instruct:Ue,sessionId:yn,clickedStart:$e,isMultilanguageEnabled:nt,onClickStart:Cr,initializeTTS:Dn,isUserLoggedIn:!!Ve&&!!(null==qe?void 0:qe.userID),hasInitialSession:!!k,notEnoughCredits:Mr&&!Rr,showLogin:C,setShowLoginDrawer:Ye,user:qe},Br={memori:e,sessionID:yn||"",tenant:L,translateTo:nt&&it.toUpperCase()!==(null===(be=null!==(_e=null!==(Se=null===(ye=null===(ve=e.culture)||void 0===ve?void 0:ve.split("-"))||void 0===ye?void 0:ye[0])&&void 0!==Se?Se:Te.language)&&void 0!==_e?_e:"IT")||void 0===be?void 0:be.toUpperCase())?it:void 0,baseUrl:M,apiUrl:Re.constants.BACKEND_URL,layout:d,memoriTyping:ct,typingText:dt,showTypingText:x,history:Or?ln:ln.slice(-2),authToken:null!==(we=null!==(xe=null!=Ve?Ve:UU)&&void 0!==xe?xe:null==V?void 0:V.loginToken)&&void 0!==we?we:z,dialogState:_n,setDialogState:xn,pushMessage:un,simulateUserPrompt:(e,t)=>{ir(),Hn(),dn(e,void 0,void 0,!1,t)},showDates:S,showContextPerLine:_,showAIicon:yr,showUpload:Sr,showWhyThisAnswer:_r,showCopyButton:g,showTranslationOriginal:v,client:Re,instruct:Ue,preview:m,sendOnEnter:ur,setSendOnEnter:dr,microphoneMode:Mt?"CONTINUOUS":"HOLD_TO_TALK",attachmentsMenuOpen:hr,setAttachmentsMenuOpen:pr,showInputs:y,showMicrophone:!!F,userMessage:rn,onChangeUserMessage:e=>{if(!e||"\n"===e||""===e.trim())return on(""),void Pn();on(e),Rn()},sendMessage:(e,t)=>{Hn(),ir(),dn(e,t?[{mediumID:t.mediumID,mimeType:t.mimeType,content:t.content,title:t.title,properties:t.properties}]:void 0),on(""),$n()},stopListening:or,startListening:Zn,stopAudio:Hn,resetTranscript:$n,listening:sn,setEnableFocusChatInput:He,isPlayingAudio:Ot,customMediaRenderer:q,user:qe,userAvatar:J,experts:Ar,useMathFormatting:st},zr=u&&fr?(0,s.jsx)("div",{className:"memori--global-background",children:(0,s.jsx)("div",{className:"memori--global-background-image",style:{backgroundImage:fr}})}):(0,s.jsx)("div",{className:"memori--global-background no-background-image"}),Fr=u?(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:vr}}):null,Ur=(0,s.jsx)(WF,{tenant:L,userLang:it,integrationID:null==u?void 0:u.integrationID,memoriHash:`${e.ownerTenantName}-${e.ownerUserName}-${e.name}`}),jr=h||("TOTEM"===pt?TU:"CHAT"===pt?IU:"FULLPAGE"===pt?EU:"WEBSITE_ASSISTANT"===pt?MU:"HIDDEN_CHAT"===pt?RU:"ZOOMED_FULL_BODY"===pt?PU:EU);return(0,s.jsxs)("div",{className:t(Cs)("memori","memori-widget",`memori-layout-${pt.toLowerCase()}`,`memori-controls-${kt.toLowerCase()}`,`memori--avatar-${(null==tt?void 0:tt.avatar)||"default"}`,{"memori--auto-start":Y,"memori--preview":m,"memori--embed":f,"memori--with-integration":u,"memori--with-speechkey":!!F,"memori--active":ft,"memori--hide-emissions":jt,"memori--has-active-session":!!yn}),"data-memori-name":null==e?void 0:e.name,"data-memori-id":null==e?void 0:e.engineMemoriID,"data-memori-secondary-id":null==e?void 0:e.memoriID,"data-memori-session-id":yn,"data-memori-integration":null==u?void 0:u.integrationID,"data-memori-engine-state":JSON.stringify({..._n,sessionID:yn}),style:{height:T},children:[(0,s.jsx)(jr,{Header:VF,headerProps:Dr,Avatar:Uz,avatarProps:kr,Chat:tD,chatProps:Br,StartPanel:cD,startPanelProps:Lr,integrationStyle:Fr,integrationBackground:zr,poweredBy:Ur,sessionId:yn,hasUserActivatedSpeak:ft,loading:at}),(0,s.jsx)("audio",{id:"memori-audio",style:{display:"none"},src:"https://aisuru.com/intro.mp3"}),Ie&&(0,s.jsx)(CN,{withModal:!0,pwdOrTokens:Qt,openModal:!!Qt,setPwdOrTokens:Zt,showTokens:"SECRET"===e.privacyType,onFinish:async e=>{var t,n,r,i;e.password&&Yt(e.password),e.password&&(FU=e.password),e.tokens&&Xt(e.tokens),Cn(!yn,e.password,e.tokens,null==B?void 0:B.tag,null==B?void 0:B.pin,{PATHNAME:null===(t=window.location.pathname)||void 0===t?void 0:t.toUpperCase(),ROUTE:(null===(i=null===(r=null===(n=window.location.pathname)||void 0===n?void 0:n.split("/"))||void 0===r?void 0:r.pop())||void 0===i?void 0:i.toUpperCase())||"",...N||{}},O,mn).then((e=>{Zt(null),Cr(e||void 0)})).catch((()=>{Zt(null),Ze(!0)}))},minimumNumberOfRecoveryTokens:null!==(Ae=null==e?void 0:e.minimumNumberOfRecoveryTokens)&&void 0!==Ae?Ae:1}),Ie&&(0,s.jsx)($F,{visible:gn,minAge:pn,onClose:t=>{var n,r,i,o;t?(fn(t),BB("birthDate",t),Cn(!yn,FU||Kt||(null==e?void 0:e.secretToken),$t,null==B?void 0:B.tag,null==B?void 0:B.pin,{PATHNAME:null===(n=window.location.pathname)||void 0===n?void 0:n.toUpperCase(),ROUTE:(null===(o=null===(i=null===(r=window.location.pathname)||void 0===r?void 0:r.split("/"))||void 0===i?void 0:i.pop())||void 0===o?void 0:o.toUpperCase())||"",...N||{}},O,t).then((e=>{vn(!1),Zt(null),Cr(e||void 0)})).catch((()=>{vn(!1),Ze(!0)}))):(vn(!1),Xe(!1))}}),bt&&(0,s.jsx)(fU,{layout:pt,open:!!bt,onClose:()=>xt(!1),microphoneMode:Mt?"CONTINUOUS":"HOLD_TO_TALK",continuousSpeechTimeout:Pt,setMicrophoneMode:e=>Rt("CONTINUOUS"===e),setContinuousSpeechTimeout:Nt,controlsPosition:kt,setControlsPosition:Lt,hideEmissions:jt,setHideEmissions:Gt,avatarType:Ft,setAvatarType:Ut,enablePositionControls:Bt,setEnablePositionControls:zt,isAvatar3d:!!(null==tt?void 0:tt.avatarURL),additionalSettings:W,speakerMuted:jU}),St&&(0,s.jsx)(tP,{memori:e,open:!!St,venue:en,setVenue:e=>{tn(e),nn(e),e?BB("position",JSON.stringify(e)):zB("position")},onClose:e=>{e&&nn(e),_t(!1)}}),wt&&yn&&(0,s.jsx)(SU,{apiClient:Re,memori:e,sessionID:yn,visible:wt,closeDrawer:()=>Ct(!1)}),At&&!!Ar&&(0,s.jsx)(_U,{apiUrl:Re.constants.BACKEND_URL,baseUrl:M,tenant:L,experts:Ar,open:At,onClose:()=>Et(!1)}),Ke&&(null==L?void 0:L.id)&&(0,s.jsx)(AU,{tenant:L,apiClient:Re,open:!!Ke,user:qe,loginToken:Ve,onClose:()=>Ye(!1),onLogin:(e,t)=>{Je(e),We(t),UU=t,Ye(!1),BB("loginToken",t)},onLogout:()=>{Ve&&Re.backend.userLogout(Ve).then((()=>{Ye(!1),Je(void 0),We(void 0),UU=void 0,zB("loginToken")}))}})]})};const VU={id:"aisuru.com",theme:"aisuru",config:{name:"Memori",showNewUser:!1,requirePosition:!1}},WU=async(e,t)=>{const n=t?new URL(`${t.startsWith("http")?"":t.includes("localhost")?"http://":"https://"}${t}`).origin:"https://aisuru.com";try{const t=await fetch(`${n}/api/tenant/${e}`),{tenant:r}=await t.json();return r||{...VU,tenantID:e}}catch(t){return{...VU,tenantID:e}}};function qU(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function JU(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ak(r.key),r)}}function KU(e,t,n){return t&&JU(e.prototype,t),n&&JU(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function YU(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $U(e,t){return $U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},$U(e,t)}function XU(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$U(e,t)}function QU(e,t){if(t&&("object"===wk(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return YU(e)}function ZU(e){return ZU=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ZU(e)}function ej(e){if(Array.isArray(e))return e}function tj(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function nj(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function rj(e,t){if(e){if("string"==typeof e)return nj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nj(e,t):void 0}}function ij(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function oj(e){return ej(e)||tj(e)||rj(e)||ij()}function sj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function aj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sj(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sj(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var lj={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},cj=new(function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};qU(this,e),this.init(t,n)}return KU(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||lj,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,r){return r&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,aj(aj({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}()),uj=function(){function e(){qU(this,e),this.observers={}}return KU(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(this.observers[e]){var i=[].concat(this.observers[e]);i.forEach((function(e){e.apply(void 0,n)}))}if(this.observers["*"]){var o=[].concat(this.observers["*"]);o.forEach((function(t){t.apply(t,[e].concat(n))}))}}}]),e}();function dj(){var e,t,n=new Promise((function(n,r){e=n,t=r}));return n.resolve=e,n.reject=t,n}function hj(e){return null==e?"":""+e}function pj(e,t,n){e.forEach((function(e){t[e]&&(n[e]=t[e])}))}function mj(e,t,n){function r(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var o="string"!=typeof t?[].concat(t):t.split(".");o.length>1;){if(i())return{};var s=r(o.shift());!e[s]&&n&&(e[s]=new n),e=Object.prototype.hasOwnProperty.call(e,s)?e[s]:{}}return i()?{}:{obj:e,k:r(o.shift())}}function fj(e,t,n){var r=mj(e,t,Object);r.obj[r.k]=n}function gj(e,t){var n=mj(e,t),r=n.obj,i=n.k;if(r)return r[i]}function vj(e,t,n){var r=gj(e,n);return void 0!==r?r:gj(t,n)}function yj(e,t,n){for(var r in t)"__proto__"!==r&&"constructor"!==r&&(r in e?"string"==typeof e[r]||e[r]instanceof String||"string"==typeof t[r]||t[r]instanceof String?n&&(e[r]=t[r]):yj(e[r],t[r],n):e[r]=t[r]);return e}function Sj(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var _j={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function bj(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return _j[e]})):e}var xj="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,wj=[" ",",","?","!",";"];function Cj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Aj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cj(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cj(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ej(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ZU(e);if(t){var i=ZU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return QU(this,n)}}function Tj(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var r=t.split(n),i=e,o=0;o<r.length;++o){if(!i)return;if("string"==typeof i[r[o]]&&o+1<r.length)return;if(void 0===i[r[o]]){for(var s=2,a=r.slice(o,o+s).join(n),l=i[a];void 0===l&&r.length>o+s;)s++,l=i[a=r.slice(o,o+s).join(n)];if(void 0===l)return;if(null===l)return null;if(t.endsWith(a)){if("string"==typeof l)return l;if(a&&"string"==typeof l[a])return l[a]}var c=r.slice(o+s).join(n);return c?Tj(l,c,n):void 0}i=i[r[o]]}return i}}var Ij=function(e){XU(n,e);var t=Ej(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return qU(this,n),r=t.call(this),xj&&uj.call(YU(r)),r.data=e||{},r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),void 0===r.options.ignoreJSONStructure&&(r.options.ignoreJSONStructure=!0),r}return KU(n,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=void 0!==r.ignoreJSONStructure?r.ignoreJSONStructure:this.options.ignoreJSONStructure,s=[e,t];n&&"string"!=typeof n&&(s=s.concat(n)),n&&"string"==typeof n&&(s=s.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(s=e.split("."));var a=gj(this.data,s);return a||!o||"string"!=typeof n?a:Tj(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},o=this.options.keySeparator;void 0===o&&(o=".");var s=[e,t];n&&(s=s.concat(o?n.split(o):n)),e.indexOf(".")>-1&&(r=t,t=(s=e.split("."))[1]),this.addNamespaces(t),fj(this.data,s,r),i.silent||this.emit("added",e,t,n,r)}},{key:"addResources",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});r.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},s=[e,t];e.indexOf(".")>-1&&(r=n,n=t,t=(s=e.split("."))[1]),this.addNamespaces(t);var a=gj(this.data,s)||{};r?yj(a,n,i):a=Aj(Aj({},a),n),fj(this.data,s,a),o.silent||this.emit("added",e,t,n)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?Aj(Aj({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),n}(uj),Mj={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,r,i){var o=this;return e.forEach((function(e){o.processors[e]&&(t=o.processors[e].process(t,n,r,i))})),t}};function Rj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Pj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rj(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rj(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nj(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ZU(e);if(t){var i=ZU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return QU(this,n)}}var Oj={},Dj=function(e){XU(n,e);var t=Nj(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return qU(this,n),r=t.call(this),xj&&uj.call(YU(r)),pj(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,YU(r)),r.options=i,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r.logger=cj.create("translator"),r}return KU(n,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var r=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],o=n&&e.indexOf(n)>-1,s=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var r=wj.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===r.length)return!0;var i=new RegExp("(".concat(r.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),o=!i.test(e);if(!o){var s=e.indexOf(n);s>0&&!i.test(e.substring(0,s))&&(o=!0)}return o}(e,n,r));if(o&&!s){var a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:i};var l=e.split(n);(n!==r||n===r&&this.options.ns.indexOf(l[0])>-1)&&(i=l.shift()),e=l.join(r)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,r){var i=this;if("object"!==wk(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var o=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,s=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],t),l=a.key,c=a.namespaces,u=c[c.length-1],d=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&"cimode"===d.toLowerCase()){if(h){var p=t.nsSeparator||this.options.nsSeparator;return o?(m.res="".concat(u).concat(p).concat(l),m):"".concat(u).concat(p).concat(l)}return o?(m.res=l,m):l}var m=this.resolve(e,t),f=m&&m.res,g=m&&m.usedKey||l,v=m&&m.exactUsedKey||l,y=Object.prototype.toString.apply(f),S=["[object Number]","[object Function]","[object RegExp]"],_=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,x="string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f;if(b&&f&&x&&S.indexOf(y)<0&&("string"!=typeof _||"[object Array]"!==y)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var w=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,f,Pj(Pj({},t),{},{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return o?(m.res=w,m):w}if(s){var C="[object Array]"===y,A=C?[]:{},E=C?v:g;for(var T in f)if(Object.prototype.hasOwnProperty.call(f,T)){var I="".concat(E).concat(s).concat(T);A[T]=this.translate(I,Pj(Pj({},t),{joinArrays:!1,ns:c})),A[T]===I&&(A[T]=f[T])}f=A}}else if(b&&"string"==typeof _&&"[object Array]"===y)(f=f.join(_))&&(f=this.extendTranslation(f,e,t,r));else{var M=!1,R=!1,P=void 0!==t.count&&"string"!=typeof t.count,N=n.hasDefaultValue(t),O=P?this.pluralResolver.getSuffix(d,t.count,t):"",D=t["defaultValue".concat(O)]||t.defaultValue;!this.isValidLookup(f)&&N&&(M=!0,f=D),this.isValidLookup(f)||(R=!0,f=l);var k=t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,L=k&&R?void 0:f,B=N&&D!==f&&this.options.updateMissing;if(R||M||B){if(this.logger.log(B?"updateKey":"missingKey",d,u,l,B?D:f),s){var z=this.resolve(l,Pj(Pj({},t),{},{keySeparator:!1}));z&&z.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var F=[],U=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&U&&U[0])for(var j=0;j<U.length;j++)F.push(U[j]);else"all"===this.options.saveMissingTo?F=this.languageUtils.toResolveHierarchy(t.lng||this.language):F.push(t.lng||this.language);var G=function(e,n,r){var o=N&&r!==f?r:L;i.options.missingKeyHandler?i.options.missingKeyHandler(e,u,n,o,B,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,u,n,o,B,t),i.emit("missingKey",e,u,n,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?F.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(n){G([e],l+n,t["defaultValue".concat(n)]||D)}))})):G(F,l,D))}f=this.extendTranslation(f,e,t,m,r),R&&f===l&&this.options.appendNamespaceToMissingKey&&(f="".concat(u,":").concat(l)),(R||M)&&this.options.parseMissingKeyHandler&&(f="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(u,":").concat(l):l,M?f:void 0):this.options.parseMissingKeyHandler(f))}return o?(m.res=f,m):f}},{key:"extendTranslation",value:function(e,t,n,r,i){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,Pj(Pj({},this.options.interpolation.defaultVariables),n),r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(Pj(Pj({},n),{interpolation:Pj(Pj({},this.options.interpolation),n.interpolation)}));var s,a="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){var l=e.match(this.interpolator.nestingRegexp);s=l&&l.length}var c=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(c=Pj(Pj({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,n.lng||this.language,n),a){var u=e.match(this.interpolator.nestingRegexp);s<(u&&u.length)&&(n.nest=!1)}!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,r=new Array(e),s=0;s<e;s++)r[s]=arguments[s];return i&&i[0]===r[0]&&!n.context?(o.logger.warn("It seems you are nesting recursively key: ".concat(r[0]," in key: ").concat(t[0])),null):o.translate.apply(o,r.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var d=n.postProcess||this.options.postProcess,h="string"==typeof d?[d]:d;return null!=e&&h&&h.length&&!1!==n.applyPostProcessor&&(e=Mj.handle(h,e,t,this.options&&this.options.postProcessPassResolved?Pj({i18nResolved:r},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,r,i,o,s=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!s.isValidLookup(t)){var l=s.extractFromKey(e,a),c=l.key;n=c;var u=l.namespaces;s.options.fallbackNS&&(u=u.concat(s.options.fallbackNS));var d=void 0!==a.count&&"string"!=typeof a.count,h=d&&!a.ordinal&&0===a.count&&s.pluralResolver.shouldUseIntlApi(),p=void 0!==a.context&&("string"==typeof a.context||"number"==typeof a.context)&&""!==a.context,m=a.lngs?a.lngs:s.languageUtils.toResolveHierarchy(a.lng||s.language,a.fallbackLng);u.forEach((function(e){s.isValidLookup(t)||(o=e,!Oj["".concat(m[0],"-").concat(e)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(o)&&(Oj["".concat(m[0],"-").concat(e)]=!0,s.logger.warn('key "'.concat(n,'" for languages "').concat(m.join(", "),'" won\'t get resolved as namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach((function(n){if(!s.isValidLookup(t)){i=n;var o,l=[c];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(l,c,n,e,a);else{var u;d&&(u=s.pluralResolver.getSuffix(n,a.count,a));var m="".concat(s.options.pluralSeparator,"zero");if(d&&(l.push(c+u),h&&l.push(c+m)),p){var f="".concat(c).concat(s.options.contextSeparator).concat(a.context);l.push(f),d&&(l.push(f+u),h&&l.push(f+m))}}for(;o=l.pop();)s.isValidLookup(t)||(r=o,t=s.getResource(n,e,o,a))}})))}))}})),{res:t,usedKey:n,exactUsedKey:r,usedLng:i,usedNS:o}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,t.length)&&void 0!==e[n])return!0;return!1}}]),n}(uj);function kj(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Lj=function(){function e(t){qU(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=cj.create("languageUtils")}return KU(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=kj(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=kj(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=kj(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,n=this;return e?(e.forEach((function(e){if(!t){var r=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(r)||(t=r)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var r=n.getLanguagePartFromCode(e);if(n.isSupportedCode(r))return t=r;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(r))return e}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,r=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],o=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):"string"==typeof e&&o(this.formatLanguageCode(e)),r.forEach((function(e){i.indexOf(e)<0&&o(n.formatLanguageCode(e))})),i}}]),e}(),Bj=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],zj={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},Fj=["v1","v2","v3"],Uj={zero:0,one:1,two:2,few:3,many:4,other:5};function jj(){var e={};return Bj.forEach((function(t){t.lngs.forEach((function(n){e[n]={numbers:t.nr,plurals:zj[t.fc]}}))})),e}var Gj=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};qU(this,e),this.languageUtils=t,this.options=n,this.logger=cj.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=jj()}return KU(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((function(e,t){return Uj[e]-Uj[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):r.numbers.map((function(r){return t.getSuffix(e,r,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.getRule(e,n);return r?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(r.select(t)):this.getSuffixRetroCompatible(r,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,r=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[r];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var o=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):o():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}},{key:"shouldUseIntlApi",value:function(){return!Fj.includes(this.options.compatibilityJSON)}}]),e}();function Hj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Vj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hj(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hj(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Wj=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};qU(this,e),this.logger=cj.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return KU(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:bj,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Sj(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Sj(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?Sj(t.nestingPrefix):t.nestingPrefixEscaped||Sj("$t("),this.nestingSuffix=t.nestingSuffix?Sj(t.nestingSuffix):t.nestingSuffixEscaped||Sj(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,r){var i,o,s,a=this,l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var u=function(e){if(e.indexOf(a.formatSeparator)<0){var i=vj(t,l,e);return a.alwaysFormat?a.format(i,void 0,n,Vj(Vj(Vj({},r),t),{},{interpolationkey:e})):i}var o=e.split(a.formatSeparator),s=o.shift().trim(),c=o.join(a.formatSeparator).trim();return a.format(vj(t,l,s),c,n,Vj(Vj(Vj({},r),t),{},{interpolationkey:s}))};this.resetRegExp();var d=r&&r.missingInterpolationHandler||this.options.missingInterpolationHandler,h=r&&r.interpolation&&void 0!==r.interpolation.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return a.escapeValue?c(a.escape(e)):c(e)}}].forEach((function(t){for(s=0;i=t.regex.exec(e);){var n=i[1].trim();if(void 0===(o=u(n)))if("function"==typeof d){var l=d(e,i,r);o="string"==typeof l?l:""}else if(r&&r.hasOwnProperty(n))o="";else{if(h){o=i[0];continue}a.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),o=""}else"string"==typeof o||a.useRawValueToEscape||(o=hj(o));var c=t.safeValue(o);if(e=e.replace(i[0],c),h?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++s>=a.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var n,r,i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=Vj({},o);function a(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var r=e.split(new RegExp("".concat(n,"[ ]*{"))),i="{".concat(r[1]);e=r[0];var o=(i=this.interpolate(i,s)).match(/'/g),a=i.match(/"/g);(o&&o.length%2==0&&!a||a.length%2!=0)&&(i=i.replace(/'/g,'"'));try{s=JSON.parse(i),t&&(s=Vj(Vj({},t),s))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(i)}return delete s.defaultValue,e}for(s.applyPostProcessor=!1,delete s.defaultValue;n=this.nestingRegexp.exec(e);){var l=[],c=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var u=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=u.shift(),l=u,c=!0}if((r=t(a.call(this,n[1].trim(),s),s))&&n[0]===e&&"string"!=typeof r)return r;"string"!=typeof r&&(r=hj(r)),r||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),r=""),c&&(r=l.reduce((function(e,t){return i.format(e,t,o.lng,Vj(Vj({},o),{},{interpolationkey:n[1].trim()}))}),r.trim())),e=e.replace(n[0],r),this.regexp.lastIndex=0}return e}}]),e}();function qj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Jj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qj(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qj(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Kj(e){var t={};return function(n,r,i){var o=r+JSON.stringify(i),s=t[o];return s||(s=e(r,i),t[o]=s),s(n)}}var Yj=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};qU(this,e),this.logger=cj.create("formatter"),this.options=t,this.formats={number:Kj((function(e,t){var n=new Intl.NumberFormat(e,t);return function(e){return n.format(e)}})),currency:Kj((function(e,t){var n=new Intl.NumberFormat(e,Jj(Jj({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:Kj((function(e,t){var n=new Intl.DateTimeFormat(e,Jj({},t));return function(e){return n.format(e)}})),relativetime:Kj((function(e,t){var n=new Intl.RelativeTimeFormat(e,Jj({},t));return function(e){return n.format(e,t.range||"day")}})),list:Kj((function(e,t){var n=new Intl.ListFormat(e,Jj({},t));return function(e){return n.format(e)}}))},this.init(t)}return KU(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=t.interpolation;this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=Kj(t)}},{key:"format",value:function(e,t,n,r){var i=this,o=t.split(this.formatSeparator).reduce((function(e,t){var o=function(e){var t=e.toLowerCase().trim(),n={};if(e.indexOf("(")>-1){var r=e.split("(");t=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);"currency"===t&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=oj(e.split(":")),r=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[r.trim()]||(n[r.trim()]=i),"false"===i&&(n[r.trim()]=!1),"true"===i&&(n[r.trim()]=!0),isNaN(i)||(n[r.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:n}}(t),s=o.formatName,a=o.formatOptions;if(i.formats[s]){var l=e;try{var c=r&&r.formatParams&&r.formatParams[r.interpolationkey]||{},u=c.locale||c.lng||r.locale||r.lng||n;l=i.formats[s](e,u,Jj(Jj(Jj({},a),r),c))}catch(e){i.logger.warn(e)}return l}return i.logger.warn("there was no format function for ".concat(s)),e}),e);return o}}]),e}();function $j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$j(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Qj(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ZU(e);if(t){var i=ZU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return QU(this,n)}}var Zj=function(e){XU(n,e);var t=Qj(n);function n(e,r,i){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return qU(this,n),o=t.call(this),xj&&uj.call(YU(o)),o.backend=e,o.store=r,o.services=i,o.languageUtils=i.languageUtils,o.options=s,o.logger=cj.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=s.maxParallelReads||10,o.readingCalls=0,o.maxRetries=s.maxRetries>=0?s.maxRetries:5,o.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(i,s.backend,s),o}return KU(n,[{key:"queueLoad",value:function(e,t,n,r){var i=this,o={},s={},a={},l={};return e.forEach((function(e){var r=!0;t.forEach((function(t){var a="".concat(e,"|").concat(t);!n.reload&&i.store.hasResourceBundle(e,t)?i.state[a]=2:i.state[a]<0||(1===i.state[a]?void 0===s[a]&&(s[a]=!0):(i.state[a]=1,r=!1,void 0===s[a]&&(s[a]=!0),void 0===o[a]&&(o[a]=!0),void 0===l[t]&&(l[t]=!0)))})),r||(a[e]=!0)})),(Object.keys(o).length||Object.keys(s).length)&&this.queue.push({pending:s,pendingCount:Object.keys(s).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(o),pending:Object.keys(s),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}},{key:"loaded",value:function(e,t,n){var r=e.split("|"),i=r[0],o=r[1];t&&this.emit("failedLoading",i,o,t),n&&this.store.addResourceBundle(i,o,n),this.state[e]=t?-1:2;var s={};this.queue.forEach((function(n){var r,a,l,c,u,d;r=n.loaded,a=o,c=mj(r,[i],Object),u=c.obj,d=c.k,u[d]=u[d]||[],l&&(u[d]=u[d].concat(a)),l||u[d].push(a),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){s[e]||(s[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===s[e][t]&&(s[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",s),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,s=arguments.length>5?arguments[5]:void 0;return e.length?this.readingCalls>=this.maxParallelReads?void this.waitingReads.push({lng:e,ns:t,fcName:n,tried:i,wait:o,callback:s}):(this.readingCalls++,this.backend[n](e,t,(function(a,l){if(r.readingCalls--,r.waitingReads.length>0){var c=r.waitingReads.shift();r.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}a&&l&&i<r.maxRetries?setTimeout((function(){r.read.call(r,e,t,n,i+1,2*o,s)}),o):s(a,l)}))):s(null,{})}},{key:"prepareLoading",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var o=this.queueLoad(e,t,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=e.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(function(r,s){r&&t.logger.warn("".concat(n,"loading namespace ").concat(o," for language ").concat(i," failed"),r),!r&&s&&t.logger.log("".concat(n,"loaded namespace ").concat(o," for language ").concat(i),s),t.loaded(e,r,s)}))}},{key:"saveMissing",value:function(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t)?this.logger.warn('did not save key "'.concat(n,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!"):null!=n&&""!==n&&(this.backend&&this.backend.create&&this.backend.create(e,t,n,r,null,Xj(Xj({},o),{},{isUpdate:i})),e&&e[0]&&this.store.addResource(e[0],t,n,r))}}]),n}(uj);function eG(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===wk(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===wk(e[2])||"object"===wk(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,r){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function tG(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function nG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function rG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nG(Object(n),!0).forEach((function(t){Ek(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nG(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function iG(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ZU(e);if(t){var i=ZU(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return QU(this,n)}}function oG(){}function sG(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(t){"function"==typeof e[t]&&(e[t]=e[t].bind(e))}))}var aG=function(e){XU(n,e);var t=iG(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;if(qU(this,n),e=t.call(this),xj&&uj.call(YU(e)),e.options=tG(r),e.services={},e.logger=cj,e.modules={external:[]},sG(YU(e)),i&&!e.isInitialized&&!r.isClone){if(!e.options.initImmediate)return e.init(r,i),QU(e,YU(e));setTimeout((function(){e.init(r,i)}),0)}return e}return KU(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var r=eG();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=rG(rG(rG({},r),this.options),tG(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=rG(rG({},r.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var o;this.modules.logger?cj.init(i(this.modules.logger),this.options):cj.init(null,this.options),this.modules.formatter?o=this.modules.formatter:"undefined"!=typeof Intl&&(o=Yj);var s=new Lj(this.options);this.store=new Ij(this.options.resources,this.options);var a=this.services;a.logger=cj,a.resourceStore=this.store,a.languageUtils=s,a.pluralResolver=new Gj(s,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!o||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(a.formatter=i(o),a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new Wj(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new Zj(i(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.languageDetector&&(a.languageDetector=i(this.modules.languageDetector),a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=i(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new Dj(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t].concat(r))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=oG),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var l=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);l.length>0&&"dev"!==l[0]&&(this.options.lng=l[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");var c=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];c.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments)}}));var u=["addResource","addResources","addResourceBundle","removeResourceBundle"];u.forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var d=dj(),h=function(){var t=function(t,r){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),d.resolve(r),n(t,r)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?h():setTimeout(h,0),d}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oG,r=n,i="string"==typeof e?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase())return r();var o=[],s=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){o.indexOf(e)<0&&o.push(e)}))};if(i)s(i);else{var a=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);a.forEach((function(e){return s(e)}))}this.options.preload&&this.options.preload.forEach((function(e){return s(e)})),this.services.backendConnector.load(o,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),r(e)}))}else r(null)}},{key:"reloadResources",value:function(e,t,n){var r=dj();return e||(e=this.languages),t||(t=this.options.ns),n||(n=oG),this.services.backendConnector.reload(e,t,(function(e){r.resolve(),n(e)})),r}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Mj.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var r=dj();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},o=function(o){e||o||!n.services.languageDetector||(o=[]);var s="string"==typeof o?o:n.services.languageUtils.getBestMatchFromCodes(o);s&&(n.language||i(s),n.translator.language||n.translator.changeLanguage(s),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(s)),n.loadResources(s,(function(e){!function(e,o){o?(i(o),n.translator.changeLanguage(o),n.isLanguageChangingTo=void 0,n.emit("languageChanged",o),n.logger.log("languageChanged",o)):n.isLanguageChangingTo=void 0,r.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,arguments)}))}(e,s)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}},{key:"getFixedT",value:function(e,t,n){var r=this,i=function e(t,i){var o;if("object"!==wk(i)){for(var s=arguments.length,a=new Array(s>2?s-2:0),l=2;l<s;l++)a[l-2]=arguments[l];o=r.options.overloadTranslationOptionHandler([t,i].concat(a))}else o=rG({},i);o.lng=o.lng||e.lng,o.lngs=o.lngs||e.lngs,o.ns=o.ns||e.ns,o.keyPrefix=o.keyPrefix||n||e.keyPrefix;var c=r.options.keySeparator||".",u=o.keyPrefix?"".concat(o.keyPrefix).concat(c).concat(t):t;return r.t(u,o)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=n,i}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var r=this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;var s=function(e,n){var r=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===r||2===r};if(n.precheck){var a=n.precheck(this,s);if(void 0!==a)return a}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!s(r,e)||i&&!s(o,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,r=dj();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){r.resolve(),t&&t(e)})),r):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=dj();"string"==typeof e&&(e=[e]);var r=this.options.preload||[],i=e.filter((function(e){return r.indexOf(e)<0}));return i.length?(this.options.preload=r.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(this.services.languageUtils.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oG,i=rG(rG(rG({},this.options),t),{isClone:!0}),o=new n(i);void 0===t.debug&&void 0===t.prefix||(o.logger=o.logger.clone(t));var s=["store","services","language"];return s.forEach((function(t){o[t]=e[t]})),o.services=rG({},this.services),o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o.translator=new Dj(o.services,o.options),o.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];o.emit.apply(o,[e].concat(n))})),o.init(i,r),o.translator.options=o.options,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),n}(uj);Ek(aG,"createInstance",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return new aG(e,t)}));var lG=aG.createInstance();lG.createInstance=aG.createInstance;var cG,uG=lG.createInstance;lG.init,lG.loadResources,lG.reloadResources,lG.use,lG.changeLanguage,lG.getFixedT,lG.t,lG.exists,lG.setDefaultNamespace,lG.hasLoadedNamespace,lG.loadNamespaces,lG.loadLanguages;cG=JSON.parse('{"yes":"Si","no":"No","confirm":"Conferma","apply":"Applica","cancel":"Annulla","show":"Mostra","hide":"Nascondi","send":"Invia","close":"Chiudi","edit":"Modifica","delete":"Elimina","loading":"Caricamento","expand":"Espandi","collapse":"Riduci","fullscreenEnter":"Passa a schermo intero","fullscreenExit":"Esci da schermo intero","center":"Centro","bottom":"In basso","hidden":"Nascosto","day":"Giorno","month":"Mese","year":"Anno","createdAt":"Data creazione","selected":"Selezionati","page":"pagina","actions":"Azioni","next":"Successivo","previous":"Precedente","copy":"Copia","copyRawCode":"Copia codice sorgente","copyToClipboard":"Copia negli appunti","showOriginalText":"Mostra originale","showTranslatedText":"Mostra traduzione","exactPosition":"Posizione esatta","uncertain":"Incertezza","question":"Domanda","nothingFound":"Nessun risultato","venue":"Luogo","searchVenue":"Cerca luogo...","memoriBlockedTitle":"Bloccato","memoriBlockedUntil":"Agente bloccato fino al {{date}}","memoriBlockedAnon":"Attualmente \\"{{name}}\\" non può rispondere, torna qui il {{date}}","memoriBlockedReasonExceedChats":"perchè ha superato la soglia mensile di chat ammesse.","memoriBlockedGiverHelper":"Puoi sempre gestirlo in qualità di amministratore, ma altri utenti non potranno interrogarlo.","generatedByAI":"Risposta generata da IA, può talvolta generare informazioni non corrette","whyThisAnswer":"Perché questa risposta?","whyThisAnswerHelper":"Questa risposta è stata generata automaticamente da un\'intelligenza artificiale sulla base di questi contenuti verificati.","completionsEnabled":"IA evoluta, può rispondere con risposte generate automaticamente che talvolta potrebbero contenere informazioni non corrette","completionProviderDown":"Questo agente è integrato con una IA generativa di {{provider}}, ma al momento non è disponibile. Riprova più tardi.","completionProviderFallbackName":"un provider esterno","completionProviderCheckStatusPage":"Vedi pagina di stato","boardOfExperts":"Gruppo di esperti","birthDate":"Data di nascita","birthDateHelper":"Ti chiediamo la data di nascita esclusivamente per abilitare o disabilitare le funzionalità che hanno restrizioni in base all\'età","underage":"Devi avere almeno {{age}} anni per registrarti.","underageTwinSession":"Devi avere almeno {{age}} anni per interagire con questo agente.","errorFetchingSession":"Errore durante il caricamento della sessione","errorGettingReferralURL":"Errore durante il caricamento del riferimento","errorReopeningSession":"Errore durante il riapertura della sessione","ageVerification":"Verifica dell\'età","ageVerificationText":"Per interagire con questo agente, devi aver almeno {{minAge}} anni.","nsfw":"NSFW: Questo agente contiene contenuti per adulti","deepThought":"Pensiero profondo","deepThoughtHelper":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme.","deepThoughtDisclaimerTitle":"Pensiero profondo abilitato","deepThoughtDisclaimer":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme.","deepThoughtPreDisclaimerUnlogged":"Accedi per abilitare Pensiero Profondo.","deepThoughtPreDisclaimerNotAllowed":"Pensiero Profondo è disabilitato poiché non hai acconsentito al suo utilizzo, puoi cambiare la tua scelta in qualsiasi momento nelle impostazioni del tuo account.","notEnoughCredits":"L\'autore di questo agente non ha abbastanza crediti per rispondere alla tua domanda.","knownFacts":{"title":"Fatti noti","description":"Dettagli delle informazioni condivise tra te e {{memoriName}}","type":"Tipo","typeShortTerm":"Breve termine","typeLongTerm":"Lungo termine","typeHelper":"Tipi:\\n- Breve termine: questo fatto noto è sempre utilizzato durante le conversazioni\\n- Lungo termine: questo fatto noto è utilizzato durante le conversazioni solo se rilevante per la domanda corrente","text":"Testo","deleteSuccess":"Fatto noto eliminato","deleteConfirmTitle":"Elimina il fatto noto","deleteConfirmMessage":"Confermi di voler eliminare questo fatto noto?","deleteSelectedConfirmTitle":"Elimina i fatti noti selezionati","deleteSelectedConfirmMessage":"Confermi di voler eliminare i fatti noti selezionati?"},"auth":{"title":"Autenticazione","useRecoveryTokens":"Utilizza i token di recupero","tokens":"Token","addToken":"Aggiungi token","usePassword":"Utilizza la password","atLeast":"Almeno"},"widget":{"instruct":"Istruisci","test":"Prova","sound":"Audio","position":"Preferenze posizione","settings":"Impostazioni","share":"Condividi","sendOnKeypress":"Premi Invio per inviare","sendOnClick":"Clicca sul bottone di invio","boardOfExperts":"Gruppo di esperti","showExpertsInTheBoard":"Mostra gli esperti di questo gruppo","expertsInTheBoard":"Esperti di questo gruppo","goToIntegrationsToCustomizeAvatar":"Per personalizzare l\'avatar, vai a Condividimi e configura la pagina pubblica"},"write_and_speak":{"micButtonPopover":"Premi il pulsante per parlare","micButtonPopoverListening":"Premi il pulsante per smettere di parlare","pageInstructExplanation":"Per insegnarmi nuove cose clicca sul pulsante ISTRUISCIMI per cominciare","pageTryMeExplanation":"Per parlare con me clicca sul pulsante INIZIAMO per cominciare","instructButton":"ISTRUISCIMI","tryMeButton":"INIZIAMO","resumeButton":"RIPRENDI","chatHistory":"Cronologia chat","exportChatHistory":"Esporta la cronologia chat","exportChatHistoryMessage":"Vuoi esportare la cronologia chat?","chatBotButtonText":"CLICCA QUI PER APRIRE LA CHAT","conversationStartedLabel":"Conversazione avvenuta il","settingsHeaderLabel":"Configura qui se vuoi impostare una conversazione continua. Setta i secondi di silenzio prima dell\'invio.","continuousSpeechLabel":"Conversazione continua","continuousSpeechDisabled":"Conversazione continua disabilitata poichè l\'agente è in modalità muta","holdToSpeak":"Tieni premuto per parlare","releaseToEndListening":"Rilascia per smettere di parlare","pressAndHoldToSpeak":"Premi e tieni premuto per parlare","microphoneMode":"Modalità microfono","hideEmissionsLabel":"Nascondi testo emesso dall\'agente","secondsLabel":"Secondi","controlsPosition":"Posizione dei controlli","avatarControls":"Controlli Avatar","height":"Altezza","depth":"Profondità","avatarType":"Tipo Avatar","blob":"Blob","avatar3d":"Avatar 3D","zoomed":"Vicino","normal":"Normale","far":"Lontano","suggestions":"Usa le frecce per regolare l\'altezza dell\'avatar\\nUsa +/- per regolare la profondità dell\'avatar","enablePositionControls":"Abilita controlli posizione","tryMeHeaderLabel":"PROVA","unknownPosition":"Posizione sconosciuta","fieldPlace":"Indica la posizione (es \'Milano\')","showMapLinkFor":"Visualizza sulla mappa la posizione","useMyPosition":"Usa la mia posizione","myPosition":"Posizione corrente","updatingPosition":"Aggiorno la posizione...","placeNotFound":"Luogo sconosciuto!","requirePositionHelp":"Per parlare con {{name}} devi decidere se fornire o meno la tua posizione. Questo perchè diverse risposte che potrà fornirti potrebbero dipendere da dove ti trovi.","dontWantToProvidePosition":"Non voglio fornire la mia posizione","attachmentsLabel":"Arricchisci il tuo messaggio","iWantToTalkToIn":"Voglio parlare con {{name}} in"},"media":{"title":"Titolo","editAttributes":"Modifica attributi media","uploadMimeTypeNotAllowed":"Il tipo di file non è permesso","uploadSizeLimitMessage":"Il file caricato è troppo grande (max {{size}}MB)","uploadWrongResolutionMessage":"La risoluzione deve essere {{width}}x{{height}} pixel","memoriNameAlreadyUsed":"Hai già un Agente con questo nome","uploadHelperImages":"Caricare un file con estensione png, jpg, jpeg o gif e con dimensione massima di {{size}}MB","uploadHelper":"Caricare un file di dimensione massima di {{size}}MB","uploadError":"Errore nel caricamento","square":"quadrato","scaleRatio":"Proporzioni","addMediaLabel":"Aggiungi media","insertThisMediaMsg":"Inserisci questi media","mediaUploadMessage":"Clicca per caricare un nuovo media","addLinkLabel":"Aggiungi un link","linkKey":"URL","linkValue":"Titolo link","insertThisLink":"Inserisci un link a {{url}} con titolo {{title}}"},"gamification":{"level":"Livello","points":"punti","memoriReachedLevel":"è diventato più evoluto ed ha raggiunto il livello","levelGoToStatistics":"{{memori}} è al livello {{level}} con {{points}} punti. Clicca per andare alle statistiche.","congratulationsNewLevel":"Congratulazioni, hai raggiunto un nuovo livello!","congratulationsNewLevelDescription":"Il tuo agente è diventato più evoluto con {{points}} punti, guarda le","statistics":"statistiche"},"login":{"login":"Accedi","logout":"Esci","user":"Utente","loggedDrawerTitle":"Ciao, {{name}}!","loginDrawerTitle":"Accedi","signupDrawerTitle":"Registrati","newUserSignUp":"Sei un nuovo utente?","signUp":"Registrati!","alreadyHaveAnAccount":"Hai già un account?","backToLogin":"Torna al login","registrationDisabled":"La registrazione è disabilitata.","contactAdmin":"Contatta l\'amministratore per richiedere l\'accesso","userNameOrEmail":"Nome utente o email","email":"Email","emailFormatError":"Per favore, inserisci una mail valida","username":"Nome utente","usernameContainsReservedWord":"Il nome utente contiene una parola riservata, per favore cambia il nome utente","usernameFormatError":"Il nome utente deve essere lungo almeno 3 caratteri e può contenere solo lettere, numeri e _","otpCode":"Codice di verifica","resendVerificationCode":"Invia di nuovo","resentVerificationCode":"Codice di verifica inviato! Controlla la tua mail.","password":"Password","newPassword":"Nuova password","confirmPassword":"Conferma la password","currentPassword":"Password attuale","passwordMatchingError":"Le password non coincidono.","passwordFormatError":"La password deve essere lunga almeno 8 caratteri e contenere almeno un numero, una lettera maiuscola, una minuscola e un simbolo","pwdWeak":"Debole","pwdAcceptable":"Accettabile","pwdStrong":"Forte","mustChangePassword":"Devi cambiare la password","passwordChange":"Cambio password","emailChange":"Cambio email","avatarChange":"Cambio avatar","underage":"Devi avere almeno {{age}} anni per registrarti.","optional":"opzionale","birthDate":"Data di nascita","birthDateHelper":"Ti chiediamo la data di nascita esclusivamente per abilitare o disabilitare le funzionalità che hanno restrizioni in base all\'età","missingData":"Informazioni mancanti","missingDataHelper":"Sappiamo che questo è un po\' fastidioso, ma abbiamo bisogno di alcune informazioni in più per completare la tua registrazione.","goToAccountToChangeYourPreferences":"Puoi cambiare la tua scelta in qualsiasi momento dalla tua pagina Account.","deepThoughtExplaination":"Pensiero Profondo è una funzionalità avanzata delle AI che ti consentirà di poter sfruttare a pieno le tue conversazioni mantenendo memoria delle stesse. Le AI con Pensiero Profondo possono darti informazioni adattandosi a te e alle cose che condividerete insieme. Consenti all\'autore dell\'agente di contattarti per offerte commerciali riguardanti prodotti su cui hai espresso interesse.","tnCAndPPAcceptedHelper":"Dall\'ultimo accesso, i T&C e l\'Informativa sulla privacy sono stati modificati. Si prega di accettarle, altrimenti non sarà possibile apportare modifiche ai propri gemelli. Puoi sempre cancellare il tuo account nella pagina del tuo profilo utente.","privacyLabel":"Ho letto e accettato l\'","privacyAndCookiePolicy":"informativa sui cookie e sulla privacy","and":"e","termsOfService":"i termini del servizio","pAndCUAccepted":"Accetto le condizioni di utilizzo relative a Pensiero Profondo","editAccount":"Modifica account","save":"Salva"},"success":"Operazione andata a buon fine","Error":"Errore","internal server error":"Ops, scusa... qualcosa è andato storto nel server","error":"Errore","error.loading":"Errore durante il caricamento dei contenuti.","error.notFound":"Ops, non abbiamo trovato ciò che cercavi.","error.generic":"Ops, qualcosa è andato storto.","error.serverNotResponding":"Stiamo facendo manutenzione o rilasciando aggiornamenti. Riprova più tardi.","error.unprocessableEntity":"Errore durante il salvataggio dei dati. Ricontrolla i dati inseriti.","error.goBackTo":"Prova a tornare alla","error.reloadPage":"Ricarica la pagina","error.tryAgain":"Riprova","error.unauthorized":"Non sei autorizzato a visualizzare questo contenuto.","errors":{"TENANT_NOT_FOUND":"Tenant non trovato","TENANT_REGISTRATION_DISABLED":"La registrazione su questa piattaforma è disabilitata","TENANT_MISSING_NAME":"Tenant: nome mancante","TENANT_MAX_USERS_REACHED":"Numero massimo di utenti raggiunto","TENANT_MAX_ADMINS_REACHED":"Numero massimo di utenti amministratori raggiunto","TENANT_ALREADY_EXISTS":"Tenant già esistente","TENANT_MISSING_DESCRIPTION":"Tenant: descrizione mancante","TENANT_CANT_SET_COMPLETION_PROVIDER":"Tenant: non abilitato a gestire il provider di completamento","USER_NOT_CONFIRMED":"Utente ancora non confermato","USER_NOT_FOUND":"Utente non trovato","USER_OR_PASSWORD_INVALID":"Utente o password non validi","USER_MUST_CHANGE_PASSWORD":"Devi cambiare la password","USER_MUST_ENTER_VERIFICATION_CODE":"Devi inserire il codice di verifica","USER_MISSING_TENANT":"Utente: tenant mancante","USER_MISSING_NAME":"Utente: nome mancante","USER_MISSING_PASSWORD":"Utente: password mancante","USER_MISSING_EMAIL":"Utente: email mancante","USER_MISSING_VERIFICATION_CODE":"Utente: codice di verifica mancante","USER_NAME_ALREADY_USED":"Nome utente già in uso","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"La password non rispetta le regole di sicurezza","USER_EMAIL_ALREADY_USED":"Email già in uso","USER_EMAIL_INVALID":"Email non valida","USER_VERIFICATION_CODE_INVALID":"Codice di verifica non valido","USER_MISSING_NAME_OR_EMAIL":"Nome utente o email mancante","USER_NAME_INVALID":"Nome utente non valido","USER_HAS_ONE_OR_MORE_MEMORI":"L\'utente ha uno o più Agenti","USER_MISSING_NEW_PASSWORD":"Utente: nuova password mancante","USER_NOTHING_TO_DO":"Niente da fare","USER_CANT_CREATE_MEMORI":"Utente non abilitato a creare Agenti","USER_MAX_MEMORI_REACHED":"Massimo numero di Agenti raggiunto","USER_TOO_MANY_ATTEMPTS":"Troppi tentativi","USER_MUST_ACCEPT_TNC_AND_PP":"Devi accettare i termini e le condizioni","USER_BIRTH_DATE_CANT_BE_CHANGED":"Data di nascita non può essere cambiata","USER_CANT_SET_COMPLETION_PROVIDER":"Utente: non abilitato a gestire il provider di completamento","USER_CANT_ENABLE_DEEP_THOUGHT":"Utente: non abilitato a gestire Pensiero Profondo","USER_CANT_ENABLE_DCM_INTEGRATION":"Utente: non abilitato a gestire l\'integrazione con DCM","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"Utente: non abilitato a gestire la concatenazione o il gruppo di esperti","USER_CREATION_BILLING_DENIED_PERMISSION":"Non hai crediti sufficienti per creare un agente","USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS":"L\'utente ha una o più configurazioni completions","USER_CANT_BE_DELETED":"Utente non può essere cancellato","MEMORI_NOT_FOUND":"Agente non trovato","MEMORI_NOT_ACCESSIBLE":"Agente non accessibile","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Solo il proprietario può cambiare il tag e il pin","SESSION_NOT_FOUND":"Sessione non trovata","SESSION_IS_NOT_ADMINISTRATIVE":"Sessione non amministrativa","SESSION_EXPIRED":"Sessione scaduta","MEMORI_MISSING_CONFIGURATION":"Agente: configurazione mancante","MEMORI_CONFIGURATION_NOT_FOUND":"Agente: configurazione non trovata","MEMORI_INVALID_PRIVACY_TYPE":"Agente: tipo di privacy non valido","MEMORI_MISSING_PASSWORD":"Agente: password mancante","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Agente: numero totale di token di recupero non valido","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Agente: numero minimo di token di recupero non valido","MEMORI_INVALID_VOICE_TYPE":"Agente: tipo di voce non valido","MEMORI_MISSING_NAME":"Agente: nome mancante","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Agente: password o token di recupero mancanti","MEMORI_INVALID_ID":"Agente: ID non valido","MEMORI_NAME_ALREADY_USED":"Nome Agente già in uso","MEMORI_INVALID_PIN":"Agente: PIN non valido","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Agente: cambio TAG e PIN richiedono operazioni separate","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Agente: password non richiesta su agente pubblico","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Pensiero Profondo richiede l\'abilitazione delle completions","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"Il gruppo di esperti richiede l\'abilitazione delle completions","MEMORI_INVALID_COMPLETION_CONFIG":"Agente: configurazione completions non valida","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Trasferimento: utente di destinazione mancante","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Trasferimento: ID utente di destinazione non valido","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Trasferimento: dati utente di destinazione non validi","MEMORI_TRANSFER_NOTHING_TO_DO":"Trasferimento: alcuna operazione da fare","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Agente: la configurazione non può essere modificata","MEMORI_MISSING_NEW_PASSWORD":"Agente: nuova password mancante","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Formato non valido data a partire da","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Formato non valido data fino a","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"Agente: funzionalità richiede un abbonamento","INTEGRATION_NOT_FOUND":"Integrazione non trovata","INTEGRATION_INVALID_TYPE":"Tipo integrazione non valido","INTEGRATION_ALREADY_EXISTS":"Integrazione già esistente","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Agenti non pubblici non possono essere integrati","INTEGRATION_MISSING_INVOCATION_TEXT":"Integrazione: testo di invocazione mancante","INTEGRATION_MISSING_DEVICE_EMAILS":"Integrazione: email del dispositivo mancante","INTEGRATION_MEMORI_IS_EMPTY":"Agenti vuoti non possono essere integrati","INTEGRATION_MISSING_PRIVACY_POLICY":"Integrazione: privacy policy mancante","INTEGRATION_MISSING_CATEGORY":"Categoria integrazione mancante","INTEGRATION_MISSING_DESCRIPTION":"Descrizione integrazione mancante","INTEGRATION_INVALID_INVOCATION_TEXT":"Testo di invocazione non valido","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home non più disponibile","UPLOAD_REQUIRES_MULTIPART_ENCODING":"L\'upload richiede l\'encoding multipart","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: manca il content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: dimensione massima superata","UPLOAD_FILE_IS_EMPTY":"Upload: file vuoto","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: tipo di file o firma non validi","UPLOAD_MISSING_FILE_NAME":"Upload: nome file mancante","UPLOAD_INVALID_MEMORY_ID":"Upload: ID contenuto non valido","UPLOAD_MISSING_FILE_CONTENT":"Upload: contenuto file mancante","ASSET_NOT_FOUND":"Asset non trovato","ASSET_NOT_ACCESSIBLE":"Asset non accessibile","ASSET_MISSING_SESSION_ID":"Asset: ID sessione mancante","ASSET_INVALID_FILE_NAME":"Asset: nome file non valido","INVITATION_NOT_FOUND":"Invito non trovato","INVITATION_NOT_ACCESSIBLE":"Invito non accessibile","INVITATION_ALREADY_ACCEPTED":"Invito già accettato","INVITATION_ALREADY_REJECTED":"Invito già rifiutato","INVITATION_MISSING_DESTINATION_EMAIL":"Invito: email di destinazione mancante","INVITATION_DESTINATION_EMAIL_INVALID":"Invito: email di destinazione non valida","INVITATION_MISSING_TAG":"Invito: tag mancante","INVITATION_MISSING_PIN":"Invito: PIN mancante","INVITATION_INVALID_PIN":"Invito: PIN non valido","INVITATION_INVALID_TYPE":"Invito: tipo non valido","INVITATION_MISSING_DESTINATION_NAME":"Invito: nome destinatario mancante","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invito: tag e pin non possono essere cambiati","INVITATION_CANT_BE_CHANGED":"Invito: non può essere modificato","ACTIONLOG_INVALID_USER_ID":"ID utente non valido","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","ACTIONLOG_INVALID_MEMORI_ID":"ID agente non valido","CONSUMPTIONLOG_INVALID_TYPE":"Tipo di log non valido","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Data a partire da: formato non valido","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Data fino a: formato non valido","CONSUMPTIONLOG_INVALID_USER_ID":"ID utente non valido","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Memori ID non valido","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notifiche: Periodo di estrazione chatlog non valido","PROCESS_INVALID_TYPE":"Tipo di processo non valido","PROCESS_ALREADY_RUNNING":"Processo già in esecuzione","PROCESS_NOT_FOUND":"Processo non trovato","IMPORTCSV_MISSING_ROWS":"Importazione CSV: righe mancanti","IMPORTCSV_MISSING_CSV":"Importazione CSV: CSV mancante","IMPORTCSV_MISSING_SEPARATOR":"Importazione CSV: separatore mancante","IMPORTCSV_INVALID_SEPARATOR":"Importazione CSV: separatore non valido","IMPORTCSV_MISSING_HEADERS":"Importazione CSV: intestazioni mancanti","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Importazione CSV: separatore varianti titolo mancante","IMPORTCSV_INVALID_RECEIVER_ID":"Importazione CSV: ID receiver non valido","IMPORTCSV_INVALID_MEDIA_LINK":"Importazione CSV: link media non valido","IMPORTCSV_INVALID_LINK_TITLE_HANDLING":"Importazione CSV: titolo link non valido","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"Importazione CSV: encoding caratteri non rilevabile","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"Importazione CSV: impossibile importare in agenti segreti","IMPORTTXT_MISSING_ROWS":"Importazione TXT: righe mancanti","IMPORTTXT_INVALID_GRANULARITY":"Importazione TXT: granularità non valida","IMPORTTXT_INVALID_RECEIVER_ID":"Importazione TXT: ID receiver non valido","IMPORTTXT_INVALID_MEDIA_LINK":"Importazione TXT: link media non valido","IMPORTTXT_INVALID_LINK_TITLE_HANDLING":"Importazione TXT: titolo link non valido","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"Importazione TXT: encoding caratteri non rilevabile","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"Importazione TXT: impossibile importare in agenti segreti","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Importazione TXT: limite importazione superato","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Importazione TXT: importazione su GPT-4 richiede API key","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Importazione TXT: importazione richiede un piano a pagamento","IMPORTTXT_BILLING_DENIED_PERMISSION":"Importazione TXT: non hai crediti sufficienti per l\'operazione","EXPORTCSV_MISSING_CSV_SPECS":"Esportazione CSV: specifiche CSV mancanti","EXPORTCSV_MISSING_SEPARATOR":"Esportazione CSV: separatore mancante","EXPORTCSV_INVALID_SEPARATOR":"Esportazione CSV: separatore non valido","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Esportazione CSV: separatore varianti titolo mancante","EXPORTCSV_MISSING_NEW_LINE_CHAR":"Esportazione CSV: carattere di nuova riga mancante","EXPORTCSV_INVALID_NEW_LINE_CHAR":"Esportazione CSV: carattere di nuova riga non valido","EXPORTCSV_MISSING_PASSWORD":"Esportazione CSV: password mancante","EXPORTJSONL_MISSING_JSONL_SPECS":"Esportazione JSONL: specifiche JSONL mancanti","EXPORTJSONL_MISSING_PLATFORM":"Esportazione JSONL: piattaforma mancante","EXPORTJSONL_INVALID_PLATFORM":"Esportazione JSONL: piattaforma non valida","EXPORTJSONL_MISSING_PASSWORD":"Esportazione JSONL: password mancante","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"Esportazione JSONL: esportazione richiede un piano a pagamento","ANALYSIS_MISSING_QUERY":"Analisi: query mancante","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analisi: impossibile analizzare agenti segreti","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analisi: corrispondenza query utente richiede Pensiero Profondo","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Assegnazione badge: credenziali errate o mancanti","BADGE_ASSIGNMENT_MISSING_REF_ID":"Assegnazione badge: ID ref mancante","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Assegnazione badge: esito non trovato","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Assegnazione badge: URL di asserzione mancante","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Assegnazione badge: URL badge mancante","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Assegnazione badge: URL issuer mancante","BADGE_ASSIGNMENT_INVALID_URL":"Assegnazione badge: URL non valido","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Assegnazione badge: destinatario mancante","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Assegnazione badge: tipo destinatario sconosciuto","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Assegnazione badge: identità destinatario mancante","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Assegnazione badge: tipo hash destinatario mancante","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Assegnazione badge: tipo hash destinatario sconosciuto","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Assegnazione badge: identità destinatario errata","BADGE_NOT_FOUND":"Badge non trovato","OUTCOME_NO_DCM_CONFIGURED":"Outcome: nessun DCM configurato","OUTCOME_USER_BADGES_DISABLED":"Outcome: badge utente disabilitati","COMPLETION_CONFIG_MISSING_NAME":"Configurazione completions: nome mancante","COMPLETION_CONFIG_MISSING_PROVIDER":"Configurazione completions: provider mancante","COMPLETION_CONFIG_MISSING_ENDPOINT":"Configurazione completions: endpoint mancante","COMPLETION_CONFIG_MISSING_API_KEY":"Configurazione completions: API key mancante","COMPLETION_CONFIG_MISSING_MODEL":"Configurazione completions: modello mancante","COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED":"Configurazione completions: almeno un tipo di completions deve essere specificato","COMPLETION_CONFIG_INVALID_NAME":"Configurazione completions: nome non valido","COMPLETION_CONFIG_INVALID_PURPOSE":"Configurazione completions: tipo di completions non valido","COMPLETION_CONFIG_INVALID_ENDPOINT":"Configurazione completions: endpoint non valido","COMPLETION_CONFIG_INCONSISTENT_ENDPOINT":"Configurazione completions: endpoint incoerente","COMPLETION_CONFIG_INVALID_PROVIDER":"Configurazione completions: provider non valido","COMPLETION_CONFIG_NOT_FOUND":"Configurazione completions: non trovata","COMPLETION_CONFIG_NOT_ACCESSIBLE":"Configurazione completions: non accessibile","COMPLETION_CONFIG_NAME_RESERVED":"Configurazione completions: nome riservato","COMPLETION_CONFIG_NAME_ALREADY_EXISTS":"Configurazione completions: nome già esistente","COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED":"Configurazione completions: cambiamento visibilità non consentito"}}');var dG;dG=JSON.parse('{"yes":"Yes","no":"No","confirm":"Confirm","apply":"Apply","cancel":"Cancel","show":"Show","hide":"Hide","send":"Send","close":"Close","edit":"Edit","delete":"Delete","loading":"Loading","expand":"Expand","collapse":"Collapse","fullscreenEnter":"Enter fullscreen","fullscreenExit":"Exit fullscreen","center":"Center","bottom":"Bottom","hidden":"Hidden","day":"Day","month":"Month","year":"Year","createdAt":"Creation date","selected":"Selected","page":"page","actions":"Actions","next":"Next","previous":"Previous","copy":"Copy","copyRawCode":"Copy raw code","copyToClipboard":"Copy to clipboard","showOriginalText":"Show original","showTranslatedText":"Show translation","exactPosition":"Exact position","uncertain":"Uncertain","question":"Question","nothingFound":"Nothing found","venue":"Venue","searchVenue":"Search venue...","memoriBlockedTitle":"Blocked","memoriBlockedUntil":"Agent blocked until {{date}}","memoriBlockedAnon":"Currently \\"{{name}}\\" can\'t answer, come back here on {{date}}","memoriBlockedReasonExceedChats":"because it has exceeded the monthly threshold of allowed chats.","memoriBlockedGiverHelper":"You can still manage it as administrator, but other users will not be able to interact with it.","generatedByAI":"Answer generated by AI, may occasionally generate incorrect informations","whyThisAnswer":"Why this answer?","whyThisAnswerHelper":"This answer was generated automatically by an artificial intelligence based on these verified contents.","completionsEnabled":"Advanced AI, can respond with automatically generated answers that may sometimes contain incorrect information","completionProviderDown":"This agent is integrated with a generative AI from {{provider}}, but it is currently unavailable. Try again later.","completionProviderFallbackName":"an external provider","completionProviderCheckStatusPage":"Check status page","boardOfExperts":"Board of experts","birthDate":"Birth date","birthDateHelper":"We ask for your birth date only to enable or disable functionalities that have age restrictions","underage":"You must be at least {{age}} years old to sign up.","underageTwinSession":"You must be at least {{age}} years old to interact with this agent.","errorFetchingSession":"Error during session loading","errorGettingReferralURL":"Error during referral loading","errorReopeningSession":"Error during session reopening","ageVerification":"Age verification","ageVerificationText":"To interact with this agent, you must be at least {{minAge}} years old.","nsfw":"NSFW: This agent contains adult contents","deepThought":"Deep Thought","deepThoughtHelper":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together. Allow the agent\'s author to contact you for commercial offers regarding products you have shown interest in.","deepThoughtDisclaimerTitle":"Deep Thought enabled","deepThoughtDisclaimer":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together.","deepThoughtPreDisclaimerUnlogged":"Log in to enable Deep Thought.","deepThoughtPreDisclaimerNotAllowed":"Deep Thought is disabled since you didn\'t consent its usage, you can change this any time in your account settings.","notEnoughCredits":"The author of this agent does not have enough credits to answer your question.","knownFacts":{"title":"Known facts","description":"Details of the information shared between you and {{memoriName}}","type":"Type","typeShortTerm":"Short term","typeLongTerm":"Long term","typeHelper":"Types:\\n- Short Term: this Known Fact is always used during conversations\\n- Long Term: this Known Fact is used during conversations only if relevant to the current question","text":"Text","deleteSuccess":"Known fact deleted","deleteConfirmTitle":"Delete known fact","deleteConfirmMessage":"Are you sure you want to delete this known fact?","deleteSelectedConfirmTitle":"Delete selected known facts","deleteSelectedConfirmMessage":"Are you sure you want to delete the selected known facts?"},"auth":{"title":"Authentication","useRecoveryTokens":"Use recovery tokens","tokens":"Tokens","addToken":"Add token","usePassword":"Use password","atLeast":"At least"},"widget":{"instruct":"Instruct","test":"Test","sound":"Sound","position":"Position preferences","settings":"Settings","share":"Share","sendOnKeypress":"Hit Enter to send","sendOnClick":"Click on Submit","boardOfExperts":"Board of experts","showExpertsInTheBoard":"Show experts in this board","expertsInTheBoard":"Experts in this board","goToIntegrationsToCustomizeAvatar":"To customize the avatar, go to Share and customize the public page"},"write_and_speak":{"micButtonPopover":"Click the button to speak","micButtonPopoverListening":"Click the button to stop speak","pageInstructExplanation":"To teach me new things click on the INSTRUCT ME button to get started","pageTryMeExplanation":"To talk to me click on the START button to get started","instructButton":"INSTRUCT ME","tryMeButton":"START","resumeButton":"RESUME","chatHistory":"Chat history","exportChatHistory":"Export chat history","exportChatHistoryMessage":"Do you want to export chat history?","chatBotButtonText":"CLICK HERE TO OPEN CHATBOT","conversationStartedLabel":"Conversation started on","settingsHeaderLabel":"Setup here if you want to set the continuous speech, and change the silence seconds if you want to customize them.","continuousSpeechLabel":"Continuous speech","continuousSpeechDisabled":"Continuous speech disabled because the agent is in mute mode","holdToSpeak":"Hold to speak","releaseToEndListening":"Release to end listening","pressAndHoldToSpeak":"Press and hold to speak","microphoneMode":"Microphone mode","hideEmissionsLabel":"Hide text emitted by the agent","secondsLabel":"Set seconds","controlsPosition":"Controls position","avatarControls":"Avatar controls","height":"Height","depth":"Depth","avatarType":"Avatar type","suggestions":"Use the arrow keys to adjust the avatar height\\nUse +/- to adjust the avatar depth","blob":"Blob","avatar3d":"3D Avatar","zoomed":"Zoomed","normal":"Normal","far":"Far","enablePositionControls":"Enable position controls","tryMeHeaderLabel":"TRY","unknownPosition":"Unknown position","fieldPlace":"Write the place (eg \'Milano\')","showMapLinkFor":"Show the position on the map","useMyPosition":"Use my position","myPosition":"Your position","updatingPosition":"Updating position...","placeNotFound":"Place not found!","requirePosition":"Insert your position before start","requirePositionHelp":"To talk to {{name}} you have to decide whether to provide your position or not. This is because different answers that it can provide you may depend on where you are.","dontWantToProvidePosition":"I don\'t want to provide my position","attachmentsLabel":"Enrich your message","iWantToTalkToIn":"I want to talk to {{name}} in"},"media":{"title":"Title","editAttributes":"Edit media attributes","uploadMimeTypeNotAllowed":"The file type is not allowed","uploadSizeLimitMessage":"The uploaded size is too big (max {{size}}MB)","uploadWrongResolutionMessage":"The resolution must be {{width}}x{{height}} pixel","memoriNameAlreadyUsed":"You already have an agent with this name","uploadHelperImages":"Upload a file with extension png, jpg, jpeg or gif, and having at maximum a size of {{size}}MB","uploadHelper":"Upload a file having at maximum a size of {{size}}MB","uploadError":"Upload failed","square":"square","scaleRatio":"Scale ratio","addMediaLabel":"Add a media","insertThisMediaMsg":"Insert these media","mediaUploadMessage":"Click to load a new media","addLinkLabel":"Add a link","linkKey":"URL","linkValue":"Link title","insertThisLink":"Insert a link to {{url}} with title {{title}}"},"gamification":{"level":"Level","points":"points","memoriReachedLevel":"became more evolved and reached level","levelGoToStatistics":"{{memori}} is at level {{level}} with {{points}} points. Click to go to statistics.","congratulationsNewLevel":"Congratulations, you have reached a new level!","congratulationsNewLevelDescription":"Your agent became more evolved with {{points}} points, look at the","statistics":"statistics"},"login":{"login":"Login","logout":"Logout","user":"User","loggedDrawerTitle":"Hi, {{name}}!","loginDrawerTitle":"Login","signupDrawerTitle":"Sign up","newUserSignUp":"New user?","signUp":"Sign up!","alreadyHaveAnAccount":"Already have an account?","backToLogin":"Back to login","registrationDisabled":"Registration is disabled","contactAdmin":"Contact the administrator to request access","userNameOrEmail":"Username or email","email":"Email","emailFormatError":"Please, insert a valid email","username":"Username","usernameContainsReservedWord":"Username contains a reserved word, please choose another one","usernameFormatError":"Username must be at least 3 characters long and contain only letters, numbers and _","otpCode":"Verification code","resendVerificationCode":"Resend code","resentVerificationCode":"Confirmation code sent! Please check your email.","password":"Password","newPassword":"New password","confirmPassword":"Confirm Password","currentPassword":"Current password","passwordMatchingError":"Passwords do not match.","passwordFormatError":"Password must be at least 8 characters long and contain at least a number, an upper case letter, a lower case letter and a symbol","pwdWeak":"Weak","pwdAcceptable":"Acceptable","pwdStrong":"Strong","mustChangePassword":"You must change your password","passwordChange":"Change password","emailChange":"Change email","avatarChange":"Change avatar","underage":"You must be at least {{age}} years old to sign up.","optional":"Optional","birthDate":"Birth date","birthDateHelper":"We ask for your birth date only to enable or disable functionalities that have age restrictions","missingData":"Missing informations","missingDataHelper":"We know that this is a bit annoying, but we need some more informations to complete your registration.","goToAccountToChangeYourPreferences":"You can change your choice at any time from your Account page.","deepThoughtExplaination":"Deep Thought is an advanced feature of the AI that will allow you to fully exploit your conversations by keeping track of them. The AI with Deep Thought can give you information tailored to you and the things you will share together. Allow the agent\'s author to contact you for commercial offers regarding products you have shown interest in.","tnCAndPPAcceptedHelper":"Since your last login, T&C and Privacy Policy have changed. Please accept them, otherwise you won\'t be able to make changes to your Twins. You can always delete your account in your user profile page.","privacyLabel":"I have read and accepted the","privacyAndCookiePolicy":"Privacy e Cookie Policy","and":"and","termsOfService":"Terms of Service","pAndCUAccepted":"I accept the terms of service about Deep Thought","editAccount":"Edit account","save":"Save"},"success":"Success","Error":"Error","internal server error":"Oupsie, sorry... Something went wrong on the server","error":"Error","error.loading":"Error while loading content.","error.generic":"Oupsie, sorry... something went wrong.","error.serverNotResponding":"We are doing maintenance or releasing updates. Please try again later.","error.notFound":"Oupsie, we didn\'t find the page you were looking for.","error.goBackTo":"You can try to go back to the","error.reloadPage":"Reload the page","error.tryAgain":"Try again","error.unauthorized":"You are unauthorized to view this content.","error.unprocessableEntity":"Error while processing the request. Check the data you entered.","errors":{"TENANT_NOT_FOUND":"Tenant not found","TENANT_REGISTRATION_DISABLED":"Registration on this platform is disabled","TENANT_MISSING_NAME":"Tenant: name missing","TENANT_MAX_USERS_REACHED":"Maximum number of users reached","TENANT_MAX_ADMINS_REACHED":"Maximum number of admin users reached","TENANT_ALREADY_EXISTS":"Tenant already exists","TENANT_MISSING_DESCRIPTION":"Tenant: description missing","TENANT_CANT_SET_COMPLETION_PROVIDER":"Tenant: can\'t set completion provider","USER_NOT_CONFIRMED":"User still not confirmed","USER_NOT_FOUND":"User not found","USER_OR_PASSWORD_INVALID":"Invalid user or password","USER_MUST_CHANGE_PASSWORD":"You must change your password","USER_MUST_ENTER_VERIFICATION_CODE":"You must enter the verification code","USER_MISSING_TENANT":"User: missing tenant","USER_MISSING_NAME":"User: name is missing","USER_MISSING_PASSWORD":"User: password missing","USER_MISSING_EMAIL":"User: Missing email","USER_MISSING_VERIFICATION_CODE":"User: Missing verification code","USER_NAME_ALREADY_USED":"User name already in use","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"The password does not meet the security rules","USER_EMAIL_ALREADY_USED":"Email already in use","USER_EMAIL_INVALID":"Invalid email","USER_VERIFICATION_CODE_INVALID":"Invalid verification code","USER_MISSING_NAME_OR_EMAIL":"Missing username or email","USER_NAME_INVALID":"Invalid user name","USER_HAS_ONE_OR_MORE_MEMORI":"The user has one or more memories","USER_MISSING_NEW_PASSWORD":"User: new password missing","USER_NOTHING_TO_DO":"Nothing to do","USER_CANT_CREATE_MEMORI":"User not allowed to create agents","USER_MAX_MEMORI_REACHED":"Maximum number of agents reached","USER_TOO_MANY_ATTEMPTS":"Too many attempts","USER_MUST_ACCEPT_TNC_AND_PP":"You must accept the terms and conditions","USER_BIRTH_DATE_CANT_BE_CHANGED":"Date of birth cannot be changed","USER_CANT_SET_COMPLETION_PROVIDER":"User: not allowed to manage completion provider","USER_CANT_ENABLE_DEEP_THOUGHT":"User: not enabled to manage Deep Thought","USER_CANT_ENABLE_DCM_INTEGRATION":"User: not enabled to manage DCM integration","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"User: not allowed to manage chaining or expert group","USER_CREATION_BILLING_DENIED_PERMISSION":"You don\'t have enough credits to create an agent","USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS":"The user has one or more completion configurations","USER_CANT_BE_DELETED":"User can\'t be deleted","MEMORI_NOT_FOUND":"Agent not found","MEMORI_NOT_ACCESSIBLE":"Agent not accessible","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Only owner can change tag or pin","SESSION_NOT_FOUND":"Session not found","SESSION_IS_NOT_ADMINISTRATIVE":"Non-administrative session","SESSION_EXPIRED":"Session expired","MEMORI_MISSING_CONFIGURATION":"Agent: missing configuration","MEMORI_CONFIGURATION_NOT_FOUND":"Agent: configuration not found","MEMORI_INVALID_PRIVACY_TYPE":"Agent: invalid privacy type","MEMORI_MISSING_PASSWORD":"Agent: missing password","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Agent: total number of invalid recovery tokens","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Agent: minimum number of invalid recovery tokens","MEMORI_INVALID_VOICE_TYPE":"Agent: invalid voice type","MEMORI_MISSING_NAME":"Agent: missing name","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Agent: missing password or recovery token","MEMORI_INVALID_ID":"Agent: invalid ID","MEMORI_NAME_ALREADY_USED":"Agent name already in use","MEMORI_INVALID_PIN":"Agent: Invalid PIN","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Agent: TAG and PIN change require separate operations","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Agent: no password required when public","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Deep Thought requires completions to be enabled","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"The expert group requires completions to be enabled","MEMORI_INVALID_COMPLETION_CONFIG":"Agent: invalid completions configuration","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Transfer: missing destination user","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Transfer: invalid destination user ID","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Transfer: invalid destination user data","MEMORI_TRANSFER_NOTHING_TO_DO":"Transfer: nothing to do","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Agent: configuration cannot be changed","MEMORI_MISSING_NEW_PASSWORD":"Agent: new password missing","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"Feature requires subscription","INTEGRATION_NOT_FOUND":"Integration not found","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Invalid date from format","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Invalid date to format","INTEGRATION_INVALID_TYPE":"Invalid integration type","INTEGRATION_ALREADY_EXISTS":"Integration already exists","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Non-public memories cannot be integrated","INTEGRATION_MISSING_INVOCATION_TEXT":"Integration: missing invocation text","INTEGRATION_MISSING_DEVICE_EMAILS":"Integration: missing device email","INTEGRATION_MEMORI_IS_EMPTY":"Empty memories cannot be integrated","INTEGRATION_MISSING_PRIVACY_POLICY":"Integration: privacy policy missing","INTEGRATION_MISSING_CATEGORY":"Integration category missing","INTEGRATION_MISSING_DESCRIPTION":"Missing integration description","INTEGRATION_INVALID_INVOCATION_TEXT":"Invalid invocation text","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home no more available","UPLOAD_REQUIRES_MULTIPART_ENCODING":"Upload requires multipart encoding","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Upload: missing content type boundary","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: maximum size exceeded","UPLOAD_FILE_IS_EMPTY":"Upload: empty file","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Upload: invalid file type or signature","UPLOAD_MISSING_FILE_NAME":"Upload: missing file name","UPLOAD_INVALID_MEMORY_ID":"Upload: Invalid content ID","UPLOAD_MISSING_FILE_CONTENT":"Upload: Missing file content","ASSET_NOT_FOUND":"Asset not found","ASSET_NOT_ACCESSIBLE":"Asset not accessible","ASSET_MISSING_SESSION_ID":"Asset: missing session ID","ASSET_INVALID_FILE_NAME":"Asset: invalid file name","INVITATION_NOT_FOUND":"Invitation not found","INVITATION_NOT_ACCESSIBLE":"Invitation not accessible","INVITATION_ALREADY_ACCEPTED":"Invitation already accepted","INVITATION_ALREADY_REJECTED":"Invitation already rejected","INVITATION_MISSING_DESTINATION_EMAIL":"Invitation: missing destination email","INVITATION_DESTINATION_EMAIL_INVALID":"Invitation: destination email invalid","INVITATION_MISSING_TAG":"Invitation: missing tag","INVITATION_MISSING_PIN":"Invitation: PIN missing","INVITATION_INVALID_PIN":"Invitation: invalid PIN","INVITATION_INVALID_TYPE":"Invitation: invalid type","INVITATION_MISSING_DESTINATION_NAME":"Invitation: destination name missing","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invitation: tag and pin can\'t be changed","INVITATION_CANT_BE_CHANGED":"Intation: can\'t be changed","ACTIONLOG_INVALID_USER_ID":"Invalid user ID","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","ACTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID","CONSUMPTIONLOG_INVALID_TYPE":"Invalid log type","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Date from: invalid format","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Date to: invalid format","CONSUMPTIONLOG_INVALID_USER_ID":"Invalid user ID","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Invalid Memori ID","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notifications: Invalid chat log extraction period","PROCESS_INVALID_TYPE":"Invalid process type","PROCESS_ALREADY_RUNNING":"Process already running","PROCESS_NOT_FOUND":"Process not found","IMPORTCSV_MISSING_ROWS":"CSV import: missing rows","IMPORTCSV_MISSING_CSV":"CSV Import: Missing CSV","IMPORTCSV_MISSING_SEPARATOR":"CSV import: missing separator","IMPORTCSV_INVALID_SEPARATOR":"CSV import: invalid separator","IMPORTCSV_MISSING_HEADERS":"CSV import: missing headers","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV import: missing title variant separator","IMPORTCSV_INVALID_RECEIVER_ID":"CSV import: invalid receiver ID","IMPORTCSV_INVALID_MEDIA_LINK":"CSV import: invalid media link","IMPORTCSV_INVALID_LINK_TITLE_HANDLING":"CSV import: invalid link title","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"CSV import: undetectable character encoding","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"CSV Import: Cannot import to Secret Memories","IMPORTTXT_MISSING_ROWS":"Importing TXT: missing rows","IMPORTTXT_INVALID_GRANULARITY":"Import TXT: invalid granularity","IMPORTTXT_INVALID_RECEIVER_ID":"Import TXT: invalid receiver ID","IMPORTTXT_INVALID_MEDIA_LINK":"Import TXT: invalid media link","IMPORTTXT_INVALID_LINK_TITLE_HANDLING":"Import TXT: invalid link title","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"TXT import: undetectable character encoding","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"TXT Import: Cannot import to Secret Memories","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Import TXT: import limit exceeded","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Import TXT: import on GPT-4 requires API key","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Import TXT: Import requires a paying plan","IMPORTTXT_BILLING_DENIED_PERMISSION":"Import TXT: you don\'t have enough credits for the operation","EXPORTCSV_MISSING_CSV_SPECS":"CSV export: missing CSV specifications","EXPORTCSV_MISSING_SEPARATOR":"CSV export: missing separator","EXPORTCSV_INVALID_SEPARATOR":"CSV export: invalid separator","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV export: missing title variant separator","EXPORTCSV_MISSING_NEW_LINE_CHAR":"CSV export: missing newline character","EXPORTCSV_INVALID_NEW_LINE_CHAR":"CSV export: invalid newline character","EXPORTCSV_MISSING_PASSWORD":"CSV export: missing password","EXPORTJSONL_MISSING_JSONL_SPECS":"JSONL export: missing JSONL specifications","EXPORTJSONL_MISSING_PLATFORM":"JSONL export: missing platform","EXPORTJSONL_INVALID_PLATFORM":"JSONL export: invalid platform","EXPORTJSONL_MISSING_PASSWORD":"JSONL export: missing password","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"JSONL Export: Export requires a paid plan","ANALYSIS_MISSING_QUERY":"Analysis: missing query","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analysis: Unable to analyze Secret Memories","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analysis: matching user query requires Deep Thinking","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Badge assignment: incorrect or missing credentials","BADGE_ASSIGNMENT_MISSING_REF_ID":"Badge assignment: ref ID missing","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Badge assignment: result not found","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Badge assignment: Missing assertion URL","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Badge Assignment: Missing Badge URL","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Badge assignment: missing issuer URL","BADGE_ASSIGNMENT_INVALID_URL":"Badge assignment: Invalid URL","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Badge assignment: missing recipient","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Badge assignment: unknown recipient type","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Badge assignment: missing recipient identity","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Badge assignment: missing recipient hash type","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Badge assignment: recipient hash type unknown","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Badge assignment: incorrect recipient identity","BADGE_NOT_FOUND":"Badge not found","OUTCOME_NO_DCM_CONFIGURED":"Outcome: no DCM configured","OUTCOME_USER_BADGES_DISABLED":"Outcome: user badges disabled","COMPLETION_CONFIG_MISSING_NAME":"Completions configuration: missing name","COMPLETION_CONFIG_MISSING_PROVIDER":"Completions configuration: missing provider","COMPLETION_CONFIG_MISSING_ENDPOINT":"Completions configuration: missing endpoint","COMPLETION_CONFIG_MISSING_API_KEY":"Completions configuration: missing API key","COMPLETION_CONFIG_MISSING_MODEL":"Completions configuration: missing model","COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED":"Completions configuration: at least one completions type must be specified","COMPLETION_CONFIG_INVALID_NAME":"Completions configuration: invalid name","COMPLETION_CONFIG_INVALID_PURPOSE":"Completions configuration: invalid completions type","COMPLETION_CONFIG_INVALID_ENDPOINT":"Completions configuration: invalid endpoint","COMPLETION_CONFIG_INCONSISTENT_ENDPOINT":"Completions configuration: inconsistent endpoint","COMPLETION_CONFIG_INVALID_PROVIDER":"Completions configuration: invalid provider","COMPLETION_CONFIG_NOT_FOUND":"Completions configuration: not found","COMPLETION_CONFIG_NOT_ACCESSIBLE":"Completions configuration: not accessible","COMPLETION_CONFIG_NAME_RESERVED":"Completions configuration: name reserved","COMPLETION_CONFIG_NAME_ALREADY_EXISTS":"Completions configuration: name already exists","COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED":"Completions configuration: visibility change not allowed"}}');var hG;hG=JSON.parse('{"yes":"Oui","no":"Non","confirm":"Confirmer","apply":"Appliquer","cancel":"Annuler","show":"Montrer","hide":"Cacher","send":"Envoyer","close":"Fermer","edit":"Modifier","delete":"Supprimer","loading":"Chargement","expand":"Développer","collapse":"Effondrement","fullscreenEnter":"Entrez en plein écran","fullscreenExit":"Quitter le plein écran","center":"Centre","bottom":"Bas","hidden":"Caché","day":"Jour","month":"Mois","year":"Année","createdAt":"Date de création","selected":"Choisi","page":"page","actions":"Actes","next":"Suivant","previous":"Précédent","copy":"Copie","copyRawCode":"Copier le code brut","copyToClipboard":"Copier dans le presse-papier","showOriginalText":"Afficher l\'original","showTranslatedText":"Afficher la traduction","exactPosition":"Position exacte","uncertain":"Incertain","question":"Question","nothingFound":"Rien trouvé","venue":"Lieu","searchVenue":"Rechercher un lieu...","memoriBlockedTitle":"Bloqué","memoriBlockedUntil":"Agent bloqué jusqu\'à {{date}}","memoriBlockedAnon":"Actuellement \\"{{name}}\\"Je ne peux pas répondre, reviens ici {{date}}","memoriBlockedReasonExceedChats":"car il a dépassé le seuil mensuel de chats autorisés.","memoriBlockedGiverHelper":"Vous pouvez toujours le gérer en tant qu\'administrateur, mais les autres utilisateurs ne pourront pas interagir avec lui.","generatedByAI":"Réponse générée par l\'IA, peut occasionnellement générer des informations incorrectes","whyThisAnswer":"Pourquoi cette réponse ?","whyThisAnswerHelper":"Cette réponse a été générée automatiquement par une intelligence artificielle basée sur ces contenus vérifiés.","completionsEnabled":"L\'IA avancée peut répondre avec des réponses générées automatiquement qui peuvent parfois contenir des informations incorrectes","completionProviderDown":"Ce Agent est intégré à une IA générative de {{provider}}, mais il est actuellement indisponible. ","completionProviderFallbackName":"un prestataire externe","completionProviderCheckStatusPage":"Vérifier la page d\'état","boardOfExperts":"Conseil d\'experts","birthDate":"Date de naissance","birthDateHelper":"Nous demandons votre date de naissance uniquement pour activer ou désactiver les fonctionnalités qui ont des restrictions d\'âge","underage":"Vous devez être au moins {{age}} ans pour s\'inscrire.","underageTwinSession":"Vous devez être au moins {{age}} ans pour interagir avec ce Agent.","errorFetchingSession":"Erreur lors du chargement de la session","errorGettingReferralURL":"Erreur lors du chargement du référent","errorReopeningSession":"Erreur lors de la re-ouverture de la session","ageVerification":"Vérification de l\'âge","ageVerificationText":"Pour interagir avec ce Agent, vous devez être au minimum {{minAge}} ans.","nsfw":"NSFW : Ce jumeau contient du contenu pour adultes","deepThought":"Pensée profonde","deepThoughtHelper":"Deep Thought est une fonctionnalité avancée de l\'IA qui vous permettra d\'exploiter pleinement vos conversations en les gardant une trace. ","deepThoughtDisclaimerTitle":"Pensée profonde activée","deepThoughtDisclaimer":"Deep Thought est une fonctionnalité avancée de l\'IA qui vous permettra d\'exploiter pleinement vos conversations en les gardant une trace. ","deepThoughtPreDisclaimerUnlogged":"Connectez-vous pour activer Deep Thought.","deepThoughtPreDisclaimerNotAllowed":"Deep Thought est désactivé car vous n\'avez pas consenti à son utilisation, vous pouvez le modifier à tout moment dans les paramètres de votre compte.","notEnoughCredits":"L\'auteur de ce Agent n\'a pas suffisamment de crédits pour répondre à votre question.","knownFacts":{"title":"Faits connus","description":"Détails des informations partagées entre vous et {{memoriName}}","type":"Taper","typeShortTerm":"Court terme","typeLongTerm":"Long terme","typeHelper":"Types :\\n","text":"Texte","deleteSuccess":"Fait connu supprimé","deleteConfirmTitle":"Supprimer un fait connu","deleteConfirmMessage":"Êtes-vous sûr de vouloir supprimer ce fait connu ?","deleteSelectedConfirmTitle":"Supprimer les faits connus sélectionnés","deleteSelectedConfirmMessage":"Etes-vous sûr de vouloir supprimer les faits connus sélectionnés ?"},"auth":{"title":"Authentification","useRecoveryTokens":"Utiliser des jetons de récupération","tokens":"Jetons","addToken":"Ajouter un jeton","usePassword":"Utiliser le mot de passe","atLeast":"Au moins"},"widget":{"instruct":"Instruire","test":"Test","sound":"Son","position":"Préférences de position","settings":"Paramètres","share":"Partager","sendOnKeypress":"Appuyez sur Entrée pour envoyer","sendOnClick":"Cliquez sur Soumettre","boardOfExperts":"Conseil d\'experts","showExpertsInTheBoard":"Afficher les experts dans ce forum","expertsInTheBoard":"Experts dans ce forum","goToIntegrationsToCustomizeAvatar":"Pour personnaliser l\'avatar, allez dans Partager et personnalisez la page publique"},"write_and_speak":{"micButtonPopover":"Cliquez sur le bouton pour parler","micButtonPopoverListening":"Cliquez sur le bouton pour arrêter de parler","pageInstructExplanation":"Pour m\'apprendre de nouvelles choses, cliquez sur le bouton INSTRUCTEZ-MOI pour commencer","pageTryMeExplanation":"Pour me parler, cliquez sur le bouton START pour commencer","instructButton":"INSTRUCTEZ-MOI","tryMeButton":"COMMENCER","chatHistory":"Historique des discussions","exportChatHistory":"Exporter l\'historique des discussions","exportChatHistoryMessage":"Voulez-vous exporter l’historique des discussions ?","chatBotButtonText":"CLIQUEZ ICI POUR OUVRIR LE CHATBOT","conversationStartedLabel":"La conversation a commencé le","settingsHeaderLabel":"Configurez ici si vous souhaitez définir la mémoire comme parole continue et modifiez les secondes de silence si vous souhaitez les personnaliser.","continuousSpeechLabel":"Discours continu","continuousSpeechDisabled":"Discours continu désactivé car l\'agente est en mode muté","holdToSpeak":"Attends pour parler","releaseToEndListening":"Relâcher pour terminer l\'écoute","pressAndHoldToSpeak":"Appuyez et maintenez pour parler","microphoneMode":"Mode micro","hideEmissionsLabel":"Masquer le texte émis par le Agent","secondsLabel":"Régler les secondes","controlsPosition":"Position des commandes","tryMeHeaderLabel":"ESSAYER","unknownPosition":"Position inconnue","fieldPlace":"Écrivez le lieu (par exemple « Milano »)","showMapLinkFor":"Afficher la position sur la carte","useMyPosition":"Utiliser ma position","myPosition":"Votre poste","updatingPosition":"Mise à jour du poste...","placeNotFound":"Lieu introuvable !","requirePosition":"Insérez votre position avant de commencer","requirePositionHelp":"Pour parler à {{name}} vous devez décider si vous souhaitez ou non fournir votre poste. ","dontWantToProvidePosition":"Je ne veux pas donner ma position","attachmentsLabel":"Enrichissez votre message","iWantToTalkToIn":"je veux parler à {{name}} dans"},"media":{"title":"Titre","editAttributes":"Modifier les attributs du média","uploadMimeTypeNotAllowed":"Le type de fichier n\'est pas autorisé","uploadSizeLimitMessage":"La taille téléchargée est trop grande (max {{size}}Mo)","uploadWrongResolutionMessage":"La résolution doit être {{width}}x{{height}} pixels","memoriNameAlreadyUsed":"Vous avez déjà un jumeau portant ce nom","uploadHelperImages":"Téléchargez un fichier avec l\'extension png, jpg, jpeg ou gif, et ayant au maximum une taille de {{size}}Mo","uploadHelper":"Téléchargez un fichier ayant au maximum une taille de {{size}}Mo","uploadError":"Échec du téléchargement","square":"carré","scaleRatio":"Rapport d\'échelle","addMediaLabel":"Ajouter un média","insertThisMediaMsg":"Insérez ces médias","mediaUploadMessage":"Cliquez pour charger un nouveau média","addLinkLabel":"Ajouter un lien","linkKey":"URL","linkValue":"Titre du lien","insertThisLink":"Insérer un lien vers {{url}} avec titre {{title}}"},"gamification":{"level":"Niveau","points":"points","memoriReachedLevel":"est devenu plus évolué et a atteint le niveau","levelGoToStatistics":"{{Agent}} est au niveau {{level}} avec {{points}} points. ","congratulationsNewLevel":"Félicitations, vous avez atteint un nouveau niveau !","congratulationsNewLevelDescription":"Votre Agent est devenu plus évolué avec {{points}} points, regardez le","statistics":"statistiques"},"login":{"login":"Se connecter","logout":"Déconnexion","user":"Utilisateur","loggedDrawerTitle":"Salut, {{name}}!","loginDrawerTitle":"Se connecter","signupDrawerTitle":"S\'inscrire","newUserSignUp":"Nouvel utilisateur ?","signUp":"S\'inscrire!","alreadyHaveAnAccount":"Vous avez déjà un compte ?","backToLogin":"Retour à la connexion","registrationDisabled":"L\'inscription est désactivée","contactAdmin":"Contacter l\'administrateur pour demander l\'accès","userNameOrEmail":"Nom d\'utilisateur ou email","email":"E-mail","emailFormatError":"Veuillez insérer un email valide","username":"Nom d\'utilisateur","usernameContainsReservedWord":"Le nom d\'utilisateur contient un mot réservé, veuillez en choisir un autre","usernameFormatError":"Le nom d\'utilisateur doit comporter au moins 3 caractères et contenir uniquement des lettres, des chiffres et _","otpCode":"Le code de vérification","resendVerificationCode":"Renvoyer le code","resentVerificationCode":"Code de confirmation envoyé ! ","password":"Mot de passe","newPassword":"Nouveau mot de passe","confirmPassword":"Confirmez le mot de passe","currentPassword":"Mot de passe actuel","passwordMatchingError":"Les mots de passe ne correspondent pas.","passwordFormatError":"Le mot de passe doit comporter au moins 8 caractères et contenir au moins un chiffre, une lettre majuscule, une lettre minuscule et un symbole.","pwdWeak":"Faible","pwdAcceptable":"Acceptable","pwdStrong":"Fort","mustChangePassword":"Vous devez changer votre mot de passe","passwordChange":"Changer le mot de passe","emailChange":"Changer d\'e-mail","avatarChange":"Changer d\'avatar","underage":"Vous devez être au moins {{age}} ans pour s\'inscrire.","optional":"Facultatif","birthDate":"Date de naissance","birthDateHelper":"Nous demandons votre date de naissance uniquement pour activer ou désactiver les fonctionnalités qui ont des restrictions d\'âge","missingData":"Informations manquantes","missingDataHelper":"Nous savons que c\'est un peu ennuyeux, mais nous avons besoin de plus d\'informations pour finaliser votre inscription.","goToAccountToChangeYourPreferences":"Vous pouvez modifier votre choix à tout moment depuis la page de votre compte.","deepThoughtExplaination":"Deep Thought est une fonctionnalité avancée de l\'IA qui vous permettra d\'exploiter pleinement vos conversations en les gardant une trace. ","tnCAndPPAcceptedHelper":"Depuis votre dernière connexion, les conditions générales et la politique de confidentialité ont changé. ","privacyLabel":"J\'ai lu et accepté le","privacyAndCookiePolicy":"Politique de confidentialité et de cookies","and":"et","termsOfService":"Conditions d\'utilisation","pAndCUAccepted":"J\'accepte les conditions d\'utilisation de Deep Thought","editAccount":"Modifier le compte","save":"Sauvegarder"},"success":"Succès","Error":"Erreur","internal server error":"Oupsie, désolé... Quelque chose s\'est mal passé sur le serveur","error":"Erreur","error.loading":"Erreur lors du chargement du contenu.","error.generic":"Oupsie, désolé... quelque chose s\'est mal passé.","error.serverNotResponding":"Nous effectuons une maintenance ou publions des mises à jour. ","error.notFound":"Oupsie, nous n\'avons pas trouvé la page que vous cherchiez.","error.goBackTo":"Vous pouvez essayer de revenir au","error.reloadPage":"Recharger la page","error.tryAgain":"Essayer à nouveau","error.unauthorized":"Vous n\'êtes pas autorisé à consulter ce contenu.","error.unprocessableEntity":"Erreur lors du traitement de la demande. ","errors":{"TENANT_NOT_FOUND":"Locataire introuvable","TENANT_REGISTRATION_DISABLED":"L\'inscription sur cette plateforme est désactivée","TENANT_MISSING_NAME":"Locataire : nom manquant","TENANT_MAX_USERS_REACHED":"Nombre maximum d\'utilisateurs atteint","TENANT_MAX_ADMINS_REACHED":"Nombre maximum d\'utilisateurs administrateurs atteint","TENANT_ALREADY_EXISTS":"Le locataire existe déjà","TENANT_MISSING_DESCRIPTION":"Locataire : description manquante","TENANT_CANT_SET_COMPLETION_PROVIDER":"Locataire : impossible de définir le fournisseur de complétion","USER_NOT_CONFIRMED":"L\'utilisateur n\'est toujours pas confirmé","USER_NOT_FOUND":"Utilisateur introuvable","USER_OR_PASSWORD_INVALID":"Utilisateur ou mot de passe invalide","USER_MUST_CHANGE_PASSWORD":"Vous devez changer votre mot de passe","USER_MUST_ENTER_VERIFICATION_CODE":"Vous devez entrer le code de vérification","USER_MISSING_TENANT":"Utilisateur : locataire manquant","USER_MISSING_NAME":"Utilisateur : le nom est manquant","USER_MISSING_PASSWORD":"Utilisateur : mot de passe manquant","USER_MISSING_EMAIL":"Utilisateur : E-mail manquant","USER_MISSING_VERIFICATION_CODE":"Utilisateur : Code de vérification manquant","USER_NAME_ALREADY_USED":"Nom d\'utilisateur déjà utilisé","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"Le mot de passe ne répond pas aux règles de sécurité","USER_EMAIL_ALREADY_USED":"E-mail déjà utilisé","USER_EMAIL_INVALID":"E-mail invalide","USER_VERIFICATION_CODE_INVALID":"Code de vérification invalide","USER_MISSING_NAME_OR_EMAIL":"Nom d\'utilisateur ou e-mail manquant","USER_NAME_INVALID":"Nom d\'utilisateur invalide","USER_HAS_ONE_OR_MORE_MEMORI":"L\'utilisateur possède une ou plusieurs mémoires","USER_MISSING_NEW_PASSWORD":"Utilisateur : nouveau mot de passe manquant","USER_NOTHING_TO_DO":"Rien à faire","USER_CANT_CREATE_MEMORI":"L\'utilisateur n\'est pas autorisé à créer des Agent","USER_MAX_MEMORI_REACHED":"Nombre maximum de Agent atteint","USER_TOO_MANY_ATTEMPTS":"Trop de tentatives","USER_MUST_ACCEPT_TNC_AND_PP":"Vous devez accepter les termes et conditions","USER_BIRTH_DATE_CANT_BE_CHANGED":"La date de naissance ne peut pas être modifiée","USER_CANT_SET_COMPLETION_PROVIDER":"Utilisateur : non autorisé à gérer le fournisseur de complétion","USER_CANT_ENABLE_DEEP_THOUGHT":"Utilisateur : non autorisé à gérer Deep Thought","USER_CANT_ENABLE_DCM_INTEGRATION":"Utilisateur : non autorisé à gérer l\'intégration DCM","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"Utilisateur : non autorisé à gérer des chaînages ou des groupes d\'experts","USER_CREATION_BILLING_DENIED_PERMISSION":"Vous n\'avez pas assez de crédits pour créer un Agent","USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS":"L\'utilisateur dispose d\'une ou plusieurs configurations de complétion","USER_CANT_BE_DELETED":"L\'utilisateur ne peut pas être supprimé","MEMORI_NOT_FOUND":"Mémoire introuvable","MEMORI_NOT_ACCESSIBLE":"Mémoires non accessibles","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Seul le propriétaire peut modifier le tag ou le code PIN","SESSION_NOT_FOUND":"Séance introuvable","SESSION_IS_NOT_ADMINISTRATIVE":"Séance non administrative","SESSION_EXPIRED":"Session expirée","MEMORI_MISSING_CONFIGURATION":"Agent : configuration manquante","MEMORI_CONFIGURATION_NOT_FOUND":"Agent : configuration introuvable","MEMORI_INVALID_PRIVACY_TYPE":"Agent : type de confidentialité non valide","MEMORI_MISSING_PASSWORD":"Agent : mot de passe manquant","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Agent : nombre total de jetons de récupération invalides","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Agent : nombre minimum de jetons de récupération invalides","MEMORI_INVALID_VOICE_TYPE":"Agent : type de voix invalide","MEMORI_MISSING_NAME":"Jumeau : nom manquant","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Agent : mot de passe ou jeton de récupération manquant","MEMORI_INVALID_ID":"Jumeau : pièce d\'identité invalide","MEMORI_NAME_ALREADY_USED":"Nom jumeau déjà utilisé","MEMORI_INVALID_PIN":"Agent : code PIN invalide","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Agent : le changement de TAG et de PIN nécessite des opérations distinctes","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Agent : aucun mot de passe requis lorsqu\'il est public","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Deep Thought nécessite que les complétions soient activées","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"Le groupe d\'experts exige que les complétions soient activées","MEMORI_INVALID_COMPLETION_CONFIG":"Agent : configuration des complétions non valide","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Transfert : utilisateur de destination manquant","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Transfert : ID utilisateur de destination non valide","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Transfert : données utilisateur de destination non valides","MEMORI_TRANSFER_NOTHING_TO_DO":"Transfert : rien à faire","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Mémoires : la configuration ne peut pas être modifiée","MEMORI_MISSING_NEW_PASSWORD":"Souvenirs : nouveau mot de passe manquant","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"La fonctionnalité nécessite un abonnement","INTEGRATION_NOT_FOUND":"Intégration introuvable","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Date invalide du format","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Date à formater invalide","INTEGRATION_INVALID_TYPE":"Type d\'intégration invalide","INTEGRATION_ALREADY_EXISTS":"L\'intégration existe déjà","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Les mémoires non publiques ne peuvent pas être intégrées","INTEGRATION_MISSING_INVOCATION_TEXT":"Intégration : texte d\'invocation manquant","INTEGRATION_MISSING_DEVICE_EMAILS":"Intégration : e-mail de l\'appareil manquant","INTEGRATION_MEMORI_IS_EMPTY":"Les mémoires vides ne peuvent pas être intégrées","INTEGRATION_MISSING_PRIVACY_POLICY":"Intégration : politique de confidentialité manquante","INTEGRATION_MISSING_CATEGORY":"Catégorie d\'intégration manquante","INTEGRATION_MISSING_DESCRIPTION":"Description de l\'intégration manquante","INTEGRATION_INVALID_INVOCATION_TEXT":"Texte d\'appel invalide","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home n\'est plus disponible","UPLOAD_REQUIRES_MULTIPART_ENCODING":"Le téléchargement nécessite un codage en plusieurs parties","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Téléchargement : limite de type de contenu manquante","UPLOAD_MAX_LENGTH_EXCEEDED":"Téléchargement : taille maximale dépassée","UPLOAD_FILE_IS_EMPTY":"Télécharger : fichier vide","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Téléchargement : type de fichier ou signature non valide","UPLOAD_MISSING_FILE_NAME":"Télécharger : nom de fichier manquant","UPLOAD_INVALID_MEMORY_ID":"Télécharger : ID de contenu invalide","UPLOAD_MISSING_FILE_CONTENT":"Télécharger : contenu du fichier manquant","ASSET_NOT_FOUND":"Actif introuvable","ASSET_NOT_ACCESSIBLE":"Actif non accessible","ASSET_MISSING_SESSION_ID":"Élément : ID de session manquant","ASSET_INVALID_FILE_NAME":"Élément : nom de fichier non valide","INVITATION_NOT_FOUND":"Invitation introuvable","INVITATION_NOT_ACCESSIBLE":"Invitation non accessible","INVITATION_ALREADY_ACCEPTED":"Invitation déjà acceptée","INVITATION_ALREADY_REJECTED":"Invitation déjà rejetée","INVITATION_MISSING_DESTINATION_EMAIL":"Invitation : e-mail de destination manquant","INVITATION_DESTINATION_EMAIL_INVALID":"Invitation : e-mail de destination invalide","INVITATION_MISSING_TAG":"Invitation : étiquette manquante","INVITATION_MISSING_PIN":"Invitation : code PIN manquant","INVITATION_INVALID_PIN":"Invitation : code PIN invalide","INVITATION_INVALID_TYPE":"Invitation : type non valide","INVITATION_MISSING_DESTINATION_NAME":"Invitation : le nom de la destination est manquant","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invitation : le tag et le code PIN ne peuvent pas être modifiés","INVITATION_CANT_BE_CHANGED":"Intation : ne peut pas être modifié","ACTIONLOG_INVALID_USER_ID":"ID utilisateur invalide","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Date de : format non valide","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Date de : format non valide","ACTIONLOG_INVALID_MEMORI_ID":"Identifiant Agent invalide","CONSUMPTIONLOG_INVALID_TYPE":"Type de journal invalide","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Date de : format non valide","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Date de : format non valide","CONSUMPTIONLOG_INVALID_USER_ID":"ID utilisateur invalide","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Identifiant Agent invalide","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notifications : période d\'extraction du journal de discussion non valide","PROCESS_INVALID_TYPE":"Type de processus invalide","PROCESS_ALREADY_RUNNING":"Processus déjà en cours","PROCESS_NOT_FOUND":"Processus introuvable","IMPORTCSV_MISSING_ROWS":"Import CSV : lignes manquantes","IMPORTCSV_MISSING_CSV":"Importation CSV : CSV manquant","IMPORTCSV_MISSING_SEPARATOR":"Import CSV : séparateur manquant","IMPORTCSV_INVALID_SEPARATOR":"Importation CSV : séparateur non valide","IMPORTCSV_MISSING_HEADERS":"Import CSV : en-têtes manquants","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Import CSV : séparateur de variante de titre manquant","IMPORTCSV_INVALID_RECEIVER_ID":"Importation CSV : ID de destinataire non valide","IMPORTCSV_INVALID_MEDIA_LINK":"Importation CSV : lien média non valide","IMPORTCSV_INVALID_LINK_TITLE_HANDLING":"Importation CSV : titre du lien invalide","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"Import CSV : encodage de caractères indétectable","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"Importation CSV : impossible d\'importer dans les mémoires secrètes","IMPORTTXT_MISSING_ROWS":"Importation de TXT : lignes manquantes","IMPORTTXT_INVALID_GRANULARITY":"Importer TXT : granularité invalide","IMPORTTXT_INVALID_RECEIVER_ID":"Importer TXT : ID de destinataire invalide","IMPORTTXT_INVALID_MEDIA_LINK":"Importer TXT : lien média non valide","IMPORTTXT_INVALID_LINK_TITLE_HANDLING":"Importer TXT : titre du lien invalide","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"Import TXT : encodage de caractères indétectable","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"Importation TXT : impossible d\'importer vers les mémoires secrètes","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Importer TXT : limite d\'importation dépassée","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Importer TXT : l\'importation sur GPT-4 nécessite une clé API","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Importer TXT : l\'importation nécessite un forfait payant","IMPORTTXT_BILLING_DENIED_PERMISSION":"Importer TXT : vous n\'avez pas assez de crédits pour l\'opération","EXPORTCSV_MISSING_CSV_SPECS":"Exportation CSV : spécifications CSV manquantes","EXPORTCSV_MISSING_SEPARATOR":"Export CSV : séparateur manquant","EXPORTCSV_INVALID_SEPARATOR":"Exportation CSV : séparateur non valide","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Exportation CSV : séparateur de variante de titre manquant","EXPORTCSV_MISSING_NEW_LINE_CHAR":"Exportation CSV : caractère de nouvelle ligne manquant","EXPORTCSV_INVALID_NEW_LINE_CHAR":"Exportation CSV : caractère de nouvelle ligne non valide","EXPORTCSV_MISSING_PASSWORD":"Export CSV : mot de passe manquant","EXPORTJSONL_MISSING_JSONL_SPECS":"Export JSONL : spécifications JSONL manquantes","EXPORTJSONL_MISSING_PLATFORM":"Export JSONL : plateforme manquante","EXPORTJSONL_INVALID_PLATFORM":"Export JSONL : plateforme non valide","EXPORTJSONL_MISSING_PASSWORD":"Export JSONL : mot de passe manquant","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"Exportation JSONL : l\'exportation nécessite un forfait payant","ANALYSIS_MISSING_QUERY":"Analyse : requête manquante","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analyse : impossible d\'analyser les souvenirs secrets","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analyse : la correspondance avec la requête de l\'utilisateur nécessite une réflexion approfondie","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Attribution des badges : identifiants incorrects ou manquants","BADGE_ASSIGNMENT_MISSING_REF_ID":"Affectation du badge : ID de référence manquant","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Attribution des badges : résultat introuvable","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Attribution du badge : URL d\'assertion manquante","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Attribution du badge : URL du badge manquante","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Attribution du badge : URL de l\'émetteur manquante","BADGE_ASSIGNMENT_INVALID_URL":"Attribution du badge : URL invalide","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Affectation du badge : destinataire manquant","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Attribution du badge : type de destinataire inconnu","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Attribution du badge : identité du destinataire manquante","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Attribution du badge : type de hachage du destinataire manquant","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Attribution du badge : type de hachage du destinataire inconnu","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Attribution du badge : identité du destinataire incorrecte","BADGE_NOT_FOUND":"Badge introuvable","OUTCOME_NO_DCM_CONFIGURED":"Résultat : aucun DCM configuré","OUTCOME_USER_BADGES_DISABLED":"Résultat : badges utilisateur désactivés","COMPLETION_CONFIG_MISSING_NAME":"Configuration des complétions : nom manquant","COMPLETION_CONFIG_MISSING_PROVIDER":"Configuration des complétions : fournisseur manquant","COMPLETION_CONFIG_MISSING_ENDPOINT":"Configuration des complétions : point de terminaison manquant","COMPLETION_CONFIG_MISSING_API_KEY":"Configuration des complétions : clé API manquante","COMPLETION_CONFIG_MISSING_MODEL":"Configuration des complétions : modèle manquant","COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED":"Configuration des complétions : au moins un type de complétions doit être spécifié","COMPLETION_CONFIG_INVALID_NAME":"Configuration des complétions: nom non valide","COMPLETION_CONFIG_INVALID_PURPOSE":"Configuration des complétions : type de complétions non valide","COMPLETION_CONFIG_INVALID_ENDPOINT":"Configuration des achèvements : point de terminaison non valide","COMPLETION_CONFIG_INCONSISTENT_ENDPOINT":"Configuration des complétions : point de terminaison incohérent","COMPLETION_CONFIG_INVALID_PROVIDER":"Configuration des complétions : fournisseur non valide","COMPLETION_CONFIG_NOT_FOUND":"Configuration des complétions : introuvable","COMPLETION_CONFIG_NOT_ACCESSIBLE":"Configuration des complétions : non accessible","COMPLETION_CONFIG_NAME_RESERVED":"Configuration des complétions : nom réservé","COMPLETION_CONFIG_NAME_ALREADY_EXISTS":"Configuration des complétions : le nom existe déjà","COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED":"Configuration des complétions : changement de visibilité non autorisé"}}');var pG;pG=JSON.parse('{"yes":"Ja","no":"NEIN","confirm":"Bestätigen","apply":"Anwenden","cancel":"Stornieren","show":"Zeigen","hide":"Verstecken","send":"Schicken","close":"Schließen","edit":"Bearbeiten","delete":"Löschen","loading":"Laden","expand":"Expandieren","collapse":"Zusammenbruch","fullscreenEnter":"Geben Sie den Vollbildmodus ein","fullscreenExit":"Beenden Sie den Vollbildmodus","center":"Center","bottom":"Unten","hidden":"Versteckt","day":"Tag","month":"Monat","year":"Jahr","createdAt":"Erstellungsdatum","selected":"Ausgewählt","page":"Seite","actions":"Aktionen","next":"Nächste","previous":"Vorherige","copy":"Kopie","copyRawCode":"Rohcode kopieren","copyToClipboard":"In die Zwischenablage kopieren","showOriginalText":"Original anzeigen","showTranslatedText":"Übersetzung anzeigen","exactPosition":"Genaue Position","uncertain":"Unsicher","question":"Frage","nothingFound":"Nichts gefunden","venue":"Veranstaltungsort","searchVenue":"Veranstaltungsort suchen...","memoriBlockedTitle":"Blockiert","memoriBlockedUntil":"Agent blockiert bis {{date}}","memoriBlockedAnon":"Momentan \\"{{name}}„Kann nicht antworten, komm hierher zurück {{date}}","memoriBlockedReasonExceedChats":"weil der monatliche Schwellenwert für erlaubte Chats überschritten wurde.","memoriBlockedGiverHelper":"Sie können es weiterhin als Administrator verwalten, andere Benutzer können jedoch nicht damit interagieren.","generatedByAI":"Von KI generierte Antworten können gelegentlich falsche Informationen generieren","whyThisAnswer":"Warum diese Antwort?","whyThisAnswerHelper":"Diese Antwort wurde automatisch von einer künstlichen Intelligenz auf Basis dieser verifizierten Inhalte generiert.","completionsEnabled":"Fortschrittliche KI kann mit automatisch generierten Antworten reagieren, die manchmal falsche Informationen enthalten können","completionProviderDown":"Dieser Zwilling ist mit einer generativen KI von integriert {{provider}}, aber es ist derzeit nicht verfügbar. ","completionProviderFallbackName":"ein externer Anbieter","completionProviderCheckStatusPage":"Überprüfen Sie die Statusseite","boardOfExperts":"Expertengremium","birthDate":"Geburtsdatum","birthDateHelper":"Wir fragen nur nach Ihrem Geburtsdatum, um Funktionen zu aktivieren oder zu deaktivieren, für die Altersbeschränkungen gelten","underage":"Das müssen Sie mindestens sein {{age}} Jahre alt, um sich anzumelden.","underageTwinSession":"Das müssen Sie mindestens sein {{age}} Jahre alt, um mit diesem Zwilling zu interagieren.","errorFetchingSession":"Fehler beim Laden der Sitzung","errorGettingReferralURL":"Fehler beim Laden des Referrals","errorReopeningSession":"Fehler beim erneuten Öffnen der Sitzung","ageVerification":"Altersüberprüfung","ageVerificationText":"Um mit diesem Zwilling interagieren zu können, müssen Sie mindestens sein {{minAge}} Jahre alt.","nsfw":"NSFW: Dieser Agent enthält Inhalte für Erwachsene","deepThought":"Tiefer Gedanke","deepThoughtHelper":"Deep Thought ist eine erweiterte Funktion der KI, die es Ihnen ermöglicht, Ihre Gespräche voll auszuschöpfen, indem Sie sie verfolgen. ","deepThoughtDisclaimerTitle":"Deep Thought aktiviert","deepThoughtDisclaimer":"Deep Thought ist eine erweiterte Funktion der KI, die es Ihnen ermöglicht, Ihre Gespräche voll auszuschöpfen, indem Sie sie verfolgen. ","deepThoughtPreDisclaimerUnlogged":"Melden Sie sich an, um Deep Thought zu aktivieren.","deepThoughtPreDisclaimerNotAllowed":"Deep Thought ist deaktiviert, da Sie der Nutzung nicht zugestimmt haben. Sie können dies jederzeit in Ihren Kontoeinstellungen ändern.","notEnoughCredits":"Der Autor dieses Zwillings verfügt nicht über genügend Credits, um Ihre Frage zu beantworten.","knownFacts":{"title":"Bekannte Fakten","description":"Einzelheiten zu den Informationen, die zwischen Ihnen und geteilt werden {{memoriName}}","type":"Typ","typeShortTerm":"Kurzfristig","typeLongTerm":"Langfristig","typeHelper":"Typen:\\n","text":"Text","deleteSuccess":"Bekannte Tatsache gelöscht","deleteConfirmTitle":"Bekannte Tatsache löschen","deleteConfirmMessage":"Sind Sie sicher, dass Sie diese bekannte Tatsache löschen möchten?","deleteSelectedConfirmTitle":"Ausgewählte bekannte Fakten löschen","deleteSelectedConfirmMessage":"Sind Sie sicher, dass Sie die ausgewählten bekannten Fakten löschen möchten?"},"auth":{"title":"Authentifizierung","useRecoveryTokens":"Verwenden Sie Wiederherstellungstoken","tokens":"Token","addToken":"Token hinzufügen","usePassword":"Passwort verwenden","atLeast":"Mindestens"},"widget":{"instruct":"Anweisen","test":"Prüfen","sound":"Klang","position":"Positionspräferenzen","settings":"Einstellungen","share":"Aktie","sendOnKeypress":"Drücken Sie zum Senden die Eingabetaste","sendOnClick":"Klicken Sie auf Senden","boardOfExperts":"Expertengremium","showExpertsInTheBoard":"Experten in diesem Forum anzeigen","expertsInTheBoard":"Experten in diesem Forum","goToIntegrationsToCustomizeAvatar":"Um den Avatar anzupassen, gehen Sie zu „Teilen“ und passen Sie die öffentliche Seite an"},"write_and_speak":{"micButtonPopover":"Klicken Sie auf die Schaltfläche, um zu sprechen","micButtonPopoverListening":"Klicken Sie auf die Schaltfläche, um das Sprechen zu stoppen","pageInstructExplanation":"Um mir neue Dinge beizubringen, klicken Sie auf die Schaltfläche „ANLEITEN“, um zu beginnen","pageTryMeExplanation":"Um mit mir zu sprechen, klicken Sie auf die Schaltfläche START, um zu beginnen","instructButton":"WEISE MICH AN","tryMeButton":"START","chatHistory":"Chatverlauf","exportChatHistory":"Chatverlauf exportieren","exportChatHistoryMessage":"Möchten Sie den Chatverlauf exportieren?","chatBotButtonText":"KLICKEN SIE HIER, UM CHATBOT ZU ÖFFNEN","conversationStartedLabel":"Das Gespräch begann am","settingsHeaderLabel":"Richten Sie hier ein, wenn Sie die Agent als Dauerrede einstellen möchten, und ändern Sie die Stillesekunden, wenn Sie sie anpassen möchten.","continuousSpeechLabel":"Kontinuierliche Rede","continuousSpeechDisabled":"Kontinuierliche Rede deaktiviert, da der Agent im Stummschaltmodus ist","holdToSpeak":"Halten Sie gedrückt, um zu sprechen","releaseToEndListening":"Lassen Sie los, um das Hören zu beenden","pressAndHoldToSpeak":"Zum Sprechen gedrückt halten","microphoneMode":"Mikrofonmodus","hideEmissionsLabel":"Vom Zwilling ausgegebenen Text ausblenden","secondsLabel":"Sekunden einstellen","controlsPosition":"Steuert die Position","tryMeHeaderLabel":"VERSUCHEN","unknownPosition":"Unbekannte Position","fieldPlace":"Geben Sie den Ort ein (z. B. „Mailand“)","showMapLinkFor":"Zeigen Sie die Position auf der Karte an","useMyPosition":"Nutzen Sie meine Position","myPosition":"Ihre Position","updatingPosition":"Position wird aktualisiert...","placeNotFound":"Ort nicht gefunden!","requirePosition":"Geben Sie vor dem Start Ihre Position ein","requirePositionHelp":"Zum Reden {{name}} Sie müssen entscheiden, ob Sie Ihre Position angeben oder nicht. ","dontWantToProvidePosition":"Ich möchte meine Position nicht bekannt geben","attachmentsLabel":"Bereichern Sie Ihre Botschaft","iWantToTalkToIn":"Ich möchte mit reden {{name}} In"},"media":{"title":"Titel","editAttributes":"Medienattribute bearbeiten","uploadMimeTypeNotAllowed":"Der Dateityp ist nicht zulässig","uploadSizeLimitMessage":"Die hochgeladene Größe ist zu groß (max {{size}}MB)","uploadWrongResolutionMessage":"Die Auflösung muss sein {{width}}X{{height}} Pixel","memoriNameAlreadyUsed":"Du hast bereits einen Zwilling mit diesem Namen","uploadHelperImages":"Laden Sie eine Datei mit der Erweiterung PNG, JPG, JPEG oder GIF hoch und darf maximal eine Größe von haben {{size}}MB","uploadHelper":"Laden Sie eine Datei mit einer maximalen Größe von hoch {{size}}MB","uploadError":"Der Upload ist fehlgeschlagen","square":"Quadrat","scaleRatio":"Maßstabsverhältnis","addMediaLabel":"Fügen Sie ein Medium hinzu","insertThisMediaMsg":"Legen Sie diese Medien ein","mediaUploadMessage":"Klicken Sie hier, um ein neues Medium zu laden","addLinkLabel":"Fügen Sie einen Link hinzu","linkKey":"URL","linkValue":"Linktitel","insertThisLink":"Fügen Sie einen Link ein {{url}} mit Titel {{title}}"},"gamification":{"level":"Ebene","points":"Punkte","memoriReachedLevel":"entwickelte sich weiter und erreichte ein höheres Niveau","levelGoToStatistics":"{{memori}} ist auf gleicher Höhe {{level}} mit {{points}} Punkte. ","congratulationsNewLevel":"Herzlichen Glückwunsch, Sie haben ein neues Level erreicht!","congratulationsNewLevelDescription":"Ihre Agent wurden mit weiterentwickelt {{points}} Punkte, schauen Sie sich die an","statistics":"Statistiken"},"login":{"login":"Login","logout":"Abmelden","user":"Benutzer","loggedDrawerTitle":"Hallo, {{name}}!","loginDrawerTitle":"Login","signupDrawerTitle":"Melden Sie sich an","newUserSignUp":"Neuer Benutzer?","signUp":"Melden Sie sich an!","alreadyHaveAnAccount":"Sie haben bereits ein Konto?","backToLogin":"Zurück zum Login","registrationDisabled":"Die Registrierung ist deaktiviert","contactAdmin":"Wenden Sie sich an den Administrator, um Zugriff anzufordern","userNameOrEmail":"Benutzername oder E-Mail","email":"E-Mail","emailFormatError":"Bitte geben Sie eine gültige E-Mail-Adresse ein","username":"Benutzername","usernameContainsReservedWord":"Der Benutzername enthält ein reserviertes Wort. Bitte wählen Sie ein anderes","usernameFormatError":"Der Benutzername muss mindestens 3 Zeichen lang sein und darf nur Buchstaben, Zahlen und _ enthalten.","otpCode":"Bestätigungscode","resendVerificationCode":"Code erneut senden","resentVerificationCode":"Bestätigungscode gesendet! ","password":"Passwort","newPassword":"Neues Passwort","confirmPassword":"Passwort bestätigen","currentPassword":"Aktuelles Passwort","passwordMatchingError":"Passwörter stimmen nicht überein.","passwordFormatError":"Das Passwort muss mindestens 8 Zeichen lang sein und mindestens eine Zahl, einen Großbuchstaben, einen Kleinbuchstaben und ein Symbol enthalten","pwdWeak":"Schwach","pwdAcceptable":"Akzeptabel","pwdStrong":"Stark","mustChangePassword":"Sie müssen Ihr Passwort ändern","passwordChange":"Kennwort ändern","emailChange":"E-Mail ändern","avatarChange":"Avatar ändern","underage":"Das müssen Sie mindestens sein {{age}} Jahre alt, um sich anzumelden.","optional":"Optional","birthDate":"Geburtsdatum","birthDateHelper":"Wir fragen nur nach Ihrem Geburtsdatum, um Funktionen zu aktivieren oder zu deaktivieren, für die Altersbeschränkungen gelten","missingData":"Fehlende Informationen","missingDataHelper":"Wir wissen, dass dies etwas nervig ist, benötigen jedoch noch einige weitere Informationen, um Ihre Registrierung abzuschließen.","goToAccountToChangeYourPreferences":"Sie können Ihre Auswahl jederzeit auf Ihrer Kontoseite ändern.","deepThoughtExplaination":"Deep Thought ist eine erweiterte Funktion der KI, die es Ihnen ermöglicht, Ihre Gespräche voll auszuschöpfen, indem Sie sie verfolgen. ","tnCAndPPAcceptedHelper":"Seit Ihrer letzten Anmeldung haben sich die AGB und Datenschutzbestimmungen geändert. ","privacyLabel":"Ich habe die gelesen und akzeptiert","privacyAndCookiePolicy":"Datenschutz und Cookie-Richtlinie","and":"Und","termsOfService":"Nutzungsbedingungen","pAndCUAccepted":"Ich akzeptiere die Nutzungsbedingungen von Deep Thought","editAccount":"Konto bearbeiten","save":"Speichern"},"success":"Erfolg","Error":"Fehler","internal server error":"Oupsie, tut mir leid... Auf dem Server ist ein Fehler aufgetreten","error":"Fehler","error.loading":"Fehler beim Laden des Inhalts.","error.generic":"Oupsie, tut mir leid ... etwas ist schief gelaufen.","error.serverNotResponding":"Wir führen Wartungsarbeiten durch oder veröffentlichen Updates. ","error.notFound":"Oupsie, wir haben die von Ihnen gesuchte Seite nicht gefunden.","error.goBackTo":"Sie können versuchen, dorthin zurückzukehren","error.reloadPage":"Laden Sie die Seite neu","error.tryAgain":"Versuchen Sie es erneut","error.unauthorized":"Es ist Ihnen nicht gestattet, diesen Inhalt anzuzeigen.","error.unprocessableEntity":"Fehler beim Verarbeiten der Anfrage. ","errors":{"TENANT_NOT_FOUND":"Mieter nicht gefunden","TENANT_REGISTRATION_DISABLED":"Die Registrierung auf dieser Plattform ist deaktiviert","TENANT_MISSING_NAME":"Mieter: Name fehlt","TENANT_MAX_USERS_REACHED":"Maximale Anzahl Benutzer erreicht","TENANT_MAX_ADMINS_REACHED":"Maximale Anzahl an Admin-Benutzern erreicht","TENANT_ALREADY_EXISTS":"Mieter existiert bereits","TENANT_MISSING_DESCRIPTION":"Mieter: Beschreibung fehlt","TENANT_CANT_SET_COMPLETION_PROVIDER":"Mandant: Abschlussanbieter kann nicht festgelegt werden","USER_NOT_CONFIRMED":"Benutzer noch nicht bestätigt","USER_NOT_FOUND":"Benutzer nicht gefunden","USER_OR_PASSWORD_INVALID":"Ungültiger Benutzer oder Passwort","USER_MUST_CHANGE_PASSWORD":"Sie müssen Ihr Passwort ändern","USER_MUST_ENTER_VERIFICATION_CODE":"Sie müssen den Bestätigungscode eingeben","USER_MISSING_TENANT":"Benutzer: Mieter fehlt","USER_MISSING_NAME":"Benutzer: Name fehlt","USER_MISSING_PASSWORD":"Benutzer: Passwort fehlt","USER_MISSING_EMAIL":"Benutzer: Fehlende E-Mail","USER_MISSING_VERIFICATION_CODE":"Benutzer: Fehlender Bestätigungscode","USER_NAME_ALREADY_USED":"Benutzername wird bereits verwendet","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"Das Passwort entspricht nicht den Sicherheitsregeln","USER_EMAIL_ALREADY_USED":"E-Mail wird bereits verwendet","USER_EMAIL_INVALID":"Ungültige E-Mail","USER_VERIFICATION_CODE_INVALID":"Ungültiger Bestätigungscode","USER_MISSING_NAME_OR_EMAIL":"Benutzername oder E-Mail fehlen","USER_NAME_INVALID":"Ungültiger Benutzername","USER_HAS_ONE_OR_MORE_MEMORI":"Der Benutzer verfügt über eine oder mehrere Erinnerungen","USER_MISSING_NEW_PASSWORD":"Benutzer: Neues Passwort fehlt","USER_NOTHING_TO_DO":"Nichts zu tun","USER_CANT_CREATE_MEMORI":"Benutzer darf Agent nicht erstellen","USER_MAX_MEMORI_REACHED":"Maximale Anzahl an Agent erreicht","USER_TOO_MANY_ATTEMPTS":"Zu viele Versuche","USER_MUST_ACCEPT_TNC_AND_PP":"Sie müssen die Allgemeinen Geschäftsbedingungen akzeptieren","USER_BIRTH_DATE_CANT_BE_CHANGED":"Das Geburtsdatum kann nicht geändert werden","USER_CANT_SET_COMPLETION_PROVIDER":"Benutzer: darf den Vervollständigungsanbieter nicht verwalten","USER_CANT_ENABLE_DEEP_THOUGHT":"Benutzer: nicht für die Verwaltung von Deep Thought aktiviert","USER_CANT_ENABLE_DCM_INTEGRATION":"Benutzer: nicht für die Verwaltung der DCM-Integration aktiviert","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"Benutzer: darf die Verkettung oder Expertengruppe nicht verwalten","USER_CREATION_BILLING_DENIED_PERMISSION":"Sie haben nicht genügend Credits, um einen Zwilling zu erstellen","USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS":"Der Benutzer verfügt über eine oder mehrere Abschlusskonfigurationen","USER_CANT_BE_DELETED":"Benutzer kann nicht gelöscht werden","MEMORI_NOT_FOUND":"Erinnerungen nicht gefunden","MEMORI_NOT_ACCESSIBLE":"Agent nicht zugänglich","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Nur der Eigentümer kann das Tag oder die PIN ändern","SESSION_NOT_FOUND":"Sitzung nicht gefunden","SESSION_IS_NOT_ADMINISTRATIVE":"Nicht-administrative Sitzung","SESSION_EXPIRED":"Sitzung abgelaufen","MEMORI_MISSING_CONFIGURATION":"Zwilling: fehlende Konfiguration","MEMORI_CONFIGURATION_NOT_FOUND":"Zwilling: Konfiguration nicht gefunden","MEMORI_INVALID_PRIVACY_TYPE":"Agent: ungültiger Datenschutztyp","MEMORI_MISSING_PASSWORD":"Zwilling: Passwort fehlt","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Agent: Gesamtzahl ungültiger Wiederherstellungstokens","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Agent: Mindestanzahl ungültiger Wiederherstellungstokens","MEMORI_INVALID_VOICE_TYPE":"Zwilling: ungültiger Stimmtyp","MEMORI_MISSING_NAME":"Zwilling: fehlender Name","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Zwilling: Fehlendes Passwort oder Wiederherstellungstoken","MEMORI_INVALID_ID":"Zwilling: ungültige ID","MEMORI_NAME_ALREADY_USED":"Zwillingsname wird bereits verwendet","MEMORI_INVALID_PIN":"Zwilling: Ungültige PIN","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Zwilling: TAG- und PIN-Änderung erfordern separate Vorgänge","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Zwilling: Im öffentlichen Zustand ist kein Passwort erforderlich","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Für „Deep Thought“ müssen Vervollständigungen aktiviert sein","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"Für die Expertengruppe müssen Vervollständigungen aktiviert sein","MEMORI_INVALID_COMPLETION_CONFIG":"Zwilling: Ungültige Abschlusskonfiguration","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Übertragung: Zielbenutzer fehlt","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Übertragung: Ungültige Zielbenutzer-ID","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Übertragung: Ungültige Zielbenutzerdaten","MEMORI_TRANSFER_NOTHING_TO_DO":"Transfer: nichts zu tun","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Speicher: Konfiguration kann nicht geändert werden","MEMORI_MISSING_NEW_PASSWORD":"Erinnerungen: Neues Passwort fehlt","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"Für die Funktion ist ein Abonnement erforderlich","INTEGRATION_NOT_FOUND":"Integration nicht gefunden","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Ungültiges Datum aus Format","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Ungültiges Datum zum Formatieren","INTEGRATION_INVALID_TYPE":"Ungültiger Integrationstyp","INTEGRATION_ALREADY_EXISTS":"Die Integration ist bereits vorhanden","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Nicht-öffentliche Erinnerungen können nicht integriert werden","INTEGRATION_MISSING_INVOCATION_TEXT":"Integration: fehlender Aufruftext","INTEGRATION_MISSING_DEVICE_EMAILS":"Integration: Fehlende Geräte-E-Mail","INTEGRATION_MEMORI_IS_EMPTY":"Leere Erinnerungen können nicht integriert werden","INTEGRATION_MISSING_PRIVACY_POLICY":"Integration: Datenschutzrichtlinie fehlt","INTEGRATION_MISSING_CATEGORY":"Integrationskategorie fehlt","INTEGRATION_MISSING_DESCRIPTION":"Fehlende Integrationsbeschreibung","INTEGRATION_INVALID_INVOCATION_TEXT":"Ungültiger Aufruftext","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home nicht mehr verfügbar","UPLOAD_REQUIRES_MULTIPART_ENCODING":"Für den Upload ist eine mehrteilige Kodierung erforderlich","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Hochladen: Inhaltstypgrenze fehlt","UPLOAD_MAX_LENGTH_EXCEEDED":"Upload: Maximale Größe überschritten","UPLOAD_FILE_IS_EMPTY":"Hochladen: leere Datei","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Hochladen: Ungültiger Dateityp oder ungültige Signatur","UPLOAD_MISSING_FILE_NAME":"Hochladen: Dateiname fehlt","UPLOAD_INVALID_MEMORY_ID":"Hochladen: Ungültige Inhalts-ID","UPLOAD_MISSING_FILE_CONTENT":"Hochladen: Dateiinhalt fehlt","ASSET_NOT_FOUND":"Asset nicht gefunden","ASSET_NOT_ACCESSIBLE":"Asset nicht zugänglich","ASSET_MISSING_SESSION_ID":"Asset: Sitzungs-ID fehlt","ASSET_INVALID_FILE_NAME":"Asset: ungültiger Dateiname","INVITATION_NOT_FOUND":"Einladung nicht gefunden","INVITATION_NOT_ACCESSIBLE":"Einladung nicht zugänglich","INVITATION_ALREADY_ACCEPTED":"Einladung bereits angenommen","INVITATION_ALREADY_REJECTED":"Einladung bereits abgelehnt","INVITATION_MISSING_DESTINATION_EMAIL":"Einladung: Ziel-E-Mail fehlt","INVITATION_DESTINATION_EMAIL_INVALID":"Einladung: Ziel-E-Mail-Adresse ungültig","INVITATION_MISSING_TAG":"Einladung: Tag fehlt","INVITATION_MISSING_PIN":"Einladung: PIN fehlt","INVITATION_INVALID_PIN":"Einladung: ungültige PIN","INVITATION_INVALID_TYPE":"Einladung: ungültiger Typ","INVITATION_MISSING_DESTINATION_NAME":"Einladung: Zielname fehlt","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Einladung: Tag und Pin können nicht geändert werden","INVITATION_CANT_BE_CHANGED":"Absicht: kann nicht geändert werden","ACTIONLOG_INVALID_USER_ID":"Ungültige Benutzer-ID","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Datum von: ungültiges Format","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Datum bis: ungültiges Format","ACTIONLOG_INVALID_MEMORI_ID":"Ungültige Memori-ID","CONSUMPTIONLOG_INVALID_TYPE":"Ungültiger Protokolltyp","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Datum von: ungültiges Format","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Datum bis: ungültiges Format","CONSUMPTIONLOG_INVALID_USER_ID":"Ungültige Benutzer-ID","CONSUMPTIONLOG_INVALID_MEMORI_ID":"Ungültige Memori-ID","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Benachrichtigungen: Ungültiger Chat-Protokoll-Extraktionszeitraum","PROCESS_INVALID_TYPE":"Ungültiger Prozesstyp","PROCESS_ALREADY_RUNNING":"Prozess läuft bereits","PROCESS_NOT_FOUND":"Prozess nicht gefunden","IMPORTCSV_MISSING_ROWS":"CSV-Import: fehlende Zeilen","IMPORTCSV_MISSING_CSV":"CSV-Import: CSV fehlt","IMPORTCSV_MISSING_SEPARATOR":"CSV-Import: fehlendes Trennzeichen","IMPORTCSV_INVALID_SEPARATOR":"CSV-Import: Ungültiges Trennzeichen","IMPORTCSV_MISSING_HEADERS":"CSV-Import: fehlende Header","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV-Import: Titelvariantentrennzeichen fehlt","IMPORTCSV_INVALID_RECEIVER_ID":"CSV-Import: ungültige Empfänger-ID","IMPORTCSV_INVALID_MEDIA_LINK":"CSV-Import: Ungültiger Medienlink","IMPORTCSV_INVALID_LINK_TITLE_HANDLING":"CSV-Import: Ungültiger Linktitel","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"CSV-Import: Nicht erkennbare Zeichenkodierung","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"CSV-Import: Der Import in Secret Memories ist nicht möglich","IMPORTTXT_MISSING_ROWS":"TXT wird importiert: Zeilen fehlen","IMPORTTXT_INVALID_GRANULARITY":"TXT importieren: ungültige Granularität","IMPORTTXT_INVALID_RECEIVER_ID":"TXT importieren: ungültige Empfänger-ID","IMPORTTXT_INVALID_MEDIA_LINK":"TXT importieren: Ungültiger Medienlink","IMPORTTXT_INVALID_LINK_TITLE_HANDLING":"TXT importieren: ungültiger Linktitel","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"TXT-Import: Nicht erkennbare Zeichenkodierung","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"TXT-Import: Der Import in Secret Memories ist nicht möglich","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"TXT importieren: Importlimit überschritten","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"TXT importieren: Für den Import auf GPT-4 ist ein API-Schlüssel erforderlich","IMPORTTXT_IMPORT_REQUIRES_PAYING":"TXT importieren: Für den Import ist ein kostenpflichtiger Plan erforderlich","IMPORTTXT_BILLING_DENIED_PERMISSION":"TXT importieren: Sie haben nicht genügend Credits für den Vorgang","EXPORTCSV_MISSING_CSV_SPECS":"CSV-Export: CSV-Spezifikationen fehlen","EXPORTCSV_MISSING_SEPARATOR":"CSV-Export: fehlendes Trennzeichen","EXPORTCSV_INVALID_SEPARATOR":"CSV-Export: Ungültiges Trennzeichen","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"CSV-Export: fehlendes Titelvarianten-Trennzeichen","EXPORTCSV_MISSING_NEW_LINE_CHAR":"CSV-Export: Fehlendes Zeilenumbruchzeichen","EXPORTCSV_INVALID_NEW_LINE_CHAR":"CSV-Export: Ungültiges Zeilenumbruchzeichen","EXPORTCSV_MISSING_PASSWORD":"CSV-Export: Passwort fehlt","EXPORTJSONL_MISSING_JSONL_SPECS":"JSONL-Export: JSONL-Spezifikationen fehlen","EXPORTJSONL_MISSING_PLATFORM":"JSONL-Export: fehlende Plattform","EXPORTJSONL_INVALID_PLATFORM":"JSONL-Export: ungültige Plattform","EXPORTJSONL_MISSING_PASSWORD":"JSONL-Export: Passwort fehlt","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"JSONL-Export: Für den Export ist ein kostenpflichtiger Plan erforderlich","ANALYSIS_MISSING_QUERY":"Analyse: fehlende Abfrage","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Analyse: Geheime Erinnerungen können nicht analysiert werden","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Analyse: Passende Benutzeranfragen erfordern tiefes Denken","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Ausweiszuweisung: falsche oder fehlende Zugangsdaten","BADGE_ASSIGNMENT_MISSING_REF_ID":"Badge-Zuordnung: Referenz-ID fehlt","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Badge-Zuweisung: Ergebnis nicht gefunden","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Badge-Zuweisung: Fehlende Behauptungs-URL","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Badge-Zuweisung: Badge-URL fehlt","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Badge-Zuweisung: Aussteller-URL fehlt","BADGE_ASSIGNMENT_INVALID_URL":"Badge-Zuweisung: Ungültige URL","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Ausweiszuordnung: fehlender Empfänger","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Badge-Zuordnung: unbekannter Empfängertyp","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Ausweiszuordnung: Empfängeridentität fehlt","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Badge-Zuweisung: Empfänger-Hash-Typ fehlt","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Badge-Zuweisung: Empfänger-Hash-Typ unbekannt","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Badge-Zuordnung: Falsche Empfängeridentität","BADGE_NOT_FOUND":"Abzeichen nicht gefunden","OUTCOME_NO_DCM_CONFIGURED":"Ergebnis: kein DCM konfiguriert","OUTCOME_USER_BADGES_DISABLED":"Ergebnis: Benutzerausweise deaktiviert","COMPLETION_CONFIG_MISSING_NAME":"Vervollständigungskonfiguration: Name fehlt","COMPLETION_CONFIG_MISSING_PROVIDER":"Vervollständigungskonfiguration: fehlender Anbieter","COMPLETION_CONFIG_MISSING_ENDPOINT":"Abschlusskonfiguration: fehlender Endpunkt","COMPLETION_CONFIG_MISSING_API_KEY":"Vervollständigungskonfiguration: fehlender API-Schlüssel","COMPLETION_CONFIG_MISSING_MODEL":"Vervollständigungskonfiguration: fehlendes Modell","COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED":"Vervollständigungskonfiguration: Es muss mindestens ein Vervollständigungstyp angegeben werden","COMPLETION_CONFIG_INVALID_NAME":"Vervollständigungskonfiguration: ungültiger Name","COMPLETION_CONFIG_INVALID_PURPOSE":"Vervollständigungskonfiguration: Ungültiger Vervollständigungstyp","COMPLETION_CONFIG_INVALID_ENDPOINT":"Abschlusskonfiguration: Ungültiger Endpunkt","COMPLETION_CONFIG_INCONSISTENT_ENDPOINT":"Abschlusskonfiguration: inkonsistenter Endpunkt","COMPLETION_CONFIG_INVALID_PROVIDER":"Vervollständigungskonfiguration: ungültiger Anbieter","COMPLETION_CONFIG_NOT_FOUND":"Vervollständigungskonfiguration: nicht gefunden","COMPLETION_CONFIG_NOT_ACCESSIBLE":"Vervollständigungskonfiguration: nicht zugänglich","COMPLETION_CONFIG_NAME_RESERVED":"Vervollständigungskonfiguration: Name reserviert","COMPLETION_CONFIG_NAME_ALREADY_EXISTS":"Vervollständigungskonfiguration: Name existiert bereits","COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED":"Vervollständigungskonfiguration: Änderung der Sichtbarkeit nicht zulässig"}}');var mG;mG=JSON.parse('{"yes":"Sí","no":"No","confirm":"Confirmar","apply":"Aplicar","cancel":"Cancelar","show":"Espectáculo","hide":"Esconder","send":"Enviar","close":"Cerca","edit":"Editar","delete":"Borrar","loading":"Cargando","expand":"Expandir","collapse":"Colapsar","fullscreenEnter":"Entrar en pantalla completa","fullscreenExit":"Salir de pantalla completa","center":"Centro","bottom":"Abajo","hidden":"Oculto","day":"Día","month":"Mes","year":"Año","createdAt":"Fecha de creación","selected":"Seleccionado","page":"página","actions":"Comportamiento","next":"Próximo","previous":"Anterior","copy":"Copiar","copyRawCode":"Copiar código sin formato","copyToClipboard":"Copiar al portapapeles","showOriginalText":"Mostrar original","showTranslatedText":"Mostrar traducción","exactPosition":"Posición exacta","uncertain":"Incierto","question":"Pregunta","nothingFound":"No se encontró nada","venue":"Evento","searchVenue":"Buscar lugar...","memoriBlockedTitle":"Obstruido","memoriBlockedUntil":"Agent bloqueado hasta {{date}}","memoriBlockedAnon":"Actualmente \\"{{name}}\\"No puedo responder, vuelve aquí. {{date}}","memoriBlockedReasonExceedChats":"porque ha superado el umbral mensual de chats permitidos.","memoriBlockedGiverHelper":"Aún podrás administrarlo como administrador, pero otros usuarios no podrán interactuar con él.","generatedByAI":"La respuesta generada por IA, ocasionalmente puede generar información incorrecta","whyThisAnswer":"¿Por qué esta respuesta?","whyThisAnswerHelper":"Esta respuesta fue generada automáticamente por una inteligencia artificial basada en estos contenidos verificados.","completionsEnabled":"La IA avanzada puede responder con respuestas generadas automáticamente que a veces pueden contener información incorrecta.","completionProviderDown":"Este Agent está integrado con una IA generativa de {{provider}}, pero actualmente no está disponible. ","completionProviderFallbackName":"un proveedor externo","completionProviderCheckStatusPage":"Comprobar página de estado","boardOfExperts":"junta de expertos","birthDate":"Fecha de nacimiento","birthDateHelper":"Solicitamos tu fecha de nacimiento únicamente para habilitar o deshabilitar funcionalidades que tienen restricciones de edad.","underage":"Debes ser al menos {{age}} años para inscribirse.","underageTwinSession":"Debes ser al menos {{age}} años para interactuar con este gemelo.","errorFetchingSession":"Error durante el cargamento de la sesión","errorGettingReferralURL":"Error durante el cargamento del référent","errorReopeningSession":"Error durante el re-abrir la sesión","ageVerification":"Verificación de edad","ageVerificationText":"Para interactuar con este Gemelo, debes tener al menos {{minAge}} años.","nsfw":"NSFW: Este gemelo contiene contenido para adultos","deepThought":"pensamiento profundo","deepThoughtHelper":"Deep Thought es una característica avanzada de la IA que te permitirá explotar al máximo tus conversaciones al realizar un seguimiento de ellas. ","deepThoughtDisclaimerTitle":"Pensamiento profundo habilitado","deepThoughtDisclaimer":"Deep Thought es una característica avanzada de la IA que te permitirá explotar al máximo tus conversaciones al realizar un seguimiento de ellas. ","deepThoughtPreDisclaimerUnlogged":"Inicie sesión para habilitar Pensamiento profundo.","deepThoughtPreDisclaimerNotAllowed":"Deep Thought está deshabilitado porque usted no dio su consentimiento para su uso; puede cambiar esto en cualquier momento en la configuración de su cuenta.","notEnoughCredits":"El autor de este Gemelo no tiene suficientes créditos para responder a tu pregunta.","knownFacts":{"title":"hechos conocidos","description":"Detalles de la información compartida entre usted y {{memoriName}}","type":"Tipo","typeShortTerm":"Corto plazo","typeLongTerm":"Largo plazo","typeHelper":"Tipos:\\n","text":"Texto","deleteSuccess":"Hecho conocido eliminado","deleteConfirmTitle":"Eliminar hecho conocido","deleteConfirmMessage":"¿Está seguro de que desea eliminar este hecho conocido?","deleteSelectedConfirmTitle":"Eliminar hechos conocidos seleccionados","deleteSelectedConfirmMessage":"¿Está seguro de que desea eliminar los hechos conocidos seleccionados?"},"auth":{"title":"Autenticación","useRecoveryTokens":"Utilice tokens de recuperación","tokens":"Fichas","addToken":"Agregar token","usePassword":"Usar contraseña","atLeast":"Al menos"},"widget":{"instruct":"Instruir","test":"Prueba","sound":"Sonido","position":"Preferencias de posición","settings":"Ajustes","share":"Compartir","sendOnKeypress":"Presiona Enter para enviar","sendOnClick":"Haga clic en Enviar","boardOfExperts":"junta de expertos","showExpertsInTheBoard":"Mostrar expertos en este foro","expertsInTheBoard":"Expertos en este foro","goToIntegrationsToCustomizeAvatar":"Para personalizar el avatar, vaya a Compartir y personalice la página pública."},"write_and_speak":{"micButtonPopover":"Haga clic en el botón para hablar","micButtonPopoverListening":"Haga clic en el botón para dejar de hablar.","pageInstructExplanation":"Para enseñarme cosas nuevas, haga clic en el botón INSTRUIRME para comenzar.","pageTryMeExplanation":"Para hablar conmigo haga clic en el botón INICIO para comenzar","instructButton":"INSTRUÍME","tryMeButton":"COMENZAR","chatHistory":"Historial de chat","exportChatHistory":"Exportar historial de chat","exportChatHistoryMessage":"¿Quieres exportar el historial de chat?","chatBotButtonText":"HAGA CLIC AQUÍ PARA ABRIR EL CHATBOT","conversationStartedLabel":"La conversación comenzó el","settingsHeaderLabel":"Configure aquí si desea configurar la memoria como voz continua y cambie los segundos de silencio si desea personalizarlos.","continuousSpeechLabel":"discurso continuo","continuousSpeechDisabled":"Discurso continuo deshabilitado porque el agente está en modo silencioso","holdToSpeak":"Mantenga para hablar","releaseToEndListening":"Suelte para finalizar la escucha","pressAndHoldToSpeak":"Mantenga presionado para hablar","microphoneMode":"Modo micrófono","hideEmissionsLabel":"Ocultar texto emitido por el Agent","secondsLabel":"Establecer segundos","controlsPosition":"Posición de los controles","tryMeHeaderLabel":"INTENTAR","unknownPosition":"Posición desconocida","fieldPlace":"Escribe el lugar (por ejemplo, \'Milano\')","showMapLinkFor":"Mostrar la posición en el mapa.","useMyPosition":"Usa mi posición","myPosition":"Tu posición","updatingPosition":"Actualizando posición...","placeNotFound":"¡Lugar no encontrado!","requirePosition":"Inserte su posición antes de comenzar","requirePositionHelp":"para hablar con {{name}} usted tiene que decidir si proporciona su puesto o no. ","dontWantToProvidePosition":"No quiero proporcionar mi puesto.","attachmentsLabel":"Enriquece tu mensaje","iWantToTalkToIn":"quiero hablar con {{name}} en"},"media":{"title":"Título","editAttributes":"Editar atributos de medios","uploadMimeTypeNotAllowed":"El tipo de archivo no está permitido.","uploadSizeLimitMessage":"El tamaño subido es demasiado grande (máx. {{size}}MEGABYTE)","uploadWrongResolutionMessage":"La resolución debe ser {{width}}incógnita{{height}} píxel","memoriNameAlreadyUsed":"Ya tienes un gemelo con este nombre.","uploadHelperImages":"Sube un archivo con extensión png, jpg, jpeg o gif, y que tenga como máximo un tamaño de {{size}}MEGABYTE","uploadHelper":"Cargue un archivo que tenga como máximo un tamaño de {{size}}MEGABYTE","uploadError":"Error al subir","square":"cuadrado","scaleRatio":"Relación de escala","addMediaLabel":"Agregar un medio","insertThisMediaMsg":"Inserte estos medios","mediaUploadMessage":"Haga clic para cargar un nuevo medio","addLinkLabel":"Agregar un enlace","linkKey":"URL","linkValue":"Título del enlace","insertThisLink":"Insertar un enlace a {{url}} con titulo {{title}}"},"gamification":{"level":"Nivel","points":"agujas","memoriReachedLevel":"se volvió más evolucionado y alcanzó el nivel","levelGoToStatistics":"{{Agent}} esta al nivel {{level}} con {{points}} agujas. ","congratulationsNewLevel":"¡Felicitaciones, has alcanzado un nuevo nivel!","congratulationsNewLevelDescription":"Tu Agent se volvió más evolucionado con {{points}} puntos, mira el","statistics":"estadística"},"login":{"login":"Acceso","logout":"Cerrar sesión","user":"Usuario","loggedDrawerTitle":"Hola, {{name}}!","loginDrawerTitle":"Acceso","signupDrawerTitle":"Inscribirse","newUserSignUp":"¿Nuevo usuario?","signUp":"¡Inscribirse!","alreadyHaveAnAccount":"¿Ya tienes una cuenta?","backToLogin":"Volver a iniciar sesión","registrationDisabled":"El registro está deshabilitado","contactAdmin":"Póngase en contacto con el administrador para solicitar acceso","userNameOrEmail":"Nombre de usuario o correo electrónico","email":"Correo electrónico","emailFormatError":"Por favor, inserte un correo electrónico válido","username":"Nombre de usuario","usernameContainsReservedWord":"El nombre de usuario contiene una palabra reservada, elija otra","usernameFormatError":"El nombre de usuario debe tener al menos 3 caracteres y contener solo letras, números y _","otpCode":"Código de verificación","resendVerificationCode":"Reenviar código","resentVerificationCode":"¡Código de confirmación enviado! ","password":"Contraseña","newPassword":"Nueva contraseña","confirmPassword":"confirmar Contraseña","currentPassword":"Contraseña actual","passwordMatchingError":"Las contraseñas no coinciden.","passwordFormatError":"La contraseña debe tener al menos 8 caracteres y contener al menos un número, una letra mayúscula, una letra minúscula y un símbolo.","pwdWeak":"Débil","pwdAcceptable":"Aceptable","pwdStrong":"Fuerte","mustChangePassword":"Debes cambiar tu contraseña","passwordChange":"Cambiar la contraseña","emailChange":"Cambiar correo electrónico","avatarChange":"Cambiar avatar","underage":"Debes ser al menos {{age}} años para inscribirse.","optional":"Opcional","birthDate":"Fecha de nacimiento","birthDateHelper":"Solicitamos tu fecha de nacimiento únicamente para habilitar o deshabilitar funcionalidades que tienen restricciones de edad.","missingData":"Información faltante","missingDataHelper":"Sabemos que esto es un poco molesto, pero necesitamos más información para completar tu registro.","goToAccountToChangeYourPreferences":"Puede cambiar su elección en cualquier momento desde la página de su Cuenta.","deepThoughtExplaination":"Deep Thought es una característica avanzada de la IA que te permitirá explotar al máximo tus conversaciones al realizar un seguimiento de ellas. ","tnCAndPPAcceptedHelper":"Desde su último inicio de sesión, los Términos y condiciones y la Política de privacidad han cambiado. ","privacyLabel":"He leído y acepto el","privacyAndCookiePolicy":"Política de privacidad y cookies","and":"y","termsOfService":"Términos de servicio","pAndCUAccepted":"Acepto los términos de servicio sobre Deep Thought","editAccount":"Editar cuenta","save":"Ahorrar"},"success":"Éxito","Error":"Error","internal server error":"Oupsie, lo siento... Algo salió mal en el servidor.","error":"Error","error.loading":"Error al cargar contenido.","error.generic":"Oupsie, lo siento... algo salió mal.","error.serverNotResponding":"Estamos realizando mantenimiento o lanzando actualizaciones. ","error.notFound":"Oupsie, no encontramos la página que buscabas.","error.goBackTo":"Puedes intentar volver al","error.reloadPage":"recargar la pagina","error.tryAgain":"Intentar otra vez","error.unauthorized":"No estás autorizado a ver este contenido.","error.unprocessableEntity":"Error al procesar la solicitud. ","errors":{"TENANT_NOT_FOUND":"Inquilino no encontrado","TENANT_REGISTRATION_DISABLED":"El registro en esta plataforma está deshabilitado","TENANT_MISSING_NAME":"Inquilino: falta el nombre","TENANT_MAX_USERS_REACHED":"Número máximo de usuarios alcanzado","TENANT_MAX_ADMINS_REACHED":"Número máximo de usuarios administradores alcanzado","TENANT_ALREADY_EXISTS":"El inquilino ya existe","TENANT_MISSING_DESCRIPTION":"Inquilino: falta descripción","TENANT_CANT_SET_COMPLETION_PROVIDER":"Inquilino: no se puede configurar el proveedor de finalización","USER_NOT_CONFIRMED":"Usuario aún no confirmado","USER_NOT_FOUND":"Usuario no encontrado","USER_OR_PASSWORD_INVALID":"Usuario o contraseña no válidos","USER_MUST_CHANGE_PASSWORD":"Debes cambiar tu contraseña","USER_MUST_ENTER_VERIFICATION_CODE":"Debes ingresar el código de verificación","USER_MISSING_TENANT":"Usuario: inquilino desaparecido","USER_MISSING_NAME":"Usuario: falta el nombre","USER_MISSING_PASSWORD":"Usuario: falta contraseña","USER_MISSING_EMAIL":"Usuario: Falta correo electrónico","USER_MISSING_VERIFICATION_CODE":"Usuario: Falta el código de verificación","USER_NAME_ALREADY_USED":"Nombre de usuario ya en uso","USER_PASSWORD_NOT_CONFORMING_TO_POLICY":"La contraseña no cumple con las reglas de seguridad.","USER_EMAIL_ALREADY_USED":"Correo electrónico ya en uso","USER_EMAIL_INVALID":"Correo electrónico no válido","USER_VERIFICATION_CODE_INVALID":"Código de verificación no válido","USER_MISSING_NAME_OR_EMAIL":"Falta nombre de usuario o correo electrónico","USER_NAME_INVALID":"Nombre de usuario no válido","USER_HAS_ONE_OR_MORE_MEMORI":"El usuario tiene uno o más recuerdos.","USER_MISSING_NEW_PASSWORD":"Usuario: falta nueva contraseña","USER_NOTHING_TO_DO":"Nada que hacer","USER_CANT_CREATE_MEMORI":"Usuario no autorizado a crear Agent","USER_MAX_MEMORI_REACHED":"Número máximo de Agent alcanzado","USER_TOO_MANY_ATTEMPTS":"demasiados intentos","USER_MUST_ACCEPT_TNC_AND_PP":"Debes aceptar los términos y condiciones.","USER_BIRTH_DATE_CANT_BE_CHANGED":"La fecha de nacimiento no se puede cambiar.","USER_CANT_SET_COMPLETION_PROVIDER":"Usuario: no tiene permiso para gestionar el proveedor de finalización","USER_CANT_ENABLE_DEEP_THOUGHT":"Usuario: no habilitado para gestionar Deep Thought","USER_CANT_ENABLE_DCM_INTEGRATION":"Usuario: no habilitado para gestionar la integración de DCM","USER_CANT_ENABLE_CHAINING_OR_BOARD_OF_EXPERTS":"Usuario: no se le permite gestionar encadenamiento o grupo de expertos","USER_CREATION_BILLING_DENIED_PERMISSION":"No tienes suficientes créditos para crear un gemelo","USER_HAS_ONE_OR_MORE_COMPLETION_CONFIGS":"El usuario tiene una o más configuraciones de finalización.","USER_CANT_BE_DELETED":"Usuario: no se puede eliminar","MEMORI_NOT_FOUND":"Memoria no encontrada","MEMORI_NOT_ACCESSIBLE":"Memorias no accesibles","MEMORI_ONLY_OWNER_CAN_CHANGE_GIVER_TAG_AND_PIN":"Sólo el propietario puede cambiar la etiqueta o el pin","SESSION_NOT_FOUND":"Sesión no encontrada","SESSION_IS_NOT_ADMINISTRATIVE":"Sesión no administrativa","SESSION_EXPIRED":"La sesión expiró","MEMORI_MISSING_CONFIGURATION":"Gemelo: falta configuración","MEMORI_CONFIGURATION_NOT_FOUND":"Gemelo: configuración no encontrada","MEMORI_INVALID_PRIVACY_TYPE":"Gemelo: tipo de privacidad no válido","MEMORI_MISSING_PASSWORD":"Gemelo: falta contraseña","MEMORI_INVALID_TOTAL_NUMBER_OF_RECOVERY_TOKENS":"Gemelo: número total de tokens de recuperación no válidos","MEMORI_INVALID_MINIMUM_NUMBER_OF_RECOVERY_TOKENS":"Gemelo: número mínimo de tokens de recuperación no válidos","MEMORI_INVALID_VOICE_TYPE":"Gemelo: tipo de voz no válido","MEMORI_MISSING_NAME":"Gemelo: falta nombre","MEMORI_MISSING_PASSWORD_OR_RECOVERY_TOKENS":"Gemelo: falta contraseña o token de recuperación","MEMORI_INVALID_ID":"Gemelo: identificación no válida","MEMORI_NAME_ALREADY_USED":"Nombre gemelo ya en uso","MEMORI_INVALID_PIN":"Gemelo: PIN no válido","MEMORI_GIVER_TAG_PIN_CHANGE_REQUIRES_SEPARATE_OPERATION":"Gemelo: el cambio de TAG y PIN requiere operaciones separadas","MEMORI_NO_PASSWORD_WHEN_PUBLIC":"Agent: no se requiere contraseña cuando es público","MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS":"Deep Thought requiere que las completaciones estén habilitadas","MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS":"El grupo de expertos requiere que se habiliten las completaciones.","MEMORI_INVALID_COMPLETION_CONFIG":"Gemelo: configuración de finalizaciones no válidas","MEMORI_TRANSFER_MISSING_DESTINATION_USER":"Transferencia: falta usuario de destino","MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID":"Transferencia: ID de usuario de destino no válido","MEMORI_TRANSFER_DESTINATION_USER_DATA_INCONSISTENT":"Transferencia: datos de usuario de destino no válidos","MEMORI_TRANSFER_NOTHING_TO_DO":"Transferencia: nada que hacer","MEMORI_CONFIGURATION_CANT_BE_CHANGED":"Memorias: la configuración no se puede cambiar","MEMORI_MISSING_NEW_PASSWORD":"Recuerdos: falta nueva contraseña","MEMORI_FEATURE_REQUIRES_SUBSCRIPTION":"La función requiere suscripción","INTEGRATION_NOT_FOUND":"Integración no encontrada","MEMORI_SESSIONS_INVALID_DATE_FROM_FORMAT":"Fecha no válida del formato","MEMORI_SESSIONS_INVALID_DATE_TO_FORMAT":"Fecha no válida para formatear","INTEGRATION_INVALID_TYPE":"Tipo de integración no válido","INTEGRATION_ALREADY_EXISTS":"La integración ya existe","INTEGRATION_MEMORI_IS_NOT_PUBLIC":"Las memorias no públicas no se pueden integrar","INTEGRATION_MISSING_INVOCATION_TEXT":"Integración: falta texto de invocación","INTEGRATION_MISSING_DEVICE_EMAILS":"Integración: correo electrónico del dispositivo perdido","INTEGRATION_MEMORI_IS_EMPTY":"Los recuerdos vacíos no se pueden integrar","INTEGRATION_MISSING_PRIVACY_POLICY":"Integración: falta la política de privacidad","INTEGRATION_MISSING_CATEGORY":"Falta categoría de integración","INTEGRATION_MISSING_DESCRIPTION":"Falta descripción de integración","INTEGRATION_INVALID_INVOCATION_TEXT":"Texto de invocación no válido","INTEGRATION_GOOGLE_NO_MORE_AVAILABLE":"Google Home ya no está disponible","UPLOAD_REQUIRES_MULTIPART_ENCODING":"La carga requiere codificación multiparte","UPLOAD_MISSING_CONTENT_TYPE_BOUNDARY":"Subir: falta límite de tipo de contenido","UPLOAD_MAX_LENGTH_EXCEEDED":"Subir: se superó el tamaño máximo","UPLOAD_FILE_IS_EMPTY":"Subir: archivo vacío","UPLOAD_INVALID_FILE_TYPE_OR_SIGNATURE":"Subir: tipo de archivo o firma no válidos","UPLOAD_MISSING_FILE_NAME":"Subir: falta el nombre del archivo","UPLOAD_INVALID_MEMORY_ID":"Subir: ID de contenido no válido","UPLOAD_MISSING_FILE_CONTENT":"Subir: Falta contenido del archivo","ASSET_NOT_FOUND":"Activo no encontrado","ASSET_NOT_ACCESSIBLE":"Activo no accesible","ASSET_MISSING_SESSION_ID":"Activo: ID de sesión faltante","ASSET_INVALID_FILE_NAME":"Activo: nombre de archivo no válido","INVITATION_NOT_FOUND":"Invitación no encontrada","INVITATION_NOT_ACCESSIBLE":"Invitación no accesible","INVITATION_ALREADY_ACCEPTED":"Invitación ya aceptada","INVITATION_ALREADY_REJECTED":"Invitación ya rechazada","INVITATION_MISSING_DESTINATION_EMAIL":"Invitación: falta el correo electrónico de destino","INVITATION_DESTINATION_EMAIL_INVALID":"Invitación: correo electrónico de destino no válido","INVITATION_MISSING_TAG":"Invitación: falta etiqueta","INVITATION_MISSING_PIN":"Invitación: falta el PIN","INVITATION_INVALID_PIN":"Invitación: PIN no válido","INVITATION_INVALID_TYPE":"Invitación: tipo no válido","INVITATION_MISSING_DESTINATION_NAME":"Invitación: falta el nombre del destino","INVITATION_TAG_PIN_CANT_BE_CHANGED":"Invitación: la etiqueta y el pin no se pueden cambiar","INVITATION_CANT_BE_CHANGED":"Intación: no se puede cambiar","ACTIONLOG_INVALID_USER_ID":"ID de usuario no válido","ACTIONLOG_INVALID_DATE_FROM_FORMAT":"Fecha de: formato no válido","ACTIONLOG_INVALID_DATE_TO_FORMAT":"Fecha hasta: formato no válido","ACTIONLOG_INVALID_MEMORI_ID":"ID de memoria no válida","CONSUMPTIONLOG_INVALID_TYPE":"Tipo de registro no válido","CONSUMPTIONLOG_INVALID_DATE_FROM_FORMAT":"Fecha de: formato no válido","CONSUMPTIONLOG_INVALID_DATE_TO_FORMAT":"Fecha hasta: formato no válido","CONSUMPTIONLOG_INVALID_USER_ID":"ID de usuario no válido","CONSUMPTIONLOG_INVALID_MEMORI_ID":"ID de memoria no válida","NOTIFICATIONPREFS_INVALID_CHATLOG_EXTRACTION_PERIOD":"Notificaciones: Período de extracción del registro de chat no válido","PROCESS_INVALID_TYPE":"Tipo de proceso no válido","PROCESS_ALREADY_RUNNING":"Proceso ya en ejecución","PROCESS_NOT_FOUND":"Proceso no encontrado","IMPORTCSV_MISSING_ROWS":"Importación CSV: filas faltantes","IMPORTCSV_MISSING_CSV":"Importación CSV: Falta CSV","IMPORTCSV_MISSING_SEPARATOR":"Importación CSV: falta separador","IMPORTCSV_INVALID_SEPARATOR":"Importación CSV: separador no válido","IMPORTCSV_MISSING_HEADERS":"Importación CSV: faltan encabezados","IMPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Importación CSV: falta el separador de variante de título","IMPORTCSV_INVALID_RECEIVER_ID":"Importación CSV: ID de receptor no válido","IMPORTCSV_INVALID_MEDIA_LINK":"Importación CSV: enlace multimedia no válido","IMPORTCSV_INVALID_LINK_TITLE_HANDLING":"Importación CSV: título del enlace no válido","IMPORTCSV_UNDETECTABLE_CHAR_ENCODING":"Importación CSV: codificación de caracteres indetectable","IMPORTCSV_CANT_IMPORT_TO_SECRET_MEMORI":"Importación CSV: no se puede importar a Secret Memories","IMPORTTXT_MISSING_ROWS":"Importando TXT: filas faltantes","IMPORTTXT_INVALID_GRANULARITY":"Importar TXT: granularidad no válida","IMPORTTXT_INVALID_RECEIVER_ID":"Importar TXT: ID de receptor no válido","IMPORTTXT_INVALID_MEDIA_LINK":"Importar TXT: enlace multimedia no válido","IMPORTTXT_INVALID_LINK_TITLE_HANDLING":"Importar TXT: título del enlace no válido","IMPORTTXT_UNDETECTABLE_CHAR_ENCODING":"Importación TXT: codificación de caracteres indetectable","IMPORTTXT_CANT_IMPORT_TO_SECRET_MEMORI":"Importación TXT: No se puede importar a Secret Memories","IMPORTTXT_IMPORT_LIMIT_EXCEEDED":"Importar TXT: límite de importación excedido","IMPORTTXT_IMPORT_ON_GPT4_REQUIRES_API_KEY":"Importar TXT: la importación en GPT-4 requiere una clave API","IMPORTTXT_IMPORT_REQUIRES_PAYING":"Importar TXT: la importación requiere un plan de pago","IMPORTTXT_BILLING_DENIED_PERMISSION":"Importar TXT: no tienes suficientes créditos para la operación","EXPORTCSV_MISSING_CSV_SPECS":"Exportación CSV: faltan especificaciones CSV","EXPORTCSV_MISSING_SEPARATOR":"Exportación CSV: falta separador","EXPORTCSV_INVALID_SEPARATOR":"Exportación CSV: separador no válido","EXPORTCSV_MISSING_TITLE_VARIANT_SEPARATOR":"Exportación CSV: falta el separador de variante de título","EXPORTCSV_MISSING_NEW_LINE_CHAR":"Exportación CSV: falta un carácter de nueva línea","EXPORTCSV_INVALID_NEW_LINE_CHAR":"Exportación CSV: carácter de nueva línea no válido","EXPORTCSV_MISSING_PASSWORD":"Exportación CSV: falta contraseña","EXPORTJSONL_MISSING_JSONL_SPECS":"Exportación JSONL: faltan especificaciones JSONL","EXPORTJSONL_MISSING_PLATFORM":"Exportación JSONL: plataforma faltante","EXPORTJSONL_INVALID_PLATFORM":"Exportación JSONL: plataforma no válida","EXPORTJSONL_MISSING_PASSWORD":"Exportación JSONL: falta contraseña","EXPORTJSONL_EXPORT_REQUIRES_PAYING":"Exportación JSONL: la exportación requiere un plan pago","ANALYSIS_MISSING_QUERY":"Análisis: consulta faltante","ANALYSIS_CANT_ANALYZE_SECRET_MEMORI":"Análisis: No se pueden analizar recuerdos secretos","ANALYSIS_USER_QUERY_MATCH_REQUIRES_DEEP_THOUGHT":"Análisis: hacer coincidir la consulta del usuario requiere un pensamiento profundo","BADGE_ASSIGNMENT_WRONG_OR_MISSING_CREDENTIALS":"Asignación de insignia: credenciales incorrectas o faltantes","BADGE_ASSIGNMENT_MISSING_REF_ID":"Asignación de insignia: falta el ID de referencia","BADGE_ASSIGNMENT_OUTCOME_NOT_FOUND":"Asignación de insignia: resultado no encontrado","BADGE_ASSIGNMENT_MISSING_ASSERTION_URL":"Asignación de insignia: falta la URL de aserción","BADGE_ASSIGNMENT_MISSING_BADGE_URL":"Asignación de insignia: URL de insignia faltante","BADGE_ASSIGNMENT_MISSING_ISSUER_URL":"Asignación de insignia: falta la URL del emisor","BADGE_ASSIGNMENT_INVALID_URL":"Asignación de insignia: URL no válida","BADGE_ASSIGNMENT_MISSING_RECIPIENT":"Asignación de insignia: destinatario faltante","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_TYPE":"Asignación de insignia: tipo de destinatario desconocido","BADGE_ASSIGNMENT_MISSING_RECIPIENT_IDENTITY":"Asignación de insignia: falta la identidad del destinatario","BADGE_ASSIGNMENT_MISSING_RECIPIENT_HASH_TYPE":"Asignación de insignia: falta el tipo de hash del destinatario","BADGE_ASSIGNMENT_UNKNOWN_RECIPIENT_HASH_TYPE":"Asignación de insignia: tipo de hash del destinatario desconocido","BADGE_ASSIGNMENT_WRONG_RECIPIENT_IDENTITY":"Asignación de insignia: identidad del destinatario incorrecta","BADGE_NOT_FOUND":"Insignia no encontrada","OUTCOME_NO_DCM_CONFIGURED":"Resultado: no hay ningún DCM configurado","OUTCOME_USER_BADGES_DISABLED":"Resultado: insignias de usuario deshabilitadas","COMPLETION_CONFIG_MISSING_NAME":"Configuración de terminaciones: falta nombre","COMPLETION_CONFIG_MISSING_PROVIDER":"Configuración de terminaciones: falta proveedor","COMPLETION_CONFIG_MISSING_ENDPOINT":"Configuración de terminaciones: falta punto final","COMPLETION_CONFIG_MISSING_API_KEY":"Configuración de terminaciones: falta clave API","COMPLETION_CONFIG_MISSING_MODEL":"Configuración de terminaciones: modelo faltante","COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED":"Configuración de terminaciones: se debe especificar al menos un tipo de terminaciones","COMPLETION_CONFIG_INVALID_NAME":"Configuración de terminaciones: nombre no válido","COMPLETION_CONFIG_INVALID_PURPOSE":"Configuración de terminaciones: tipo de terminaciones no válidas","COMPLETION_CONFIG_INVALID_ENDPOINT":"Configuración de terminaciones: punto final no válido","COMPLETION_CONFIG_INCONSISTENT_ENDPOINT":"Configuración de terminaciones: punto final inconsistente","COMPLETION_CONFIG_INVALID_PROVIDER":"Configuración de terminaciones: proveedor no válido","COMPLETION_CONFIG_NOT_FOUND":"Configuración de terminaciones: no encontrada","COMPLETION_CONFIG_NOT_ACCESSIBLE":"Configuración de terminaciones: no accesible","COMPLETION_CONFIG_NAME_RESERVED":"Configuración de terminaciones: nombre reservado","COMPLETION_CONFIG_NAME_ALREADY_EXISTS":"Configuración de terminaciones: el nombre ya existe","COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED":"Configuración de terminaciones: cambio de visibilidad no permitido"}}');const fG=uG({resources:{en:{translation:t(dG)},it:{translation:t(cG)},es:{translation:t(mG)},fr:{translation:t(hG)},de:{translation:t(pG)}},lng:"en",fallbackLng:"it",supportedLngs:["en","it","fr","es","de"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1}});fG.init();var gG=fG;c=o("85Hg2");function vG(e){var t=e.i18n,n=e.defaultNS,r=e.children,i=(0,c.useMemo)((function(){return{i18n:t,defaultNS:n}}),[t,n]);return(0,c.createElement)(ue.Provider,{value:i},r)}var yG=({children:e})=>(0,s.jsx)(vG,{i18n:gG,children:e});const SG=({ownerUserName:e,ownerUserID:t,memoriName:n,memoriID:r,integration:i,integrationID:o,tenantID:a,secretToken:l,sessionID:u,layout:d,customLayout:h,showShare:p=!0,showCopyButton:m=!0,showTranslationOriginal:f=!1,showSettings:g=!0,showTypingText:v=!1,showClear:y=!1,showOnlyLastMessages:S,showInputs:_=!0,showDates:b=!1,showContextPerLine:x=!1,showUpload:w,showLogin:C,height:A="100%",baseURL:E,apiURL:T="https://backend.memori.ai",engineURL:I="https://engine.memori.ai",tag:M,pin:R,context:P,initialQuestion:N,uiLang:O,spokenLang:D,multilingual:k,authToken:L,enableAudio:B,defaultSpeakerActive:z=!0,disableTextEnteredEvents:F=!1,onStateChange:U,additionalInfo:j,customMediaRenderer:G,additionalSettings:H,userAvatar:V,useMathFormatting:W=!1,autoStart:q=!1,applyVarsToRoot:J=!1})=>{var K,Y,$,X;const[Q,ee]=(0,c.useState)(),[te,ne]=(0,c.useState)(),[re,ie]=(0,c.useState)(),{t:oe}=Ce();if(!(r&&t||n&&e))throw new Error("Identifier pair required: please provide either memoriID and ownerUserID or memoriName and ownerUserName");const se=Z(T,I),ae=(0,c.useCallback)((async()=>{const e=E||(a.startsWith("https://")?a:`https://${a}`);try{const t=await fetch(`${e}/api/speechkey`),n=await t.json();n.AZURE_COGNITIVE_SERVICES_TTS_KEY?ie(n.AZURE_COGNITIVE_SERVICES_TTS_KEY):console.log("AZURE_COGNITIVE_SERVICES_TTS_KEY not found")}catch(e){console.error("Error fetching speech key",e)}}),[]);(0,c.useEffect)((()=>{ae()}),[]);const le=(0,c.useCallback)((async()=>{if(r&&t){const{memori:e,...n}=await se.backend.getMemoriByUserAndId(a,t,r);0===n.resultCode&&e?ee(e):console.error("[MEMORI]",n,e)}else if(n&&e){const{memori:t,...r}=await se.backend.getMemori(a,e,n);0===r.resultCode&&t?ee(t):console.error("[MEMORI]",r,t)}}),[r,t,n,e,a]);(0,c.useEffect)((()=>{le()}),[le,a]);const ce=(0,c.useCallback)((async()=>{const e=await WU(a,E);e&&ne(e)}),[a,T]);(0,c.useEffect)((()=>{ce()}),[ce]),(0,c.useEffect)((()=>{if(O)gG.changeLanguage(O.toLowerCase());else{const{lng:e,fallbackLng:t}=(()=>{const e=navigator.language;if(e){let t=e.split("-")[0];if(["en","it"].includes(t))return{lng:t,fallbackLng:"en"===t?"it":"en"}}return{lng:"en",fallbackLng:"it"}})();gG.changeLanguage(e).catch((()=>{gG.changeLanguage(t)}))}}),[O]);const ue=null!=i?i:null===(K=null==Q?void 0:Q.integrations)||void 0===K?void 0:K.find((e=>o?e.integrationID===o:!!e.publish&&"LANDING_EXPERIENCE"===e.type)),de=yR(null!==(Y=null==ue?void 0:ue.customData)&&void 0!==Y?Y:"{}"),he=null!=P?P:(e=>{var t;if(!e)return{};const n=null===(t=null==e?void 0:e.split(","))||void 0===t?void 0:t.reduce(((e,t)=>{const[n,r]=t.split(":").map((e=>e.trim()));return{...e,[n]:r}}),{});return n})(de.contextVars),pe=null!=N?N:de.initialQuestion;return(0,s.jsx)(yG,{children:(0,s.jsxs)(zz,{children:[(0,s.jsx)(ed.Toaster,{position:"top-center",reverseOrder:!0}),Q?(0,s.jsx)(HU,{layout:d,customLayout:h,height:A,baseUrl:E||(a.startsWith("https://")?a:`https://${a}`),apiURL:T,engineURL:I,memori:{...Q,secretToken:l},ownerUserName:null!=e?e:Q.ownerUserName,ownerUserID:null!=t?t:Q.ownerUserID,tenantID:a,memoriLang:null!=D?D:null===(X=null===($=Q.culture)||void 0===$?void 0:$.split("-"))||void 0===X?void 0:X[0],multilingual:k,tenant:te,secret:l,sessionID:u,showShare:p,showCopyButton:m,showTranslationOriginal:f,showSettings:g,showTypingText:v,showClear:y,showOnlyLastMessages:S,showInputs:_,showDates:b,showContextPerLine:x,showLogin:null!=C?C:null==Q?void 0:Q.enableDeepThought,showUpload:w,integration:ue,initialContextVars:he,initialQuestion:pe,authToken:L,AZURE_COGNITIVE_SERVICES_TTS_KEY:re,autoStart:q,enableAudio:B&&!!re,defaultSpeakerActive:z,disableTextEnteredEvents:F,onStateChange:U,additionalInfo:j,customMediaRenderer:G,additionalSettings:H,userAvatar:V,useMathFormatting:W,applyVarsToRoot:J,...M&&R?{personification:{tag:M,pin:R}}:{}}):(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:(0,s.jsxs)("p",{style:{textAlign:"center",margin:"2rem auto",textTransform:"capitalize"},children:[oe("loading")||"Loading","..."]})})]})})};SG.propTypes={memoriName:t(l).string,memoriID:t(l).string,ownerUserName:t(l).string,ownerUserID:t(l).string,integrationID:t(l).string,integration:t(l).any,tenantID:t(l).string.isRequired,secretToken:t(l).string,sessionID:t(l).string,layout:t(l).oneOf(["DEFAULT","FULLPAGE","TOTEM","WEBSITE_ASSISTANT","CHAT","HIDDEN_CHAT","ZOOMED_FULL_BODY"]),customLayout:t(l).any,showShare:t(l).bool,showCopyButton:t(l).bool,showTranslationOriginal:t(l).bool,showInputs:t(l).bool,showDates:t(l).bool,showContextPerLine:t(l).bool,showSettings:t(l).bool,showClear:t(l).bool,showOnlyLastMessages:t(l).bool,showTypingText:t(l).bool,showLogin:t(l).bool,showUpload:t(l).bool,height:t(l).oneOfType([t(l).string,t(l).number]),baseURL:t(l).string,apiURL:t(l).string,engineURL:t(l).string,tag:t(l).string,pin:t(l).string,context:t(l).objectOf(t(l).any),initialQuestion:t(l).string,uiLang:t(l).oneOf(["en","it","fr","es","de","EN","IT","FR","ES","DE"]),spokenLang:t(l).string,multilingual:t(l).bool,authToken:t(l).string,enableAudio:t(l).bool,defaultSpeakerActive:t(l).bool,disableTextEnteredEvents:t(l).bool,onStateChange:t(l).func,additionalInfo:t(l).objectOf(t(l).any),customMediaRenderer:t(l).func,additionalSettings:t(l).any,userAvatar:t(l).oneOfType([t(l).string,t(l).any]),useMathFormatting:t(l).bool,autoStart:t(l).bool,applyVarsToRoot:t(l).bool};var _G=SG;const bG=e=>{try{return JSON.parse(e)}catch(e){return null}};class xG extends HTMLElement{connectedCallback(){const e=document.createElement("div"),n=document.createElement("div");n.setAttribute("id","memori-root"),e.appendChild(n),this.appendChild(e);const r=Object.keys(_G.propTypes).reduce(((e,t)=>(this.hasAttribute(t)&&(e[t]=this.getAttribute(t),"true"!==e[t]&&"false"!==e[t]||(e[t]="true"===e[t])),e)),{}),i=this.getAttribute("tenantId"),o=this.getAttribute("context")?.split(",")?.reduce(((e,t)=>{const[n,r]=t.split(":").map((e=>e.trim()));return{...e,[n]:r}}),{}),l=bG(this.getAttribute("additionalInfo")||"{}")||{},c=this.getAttribute("integration"),u=c&&bG(c)||void 0;i?t(a).render((0,s.jsx)(_G,{...r,context:o,tenantID:i,additionalInfo:l,integration:u}),n):console.error("No tenantId attribute found")}}customElements.define("memori-client",xG)})();