bridgeapp-ai-chat-widget 0.2.8 → 0.2.9
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.
|
@@ -40798,7 +40798,7 @@ const Tee = () => {
|
|
|
40798
40798
|
}
|
|
40799
40799
|
}, []);
|
|
40800
40800
|
return See(() => {
|
|
40801
|
-
|
|
40801
|
+
navigator.mediaDevices?.addEventListener("devicechange", o);
|
|
40802
40802
|
}), Eee(() => {
|
|
40803
40803
|
navigator.mediaDevices?.removeEventListener("devicechange", o);
|
|
40804
40804
|
}), te.useEffect(() => {
|
|
@@ -81935,7 +81935,7 @@ class rle extends EventTarget {
|
|
|
81935
81935
|
playAnimationImpl = null;
|
|
81936
81936
|
resolveAssetPath;
|
|
81937
81937
|
constructor(e) {
|
|
81938
|
-
super()
|
|
81938
|
+
super();
|
|
81939
81939
|
const t = 300 * 1e3;
|
|
81940
81940
|
if (this.onSessionExpired = ele(
|
|
81941
81941
|
this.onSessionExpired,
|
|
@@ -81954,7 +81954,7 @@ class rle extends EventTarget {
|
|
|
81954
81954
|
}
|
|
81955
81955
|
async init(e, t) {
|
|
81956
81956
|
const r = await (await fetch(`${kO}/manifest.json`)).json();
|
|
81957
|
-
|
|
81957
|
+
this.resolveAssetPath = (l) => `${kO}/${r[l]}`, await this.fetchAndMergeRemoteConfig(t);
|
|
81958
81958
|
const o = {
|
|
81959
81959
|
onAvatarReady: this.onAvatarReady,
|
|
81960
81960
|
onSessionExpired: this.onSessionExpired,
|
|
@@ -81969,15 +81969,18 @@ class rle extends EventTarget {
|
|
|
81969
81969
|
this.root = Aoe(e, this.config, o);
|
|
81970
81970
|
}
|
|
81971
81971
|
async fetchAndMergeRemoteConfig(e) {
|
|
81972
|
-
if (e.configName)
|
|
81973
|
-
|
|
81974
|
-
|
|
81975
|
-
|
|
81976
|
-
|
|
81977
|
-
|
|
81978
|
-
|
|
81979
|
-
|
|
81980
|
-
}
|
|
81972
|
+
if (!e.configName) {
|
|
81973
|
+
this.config = e;
|
|
81974
|
+
return;
|
|
81975
|
+
}
|
|
81976
|
+
try {
|
|
81977
|
+
const n = await (await fetch(
|
|
81978
|
+
this.resolveAssetPath(`configs/${e.configName}.json`)
|
|
81979
|
+
)).json();
|
|
81980
|
+
this.config = { ...e, ...n };
|
|
81981
|
+
} catch (t) {
|
|
81982
|
+
Bn.error("Failed to fetch remote config", t), this.config = { ...this.config };
|
|
81983
|
+
}
|
|
81981
81984
|
}
|
|
81982
81985
|
onAvatarReady = (e) => {
|
|
81983
81986
|
this.playAnimation = e, this.dispatchEvent(new CustomEvent("avatar_ready"));
|
|
@@ -4550,7 +4550,7 @@ void main() {
|
|
|
4550
4550
|
`).map(e=>{const t=e.split(" ");return{time:Number(t[0]),viseme:t[1]}}).filter(e=>e.viseme!=="X")}convertVisemeDataToAnimationScenario(){}update(e,t=0){this.mixer&&this.mixer.update(e),!(this.visemeDataIndex>=this.visemeData.length)&&t&&t>=this.visemeData[this.visemeDataIndex].time-this.blendShapeResetAnimationLength*.7&&(this.playVisemeAnimation(t,this.visemeData[this.visemeDataIndex],this.visemeData[this.visemeDataIndex+1]),this.visemeDataIndex++)}resetMorphing(){this.animations.forEach(e=>e.kill()),gu.to(this.avatar.head.morphTargetInfluences,this.blendShapeResetAnimationLength,this.zeroMorphingInfluences)}blendShapeAnimationLength=.2;blendShapeResetAnimationLength=.1;playVisemeAnimation(e,t,n){if(this.resetMorphing(),t.viseme==="X")return;const r=1,o=t.viseme,l=TW[MW[o]],u=this.avatar.head?.morphTargetDictionary[l],h=n?.time-e,m=Math.min(this.blendShapeAnimationLength,h-.07),_={influence:0},p=gu.to(_,{influence:r,duration:m,delay:this.blendShapeResetAnimationLength*.7,onUpdate:()=>{this.avatar.head.morphTargetInfluences[u]=_.influence}}),y=gu.to(_,{influence:0,duration:this.blendShapeAnimationLength,delay:m+.07,onUpdate:()=>{this.avatar.head.morphTargetInfluences[u]=_.influence}});this.animations=[p,y]}shapeFadeInDuration=.6;shapeFadeOutDuration=.6;showcaseBlendShape(e){this.resetMorphing();const t=this.avatar.head?.morphTargetDictionary[e],n={influence:0};gu.to(n,{influence:1,duration:this.shapeFadeInDuration,delay:this.blendShapeResetAnimationLength,onUpdate:()=>{this.avatar.head.morphTargetInfluences[t]=n.influence}}),gu.to(n,{influence:0,duration:this.shapeFadeOutDuration,delay:this.blendShapeResetAnimationLength+3,onUpdate:()=>{this.avatar.head.morphTargetInfluences[t]=n.influence}})}}class AW extends EventTarget{constructor(e,t,n,r){super(),this.canvas=e,this.videoContainer=t,this.config=n,this.api=r,this.renderer=new uq({canvas:this.canvas,antialias:!0,powerPreference:"high-performance",logarithmicDepthBuffer:!0,alpha:!0}),this.renderer.outputColorSpace=on,this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=aN,this.init()}initialAssetsfbxLoader;head;renderer;sound;gui;cubeTexture;textureLoader;clock=new UV;scene;camera;hair;body;animationManager;cameraParams={zoomIn:{position:new Se(0,140,200),lookAt:new Se(-7,115,0),fov:35},zoomOut:{position:new Se(0,125,200),lookAt:new Se(-7,90,0),fov:48}};controls;lightAmbient;lightDirectional;loadingManager;async init(){this.loadingManager=new B3;const e=23;this.loadingManager.onProgress=(ie,fe)=>{const me=fe/e,X=new CustomEvent("loading_progress",{detail:me});this.dispatchEvent(X)},this.initialAssetsfbxLoader=new p5(this.loadingManager),this.textureLoader=new wk(this.loadingManager),this.sound=new iY.Howl({src:[this.api.resolveAssetPath("sounds/voice-test.wav")]}),this.sound.mute(!0);const t=new HH;this.scene=t,this.lightAmbient=new Ok(4210752,50),t.add(this.lightAmbient);const n=2048,r=new Dk(16777215,2);r.position.set(50,170,50),r.target.position.set(0,80,0),r.castShadow=!0,this.lightDirectional=r,this.scene.add(this.lightDirectional),t.add(r.target),r.shadow.bias=-5e-4,r.shadow.normalBias=.1,r.shadow.mapSize.width=n,r.shadow.mapSize.height=n,r.shadow.camera.near=30,r.shadow.camera.far=230,r.shadow.camera.left=-50,r.shadow.camera.right=50,r.shadow.camera.top=75,r.shadow.camera.bottom=-70;const{width:o,height:l}=this.canvas.getBoundingClientRect(),u=new gs(65,o/l,.1,1e3);if(this.camera=u,this.setCamera(this.cameraParams.zoomIn),this.config.background){const ie=this.textureLoader.load(this.api.resolveAssetPath("textures/bg1.jpg"));ie.colorSpace=on,t.background=ie}const h=new CV(this.loadingManager);this.cubeTexture=h.load([this.api.resolveAssetPath("textures/cube-map/px.png"),this.api.resolveAssetPath("textures/cube-map/nx.png"),this.api.resolveAssetPath("textures/cube-map/py.png"),this.api.resolveAssetPath("textures/cube-map/ny.png"),this.api.resolveAssetPath("textures/cube-map/pz.png"),this.api.resolveAssetPath("textures/cube-map/nz.png")]);const m=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/brows_base_color.png")),_=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/eyes_base_color.png"));_.wrapS=Wr,_.wrapT=Wr;const p=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/body_base_color.png"));p.wrapS=Wr,p.wrapT=Wr;const y=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/body_metallic.png"));y.wrapS=Wr,y.wrapT=Wr;const x=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/body_normal.png"));x.wrapS=Wr,x.wrapT=Wr;const T=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/body_roughness.png"));T.wrapS=Wr,T.wrapT=Wr;const M=new mm({map:p,normalMap:x}),A=new I3({map:p,normalMap:x,metalnessMap:y,metalness:.94,roughness:.738,roughnessMap:T,envMap:this.cubeTexture,envMapIntensity:.496}),w=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/hair_base_color.png")),L=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/hair_metallic.png")),N=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/hair_normal.png")),I=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/hair_roughness.png")),z=new I3({map:w,normalMap:N,metalnessMap:L,metalness:1,roughnessMap:I,envMap:this.cubeTexture}),P=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/head_base_color.png")),H=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/head_metallic.png")),W=this.textureLoader.load(this.api.resolveAssetPath("textures/pbr/head_roughness.png")),U=new mm({map:P}),V=new mm({map:m}),J=this.textureLoader.load(this.api.resolveAssetPath("textures/shared/shadow_base_color.png"));J.wrapS=Wr,J.wrapT=Wr;const ne=this.textureLoader.load(this.api.resolveAssetPath("textures/shared/shadow_opacity.png"));ne.wrapS=Wr,ne.wrapT=Wr,m.colorSpace=on,_.colorSpace=on,p.colorSpace=on,y.colorSpace=on,x.colorSpace=on,T.colorSpace=on,w.colorSpace=on,L.colorSpace=on,N.colorSpace=on,I.colorSpace=on,P.colorSpace=on,H.colorSpace=on,W.colorSpace=on,J.colorSpace=on,ne.colorSpace=on,this.initialAssetsfbxLoader.load(this.api.resolveAssetPath("models/female_rig.fbx"),async ie=>{t.add(ie),ie.traverse(fe=>{if(fe instanceof hl&&(fe.castShadow=!0,fe.receiveShadow=!0),fe.name=="eye_shadows"){const X=fe.material;X.map=J,X.alphaMap=ne,X.transparent=!0;return}if(fe.name=="Hair"){this.hair=fe;return}if(fe.name=="Eyes"){const me=fe,X=new I3({map:_});me.material=X;return}if(fe.name=="Head"){this.head=fe;return}if(fe.name=="Body"){this.body=fe;return}}),this.hair.material=z,this.head.material=[U,V],this.body.material=[A,M],this.animationManager=new wW(ie,this),this.animationManager.init(),this.animationManager.setVisemeData(),this.animate(),this.onResize(),this.config.debug&&this.addGui()})}tempLookAt=new Se;setCamera(e,t){const{position:n,lookAt:r,fov:o}=e;gu.to(this.camera.position,{x:n.x,y:n.y,z:n.z,duration:.5}),gu.to(this.camera,{fov:o,duration:.5,onUpdate:()=>{this.camera.updateProjectionMatrix()}}),gu.to(this.tempLookAt,{x:r.x,y:r.y,z:r.z,duration:.5,onUpdate:()=>{this.camera.lookAt(this.tempLookAt)},onComplete:t})}width=0;height=0;onResize=(e,t)=>{if(!e||!t){const n=this.canvas.getBoundingClientRect();e=n.width,t=n.height}!e||!t||e==this.width&&t==this.height||(this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t,!1),this.render(),this.width=e,this.height=t)};animate=()=>{requestAnimationFrame(this.animate);const e=this.clock.getDelta(),t=this.sound.seek();this.animationManager.update(e,t),this.controls?.update(),this.render()};SPEAKING_ANIMATION_NAME_1="generic_speaking_1";SPEAKING_ANIMATION_NAME_2="generic_speaking_2";IDLE_ANIMATION_NAME_1="idle_1";IDLE_ANIMATION_NAME_2="waiting_idle";speakingAnimationName=this.SPEAKING_ANIMATION_NAME_1;idleAnimationName=this.IDLE_ANIMATION_NAME_1;setTalking(e){e?(this.sound.play(),this.animationManager.fadeToAction(this.speakingAnimationName)):(this.sound.stop(),this.sound.seek(0),this.animationManager.resetMorphing(),this.animationManager.resetVisemeData(),this.speakingAnimationName=this.speakingAnimationName===this.SPEAKING_ANIMATION_NAME_1?this.SPEAKING_ANIMATION_NAME_2:this.SPEAKING_ANIMATION_NAME_1,this.idleAnimationName=this.idleAnimationName===this.IDLE_ANIMATION_NAME_1?this.IDLE_ANIMATION_NAME_2:this.IDLE_ANIMATION_NAME_1,this.animationManager.activeActionName===this.speakingAnimationName&&this.animationManager.fadeToAction(this.idleAnimationName))}externalLaunchAnimationAction=e=>{this.animationManager.fadeToAction(e)};playAction=(e,t)=>{this.shutDownVideo(),this.setCamera(this.cameraParams.zoomIn),this.animationManager.resetVisemeData(),this.sound.stop(),t&&this.sound.play(),this.animationManager.fadeToAction(e)};playVideo=async(e,t)=>new Promise(r=>{this.setCamera(this.cameraParams.zoomOut,()=>{for(const l of this.videoContainer.children)l.style.visibility="hidden",l.onended=null;const o=this.videoContainer.querySelector(`#${e}`);o.style.visibility="visible",t&&this.sound.play(),o.play(),o.onended=()=>{this.sound.stop(),r(void 0)}})});shutDownVideo=()=>{for(const e of this.videoContainer.children)e.style.visibility="hidden"};showcaseBlendShape(e){this.sound.stop(),this.animationManager.showcaseBlendShape(e)}render(){this.renderer.render(this.scene,this.camera)}onAllAssetsLoaded=()=>{this.api.onAvatarReady(this.externalLaunchAnimationAction)};addGui(){this.gui=new aR,this.gui.domElement.style.position="absolute",this.gui.domElement.style.top="0",this.gui.domElement.style.left="0",this.gui.domElement.style.zIndex="50";const e=this.gui.addFolder("3D Animations").close(),t=this.gui.addFolder("Video + 3D Animations").close(),n={excited:()=>this.playAction("excited",!1),fixHair:()=>this.playAction("fix_hair",!1),genericSpeaking:()=>this.playAction("generic_speaking_1",!0),genericSpeaking2:()=>this.playAction("generic_speaking_2",!0),spin:()=>this.playAction("spin",!1),waitingIdle:()=>this.playAction("waiting_idle",!1),speak:()=>this.playAction("voice_1",!0),kiss:()=>this.playAction("kiss",!1),playVideoIdle:async()=>{await this.playVideo("idle"),this.playAction("waiting_idle",!1)},playVideoWave:async()=>{await this.playVideo("wave"),this.playAction("waiting_idle",!1)},playVideoSpeaking1:async()=>{await this.playVideo("speaking_1",!0),this.playVideo("idle")},playVideoSpeaking2:async()=>{await this.playVideo("speaking_2",!0),this.playVideo("idle")},playVideoSpeakingLong:async()=>{await this.playVideo("long_speaking",!0),this.playVideo("idle")}};e.add(n,"excited").name("Excited"),e.add(n,"fixHair").name("Fix Hair"),e.add(n,"genericSpeaking").name("Generic Speaking"),e.add(n,"genericSpeaking2").name("Generic Speaking 2"),e.add(n,"spin").name("Spin"),e.add(n,"waitingIdle").name("Waiting Idle"),e.add(n,"speak").name("Speak"),e.add(n,"kiss").name("Kiss"),t.add(n,"playVideoIdle").name("Video Idle -> 3D Waiting Idle"),t.add(n,"playVideoWave").name("Video Wave -> 3D Waiting Idle"),t.add(n,"playVideoSpeakingLong").name("Video Long Speaking -> Video Idle"),t.add(n,"playVideoSpeaking1").name("Video Speaking 1 -> Video Idle"),t.add(n,"playVideoSpeaking2").name("Video Speaking 2 -> Video Idle")}}const CW=i=>te.createElement("svg",{width:15,height:22,viewBox:"0 0 15 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},te.createElement("path",{d:"M3 10.5V4.5C3 3.30653 3.47411 2.16193 4.31802 1.31802C5.16193 0.474106 6.30653 0 7.5 0C8.69347 0 9.83807 0.474106 10.682 1.31802C11.5259 2.16193 12 3.30653 12 4.5V10.5C12 11.6935 11.5259 12.8381 10.682 13.682C9.83807 14.5259 8.69347 15 7.5 15C6.30653 15 5.16193 14.5259 4.31802 13.682C3.47411 12.8381 3 11.6935 3 10.5ZM15 10.5C15 10.3011 14.921 10.1103 14.7803 9.96967C14.6397 9.82902 14.4489 9.75 14.25 9.75C14.0511 9.75 13.8603 9.82902 13.7197 9.96967C13.579 10.1103 13.5 10.3011 13.5 10.5C13.5 12.0913 12.8679 13.6174 11.7426 14.7426C10.6174 15.8679 9.0913 16.5 7.5 16.5C5.9087 16.5 4.38258 15.8679 3.25736 14.7426C2.13214 13.6174 1.5 12.0913 1.5 10.5C1.5 10.3011 1.42098 10.1103 1.28033 9.96967C1.13968 9.82902 0.948912 9.75 0.75 9.75C0.551088 9.75 0.360322 9.82902 0.21967 9.96967C0.0790178 10.1103 0 10.3011 0 10.5C0.00228386 12.3586 0.693677 14.1504 1.94048 15.5288C3.18728 16.9072 4.90091 17.7743 6.75 17.9625V21C6.75 21.1989 6.82902 21.3897 6.96967 21.5303C7.11032 21.671 7.30109 21.75 7.5 21.75C7.69891 21.75 7.88968 21.671 8.03033 21.5303C8.17098 21.3897 8.25 21.1989 8.25 21V17.9625C10.0991 17.7743 11.8127 16.9072 13.0595 15.5288C14.3063 14.1504 14.9977 12.3586 15 10.5Z",fill:"white"})),RW=i=>te.createElement("svg",{width:17,height:22,viewBox:"0 0 17 22",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...i},te.createElement("path",{d:"M16.2483 20.05C16.1011 20.1838 15.9068 20.2536 15.7082 20.2441C15.5095 20.2346 15.3227 20.1466 15.189 19.9994L12.2902 16.8119C11.2986 17.4511 10.1683 17.8436 8.99395 17.9566V20.995C8.99395 21.1939 8.91494 21.3847 8.77428 21.5253C8.63363 21.666 8.44287 21.745 8.24395 21.745C8.04504 21.745 7.85428 21.666 7.71362 21.5253C7.57297 21.3847 7.49395 21.1939 7.49395 20.995V17.9575C5.64487 17.7694 3.93123 16.9022 2.68443 15.5238C1.43763 14.1454 0.746237 12.3536 0.743953 10.495C0.743953 10.2961 0.822971 10.1053 0.963623 9.96468C1.10428 9.82403 1.29504 9.74501 1.49395 9.74501C1.69287 9.74501 1.88363 9.82403 2.02428 9.96468C2.16494 10.1053 2.24395 10.2961 2.24395 10.495C2.24569 12.0858 2.87839 13.6109 4.00323 14.7357C5.12807 15.8606 6.65319 16.4933 8.24395 16.495C9.3051 16.4981 10.3477 16.2172 11.2636 15.6813L10.223 14.5375C9.53688 14.8735 8.77649 15.0293 8.01351 14.9902C7.25052 14.951 6.51006 14.7183 5.86189 14.3139C5.21372 13.9095 4.67918 13.3467 4.30864 12.6786C3.93811 12.0105 3.74377 11.259 3.74395 10.495V7.4097L0.188953 3.49939C0.0579834 3.35175 -0.00951799 3.15845 0.00108397 2.96138C0.0116859 2.76431 0.0995364 2.57936 0.245589 2.44663C0.391643 2.3139 0.584126 2.24408 0.781309 2.25232C0.978492 2.26056 1.16448 2.34619 1.29895 2.49064L16.299 18.9906C16.4327 19.1378 16.5025 19.3321 16.493 19.5308C16.4835 19.7295 16.3955 19.9162 16.2483 20.05ZM13.9805 14.1316C14.0828 14.1823 14.1954 14.2086 14.3096 14.2085C14.4501 14.2085 14.5878 14.169 14.7069 14.0946C14.8261 14.0202 14.922 13.9138 14.9836 13.7875C15.4869 12.7631 15.7471 11.6364 15.744 10.495C15.744 10.2961 15.6649 10.1053 15.5243 9.96468C15.3836 9.82403 15.1929 9.74501 14.994 9.74501C14.795 9.74501 14.6043 9.82403 14.4636 9.96468C14.323 10.1053 14.244 10.2961 14.244 10.495C14.2466 11.4079 14.0387 12.309 13.6365 13.1285C13.5491 13.3071 13.5363 13.5131 13.6008 13.7013C13.6653 13.8894 13.8019 14.0442 13.9805 14.1316ZM11.4183 11.3922C11.5158 11.4995 11.6422 11.5762 11.7824 11.6131C11.9225 11.65 12.0703 11.6456 12.208 11.6002C12.3456 11.5549 12.4672 11.4707 12.558 11.3577C12.6488 11.2448 12.7049 11.1079 12.7196 10.9638C12.7356 10.808 12.7437 10.6516 12.744 10.495V4.49501C12.7428 3.46146 12.3859 2.45981 11.7333 1.6584C11.0806 0.85698 10.172 0.304654 9.16007 0.0942441C8.14816 -0.116166 7.09467 0.0281652 6.17664 0.502981C5.25861 0.977798 4.53201 1.75415 4.11895 2.70158C4.06128 2.834 4.04308 2.98027 4.06652 3.1228C4.08997 3.26532 4.15408 3.39804 4.25114 3.50501L11.4183 11.3922Z"})),DW=i=>te.createElement("svg",{width:19,height:17,viewBox:"0 0 19 17",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...i},te.createElement("path",{d:"M12.5227 3.81607C11.8966 2.45748 10.8252 1.35355 9.48597 0.687157C8.14671 0.0207681 6.61998 -0.168078 5.15872 0.151907C3.69745 0.471891 2.38936 1.2815 1.45116 2.4466C0.512966 3.6117 0.000969112 5.06237 0 6.55826V11.5583C0 11.9727 0.16462 12.3701 0.457646 12.6631C0.750671 12.9561 1.1481 13.1208 1.5625 13.1208H5.63281C6.16643 14.2418 7.00649 15.1889 8.05583 15.8525C9.10517 16.5161 10.3209 16.8692 11.5625 16.8708H16.5625C16.9769 16.8708 17.3743 16.7061 17.6674 16.4131C17.9604 16.1201 18.125 15.7227 18.125 15.3083V10.3083C18.1251 8.73409 17.5593 7.21234 16.5309 6.02056C15.5024 4.82878 14.0799 4.04638 12.5227 3.81607ZM1.875 6.55826C1.875 5.63116 2.14992 4.72488 2.66499 3.95402C3.18006 3.18317 3.91214 2.58236 4.76867 2.22757C5.6252 1.87278 6.5677 1.77996 7.47699 1.96082C8.38627 2.14169 9.2215 2.58813 9.87706 3.24369C10.5326 3.89925 10.9791 4.73448 11.1599 5.64377C11.3408 6.55306 11.248 7.49556 10.8932 8.35209C10.5384 9.20861 9.93759 9.9407 9.16674 10.4558C8.39588 10.9708 7.4896 11.2458 6.5625 11.2458H1.875V6.55826ZM16.25 14.9958H11.5625C10.8125 14.9949 10.0737 14.8145 9.40771 14.4697C8.74173 14.1249 8.16796 13.6256 7.73438 13.0137C9.36318 12.7195 10.8205 11.8202 11.8138 10.4962C12.8071 9.17219 13.2629 7.52154 13.0898 5.87544C14.0125 6.19342 14.8129 6.79144 15.3794 7.58608C15.9459 8.38072 16.2502 9.33236 16.25 10.3083V14.9958Z"}));var Cm=(i=>(i.Voice="voice",i.Text="text",i))(Cm||{});const Ca={list:"/chats",voice:"/chat/voice",text:"/chat/text"};function OW(i){return i===Ca.text||i.endsWith(Ca.text)?"text":"voice"}function LW(i){return i===Ca.list||i.endsWith(Ca.list)}function BU(i){var e,t,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(e=0;e<r;e++)i[e]&&(t=BU(i[e]))&&(n&&(n+=" "),n+=t)}else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function NW(){for(var i,e,t=0,n="",r=arguments.length;t<r;t++)(i=arguments[t])&&(e=BU(i))&&(n&&(n+=" "),n+=e);return n}const kW=(i,e)=>{const t=new Array(i.length+e.length);for(let n=0;n<i.length;n++)t[n]=i[n];for(let n=0;n<e.length;n++)t[i.length+n]=e[n];return t},UW=(i,e)=>({classGroupId:i,validator:e}),PU=(i=new Map,e=null,t)=>({nextPart:i,validators:e,classGroupId:t}),FT="-",FU=[],IW="arbitrary..",zW=i=>{const e=PW(i),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=i;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return BW(l);const u=l.split(FT),h=u[0]===""&&u.length>1?1:0;return HU(u,h,e)},getConflictingClassGroupIds:(l,u)=>{if(u){const h=n[l],m=t[l];return h?m?kW(m,h):h:m||FU}return t[l]||FU}}},HU=(i,e,t)=>{if(i.length-e===0)return t.classGroupId;const r=i[e],o=t.nextPart.get(r);if(o){const m=HU(i,e+1,o);if(m)return m}const l=t.validators;if(l===null)return;const u=e===0?i.join(FT):i.slice(e).join(FT),h=l.length;for(let m=0;m<h;m++){const _=l[m];if(_.validator(u))return _.classGroupId}},BW=i=>i.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=i.slice(1,-1),t=e.indexOf(":"),n=e.slice(0,t);return n?IW+n:void 0})(),PW=i=>{const{theme:e,classGroups:t}=i;return FW(t,e)},FW=(i,e)=>{const t=PU();for(const n in i){const r=i[n];qR(r,t,n,e)}return t},qR=(i,e,t,n)=>{const r=i.length;for(let o=0;o<r;o++){const l=i[o];HW(l,e,t,n)}},HW=(i,e,t,n)=>{if(typeof i=="string"){VW(i,e,t);return}if(typeof i=="function"){GW(i,e,t,n);return}jW(i,e,t,n)},VW=(i,e,t)=>{const n=i===""?e:VU(e,i);n.classGroupId=t},GW=(i,e,t,n)=>{if($W(i)){qR(i(n),e,t,n);return}e.validators===null&&(e.validators=[]),e.validators.push(UW(t,i))},jW=(i,e,t,n)=>{const r=Object.entries(i),o=r.length;for(let l=0;l<o;l++){const[u,h]=r[l];qR(h,VU(e,u),t,n)}},VU=(i,e)=>{let t=i;const n=e.split(FT),r=n.length;for(let o=0;o<r;o++){const l=n[o];let u=t.nextPart.get(l);u||(u=PU(),t.nextPart.set(l,u)),t=u}return t},$W=i=>"isThemeGetter"in i&&i.isThemeGetter===!0,XW=i=>{if(i<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),n=Object.create(null);const r=(o,l)=>{t[o]=l,e++,e>i&&(e=0,n=t,t=Object.create(null))};return{get(o){let l=t[o];if(l!==void 0)return l;if((l=n[o])!==void 0)return r(o,l),l},set(o,l){o in t?t[o]=l:r(o,l)}}},YR="!",GU=":",qW=[],jU=(i,e,t,n,r)=>({modifiers:i,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:n,isExternal:r}),YW=i=>{const{prefix:e,experimentalParseClassName:t}=i;let n=r=>{const o=[];let l=0,u=0,h=0,m;const _=r.length;for(let M=0;M<_;M++){const A=r[M];if(l===0&&u===0){if(A===GU){o.push(r.slice(h,M)),h=M+1;continue}if(A==="/"){m=M;continue}}A==="["?l++:A==="]"?l--:A==="("?u++:A===")"&&u--}const p=o.length===0?r:r.slice(h);let y=p,x=!1;p.endsWith(YR)?(y=p.slice(0,-1),x=!0):p.startsWith(YR)&&(y=p.slice(1),x=!0);const T=m&&m>h?m-h:void 0;return jU(o,x,y,T)};if(e){const r=e+GU,o=n;n=l=>l.startsWith(r)?o(l.slice(r.length)):jU(qW,!1,l,void 0,!0)}if(t){const r=n;n=o=>t({className:o,parseClassName:r})}return n},WW=i=>{const e=new Map;return i.orderSensitiveModifiers.forEach((t,n)=>{e.set(t,1e6+n)}),t=>{const n=[];let r=[];for(let o=0;o<t.length;o++){const l=t[o],u=l[0]==="[",h=e.has(l);u||h?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(l)):r.push(l)}return r.length>0&&(r.sort(),n.push(...r)),n}},ZW=i=>({cache:XW(i.cacheSize),parseClassName:YW(i),sortModifiers:WW(i),...zW(i)}),KW=/\s+/,JW=(i,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:r,sortModifiers:o}=e,l=[],u=i.trim().split(KW);let h="";for(let m=u.length-1;m>=0;m-=1){const _=u[m],{isExternal:p,modifiers:y,hasImportantModifier:x,baseClassName:T,maybePostfixModifierPosition:M}=t(_);if(p){h=_+(h.length>0?" "+h:h);continue}let A=!!M,w=n(A?T.substring(0,M):T);if(!w){if(!A){h=_+(h.length>0?" "+h:h);continue}if(w=n(T),!w){h=_+(h.length>0?" "+h:h);continue}A=!1}const L=y.length===0?"":y.length===1?y[0]:o(y).join(":"),N=x?L+YR:L,I=N+w;if(l.indexOf(I)>-1)continue;l.push(I);const z=r(w,A);for(let P=0;P<z.length;++P){const H=z[P];l.push(N+H)}h=_+(h.length>0?" "+h:h)}return h},QW=(...i)=>{let e=0,t,n,r="";for(;e<i.length;)(t=i[e++])&&(n=$U(t))&&(r&&(r+=" "),r+=n);return r},$U=i=>{if(typeof i=="string")return i;let e,t="";for(let n=0;n<i.length;n++)i[n]&&(e=$U(i[n]))&&(t&&(t+=" "),t+=e);return t},eZ=(i,...e)=>{let t,n,r,o;const l=h=>{const m=e.reduce((_,p)=>p(_),i());return t=ZW(m),n=t.cache.get,r=t.cache.set,o=u,u(h)},u=h=>{const m=n(h);if(m)return m;const _=JW(h,t);return r(h,_),_};return o=l,(...h)=>o(QW(...h))},tZ=[],Qr=i=>{const e=t=>t[i]||tZ;return e.isThemeGetter=!0,e},XU=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,qU=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nZ=/^\d+\/\d+$/,iZ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rZ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,aZ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,sZ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,oZ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Cv=i=>nZ.test(i),Mn=i=>!!i&&!Number.isNaN(Number(i)),sh=i=>!!i&&Number.isInteger(Number(i)),WR=i=>i.endsWith("%")&&Mn(i.slice(0,-1)),Tf=i=>iZ.test(i),lZ=()=>!0,cZ=i=>rZ.test(i)&&!aZ.test(i),YU=()=>!1,uZ=i=>sZ.test(i),fZ=i=>oZ.test(i),dZ=i=>!At(i)&&!Ct(i),hZ=i=>Rv(i,QU,YU),At=i=>XU.test(i),Rm=i=>Rv(i,eI,cZ),ZR=i=>Rv(i,yZ,Mn),WU=i=>Rv(i,KU,YU),pZ=i=>Rv(i,JU,fZ),HT=i=>Rv(i,tI,uZ),Ct=i=>qU.test(i),Jb=i=>Dv(i,eI),mZ=i=>Dv(i,_Z),ZU=i=>Dv(i,KU),gZ=i=>Dv(i,QU),vZ=i=>Dv(i,JU),VT=i=>Dv(i,tI,!0),Rv=(i,e,t)=>{const n=XU.exec(i);return n?n[1]?e(n[1]):t(n[2]):!1},Dv=(i,e,t=!1)=>{const n=qU.exec(i);return n?n[1]?e(n[1]):t:!1},KU=i=>i==="position"||i==="percentage",JU=i=>i==="image"||i==="url",QU=i=>i==="length"||i==="size"||i==="bg-size",eI=i=>i==="length",yZ=i=>i==="number",_Z=i=>i==="family-name",tI=i=>i==="shadow",bZ=eZ(()=>{const i=Qr("color"),e=Qr("font"),t=Qr("text"),n=Qr("font-weight"),r=Qr("tracking"),o=Qr("leading"),l=Qr("breakpoint"),u=Qr("container"),h=Qr("spacing"),m=Qr("radius"),_=Qr("shadow"),p=Qr("inset-shadow"),y=Qr("text-shadow"),x=Qr("drop-shadow"),T=Qr("blur"),M=Qr("perspective"),A=Qr("aspect"),w=Qr("ease"),L=Qr("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],z=()=>[...I(),Ct,At],P=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto","contain","none"],W=()=>[Ct,At,h],U=()=>[Cv,"full","auto",...W()],V=()=>[sh,"none","subgrid",Ct,At],J=()=>["auto",{span:["full",sh,Ct,At]},sh,Ct,At],ne=()=>[sh,"auto",Ct,At],ie=()=>["auto","min","max","fr",Ct,At],fe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],me=()=>["start","end","center","stretch","center-safe","end-safe"],X=()=>["auto",...W()],K=()=>[Cv,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...W()],ee=()=>[i,Ct,At],ke=()=>[...I(),ZU,WU,{position:[Ct,At]}],Pe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",gZ,hZ,{size:[Ct,At]}],le=()=>[WR,Jb,Rm],Ee=()=>["","none","full",m,Ct,At],Re=()=>["",Mn,Jb,Rm],Qe=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_e=()=>[Mn,WR,ZU,WU],nt=()=>["","none",T,Ct,At],lt=()=>["none",Mn,Ct,At],ut=()=>["none",Mn,Ct,At],Ze=()=>[Mn,Ct,At],Ln=()=>[Cv,"full",...W()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tf],breakpoint:[Tf],color:[lZ],container:[Tf],"drop-shadow":[Tf],ease:["in","out","in-out"],font:[dZ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tf],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tf],shadow:[Tf],spacing:["px",Mn],text:[Tf],"text-shadow":[Tf],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Cv,At,Ct,A]}],container:["container"],columns:[{columns:[Mn,At,Ct,u]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:z()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{start:U()}],end:[{end:U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[sh,"auto",Ct,At]}],basis:[{basis:[Cv,"full","auto",u,...W()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Mn,Cv,"auto","initial","none",At]}],grow:[{grow:["",Mn,Ct,At]}],shrink:[{shrink:["",Mn,Ct,At]}],order:[{order:[sh,"first","last","none",Ct,At]}],"grid-cols":[{"grid-cols":V()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":V()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:W()}],"gap-x":[{"gap-x":W()}],"gap-y":[{"gap-y":W()}],"justify-content":[{justify:[...fe(),"normal"]}],"justify-items":[{"justify-items":[...me(),"normal"]}],"justify-self":[{"justify-self":["auto",...me()]}],"align-content":[{content:["normal",...fe()]}],"align-items":[{items:[...me(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...me(),{baseline:["","last"]}]}],"place-content":[{"place-content":fe()}],"place-items":[{"place-items":[...me(),"baseline"]}],"place-self":[{"place-self":["auto",...me()]}],p:[{p:W()}],px:[{px:W()}],py:[{py:W()}],ps:[{ps:W()}],pe:[{pe:W()}],pt:[{pt:W()}],pr:[{pr:W()}],pb:[{pb:W()}],pl:[{pl:W()}],m:[{m:X()}],mx:[{mx:X()}],my:[{my:X()}],ms:[{ms:X()}],me:[{me:X()}],mt:[{mt:X()}],mr:[{mr:X()}],mb:[{mb:X()}],ml:[{ml:X()}],"space-x":[{"space-x":W()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":W()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[u,"screen",...K()]}],"min-w":[{"min-w":[u,"screen","none",...K()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",t,Jb,Rm]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ct,ZR]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",WR,At]}],"font-family":[{font:[mZ,At,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Ct,At]}],"line-clamp":[{"line-clamp":[Mn,"none",Ct,ZR]}],leading:[{leading:[o,...W()]}],"list-image":[{"list-image":["none",Ct,At]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ct,At]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ee()}],"text-color":[{text:ee()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Qe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Mn,"from-font","auto",Ct,Rm]}],"text-decoration-color":[{decoration:ee()}],"underline-offset":[{"underline-offset":[Mn,"auto",Ct,At]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:W()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ct,At]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ct,At]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ke()}],"bg-repeat":[{bg:Pe()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},sh,Ct,At],radial:["",Ct,At],conic:[sh,Ct,At]},vZ,pZ]}],"bg-color":[{bg:ee()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:ee()}],"gradient-via":[{via:ee()}],"gradient-to":[{to:ee()}],rounded:[{rounded:Ee()}],"rounded-s":[{"rounded-s":Ee()}],"rounded-e":[{"rounded-e":Ee()}],"rounded-t":[{"rounded-t":Ee()}],"rounded-r":[{"rounded-r":Ee()}],"rounded-b":[{"rounded-b":Ee()}],"rounded-l":[{"rounded-l":Ee()}],"rounded-ss":[{"rounded-ss":Ee()}],"rounded-se":[{"rounded-se":Ee()}],"rounded-ee":[{"rounded-ee":Ee()}],"rounded-es":[{"rounded-es":Ee()}],"rounded-tl":[{"rounded-tl":Ee()}],"rounded-tr":[{"rounded-tr":Ee()}],"rounded-br":[{"rounded-br":Ee()}],"rounded-bl":[{"rounded-bl":Ee()}],"border-w":[{border:Re()}],"border-w-x":[{"border-x":Re()}],"border-w-y":[{"border-y":Re()}],"border-w-s":[{"border-s":Re()}],"border-w-e":[{"border-e":Re()}],"border-w-t":[{"border-t":Re()}],"border-w-r":[{"border-r":Re()}],"border-w-b":[{"border-b":Re()}],"border-w-l":[{"border-l":Re()}],"divide-x":[{"divide-x":Re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Qe(),"hidden","none"]}],"divide-style":[{divide:[...Qe(),"hidden","none"]}],"border-color":[{border:ee()}],"border-color-x":[{"border-x":ee()}],"border-color-y":[{"border-y":ee()}],"border-color-s":[{"border-s":ee()}],"border-color-e":[{"border-e":ee()}],"border-color-t":[{"border-t":ee()}],"border-color-r":[{"border-r":ee()}],"border-color-b":[{"border-b":ee()}],"border-color-l":[{"border-l":ee()}],"divide-color":[{divide:ee()}],"outline-style":[{outline:[...Qe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Mn,Ct,At]}],"outline-w":[{outline:["",Mn,Jb,Rm]}],"outline-color":[{outline:ee()}],shadow:[{shadow:["","none",_,VT,HT]}],"shadow-color":[{shadow:ee()}],"inset-shadow":[{"inset-shadow":["none",p,VT,HT]}],"inset-shadow-color":[{"inset-shadow":ee()}],"ring-w":[{ring:Re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ee()}],"ring-offset-w":[{"ring-offset":[Mn,Rm]}],"ring-offset-color":[{"ring-offset":ee()}],"inset-ring-w":[{"inset-ring":Re()}],"inset-ring-color":[{"inset-ring":ee()}],"text-shadow":[{"text-shadow":["none",y,VT,HT]}],"text-shadow-color":[{"text-shadow":ee()}],opacity:[{opacity:[Mn,Ct,At]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Mn]}],"mask-image-linear-from-pos":[{"mask-linear-from":_e()}],"mask-image-linear-to-pos":[{"mask-linear-to":_e()}],"mask-image-linear-from-color":[{"mask-linear-from":ee()}],"mask-image-linear-to-color":[{"mask-linear-to":ee()}],"mask-image-t-from-pos":[{"mask-t-from":_e()}],"mask-image-t-to-pos":[{"mask-t-to":_e()}],"mask-image-t-from-color":[{"mask-t-from":ee()}],"mask-image-t-to-color":[{"mask-t-to":ee()}],"mask-image-r-from-pos":[{"mask-r-from":_e()}],"mask-image-r-to-pos":[{"mask-r-to":_e()}],"mask-image-r-from-color":[{"mask-r-from":ee()}],"mask-image-r-to-color":[{"mask-r-to":ee()}],"mask-image-b-from-pos":[{"mask-b-from":_e()}],"mask-image-b-to-pos":[{"mask-b-to":_e()}],"mask-image-b-from-color":[{"mask-b-from":ee()}],"mask-image-b-to-color":[{"mask-b-to":ee()}],"mask-image-l-from-pos":[{"mask-l-from":_e()}],"mask-image-l-to-pos":[{"mask-l-to":_e()}],"mask-image-l-from-color":[{"mask-l-from":ee()}],"mask-image-l-to-color":[{"mask-l-to":ee()}],"mask-image-x-from-pos":[{"mask-x-from":_e()}],"mask-image-x-to-pos":[{"mask-x-to":_e()}],"mask-image-x-from-color":[{"mask-x-from":ee()}],"mask-image-x-to-color":[{"mask-x-to":ee()}],"mask-image-y-from-pos":[{"mask-y-from":_e()}],"mask-image-y-to-pos":[{"mask-y-to":_e()}],"mask-image-y-from-color":[{"mask-y-from":ee()}],"mask-image-y-to-color":[{"mask-y-to":ee()}],"mask-image-radial":[{"mask-radial":[Ct,At]}],"mask-image-radial-from-pos":[{"mask-radial-from":_e()}],"mask-image-radial-to-pos":[{"mask-radial-to":_e()}],"mask-image-radial-from-color":[{"mask-radial-from":ee()}],"mask-image-radial-to-color":[{"mask-radial-to":ee()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":I()}],"mask-image-conic-pos":[{"mask-conic":[Mn]}],"mask-image-conic-from-pos":[{"mask-conic-from":_e()}],"mask-image-conic-to-pos":[{"mask-conic-to":_e()}],"mask-image-conic-from-color":[{"mask-conic-from":ee()}],"mask-image-conic-to-color":[{"mask-conic-to":ee()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ke()}],"mask-repeat":[{mask:Pe()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ct,At]}],filter:[{filter:["","none",Ct,At]}],blur:[{blur:nt()}],brightness:[{brightness:[Mn,Ct,At]}],contrast:[{contrast:[Mn,Ct,At]}],"drop-shadow":[{"drop-shadow":["","none",x,VT,HT]}],"drop-shadow-color":[{"drop-shadow":ee()}],grayscale:[{grayscale:["",Mn,Ct,At]}],"hue-rotate":[{"hue-rotate":[Mn,Ct,At]}],invert:[{invert:["",Mn,Ct,At]}],saturate:[{saturate:[Mn,Ct,At]}],sepia:[{sepia:["",Mn,Ct,At]}],"backdrop-filter":[{"backdrop-filter":["","none",Ct,At]}],"backdrop-blur":[{"backdrop-blur":nt()}],"backdrop-brightness":[{"backdrop-brightness":[Mn,Ct,At]}],"backdrop-contrast":[{"backdrop-contrast":[Mn,Ct,At]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Mn,Ct,At]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Mn,Ct,At]}],"backdrop-invert":[{"backdrop-invert":["",Mn,Ct,At]}],"backdrop-opacity":[{"backdrop-opacity":[Mn,Ct,At]}],"backdrop-saturate":[{"backdrop-saturate":[Mn,Ct,At]}],"backdrop-sepia":[{"backdrop-sepia":["",Mn,Ct,At]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":W()}],"border-spacing-x":[{"border-spacing-x":W()}],"border-spacing-y":[{"border-spacing-y":W()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ct,At]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Mn,"initial",Ct,At]}],ease:[{ease:["linear","initial",w,Ct,At]}],delay:[{delay:[Mn,Ct,At]}],animate:[{animate:["none",L,Ct,At]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[M,Ct,At]}],"perspective-origin":[{"perspective-origin":z()}],rotate:[{rotate:lt()}],"rotate-x":[{"rotate-x":lt()}],"rotate-y":[{"rotate-y":lt()}],"rotate-z":[{"rotate-z":lt()}],scale:[{scale:ut()}],"scale-x":[{"scale-x":ut()}],"scale-y":[{"scale-y":ut()}],"scale-z":[{"scale-z":ut()}],"scale-3d":["scale-3d"],skew:[{skew:Ze()}],"skew-x":[{"skew-x":Ze()}],"skew-y":[{"skew-y":Ze()}],transform:[{transform:[Ct,At,"","none","gpu","cpu"]}],"transform-origin":[{origin:z()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ln()}],"translate-x":[{"translate-x":Ln()}],"translate-y":[{"translate-y":Ln()}],"translate-z":[{"translate-z":Ln()}],"translate-none":["translate-none"],accent:[{accent:ee()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ee()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ct,At]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":W()}],"scroll-mx":[{"scroll-mx":W()}],"scroll-my":[{"scroll-my":W()}],"scroll-ms":[{"scroll-ms":W()}],"scroll-me":[{"scroll-me":W()}],"scroll-mt":[{"scroll-mt":W()}],"scroll-mr":[{"scroll-mr":W()}],"scroll-mb":[{"scroll-mb":W()}],"scroll-ml":[{"scroll-ml":W()}],"scroll-p":[{"scroll-p":W()}],"scroll-px":[{"scroll-px":W()}],"scroll-py":[{"scroll-py":W()}],"scroll-ps":[{"scroll-ps":W()}],"scroll-pe":[{"scroll-pe":W()}],"scroll-pt":[{"scroll-pt":W()}],"scroll-pr":[{"scroll-pr":W()}],"scroll-pb":[{"scroll-pb":W()}],"scroll-pl":[{"scroll-pl":W()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ct,At]}],fill:[{fill:["none",...ee()]}],"stroke-w":[{stroke:[Mn,Jb,Rm,ZR]}],stroke:[{stroke:["none",...ee()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Co(...i){return bZ(NW(i))}const xZ=typeof document<"u"?tm.useLayoutEffect:()=>{},oh=i=>{var e;return(e=i?.ownerDocument)!==null&&e!==void 0?e:document},Dm=i=>i&&"window"in i&&i.window===i?i:oh(i).defaultView||window;function SZ(i){return i!==null&&typeof i=="object"&&"nodeType"in i&&typeof i.nodeType=="number"}function EZ(i){return SZ(i)&&i.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in i}let TZ=!1;function KR(){return TZ}function nI(i,e){if(!KR())return e&&i?i.contains(e):!1;if(!i||!e)return!1;let t=e;for(;t!==null;){if(t===i)return!0;t.tagName==="SLOT"&&t.assignedSlot?t=t.assignedSlot.parentNode:EZ(t)?t=t.host:t=t.parentNode}return!1}const JR=(i=document)=>{var e;if(!KR())return i.activeElement;let t=i.activeElement;for(;t&&"shadowRoot"in t&&(!((e=t.shadowRoot)===null||e===void 0)&&e.activeElement);)t=t.shadowRoot.activeElement;return t};function iI(i){return KR()&&i.target.shadowRoot&&i.composedPath?i.composedPath()[0]:i.target}function MZ(i){if(wZ())i.focus({preventScroll:!0});else{let e=AZ(i);i.focus(),CZ(e)}}let GT=null;function wZ(){if(GT==null){GT=!1;try{document.createElement("div").focus({get preventScroll(){return GT=!0,!0}})}catch{}}return GT}function AZ(i){let e=i.parentNode,t=[],n=document.scrollingElement||document.documentElement;for(;e instanceof HTMLElement&&e!==n;)(e.offsetHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)&&t.push({element:e,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),e=e.parentNode;return n instanceof HTMLElement&&t.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),t}function CZ(i){for(let{element:e,scrollTop:t,scrollLeft:n}of i)e.scrollTop=t,e.scrollLeft=n}function jT(i){var e;if(typeof window>"u"||window.navigator==null)return!1;let t=(e=window.navigator.userAgentData)===null||e===void 0?void 0:e.brands;return Array.isArray(t)&&t.some(n=>i.test(n.brand))||i.test(window.navigator.userAgent)}function QR(i){var e;return typeof window<"u"&&window.navigator!=null?i.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function Mf(i){if(process.env.NODE_ENV==="test")return i;let e=null;return()=>(e==null&&(e=i()),e)}const Qb=Mf(function(){return QR(/^Mac/i)}),RZ=Mf(function(){return QR(/^iPhone/i)}),rI=Mf(function(){return QR(/^iPad/i)||Qb()&&navigator.maxTouchPoints>1}),DZ=Mf(function(){return RZ()||rI()});Mf(function(){return Qb()||DZ()});const OZ=Mf(function(){return jT(/AppleWebKit/i)&&!LZ()}),LZ=Mf(function(){return jT(/Chrome/i)}),NZ=Mf(function(){return jT(/Android/i)}),kZ=Mf(function(){return jT(/Firefox/i)});function e1(i,e,t=!0){var n,r;let{metaKey:o,ctrlKey:l,altKey:u,shiftKey:h}=e;kZ()&&(!((r=window.event)===null||r===void 0||(n=r.type)===null||n===void 0)&&n.startsWith("key"))&&i.target==="_blank"&&(Qb()?o=!0:l=!0);let m=OZ()&&Qb()&&!rI()&&process.env.NODE_ENV!=="test"?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:o,ctrlKey:l,altKey:u,shiftKey:h}):new MouseEvent("click",{metaKey:o,ctrlKey:l,altKey:u,shiftKey:h,detail:1,bubbles:!0,cancelable:!0});e1.isOpening=t,MZ(i),i.dispatchEvent(m),e1.isOpening=!1}e1.isOpening=!1;function aI(){let i=te.useRef(new Map),e=te.useCallback((r,o,l,u)=>{let h=u?.once?(...m)=>{i.current.delete(l),l(...m)}:l;i.current.set(l,{type:o,eventTarget:r,fn:h,options:u}),r.addEventListener(o,h,u)},[]),t=te.useCallback((r,o,l,u)=>{var h;let m=((h=i.current.get(l))===null||h===void 0?void 0:h.fn)||l;r.removeEventListener(o,m,u),i.current.delete(l)},[]),n=te.useCallback(()=>{i.current.forEach((r,o)=>{t(r.eventTarget,r.type,o,r.options)})},[t]);return te.useEffect(()=>n,[n]),{addGlobalListener:e,removeGlobalListener:t,removeAllGlobalListeners:n}}function UZ(i){return i.pointerType===""&&i.isTrusted?!0:NZ()&&i.pointerType?i.type==="click"&&i.buttons===1:i.detail===0&&!i.pointerType}function sI(i){let e=i;return e.nativeEvent=i,e.isDefaultPrevented=()=>e.defaultPrevented,e.isPropagationStopped=()=>e.cancelBubble,e.persist=()=>{},e}function IZ(i,e){Object.defineProperty(i,"target",{value:e}),Object.defineProperty(i,"currentTarget",{value:e})}function oI(i){let e=te.useRef({isFocused:!1,observer:null});return xZ(()=>{const t=e.current;return()=>{t.observer&&(t.observer.disconnect(),t.observer=null)}},[]),te.useCallback(t=>{if(t.target instanceof HTMLButtonElement||t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLSelectElement){e.current.isFocused=!0;let n=t.target,r=o=>{if(e.current.isFocused=!1,n.disabled){let l=sI(o);i?.(l)}e.current.observer&&(e.current.observer.disconnect(),e.current.observer=null)};n.addEventListener("focusout",r,{once:!0}),e.current.observer=new MutationObserver(()=>{if(e.current.isFocused&&n.disabled){var o;(o=e.current.observer)===null||o===void 0||o.disconnect();let l=n===document.activeElement?null:document.activeElement;n.dispatchEvent(new FocusEvent("blur",{relatedTarget:l})),n.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:l}))}}),e.current.observer.observe(n,{attributes:!0,attributeFilter:["disabled"]})}},[i])}let zZ=!1,t1=null,eD=new Set,n1=new Map,Om=!1,tD=!1;const BZ={Tab:!0,Escape:!0};function nD(i,e){for(let t of eD)t(i,e)}function PZ(i){return!(i.metaKey||!Qb()&&i.altKey||i.ctrlKey||i.key==="Control"||i.key==="Shift"||i.key==="Meta")}function $T(i){Om=!0,!e1.isOpening&&PZ(i)&&(t1="keyboard",nD("keyboard",i))}function yl(i){t1="pointer","pointerType"in i&&i.pointerType,(i.type==="mousedown"||i.type==="pointerdown")&&(Om=!0,nD("pointer",i))}function lI(i){!e1.isOpening&&UZ(i)&&(Om=!0,t1="virtual")}function cI(i){i.target===window||i.target===document||zZ||!i.isTrusted||(!Om&&!tD&&(t1="virtual",nD("virtual",i)),Om=!1,tD=!1)}function uI(){Om=!1,tD=!0}function iD(i){if(typeof window>"u"||typeof document>"u"||n1.get(Dm(i)))return;const e=Dm(i),t=oh(i);let n=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){Om=!0,n.apply(this,arguments)},t.addEventListener("keydown",$T,!0),t.addEventListener("keyup",$T,!0),t.addEventListener("click",lI,!0),e.addEventListener("focus",cI,!0),e.addEventListener("blur",uI,!1),typeof PointerEvent<"u"?(t.addEventListener("pointerdown",yl,!0),t.addEventListener("pointermove",yl,!0),t.addEventListener("pointerup",yl,!0)):process.env.NODE_ENV==="test"&&(t.addEventListener("mousedown",yl,!0),t.addEventListener("mousemove",yl,!0),t.addEventListener("mouseup",yl,!0)),e.addEventListener("beforeunload",()=>{fI(i)},{once:!0}),n1.set(e,{focus:n})}const fI=(i,e)=>{const t=Dm(i),n=oh(i);e&&n.removeEventListener("DOMContentLoaded",e),n1.has(t)&&(t.HTMLElement.prototype.focus=n1.get(t).focus,n.removeEventListener("keydown",$T,!0),n.removeEventListener("keyup",$T,!0),n.removeEventListener("click",lI,!0),t.removeEventListener("focus",cI,!0),t.removeEventListener("blur",uI,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",yl,!0),n.removeEventListener("pointermove",yl,!0),n.removeEventListener("pointerup",yl,!0)):process.env.NODE_ENV==="test"&&(n.removeEventListener("mousedown",yl,!0),n.removeEventListener("mousemove",yl,!0),n.removeEventListener("mouseup",yl,!0)),n1.delete(t))};function FZ(i){const e=oh(i);let t;return e.readyState!=="loading"?iD(i):(t=()=>{iD(i)},e.addEventListener("DOMContentLoaded",t)),()=>fI(i,t)}typeof document<"u"&&FZ();function dI(){return t1!=="pointer"}const HZ=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function VZ(i,e,t){let n=oh(t?.target);const r=typeof window<"u"?Dm(t?.target).HTMLInputElement:HTMLInputElement,o=typeof window<"u"?Dm(t?.target).HTMLTextAreaElement:HTMLTextAreaElement,l=typeof window<"u"?Dm(t?.target).HTMLElement:HTMLElement,u=typeof window<"u"?Dm(t?.target).KeyboardEvent:KeyboardEvent;return i=i||n.activeElement instanceof r&&!HZ.has(n.activeElement.type)||n.activeElement instanceof o||n.activeElement instanceof l&&n.activeElement.isContentEditable,!(i&&e==="keyboard"&&t instanceof u&&!BZ[t.key])}function GZ(i,e,t){iD(),te.useEffect(()=>{let n=(r,o)=>{VZ(!!t?.isTextInput,r,o)&&i(dI())};return eD.add(n),()=>{eD.delete(n)}},e)}function jZ(i){let{isDisabled:e,onFocus:t,onBlur:n,onFocusChange:r}=i;const o=te.useCallback(h=>{if(h.target===h.currentTarget)return n&&n(h),r&&r(!1),!0},[n,r]),l=oI(o),u=te.useCallback(h=>{const m=oh(h.target),_=m?JR(m):JR();h.target===h.currentTarget&&_===iI(h.nativeEvent)&&(t&&t(h),r&&r(!0),l(h))},[r,t,l]);return{focusProps:{onFocus:!e&&(t||r||n)?u:void 0,onBlur:!e&&(n||r)?o:void 0}}}function $Z(i){let{isDisabled:e,onBlurWithin:t,onFocusWithin:n,onFocusWithinChange:r}=i,o=te.useRef({isFocusWithin:!1}),{addGlobalListener:l,removeAllGlobalListeners:u}=aI(),h=te.useCallback(p=>{p.currentTarget.contains(p.target)&&o.current.isFocusWithin&&!p.currentTarget.contains(p.relatedTarget)&&(o.current.isFocusWithin=!1,u(),t&&t(p),r&&r(!1))},[t,r,o,u]),m=oI(h),_=te.useCallback(p=>{if(!p.currentTarget.contains(p.target))return;const y=oh(p.target),x=JR(y);if(!o.current.isFocusWithin&&x===iI(p.nativeEvent)){n&&n(p),r&&r(!0),o.current.isFocusWithin=!0,m(p);let T=p.currentTarget;l(y,"focus",M=>{if(o.current.isFocusWithin&&!nI(T,M.target)){let A=new y.defaultView.FocusEvent("blur",{relatedTarget:M.target});IZ(A,T);let w=sI(A);h(w)}},{capture:!0})}},[n,r,m,l,h]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:_,onBlur:h}}}let XT=!1,qT=0;function rD(){XT=!0,setTimeout(()=>{XT=!1},50)}function hI(i){i.pointerType==="touch"&&rD()}function XZ(){if(!(typeof document>"u"))return qT===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",hI):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",rD)),qT++,()=>{qT--,!(qT>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",hI):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",rD))}}function pI(i){let{onHoverStart:e,onHoverChange:t,onHoverEnd:n,isDisabled:r}=i,[o,l]=te.useState(!1),u=te.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;te.useEffect(XZ,[]);let{addGlobalListener:h,removeAllGlobalListeners:m}=aI(),{hoverProps:_,triggerHoverEnd:p}=te.useMemo(()=>{let y=(M,A)=>{if(u.pointerType=A,r||A==="touch"||u.isHovered||!M.currentTarget.contains(M.target))return;u.isHovered=!0;let w=M.currentTarget;u.target=w,h(oh(M.target),"pointerover",L=>{u.isHovered&&u.target&&!nI(u.target,L.target)&&x(L,L.pointerType)},{capture:!0}),e&&e({type:"hoverstart",target:w,pointerType:A}),t&&t(!0),l(!0)},x=(M,A)=>{let w=u.target;u.pointerType="",u.target=null,!(A==="touch"||!u.isHovered||!w)&&(u.isHovered=!1,m(),n&&n({type:"hoverend",target:w,pointerType:A}),t&&t(!1),l(!1))},T={};return typeof PointerEvent<"u"?(T.onPointerEnter=M=>{XT&&M.pointerType==="mouse"||y(M,M.pointerType)},T.onPointerLeave=M=>{!r&&M.currentTarget.contains(M.target)&&x(M,M.pointerType)}):process.env.NODE_ENV==="test"&&(T.onTouchStart=()=>{u.ignoreEmulatedMouseEvents=!0},T.onMouseEnter=M=>{!u.ignoreEmulatedMouseEvents&&!XT&&y(M,"mouse"),u.ignoreEmulatedMouseEvents=!1},T.onMouseLeave=M=>{!r&&M.currentTarget.contains(M.target)&&x(M,"mouse")}),{hoverProps:T,triggerHoverEnd:x}},[e,t,n,r,u,h,m]);return te.useEffect(()=>{r&&p({currentTarget:u.target},u.pointerType)},[r]),{hoverProps:_,isHovered:o}}function mI(i={}){let{autoFocus:e=!1,isTextInput:t,within:n}=i,r=te.useRef({isFocused:!1,isFocusVisible:e||dI()}),[o,l]=te.useState(!1),[u,h]=te.useState(()=>r.current.isFocused&&r.current.isFocusVisible),m=te.useCallback(()=>h(r.current.isFocused&&r.current.isFocusVisible),[]),_=te.useCallback(x=>{r.current.isFocused=x,l(x),m()},[m]);GZ(x=>{r.current.isFocusVisible=x,m()},[],{isTextInput:t});let{focusProps:p}=jZ({isDisabled:n,onFocusChange:_}),{focusWithinProps:y}=$Z({isDisabled:!n,onFocusWithinChange:_});return{isFocused:o,isFocusVisible:u,focusProps:n?y:p}}var qZ=Object.defineProperty,YZ=(i,e,t)=>e in i?qZ(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,aD=(i,e,t)=>(YZ(i,typeof e!="symbol"?e+"":e,t),t);let WZ=class{constructor(){aD(this,"current",this.detect()),aD(this,"handoffState","pending"),aD(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},gI=new WZ;function ZZ(i){var e;return gI.isServer?null:i==null?document:(e=i?.ownerDocument)!=null?e:document}function KZ(i){typeof queueMicrotask=="function"?queueMicrotask(i):Promise.resolve().then(i).catch(e=>setTimeout(()=>{throw e}))}function vI(){let i=[],e={addEventListener(t,n,r,o){return t.addEventListener(n,r,o),e.add(()=>t.removeEventListener(n,r,o))},requestAnimationFrame(...t){let n=requestAnimationFrame(...t);return e.add(()=>cancelAnimationFrame(n))},nextFrame(...t){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...t))},setTimeout(...t){let n=setTimeout(...t);return e.add(()=>clearTimeout(n))},microTask(...t){let n={current:!0};return KZ(()=>{n.current&&t[0]()}),e.add(()=>{n.current=!1})},style(t,n,r){let o=t.style.getPropertyValue(n);return Object.assign(t.style,{[n]:r}),this.add(()=>{Object.assign(t.style,{[n]:o})})},group(t){let n=vI();return t(n),this.add(()=>n.dispose())},add(t){return i.includes(t)||i.push(t),()=>{let n=i.indexOf(t);if(n>=0)for(let r of i.splice(n,1))r()}},dispose(){for(let t of i.splice(0))t()}};return e}function JZ(){let[i]=te.useState(vI);return te.useEffect(()=>()=>i.dispose(),[i]),i}let sD=(i,e)=>{gI.isServer?te.useEffect(i,e):te.useLayoutEffect(i,e)};function QZ(i){let e=te.useRef(i);return sD(()=>{e.current=i},[i]),e}let YT=function(i){let e=QZ(i);return tm.useCallback((...t)=>e.current(...t),[e])};function eK(i){let e=i.width/2,t=i.height/2;return{top:i.clientY-t,right:i.clientX+e,bottom:i.clientY+t,left:i.clientX-e}}function tK(i,e){return!(!i||!e||i.right<e.left||i.left>e.right||i.bottom<e.top||i.top>e.bottom)}function nK({disabled:i=!1}={}){let e=te.useRef(null),[t,n]=te.useState(!1),r=JZ(),o=YT(()=>{e.current=null,n(!1),r.dispose()}),l=YT(u=>{if(r.dispose(),e.current===null){e.current=u.currentTarget,n(!0);{let h=ZZ(u.currentTarget);r.addEventListener(h,"pointerup",o,!1),r.addEventListener(h,"pointermove",m=>{if(e.current){let _=eK(m);n(tK(_,e.current.getBoundingClientRect()))}},!1),r.addEventListener(h,"pointercancel",o,!1)}}});return{pressed:t,pressProps:i?{}:{onPointerDown:l,onPointerUp:o,onClick:o}}}function WT(i){return te.useMemo(()=>i,Object.values(i))}let iK=te.createContext(void 0);function ZT(){return te.useContext(iK)}function yI(...i){return Array.from(new Set(i.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function _I(i,e,...t){if(i in e){let r=e[i];return typeof r=="function"?r(...t):r}let n=new Error(`Tried to handle "${i}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(r=>`"${r}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,_I),n}var rK=(i=>(i[i.None=0]="None",i[i.RenderStrategy=1]="RenderStrategy",i[i.Static=2]="Static",i))(rK||{}),aK=(i=>(i[i.Unmount=0]="Unmount",i[i.Hidden=1]="Hidden",i))(aK||{});function KT(){let i=oK();return te.useCallback(e=>sK({mergeRefs:i,...e}),[i])}function sK({ourProps:i,theirProps:e,slot:t,defaultTag:n,features:r,visible:o=!0,name:l,mergeRefs:u}){u=u??lK;let h=bI(e,i);if(o)return JT(h,t,n,l,u);let m=r??0;if(m&2){let{static:_=!1,...p}=h;if(_)return JT(p,t,n,l,u)}if(m&1){let{unmount:_=!0,...p}=h;return _I(_?0:1,{0(){return null},1(){return JT({...p,hidden:!0,style:{display:"none"}},t,n,l,u)}})}return JT(h,t,n,l,u)}function JT(i,e={},t,n,r){let{as:o=t,children:l,refName:u="ref",...h}=oD(i,["unmount","static"]),m=i.ref!==void 0?{[u]:i.ref}:{},_=typeof l=="function"?l(e):l;"className"in h&&h.className&&typeof h.className=="function"&&(h.className=h.className(e)),h["aria-labelledby"]&&h["aria-labelledby"]===h.id&&(h["aria-labelledby"]=void 0);let p={};if(e){let y=!1,x=[];for(let[T,M]of Object.entries(e))typeof M=="boolean"&&(y=!0),M===!0&&x.push(T.replace(/([A-Z])/g,A=>`-${A.toLowerCase()}`));if(y){p["data-headlessui-state"]=x.join(" ");for(let T of x)p[`data-${T}`]=""}}if(eM(o)&&(Object.keys(Ov(h)).length>0||Object.keys(Ov(p)).length>0))if(!te.isValidElement(_)||Array.isArray(_)&&_.length>1||uK(_)){if(Object.keys(Ov(h)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Ov(h)).concat(Object.keys(Ov(p))).map(y=>` - ${y}`).join(`
|
|
4551
4551
|
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(y=>` - ${y}`).join(`
|
|
4552
4552
|
`)].join(`
|
|
4553
|
-
`))}else{let y=_.props,x=y?.className,T=typeof x=="function"?(...w)=>yI(x(...w),h.className):yI(x,h.className),M=T?{className:T}:{},A=bI(_.props,Ov(oD(h,["ref"])));for(let w in p)w in A&&delete p[w];return te.cloneElement(_,Object.assign({},A,p,m,{ref:r(cK(_),m.ref)},M))}return te.createElement(o,Object.assign({},oD(h,["ref"]),!eM(o)&&m,!eM(o)&&p),_)}function oK(){let i=te.useRef([]),e=te.useCallback(t=>{for(let n of i.current)n!=null&&(typeof n=="function"?n(t):n.current=t)},[]);return(...t)=>{if(!t.every(n=>n==null))return i.current=t,e}}function lK(...i){return i.every(e=>e==null)?void 0:e=>{for(let t of i)t!=null&&(typeof t=="function"?t(e):t.current=e)}}function bI(...i){if(i.length===0)return{};if(i.length===1)return i[0];let e={},t={};for(let n of i)for(let r in n)r.startsWith("on")&&typeof n[r]=="function"?(t[r]!=null||(t[r]=[]),t[r].push(n[r])):e[r]=n[r];if(e.disabled||e["aria-disabled"])for(let n in t)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(n)&&(t[n]=[r=>{var o;return(o=r?.preventDefault)==null?void 0:o.call(r)}]);for(let n in t)Object.assign(e,{[n](r,...o){let l=t[n];for(let u of l){if((r instanceof Event||r?.nativeEvent instanceof Event)&&r.defaultPrevented)return;u(r,...o)}}});return e}function xI(...i){if(i.length===0)return{};if(i.length===1)return i[0];let e={},t={};for(let n of i)for(let r in n)r.startsWith("on")&&typeof n[r]=="function"?(t[r]!=null||(t[r]=[]),t[r].push(n[r])):e[r]=n[r];for(let n in t)Object.assign(e,{[n](...r){let o=t[n];for(let l of o)l?.(...r)}});return e}function QT(i){var e;return Object.assign(te.forwardRef(i),{displayName:(e=i.displayName)!=null?e:i.name})}function Ov(i){let e=Object.assign({},i);for(let t in e)e[t]===void 0&&delete e[t];return e}function oD(i,e=[]){let t=Object.assign({},i);for(let n of e)n in t&&delete t[n];return t}function cK(i){return tm.version.split(".")[0]>="19"?i.props.ref:i.ref}function eM(i){return i===te.Fragment||i===Symbol.for("react.fragment")}function uK(i){return eM(i.type)}let fK="button";function dK(i,e){var t;let n=ZT(),{disabled:r=n||!1,autoFocus:o=!1,...l}=i,{isFocusVisible:u,focusProps:h}=mI({autoFocus:o}),{isHovered:m,hoverProps:_}=pI({isDisabled:r}),{pressed:p,pressProps:y}=nK({disabled:r}),x=xI({ref:e,type:(t=l.type)!=null?t:"button",disabled:r||void 0,autoFocus:o},h,_,y),T=WT({disabled:r,hover:m,focus:u,active:p,autofocus:o});return KT()({ourProps:x,theirProps:l,slot:T,defaultTag:fK,name:"Button"})}let wf=QT(dK),hK=te.createContext(void 0);function SI(){return te.useContext(hK)}function pK(i){return typeof i!="object"||i===null?!1:"nodeType"in i}function EI(i){return pK(i)&&"tagName"in i}function TI(i){return EI(i)&&"accessKey"in i}function mK(i){return TI(i)&&i.nodeName==="INPUT"}function MI(i){return TI(i)&&i.nodeName==="LABEL"}function gK(i){return EI(i)?i.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}let vK=Symbol();function wI(...i){let e=te.useRef(i);te.useEffect(()=>{e.current=i},[i]);let t=YT(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)});return i.every(n=>n==null||n?.[vK])?void 0:t}let lD=te.createContext(null);lD.displayName="DescriptionContext";function AI(){let i=te.useContext(lD);if(i===null){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,AI),e}return i}function yK(){var i,e;return(e=(i=te.useContext(lD))==null?void 0:i.value)!=null?e:void 0}let _K="p";function bK(i,e){let t=te.useId(),n=ZT(),{id:r=`headlessui-description-${t}`,...o}=i,l=AI(),u=wI(e);sD(()=>l.register(r),[r,l.register]);let h=WT({...l.slot,disabled:n||!1}),m={ref:u,...l.props,id:r};return KT()({ourProps:m,theirProps:o,slot:h,defaultTag:_K,name:l.name||"Description"})}let xK=QT(bK);Object.assign(xK,{});let cD=te.createContext(null);cD.displayName="LabelContext";function CI(){let i=te.useContext(cD);if(i===null){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,CI),e}return i}function SK(i){var e,t,n;let r=(t=(e=te.useContext(cD))==null?void 0:e.value)!=null?t:void 0;return((n=void 0)!=null?n:0)>0?[r,...i].filter(Boolean).join(" "):r}let EK="label";function TK(i,e){var t;let n=te.useId(),r=CI(),o=SI(),l=ZT(),{id:u=`headlessui-label-${n}`,htmlFor:h=o??((t=r.props)==null?void 0:t.htmlFor),passive:m=!1,..._}=i,p=wI(e);sD(()=>r.register(u),[u,r.register]);let y=YT(M=>{let A=M.currentTarget;if(!(M.target!==M.currentTarget&&gK(M.target))&&(MI(A)&&M.preventDefault(),r.props&&"onClick"in r.props&&typeof r.props.onClick=="function"&&r.props.onClick(M),MI(A))){let w=document.getElementById(A.htmlFor);if(w){let L=w.getAttribute("disabled");if(L==="true"||L==="")return;let N=w.getAttribute("aria-disabled");if(N==="true"||N==="")return;(mK(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),x=WT({...r.slot,disabled:l||!1}),T={ref:p,...r.props,id:u,htmlFor:h,onClick:y};return m&&("onClick"in T&&(delete T.htmlFor,delete T.onClick),"onClick"in _&&delete _.onClick),KT()({ourProps:T,theirProps:_,slot:x,defaultTag:h?EK:"div",name:r.name||"Label"})}let MK=QT(TK);Object.assign(MK,{});let wK="textarea";function AK(i,e){let t=te.useId(),n=SI(),r=ZT(),{id:o=n||`headlessui-textarea-${t}`,disabled:l=r||!1,autoFocus:u=!1,invalid:h=!1,...m}=i,_=SK(),p=yK(),{isFocused:y,focusProps:x}=mI({autoFocus:u}),{isHovered:T,hoverProps:M}=pI({isDisabled:l}),A=xI({ref:e,id:o,"aria-labelledby":_,"aria-describedby":p,"aria-invalid":h?"true":void 0,disabled:l||void 0,autoFocus:u},x,M),w=WT({disabled:l,invalid:h,hover:T,focus:y,autofocus:u});return KT()({ourProps:A,theirProps:m,slot:w,defaultTag:wK,name:"Textarea"})}let CK=QT(AK);const RK=i=>te.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...i},te.createElement("path",{d:"M8 1.25C6.66498 1.25 5.35994 1.64588 4.2499 2.38758C3.13987 3.12928 2.27471 4.18349 1.76382 5.41689C1.25292 6.65029 1.11925 8.00749 1.3797 9.31686C1.64015 10.6262 2.28303 11.829 3.22703 12.773C4.17104 13.717 5.37377 14.3598 6.68314 14.6203C7.99252 14.8808 9.34971 14.7471 10.5831 14.2362C11.8165 13.7253 12.8707 12.8601 13.6124 11.7501C14.3541 10.6401 14.75 9.33502 14.75 8C14.748 6.2104 14.0362 4.49466 12.7708 3.22922C11.5053 1.96378 9.78961 1.25199 8 1.25ZM8 13.25C6.96165 13.25 5.94662 12.9421 5.08326 12.3652C4.2199 11.7883 3.547 10.9684 3.14964 10.0091C2.75228 9.04978 2.64831 7.99418 2.85088 6.97578C3.05345 5.95738 3.55347 5.02191 4.28769 4.28769C5.02192 3.55346 5.95738 3.05345 6.97578 2.85088C7.99418 2.6483 9.04978 2.75227 10.0091 3.14963C10.9684 3.54699 11.7883 4.2199 12.3652 5.08326C12.9421 5.94661 13.25 6.96165 13.25 8C13.2485 9.39193 12.6949 10.7264 11.7107 11.7107C10.7264 12.6949 9.39193 13.2485 8 13.25ZM7.25 8.25V5C7.25 4.80109 7.32902 4.61032 7.46967 4.46967C7.61032 4.32902 7.80109 4.25 8 4.25C8.19892 4.25 8.38968 4.32902 8.53033 4.46967C8.67098 4.61032 8.75 4.80109 8.75 5V8.25C8.75 8.44891 8.67098 8.63968 8.53033 8.78033C8.38968 8.92098 8.19892 9 8 9C7.80109 9 7.61032 8.92098 7.46967 8.78033C7.32902 8.63968 7.25 8.44891 7.25 8.25ZM9 10.75C9 10.9478 8.94135 11.1411 8.83147 11.3056C8.72159 11.47 8.56541 11.5982 8.38269 11.6739C8.19996 11.7496 7.99889 11.7694 7.80491 11.7308C7.61093 11.6922 7.43275 11.597 7.2929 11.4571C7.15304 11.3173 7.0578 11.1391 7.01922 10.9451C6.98063 10.7511 7.00044 10.55 7.07612 10.3673C7.15181 10.1846 7.27998 10.0284 7.44443 9.91853C7.60888 9.80865 7.80222 9.75 8 9.75C8.26522 9.75 8.51957 9.85536 8.70711 10.0429C8.89465 10.2304 9 10.4848 9 10.75Z",fill:"currentColor"}));function RI({message:i,className:e,...t}){return $e.jsxs("div",{...t,className:Co("message flex h-fit min-h-9 w-fit max-w-70 flex-row items-center justify-center gap-1 bg-black",e),children:[$e.jsx(RK,{}),$e.jsx("span",{children:i})]})}let tM=()=>({emit(i,...e){for(let t=this.events[i]||[],n=0,r=t.length;n<r;n++)t[n](...e)},events:{},on(i,e){return(this.events[i]||=[]).push(e),()=>{this.events[i]=this.events[i]?.filter(t=>e!==t)}}});class i1 extends Error{constructor(e,t){e instanceof Error?(super(e.message),this.cause=e):super(e),this.reason=t,this.name="ReasonError"}}class DI extends i1{constructor(e){super("Rejected",e),this.name="SubscriptionRejectedError"}}class DK extends i1{constructor(e){super(e||"Timed out to receive subscription ack"),this.name="SubscriptionTimeoutError"}}class _c extends i1{constructor(e,t){t?super(e,t):super("Disconnected",e),this.name="DisconnectedError"}}class OK extends _c{constructor(e){super(e,"stale_connection"),this.name="StaleConnectionError"}}function OI(i){return i?`{${Object.keys(i).sort().filter(t=>i[t]!==void 0).map(t=>{let n=JSON.stringify(i[t]);return`${JSON.stringify(t)}:${n}`}).join(",")}}`:""}class LK{constructor(e){this.channel=e,this.listeners=[]}watch(){this.listeners.push(this.channel.on("presence",e=>{if(e.type==="info"){this._state||(this._state=this.stateFromInfo(e));return}this._state&&(e.type==="join"?this._state[e.id]=e.info:e.type==="leave"&&delete this._state[e.id])}))}reset(){delete this._state}dispose(){delete this._info,delete this._state,this.listeners.forEach(e=>e()),this.listeners.length=0}async join(e,t){if(!this._info)return this._info={id:e,info:t},this.channel.perform("$presence:join",this._info)}async leave(){if(!this._info)return;let e=await this.channel.perform("$presence:leave");return delete this._info,e}async info(){return this._state?this._state:(this._promise||(this._promise=this._sync()),await this._promise,this._state)}async _sync(){this.watch();try{let e=await this.channel.perform("$presence:info",{});return this._state=this.stateFromInfo(e),this._state}finally{delete this._promise}}stateFromInfo(e){return e.records.reduce((t,{id:n,info:r})=>(t[n]=r,t),{})}}const Lm=Symbol("state");class uD{constructor(e={}){this.emitter=tM(),this.params=Object.freeze(e),this.presence=new LK(this),this.initialConnect=!0,this[Lm]="idle"}get identifier(){return this._identifier?this._identifier:(this._identifier=OI({channel:this.channelId,...this.params}),this._identifier)}get channelId(){return this.constructor.identifier}get state(){return this[Lm]}attached(e){if(this.receiver){if(this.receiver!==e)throw Error("Already connected to a different receiver");return!1}return this.receiver=e,!0}connecting(){this[Lm]="connecting"}connected(){if(this.state==="connected"||this.state==="closed")return;this[Lm]="connected";let e=!1;this.initialConnect?(this.initialConnect=!1,this.emit("connect",{reconnect:!1,restored:e})):this.emit("connect",{reconnect:!0,restored:e})}restored(){if(this.state==="connected")throw Error("Already connected");this[Lm]="connected";let e=!0,t=!0;this.initialConnect=!1,this.emit("connect",{reconnect:t,restored:e})}disconnected(e){this.state==="disconnected"||this.state==="closed"||(this[Lm]="disconnected",this.presence.reset(),this.emit("disconnect",e))}closed(e){this.state!=="closed"&&(this[Lm]="closed",delete this.receiver,this.initialConnect=!0,this.presence.dispose(),this.emit("close",e))}disconnect(){this.state==="idle"||this.state==="closed"||this.receiver.unsubscribe(this)}async perform(e,t){if(this.state==="idle"||this.state==="closed")throw Error("Channel is not subscribed");return this.receiver.perform(this.identifier,e,t)}async send(e){return this.perform(void 0,e)}async whisper(e){try{await this.perform("$whisper",e)}catch(t){let n=this.receiver?this.receiver.logger:null;n&&n.warn("whisper failed: ",t)}}receive(e,t){this.emit("message",e,t)}on(e,t){return this.emitter.on(e,t)}once(e,t){let n=this.emitter.on(e,(...r)=>{n(),t(...r)});return n}emit(e,...t){return this.emitter.emit(e,...t)}ensureSubscribed(){return this.state==="connected"?Promise.resolve():this.state==="closed"?Promise.reject(Error("Channel is unsubscribed")):this.pendingSubscribe()}pendingSubscribe(){return this._pendingSubscribe?this._pendingSubscribe:(this._pendingSubscribe=new Promise((e,t)=>{let n=[()=>delete this._pendingSubscribe];n.push(this.on("connect",()=>{n.forEach(r=>r()),e()})),n.push(this.on("close",r=>{n.forEach(o=>o()),t(r||new i1("Channel was disconnected before subscribing","canceled"))}))}),this._pendingSubscribe)}}class NK{constructor(e){this.id=e,this.intent="unsubscribed",this.state="idle",this.channels=[],this.disposed=!1,this._pendings=[]}add(e){this.channels.includes(e)||this.channels.push(e)}remove(e){let t=this.channels.indexOf(e);t>-1&&this.channels.splice(t,1)}notify(e,...t){this.state=e==="restored"?"connected":e,t.length===1?this.channels.forEach(n=>n[e](t[0])):this.channels.forEach(n=>n[e]())}pending(e){this._checkIntent(e);let t=this._pendings[0];return!t||t.intent!==e?Promise.resolve():t.promise}ensureResubscribed(){this.disposed||(this.intent=void 0,this.ensureSubscribed())}ensureSubscribed(){if(this.intent==="subscribed")return;if(this.disposed)throw Error("Subscription is disposed");this.intent="subscribed",!this._mergeWithPending("unsubscribed")&&this.subscriber(this)}maybeUnsubscribe(){this.disposed||this.intent==="unsubscribed"||this.channels.length>0||(this.intent="unsubscribed",this._mergeWithPending("subscribed"))||this.unsubscriber(this)}async acquire(e){this._checkIntent(e);let t,r={promise:new Promise(l=>{t=l}),intent:e,release:()=>{this._pendings.splice(this._pendings.indexOf(r),1),t(r)},canceled:!1,acquired:!1},o=this._pendingTop;return this._pendings.push(r),o&&await o.promise,this.gvl&&await this.gvl.acquire(r,e),r.acquired=!0,r}close(e){this.disposed=!0,this.intent=void 0,this.notify("closed",e)}_checkIntent(e){if(!(e==="unsubscribed"||e==="subscribed"))throw Error(`Unknown subscription intent: ${e}`)}get _pendingTop(){return this._pendings.length?this._pendings[this._pendings.length-1]:void 0}_mergeWithPending(e){let t=this._pendingTop;return!t||t.acquired||t.intent!==e?!1:(this._pendings.pop(),t.canceled=!0,!0)}}class kK{constructor(){this.queue=[]}async acquire(e,t){t==="subscribed"&&(this.queue.push(e.promise.then(()=>{this.queue.splice(this.queue.indexOf(e),1)})),this.queue.length>1&&await this.queue[this.queue.length-2])}}class UK{constructor(e){e.concurrentSubscribes===!1&&(this.glv=new kK),this._subscriptions={},this._localToRemote={}}all(){return Object.values(this._subscriptions)}get(e){return this._subscriptions[e]}create(e,{subscribe:t,unsubscribe:n}){let r=this._subscriptions[e]=new NK(e);return r.remoteId=this._localToRemote[e],r.subscriber=t,r.unsubscriber=n,r.gvl=this.glv,r}remove(e){delete this._subscriptions[e],delete this._localToRemote[e]}storeRemoteId(e,t){this._localToRemote[e]=t;let n=this.get(e);n&&(n.remoteId=t)}}class IK{constructor(e={}){this.subscriptions=new UK(e),this._pendingMessages=[],this._remoteToLocal={}}subscribe(e,t){this._remoteToLocal[t]=e,this.subscriptions.storeRemoteId(e,t),this.flush(t)}unsubscribe(e){let t=this.subscriptions.get(e);if(!t)return;let n=t.remoteId;n&&delete this._remoteToLocal[n],this.subscriptions.remove(e)}transmit(e,t,n){let r=this._remoteToLocal[e];if(!r){this._pendingMessages.push([e,t,n]);return}let o=this.subscriptions.get(r);o&&o.channels.forEach(l=>{l.receive(t,n)})}notify(e,t,n){let r=this._remoteToLocal[e];if(!r)return;let o=this.subscriptions.get(r);o&&o.channels.forEach(l=>l.emit(t,n))}close(){this._pendingMessages.length=0}get size(){return this.channels.length}get channels(){return this.subscriptions.all().flatMap(e=>e.channels)}flush(e){let t=[];for(let n of this._pendingMessages)n[0]===e?this.transmit(n[0],n[1],n[2]):t.push(n);this._pendingMessages=t}}const LI={debug:0,info:1,warn:2,error:3};class NI{constructor(e){this.level=e||"warn"}log(e,t,n){LI[e]<LI[this.level]||this.writeLogEntry(e,t,n)}writeLogEntry(){throw Error("Not implemented")}debug(e,t){this.log("debug",e,t)}info(e,t){this.log("info",e,t)}warn(e,t){this.log("warn",e,t)}error(e,t){this.log("error",e,t)}}class r1 extends NI{writeLogEntry(){}}class zK{encode(e){return JSON.stringify(e)}decode(e){try{return JSON.parse(e)}catch{}}}let BK=0;class kI{constructor(e={}){let{logger:t}=e;this.logger=t||new r1,this.pendingSubscriptions={},this.pendingUnsubscriptions={},this.subscribeCooldownInterval=e.subscribeCooldownInterval||250,this.subscribeRetryInterval=e.subscribeRetryInterval||5e3}attached(e){this.cable=e}subscribe(e,t){let n={channel:e};t&&Object.assign(n,t);let r=OI(n);if(this.pendingUnsubscriptions[r]){let l=this.subscribeCooldownInterval*1.5;return this.logger.debug(`unsubscribed recently, cooldown for ${l}`,r),new Promise(u=>{setTimeout(()=>{u(this.subscribe(e,t))},l)})}if(this.pendingSubscriptions[r])return this.logger.warn("subscription is already pending, skipping",r),Promise.reject(Error("Already subscribing"));let o=this.subscribeRetryInterval;return new Promise((l,u)=>{let h=++BK;this.pendingSubscriptions[r]={resolve:l,reject:u,id:h},this.cable.send(this.buildSubscribeRequest(r)),this.maybeRetrySubscribe(h,r,o)})}buildSubscribeRequest(e){return{command:"subscribe",identifier:e}}maybeRetrySubscribe(e,t,n){setTimeout(()=>{let r=this.pendingSubscriptions[t];r&&r.id===e&&(this.logger.warn(`no subscription ack received in ${n}ms, retrying subscribe`,t),this.cable.send(this.buildSubscribeRequest(t)),this.maybeExpireSubscribe(e,t,n))},n)}maybeExpireSubscribe(e,t,n){setTimeout(()=>{let r=this.pendingSubscriptions[t];r&&r.id===e&&(delete this.pendingSubscriptions[t],r.reject(new DK(`Haven't received subscription ack in ${n*2}ms for ${t}`)))},n)}unsubscribe(e){return this.cable.send({command:"unsubscribe",identifier:e}),this.pendingUnsubscriptions[e]=!0,setTimeout(()=>{delete this.pendingUnsubscriptions[e]},this.subscribeCooldownInterval),Promise.resolve()}perform(e,t,n){return t==="$whisper"?this.whisper(e,n):(n||(n={}),n.action||=t,this.cable.send({command:"message",identifier:e,data:JSON.stringify(n)}),Promise.resolve())}whisper(e,t){return this.cable.send({command:"whisper",identifier:e,data:t}),Promise.resolve()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:t,identifier:n,message:r,reason:o,reconnect:l}=e;if(t==="ping")return this.cable.keepalive(e.message);if(this.cable.keepalive(),t==="welcome"){let u=e.sid;return u&&this.cable.setSessionId(u),this.cable.connected()}if(t==="disconnect"){let u=new _c(o);this.reset(u),l===!1?this.cable.closed(u):this.cable.disconnected(u);return}if(t==="confirm_subscription"){let u=this.pendingSubscriptions[n];if(!u){this.logger.error("subscription not found, unsubscribing",{type:t,identifier:n}),this.unsubscribe(n);return}return delete this.pendingSubscriptions[n],u.resolve(n)}if(t==="reject_subscription"){let u=this.pendingSubscriptions[n];return u?(delete this.pendingSubscriptions[n],u.reject(new DI)):this.logger.error("subscription not found",{type:t,identifier:n})}if(r)return{identifier:n,message:r};this.logger.warn(`unknown message type: ${t}`,{message:e})}reset(e){for(let t in this.pendingSubscriptions)this.pendingSubscriptions[t].reject(e);this.pendingSubscriptions={}}recoverableClosure(){return!1}}const UI=()=>Date.now()/1e3|0;class PK extends kI{constructor(e={}){super(e),this.streamsPositions={},this.subscriptionStreams={},this.pendingHistory={},this.pendingPresence={},this.presenceInfo={},this.restoreSince=e.historyTimestamp,this.disableSessionRecovery=e.disableSessionRecovery,this.restoreSince===void 0&&(this.restoreSince=UI()),this.sessionId=void 0,this.sendPongs=e.pongs}reset(e){for(let t in this.pendingPresence)this.pendingPresence[t].reject(e);return this.pendingPresence={},super.reset()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:t,identifier:n,message:r}=e;if(t==="disconnect")return delete this.sessionId,this.cable.setSessionId(""),super.receive(e);if(t==="reject_subscription")return super.receive(e);if(t==="confirm_subscription")return this.subscriptionStreams[n]||(this.subscriptionStreams[n]=new Set),super.receive(e);if(t==="ping")return this.restoreSince&&(this.restoreSince=UI()),this.sendPongs&&this.sendPong(),this.cable.keepalive(e.message);if(this.cable.keepalive(),t==="confirm_history"){this.logger.debug("history result received",e),this.cable.notify("history_received",n);return}if(t==="reject_history"){this.logger.warn("failed to retrieve history",e),this.cable.notify("history_not_found",n);return}if(t==="welcome"){if(this.disableSessionRecovery||(this.sessionId=e.sid,this.sessionId&&this.cable.setSessionId(this.sessionId)),e.restored){let o=e.restored_ids||Object.keys(this.subscriptionStreams);for(let l of o)this.cable.send({identifier:l,command:"history",history:this.historyRequestFor(l)}),this.presenceInfo[l]&&this.cable.send({identifier:l,command:"join",presence:this.presenceInfo[l]});return this.cable.restored(o)}return this.cable.connected(this.sessionId)}if(t==="presence"){let o=r.type;if(o==="info"){let l=this.pendingPresence[n];l&&(delete this.pendingPresence[n],l.resolve(r))}else if(o==="error"){let l=this.pendingPresence[n];l&&(delete this.pendingPresence[n],l.reject(new Error("failed to retrieve presence")))}return{type:t,identifier:n,message:r}}if(r){let o=this.trackStreamPosition(n,e.stream_id,e.epoch,e.offset);return{identifier:n,message:r,meta:o}}this.logger.warn(`unknown message type: ${t}`,{message:e})}perform(e,t,n){switch(t){case"$presence:join":return this.join(e,n);case"$presence:leave":return this.leave(e,n);case"$presence:info":return this.presence(e,n)}return super.perform(e,t,n)}unsubscribe(e){return delete this.presenceInfo[e],super.unsubscribe(e)}buildSubscribeRequest(e){let t=super.buildSubscribeRequest(e),n=this.historyRequestFor(e);n&&(t.history=n,this.pendingHistory[e]=!0);let r=this.presenceInfo[e];return r&&(t.presence=r),t}recoverableClosure(){return!!this.sessionId}historyRequestFor(e){let t={},n=!1;if(this.subscriptionStreams[e])for(let r of this.subscriptionStreams[e]){let o=this.streamsPositions[r];o&&(n=!0,t[r]=o)}if(!(!n&&!this.restoreSince))return{since:this.restoreSince,streams:t}}trackStreamPosition(e,t,n,r){if(!(!t||!n))return this.subscriptionStreams[e]||(this.subscriptionStreams[e]=new Set),this.subscriptionStreams[e].add(t),this.streamsPositions[t]={epoch:n,offset:r},{stream:t,epoch:n,offset:r}}async sendPong(){await new Promise(e=>setTimeout(e,0)),this.cable.state==="connected"&&this.cable.send({command:"pong"})}async join(e,t){return this.presenceInfo[e]=t,this.cable.send({command:"join",identifier:e,presence:t}),Promise.resolve()}async leave(e,t){return delete this.presenceInfo[e],this.cable.send({command:"leave",identifier:e,presence:t}),Promise.resolve()}presence(e,t){return this.pendingPresence[e]?(this.logger.warn("presence is already pending, skipping",e),Promise.reject(Error("presence request is already pending"))):new Promise((n,r)=>{this.pendingPresence[e]={resolve:n,reject:r},this.cable.send({command:"presence",identifier:e,data:t})})}}class FK extends i1{constructor(){super("No connection","closed"),this.name="NoConnectionError"}}class HK extends uD{static identifier="__ghost__";constructor(e,t){super(t),this.channelId=e}set channelId(e){this._channelId=e}get channelId(){return this._channelId}}const VK="$pubsub";class II extends uD{static identifier=VK;async perform(e,t){if(e.startsWith("$"))return super.perform(e,t);throw Error("not implemented")}}const Nm=Symbol("state");class GK{constructor({transport:e,protocol:t,encoder:n,logger:r,lazy:o,hubOptions:l,performFailures:u,transportConfigurator:h}){this.emitter=tM(),this.transport=e,this.encoder=n,this.logger=r||new r1,this.protocol=t,this.performFailures=u||"throw",this.protocol.attached(this),this.hub=new IK(l||{}),this[Nm]="idle",this.handleClose=this.handleClose.bind(this),this.handleIncoming=this.handleIncoming.bind(this),this.transportConfigurator=h,this.transport.on("close",this.handleClose),this.transport.on("data",this.handleIncoming),this.initialConnect=!0,this.recovering=!1,o===!1&&this.connect().catch(()=>{})}get state(){return this[Nm]}async connect(){if(this.state==="connected")return Promise.resolve();if(this.state==="connecting")return this.pendingConnect();let e=this.state==="idle";this[Nm]="connecting";let t=this.pendingConnect();this.logger.debug("connecting");try{this.transportConfigurator&&await this.transportConfigurator(this.transport,{initial:e}),await this.transport.open()}catch(n){this.handleClose(n)}return t}setSessionId(e){this.sessionId=e,this.transport.setParam("sid",e)}connected(){if(this.state==="connected")return;this.logger.info("connected"),this[Nm]="connected",this.recovering&&this.hub.subscriptions.all().forEach(t=>t.notify("disconnected",new _c("recovery_failed"))),this.hub.subscriptions.all().forEach(t=>this._resubscribe(t));let e=!1;this.recovering=!1,this.initialConnect?(this.initialConnect=!1,this.emit("connect",{reconnect:!1,restored:e})):this.emit("connect",{reconnect:!0,restored:e})}restored(e){this.logger.info("connection recovered",{remoteIds:e}),this[Nm]="connected",this.hub.subscriptions.all().forEach(r=>{e&&r.remoteId&&e.includes(r.remoteId)?r.notify("restored"):(r.notify("disconnected",new _c("recovery_failed")),this._resubscribe(r))});let t=!this.initialConnect,n=!0;this.recovering=!1,this.initialConnect=!1,this.emit("connect",{reconnect:t,restored:n})}notify(e,t,n){t&&typeof t!="string"&&(n=t,t=void 0),t?this.hub.notify(t,"info",{type:e,data:n}):this.emit("info",{type:e,data:n})}handleClose(e){this.logger.debug("transport closed",{error:e}),this.disconnected(new _c(e,"transport_closed"))}disconnected(e){(this.state==="connected"||this.state==="connecting")&&(this.logger.info("disconnected",{reason:e}),this[Nm]="disconnected",this.recovering=this.protocol.recoverableClosure(e),this.recovering?this.hub.subscriptions.all().forEach(t=>t.notify("connecting")):this.hub.subscriptions.all().forEach(t=>{t.notify("disconnected",e)}),this.protocol.reset(e),this.hub.close(),this.transport.close(),this.emit("disconnect",e))}closed(e){if(this.state==="closed"||this.state==="idle")return;let t;e&&(t=e instanceof _c?e:new _c(e,void 0)),this.logger.info("closed",{reason:e||"user"}),this[Nm]="closed";let n=t||new _c("cable_closed");this.hub.subscriptions.all().forEach(r=>r.notify("disconnected",n)),this.hub.close(),this.protocol.reset(),this.transport.close(),this.initialConnect=!0,this.emit("close",t)}disconnect(){this.closed()}handleIncoming(e){if(this.state==="closed"||this.state==="idle")return;let t=this.encoder.decode(e);if(t===void 0){this.logger.error("failed to decode message",{message:e});return}this.logger.debug("incoming data",t);let n=this.protocol.receive(t);if(n){this.logger.debug("processed incoming message",n);let{type:r,identifier:o,message:l,meta:u}=n;r?this.hub.notify(o,r,l):this.hub.transmit(o,l,u)}}send(e){if(this.state==="closed")throw Error("Cable is closed");let t=this.encoder.encode(e);if(t===void 0){this.logger.error("failed to encode message",{message:e});return}this.logger.debug("outgoing message",e),this.transport.send(t)}keepalive(e){this.emit("keepalive",e)}streamFrom(e){let t=new II({stream_name:e});return this.subscribe(t)}streamFromSigned(e){let t=new II({signed_stream_name:e});return this.subscribe(t)}subscribeTo(e,t){let n,r;return typeof e=="string"&&(r=e,e=HK),n=r?new e(r,t):new e(t),this.subscribe(n)}subscribe(e){if(!e.attached(this))return e;let t=e.identifier;e.connecting();let n=this.hub.subscriptions.get(t)||this.hub.subscriptions.create(t,{subscribe:r=>this._subscribe(r,e.channelId,e.params),unsubscribe:r=>this._unsubscribe(r)});return n.add(e),n.intent==="subscribed"&&n.state==="connected"&&e.connected(),n.ensureSubscribed(),e}async _resubscribe(e){e.intent!=="subscribed"||!e.channels[0]||(e.notify("connecting"),e.ensureResubscribed())}async _subscribe(e,t,n){let r=e.id;if(this.state==="idle"&&this.connect().catch(()=>{}),this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:r});return}this.logger.debug("acquiring subscribe lock",{identifier:r});let o=await e.acquire("subscribed");if(o.canceled){this.logger.debug("subscribe lock has been canceled",{identifier:r}),o.release();return}if(this.logger.debug("subscribe lock has been acquired",{identifier:r}),e.intent!=="subscribed"){this.logger.debug("cancel subscribe request, already unsubscribed"),o.release();return}if(this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:r}),o.release();return}if(e.state==="connected"){this.logger.debug("already connected, skip subscribe command",{identifier:r}),e.notify("connected"),o.release();return}let l={identifier:t,params:n};this.logger.debug("subscribing",l);try{let u=await this.protocol.subscribe(t,n);this.hub.subscribe(r,u),this.logger.debug("subscribed",{...l,remoteId:u}),e.notify("connected")}catch(u){if(u){if(u instanceof DI&&this.logger.warn("rejected",l),u instanceof _c){this.logger.debug("disconnected during subscription; will retry on connect",l),o.release();return}this.logger.error("failed to subscribe",{error:u,...l})}e.close(u),this.hub.unsubscribe(r)}o.release()}unsubscribe(e){let t=e.identifier,n=this.hub.subscriptions.get(t);if(!n)throw Error(`Subscription not found: ${t}`);n.remove(e),e.closed(),n.maybeUnsubscribe()}async _unsubscribe(e){let t=e.id;this.logger.debug("acquiring unsubscribe lock",{identifier:t});let n=await e.acquire("unsubscribed");if(n.canceled){this.logger.debug("unsubscribe lock has been canceled",{identifier:t}),n.release();return}if(this.logger.debug("unsubscribe lock has been acquired",{identifier:t}),e.intent!=="unsubscribed"){this.logger.debug("cancel unsubscribe, no longer needed",{identifier:t,intent:e.intent}),n.release();return}if(e.state==="disconnected"||e.state==="closed"){this.logger.debug(`already ${e.state} connected, skip unsubscribe command`,{identifier:t}),n.release();return}let r=e.remoteId;if(this.logger.debug("unsubscribing...",{remoteId:r}),this.state!=="connected"){this.logger.debug("unsubscribe skipped (cable is not connected)",{id:t}),e.close(),this.hub.unsubscribe(t),n.release();return}try{await this.protocol.unsubscribe(r),this.logger.debug("unsubscribed remotely",{id:t})}catch(o){o&&(o instanceof _c?this.logger.debug("cable disconnected during the unsubscribe command execution",{id:t,error:o}):this.logger.error("unsubscribe failed",{id:t,error:o}))}e.intent==="unsubscribed"?(e.close(),this.hub.unsubscribe(t)):e.state="closed",n.release()}async perform(e,t,n){if(this.performFailures==="throw")return this._perform(e,t,n);try{return await this._perform(e,t,n)}catch(r){this.performFailures==="warn"&&this.logger.warn("perform failed",{error:r});return}}async _perform(e,t,n){if(this.state==="connecting"&&await this.pendingConnect(),this.state==="closed"||this.state==="disconnected")throw new FK;let r=this.hub.subscriptions.get(e);if(!r)throw Error(`Subscription not found: ${e}`);if(await r.pending("subscribed"),r.intent!=="subscribed")throw Error(`Subscription is closed: ${e}`);let o=r.remoteId,l={id:o,action:t,payload:n};this.logger.debug("perform",l);try{let u=await this.protocol.perform(o,t,n);return u&&this.logger.debug("perform result",{message:u,request:l}),u}catch(u){throw this.logger.error("perform failed",{error:u,request:l}),u}}on(e,t){return this.emitter.on(e,t)}once(e,t){let n=this.emitter.on(e,(...r)=>{n(),t(...r)});return n}emit(e,...t){return this.emitter.emit(e,...t)}pendingConnect(){return this._pendingConnect?this._pendingConnect:(this._pendingConnect=new Promise((e,t)=>{let n=[()=>delete this._pendingConnect];n.push(this.on("connect",()=>{n.forEach(r=>r()),e()})),n.push(this.on("close",r=>{n.forEach(o=>o()),t(r)})),n.push(this.on("disconnect",r=>{n.forEach(o=>o()),t(r)}))}),this._pendingConnect)}}const jK={maxMissingPings:2,maxReconnectAttempts:1/0},Lv=()=>Date.now(),zI=(i,e)=>{e=e||{};let{backoffRate:t,jitterRatio:n,maxInterval:r}=e;return t=t||2,n===void 0&&(n=.5),o=>{let l=i*t**o,u=l*t,h=l+(u-l)*Math.random(),m=2*(Math.random()-.5)*n;return h=h*(1+m),r&&r<h&&(h=r),h}};let BI=class{constructor({pingInterval:e,...t}){if(this.pingInterval=e,!this.pingInterval)throw Error(`Incorrect pingInterval is provided: ${e}`);if(t=Object.assign({},jK,t),this.strategy=t.reconnectStrategy,!this.strategy)throw Error("Reconnect strategy must be provided");this.maxMissingPings=t.maxMissingPings,this.maxReconnectAttempts=t.maxReconnectAttempts,this.logger=t.logger||new r1,this.state="pending_connect",this.attempts=0,this.disconnectedAt=Lv()}watch(e){this.target=e,this.initListeners()}reconnectNow(){return this.state==="connected"||this.state==="pending_connect"||this.state==="closed"?!1:(this.cancelReconnect(),this.state="pending_connect",this.target.connect().catch(e=>{this.logger.info("Failed at reconnecting: "+e)}),!0)}initListeners(){this.unbind=[],this.unbind.push(this.target.on("connect",()=>{this.attempts=0,this.pingedAt=Lv(),this.state="connected",this.cancelReconnect(),this.startPolling()})),this.unbind.push(this.target.on("disconnect",()=>{this.disconnectedAt=Lv(),this.state="disconnected",this.stopPolling(),this.scheduleReconnect()})),this.unbind.push(this.target.on("close",()=>{this.disconnectedAt=Lv(),this.state="closed",this.cancelReconnect(),this.stopPolling()})),this.unbind.push(this.target.on("keepalive",()=>{this.pingedAt=Lv()})),this.unbind.push(()=>{this.cancelReconnect(),this.stopPolling()})}dispose(){delete this.target,this.unbind&&this.unbind.forEach(e=>e()),delete this.unbind}startPolling(){this.pollId&&clearTimeout(this.pollId);let e=this.pingInterval+(Math.random()-.5)*this.pingInterval*.5;this.pollId=setTimeout(()=>{this.checkStale(),this.state==="connected"&&this.startPolling()},e)}stopPolling(){this.pollId&&clearTimeout(this.pollId)}checkStale(){let e=Lv()-this.pingedAt;e>this.maxMissingPings*this.pingInterval&&(this.logger.warn(`Stale connection: ${e}ms without pings`),this.state="pending_disconnect",this.target.disconnected(new OK))}scheduleReconnect(){if(this.attempts>=this.maxReconnectAttempts){this.target.close();return}let e=this.strategy(this.attempts);this.attempts++,this.logger.info(`Reconnecting in ${e}ms (${this.attempts} attempt)`),this.state="pending_reconnect",this.reconnnectId=setTimeout(()=>this.reconnectNow(),e)}cancelReconnect(){this.reconnnectId&&(clearTimeout(this.reconnnectId),delete this.reconnnectId)}};class $K{constructor(e,t={}){this.transports=e,this.transport=null,this.emitter=tM(),this.unbind=[],this.logger=t.logger||new r1}displayName(){return"fallbacked transport"}async open(){for(let e=0;e<this.transports.length;e++){let t=this.transports[e];try{this.transport=t,this.resetListeners(),this.logger.debug(`Trying to connect via ${t.displayName()}`),await t.open(),this.logger.debug(`Connected via ${t.displayName()}`);return}catch(n){this.logger.debug(`Failed to connect via ${t.displayName()}: ${n.message}`)}}throw this.transport=null,this.resetListeners(),new Error("Couldn't connect via any available transport")}send(e){if(!this.transport)throw new Error("No transport is open");this.transport.send(e)}async close(){if(!this.transport)throw new Error("No transport is open");await this.transport.close(),this.transport=null}setURL(){throw new Error("Not implemented. Set URL for each transport separately")}setParam(e,t){this.transports.forEach(n=>{n.setParam(e,t)})}setToken(e,t){this.transports.forEach(n=>{n.setToken(e,t)})}on(e,t){return this.emitter.on(e,t)}once(e,t){let n=this.emitter.on(e,(...r)=>{n(),t(...r)});return n}get url(){return this.transport?this.transport.url:""}resetListeners(){this.unbind.forEach(e=>e()),this.unbind.length=0,this.transport&&this.unbind.push(this.transport.on("open",()=>{this.emitter.emit("open")}),this.transport.on("data",e=>{this.emitter.emit("data",e)}),this.transport.on("close",e=>{this.emitter.emit("close",e)}),this.transport.on("error",e=>{this.emitter.emit("error",e)}))}}class XK{constructor(e,t={}){this.url=e;let n=t.websocketImplementation;if(n)this.Impl=n;else if(typeof WebSocket<"u")this.Impl=WebSocket;else throw new Error("No WebSocket support");this.connected=!1,this.emitter=tM();let{format:r,subprotocol:o,authStrategy:l}=t;this.format=r||"text",this.connectionOptions=t.websocketOptions,this.authStrategy=l||"param",this.authProtocol="",this.subprotocol=o}displayName(){return"WebSocket("+this.url+")"}open(){let e=this.subprotocol;return this.authStrategy==="sub-protocol"&&(e=[this.subprotocol,this.authProtocol]),this.connectionOptions?this.ws=new this.Impl(this.url,e,this.connectionOptions):this.ws=new this.Impl(this.url,e),this.ws.binaryType="arraybuffer",this.initListeners(),new Promise((t,n)=>{let r=[];r.push(this.once("open",()=>{r.forEach(o=>o()),t()})),r.push(this.once("close",()=>{r.forEach(o=>o()),n(Error("WS connection closed"))}))})}setURL(e){this.url=e}setParam(e,t){let n=new URL(this.url);n.searchParams.set(e,t);let r=`${n.protocol}//${n.host}${n.pathname}?${n.searchParams}`;this.setURL(r)}setToken(e,t="jid"){if(this.authStrategy==="param")this.setParam(t,e);else if(this.authStrategy==="header"){this.connectionOptions=this.connectionOptions||{},this.connectionOptions.headers=this.connectionOptions.headers||{};let n=`x-${t}`.toLowerCase();n=Object.keys(this.connectionOptions.headers).find(o=>o.toLowerCase()===n)||n,this.connectionOptions.headers[n]=e}else if(this.authStrategy==="sub-protocol")this.authProtocol=`anycable-token.${e}`;else throw new Error("Unknown auth strategy: "+this.authStrategy)}send(e){if(!this.ws||!this.connected)throw Error("WebSocket is not connected");this.ws.send(e)}close(){this.ws?this.onclose():this.connected=!1}on(e,t){return this.emitter.on(e,t)}once(e,t){let n=this.emitter.on(e,(...r)=>{n(),t(...r)});return n}initListeners(){this.ws.onerror=e=>{this.connected&&this.emitter.emit("error",e.error||new Error("WS Error"))},this.ws.onclose=()=>{this.onclose()},this.ws.onmessage=e=>{let t=e.data;this.format==="binary"&&(t=new Uint8Array(t)),this.emitter.emit("data",t)},this.ws.onopen=()=>{this.connected=!0,this.emitter.emit("open")}}onclose(){this.ws.onclose=void 0,this.ws.onmessage=void 0,this.ws.onopen=void 0,this.ws.close(),delete this.ws,this.connected=!1,this.emitter.emit("close")}}const PI={protocol:"actioncable-v1-json",pingInterval:3e3,maxReconnectAttempts:1/0,maxMissingPings:2,logLevel:"warn",lazy:!0};function qK(i,e){if(typeof i=="object"&&typeof e>"u"&&(e=i,i=void 0),e=e||{},!i&&!e.transport)throw Error("URL or transport must be specified");e=Object.assign({},PI,e);let{protocol:t,websocketImplementation:n,websocketFormat:r,websocketOptions:o,websocketAuthStrategy:l,fallbacks:u,logLevel:h,logger:m,transport:_,encoder:p,lazy:y,monitor:x,pingInterval:T,reconnectStrategy:M,maxMissingPings:A,maxReconnectAttempts:w,subprotocol:L,tokenRefresher:N,historyTimestamp:I,protocolOptions:z,concurrentSubscribes:P,performFailures:H,transportConfigurator:W,auth:U}=e;if(m=m||new r1(h),typeof t=="string"){L=L||t;let ne=t.substring(0,t.lastIndexOf("-")),ie=t.substring(t.lastIndexOf("-")+1);if(z=z||{},ne==="actioncable-v1")t=new kI({logger:m,...z});else if(ne==="actioncable-v1-ext")t=new PK({logger:m,historyTimestamp:I,...z});else throw Error(`Protocol is not supported yet: ${t}`);if(ie==="json")p=p||new zK,r=r||"text";else if(ie==="msgpack"){if(r="binary",!p)throw Error("Msgpack encoder must be specified explicitly. Use `@anycable/msgpack-encoder` package or build your own")}else if(ie==="protobuf"){if(r=r||"binary",!p)throw Error("Protobuf encoder must be specified explicitly. Use `@anycable/protobuf-encoder` package or build your own")}else throw Error(`Protocol is not supported yet: ${t}`)}if(!t)throw Error("Protocol must be specified");_=_||new XK(i,{websocketImplementation:n,websocketOptions:o,subprotocol:L,authStrategy:l,format:r}),u&&(_=new $K([_,...u],{logger:m})),U&&U.token&&_.setToken(U.token,U.param||"jid"),M=M||zI(T),x!==!1&&(x=x||new BI({pingInterval:T,reconnectStrategy:M,maxMissingPings:A,maxReconnectAttempts:w,logger:m}));let V={concurrentSubscribes:P},J=new GK({protocol:t,transport:_,encoder:p,logger:m,lazy:y,hubOptions:V,performFailures:H,transportConfigurator:W});return x&&(x.watch(J),J.monitor=x),N&&YK(J,async()=>{try{await N(_)}catch(ne){return m.error("Failed to refresh authentication token: "+ne),!1}return J.connect().catch(()=>{}),!0}),J}function YK(i,e){let t=!1;i.on("connect",()=>t=!1),i.on("close",async n=>{if(n){if(t){i.logger.warn("Token auto-refresh is disabled",n);return}n.reason==="token_expired"&&(t=!0,await e())}})}let WK=class extends NI{writeLogEntry(e,t,n){n?console[e](t,n):console[e](t)}};class ZK extends BI{watch(e){super.watch(e),this.initActivityListeners()}initActivityListeners(){if(typeof document<"u"&&typeof window<"u"&&document.addEventListener&&window.addEventListener){let e=()=>{document.hidden||this.reconnectNow()&&this.logger.debug("Trigger reconnect due to visibility change")},t=r=>{this.reconnectNow()&&this.logger.debug("Trigger reconnect",{event:r})},n=()=>this.disconnect(new _c("page_frozen"));document.addEventListener("visibilitychange",e,!1),window.addEventListener("focus",t,!1),window.addEventListener("online",t,!1),window.addEventListener("resume",t,!1),window.addEventListener("freeze",n,!1),this.unbind.push(()=>{document.removeEventListener("visibilitychange",e,!1),window.removeEventListener("focus",t,!1),window.removeEventListener("online",t,!1),window.removeEventListener("resume",t,!1),window.removeEventListener("freeze",n,!1)})}}disconnect(e){this.state==="disconnected"||this.state==="closed"||(this.logger.info("Disconnecting",{reason:e.message}),this.cancelReconnect(),this.stopPolling(),this.state="pending_disconnect",this.target.disconnected(e))}}const KK=["cable","action-cable"],JK="/cable",nM=(i,e)=>{for(let t of KK){let n=i.head.querySelector(`meta[name='${t}-${e}']`);if(n)return n.getAttribute("content")}},FI=i=>i.match(/wss?:\/\//)?i:typeof window<"u"?`${window.location.protocol.replace("http","ws")}//${window.location.host}${i}`:i,QK=()=>{if(typeof document<"u"&&document.head){let i=nM(document,"url");if(i)return FI(i)}return FI(JK)},eJ=()=>{if(typeof document<"u"&&document.head){let i=nM(document,"history-timestamp");if(i)return i|0}},tJ=()=>{if(typeof document<"u"&&document.head)return nM(document,"token")},nJ=()=>{if(typeof document<"u"&&document.head)return nM(document,"token-param")};function iJ(i,e){typeof i=="object"&&typeof e>"u"&&(e=i,i=void 0),i=i||QK(),e=e||{},e.historyTimestamp||=eJ();let t=tJ();if(t){let m=nJ();e.auth=Object.assign({token:t,param:m},e.auth||{})}e=Object.assign({},PI,e);let{logLevel:n,logger:r,pingInterval:o,reconnectStrategy:l,maxMissingPings:u,maxReconnectAttempts:h}=e;return r=e.logger=e.logger||new WK(n),l=e.reconnectStrategy=e.reconnectStrategy||zI(o),e.monitor!==!1&&(e.monitor=e.monitor||new ZK({pingInterval:o,reconnectStrategy:l,maxMissingPings:u,maxReconnectAttempts:h,logger:r})),qK(i,e)}class rJ extends uD{static identifier="WidgetChatChannel"}const a1={debug:0,info:1,warn:2,error:3};class aJ{level;prefix;constructor(e="Widget",t="info"){this.prefix=`[${e}]`,this.level=a1[t]}debug(...e){this.level<=a1.debug&&console.debug(this.prefix,...e)}info(...e){this.level<=a1.info&&console.info(this.prefix,...e)}warn(...e){this.level<=a1.warn&&console.warn(this.prefix,...e)}error(...e){this.level<=a1.error&&console.error(this.prefix,...e)}}let HI="warn";window.location.search.includes("widget-debug")&&(HI="debug");const In=new aJ("BridgeApp-Widget",HI);window.addEventListener("error",i=>{console.error("Unhandled error",i.error)});class sJ{url;cable;channels={chat:new rJ};constructor(e){this.url=e,this.register()}subscribe(e){return In.info("SUBSCRIBE","[AnyCableService] Subscribing to channel",e.identifier),this.cable?.subscribe(e),this}unsubscribe(e){return this.cable?.unsubscribe(e),this}register(){return In.info("[AnyCableService] Registering cable with status: ",this.cable?.state),this.cable||(In.info("[AnyCableService] Creating cable"),this.cable=iJ(this.url,{pingInterval:3e3,protocol:"actioncable-v1-ext-json",protocolOptions:{pongs:!0,subscribeRetryInterval:3e4}})),this.cable.state!=="connecting"&&this.cable.state!=="connected"&&(In.info("[AnyCableService] Connecting cable, state: ",this.cable.state),this.cable.connect().then(()=>{In.info("[AnyCableService] Cable connected, subscribing to channel: ",this.channels.chat.identifier),this.cable.subscribe(this.channels.chat)})),this}unregister(){this.cable&&(In.info("[AnyCableService] Disconnecting cable"),this.cable.disconnect())}}var bc=(i=>(i.Pending="pending",i.Available="available",i.Offline="offline",i.Unavailable="unavailable",i))(bc||{});const VI=te.createContext(void 0),oJ=i=>{const[e,t]=te.useState(!1),[n,r]=te.useState(bc.Pending),o=te.useRef(n);te.useEffect(()=>{o.current=n},[n]);const l=te.useRef(null);return te.useEffect(()=>{const u=new sJ(`${i.wsUrl}?access_token=${i.customerInteractionSession.accessToken}`);return l.current=u,u.channels.chat.on("info",h=>{h.type==="reject_history"&&document.location.reload()}),u.channels.chat.on("connect",()=>{console.info("[CableContext] Connected to the chat channel"),r(bc.Available)}),u.channels.chat.on("disconnect",h=>{r(bc.Unavailable),console.warn("[CableContext] Disconnected from the chat channel",h)}),window.addEventListener("online",()=>{o.current===bc.Offline&&r(bc.Available)}),window.addEventListener("offline",()=>{r(bc.Offline)}),u.channels.chat.on("close",h=>{console.warn("[CableContext] Closed the chat channel",h)}),setTimeout(()=>t(!0),0),()=>{l.current&&(l.current.unregister(),l.current=null),t(!1)}},[i.customerInteractionSession.accessToken]),e?{anycableService:l,networkStatus:n}:null},lJ=({children:i,config:e})=>{const t=oJ(e);return t?$e.jsx(VI.Provider,{value:t,children:i}):null},fD=()=>{const i=te.useContext(VI);if(i===void 0)throw new Error("useCable must be used within an CableProvider");return i},Nv={connectionFailed:"Connection failed",offline:"You're offline",agentResponseFailed:"Agent response failed",sendMessageFallback:"Failed to send message"},GI=i=>{let e;const t=new Set,n=(m,_)=>{const p=typeof m=="function"?m(e):m;if(!Object.is(p,e)){const y=e;e=_??(typeof p!="object"||p===null)?p:Object.assign({},e,p),t.forEach(x=>x(e,y))}},r=()=>e,u={setState:n,getState:r,getInitialState:()=>h,subscribe:m=>(t.add(m),()=>t.delete(m))},h=e=i(n,r,u);return u},cJ=(i=>i?GI(i):GI),uJ=i=>i;function fJ(i,e=uJ){const t=tm.useSyncExternalStore(i.subscribe,tm.useCallback(()=>e(i.getState()),[i,e]),tm.useCallback(()=>e(i.getInitialState()),[i,e]));return tm.useDebugValue(t),t}const jI=i=>{const e=cJ(i),t=n=>fJ(e,n);return Object.assign(t,e),t},$I=(i=>i?jI(i):jI);function s1(i,e){i.message.includes("401")&&e?.()}const XI=async(i,e)=>{try{console.log("startVoiceSession",{config:i,api:e});const t=await fetch(`${i.apiUrl}/agents.Agents/StartVoiceSession`,{method:"POST",headers:{Authorization:`Bearer ${i.customerInteractionSession.accessToken}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({agentId:i.agentId,voiceModelId:i.voiceModelId,voiceConfig:i.voiceConfig})});return{status:t.status,json:await t.json()}}catch(t){throw s1(t,e.onSessionExpired),t}};async function dD(i,e,t,n){try{const r=await fetch(`${i.apiUrl}/agents.Agents/EndVoiceSession`,{method:"POST",headers:{Authorization:`Bearer ${i.customerInteractionSession.accessToken}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voiceSessionId:t,reason:n})});if(!r.ok)throw new Error(`Request failed: ${r.status} ${r.statusText}`);return await r.json()}catch(r){throw s1(r,e.onSessionExpired),r}}async function dJ({voiceBaseUrl:i,voiceSessionId:e,sessionToken:t,clientInstanceId:n,protocolVersion:r,expectedConnectionGeneration:o,offerSdp:l}){try{In.debug("sendOffer",{voiceSessionId:e,clientInstanceId:n,protocolVersion:r,expectedConnectionGeneration:o,offerSdpLength:l.length});const u=await fetch(`${i}/SendOffer`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voiceSessionId:e,sessionToken:t,clientInstanceId:n,protocolVersion:r,expectedConnectionGeneration:o,offerSdp:l})});if(!u.ok)throw new Error(`Request failed: ${u.status} ${u.statusText}`);return await u.json()}catch(u){throw console.error("Request failed:",u),u}}async function hJ({voiceBaseUrl:i,voiceSessionId:e,sessionToken:t,clientInstanceId:n,connectionId:r,connectionGeneration:o,candidates:l}){try{const u=await fetch(`${i}/SendCandidates`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voiceSessionId:e,sessionToken:t,clientInstanceId:n,connectionId:r,connectionGeneration:o,candidates:l})});if(!u.ok)throw new Error(`Request failed: ${u.status} ${u.statusText}`)}catch(u){throw console.error("Request failed:",u),u}}async function pJ({voiceBaseUrl:i,voiceSessionId:e,sessionToken:t,clientInstanceId:n,connectionId:r,connectionGeneration:o,reason:l}){const u=await fetch(`${i}/EndSession`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voiceSessionId:e,sessionToken:t,clientInstanceId:n,connectionId:r,connectionGeneration:o,reason:l})});if(!u.ok)throw new Error(`Request failed: ${u.status} ${u.statusText}`)}async function mJ({voiceBaseUrl:i,voiceSessionId:e,sessionToken:t,clientInstanceId:n,protocolVersion:r}){const o=await fetch(`${i}/GetTurnBootstrap`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voiceSessionId:e,sessionToken:t,clientInstanceId:n,protocolVersion:r})});if(!o.ok)throw new Error(`Request failed: ${o.status} ${o.statusText}`);return await o.json()}const iM=globalThis.crypto?.randomUUID?.()??`widget-${Date.now()}-${Math.random().toString(16).slice(2)}`;function rM(){return{activeVoiceSessionData:null,config:null,api:null,status:"idle",errorMessage:null,isVoiceBootstrapped:!1,connection:null,connectionId:null,connectionGeneration:null,iceCandidates:[],voiceEventsChannel:null,voiceInputChannel:null,downstream:null,upstream:null,localStream:null,remoteAudioElement:null,customerMessageTranscript:"",customerMessageTranscriptVisible:!1,assistantMessageTranscript:"",assistantMessageTranscriptVisible:!1,assistantResponseInProgress:!1,microphoneEnabled:!1,inputAudioDevice:null,audioInputDevices:[]}}function hD(i){i?.getTracks().forEach(e=>e.stop())}function qI(i){if(!(!i||i.readyState==="closed"))try{i.close()}catch(e){In.debug("Failed to close data channel",e)}}function gJ(i){if(!(!i||i.connectionState==="closed"))try{i.close()}catch(e){In.debug("Failed to close peer connection",e)}}function YI(i){qI(i.voiceEventsChannel),qI(i.voiceInputChannel),gJ(i.connection),hD(i.localStream),hD(i.downstream),i.remoteAudioElement&&(i.remoteAudioElement.pause(),i.remoteAudioElement.srcObject=null)}function vJ(i){return i instanceof Error?i.message:"Voice session failed"}const pr=$I((i,e)=>({...rM(),actions:{initVoiceStore:async(t,n)=>{const{getLocalStream:r}=e().actions,o=await r();if(!o)throw new Error("No local stream available");const l=o.getAudioTracks()[0];if(!l)throw hD(o),new Error("No audio input track available");i({config:t,localStream:o,status:"connecting"});try{let u=await XI(t,n);if(u.status===409){const x=u.json.message.split(" ").pop();x&&(await dD(t,n,x,"replace_stale_session"),u=await XI(t,n))}if(u.status>=400)throw new Error(u.json.message||"Unable to start voice session");const h=u.json;In.debug("StartVoiceSession response",{sessionId:h.session.id,voiceBaseUrl:h.voiceBaseUrl,voiceProtocolVersion:h.voiceProtocolVersion});const m=await mJ({voiceBaseUrl:h.voiceBaseUrl,voiceSessionId:h.session.id,sessionToken:h.sessionToken,clientInstanceId:iM,protocolVersion:h.voiceProtocolVersion});h.voiceTurn=m,i({activeVoiceSessionData:h});const _=e().actions.createConnection();i({connection:_}),_.ondatachannel=y=>{In.debug("ondatachannel",y.channel.label),y.channel.label==="voice-events"&&(i({voiceEventsChannel:y.channel}),y.channel.onmessage=x=>{e().actions.onVoiceEventsEvent(x)}),y.channel.label==="voice-input"&&(i({voiceInputChannel:y.channel}),y.channel.onmessage=x=>{e().actions.onVoiceInputEvent(x)})},_.addEventListener("track",y=>{const x=y.streams[0];x&&(In.debug("Received remote audio track"),i({downstream:x}),e().actions.playRemoteAudio(x))}),_.onicecandidate=y=>{if(y.candidate){i(x=>({iceCandidates:[...x.iceCandidates,y.candidate?.toJSON()??{}]}));return}e().actions.sendCandidates()},_.addEventListener("connectionstatechange",()=>{if(In.debug("Peer connection state",_.connectionState),_.connectionState==="connected"){i({status:"live",errorMessage:null});return}(_.connectionState==="failed"||_.connectionState==="disconnected")&&i({status:"error",errorMessage:"Voice connection was interrupted"})}),_.addTrack(l,o),_.createDataChannel("voice-bootstrap");const p=await _.createOffer();await _.setLocalDescription(p),e().actions.sendOffer(p)}catch(u){In.error("Voice bootstrap failed",u);const h=e().activeVoiceSessionData;if(h)try{await dD(t,n,h.session.id,"bootstrap_failed")}catch(m){In.warn("Failed to close voice session after bootstrap error",m)}throw YI(e()),i({...rM(),status:"error",errorMessage:vJ(u)}),u}},sendOffer:async t=>{const n=e().activeVoiceSessionData;if(!n)throw new Error("Voice session data not found");const r=e().connection;if(!r)throw new Error("Peer connection not found");const o=await dJ({voiceBaseUrl:n.voiceBaseUrl,voiceSessionId:n.session.id,sessionToken:n.sessionToken,clientInstanceId:iM,protocolVersion:n.voiceProtocolVersion,expectedConnectionGeneration:0,offerSdp:r.localDescription?.sdp??t.sdp??""});In.debug("SendOffer response",{connectionId:o.connectionId,connectionGeneration:o.connectionGeneration}),i({connectionId:o.connectionId,connectionGeneration:o.connectionGeneration,isVoiceBootstrapped:!0}),await r.setRemoteDescription({type:"answer",sdp:o.answerSdp}),await e().actions.sendCandidates()},sendCandidates:async()=>{const t=e().activeVoiceSessionData,n=e().connectionId,r=e().connectionGeneration,o=e().iceCandidates;if(!(!t||!n||r==null||o.length===0)){i({iceCandidates:[]});try{await hJ({voiceBaseUrl:t.voiceBaseUrl,voiceSessionId:t.session.id,sessionToken:t.sessionToken,clientInstanceId:iM,connectionId:n,connectionGeneration:r,candidates:o}),In.debug("Sent ICE candidates",{count:o.length})}catch(l){throw In.error("Failed to send ICE candidates",l),i(u=>({iceCandidates:[...o,...u.iceCandidates]})),l}}},createConnection:()=>{const t=e().activeVoiceSessionData;if(!t)throw new Error("Voice session data not found");if(!t.voiceTurn)throw new Error("Voice turn not found");const n={urls:t.voiceTurn.urls,username:t.voiceTurn.username,credential:t.voiceTurn.credential};return new RTCPeerConnection({iceServers:[n]})},playRemoteAudio(t){let n=e().remoteAudioElement;n||(n=new Audio,n.autoplay=!0,i({remoteAudioElement:n})),n.srcObject=t,n.muted=!1,n.play().catch(r=>{In.debug("audioElement play error",r)})},endVoiceSession:async(t="user_hangup")=>{const{activeVoiceSessionData:n,config:r,api:o,connectionGeneration:l,connectionId:u,voiceInputChannel:h}=e();if(!n&&!e().connection&&!e().localStream&&!e().downstream){i(rM());return}i({status:"ending"});try{h?.readyState==="open"&&h.send(JSON.stringify({type:"end_session",reason:t}))}catch(m){In.warn("Failed to notify runtime about session end",m)}try{n&&u&&l!=null&&await pJ({voiceBaseUrl:n.voiceBaseUrl,voiceSessionId:n.session.id,sessionToken:n.sessionToken,clientInstanceId:iM,connectionId:u,connectionGeneration:l,reason:t})}catch(m){In.warn("Failed to end WebRTC session",m)}try{n&&await dD(r,o,n.session.id,t)}catch(m){In.warn("Failed to end voice session",m)}finally{YI(e()),i(rM())}},setMicrophoneEnabled:t=>{e().localStream?.getAudioTracks().forEach(n=>n.enabled=t),i({microphoneEnabled:t})},onVoiceEventsEvent:t=>{try{const n=JSON.parse(t.data);switch(In.debug("voice-events message",n),n.type){case"input_audio_speech_started":i({customerMessageTranscript:"",assistantMessageTranscriptVisible:!1});break;case"response_started":i({assistantResponseInProgress:!0,assistantMessageTranscript:""});break;case"assistant_transcript_delta":i({assistantMessageTranscript:e().assistantMessageTranscript+(n.text??""),assistantMessageTranscriptVisible:!0});break;case"assistant_transcript_final":i({assistantMessageTranscript:n.text??"",assistantMessageTranscriptVisible:!0});break;case"response_cancelled":case"assistant_turn_done":case"assistant_turn_failed":i({assistantResponseInProgress:!1});break;case"user_transcript_delta":i({customerMessageTranscriptVisible:!0,customerMessageTranscript:e().customerMessageTranscript+(n.text??"")});break;case"user_transcript_final":i({customerMessageTranscriptVisible:!0,customerMessageTranscript:n.text??""});break;case"realtime_error":i({status:"error",errorMessage:n.message??"Voice session failed"});break}}catch(n){In.warn("Failed to parse voice-events payload",n)}},onVoiceInputEvent:t=>{try{const n=JSON.parse(t.data);In.debug("voice-input message",n)}catch(n){In.warn("Failed to parse voice-input payload",n)}},getLocalStream:async t=>{const n=t||e().inputAudioDevice?.deviceId;if(!n)throw new Error("No audio device selected");if(!navigator.mediaDevices?.getUserMedia)throw new Error("getUserMedia is not supported in this browser");const r=(l=!1)=>{const u={},h={};return u.audio=!l&&n?{...h,deviceId:{exact:n}}:h,u},o=r();try{return await navigator.mediaDevices.getUserMedia(o)}catch(l){In.debug({error:l});const u=l?.name;if(n&&(u==="OverconstrainedError"||u==="NotFoundError"||u==="NotReadableError")){In.warn("getUserMedia failed with selected audio device, retrying with default. Error:",l);const m=r(!0);try{return await navigator.mediaDevices.getUserMedia(m)}catch(_){throw In.error("[gUM] retry with default audio failed",_),_}}throw console.error("[gUM] failed",l),l}},setNewLocalStream:async()=>{const{localStream:t,microphoneEnabled:n,actions:{setMicrophoneEnabled:r,getLocalStream:o}}=e();if(!n){try{t?.getTracks().forEach(l=>l.stop()),pr.setState({localStream:null})}finally{r(!1)}return}try{t?.getTracks().forEach(u=>u.stop()),pr.setState({localStream:null});const l=await o();if(!l)return;pr.setState({localStream:l}),r(n)}catch{r(!n)}},createAudioTrack:async()=>{const{getLocalStream:t}=e().actions,n=await t();return n?n.getAudioTracks()[0]??null:null},attachAudioTrack:async(t,{replaceExisting:n})=>{let{localStream:r}=e();const{connection:o,connectionId:l}=e(),u=r?.getAudioTracks()[0];if(r?n&&u&&(u.stop(),r.removeTrack(u)):r=new MediaStream,u&&!n)return u;if(r.addTrack(t),o){const h=o,m=l;if(h.connectionState==="closed")return console.warn(`Cannot attach audio track: peer connection ${m} is closed`),t;let _=h.getSenders().find(p=>p.track?.kind==="audio");if(!_)_=h.addTrack(t,r);else try{await _.replaceTrack(t),_.track?.id!==t.id&&console.warn(`Track replacement may not have completed for ${m}, sender track ID: ${_.track?.id}, new track ID: ${t.id}`)}catch(p){return console.error("replaceTrack audio failed:",p),t}finally{In.debug("track replaced")}}return t},ensureAudioTrack:async()=>{const{localStream:t,actions:{createAudioTrack:n,attachAudioTrack:r}}=e();if(t?.getAudioTracks()[0])return!0;const l=await n();return l?(await r(l,{replaceExisting:!1}),!0):!1},recreateAudioTrack:async()=>{const{actions:{createAudioTrack:t,attachAudioTrack:n}}=e(),r=await t();return r?(await n(r,{replaceExisting:!0}),!0):!1},enableMicrophone:async()=>{const{microphoneEnabled:t,actions:{setMicrophoneEnabled:n,ensureAudioTrack:r}}=e();if(t)return;if(!await r())throw new Error("Failed to enable the microphone. Check the input device in the settings.");n(!0)},disableMicrophone:()=>{const{microphoneEnabled:t,actions:{setMicrophoneEnabled:n}}=e();t&&n(!1)},switchAudio:async()=>{const{microphoneEnabled:t,actions:{disableMicrophone:n,enableMicrophone:r}}=e();t?n():await r()},refreshAudioProcessing:async()=>{const{microphoneEnabled:t,actions:{recreateAudioTrack:n}}=e();if(!t)return;if(!await n())throw Error("Failed to update the microphone. Check the input device in the settings.")},switchInputAudioDevice:async t=>{const{actions:{getLocalStream:n,setMicrophoneEnabled:r,attachAudioTrack:o},microphoneEnabled:l}=e();try{let u=t.deviceId,h=t;if(t.deviceId==="default"&&t.label)try{const x=(await navigator.mediaDevices.enumerateDevices()).find(T=>T.kind==="audioinput"&&T.label===t.label&&T.deviceId!=="default");x&&(u=x.deviceId,h=x)}catch(y){console.error("Error enumerating devices:",y)}const m=await n(u);if(!m)throw new Error("Failed to get new audio stream");l||r(!0),pr.setState({inputAudioDevice:h});const _=m.getAudioTracks()[0];if(!_)throw new Error("No audio track in new stream");const p=_.getSettings().deviceId;if(u&&p&&p!==u&&u!=="default"){console.error(`Mic switch mismatch. Requested deviceId=${u}, got deviceId=${p}`);try{const x=(await navigator.mediaDevices.enumerateDevices()).find(T=>T.kind==="audioinput"&&T.deviceId===p);x&&(h=x)}catch(y){console.error("Failed to enumerate devices after mismatch:",y)}}await o(_,{replaceExisting:!0})}catch(u){console.error("Error switching audio device:",u)}}}})),WI=()=>pr(i=>i.actions);var ZI=function(i){te.useEffect(i,[])},yJ=function(i){ZI(function(){i()})},_J=function(i){var e=te.useRef(i);e.current=i,ZI(function(){return function(){return e.current()}})};const bJ=()=>{const[i,e]=te.useState([]),{switchInputAudioDevice:t}=WI(),{audioInputDevices:n}=pr.getState(),r=te.useCallback(async l=>{const u=pr.getState().audioInputDevices,h=l.filter(x=>x.kind==="audioinput"),m=h.filter(x=>!u.find(T=>T.deviceId===x.deviceId)),_=pr.getState().inputAudioDevice||m[0],p=m.find(x=>x.deviceId==="default")||m[0],y=pr.getState().isVoiceBootstrapped;if(pr.setState({audioInputDevices:h}),!y){pr.setState({inputAudioDevice:p||_});return}console.log("newAudioInputDevice",p),console.log("currentAudioInputDevice",_),p&&p.groupId!==_?.groupId&&t(p),e(u)},[]),o=te.useCallback(async l=>{if(console.log("updateDevices"),console.log("navigator.mediaDevices",navigator.mediaDevices),!!navigator.mediaDevices?.enumerateDevices){l&&In.debug({e:l});try{const u=await navigator.mediaDevices.enumerateDevices();if(!u.some(m=>m.label!=="")){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(p=>p.stop());const _=await navigator.mediaDevices.enumerateDevices();return r(_)}console.log("deviceList",u),r(u)}catch(u){console.error("Failed to enumerate devices:",u)}}},[]);return yJ(()=>{console.log("devicechange"),navigator.mediaDevices?.addEventListener("devicechange",o)}),_J(()=>{navigator.mediaDevices?.removeEventListener("devicechange",o)}),te.useEffect(()=>{const l=pr.getState().inputAudioDevice,u=n.some(h=>h.deviceId===l?.deviceId&&h.groupId===l?.groupId);n?.length>0&&!u&&t(i[0])},[n]),{updateDevices:o}};function Ra(i){this.content=i}Ra.prototype={constructor:Ra,find:function(i){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===i)return e;return-1},get:function(i){var e=this.find(i);return e==-1?void 0:this.content[e+1]},update:function(i,e,t){var n=t&&t!=i?this.remove(t):this,r=n.find(i),o=n.content.slice();return r==-1?o.push(t||i,e):(o[r+1]=e,t&&(o[r]=t)),new Ra(o)},remove:function(i){var e=this.find(i);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ra(t)},addToStart:function(i,e){return new Ra([i,e].concat(this.remove(i).content))},addToEnd:function(i,e){var t=this.remove(i).content.slice();return t.push(i,e),new Ra(t)},addBefore:function(i,e,t){var n=this.remove(e),r=n.content.slice(),o=n.find(i);return r.splice(o==-1?r.length:o,0,e,t),new Ra(r)},forEach:function(i){for(var e=0;e<this.content.length;e+=2)i(this.content[e],this.content[e+1])},prepend:function(i){return i=Ra.from(i),i.size?new Ra(i.content.concat(this.subtract(i).content)):this},append:function(i){return i=Ra.from(i),i.size?new Ra(this.subtract(i).content.concat(i.content)):this},subtract:function(i){var e=this;i=Ra.from(i);for(var t=0;t<i.content.length;t+=2)e=e.remove(i.content[t]);return e},toObject:function(){var i={};return this.forEach(function(e,t){i[e]=t}),i},get size(){return this.content.length>>1}},Ra.from=function(i){if(i instanceof Ra)return i;var e=[];if(i)for(var t in i)e.push(t,i[t]);return new Ra(e)};function KI(i,e,t){for(let n=0;;n++){if(n==i.childCount||n==e.childCount)return i.childCount==e.childCount?null:t;let r=i.child(n),o=e.child(n);if(r==o){t+=r.nodeSize;continue}if(!r.sameMarkup(o))return t;if(r.isText&&r.text!=o.text){for(let l=0;r.text[l]==o.text[l];l++)t++;return t}if(r.content.size||o.content.size){let l=KI(r.content,o.content,t+1);if(l!=null)return l}t+=r.nodeSize}}function JI(i,e,t,n){for(let r=i.childCount,o=e.childCount;;){if(r==0||o==0)return r==o?null:{a:t,b:n};let l=i.child(--r),u=e.child(--o),h=l.nodeSize;if(l==u){t-=h,n-=h;continue}if(!l.sameMarkup(u))return{a:t,b:n};if(l.isText&&l.text!=u.text){let m=0,_=Math.min(l.text.length,u.text.length);for(;m<_&&l.text[l.text.length-m-1]==u.text[u.text.length-m-1];)m++,t--,n--;return{a:t,b:n}}if(l.content.size||u.content.size){let m=JI(l.content,u.content,t-1,n-1);if(m)return m}t-=h,n-=h}}class it{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,r=0,o){for(let l=0,u=0;u<t;l++){let h=this.content[l],m=u+h.nodeSize;if(m>e&&n(h,r+u,o||null,l)!==!1&&h.content.size){let _=u+1;h.nodesBetween(Math.max(0,e-_),Math.min(h.content.size,t-_),n,r+_)}u=m}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",l=!0;return this.nodesBetween(e,t,(u,h)=>{let m=u.isText?u.text.slice(Math.max(e,h)-h,t-h):u.isLeaf?r?typeof r=="function"?r(u):r:u.type.spec.leafText?u.type.spec.leafText(u):"":"";u.isBlock&&(u.isLeaf&&m||u.isTextblock)&&n&&(l?l=!1:o+=n),o+=m},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new it(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,l=0;l<t;o++){let u=this.content[o],h=l+u.nodeSize;h>e&&((l<e||h>t)&&(u.isText?u=u.cut(Math.max(0,e-l),Math.min(u.text.length,t-l)):u=u.cut(Math.max(0,e-l-1),Math.min(u.content.size,t-l-1))),n.push(u),r+=u.nodeSize),l=h}return new it(n,r)}cutByIndex(e,t){return e==t?it.empty:e==0&&t==this.content.length?this:new it(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new it(r,o)}addToStart(e){return new it([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new it(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return KI(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return JI(this,e,t,n)}findIndex(e){if(e==0)return aM(0,e);if(e==this.size)return aM(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),o=n+r.nodeSize;if(o>=e)return o==e?aM(t+1,o):aM(t,n);n=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return it.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new it(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return it.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new it(t||e,n)}static from(e){if(!e)return it.empty;if(e instanceof it)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new it([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}it.empty=new it([],0);const pD={index:0,offset:0};function aM(i,e){return pD.index=i,pD.offset=e,pD}function sM(i,e){if(i===e)return!0;if(!(i&&typeof i=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(i);if(Array.isArray(e)!=t)return!1;if(t){if(i.length!=e.length)return!1;for(let n=0;n<i.length;n++)if(!sM(i[n],e[n]))return!1}else{for(let n in i)if(!(n in e)||!sM(i[n],e[n]))return!1;for(let n in e)if(!(n in i))return!1}return!0}let Hi=class _4{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&sM(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return _4.none;if(e instanceof _4)return[e];let t=e.slice();return t.sort((n,r)=>n.type.rank-r.type.rank),t}};Hi.none=[];class oM extends Error{}class St{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=e6(this.content,e+this.openStart,t);return n&&new St(n,this.openStart,this.openEnd)}removeBetween(e,t){return new St(QI(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return St.empty;let n=t.openStart||0,r=t.openEnd||0;if(typeof n!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new St(it.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)r++;return new St(e,n,r)}}St.empty=new St(it.empty,0,0);function QI(i,e,t){let{index:n,offset:r}=i.findIndex(e),o=i.maybeChild(n),{index:l,offset:u}=i.findIndex(t);if(r==e||o.isText){if(u!=t&&!i.child(l).isText)throw new RangeError("Removing non-flat range");return i.cut(0,e).append(i.cut(t))}if(n!=l)throw new RangeError("Removing non-flat range");return i.replaceChild(n,o.copy(QI(o.content,e-r-1,t-r-1)))}function e6(i,e,t,n){let{index:r,offset:o}=i.findIndex(e),l=i.maybeChild(r);if(o==e||l.isText)return n&&!n.canReplace(r,r,t)?null:i.cut(0,e).append(t).append(i.cut(e));let u=e6(l.content,e-o-1,t,l);return u&&i.replaceChild(r,l.copy(u))}function xJ(i,e,t){if(t.openStart>i.depth)throw new oM("Inserted content deeper than insertion position");if(i.depth-t.openStart!=e.depth-t.openEnd)throw new oM("Inconsistent open depths");return t6(i,e,t,0)}function t6(i,e,t,n){let r=i.index(n),o=i.node(n);if(r==e.index(n)&&n<i.depth-t.openStart){let l=t6(i,e,t,n+1);return o.copy(o.content.replaceChild(r,l))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&i.depth==n&&e.depth==n){let l=i.parent,u=l.content;return Um(l,u.cut(0,i.parentOffset).append(t.content).append(u.cut(e.parentOffset)))}else{let{start:l,end:u}=SJ(t,i);return Um(o,i6(i,l,u,e,n))}else return Um(o,lM(i,e,n))}function n6(i,e){if(!e.type.compatibleContent(i.type))throw new oM("Cannot join "+e.type.name+" onto "+i.type.name)}function mD(i,e,t){let n=i.node(t);return n6(n,e.node(t)),n}function km(i,e){let t=e.length-1;t>=0&&i.isText&&i.sameMarkup(e[t])?e[t]=i.withText(e[t].text+i.text):e.push(i)}function o1(i,e,t,n){let r=(e||i).node(t),o=0,l=e?e.index(t):r.childCount;i&&(o=i.index(t),i.depth>t?o++:i.textOffset&&(km(i.nodeAfter,n),o++));for(let u=o;u<l;u++)km(r.child(u),n);e&&e.depth==t&&e.textOffset&&km(e.nodeBefore,n)}function Um(i,e){return i.type.checkContent(e),i.copy(e)}function i6(i,e,t,n,r){let o=i.depth>r&&mD(i,e,r+1),l=n.depth>r&&mD(t,n,r+1),u=[];return o1(null,i,r,u),o&&l&&e.index(r)==t.index(r)?(n6(o,l),km(Um(o,i6(i,e,t,n,r+1)),u)):(o&&km(Um(o,lM(i,e,r+1)),u),o1(e,t,r,u),l&&km(Um(l,lM(t,n,r+1)),u)),o1(n,null,r,u),new it(u)}function lM(i,e,t){let n=[];if(o1(null,i,t,n),i.depth>t){let r=mD(i,e,t+1);km(Um(r,lM(i,e,t+1)),n)}return o1(e,null,t,n),new it(n)}function SJ(i,e){let t=e.depth-i.openStart,r=e.node(t).copy(i.content);for(let o=t-1;o>=0;o--)r=e.node(o).copy(it.from(r));return{start:r.resolveNoCache(i.openStart+t),end:r.resolveNoCache(r.content.size-i.openEnd-t)}}class l1{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)r+=n.child(o).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Hi.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let u=n;n=r,r=u}let o=n.marks;for(var l=0;l<o.length;l++)o[l].type.spec.inclusive===!1&&(!r||!o[l].isInSet(r.marks))&&(o=o[l--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)n[o].type.spec.inclusive===!1&&(!r||!n[o].isInSet(r.marks))&&(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new cM(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let l=e;;){let{index:u,offset:h}=l.content.findIndex(o),m=o-h;if(n.push(l,u,r+h),!m||(l=l.child(u),l.isText))break;o=m-1,r+=h+1}return new l1(t,n,o)}static resolveCached(e,t){let n=r6.get(e);if(n)for(let o=0;o<n.elts.length;o++){let l=n.elts[o];if(l.pos==t)return l}else r6.set(e,n=new EJ);let r=n.elts[n.i]=l1.resolve(e,t);return n.i=(n.i+1)%TJ,r}}class EJ{constructor(){this.elts=[],this.i=0}}const TJ=12,r6=new WeakMap;class cM{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const MJ=Object.create(null);let lh=class b4{constructor(e,t,n,r=Hi.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||it.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&sM(this.attrs,t||e.defaultAttrs||MJ)&&Hi.sameSet(this.marks,n||Hi.none)}copy(e=null){return e==this.content?this:new b4(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new b4(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return St.empty;let r=this.resolve(e),o=this.resolve(t),l=n?0:r.sharedDepth(t),u=r.start(l),m=r.node(l).content.cut(r.pos-u,o.pos-u);return new St(m,r.depth-l,o.depth-l)}replace(e,t,n){return xJ(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return l1.resolveCached(this,e)}resolveNoCache(e){return l1.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,o=>(n.isInSet(o.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),a6(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=it.empty,r=0,o=n.childCount){let l=this.contentMatchAt(e).matchFragment(n,r,o),u=l&&l.matchFragment(this.content,t);if(!u||!u.validEnd)return!1;for(let h=r;h<o;h++)if(!this.type.allowsMarks(n.child(h).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),l=o&&o.matchFragment(this.content,t);return l?l.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Hi.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Hi.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=it.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}};lh.prototype.text=void 0;class uM extends lh{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):a6(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new uM(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new uM(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function a6(i,e){for(let t=i.length-1;t>=0;t--)e=i[t].type.name+"("+e+")";return e}class Im{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new wJ(e,t);if(n.next==null)return Im.empty;let r=s6(n);n.next&&n.err("Unexpected trailing text");let o=NJ(LJ(r));return kJ(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function o(l,u){let h=l.matchFragment(e,n);if(h&&(!t||h.validEnd))return it.from(u.map(m=>m.createAndFill()));for(let m=0;m<l.next.length;m++){let{type:_,next:p}=l.next[m];if(!(_.isText||_.hasRequiredAttrs())&&r.indexOf(p)==-1){r.push(p);let y=o(p,u.concat(_));if(y)return y}}return null}return o(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let l=[];for(let u=r;u.type;u=u.via)l.push(u.type);return l.reverse()}for(let l=0;l<o.next.length;l++){let{type:u,next:h}=o.next[l];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in t)&&(!r.type||h.validEnd)&&(n.push({match:u.contentMatch,type:u,via:r}),t[u.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((n,r)=>{let o=r+(n.validEnd?"*":" ")+" ";for(let l=0;l<n.next.length;l++)o+=(l?", ":"")+n.next[l].type.name+"->"+e.indexOf(n.next[l].next);return o}).join(`
|
|
4553
|
+
`))}else{let y=_.props,x=y?.className,T=typeof x=="function"?(...w)=>yI(x(...w),h.className):yI(x,h.className),M=T?{className:T}:{},A=bI(_.props,Ov(oD(h,["ref"])));for(let w in p)w in A&&delete p[w];return te.cloneElement(_,Object.assign({},A,p,m,{ref:r(cK(_),m.ref)},M))}return te.createElement(o,Object.assign({},oD(h,["ref"]),!eM(o)&&m,!eM(o)&&p),_)}function oK(){let i=te.useRef([]),e=te.useCallback(t=>{for(let n of i.current)n!=null&&(typeof n=="function"?n(t):n.current=t)},[]);return(...t)=>{if(!t.every(n=>n==null))return i.current=t,e}}function lK(...i){return i.every(e=>e==null)?void 0:e=>{for(let t of i)t!=null&&(typeof t=="function"?t(e):t.current=e)}}function bI(...i){if(i.length===0)return{};if(i.length===1)return i[0];let e={},t={};for(let n of i)for(let r in n)r.startsWith("on")&&typeof n[r]=="function"?(t[r]!=null||(t[r]=[]),t[r].push(n[r])):e[r]=n[r];if(e.disabled||e["aria-disabled"])for(let n in t)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(n)&&(t[n]=[r=>{var o;return(o=r?.preventDefault)==null?void 0:o.call(r)}]);for(let n in t)Object.assign(e,{[n](r,...o){let l=t[n];for(let u of l){if((r instanceof Event||r?.nativeEvent instanceof Event)&&r.defaultPrevented)return;u(r,...o)}}});return e}function xI(...i){if(i.length===0)return{};if(i.length===1)return i[0];let e={},t={};for(let n of i)for(let r in n)r.startsWith("on")&&typeof n[r]=="function"?(t[r]!=null||(t[r]=[]),t[r].push(n[r])):e[r]=n[r];for(let n in t)Object.assign(e,{[n](...r){let o=t[n];for(let l of o)l?.(...r)}});return e}function QT(i){var e;return Object.assign(te.forwardRef(i),{displayName:(e=i.displayName)!=null?e:i.name})}function Ov(i){let e=Object.assign({},i);for(let t in e)e[t]===void 0&&delete e[t];return e}function oD(i,e=[]){let t=Object.assign({},i);for(let n of e)n in t&&delete t[n];return t}function cK(i){return tm.version.split(".")[0]>="19"?i.props.ref:i.ref}function eM(i){return i===te.Fragment||i===Symbol.for("react.fragment")}function uK(i){return eM(i.type)}let fK="button";function dK(i,e){var t;let n=ZT(),{disabled:r=n||!1,autoFocus:o=!1,...l}=i,{isFocusVisible:u,focusProps:h}=mI({autoFocus:o}),{isHovered:m,hoverProps:_}=pI({isDisabled:r}),{pressed:p,pressProps:y}=nK({disabled:r}),x=xI({ref:e,type:(t=l.type)!=null?t:"button",disabled:r||void 0,autoFocus:o},h,_,y),T=WT({disabled:r,hover:m,focus:u,active:p,autofocus:o});return KT()({ourProps:x,theirProps:l,slot:T,defaultTag:fK,name:"Button"})}let wf=QT(dK),hK=te.createContext(void 0);function SI(){return te.useContext(hK)}function pK(i){return typeof i!="object"||i===null?!1:"nodeType"in i}function EI(i){return pK(i)&&"tagName"in i}function TI(i){return EI(i)&&"accessKey"in i}function mK(i){return TI(i)&&i.nodeName==="INPUT"}function MI(i){return TI(i)&&i.nodeName==="LABEL"}function gK(i){return EI(i)?i.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}let vK=Symbol();function wI(...i){let e=te.useRef(i);te.useEffect(()=>{e.current=i},[i]);let t=YT(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)});return i.every(n=>n==null||n?.[vK])?void 0:t}let lD=te.createContext(null);lD.displayName="DescriptionContext";function AI(){let i=te.useContext(lD);if(i===null){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,AI),e}return i}function yK(){var i,e;return(e=(i=te.useContext(lD))==null?void 0:i.value)!=null?e:void 0}let _K="p";function bK(i,e){let t=te.useId(),n=ZT(),{id:r=`headlessui-description-${t}`,...o}=i,l=AI(),u=wI(e);sD(()=>l.register(r),[r,l.register]);let h=WT({...l.slot,disabled:n||!1}),m={ref:u,...l.props,id:r};return KT()({ourProps:m,theirProps:o,slot:h,defaultTag:_K,name:l.name||"Description"})}let xK=QT(bK);Object.assign(xK,{});let cD=te.createContext(null);cD.displayName="LabelContext";function CI(){let i=te.useContext(cD);if(i===null){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,CI),e}return i}function SK(i){var e,t,n;let r=(t=(e=te.useContext(cD))==null?void 0:e.value)!=null?t:void 0;return((n=void 0)!=null?n:0)>0?[r,...i].filter(Boolean).join(" "):r}let EK="label";function TK(i,e){var t;let n=te.useId(),r=CI(),o=SI(),l=ZT(),{id:u=`headlessui-label-${n}`,htmlFor:h=o??((t=r.props)==null?void 0:t.htmlFor),passive:m=!1,..._}=i,p=wI(e);sD(()=>r.register(u),[u,r.register]);let y=YT(M=>{let A=M.currentTarget;if(!(M.target!==M.currentTarget&&gK(M.target))&&(MI(A)&&M.preventDefault(),r.props&&"onClick"in r.props&&typeof r.props.onClick=="function"&&r.props.onClick(M),MI(A))){let w=document.getElementById(A.htmlFor);if(w){let L=w.getAttribute("disabled");if(L==="true"||L==="")return;let N=w.getAttribute("aria-disabled");if(N==="true"||N==="")return;(mK(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),x=WT({...r.slot,disabled:l||!1}),T={ref:p,...r.props,id:u,htmlFor:h,onClick:y};return m&&("onClick"in T&&(delete T.htmlFor,delete T.onClick),"onClick"in _&&delete _.onClick),KT()({ourProps:T,theirProps:_,slot:x,defaultTag:h?EK:"div",name:r.name||"Label"})}let MK=QT(TK);Object.assign(MK,{});let wK="textarea";function AK(i,e){let t=te.useId(),n=SI(),r=ZT(),{id:o=n||`headlessui-textarea-${t}`,disabled:l=r||!1,autoFocus:u=!1,invalid:h=!1,...m}=i,_=SK(),p=yK(),{isFocused:y,focusProps:x}=mI({autoFocus:u}),{isHovered:T,hoverProps:M}=pI({isDisabled:l}),A=xI({ref:e,id:o,"aria-labelledby":_,"aria-describedby":p,"aria-invalid":h?"true":void 0,disabled:l||void 0,autoFocus:u},x,M),w=WT({disabled:l,invalid:h,hover:T,focus:y,autofocus:u});return KT()({ourProps:A,theirProps:m,slot:w,defaultTag:wK,name:"Textarea"})}let CK=QT(AK);const RK=i=>te.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...i},te.createElement("path",{d:"M8 1.25C6.66498 1.25 5.35994 1.64588 4.2499 2.38758C3.13987 3.12928 2.27471 4.18349 1.76382 5.41689C1.25292 6.65029 1.11925 8.00749 1.3797 9.31686C1.64015 10.6262 2.28303 11.829 3.22703 12.773C4.17104 13.717 5.37377 14.3598 6.68314 14.6203C7.99252 14.8808 9.34971 14.7471 10.5831 14.2362C11.8165 13.7253 12.8707 12.8601 13.6124 11.7501C14.3541 10.6401 14.75 9.33502 14.75 8C14.748 6.2104 14.0362 4.49466 12.7708 3.22922C11.5053 1.96378 9.78961 1.25199 8 1.25ZM8 13.25C6.96165 13.25 5.94662 12.9421 5.08326 12.3652C4.2199 11.7883 3.547 10.9684 3.14964 10.0091C2.75228 9.04978 2.64831 7.99418 2.85088 6.97578C3.05345 5.95738 3.55347 5.02191 4.28769 4.28769C5.02192 3.55346 5.95738 3.05345 6.97578 2.85088C7.99418 2.6483 9.04978 2.75227 10.0091 3.14963C10.9684 3.54699 11.7883 4.2199 12.3652 5.08326C12.9421 5.94661 13.25 6.96165 13.25 8C13.2485 9.39193 12.6949 10.7264 11.7107 11.7107C10.7264 12.6949 9.39193 13.2485 8 13.25ZM7.25 8.25V5C7.25 4.80109 7.32902 4.61032 7.46967 4.46967C7.61032 4.32902 7.80109 4.25 8 4.25C8.19892 4.25 8.38968 4.32902 8.53033 4.46967C8.67098 4.61032 8.75 4.80109 8.75 5V8.25C8.75 8.44891 8.67098 8.63968 8.53033 8.78033C8.38968 8.92098 8.19892 9 8 9C7.80109 9 7.61032 8.92098 7.46967 8.78033C7.32902 8.63968 7.25 8.44891 7.25 8.25ZM9 10.75C9 10.9478 8.94135 11.1411 8.83147 11.3056C8.72159 11.47 8.56541 11.5982 8.38269 11.6739C8.19996 11.7496 7.99889 11.7694 7.80491 11.7308C7.61093 11.6922 7.43275 11.597 7.2929 11.4571C7.15304 11.3173 7.0578 11.1391 7.01922 10.9451C6.98063 10.7511 7.00044 10.55 7.07612 10.3673C7.15181 10.1846 7.27998 10.0284 7.44443 9.91853C7.60888 9.80865 7.80222 9.75 8 9.75C8.26522 9.75 8.51957 9.85536 8.70711 10.0429C8.89465 10.2304 9 10.4848 9 10.75Z",fill:"currentColor"}));function RI({message:i,className:e,...t}){return $e.jsxs("div",{...t,className:Co("message flex h-fit min-h-9 w-fit max-w-70 flex-row items-center justify-center gap-1 bg-black",e),children:[$e.jsx(RK,{}),$e.jsx("span",{children:i})]})}let tM=()=>({emit(i,...e){for(let t=this.events[i]||[],n=0,r=t.length;n<r;n++)t[n](...e)},events:{},on(i,e){return(this.events[i]||=[]).push(e),()=>{this.events[i]=this.events[i]?.filter(t=>e!==t)}}});class i1 extends Error{constructor(e,t){e instanceof Error?(super(e.message),this.cause=e):super(e),this.reason=t,this.name="ReasonError"}}class DI extends i1{constructor(e){super("Rejected",e),this.name="SubscriptionRejectedError"}}class DK extends i1{constructor(e){super(e||"Timed out to receive subscription ack"),this.name="SubscriptionTimeoutError"}}class _c extends i1{constructor(e,t){t?super(e,t):super("Disconnected",e),this.name="DisconnectedError"}}class OK extends _c{constructor(e){super(e,"stale_connection"),this.name="StaleConnectionError"}}function OI(i){return i?`{${Object.keys(i).sort().filter(t=>i[t]!==void 0).map(t=>{let n=JSON.stringify(i[t]);return`${JSON.stringify(t)}:${n}`}).join(",")}}`:""}class LK{constructor(e){this.channel=e,this.listeners=[]}watch(){this.listeners.push(this.channel.on("presence",e=>{if(e.type==="info"){this._state||(this._state=this.stateFromInfo(e));return}this._state&&(e.type==="join"?this._state[e.id]=e.info:e.type==="leave"&&delete this._state[e.id])}))}reset(){delete this._state}dispose(){delete this._info,delete this._state,this.listeners.forEach(e=>e()),this.listeners.length=0}async join(e,t){if(!this._info)return this._info={id:e,info:t},this.channel.perform("$presence:join",this._info)}async leave(){if(!this._info)return;let e=await this.channel.perform("$presence:leave");return delete this._info,e}async info(){return this._state?this._state:(this._promise||(this._promise=this._sync()),await this._promise,this._state)}async _sync(){this.watch();try{let e=await this.channel.perform("$presence:info",{});return this._state=this.stateFromInfo(e),this._state}finally{delete this._promise}}stateFromInfo(e){return e.records.reduce((t,{id:n,info:r})=>(t[n]=r,t),{})}}const Lm=Symbol("state");class uD{constructor(e={}){this.emitter=tM(),this.params=Object.freeze(e),this.presence=new LK(this),this.initialConnect=!0,this[Lm]="idle"}get identifier(){return this._identifier?this._identifier:(this._identifier=OI({channel:this.channelId,...this.params}),this._identifier)}get channelId(){return this.constructor.identifier}get state(){return this[Lm]}attached(e){if(this.receiver){if(this.receiver!==e)throw Error("Already connected to a different receiver");return!1}return this.receiver=e,!0}connecting(){this[Lm]="connecting"}connected(){if(this.state==="connected"||this.state==="closed")return;this[Lm]="connected";let e=!1;this.initialConnect?(this.initialConnect=!1,this.emit("connect",{reconnect:!1,restored:e})):this.emit("connect",{reconnect:!0,restored:e})}restored(){if(this.state==="connected")throw Error("Already connected");this[Lm]="connected";let e=!0,t=!0;this.initialConnect=!1,this.emit("connect",{reconnect:t,restored:e})}disconnected(e){this.state==="disconnected"||this.state==="closed"||(this[Lm]="disconnected",this.presence.reset(),this.emit("disconnect",e))}closed(e){this.state!=="closed"&&(this[Lm]="closed",delete this.receiver,this.initialConnect=!0,this.presence.dispose(),this.emit("close",e))}disconnect(){this.state==="idle"||this.state==="closed"||this.receiver.unsubscribe(this)}async perform(e,t){if(this.state==="idle"||this.state==="closed")throw Error("Channel is not subscribed");return this.receiver.perform(this.identifier,e,t)}async send(e){return this.perform(void 0,e)}async whisper(e){try{await this.perform("$whisper",e)}catch(t){let n=this.receiver?this.receiver.logger:null;n&&n.warn("whisper failed: ",t)}}receive(e,t){this.emit("message",e,t)}on(e,t){return this.emitter.on(e,t)}once(e,t){let n=this.emitter.on(e,(...r)=>{n(),t(...r)});return n}emit(e,...t){return this.emitter.emit(e,...t)}ensureSubscribed(){return this.state==="connected"?Promise.resolve():this.state==="closed"?Promise.reject(Error("Channel is unsubscribed")):this.pendingSubscribe()}pendingSubscribe(){return this._pendingSubscribe?this._pendingSubscribe:(this._pendingSubscribe=new Promise((e,t)=>{let n=[()=>delete this._pendingSubscribe];n.push(this.on("connect",()=>{n.forEach(r=>r()),e()})),n.push(this.on("close",r=>{n.forEach(o=>o()),t(r||new i1("Channel was disconnected before subscribing","canceled"))}))}),this._pendingSubscribe)}}class NK{constructor(e){this.id=e,this.intent="unsubscribed",this.state="idle",this.channels=[],this.disposed=!1,this._pendings=[]}add(e){this.channels.includes(e)||this.channels.push(e)}remove(e){let t=this.channels.indexOf(e);t>-1&&this.channels.splice(t,1)}notify(e,...t){this.state=e==="restored"?"connected":e,t.length===1?this.channels.forEach(n=>n[e](t[0])):this.channels.forEach(n=>n[e]())}pending(e){this._checkIntent(e);let t=this._pendings[0];return!t||t.intent!==e?Promise.resolve():t.promise}ensureResubscribed(){this.disposed||(this.intent=void 0,this.ensureSubscribed())}ensureSubscribed(){if(this.intent==="subscribed")return;if(this.disposed)throw Error("Subscription is disposed");this.intent="subscribed",!this._mergeWithPending("unsubscribed")&&this.subscriber(this)}maybeUnsubscribe(){this.disposed||this.intent==="unsubscribed"||this.channels.length>0||(this.intent="unsubscribed",this._mergeWithPending("subscribed"))||this.unsubscriber(this)}async acquire(e){this._checkIntent(e);let t,r={promise:new Promise(l=>{t=l}),intent:e,release:()=>{this._pendings.splice(this._pendings.indexOf(r),1),t(r)},canceled:!1,acquired:!1},o=this._pendingTop;return this._pendings.push(r),o&&await o.promise,this.gvl&&await this.gvl.acquire(r,e),r.acquired=!0,r}close(e){this.disposed=!0,this.intent=void 0,this.notify("closed",e)}_checkIntent(e){if(!(e==="unsubscribed"||e==="subscribed"))throw Error(`Unknown subscription intent: ${e}`)}get _pendingTop(){return this._pendings.length?this._pendings[this._pendings.length-1]:void 0}_mergeWithPending(e){let t=this._pendingTop;return!t||t.acquired||t.intent!==e?!1:(this._pendings.pop(),t.canceled=!0,!0)}}class kK{constructor(){this.queue=[]}async acquire(e,t){t==="subscribed"&&(this.queue.push(e.promise.then(()=>{this.queue.splice(this.queue.indexOf(e),1)})),this.queue.length>1&&await this.queue[this.queue.length-2])}}class UK{constructor(e){e.concurrentSubscribes===!1&&(this.glv=new kK),this._subscriptions={},this._localToRemote={}}all(){return Object.values(this._subscriptions)}get(e){return this._subscriptions[e]}create(e,{subscribe:t,unsubscribe:n}){let r=this._subscriptions[e]=new NK(e);return r.remoteId=this._localToRemote[e],r.subscriber=t,r.unsubscriber=n,r.gvl=this.glv,r}remove(e){delete this._subscriptions[e],delete this._localToRemote[e]}storeRemoteId(e,t){this._localToRemote[e]=t;let n=this.get(e);n&&(n.remoteId=t)}}class IK{constructor(e={}){this.subscriptions=new UK(e),this._pendingMessages=[],this._remoteToLocal={}}subscribe(e,t){this._remoteToLocal[t]=e,this.subscriptions.storeRemoteId(e,t),this.flush(t)}unsubscribe(e){let t=this.subscriptions.get(e);if(!t)return;let n=t.remoteId;n&&delete this._remoteToLocal[n],this.subscriptions.remove(e)}transmit(e,t,n){let r=this._remoteToLocal[e];if(!r){this._pendingMessages.push([e,t,n]);return}let o=this.subscriptions.get(r);o&&o.channels.forEach(l=>{l.receive(t,n)})}notify(e,t,n){let r=this._remoteToLocal[e];if(!r)return;let o=this.subscriptions.get(r);o&&o.channels.forEach(l=>l.emit(t,n))}close(){this._pendingMessages.length=0}get size(){return this.channels.length}get channels(){return this.subscriptions.all().flatMap(e=>e.channels)}flush(e){let t=[];for(let n of this._pendingMessages)n[0]===e?this.transmit(n[0],n[1],n[2]):t.push(n);this._pendingMessages=t}}const LI={debug:0,info:1,warn:2,error:3};class NI{constructor(e){this.level=e||"warn"}log(e,t,n){LI[e]<LI[this.level]||this.writeLogEntry(e,t,n)}writeLogEntry(){throw Error("Not implemented")}debug(e,t){this.log("debug",e,t)}info(e,t){this.log("info",e,t)}warn(e,t){this.log("warn",e,t)}error(e,t){this.log("error",e,t)}}class r1 extends NI{writeLogEntry(){}}class zK{encode(e){return JSON.stringify(e)}decode(e){try{return JSON.parse(e)}catch{}}}let BK=0;class kI{constructor(e={}){let{logger:t}=e;this.logger=t||new r1,this.pendingSubscriptions={},this.pendingUnsubscriptions={},this.subscribeCooldownInterval=e.subscribeCooldownInterval||250,this.subscribeRetryInterval=e.subscribeRetryInterval||5e3}attached(e){this.cable=e}subscribe(e,t){let n={channel:e};t&&Object.assign(n,t);let r=OI(n);if(this.pendingUnsubscriptions[r]){let l=this.subscribeCooldownInterval*1.5;return this.logger.debug(`unsubscribed recently, cooldown for ${l}`,r),new Promise(u=>{setTimeout(()=>{u(this.subscribe(e,t))},l)})}if(this.pendingSubscriptions[r])return this.logger.warn("subscription is already pending, skipping",r),Promise.reject(Error("Already subscribing"));let o=this.subscribeRetryInterval;return new Promise((l,u)=>{let h=++BK;this.pendingSubscriptions[r]={resolve:l,reject:u,id:h},this.cable.send(this.buildSubscribeRequest(r)),this.maybeRetrySubscribe(h,r,o)})}buildSubscribeRequest(e){return{command:"subscribe",identifier:e}}maybeRetrySubscribe(e,t,n){setTimeout(()=>{let r=this.pendingSubscriptions[t];r&&r.id===e&&(this.logger.warn(`no subscription ack received in ${n}ms, retrying subscribe`,t),this.cable.send(this.buildSubscribeRequest(t)),this.maybeExpireSubscribe(e,t,n))},n)}maybeExpireSubscribe(e,t,n){setTimeout(()=>{let r=this.pendingSubscriptions[t];r&&r.id===e&&(delete this.pendingSubscriptions[t],r.reject(new DK(`Haven't received subscription ack in ${n*2}ms for ${t}`)))},n)}unsubscribe(e){return this.cable.send({command:"unsubscribe",identifier:e}),this.pendingUnsubscriptions[e]=!0,setTimeout(()=>{delete this.pendingUnsubscriptions[e]},this.subscribeCooldownInterval),Promise.resolve()}perform(e,t,n){return t==="$whisper"?this.whisper(e,n):(n||(n={}),n.action||=t,this.cable.send({command:"message",identifier:e,data:JSON.stringify(n)}),Promise.resolve())}whisper(e,t){return this.cable.send({command:"whisper",identifier:e,data:t}),Promise.resolve()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:t,identifier:n,message:r,reason:o,reconnect:l}=e;if(t==="ping")return this.cable.keepalive(e.message);if(this.cable.keepalive(),t==="welcome"){let u=e.sid;return u&&this.cable.setSessionId(u),this.cable.connected()}if(t==="disconnect"){let u=new _c(o);this.reset(u),l===!1?this.cable.closed(u):this.cable.disconnected(u);return}if(t==="confirm_subscription"){let u=this.pendingSubscriptions[n];if(!u){this.logger.error("subscription not found, unsubscribing",{type:t,identifier:n}),this.unsubscribe(n);return}return delete this.pendingSubscriptions[n],u.resolve(n)}if(t==="reject_subscription"){let u=this.pendingSubscriptions[n];return u?(delete this.pendingSubscriptions[n],u.reject(new DI)):this.logger.error("subscription not found",{type:t,identifier:n})}if(r)return{identifier:n,message:r};this.logger.warn(`unknown message type: ${t}`,{message:e})}reset(e){for(let t in this.pendingSubscriptions)this.pendingSubscriptions[t].reject(e);this.pendingSubscriptions={}}recoverableClosure(){return!1}}const UI=()=>Date.now()/1e3|0;class PK extends kI{constructor(e={}){super(e),this.streamsPositions={},this.subscriptionStreams={},this.pendingHistory={},this.pendingPresence={},this.presenceInfo={},this.restoreSince=e.historyTimestamp,this.disableSessionRecovery=e.disableSessionRecovery,this.restoreSince===void 0&&(this.restoreSince=UI()),this.sessionId=void 0,this.sendPongs=e.pongs}reset(e){for(let t in this.pendingPresence)this.pendingPresence[t].reject(e);return this.pendingPresence={},super.reset()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:t,identifier:n,message:r}=e;if(t==="disconnect")return delete this.sessionId,this.cable.setSessionId(""),super.receive(e);if(t==="reject_subscription")return super.receive(e);if(t==="confirm_subscription")return this.subscriptionStreams[n]||(this.subscriptionStreams[n]=new Set),super.receive(e);if(t==="ping")return this.restoreSince&&(this.restoreSince=UI()),this.sendPongs&&this.sendPong(),this.cable.keepalive(e.message);if(this.cable.keepalive(),t==="confirm_history"){this.logger.debug("history result received",e),this.cable.notify("history_received",n);return}if(t==="reject_history"){this.logger.warn("failed to retrieve history",e),this.cable.notify("history_not_found",n);return}if(t==="welcome"){if(this.disableSessionRecovery||(this.sessionId=e.sid,this.sessionId&&this.cable.setSessionId(this.sessionId)),e.restored){let o=e.restored_ids||Object.keys(this.subscriptionStreams);for(let l of o)this.cable.send({identifier:l,command:"history",history:this.historyRequestFor(l)}),this.presenceInfo[l]&&this.cable.send({identifier:l,command:"join",presence:this.presenceInfo[l]});return this.cable.restored(o)}return this.cable.connected(this.sessionId)}if(t==="presence"){let o=r.type;if(o==="info"){let l=this.pendingPresence[n];l&&(delete this.pendingPresence[n],l.resolve(r))}else if(o==="error"){let l=this.pendingPresence[n];l&&(delete this.pendingPresence[n],l.reject(new Error("failed to retrieve presence")))}return{type:t,identifier:n,message:r}}if(r){let o=this.trackStreamPosition(n,e.stream_id,e.epoch,e.offset);return{identifier:n,message:r,meta:o}}this.logger.warn(`unknown message type: ${t}`,{message:e})}perform(e,t,n){switch(t){case"$presence:join":return this.join(e,n);case"$presence:leave":return this.leave(e,n);case"$presence:info":return this.presence(e,n)}return super.perform(e,t,n)}unsubscribe(e){return delete this.presenceInfo[e],super.unsubscribe(e)}buildSubscribeRequest(e){let t=super.buildSubscribeRequest(e),n=this.historyRequestFor(e);n&&(t.history=n,this.pendingHistory[e]=!0);let r=this.presenceInfo[e];return r&&(t.presence=r),t}recoverableClosure(){return!!this.sessionId}historyRequestFor(e){let t={},n=!1;if(this.subscriptionStreams[e])for(let r of this.subscriptionStreams[e]){let o=this.streamsPositions[r];o&&(n=!0,t[r]=o)}if(!(!n&&!this.restoreSince))return{since:this.restoreSince,streams:t}}trackStreamPosition(e,t,n,r){if(!(!t||!n))return this.subscriptionStreams[e]||(this.subscriptionStreams[e]=new Set),this.subscriptionStreams[e].add(t),this.streamsPositions[t]={epoch:n,offset:r},{stream:t,epoch:n,offset:r}}async sendPong(){await new Promise(e=>setTimeout(e,0)),this.cable.state==="connected"&&this.cable.send({command:"pong"})}async join(e,t){return this.presenceInfo[e]=t,this.cable.send({command:"join",identifier:e,presence:t}),Promise.resolve()}async leave(e,t){return delete this.presenceInfo[e],this.cable.send({command:"leave",identifier:e,presence:t}),Promise.resolve()}presence(e,t){return this.pendingPresence[e]?(this.logger.warn("presence is already pending, skipping",e),Promise.reject(Error("presence request is already pending"))):new Promise((n,r)=>{this.pendingPresence[e]={resolve:n,reject:r},this.cable.send({command:"presence",identifier:e,data:t})})}}class FK extends i1{constructor(){super("No connection","closed"),this.name="NoConnectionError"}}class HK extends uD{static identifier="__ghost__";constructor(e,t){super(t),this.channelId=e}set channelId(e){this._channelId=e}get channelId(){return this._channelId}}const VK="$pubsub";class II extends uD{static identifier=VK;async perform(e,t){if(e.startsWith("$"))return super.perform(e,t);throw Error("not implemented")}}const Nm=Symbol("state");class GK{constructor({transport:e,protocol:t,encoder:n,logger:r,lazy:o,hubOptions:l,performFailures:u,transportConfigurator:h}){this.emitter=tM(),this.transport=e,this.encoder=n,this.logger=r||new r1,this.protocol=t,this.performFailures=u||"throw",this.protocol.attached(this),this.hub=new IK(l||{}),this[Nm]="idle",this.handleClose=this.handleClose.bind(this),this.handleIncoming=this.handleIncoming.bind(this),this.transportConfigurator=h,this.transport.on("close",this.handleClose),this.transport.on("data",this.handleIncoming),this.initialConnect=!0,this.recovering=!1,o===!1&&this.connect().catch(()=>{})}get state(){return this[Nm]}async connect(){if(this.state==="connected")return Promise.resolve();if(this.state==="connecting")return this.pendingConnect();let e=this.state==="idle";this[Nm]="connecting";let t=this.pendingConnect();this.logger.debug("connecting");try{this.transportConfigurator&&await this.transportConfigurator(this.transport,{initial:e}),await this.transport.open()}catch(n){this.handleClose(n)}return t}setSessionId(e){this.sessionId=e,this.transport.setParam("sid",e)}connected(){if(this.state==="connected")return;this.logger.info("connected"),this[Nm]="connected",this.recovering&&this.hub.subscriptions.all().forEach(t=>t.notify("disconnected",new _c("recovery_failed"))),this.hub.subscriptions.all().forEach(t=>this._resubscribe(t));let e=!1;this.recovering=!1,this.initialConnect?(this.initialConnect=!1,this.emit("connect",{reconnect:!1,restored:e})):this.emit("connect",{reconnect:!0,restored:e})}restored(e){this.logger.info("connection recovered",{remoteIds:e}),this[Nm]="connected",this.hub.subscriptions.all().forEach(r=>{e&&r.remoteId&&e.includes(r.remoteId)?r.notify("restored"):(r.notify("disconnected",new _c("recovery_failed")),this._resubscribe(r))});let t=!this.initialConnect,n=!0;this.recovering=!1,this.initialConnect=!1,this.emit("connect",{reconnect:t,restored:n})}notify(e,t,n){t&&typeof t!="string"&&(n=t,t=void 0),t?this.hub.notify(t,"info",{type:e,data:n}):this.emit("info",{type:e,data:n})}handleClose(e){this.logger.debug("transport closed",{error:e}),this.disconnected(new _c(e,"transport_closed"))}disconnected(e){(this.state==="connected"||this.state==="connecting")&&(this.logger.info("disconnected",{reason:e}),this[Nm]="disconnected",this.recovering=this.protocol.recoverableClosure(e),this.recovering?this.hub.subscriptions.all().forEach(t=>t.notify("connecting")):this.hub.subscriptions.all().forEach(t=>{t.notify("disconnected",e)}),this.protocol.reset(e),this.hub.close(),this.transport.close(),this.emit("disconnect",e))}closed(e){if(this.state==="closed"||this.state==="idle")return;let t;e&&(t=e instanceof _c?e:new _c(e,void 0)),this.logger.info("closed",{reason:e||"user"}),this[Nm]="closed";let n=t||new _c("cable_closed");this.hub.subscriptions.all().forEach(r=>r.notify("disconnected",n)),this.hub.close(),this.protocol.reset(),this.transport.close(),this.initialConnect=!0,this.emit("close",t)}disconnect(){this.closed()}handleIncoming(e){if(this.state==="closed"||this.state==="idle")return;let t=this.encoder.decode(e);if(t===void 0){this.logger.error("failed to decode message",{message:e});return}this.logger.debug("incoming data",t);let n=this.protocol.receive(t);if(n){this.logger.debug("processed incoming message",n);let{type:r,identifier:o,message:l,meta:u}=n;r?this.hub.notify(o,r,l):this.hub.transmit(o,l,u)}}send(e){if(this.state==="closed")throw Error("Cable is closed");let t=this.encoder.encode(e);if(t===void 0){this.logger.error("failed to encode message",{message:e});return}this.logger.debug("outgoing message",e),this.transport.send(t)}keepalive(e){this.emit("keepalive",e)}streamFrom(e){let t=new II({stream_name:e});return this.subscribe(t)}streamFromSigned(e){let t=new II({signed_stream_name:e});return this.subscribe(t)}subscribeTo(e,t){let n,r;return typeof e=="string"&&(r=e,e=HK),n=r?new e(r,t):new e(t),this.subscribe(n)}subscribe(e){if(!e.attached(this))return e;let t=e.identifier;e.connecting();let n=this.hub.subscriptions.get(t)||this.hub.subscriptions.create(t,{subscribe:r=>this._subscribe(r,e.channelId,e.params),unsubscribe:r=>this._unsubscribe(r)});return n.add(e),n.intent==="subscribed"&&n.state==="connected"&&e.connected(),n.ensureSubscribed(),e}async _resubscribe(e){e.intent!=="subscribed"||!e.channels[0]||(e.notify("connecting"),e.ensureResubscribed())}async _subscribe(e,t,n){let r=e.id;if(this.state==="idle"&&this.connect().catch(()=>{}),this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:r});return}this.logger.debug("acquiring subscribe lock",{identifier:r});let o=await e.acquire("subscribed");if(o.canceled){this.logger.debug("subscribe lock has been canceled",{identifier:r}),o.release();return}if(this.logger.debug("subscribe lock has been acquired",{identifier:r}),e.intent!=="subscribed"){this.logger.debug("cancel subscribe request, already unsubscribed"),o.release();return}if(this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:r}),o.release();return}if(e.state==="connected"){this.logger.debug("already connected, skip subscribe command",{identifier:r}),e.notify("connected"),o.release();return}let l={identifier:t,params:n};this.logger.debug("subscribing",l);try{let u=await this.protocol.subscribe(t,n);this.hub.subscribe(r,u),this.logger.debug("subscribed",{...l,remoteId:u}),e.notify("connected")}catch(u){if(u){if(u instanceof DI&&this.logger.warn("rejected",l),u instanceof _c){this.logger.debug("disconnected during subscription; will retry on connect",l),o.release();return}this.logger.error("failed to subscribe",{error:u,...l})}e.close(u),this.hub.unsubscribe(r)}o.release()}unsubscribe(e){let t=e.identifier,n=this.hub.subscriptions.get(t);if(!n)throw Error(`Subscription not found: ${t}`);n.remove(e),e.closed(),n.maybeUnsubscribe()}async _unsubscribe(e){let t=e.id;this.logger.debug("acquiring unsubscribe lock",{identifier:t});let n=await e.acquire("unsubscribed");if(n.canceled){this.logger.debug("unsubscribe lock has been canceled",{identifier:t}),n.release();return}if(this.logger.debug("unsubscribe lock has been acquired",{identifier:t}),e.intent!=="unsubscribed"){this.logger.debug("cancel unsubscribe, no longer needed",{identifier:t,intent:e.intent}),n.release();return}if(e.state==="disconnected"||e.state==="closed"){this.logger.debug(`already ${e.state} connected, skip unsubscribe command`,{identifier:t}),n.release();return}let r=e.remoteId;if(this.logger.debug("unsubscribing...",{remoteId:r}),this.state!=="connected"){this.logger.debug("unsubscribe skipped (cable is not connected)",{id:t}),e.close(),this.hub.unsubscribe(t),n.release();return}try{await this.protocol.unsubscribe(r),this.logger.debug("unsubscribed remotely",{id:t})}catch(o){o&&(o instanceof _c?this.logger.debug("cable disconnected during the unsubscribe command execution",{id:t,error:o}):this.logger.error("unsubscribe failed",{id:t,error:o}))}e.intent==="unsubscribed"?(e.close(),this.hub.unsubscribe(t)):e.state="closed",n.release()}async perform(e,t,n){if(this.performFailures==="throw")return this._perform(e,t,n);try{return await this._perform(e,t,n)}catch(r){this.performFailures==="warn"&&this.logger.warn("perform failed",{error:r});return}}async _perform(e,t,n){if(this.state==="connecting"&&await this.pendingConnect(),this.state==="closed"||this.state==="disconnected")throw new FK;let r=this.hub.subscriptions.get(e);if(!r)throw Error(`Subscription not found: ${e}`);if(await r.pending("subscribed"),r.intent!=="subscribed")throw Error(`Subscription is closed: ${e}`);let o=r.remoteId,l={id:o,action:t,payload:n};this.logger.debug("perform",l);try{let u=await this.protocol.perform(o,t,n);return u&&this.logger.debug("perform result",{message:u,request:l}),u}catch(u){throw this.logger.error("perform failed",{error:u,request:l}),u}}on(e,t){return this.emitter.on(e,t)}once(e,t){let n=this.emitter.on(e,(...r)=>{n(),t(...r)});return n}emit(e,...t){return this.emitter.emit(e,...t)}pendingConnect(){return this._pendingConnect?this._pendingConnect:(this._pendingConnect=new Promise((e,t)=>{let n=[()=>delete this._pendingConnect];n.push(this.on("connect",()=>{n.forEach(r=>r()),e()})),n.push(this.on("close",r=>{n.forEach(o=>o()),t(r)})),n.push(this.on("disconnect",r=>{n.forEach(o=>o()),t(r)}))}),this._pendingConnect)}}const jK={maxMissingPings:2,maxReconnectAttempts:1/0},Lv=()=>Date.now(),zI=(i,e)=>{e=e||{};let{backoffRate:t,jitterRatio:n,maxInterval:r}=e;return t=t||2,n===void 0&&(n=.5),o=>{let l=i*t**o,u=l*t,h=l+(u-l)*Math.random(),m=2*(Math.random()-.5)*n;return h=h*(1+m),r&&r<h&&(h=r),h}};let BI=class{constructor({pingInterval:e,...t}){if(this.pingInterval=e,!this.pingInterval)throw Error(`Incorrect pingInterval is provided: ${e}`);if(t=Object.assign({},jK,t),this.strategy=t.reconnectStrategy,!this.strategy)throw Error("Reconnect strategy must be provided");this.maxMissingPings=t.maxMissingPings,this.maxReconnectAttempts=t.maxReconnectAttempts,this.logger=t.logger||new r1,this.state="pending_connect",this.attempts=0,this.disconnectedAt=Lv()}watch(e){this.target=e,this.initListeners()}reconnectNow(){return this.state==="connected"||this.state==="pending_connect"||this.state==="closed"?!1:(this.cancelReconnect(),this.state="pending_connect",this.target.connect().catch(e=>{this.logger.info("Failed at reconnecting: "+e)}),!0)}initListeners(){this.unbind=[],this.unbind.push(this.target.on("connect",()=>{this.attempts=0,this.pingedAt=Lv(),this.state="connected",this.cancelReconnect(),this.startPolling()})),this.unbind.push(this.target.on("disconnect",()=>{this.disconnectedAt=Lv(),this.state="disconnected",this.stopPolling(),this.scheduleReconnect()})),this.unbind.push(this.target.on("close",()=>{this.disconnectedAt=Lv(),this.state="closed",this.cancelReconnect(),this.stopPolling()})),this.unbind.push(this.target.on("keepalive",()=>{this.pingedAt=Lv()})),this.unbind.push(()=>{this.cancelReconnect(),this.stopPolling()})}dispose(){delete this.target,this.unbind&&this.unbind.forEach(e=>e()),delete this.unbind}startPolling(){this.pollId&&clearTimeout(this.pollId);let e=this.pingInterval+(Math.random()-.5)*this.pingInterval*.5;this.pollId=setTimeout(()=>{this.checkStale(),this.state==="connected"&&this.startPolling()},e)}stopPolling(){this.pollId&&clearTimeout(this.pollId)}checkStale(){let e=Lv()-this.pingedAt;e>this.maxMissingPings*this.pingInterval&&(this.logger.warn(`Stale connection: ${e}ms without pings`),this.state="pending_disconnect",this.target.disconnected(new OK))}scheduleReconnect(){if(this.attempts>=this.maxReconnectAttempts){this.target.close();return}let e=this.strategy(this.attempts);this.attempts++,this.logger.info(`Reconnecting in ${e}ms (${this.attempts} attempt)`),this.state="pending_reconnect",this.reconnnectId=setTimeout(()=>this.reconnectNow(),e)}cancelReconnect(){this.reconnnectId&&(clearTimeout(this.reconnnectId),delete this.reconnnectId)}};class $K{constructor(e,t={}){this.transports=e,this.transport=null,this.emitter=tM(),this.unbind=[],this.logger=t.logger||new r1}displayName(){return"fallbacked transport"}async open(){for(let e=0;e<this.transports.length;e++){let t=this.transports[e];try{this.transport=t,this.resetListeners(),this.logger.debug(`Trying to connect via ${t.displayName()}`),await t.open(),this.logger.debug(`Connected via ${t.displayName()}`);return}catch(n){this.logger.debug(`Failed to connect via ${t.displayName()}: ${n.message}`)}}throw this.transport=null,this.resetListeners(),new Error("Couldn't connect via any available transport")}send(e){if(!this.transport)throw new Error("No transport is open");this.transport.send(e)}async close(){if(!this.transport)throw new Error("No transport is open");await this.transport.close(),this.transport=null}setURL(){throw new Error("Not implemented. Set URL for each transport separately")}setParam(e,t){this.transports.forEach(n=>{n.setParam(e,t)})}setToken(e,t){this.transports.forEach(n=>{n.setToken(e,t)})}on(e,t){return this.emitter.on(e,t)}once(e,t){let n=this.emitter.on(e,(...r)=>{n(),t(...r)});return n}get url(){return this.transport?this.transport.url:""}resetListeners(){this.unbind.forEach(e=>e()),this.unbind.length=0,this.transport&&this.unbind.push(this.transport.on("open",()=>{this.emitter.emit("open")}),this.transport.on("data",e=>{this.emitter.emit("data",e)}),this.transport.on("close",e=>{this.emitter.emit("close",e)}),this.transport.on("error",e=>{this.emitter.emit("error",e)}))}}class XK{constructor(e,t={}){this.url=e;let n=t.websocketImplementation;if(n)this.Impl=n;else if(typeof WebSocket<"u")this.Impl=WebSocket;else throw new Error("No WebSocket support");this.connected=!1,this.emitter=tM();let{format:r,subprotocol:o,authStrategy:l}=t;this.format=r||"text",this.connectionOptions=t.websocketOptions,this.authStrategy=l||"param",this.authProtocol="",this.subprotocol=o}displayName(){return"WebSocket("+this.url+")"}open(){let e=this.subprotocol;return this.authStrategy==="sub-protocol"&&(e=[this.subprotocol,this.authProtocol]),this.connectionOptions?this.ws=new this.Impl(this.url,e,this.connectionOptions):this.ws=new this.Impl(this.url,e),this.ws.binaryType="arraybuffer",this.initListeners(),new Promise((t,n)=>{let r=[];r.push(this.once("open",()=>{r.forEach(o=>o()),t()})),r.push(this.once("close",()=>{r.forEach(o=>o()),n(Error("WS connection closed"))}))})}setURL(e){this.url=e}setParam(e,t){let n=new URL(this.url);n.searchParams.set(e,t);let r=`${n.protocol}//${n.host}${n.pathname}?${n.searchParams}`;this.setURL(r)}setToken(e,t="jid"){if(this.authStrategy==="param")this.setParam(t,e);else if(this.authStrategy==="header"){this.connectionOptions=this.connectionOptions||{},this.connectionOptions.headers=this.connectionOptions.headers||{};let n=`x-${t}`.toLowerCase();n=Object.keys(this.connectionOptions.headers).find(o=>o.toLowerCase()===n)||n,this.connectionOptions.headers[n]=e}else if(this.authStrategy==="sub-protocol")this.authProtocol=`anycable-token.${e}`;else throw new Error("Unknown auth strategy: "+this.authStrategy)}send(e){if(!this.ws||!this.connected)throw Error("WebSocket is not connected");this.ws.send(e)}close(){this.ws?this.onclose():this.connected=!1}on(e,t){return this.emitter.on(e,t)}once(e,t){let n=this.emitter.on(e,(...r)=>{n(),t(...r)});return n}initListeners(){this.ws.onerror=e=>{this.connected&&this.emitter.emit("error",e.error||new Error("WS Error"))},this.ws.onclose=()=>{this.onclose()},this.ws.onmessage=e=>{let t=e.data;this.format==="binary"&&(t=new Uint8Array(t)),this.emitter.emit("data",t)},this.ws.onopen=()=>{this.connected=!0,this.emitter.emit("open")}}onclose(){this.ws.onclose=void 0,this.ws.onmessage=void 0,this.ws.onopen=void 0,this.ws.close(),delete this.ws,this.connected=!1,this.emitter.emit("close")}}const PI={protocol:"actioncable-v1-json",pingInterval:3e3,maxReconnectAttempts:1/0,maxMissingPings:2,logLevel:"warn",lazy:!0};function qK(i,e){if(typeof i=="object"&&typeof e>"u"&&(e=i,i=void 0),e=e||{},!i&&!e.transport)throw Error("URL or transport must be specified");e=Object.assign({},PI,e);let{protocol:t,websocketImplementation:n,websocketFormat:r,websocketOptions:o,websocketAuthStrategy:l,fallbacks:u,logLevel:h,logger:m,transport:_,encoder:p,lazy:y,monitor:x,pingInterval:T,reconnectStrategy:M,maxMissingPings:A,maxReconnectAttempts:w,subprotocol:L,tokenRefresher:N,historyTimestamp:I,protocolOptions:z,concurrentSubscribes:P,performFailures:H,transportConfigurator:W,auth:U}=e;if(m=m||new r1(h),typeof t=="string"){L=L||t;let ne=t.substring(0,t.lastIndexOf("-")),ie=t.substring(t.lastIndexOf("-")+1);if(z=z||{},ne==="actioncable-v1")t=new kI({logger:m,...z});else if(ne==="actioncable-v1-ext")t=new PK({logger:m,historyTimestamp:I,...z});else throw Error(`Protocol is not supported yet: ${t}`);if(ie==="json")p=p||new zK,r=r||"text";else if(ie==="msgpack"){if(r="binary",!p)throw Error("Msgpack encoder must be specified explicitly. Use `@anycable/msgpack-encoder` package or build your own")}else if(ie==="protobuf"){if(r=r||"binary",!p)throw Error("Protobuf encoder must be specified explicitly. Use `@anycable/protobuf-encoder` package or build your own")}else throw Error(`Protocol is not supported yet: ${t}`)}if(!t)throw Error("Protocol must be specified");_=_||new XK(i,{websocketImplementation:n,websocketOptions:o,subprotocol:L,authStrategy:l,format:r}),u&&(_=new $K([_,...u],{logger:m})),U&&U.token&&_.setToken(U.token,U.param||"jid"),M=M||zI(T),x!==!1&&(x=x||new BI({pingInterval:T,reconnectStrategy:M,maxMissingPings:A,maxReconnectAttempts:w,logger:m}));let V={concurrentSubscribes:P},J=new GK({protocol:t,transport:_,encoder:p,logger:m,lazy:y,hubOptions:V,performFailures:H,transportConfigurator:W});return x&&(x.watch(J),J.monitor=x),N&&YK(J,async()=>{try{await N(_)}catch(ne){return m.error("Failed to refresh authentication token: "+ne),!1}return J.connect().catch(()=>{}),!0}),J}function YK(i,e){let t=!1;i.on("connect",()=>t=!1),i.on("close",async n=>{if(n){if(t){i.logger.warn("Token auto-refresh is disabled",n);return}n.reason==="token_expired"&&(t=!0,await e())}})}let WK=class extends NI{writeLogEntry(e,t,n){n?console[e](t,n):console[e](t)}};class ZK extends BI{watch(e){super.watch(e),this.initActivityListeners()}initActivityListeners(){if(typeof document<"u"&&typeof window<"u"&&document.addEventListener&&window.addEventListener){let e=()=>{document.hidden||this.reconnectNow()&&this.logger.debug("Trigger reconnect due to visibility change")},t=r=>{this.reconnectNow()&&this.logger.debug("Trigger reconnect",{event:r})},n=()=>this.disconnect(new _c("page_frozen"));document.addEventListener("visibilitychange",e,!1),window.addEventListener("focus",t,!1),window.addEventListener("online",t,!1),window.addEventListener("resume",t,!1),window.addEventListener("freeze",n,!1),this.unbind.push(()=>{document.removeEventListener("visibilitychange",e,!1),window.removeEventListener("focus",t,!1),window.removeEventListener("online",t,!1),window.removeEventListener("resume",t,!1),window.removeEventListener("freeze",n,!1)})}}disconnect(e){this.state==="disconnected"||this.state==="closed"||(this.logger.info("Disconnecting",{reason:e.message}),this.cancelReconnect(),this.stopPolling(),this.state="pending_disconnect",this.target.disconnected(e))}}const KK=["cable","action-cable"],JK="/cable",nM=(i,e)=>{for(let t of KK){let n=i.head.querySelector(`meta[name='${t}-${e}']`);if(n)return n.getAttribute("content")}},FI=i=>i.match(/wss?:\/\//)?i:typeof window<"u"?`${window.location.protocol.replace("http","ws")}//${window.location.host}${i}`:i,QK=()=>{if(typeof document<"u"&&document.head){let i=nM(document,"url");if(i)return FI(i)}return FI(JK)},eJ=()=>{if(typeof document<"u"&&document.head){let i=nM(document,"history-timestamp");if(i)return i|0}},tJ=()=>{if(typeof document<"u"&&document.head)return nM(document,"token")},nJ=()=>{if(typeof document<"u"&&document.head)return nM(document,"token-param")};function iJ(i,e){typeof i=="object"&&typeof e>"u"&&(e=i,i=void 0),i=i||QK(),e=e||{},e.historyTimestamp||=eJ();let t=tJ();if(t){let m=nJ();e.auth=Object.assign({token:t,param:m},e.auth||{})}e=Object.assign({},PI,e);let{logLevel:n,logger:r,pingInterval:o,reconnectStrategy:l,maxMissingPings:u,maxReconnectAttempts:h}=e;return r=e.logger=e.logger||new WK(n),l=e.reconnectStrategy=e.reconnectStrategy||zI(o),e.monitor!==!1&&(e.monitor=e.monitor||new ZK({pingInterval:o,reconnectStrategy:l,maxMissingPings:u,maxReconnectAttempts:h,logger:r})),qK(i,e)}class rJ extends uD{static identifier="WidgetChatChannel"}const a1={debug:0,info:1,warn:2,error:3};class aJ{level;prefix;constructor(e="Widget",t="info"){this.prefix=`[${e}]`,this.level=a1[t]}debug(...e){this.level<=a1.debug&&console.debug(this.prefix,...e)}info(...e){this.level<=a1.info&&console.info(this.prefix,...e)}warn(...e){this.level<=a1.warn&&console.warn(this.prefix,...e)}error(...e){this.level<=a1.error&&console.error(this.prefix,...e)}}let HI="warn";window.location.search.includes("widget-debug")&&(HI="debug");const In=new aJ("BridgeApp-Widget",HI);window.addEventListener("error",i=>{console.error("Unhandled error",i.error)});class sJ{url;cable;channels={chat:new rJ};constructor(e){this.url=e,this.register()}subscribe(e){return In.info("SUBSCRIBE","[AnyCableService] Subscribing to channel",e.identifier),this.cable?.subscribe(e),this}unsubscribe(e){return this.cable?.unsubscribe(e),this}register(){return In.info("[AnyCableService] Registering cable with status: ",this.cable?.state),this.cable||(In.info("[AnyCableService] Creating cable"),this.cable=iJ(this.url,{pingInterval:3e3,protocol:"actioncable-v1-ext-json",protocolOptions:{pongs:!0,subscribeRetryInterval:3e4}})),this.cable.state!=="connecting"&&this.cable.state!=="connected"&&(In.info("[AnyCableService] Connecting cable, state: ",this.cable.state),this.cable.connect().then(()=>{In.info("[AnyCableService] Cable connected, subscribing to channel: ",this.channels.chat.identifier),this.cable.subscribe(this.channels.chat)})),this}unregister(){this.cable&&(In.info("[AnyCableService] Disconnecting cable"),this.cable.disconnect())}}var bc=(i=>(i.Pending="pending",i.Available="available",i.Offline="offline",i.Unavailable="unavailable",i))(bc||{});const VI=te.createContext(void 0),oJ=i=>{const[e,t]=te.useState(!1),[n,r]=te.useState(bc.Pending),o=te.useRef(n);te.useEffect(()=>{o.current=n},[n]);const l=te.useRef(null);return te.useEffect(()=>{const u=new sJ(`${i.wsUrl}?access_token=${i.customerInteractionSession.accessToken}`);return l.current=u,u.channels.chat.on("info",h=>{h.type==="reject_history"&&document.location.reload()}),u.channels.chat.on("connect",()=>{console.info("[CableContext] Connected to the chat channel"),r(bc.Available)}),u.channels.chat.on("disconnect",h=>{r(bc.Unavailable),console.warn("[CableContext] Disconnected from the chat channel",h)}),window.addEventListener("online",()=>{o.current===bc.Offline&&r(bc.Available)}),window.addEventListener("offline",()=>{r(bc.Offline)}),u.channels.chat.on("close",h=>{console.warn("[CableContext] Closed the chat channel",h)}),setTimeout(()=>t(!0),0),()=>{l.current&&(l.current.unregister(),l.current=null),t(!1)}},[i.customerInteractionSession.accessToken]),e?{anycableService:l,networkStatus:n}:null},lJ=({children:i,config:e})=>{const t=oJ(e);return t?$e.jsx(VI.Provider,{value:t,children:i}):null},fD=()=>{const i=te.useContext(VI);if(i===void 0)throw new Error("useCable must be used within an CableProvider");return i},Nv={connectionFailed:"Connection failed",offline:"You're offline",agentResponseFailed:"Agent response failed",sendMessageFallback:"Failed to send message"},GI=i=>{let e;const t=new Set,n=(m,_)=>{const p=typeof m=="function"?m(e):m;if(!Object.is(p,e)){const y=e;e=_??(typeof p!="object"||p===null)?p:Object.assign({},e,p),t.forEach(x=>x(e,y))}},r=()=>e,u={setState:n,getState:r,getInitialState:()=>h,subscribe:m=>(t.add(m),()=>t.delete(m))},h=e=i(n,r,u);return u},cJ=(i=>i?GI(i):GI),uJ=i=>i;function fJ(i,e=uJ){const t=tm.useSyncExternalStore(i.subscribe,tm.useCallback(()=>e(i.getState()),[i,e]),tm.useCallback(()=>e(i.getInitialState()),[i,e]));return tm.useDebugValue(t),t}const jI=i=>{const e=cJ(i),t=n=>fJ(e,n);return Object.assign(t,e),t},$I=(i=>i?jI(i):jI);function s1(i,e){i.message.includes("401")&&e?.()}const XI=async(i,e)=>{try{console.log("startVoiceSession",{config:i,api:e});const t=await fetch(`${i.apiUrl}/agents.Agents/StartVoiceSession`,{method:"POST",headers:{Authorization:`Bearer ${i.customerInteractionSession.accessToken}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({agentId:i.agentId,voiceModelId:i.voiceModelId,voiceConfig:i.voiceConfig})});return{status:t.status,json:await t.json()}}catch(t){throw s1(t,e.onSessionExpired),t}};async function dD(i,e,t,n){try{const r=await fetch(`${i.apiUrl}/agents.Agents/EndVoiceSession`,{method:"POST",headers:{Authorization:`Bearer ${i.customerInteractionSession.accessToken}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voiceSessionId:t,reason:n})});if(!r.ok)throw new Error(`Request failed: ${r.status} ${r.statusText}`);return await r.json()}catch(r){throw s1(r,e.onSessionExpired),r}}async function dJ({voiceBaseUrl:i,voiceSessionId:e,sessionToken:t,clientInstanceId:n,protocolVersion:r,expectedConnectionGeneration:o,offerSdp:l}){try{In.debug("sendOffer",{voiceSessionId:e,clientInstanceId:n,protocolVersion:r,expectedConnectionGeneration:o,offerSdpLength:l.length});const u=await fetch(`${i}/SendOffer`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voiceSessionId:e,sessionToken:t,clientInstanceId:n,protocolVersion:r,expectedConnectionGeneration:o,offerSdp:l})});if(!u.ok)throw new Error(`Request failed: ${u.status} ${u.statusText}`);return await u.json()}catch(u){throw console.error("Request failed:",u),u}}async function hJ({voiceBaseUrl:i,voiceSessionId:e,sessionToken:t,clientInstanceId:n,connectionId:r,connectionGeneration:o,candidates:l}){try{const u=await fetch(`${i}/SendCandidates`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voiceSessionId:e,sessionToken:t,clientInstanceId:n,connectionId:r,connectionGeneration:o,candidates:l})});if(!u.ok)throw new Error(`Request failed: ${u.status} ${u.statusText}`)}catch(u){throw console.error("Request failed:",u),u}}async function pJ({voiceBaseUrl:i,voiceSessionId:e,sessionToken:t,clientInstanceId:n,connectionId:r,connectionGeneration:o,reason:l}){const u=await fetch(`${i}/EndSession`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voiceSessionId:e,sessionToken:t,clientInstanceId:n,connectionId:r,connectionGeneration:o,reason:l})});if(!u.ok)throw new Error(`Request failed: ${u.status} ${u.statusText}`)}async function mJ({voiceBaseUrl:i,voiceSessionId:e,sessionToken:t,clientInstanceId:n,protocolVersion:r}){const o=await fetch(`${i}/GetTurnBootstrap`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({voiceSessionId:e,sessionToken:t,clientInstanceId:n,protocolVersion:r})});if(!o.ok)throw new Error(`Request failed: ${o.status} ${o.statusText}`);return await o.json()}const iM=globalThis.crypto?.randomUUID?.()??`widget-${Date.now()}-${Math.random().toString(16).slice(2)}`;function rM(){return{activeVoiceSessionData:null,config:null,api:null,status:"idle",errorMessage:null,isVoiceBootstrapped:!1,connection:null,connectionId:null,connectionGeneration:null,iceCandidates:[],voiceEventsChannel:null,voiceInputChannel:null,downstream:null,upstream:null,localStream:null,remoteAudioElement:null,customerMessageTranscript:"",customerMessageTranscriptVisible:!1,assistantMessageTranscript:"",assistantMessageTranscriptVisible:!1,assistantResponseInProgress:!1,microphoneEnabled:!1,inputAudioDevice:null,audioInputDevices:[]}}function hD(i){i?.getTracks().forEach(e=>e.stop())}function qI(i){if(!(!i||i.readyState==="closed"))try{i.close()}catch(e){In.debug("Failed to close data channel",e)}}function gJ(i){if(!(!i||i.connectionState==="closed"))try{i.close()}catch(e){In.debug("Failed to close peer connection",e)}}function YI(i){qI(i.voiceEventsChannel),qI(i.voiceInputChannel),gJ(i.connection),hD(i.localStream),hD(i.downstream),i.remoteAudioElement&&(i.remoteAudioElement.pause(),i.remoteAudioElement.srcObject=null)}function vJ(i){return i instanceof Error?i.message:"Voice session failed"}const pr=$I((i,e)=>({...rM(),actions:{initVoiceStore:async(t,n)=>{const{getLocalStream:r}=e().actions,o=await r();if(!o)throw new Error("No local stream available");const l=o.getAudioTracks()[0];if(!l)throw hD(o),new Error("No audio input track available");i({config:t,localStream:o,status:"connecting"});try{let u=await XI(t,n);if(u.status===409){const x=u.json.message.split(" ").pop();x&&(await dD(t,n,x,"replace_stale_session"),u=await XI(t,n))}if(u.status>=400)throw new Error(u.json.message||"Unable to start voice session");const h=u.json;In.debug("StartVoiceSession response",{sessionId:h.session.id,voiceBaseUrl:h.voiceBaseUrl,voiceProtocolVersion:h.voiceProtocolVersion});const m=await mJ({voiceBaseUrl:h.voiceBaseUrl,voiceSessionId:h.session.id,sessionToken:h.sessionToken,clientInstanceId:iM,protocolVersion:h.voiceProtocolVersion});h.voiceTurn=m,i({activeVoiceSessionData:h});const _=e().actions.createConnection();i({connection:_}),_.ondatachannel=y=>{In.debug("ondatachannel",y.channel.label),y.channel.label==="voice-events"&&(i({voiceEventsChannel:y.channel}),y.channel.onmessage=x=>{e().actions.onVoiceEventsEvent(x)}),y.channel.label==="voice-input"&&(i({voiceInputChannel:y.channel}),y.channel.onmessage=x=>{e().actions.onVoiceInputEvent(x)})},_.addEventListener("track",y=>{const x=y.streams[0];x&&(In.debug("Received remote audio track"),i({downstream:x}),e().actions.playRemoteAudio(x))}),_.onicecandidate=y=>{if(y.candidate){i(x=>({iceCandidates:[...x.iceCandidates,y.candidate?.toJSON()??{}]}));return}e().actions.sendCandidates()},_.addEventListener("connectionstatechange",()=>{if(In.debug("Peer connection state",_.connectionState),_.connectionState==="connected"){i({status:"live",errorMessage:null});return}(_.connectionState==="failed"||_.connectionState==="disconnected")&&i({status:"error",errorMessage:"Voice connection was interrupted"})}),_.addTrack(l,o),_.createDataChannel("voice-bootstrap");const p=await _.createOffer();await _.setLocalDescription(p),e().actions.sendOffer(p)}catch(u){In.error("Voice bootstrap failed",u);const h=e().activeVoiceSessionData;if(h)try{await dD(t,n,h.session.id,"bootstrap_failed")}catch(m){In.warn("Failed to close voice session after bootstrap error",m)}throw YI(e()),i({...rM(),status:"error",errorMessage:vJ(u)}),u}},sendOffer:async t=>{const n=e().activeVoiceSessionData;if(!n)throw new Error("Voice session data not found");const r=e().connection;if(!r)throw new Error("Peer connection not found");const o=await dJ({voiceBaseUrl:n.voiceBaseUrl,voiceSessionId:n.session.id,sessionToken:n.sessionToken,clientInstanceId:iM,protocolVersion:n.voiceProtocolVersion,expectedConnectionGeneration:0,offerSdp:r.localDescription?.sdp??t.sdp??""});In.debug("SendOffer response",{connectionId:o.connectionId,connectionGeneration:o.connectionGeneration}),i({connectionId:o.connectionId,connectionGeneration:o.connectionGeneration,isVoiceBootstrapped:!0}),await r.setRemoteDescription({type:"answer",sdp:o.answerSdp}),await e().actions.sendCandidates()},sendCandidates:async()=>{const t=e().activeVoiceSessionData,n=e().connectionId,r=e().connectionGeneration,o=e().iceCandidates;if(!(!t||!n||r==null||o.length===0)){i({iceCandidates:[]});try{await hJ({voiceBaseUrl:t.voiceBaseUrl,voiceSessionId:t.session.id,sessionToken:t.sessionToken,clientInstanceId:iM,connectionId:n,connectionGeneration:r,candidates:o}),In.debug("Sent ICE candidates",{count:o.length})}catch(l){throw In.error("Failed to send ICE candidates",l),i(u=>({iceCandidates:[...o,...u.iceCandidates]})),l}}},createConnection:()=>{const t=e().activeVoiceSessionData;if(!t)throw new Error("Voice session data not found");if(!t.voiceTurn)throw new Error("Voice turn not found");const n={urls:t.voiceTurn.urls,username:t.voiceTurn.username,credential:t.voiceTurn.credential};return new RTCPeerConnection({iceServers:[n]})},playRemoteAudio(t){let n=e().remoteAudioElement;n||(n=new Audio,n.autoplay=!0,i({remoteAudioElement:n})),n.srcObject=t,n.muted=!1,n.play().catch(r=>{In.debug("audioElement play error",r)})},endVoiceSession:async(t="user_hangup")=>{const{activeVoiceSessionData:n,config:r,api:o,connectionGeneration:l,connectionId:u,voiceInputChannel:h}=e();if(!n&&!e().connection&&!e().localStream&&!e().downstream){i(rM());return}i({status:"ending"});try{h?.readyState==="open"&&h.send(JSON.stringify({type:"end_session",reason:t}))}catch(m){In.warn("Failed to notify runtime about session end",m)}try{n&&u&&l!=null&&await pJ({voiceBaseUrl:n.voiceBaseUrl,voiceSessionId:n.session.id,sessionToken:n.sessionToken,clientInstanceId:iM,connectionId:u,connectionGeneration:l,reason:t})}catch(m){In.warn("Failed to end WebRTC session",m)}try{n&&await dD(r,o,n.session.id,t)}catch(m){In.warn("Failed to end voice session",m)}finally{YI(e()),i(rM())}},setMicrophoneEnabled:t=>{e().localStream?.getAudioTracks().forEach(n=>n.enabled=t),i({microphoneEnabled:t})},onVoiceEventsEvent:t=>{try{const n=JSON.parse(t.data);switch(In.debug("voice-events message",n),n.type){case"input_audio_speech_started":i({customerMessageTranscript:"",assistantMessageTranscriptVisible:!1});break;case"response_started":i({assistantResponseInProgress:!0,assistantMessageTranscript:""});break;case"assistant_transcript_delta":i({assistantMessageTranscript:e().assistantMessageTranscript+(n.text??""),assistantMessageTranscriptVisible:!0});break;case"assistant_transcript_final":i({assistantMessageTranscript:n.text??"",assistantMessageTranscriptVisible:!0});break;case"response_cancelled":case"assistant_turn_done":case"assistant_turn_failed":i({assistantResponseInProgress:!1});break;case"user_transcript_delta":i({customerMessageTranscriptVisible:!0,customerMessageTranscript:e().customerMessageTranscript+(n.text??"")});break;case"user_transcript_final":i({customerMessageTranscriptVisible:!0,customerMessageTranscript:n.text??""});break;case"realtime_error":i({status:"error",errorMessage:n.message??"Voice session failed"});break}}catch(n){In.warn("Failed to parse voice-events payload",n)}},onVoiceInputEvent:t=>{try{const n=JSON.parse(t.data);In.debug("voice-input message",n)}catch(n){In.warn("Failed to parse voice-input payload",n)}},getLocalStream:async t=>{const n=t||e().inputAudioDevice?.deviceId;if(!n)throw new Error("No audio device selected");if(!navigator.mediaDevices?.getUserMedia)throw new Error("getUserMedia is not supported in this browser");const r=(l=!1)=>{const u={},h={};return u.audio=!l&&n?{...h,deviceId:{exact:n}}:h,u},o=r();try{return await navigator.mediaDevices.getUserMedia(o)}catch(l){In.debug({error:l});const u=l?.name;if(n&&(u==="OverconstrainedError"||u==="NotFoundError"||u==="NotReadableError")){In.warn("getUserMedia failed with selected audio device, retrying with default. Error:",l);const m=r(!0);try{return await navigator.mediaDevices.getUserMedia(m)}catch(_){throw In.error("[gUM] retry with default audio failed",_),_}}throw console.error("[gUM] failed",l),l}},setNewLocalStream:async()=>{const{localStream:t,microphoneEnabled:n,actions:{setMicrophoneEnabled:r,getLocalStream:o}}=e();if(!n){try{t?.getTracks().forEach(l=>l.stop()),pr.setState({localStream:null})}finally{r(!1)}return}try{t?.getTracks().forEach(u=>u.stop()),pr.setState({localStream:null});const l=await o();if(!l)return;pr.setState({localStream:l}),r(n)}catch{r(!n)}},createAudioTrack:async()=>{const{getLocalStream:t}=e().actions,n=await t();return n?n.getAudioTracks()[0]??null:null},attachAudioTrack:async(t,{replaceExisting:n})=>{let{localStream:r}=e();const{connection:o,connectionId:l}=e(),u=r?.getAudioTracks()[0];if(r?n&&u&&(u.stop(),r.removeTrack(u)):r=new MediaStream,u&&!n)return u;if(r.addTrack(t),o){const h=o,m=l;if(h.connectionState==="closed")return console.warn(`Cannot attach audio track: peer connection ${m} is closed`),t;let _=h.getSenders().find(p=>p.track?.kind==="audio");if(!_)_=h.addTrack(t,r);else try{await _.replaceTrack(t),_.track?.id!==t.id&&console.warn(`Track replacement may not have completed for ${m}, sender track ID: ${_.track?.id}, new track ID: ${t.id}`)}catch(p){return console.error("replaceTrack audio failed:",p),t}finally{In.debug("track replaced")}}return t},ensureAudioTrack:async()=>{const{localStream:t,actions:{createAudioTrack:n,attachAudioTrack:r}}=e();if(t?.getAudioTracks()[0])return!0;const l=await n();return l?(await r(l,{replaceExisting:!1}),!0):!1},recreateAudioTrack:async()=>{const{actions:{createAudioTrack:t,attachAudioTrack:n}}=e(),r=await t();return r?(await n(r,{replaceExisting:!0}),!0):!1},enableMicrophone:async()=>{const{microphoneEnabled:t,actions:{setMicrophoneEnabled:n,ensureAudioTrack:r}}=e();if(t)return;if(!await r())throw new Error("Failed to enable the microphone. Check the input device in the settings.");n(!0)},disableMicrophone:()=>{const{microphoneEnabled:t,actions:{setMicrophoneEnabled:n}}=e();t&&n(!1)},switchAudio:async()=>{const{microphoneEnabled:t,actions:{disableMicrophone:n,enableMicrophone:r}}=e();t?n():await r()},refreshAudioProcessing:async()=>{const{microphoneEnabled:t,actions:{recreateAudioTrack:n}}=e();if(!t)return;if(!await n())throw Error("Failed to update the microphone. Check the input device in the settings.")},switchInputAudioDevice:async t=>{const{actions:{getLocalStream:n,setMicrophoneEnabled:r,attachAudioTrack:o},microphoneEnabled:l}=e();try{let u=t.deviceId,h=t;if(t.deviceId==="default"&&t.label)try{const x=(await navigator.mediaDevices.enumerateDevices()).find(T=>T.kind==="audioinput"&&T.label===t.label&&T.deviceId!=="default");x&&(u=x.deviceId,h=x)}catch(y){console.error("Error enumerating devices:",y)}const m=await n(u);if(!m)throw new Error("Failed to get new audio stream");l||r(!0),pr.setState({inputAudioDevice:h});const _=m.getAudioTracks()[0];if(!_)throw new Error("No audio track in new stream");const p=_.getSettings().deviceId;if(u&&p&&p!==u&&u!=="default"){console.error(`Mic switch mismatch. Requested deviceId=${u}, got deviceId=${p}`);try{const x=(await navigator.mediaDevices.enumerateDevices()).find(T=>T.kind==="audioinput"&&T.deviceId===p);x&&(h=x)}catch(y){console.error("Failed to enumerate devices after mismatch:",y)}}await o(_,{replaceExisting:!0})}catch(u){console.error("Error switching audio device:",u)}}}})),WI=()=>pr(i=>i.actions);var ZI=function(i){te.useEffect(i,[])},yJ=function(i){ZI(function(){i()})},_J=function(i){var e=te.useRef(i);e.current=i,ZI(function(){return function(){return e.current()}})};const bJ=()=>{const[i,e]=te.useState([]),{switchInputAudioDevice:t}=WI(),{audioInputDevices:n}=pr.getState(),r=te.useCallback(async l=>{const u=pr.getState().audioInputDevices,h=l.filter(x=>x.kind==="audioinput"),m=h.filter(x=>!u.find(T=>T.deviceId===x.deviceId)),_=pr.getState().inputAudioDevice||m[0],p=m.find(x=>x.deviceId==="default")||m[0],y=pr.getState().isVoiceBootstrapped;if(pr.setState({audioInputDevices:h}),!y){pr.setState({inputAudioDevice:p||_});return}console.log("newAudioInputDevice",p),console.log("currentAudioInputDevice",_),p&&p.groupId!==_?.groupId&&t(p),e(u)},[]),o=te.useCallback(async l=>{if(console.log("updateDevices"),console.log("navigator.mediaDevices",navigator.mediaDevices),!!navigator.mediaDevices?.enumerateDevices){l&&In.debug({e:l});try{const u=await navigator.mediaDevices.enumerateDevices();if(!u.some(m=>m.label!=="")){(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(p=>p.stop());const _=await navigator.mediaDevices.enumerateDevices();return r(_)}console.log("deviceList",u),r(u)}catch(u){console.error("Failed to enumerate devices:",u)}}},[]);return yJ(()=>{navigator.mediaDevices?.addEventListener("devicechange",o)}),_J(()=>{navigator.mediaDevices?.removeEventListener("devicechange",o)}),te.useEffect(()=>{const l=pr.getState().inputAudioDevice,u=n.some(h=>h.deviceId===l?.deviceId&&h.groupId===l?.groupId);n?.length>0&&!u&&t(i[0])},[n]),{updateDevices:o}};function Ra(i){this.content=i}Ra.prototype={constructor:Ra,find:function(i){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===i)return e;return-1},get:function(i){var e=this.find(i);return e==-1?void 0:this.content[e+1]},update:function(i,e,t){var n=t&&t!=i?this.remove(t):this,r=n.find(i),o=n.content.slice();return r==-1?o.push(t||i,e):(o[r+1]=e,t&&(o[r]=t)),new Ra(o)},remove:function(i){var e=this.find(i);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ra(t)},addToStart:function(i,e){return new Ra([i,e].concat(this.remove(i).content))},addToEnd:function(i,e){var t=this.remove(i).content.slice();return t.push(i,e),new Ra(t)},addBefore:function(i,e,t){var n=this.remove(e),r=n.content.slice(),o=n.find(i);return r.splice(o==-1?r.length:o,0,e,t),new Ra(r)},forEach:function(i){for(var e=0;e<this.content.length;e+=2)i(this.content[e],this.content[e+1])},prepend:function(i){return i=Ra.from(i),i.size?new Ra(i.content.concat(this.subtract(i).content)):this},append:function(i){return i=Ra.from(i),i.size?new Ra(this.subtract(i).content.concat(i.content)):this},subtract:function(i){var e=this;i=Ra.from(i);for(var t=0;t<i.content.length;t+=2)e=e.remove(i.content[t]);return e},toObject:function(){var i={};return this.forEach(function(e,t){i[e]=t}),i},get size(){return this.content.length>>1}},Ra.from=function(i){if(i instanceof Ra)return i;var e=[];if(i)for(var t in i)e.push(t,i[t]);return new Ra(e)};function KI(i,e,t){for(let n=0;;n++){if(n==i.childCount||n==e.childCount)return i.childCount==e.childCount?null:t;let r=i.child(n),o=e.child(n);if(r==o){t+=r.nodeSize;continue}if(!r.sameMarkup(o))return t;if(r.isText&&r.text!=o.text){for(let l=0;r.text[l]==o.text[l];l++)t++;return t}if(r.content.size||o.content.size){let l=KI(r.content,o.content,t+1);if(l!=null)return l}t+=r.nodeSize}}function JI(i,e,t,n){for(let r=i.childCount,o=e.childCount;;){if(r==0||o==0)return r==o?null:{a:t,b:n};let l=i.child(--r),u=e.child(--o),h=l.nodeSize;if(l==u){t-=h,n-=h;continue}if(!l.sameMarkup(u))return{a:t,b:n};if(l.isText&&l.text!=u.text){let m=0,_=Math.min(l.text.length,u.text.length);for(;m<_&&l.text[l.text.length-m-1]==u.text[u.text.length-m-1];)m++,t--,n--;return{a:t,b:n}}if(l.content.size||u.content.size){let m=JI(l.content,u.content,t-1,n-1);if(m)return m}t-=h,n-=h}}class it{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,r=0,o){for(let l=0,u=0;u<t;l++){let h=this.content[l],m=u+h.nodeSize;if(m>e&&n(h,r+u,o||null,l)!==!1&&h.content.size){let _=u+1;h.nodesBetween(Math.max(0,e-_),Math.min(h.content.size,t-_),n,r+_)}u=m}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",l=!0;return this.nodesBetween(e,t,(u,h)=>{let m=u.isText?u.text.slice(Math.max(e,h)-h,t-h):u.isLeaf?r?typeof r=="function"?r(u):r:u.type.spec.leafText?u.type.spec.leafText(u):"":"";u.isBlock&&(u.isLeaf&&m||u.isTextblock)&&n&&(l?l=!1:o+=n),o+=m},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new it(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,l=0;l<t;o++){let u=this.content[o],h=l+u.nodeSize;h>e&&((l<e||h>t)&&(u.isText?u=u.cut(Math.max(0,e-l),Math.min(u.text.length,t-l)):u=u.cut(Math.max(0,e-l-1),Math.min(u.content.size,t-l-1))),n.push(u),r+=u.nodeSize),l=h}return new it(n,r)}cutByIndex(e,t){return e==t?it.empty:e==0&&t==this.content.length?this:new it(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new it(r,o)}addToStart(e){return new it([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new it(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return KI(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return JI(this,e,t,n)}findIndex(e){if(e==0)return aM(0,e);if(e==this.size)return aM(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),o=n+r.nodeSize;if(o>=e)return o==e?aM(t+1,o):aM(t,n);n=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return it.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new it(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return it.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new it(t||e,n)}static from(e){if(!e)return it.empty;if(e instanceof it)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new it([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}it.empty=new it([],0);const pD={index:0,offset:0};function aM(i,e){return pD.index=i,pD.offset=e,pD}function sM(i,e){if(i===e)return!0;if(!(i&&typeof i=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(i);if(Array.isArray(e)!=t)return!1;if(t){if(i.length!=e.length)return!1;for(let n=0;n<i.length;n++)if(!sM(i[n],e[n]))return!1}else{for(let n in i)if(!(n in e)||!sM(i[n],e[n]))return!1;for(let n in e)if(!(n in i))return!1}return!0}let Hi=class _4{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&sM(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return _4.none;if(e instanceof _4)return[e];let t=e.slice();return t.sort((n,r)=>n.type.rank-r.type.rank),t}};Hi.none=[];class oM extends Error{}class St{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=e6(this.content,e+this.openStart,t);return n&&new St(n,this.openStart,this.openEnd)}removeBetween(e,t){return new St(QI(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return St.empty;let n=t.openStart||0,r=t.openEnd||0;if(typeof n!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new St(it.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)n++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)r++;return new St(e,n,r)}}St.empty=new St(it.empty,0,0);function QI(i,e,t){let{index:n,offset:r}=i.findIndex(e),o=i.maybeChild(n),{index:l,offset:u}=i.findIndex(t);if(r==e||o.isText){if(u!=t&&!i.child(l).isText)throw new RangeError("Removing non-flat range");return i.cut(0,e).append(i.cut(t))}if(n!=l)throw new RangeError("Removing non-flat range");return i.replaceChild(n,o.copy(QI(o.content,e-r-1,t-r-1)))}function e6(i,e,t,n){let{index:r,offset:o}=i.findIndex(e),l=i.maybeChild(r);if(o==e||l.isText)return n&&!n.canReplace(r,r,t)?null:i.cut(0,e).append(t).append(i.cut(e));let u=e6(l.content,e-o-1,t,l);return u&&i.replaceChild(r,l.copy(u))}function xJ(i,e,t){if(t.openStart>i.depth)throw new oM("Inserted content deeper than insertion position");if(i.depth-t.openStart!=e.depth-t.openEnd)throw new oM("Inconsistent open depths");return t6(i,e,t,0)}function t6(i,e,t,n){let r=i.index(n),o=i.node(n);if(r==e.index(n)&&n<i.depth-t.openStart){let l=t6(i,e,t,n+1);return o.copy(o.content.replaceChild(r,l))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&i.depth==n&&e.depth==n){let l=i.parent,u=l.content;return Um(l,u.cut(0,i.parentOffset).append(t.content).append(u.cut(e.parentOffset)))}else{let{start:l,end:u}=SJ(t,i);return Um(o,i6(i,l,u,e,n))}else return Um(o,lM(i,e,n))}function n6(i,e){if(!e.type.compatibleContent(i.type))throw new oM("Cannot join "+e.type.name+" onto "+i.type.name)}function mD(i,e,t){let n=i.node(t);return n6(n,e.node(t)),n}function km(i,e){let t=e.length-1;t>=0&&i.isText&&i.sameMarkup(e[t])?e[t]=i.withText(e[t].text+i.text):e.push(i)}function o1(i,e,t,n){let r=(e||i).node(t),o=0,l=e?e.index(t):r.childCount;i&&(o=i.index(t),i.depth>t?o++:i.textOffset&&(km(i.nodeAfter,n),o++));for(let u=o;u<l;u++)km(r.child(u),n);e&&e.depth==t&&e.textOffset&&km(e.nodeBefore,n)}function Um(i,e){return i.type.checkContent(e),i.copy(e)}function i6(i,e,t,n,r){let o=i.depth>r&&mD(i,e,r+1),l=n.depth>r&&mD(t,n,r+1),u=[];return o1(null,i,r,u),o&&l&&e.index(r)==t.index(r)?(n6(o,l),km(Um(o,i6(i,e,t,n,r+1)),u)):(o&&km(Um(o,lM(i,e,r+1)),u),o1(e,t,r,u),l&&km(Um(l,lM(t,n,r+1)),u)),o1(n,null,r,u),new it(u)}function lM(i,e,t){let n=[];if(o1(null,i,t,n),i.depth>t){let r=mD(i,e,t+1);km(Um(r,lM(i,e,t+1)),n)}return o1(e,null,t,n),new it(n)}function SJ(i,e){let t=e.depth-i.openStart,r=e.node(t).copy(i.content);for(let o=t-1;o>=0;o--)r=e.node(o).copy(it.from(r));return{start:r.resolveNoCache(i.openStart+t),end:r.resolveNoCache(r.content.size-i.openEnd-t)}}class l1{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)r+=n.child(o).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Hi.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let u=n;n=r,r=u}let o=n.marks;for(var l=0;l<o.length;l++)o[l].type.spec.inclusive===!1&&(!r||!o[l].isInSet(r.marks))&&(o=o[l--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)n[o].type.spec.inclusive===!1&&(!r||!n[o].isInSet(r.marks))&&(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new cM(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let l=e;;){let{index:u,offset:h}=l.content.findIndex(o),m=o-h;if(n.push(l,u,r+h),!m||(l=l.child(u),l.isText))break;o=m-1,r+=h+1}return new l1(t,n,o)}static resolveCached(e,t){let n=r6.get(e);if(n)for(let o=0;o<n.elts.length;o++){let l=n.elts[o];if(l.pos==t)return l}else r6.set(e,n=new EJ);let r=n.elts[n.i]=l1.resolve(e,t);return n.i=(n.i+1)%TJ,r}}class EJ{constructor(){this.elts=[],this.i=0}}const TJ=12,r6=new WeakMap;class cM{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const MJ=Object.create(null);let lh=class b4{constructor(e,t,n,r=Hi.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||it.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&sM(this.attrs,t||e.defaultAttrs||MJ)&&Hi.sameSet(this.marks,n||Hi.none)}copy(e=null){return e==this.content?this:new b4(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new b4(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return St.empty;let r=this.resolve(e),o=this.resolve(t),l=n?0:r.sharedDepth(t),u=r.start(l),m=r.node(l).content.cut(r.pos-u,o.pos-u);return new St(m,r.depth-l,o.depth-l)}replace(e,t,n){return xJ(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return l1.resolveCached(this,e)}resolveNoCache(e){return l1.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,o=>(n.isInSet(o.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),a6(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=it.empty,r=0,o=n.childCount){let l=this.contentMatchAt(e).matchFragment(n,r,o),u=l&&l.matchFragment(this.content,t);if(!u||!u.validEnd)return!1;for(let h=r;h<o;h++)if(!this.type.allowsMarks(n.child(h).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),l=o&&o.matchFragment(this.content,t);return l?l.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Hi.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Hi.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=it.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}};lh.prototype.text=void 0;class uM extends lh{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):a6(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new uM(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new uM(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function a6(i,e){for(let t=i.length-1;t>=0;t--)e=i[t].type.name+"("+e+")";return e}class Im{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new wJ(e,t);if(n.next==null)return Im.empty;let r=s6(n);n.next&&n.err("Unexpected trailing text");let o=NJ(LJ(r));return kJ(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function o(l,u){let h=l.matchFragment(e,n);if(h&&(!t||h.validEnd))return it.from(u.map(m=>m.createAndFill()));for(let m=0;m<l.next.length;m++){let{type:_,next:p}=l.next[m];if(!(_.isText||_.hasRequiredAttrs())&&r.indexOf(p)==-1){r.push(p);let y=o(p,u.concat(_));if(y)return y}}return null}return o(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let l=[];for(let u=r;u.type;u=u.via)l.push(u.type);return l.reverse()}for(let l=0;l<o.next.length;l++){let{type:u,next:h}=o.next[l];!u.isLeaf&&!u.hasRequiredAttrs()&&!(u.name in t)&&(!r.type||h.validEnd)&&(n.push({match:u.contentMatch,type:u,via:r}),t[u.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((n,r)=>{let o=r+(n.validEnd?"*":" ")+" ";for(let l=0;l<n.next.length;l++)o+=(l?", ":"")+n.next[l].type.name+"->"+e.indexOf(n.next[l].next);return o}).join(`
|
|
4554
4554
|
`)}}Im.empty=new Im(!0);class wJ{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function s6(i){let e=[];do e.push(AJ(i));while(i.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function AJ(i){let e=[];do e.push(CJ(i));while(i.next&&i.next!=")"&&i.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function CJ(i){let e=OJ(i);for(;;)if(i.eat("+"))e={type:"plus",expr:e};else if(i.eat("*"))e={type:"star",expr:e};else if(i.eat("?"))e={type:"opt",expr:e};else if(i.eat("{"))e=RJ(i,e);else break;return e}function o6(i){/\D/.test(i.next)&&i.err("Expected number, got '"+i.next+"'");let e=Number(i.next);return i.pos++,e}function RJ(i,e){let t=o6(i),n=t;return i.eat(",")&&(i.next!="}"?n=o6(i):n=-1),i.eat("}")||i.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function DJ(i,e){let t=i.nodeTypes,n=t[e];if(n)return[n];let r=[];for(let o in t){let l=t[o];l.isInGroup(e)&&r.push(l)}return r.length==0&&i.err("No node type or group '"+e+"' found"),r}function OJ(i){if(i.eat("(")){let e=s6(i);return i.eat(")")||i.err("Missing closing paren"),e}else if(/\W/.test(i.next))i.err("Unexpected token '"+i.next+"'");else{let e=DJ(i,i.next).map(t=>(i.inline==null?i.inline=t.isInline:i.inline!=t.isInline&&i.err("Mixing inline and block content"),{type:"name",value:t}));return i.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function LJ(i){let e=[[]];return r(o(i,0),t()),e;function t(){return e.push([])-1}function n(l,u,h){let m={term:h,to:u};return e[l].push(m),m}function r(l,u){l.forEach(h=>h.to=u)}function o(l,u){if(l.type=="choice")return l.exprs.reduce((h,m)=>h.concat(o(m,u)),[]);if(l.type=="seq")for(let h=0;;h++){let m=o(l.exprs[h],u);if(h==l.exprs.length-1)return m;r(m,u=t())}else if(l.type=="star"){let h=t();return n(u,h),r(o(l.expr,h),h),[n(h)]}else if(l.type=="plus"){let h=t();return r(o(l.expr,u),h),r(o(l.expr,h),h),[n(h)]}else{if(l.type=="opt")return[n(u)].concat(o(l.expr,u));if(l.type=="range"){let h=u;for(let m=0;m<l.min;m++){let _=t();r(o(l.expr,h),_),h=_}if(l.max==-1)r(o(l.expr,h),h);else for(let m=l.min;m<l.max;m++){let _=t();n(h,_),r(o(l.expr,h),_),h=_}return[n(h)]}else{if(l.type=="name")return[n(u,void 0,l.value)];throw new Error("Unknown expr type")}}}}function l6(i,e){return e-i}function c6(i,e){let t=[];return n(e),t.sort(l6);function n(r){let o=i[r];if(o.length==1&&!o[0].term)return n(o[0].to);t.push(r);for(let l=0;l<o.length;l++){let{term:u,to:h}=o[l];!u&&t.indexOf(h)==-1&&n(h)}}}function NJ(i){let e=Object.create(null);return t(c6(i,0));function t(n){let r=[];n.forEach(l=>{i[l].forEach(({term:u,to:h})=>{if(!u)return;let m;for(let _=0;_<r.length;_++)r[_][0]==u&&(m=r[_][1]);c6(i,h).forEach(_=>{m||r.push([u,m=[]]),m.indexOf(_)==-1&&m.push(_)})})});let o=e[n.join(",")]=new Im(n.indexOf(i.length-1)>-1);for(let l=0;l<r.length;l++){let u=r[l][1].sort(l6);o.next.push({type:r[l][0],next:e[u.join(",")]||t(u)})}return o}}function kJ(i,e){for(let t=0,n=[i];t<n.length;t++){let r=n[t],o=!r.validEnd,l=[];for(let u=0;u<r.next.length;u++){let{type:h,next:m}=r.next[u];l.push(h.name),o&&!(h.isText||h.hasRequiredAttrs())&&(o=!1),n.indexOf(m)==-1&&n.push(m)}o&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function u6(i){let e=Object.create(null);for(let t in i){let n=i[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function f6(i,e){let t=Object.create(null);for(let n in i){let r=e&&e[n];if(r===void 0){let o=i[n];if(o.hasDefault)r=o.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=r}return t}function d6(i,e,t,n){for(let r in e)if(!(r in i))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in i){let o=i[r];o.validate&&o.validate(e[r])}}function h6(i,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new IJ(i,n,e[n]);return t}let p6=class D7{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=h6(e,n.attrs),this.defaultAttrs=u6(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Im.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:f6(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new lh(this,this.computeAttrs(e),it.from(t),Hi.setFrom(n))}createChecked(e=null,t,n){return t=it.from(t),this.checkContent(t),new lh(this,this.computeAttrs(e),t,Hi.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=it.from(t),t.size){let l=this.contentMatch.fillBefore(t);if(!l)return null;t=l.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(it.empty,!0);return o?new lh(this,e,t.append(o),Hi.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){d6(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Hi.none:e}static compile(e,t){let n=Object.create(null);e.forEach((o,l)=>n[o]=new D7(o,t,l));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let o in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function UJ(i,e,t){let n=t.split("|");return r=>{let o=r===null?"null":typeof r;if(n.indexOf(o)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${i}, got ${o}`)}}class IJ{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?UJ(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class fM{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=h6(e,r.attrs),this.excluded=null;let o=u6(this.attrs);this.instance=o?new Hi(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Hi(this,f6(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((o,l)=>n[o]=new fM(o,r++,t,l)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){d6(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class m6{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=Ra.from(e.nodes),t.marks=Ra.from(e.marks||{}),this.nodes=p6.compile(this.spec.nodes,this),this.marks=fM.compile(this.spec.marks,this);let n=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let o=this.nodes[r],l=o.spec.content||"",u=o.spec.marks;if(o.contentMatch=n[l]||(n[l]=Im.parse(l,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=u=="_"?null:u?g6(this,u.split(" ")):u==""||!o.inlineContent?[]:null}for(let r in this.marks){let o=this.marks[r],l=o.spec.excludes;o.excluded=l==null?[o]:l==""?[]:g6(this,l.split(" "))}this.nodeFromJSON=r=>lh.fromJSON(this,r),this.markFromJSON=r=>Hi.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof p6){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new uM(n,n.defaultAttrs,e,Hi.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function g6(i,e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],o=i.marks[r],l=o;if(o)t.push(o);else for(let u in i.marks){let h=i.marks[u];(r=="_"||h.spec.group&&h.spec.group.split(" ").indexOf(r)>-1)&&t.push(l=h)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function zJ(i){return i.tag!=null}function BJ(i){return i.style!=null}let dM=class x4{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(r=>{if(zJ(r))this.tags.push(r);else if(BJ(r)){let o=/[^=]*/.exec(r.style)[0];n.indexOf(o)<0&&n.push(o),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let o=e.nodes[r.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let n=new b6(this,t,!1);return n.addAll(e,Hi.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new b6(this,t,!0);return n.addAll(e,Hi.none,t.from,t.to),St.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let o=this.tags[r];if(HJ(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let l=o.getAttrs(e);if(l===!1)continue;o.attrs=l||void 0}return o}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let l=this.styles[o],u=l.style;if(!(u.indexOf(e)!=0||l.context&&!n.matchesContext(l.context)||u.length>e.length&&(u.charCodeAt(e.length)!=61||u.slice(e.length+1)!=t))){if(l.getAttrs){let h=l.getAttrs(t);if(h===!1)continue;l.attrs=h||void 0}return l}}}static schemaRules(e){let t=[];function n(r){let o=r.priority==null?50:r.priority,l=0;for(;l<t.length;l++){let u=t[l];if((u.priority==null?50:u.priority)<o)break}t.splice(l,0,r)}for(let r in e.marks){let o=e.marks[r].spec.parseDOM;o&&o.forEach(l=>{n(l=x6(l)),l.mark||l.ignore||l.clearMark||(l.mark=r)})}for(let r in e.nodes){let o=e.nodes[r].spec.parseDOM;o&&o.forEach(l=>{n(l=x6(l)),l.node||l.ignore||l.mark||(l.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new x4(e,x4.schemaRules(e)))}};const v6={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},PJ={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},y6={ol:!0,ul:!0},c1=1,gD=2,u1=4;function _6(i,e,t){return e!=null?(e?c1:0)|(e==="full"?gD:0):i&&i.whitespace=="pre"?c1|gD:t&~u1}class hM{constructor(e,t,n,r,o,l){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=l,this.content=[],this.activeMarks=Hi.none,this.match=o||(l&u1?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(it.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,r;return(r=n.findWrapping(e.type))?(this.match=n,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&c1)){let n=this.content[this.content.length-1],r;if(n&&n.isText&&(r=/[ \t\r\n\u000c]+$/.exec(n.text))){let o=n;n.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-r[0].length))}}let t=it.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(it.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!v6.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class b6{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,o,l=_6(null,t.preserveWhitespace,0)|(n?u1:0);r?o=new hM(r.type,r.attrs,Hi.none,!0,t.topMatch||r.type.contentMatch,l):n?o=new hM(null,null,Hi.none,!0,null,l):o=new hM(e.schema.topNodeType,null,Hi.none,!0,null,l),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,o=r.options&gD?"full":this.localPreserveWS||(r.options&c1)>0,{schema:l}=this.parser;if(o==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if(o==="full")n=n.replace(/\r\n?/g,`
|
|
4555
4555
|
`);else if(l.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(l.linebreakReplacement.create())){let u=n.split(/\r?\n|\r/);for(let h=0;h<u.length;h++)h&&this.insertNode(l.linebreakReplacement.create(),t,!0),u[h]&&this.insertNode(l.text(u[h]),t,!/\S/.test(u[h]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let u=r.content[r.content.length-1],h=e.previousSibling;(!u||h&&h.nodeName=="BR"||u.isText&&/[ \t\r\n\u000c]$/.test(u.text))&&(n=n.slice(1))}n&&this.insertNode(l.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),u;y6.hasOwnProperty(l)&&this.parser.normalizeLists&&FJ(e);let h=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(u=this.parser.matchTag(e,this,n));e:if(h?h.ignore:PJ.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,t);else if(!h||h.skip||h.closeParent){h&&h.closeParent?this.open=Math.max(0,this.open-1):h&&h.skip.nodeType&&(e=h.skip);let m,_=this.needsBlock;if(v6.hasOwnProperty(l))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),m=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let p=h&&h.skip?t:this.readStyles(e,t);p&&this.addAll(e,p),m&&this.sync(o),this.needsBlock=_}else{let m=this.readStyles(e,t);m&&this.addElementByRule(e,h,m,h.consuming===!1?u:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4556
4556
|
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let o=this.parser.matchedStyles[r],l=n.getPropertyValue(o);if(l)for(let u=void 0;;){let h=this.parser.matchStyle(o,l,this,u);if(!h)break;if(h.ignore)return null;if(h.clearMark?t=t.filter(m=>!h.clearMark(m)):t=t.concat(this.parser.schema.marks[h.mark].create(h.attrs)),h.consuming===!1)u=h;else break}}return t}addElementByRule(e,t,n,r){let o,l;if(t.node)if(l=this.parser.schema.nodes[t.node],l.isLeaf)this.insertNode(l.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let h=this.enter(l,t.attrs||null,n,t.preserveWhitespace);h&&(o=!0,n=h)}else{let h=this.parser.schema.marks[t.mark];n=n.concat(h.create(t.attrs))}let u=this.top;if(l&&l.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(h=>this.insertNode(h,n,!1));else{let h=e;typeof t.contentElement=="string"?h=e.querySelector(t.contentElement):typeof t.contentElement=="function"?h=t.contentElement(e):t.contentElement&&(h=t.contentElement),this.findAround(e,h,!0),this.addAll(h,n),this.findAround(e,h,!1)}o&&this.sync(u)&&this.open--}addAll(e,t,n,r){let o=n||0;for(let l=n?e.childNodes[n]:e.firstChild,u=r==null?null:e.childNodes[r];l!=u;l=l.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(l,t);this.findAtPoint(e,o)}findPlace(e,t,n){let r,o;for(let l=this.open,u=0;l>=0;l--){let h=this.nodes[l],m=h.findWrapping(e);if(m&&(!r||r.length>m.length+u)&&(r=m,o=h,!m.length))break;if(h.solid){if(n)break;u+=2}}if(!r)return null;this.sync(o);for(let l=0;l<r.length;l++)t=this.enterInner(r[l],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let l=Hi.none;for(let u of r.concat(e.marks))(o.type?o.type.allowsMarkType(u.type):S6(u.type,e.type))&&(l=u.addToSet(l));return o.content.push(e.mark(l)),!0}return!1}enter(e,t,n,r){let o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}enterInner(e,t,n,r=!1,o){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let u=_6(e,o,l.options);l.options&u1&&l.content.length==0&&(u|=u1);let h=Hi.none;return n=n.filter(m=>(l.type?l.type.allowsMarkType(m.type):S6(m.type,e))?(h=m.addToSet(h),!1):!0),this.nodes.push(new hM(e,t,h,r,null,u)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=c1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),l=(u,h)=>{for(;u>=0;u--){let m=t[u];if(m==""){if(u==t.length-1||u==0)continue;for(;h>=o;h--)if(l(u-1,h))return!0;return!1}else{let _=h>0||h==0&&r?this.nodes[h].type:n&&h>=o?n.node(h-o).type:null;if(!_||_.name!=m&&!_.isInGroup(m))return!1;h--}}return!0};return l(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function FJ(i){for(let e=i.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&y6.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function HJ(i,e){return(i.matches||i.msMatchesSelector||i.webkitMatchesSelector||i.mozMatchesSelector).call(i,e)}function x6(i){let e={};for(let t in i)e[t]=i[t];return e}function S6(i,e){let t=e.schema.nodes;for(let n in t){let r=t[n];if(!r.allowsMarkType(i))continue;let o=[],l=u=>{o.push(u);for(let h=0;h<u.edgeCount;h++){let{type:m,next:_}=u.edge(h);if(m==e||o.indexOf(_)<0&&l(_))return!0}};if(l(r.contentMatch))return!0}}class f1{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=vD(t).createDocumentFragment());let r=n,o=[];return e.forEach(l=>{if(o.length||l.marks.length){let u=0,h=0;for(;u<o.length&&h<l.marks.length;){let m=l.marks[h];if(!this.marks[m.type.name]){h++;continue}if(!m.eq(o[u][0])||m.type.spec.spanning===!1)break;u++,h++}for(;u<o.length;)r=o.pop()[1];for(;h<l.marks.length;){let m=l.marks[h++],_=this.serializeMark(m,l.isInline,t);_&&(o.push([m,r]),r.appendChild(_.dom),r=_.contentDOM||_.dom)}}r.appendChild(this.serializeNodeInner(l,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=pM(vD(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&pM(vD(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return pM(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new f1(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=E6(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return E6(e.marks)}}function E6(i){let e={};for(let t in i){let n=i[t].spec.toDOM;n&&(e[t]=n)}return e}function vD(i){return i.document||window.document}const T6=new WeakMap;function VJ(i){let e=T6.get(i);return e===void 0&&T6.set(i,e=GJ(i)),e}function GJ(i){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let r=0;r<n.length;r++)t(n[r]);else for(let r in n)t(n[r])}return t(i),e}function pM(i,e,t,n){if(typeof e=="string")return{dom:i.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],o;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(o=VJ(n))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=r.indexOf(" ");l>0&&(t=r.slice(0,l),r=r.slice(l+1));let u,h=t?i.createElementNS(t,r):i.createElement(r),m=e[1],_=1;if(m&&typeof m=="object"&&m.nodeType==null&&!Array.isArray(m)){_=2;for(let p in m)if(m[p]!=null){let y=p.indexOf(" ");y>0?h.setAttributeNS(p.slice(0,y),p.slice(y+1),m[p]):p=="style"&&h.style?h.style.cssText=m[p]:h.setAttribute(p,m[p])}}for(let p=_;p<e.length;p++){let y=e[p];if(y===0){if(p<e.length-1||p>_)throw new RangeError("Content hole must be the only child of its parent node");return{dom:h,contentDOM:h}}else{let{dom:x,contentDOM:T}=pM(i,y,t,n);if(h.appendChild(x),T){if(u)throw new RangeError("Multiple content holes");u=T}}}return{dom:h,contentDOM:u}}const M6=65535,w6=Math.pow(2,16);function jJ(i,e){return i+e*w6}function A6(i){return i&M6}function $J(i){return(i-(i&M6))/w6}const C6=1,R6=2,mM=4,D6=8;class yD{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&D6)>0}get deletedBefore(){return(this.delInfo&(C6|mM))>0}get deletedAfter(){return(this.delInfo&(R6|mM))>0}get deletedAcross(){return(this.delInfo&mM)>0}}class Ro{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ro.empty)return Ro.empty}recover(e){let t=0,n=A6(e);if(!this.inverted)for(let r=0;r<n;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[n*3]+t+$J(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,l=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let h=this.ranges[u]-(this.inverted?r:0);if(h>e)break;let m=this.ranges[u+o],_=this.ranges[u+l],p=h+m;if(e<=p){let y=m?e==h?-1:e==p?1:t:t,x=h+r+(y<0?0:_);if(n)return x;let T=e==(t<0?h:p)?null:jJ(u/3,e-h),M=e==h?R6:e==p?C6:mM;return(t<0?e!=h:e!=p)&&(M|=D6),new yD(x,M,T)}r+=_-m}return n?e+r:new yD(e+r,0,null)}touches(e,t){let n=0,r=A6(t),o=this.inverted?2:1,l=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let h=this.ranges[u]-(this.inverted?n:0);if(h>e)break;let m=this.ranges[u+o],_=h+m;if(e<=_&&u==r*3)return!0;n+=this.ranges[u+l]-m}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let l=this.ranges[r],u=l-(this.inverted?o:0),h=l+(this.inverted?0:o),m=this.ranges[r+t],_=this.ranges[r+n];e(u,u+m,h,h+_),o+=_-m}}invert(){return new Ro(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ro.empty:new Ro(e<0?[0,-e,0]:[0,0,e])}}Ro.empty=new Ro([]);class d1{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new d1(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let e=new d1;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let o=this.from;o<this.to;o++){let l=this._maps[o],u=l.mapResult(e,t);if(u.recover!=null){let h=this.getMirror(o);if(h!=null&&h>o&&h<this.to){o=h,e=this._maps[h].recover(u.recover);continue}}r|=u.delInfo,e=u.pos}return n?e:new yD(e,r,null)}}const _D=Object.create(null);class ns{getMap(){return Ro.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=_D[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in _D)throw new RangeError("Duplicate use of step JSON ID "+e);return _D[e]=t,t.prototype.jsonID=e,t}}class Cr{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Cr(e,null)}static fail(e){return new Cr(null,e)}static fromReplace(e,t,n,r){try{return Cr.ok(e.replace(t,n,r))}catch(o){if(o instanceof oM)return Cr.fail(o.message);throw o}}}function bD(i,e,t){let n=[];for(let r=0;r<i.childCount;r++){let o=i.child(r);o.content.size&&(o=o.copy(bD(o.content,e,o))),o.isInline&&(o=e(o,t,r)),n.push(o)}return it.fromArray(n)}class ch extends ns{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new St(bD(t.content,(l,u)=>!l.isAtom||!u.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),r),t.openStart,t.openEnd);return Cr.fromReplace(e,this.from,this.to,o)}invert(){return new xc(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new ch(t.pos,n.pos,this.mark)}merge(e){return e instanceof ch&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ch(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ch(t.from,t.to,e.markFromJSON(t.mark))}}ns.jsonID("addMark",ch);class xc extends ns{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new St(bD(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return Cr.fromReplace(e,this.from,this.to,n)}invert(){return new ch(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new xc(t.pos,n.pos,this.mark)}merge(e){return e instanceof xc&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xc(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new xc(t.from,t.to,e.markFromJSON(t.mark))}}ns.jsonID("removeMark",xc);class uh extends ns{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Cr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Cr.fromReplace(e,this.pos,this.pos+1,new St(it.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(n))return new uh(this.pos,t.marks[r]);return new uh(this.pos,this.mark)}}return new zm(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new uh(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new uh(t.pos,e.markFromJSON(t.mark))}}ns.jsonID("addNodeMark",uh);class zm extends ns{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Cr.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Cr.fromReplace(e,this.pos,this.pos+1,new St(it.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new uh(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new zm(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new zm(t.pos,e.markFromJSON(t.mark))}}ns.jsonID("removeNodeMark",zm);class da extends ns{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&xD(e,this.from,this.to)?Cr.fail("Structure replace would overwrite content"):Cr.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ro([this.from,this.to-this.from,this.slice.size])}invert(e){return new da(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new da(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof da)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?St.empty:new St(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new da(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?St.empty:new St(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new da(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new da(t.from,t.to,St.fromJSON(e,t.slice),!!t.structure)}}ns.jsonID("replace",da);class ha extends ns{constructor(e,t,n,r,o,l,u=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=l,this.structure=u}apply(e){if(this.structure&&(xD(e,this.from,this.gapFrom)||xD(e,this.gapTo,this.to)))return Cr.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Cr.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?Cr.fromReplace(e,this.from,this.to,n):Cr.fail("Content does not fit in gap")}getMap(){return new Ro([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ha(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new ha(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ha(t.from,t.to,t.gapFrom,t.gapTo,St.fromJSON(e,t.slice),t.insert,!!t.structure)}}ns.jsonID("replaceAround",ha);function xD(i,e,t){let n=i.resolve(e),r=t-e,o=n.depth;for(;r>0&&o>0&&n.indexAfter(o)==n.node(o).childCount;)o--,r--;if(r>0){let l=n.node(o).maybeChild(n.indexAfter(o));for(;r>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,r--}}return!1}function XJ(i,e,t,n){let r=[],o=[],l,u;i.doc.nodesBetween(e,t,(h,m,_)=>{if(!h.isInline)return;let p=h.marks;if(!n.isInSet(p)&&_.type.allowsMarkType(n.type)){let y=Math.max(m,e),x=Math.min(m+h.nodeSize,t),T=n.addToSet(p);for(let M=0;M<p.length;M++)p[M].isInSet(T)||(l&&l.to==y&&l.mark.eq(p[M])?l.to=x:r.push(l=new xc(y,x,p[M])));u&&u.to==y?u.to=x:o.push(u=new ch(y,x,n))}}),r.forEach(h=>i.step(h)),o.forEach(h=>i.step(h))}function qJ(i,e,t,n){let r=[],o=0;i.doc.nodesBetween(e,t,(l,u)=>{if(!l.isInline)return;o++;let h=null;if(n instanceof fM){let m=l.marks,_;for(;_=n.isInSet(m);)(h||(h=[])).push(_),m=_.removeFromSet(m)}else n?n.isInSet(l.marks)&&(h=[n]):h=l.marks;if(h&&h.length){let m=Math.min(u+l.nodeSize,t);for(let _=0;_<h.length;_++){let p=h[_],y;for(let x=0;x<r.length;x++){let T=r[x];T.step==o-1&&p.eq(r[x].style)&&(y=T)}y?(y.to=m,y.step=o):r.push({style:p,from:Math.max(u,e),to:m,step:o})}}}),r.forEach(l=>i.step(new xc(l.from,l.to,l.style)))}function SD(i,e,t,n=t.contentMatch,r=!0){let o=i.doc.nodeAt(e),l=[],u=e+1;for(let h=0;h<o.childCount;h++){let m=o.child(h),_=u+m.nodeSize,p=n.matchType(m.type);if(!p)l.push(new da(u,_,St.empty));else{n=p;for(let y=0;y<m.marks.length;y++)t.allowsMarkType(m.marks[y].type)||i.step(new xc(u,_,m.marks[y]));if(r&&m.isText&&t.whitespace!="pre"){let y,x=/\r?\n|\r/g,T;for(;y=x.exec(m.text);)T||(T=new St(it.from(t.schema.text(" ",t.allowedMarks(m.marks))),0,0)),l.push(new da(u+y.index,u+y.index+y[0].length,T))}}u=_}if(!n.validEnd){let h=n.fillBefore(it.empty,!0);i.replace(u,u,new St(h,0,0))}for(let h=l.length-1;h>=0;h--)i.step(l[h])}function YJ(i,e,t){return(e==0||i.canReplace(e,i.childCount))&&(t==i.childCount||i.canReplace(0,t))}function kv(i){let t=i.parent.content.cutByIndex(i.startIndex,i.endIndex);for(let n=i.depth,r=0,o=0;;--n){let l=i.$from.node(n),u=i.$from.index(n)+r,h=i.$to.indexAfter(n)-o;if(n<i.depth&&l.canReplace(u,h,t))return n;if(n==0||l.type.spec.isolating||!YJ(l,u,h))break;u&&(r=1),h<l.childCount&&(o=1)}return null}function WJ(i,e,t){let{$from:n,$to:r,depth:o}=e,l=n.before(o+1),u=r.after(o+1),h=l,m=u,_=it.empty,p=0;for(let T=o,M=!1;T>t;T--)M||n.index(T)>0?(M=!0,_=it.from(n.node(T).copy(_)),p++):h--;let y=it.empty,x=0;for(let T=o,M=!1;T>t;T--)M||r.after(T+1)<r.end(T)?(M=!0,y=it.from(r.node(T).copy(y)),x++):m++;i.step(new ha(h,m,l,u,new St(_.append(y),p,x),_.size-p,!0))}function ED(i,e,t=null,n=i){let r=ZJ(i,e),o=r&&KJ(n,e);return o?r.map(O6).concat({type:e,attrs:t}).concat(o.map(O6)):null}function O6(i){return{type:i,attrs:null}}function ZJ(i,e){let{parent:t,startIndex:n,endIndex:r}=i,o=t.contentMatchAt(n).findWrapping(e);if(!o)return null;let l=o.length?o[0]:e;return t.canReplaceWith(n,r,l)?o:null}function KJ(i,e){let{parent:t,startIndex:n,endIndex:r}=i,o=t.child(n),l=e.contentMatch.findWrapping(o.type);if(!l)return null;let h=(l.length?l[l.length-1]:e).contentMatch;for(let m=n;h&&m<r;m++)h=h.matchType(t.child(m).type);return!h||!h.validEnd?null:l}function JJ(i,e,t){let n=it.empty;for(let l=t.length-1;l>=0;l--){if(n.size){let u=t[l].type.contentMatch.matchFragment(n);if(!u||!u.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=it.from(t[l].type.create(t[l].attrs,n))}let r=e.start,o=e.end;i.step(new ha(r,o,r,o,new St(n,0,0),t.length,!0))}function QJ(i,e,t,n,r){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=i.steps.length;i.doc.nodesBetween(e,t,(l,u)=>{let h=typeof r=="function"?r(l):r;if(l.isTextblock&&!l.hasMarkup(n,h)&&eQ(i.doc,i.mapping.slice(o).map(u),n)){let m=null;if(n.schema.linebreakReplacement){let x=n.whitespace=="pre",T=!!n.contentMatch.matchType(n.schema.linebreakReplacement);x&&!T?m=!1:!x&&T&&(m=!0)}m===!1&&N6(i,l,u,o),SD(i,i.mapping.slice(o).map(u,1),n,void 0,m===null);let _=i.mapping.slice(o),p=_.map(u,1),y=_.map(u+l.nodeSize,1);return i.step(new ha(p,y,p+1,y-1,new St(it.from(n.create(h,null,l.marks)),0,0),1,!0)),m===!0&&L6(i,l,u,o),!1}})}function L6(i,e,t,n){e.forEach((r,o)=>{if(r.isText){let l,u=/\r?\n|\r/g;for(;l=u.exec(r.text);){let h=i.mapping.slice(n).map(t+1+o+l.index);i.replaceWith(h,h+1,e.type.schema.linebreakReplacement.create())}}})}function N6(i,e,t,n){e.forEach((r,o)=>{if(r.type==r.type.schema.linebreakReplacement){let l=i.mapping.slice(n).map(t+1+o);i.replaceWith(l,l+1,e.type.schema.text(`
|
|
@@ -4844,4 +4844,4 @@ Learn more: https://react.dev/warnings/version-mismatch`))})(),typeof Map=="func
|
|
|
4844
4844
|
You might need to use a local HTTP server (instead of file://): https://react.dev/link/react-devtools-faq`:""),"font-weight:bold")}k1.createRoot=function(a,s){if(!A(a))throw Error("Target container is not a DOM element.");_S(a);var f=!1,v="",S=Sy,E=Ey,D=hx;return s!=null&&(s.hydrate?console.warn("hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead."):typeof s=="object"&&s!==null&&s.$$typeof===uo&&console.error(`You passed a JSX element to createRoot. You probably meant to call root.render instead. Example usage:
|
|
4845
4845
|
|
|
4846
4846
|
let root = createRoot(domContainer);
|
|
4847
|
-
root.render(<App />);`),s.unstable_strictMode===!0&&(f=!0),s.identifierPrefix!==void 0&&(v=s.identifierPrefix),s.onUncaughtError!==void 0&&(S=s.onUncaughtError),s.onCaughtError!==void 0&&(E=s.onCaughtError),s.onRecoverableError!==void 0&&(D=s.onRecoverableError)),s=Kg(a,1,!1,null,null,f,v,null,S,E,D,kA),a[Yc]=s.current,qu(a),new yS(s)},k1.hydrateRoot=function(a,s,f){if(!A(a))throw Error("Target container is not a DOM element.");_S(a),s===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var v=!1,S="",E=Sy,D=Ey,O=hx,B=null;return f!=null&&(f.unstable_strictMode===!0&&(v=!0),f.identifierPrefix!==void 0&&(S=f.identifierPrefix),f.onUncaughtError!==void 0&&(E=f.onUncaughtError),f.onCaughtError!==void 0&&(D=f.onCaughtError),f.onRecoverableError!==void 0&&(O=f.onRecoverableError),f.formState!==void 0&&(B=f.formState)),s=Kg(a,1,!0,s,f??null,v,S,B,E,D,O,kA),s.context=DA(null),f=s.current,v=ya(f),v=Je(v),S=_r(v),S.callback=null,Rl(f,S,v),wl(v,"hydrateRoot()",null),f=v,s.current.lanes=f,Fe(s,f),ss(s),a[Yc]=s.current,qu(a),new tl(s)},k1.version="19.2.3",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),k1}var p8;function xae(){if(p8)return bw.exports;p8=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(process.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}}return process.env.NODE_ENV==="production"?(i(),bw.exports=_ae()):bw.exports=bae(),bw.exports}var Sae=xae();function Eae(i,e,t){const n=Sae.createRoot(i);return n.render($e.jsx(gae,{config:{...e},api:t})),n}const Tae='@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-500:oklch(63.7% .237 25.331);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-neutral-400:oklch(70.8% 0 0);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-medium:500;--font-weight-bold:700;--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--blur-xs:4px;--blur-sm:8px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-purple-accent:#544ec2}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components{.btn-preview{border-style:var(--tw-border-style);border-width:5px;border-color:var(--color-blue-500);border-radius:3.40282e38px}.message{padding-inline:calc(var(--spacing)*3.5);padding-block:calc(var(--spacing)*1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6);--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-white);border-radius:18px}.no-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.no-scrollbar::-webkit-scrollbar{display:none}.chat-typing-indicator{aspect-ratio:3.5;justify-content:space-between;align-items:center;width:28px;display:flex}.chat-typing-indicator__dot{background:radial-gradient(circle closest-side,#fff 90%,#fff0) no-repeat;border-radius:50%;width:8px;height:8px}.chat-typing-indicator__dot_left{animation:2s ease-in-out infinite both chat-typing-dot_left}.chat-typing-indicator__dot_center{animation:2s ease-in-out infinite both chat-typing-dot_center}.chat-typing-indicator__dot_right{animation:2s ease-in-out infinite both chat-typing-dot_right}@keyframes chat-typing-dot_left{0%{opacity:.5;transform:scale(.5)}20%{opacity:.5;transform:scale(.5)}40%{opacity:1;transform:scale(1)}60%{opacity:1;transform:scale(.75)}80%{opacity:1;transform:scale(.5)}to{opacity:.5;transform:scale(.5)}}@keyframes chat-typing-dot_center{0%{opacity:.5;transform:scale(.5)}20%{opacity:.5;transform:scale(.5)}40%{opacity:.5;transform:scale(.5)}60%{opacity:1;transform:scale(1)}80%{opacity:1;transform:scale(.75)}to{opacity:.5;transform:scale(.5)}}@keyframes chat-typing-dot_right{0%{opacity:.5;transform:scale(.5)}20%{opacity:.5;transform:scale(.5)}40%{opacity:.5;transform:scale(.5)}60%{opacity:.5;transform:scale(.5)}80%{opacity:1;transform:scale(1)}to{opacity:.5;transform:scale(.5)}}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing)*0)}.top-0{top:calc(var(--spacing)*0)}.right-0{right:calc(var(--spacing)*0)}.right-10{right:calc(var(--spacing)*10)}.right-\\[54px\\]{right:54px}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-10{bottom:calc(var(--spacing)*10)}.bottom-\\[145px\\]{bottom:145px}.left-0{left:calc(var(--spacing)*0)}.left-9{left:calc(var(--spacing)*9)}.z-0{z-index:0}.z-1{z-index:1}.z-5{z-index:5}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-51{z-index:51}.mx-4{margin-inline:calc(var(--spacing)*4)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-16{margin-top:calc(var(--spacing)*16)}.mr-2{margin-right:calc(var(--spacing)*2)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-2{margin-left:calc(var(--spacing)*2)}.box-content{box-sizing:content-box}.block{display:block}.flex{display:flex}.hidden{display:none}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-19{height:calc(var(--spacing)*19)}.h-20{height:calc(var(--spacing)*20)}.h-21{height:calc(var(--spacing)*21)}.h-33{height:calc(var(--spacing)*33)}.h-fit{height:fit-content}.h-full{height:100%}.min-h-9{min-height:calc(var(--spacing)*9)}.min-h-10{min-height:calc(var(--spacing)*10)}.min-h-full{min-height:100%}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-19{width:calc(var(--spacing)*19)}.w-33{width:calc(var(--spacing)*33)}.w-\\[77px\\]{width:77px}.w-fit{width:fit-content}.w-full{width:100%}.max-w-70{max-width:calc(var(--spacing)*70)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-10{min-width:calc(var(--spacing)*10)}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.cursor-n-resize{cursor:n-resize}.cursor-w-resize{cursor:w-resize}.touch-none{touch-action:none}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-3xl{border-radius:calc(var(--radius) + 12px)}.rounded-\\[40px\\]{border-radius:40px}.rounded-\\[66px\\]{border-radius:66px}.rounded-full{border-radius:3.40282e38px}.rounded-none{border-radius:0}.rounded-t-\\[40px\\]{border-top-left-radius:40px;border-top-right-radius:40px}.rounded-br-sm{border-bottom-right-radius:calc(var(--radius) - 4px)}.rounded-bl-sm{border-bottom-left-radius:calc(var(--radius) - 4px)}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-gray-200{border-color:var(--color-gray-200)}.bg-black{background-color:var(--color-black)}.bg-black\\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-neutral-400{background-color:var(--color-neutral-400)}.bg-purple-accent{background-color:var(--color-purple-accent)}.bg-purple-accent\\/80{background-color:#544ec2cc}@supports (color:color-mix(in lab,red,red)){.bg-purple-accent\\/80{background-color:color-mix(in oklab,var(--color-purple-accent)80%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-white{background-color:var(--color-white)}.bg-white\\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-\\[linear-gradient\\(to_bottom\\,rgba\\(0\\,0\\,0\\,0\\.7\\)_0\\%\\,rgba\\(0\\,0\\,0\\,0\\.7\\)_20\\%\\,rgba\\(0\\,0\\,0\\,0\\.2\\)_60\\%\\,rgba\\(0\\,0\\,0\\,0\\)_100\\%\\)\\]{background-image:linear-gradient(#000000b3 0% 20%,#0003 60%,#0000)}.bg-\\[linear-gradient\\(to_top\\,rgba\\(0\\,0\\,0\\,0\\.5\\)_0\\%\\,rgba\\(0\\,0\\,0\\,0\\.5\\)_15\\%\\,rgba\\(0\\,0\\,0\\,0\\)_100\\%\\)\\]{background-image:linear-gradient(#0000,#00000080 85% 100%)}.object-cover{object-fit:cover}.object-center{object-position:center}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2\\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.pb-6{padding-bottom:calc(var(--spacing)*6)}.text-left{text-align:left}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-base\\/6{font-size:var(--text-base);line-height:calc(var(--spacing)*6)}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-4{--tw-leading:calc(var(--spacing)*4);line-height:calc(var(--spacing)*4)}.leading-5{--tw-leading:calc(var(--spacing)*5);line-height:calc(var(--spacing)*5)}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-7{--tw-leading:calc(var(--spacing)*7);line-height:calc(var(--spacing)*7)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-black{color:var(--color-black)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-purple-accent{color:var(--color-purple-accent)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-2{outline-style:var(--tw-outline-style);outline-width:2px}.outline-black\\/9{outline-color:#00000017}@supports (color:color-mix(in lab,red,red)){.outline-black\\/9{outline-color:color-mix(in oklab,var(--color-black)9%,transparent)}}.outline-white{outline-color:var(--color-white)}.outline-white\\/30{outline-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.outline-white\\/30{outline-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition-\\[clip-path\\]{transition-property:clip-path;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[width\\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-none{transition-property:none}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.outline-solid{--tw-outline-style:solid;outline-style:solid}.select-none{-webkit-user-select:none;user-select:none}.paused{animation-play-state:paused}@media(hover:hover){.group-hover\\:block:is(:where(.group):hover *){display:block}.group-hover\\:hidden:is(:where(.group):hover *){display:none}}.last\\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.data-active\\:bg-gray-100[data-active]{background-color:var(--color-gray-100)}.data-disabled\\:bg-white\\/20[data-disabled]{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.data-disabled\\:bg-white\\/20[data-disabled]{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.data-disabled\\:text-white\\/30[data-disabled]{color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.data-disabled\\:text-white\\/30[data-disabled]{color:color-mix(in oklab,var(--color-white)30%,transparent)}}.data-disabled\\:backdrop-blur-sm[data-disabled]{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.data-hover\\:bg-gray-100[data-hover]{background-color:var(--color-gray-100)}.data-hover\\:bg-white[data-hover]{background-color:var(--color-white)}.data-hover\\:text-purple-accent[data-hover]{color:var(--color-purple-accent)}@media(min-width:40rem){.sm\\:text-sm\\/6{font-size:var(--text-sm);line-height:calc(var(--spacing)*6)}}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}.bridge-ai-chat-widget{--radius:.625rem;-webkit-text-size-adjust:100%}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}';var Mae=typeof global=="object"&&global&&global.Object===Object&&global,wae=typeof self=="object"&&self&&self.Object===Object&&self,m8=Mae||wae||Function("return this")(),Sw=m8.Symbol,g8=Object.prototype,Aae=g8.hasOwnProperty,Cae=g8.toString,U1=Sw?Sw.toStringTag:void 0;function Rae(i){var e=Aae.call(i,U1),t=i[U1];try{i[U1]=void 0;var n=!0}catch{}var r=Cae.call(i);return n&&(e?i[U1]=t:delete i[U1]),r}var Dae=Object.prototype,Oae=Dae.toString;function Lae(i){return Oae.call(i)}var Nae="[object Null]",kae="[object Undefined]",v8=Sw?Sw.toStringTag:void 0;function Uae(i){return i==null?i===void 0?kae:Nae:v8&&v8 in Object(i)?Rae(i):Lae(i)}function Iae(i){return i!=null&&typeof i=="object"}var zae="[object Symbol]";function Bae(i){return typeof i=="symbol"||Iae(i)&&Uae(i)==zae}var Pae=/\s/;function Fae(i){for(var e=i.length;e--&&Pae.test(i.charAt(e)););return e}var Hae=/^\s+/;function Vae(i){return i&&i.slice(0,Fae(i)+1).replace(Hae,"")}function qO(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var y8=NaN,Gae=/^[-+]0x[0-9a-f]+$/i,jae=/^0b[01]+$/i,$ae=/^0o[0-7]+$/i,Xae=parseInt;function _8(i){if(typeof i=="number")return i;if(Bae(i))return y8;if(qO(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=qO(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Vae(i);var t=jae.test(i);return t||$ae.test(i)?Xae(i.slice(2),t?2:8):Gae.test(i)?y8:+i}var YO=function(){return m8.Date.now()},qae="Expected a function",Yae=Math.max,Wae=Math.min;function Zae(i,e,t){var n,r,o,l,u,h,m=0,_=!1,p=!1,y=!0;if(typeof i!="function")throw new TypeError(qae);e=_8(e)||0,qO(t)&&(_=!0,p="maxWait"in t,o=p?Yae(_8(t.maxWait)||0,e):o,y="trailing"in t?!!t.trailing:y);function x(P){var H=n,W=r;return n=r=void 0,m=P,l=i.apply(W,H),l}function T(P){return m=P,u=setTimeout(w,e),_?x(P):l}function M(P){var H=P-h,W=P-m,U=e-H;return p?Wae(U,o-W):U}function A(P){var H=P-h,W=P-m;return h===void 0||H>=e||H<0||p&&W>=o}function w(){var P=YO();if(A(P))return L(P);u=setTimeout(w,M(P))}function L(P){return u=void 0,y&&n?x(P):(n=r=void 0,l)}function N(){u!==void 0&&clearTimeout(u),m=0,n=h=r=u=void 0}function I(){return u===void 0?l:L(YO())}function z(){var P=YO(),H=A(P);if(n=arguments,r=this,h=P,H){if(u===void 0)return T(h);if(p)return clearTimeout(u),u=setTimeout(w,e),x(h)}return u===void 0&&(u=setTimeout(w,e)),l}return z.cancel=N,z.flush=I,z}const Ew="https://metamediastatic.com";class Kae extends EventTarget{root=null;shadowRoot;config;setOpenImpl=null;sendServiceMessageImpl=null;playAnimationImpl=null;resolveAssetPath;constructor(e){super(),console.log("ChatWidgetInstance constructor",e);const t=300*1e3;if(this.onSessionExpired=Zae(this.onSessionExpired,t,{leading:!0}),!e.mountElementId)throw new Error("ChatWidget: mount element id is required");const n=document.getElementById(e.mountElementId);if(!n)throw new Error(`ChatWidget: mount element with id ${e.mountElementId} is not found on on the page`);this.shadowRoot=n.attachShadow({mode:"open"}),this.injectStyles(this.shadowRoot);const r=document.createElement("div");this.shadowRoot.appendChild(r),this.init(r,e)}async init(e,t){const r=await(await fetch(`${Ew}/manifest.json`)).json();console.log(r),this.resolveAssetPath=l=>(console.log(l),`${Ew}/${r[l]}`),await this.fetchAndMergeRemoteConfig(t);const o={onAvatarReady:this.onAvatarReady,onSessionExpired:this.onSessionExpired,registerSetOpen:l=>{this.setOpenImpl=l},registerSendServiceMessage:l=>{this.sendServiceMessageImpl=l},resolveAssetPath:this.resolveAssetPath};this.root=Eae(e,this.config,o)}async fetchAndMergeRemoteConfig(e){if(e.configName)try{const n=await(await fetch(this.resolveAssetPath(`configs/${e.configName}.json`))).json();this.config={...e,...n}}catch(t){In.error("Failed to fetch remote config",t),this.config={...this.config}}}onAvatarReady=e=>{this.playAnimation=e,this.dispatchEvent(new CustomEvent("avatar_ready"))};onSessionExpired=()=>{this.dispatchEvent(new CustomEvent("renew_session"))};injectStyles(e){const t=document.createElement("style");t.textContent=Tae,e.appendChild(t)}setOpen(e){this.setOpenImpl?this.setOpenImpl(e):In.debug(`setOpen(${e}) called, but the method is not initialized yet`)}playAnimation(e){this.playAnimationImpl?this.playAnimationImpl(e):In.debug(`playAnimation(${e}) called, but the method is not initialized yet`)}setCustomerInteractionSession(e){this.config.customerInteractionSession=e}sendServiceMessage(e,t){this.sendServiceMessageImpl?this.sendServiceMessageImpl(e,t):In.debug(`sendServiceMessage(${{message:e,animationName:t}}) called, but the method is not initialized yet`)}destroy(){this.setOpenImpl=null,this.sendServiceMessageImpl=null,this.playAnimationImpl=null,this.root?.unmount?.(),this.shadowRoot.innerHTML=""}}em.ASSETS_URL=Ew,em.ChatWidgetInstance=Kae,Object.defineProperty(em,Symbol.toStringTag,{value:"Module"})}));
|
|
4847
|
+
root.render(<App />);`),s.unstable_strictMode===!0&&(f=!0),s.identifierPrefix!==void 0&&(v=s.identifierPrefix),s.onUncaughtError!==void 0&&(S=s.onUncaughtError),s.onCaughtError!==void 0&&(E=s.onCaughtError),s.onRecoverableError!==void 0&&(D=s.onRecoverableError)),s=Kg(a,1,!1,null,null,f,v,null,S,E,D,kA),a[Yc]=s.current,qu(a),new yS(s)},k1.hydrateRoot=function(a,s,f){if(!A(a))throw Error("Target container is not a DOM element.");_S(a),s===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var v=!1,S="",E=Sy,D=Ey,O=hx,B=null;return f!=null&&(f.unstable_strictMode===!0&&(v=!0),f.identifierPrefix!==void 0&&(S=f.identifierPrefix),f.onUncaughtError!==void 0&&(E=f.onUncaughtError),f.onCaughtError!==void 0&&(D=f.onCaughtError),f.onRecoverableError!==void 0&&(O=f.onRecoverableError),f.formState!==void 0&&(B=f.formState)),s=Kg(a,1,!0,s,f??null,v,S,B,E,D,O,kA),s.context=DA(null),f=s.current,v=ya(f),v=Je(v),S=_r(v),S.callback=null,Rl(f,S,v),wl(v,"hydrateRoot()",null),f=v,s.current.lanes=f,Fe(s,f),ss(s),a[Yc]=s.current,qu(a),new tl(s)},k1.version="19.2.3",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),k1}var p8;function xae(){if(p8)return bw.exports;p8=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(process.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}}return process.env.NODE_ENV==="production"?(i(),bw.exports=_ae()):bw.exports=bae(),bw.exports}var Sae=xae();function Eae(i,e,t){const n=Sae.createRoot(i);return n.render($e.jsx(gae,{config:{...e},api:t})),n}const Tae='@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-500:oklch(63.7% .237 25.331);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-neutral-400:oklch(70.8% 0 0);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-medium:500;--font-weight-bold:700;--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--blur-xs:4px;--blur-sm:8px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-purple-accent:#544ec2}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components{.btn-preview{border-style:var(--tw-border-style);border-width:5px;border-color:var(--color-blue-500);border-radius:3.40282e38px}.message{padding-inline:calc(var(--spacing)*3.5);padding-block:calc(var(--spacing)*1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6);--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-white);border-radius:18px}.no-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.no-scrollbar::-webkit-scrollbar{display:none}.chat-typing-indicator{aspect-ratio:3.5;justify-content:space-between;align-items:center;width:28px;display:flex}.chat-typing-indicator__dot{background:radial-gradient(circle closest-side,#fff 90%,#fff0) no-repeat;border-radius:50%;width:8px;height:8px}.chat-typing-indicator__dot_left{animation:2s ease-in-out infinite both chat-typing-dot_left}.chat-typing-indicator__dot_center{animation:2s ease-in-out infinite both chat-typing-dot_center}.chat-typing-indicator__dot_right{animation:2s ease-in-out infinite both chat-typing-dot_right}@keyframes chat-typing-dot_left{0%{opacity:.5;transform:scale(.5)}20%{opacity:.5;transform:scale(.5)}40%{opacity:1;transform:scale(1)}60%{opacity:1;transform:scale(.75)}80%{opacity:1;transform:scale(.5)}to{opacity:.5;transform:scale(.5)}}@keyframes chat-typing-dot_center{0%{opacity:.5;transform:scale(.5)}20%{opacity:.5;transform:scale(.5)}40%{opacity:.5;transform:scale(.5)}60%{opacity:1;transform:scale(1)}80%{opacity:1;transform:scale(.75)}to{opacity:.5;transform:scale(.5)}}@keyframes chat-typing-dot_right{0%{opacity:.5;transform:scale(.5)}20%{opacity:.5;transform:scale(.5)}40%{opacity:.5;transform:scale(.5)}60%{opacity:.5;transform:scale(.5)}80%{opacity:1;transform:scale(1)}to{opacity:.5;transform:scale(.5)}}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing)*0)}.top-0{top:calc(var(--spacing)*0)}.right-0{right:calc(var(--spacing)*0)}.right-10{right:calc(var(--spacing)*10)}.right-\\[54px\\]{right:54px}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-10{bottom:calc(var(--spacing)*10)}.bottom-\\[145px\\]{bottom:145px}.left-0{left:calc(var(--spacing)*0)}.left-9{left:calc(var(--spacing)*9)}.z-0{z-index:0}.z-1{z-index:1}.z-5{z-index:5}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-51{z-index:51}.mx-4{margin-inline:calc(var(--spacing)*4)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-16{margin-top:calc(var(--spacing)*16)}.mr-2{margin-right:calc(var(--spacing)*2)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-2{margin-left:calc(var(--spacing)*2)}.box-content{box-sizing:content-box}.block{display:block}.flex{display:flex}.hidden{display:none}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-19{height:calc(var(--spacing)*19)}.h-20{height:calc(var(--spacing)*20)}.h-21{height:calc(var(--spacing)*21)}.h-33{height:calc(var(--spacing)*33)}.h-fit{height:fit-content}.h-full{height:100%}.min-h-9{min-height:calc(var(--spacing)*9)}.min-h-10{min-height:calc(var(--spacing)*10)}.min-h-full{min-height:100%}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-19{width:calc(var(--spacing)*19)}.w-33{width:calc(var(--spacing)*33)}.w-\\[77px\\]{width:77px}.w-fit{width:fit-content}.w-full{width:100%}.max-w-70{max-width:calc(var(--spacing)*70)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-10{min-width:calc(var(--spacing)*10)}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.cursor-n-resize{cursor:n-resize}.cursor-w-resize{cursor:w-resize}.touch-none{touch-action:none}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-3xl{border-radius:calc(var(--radius) + 12px)}.rounded-\\[40px\\]{border-radius:40px}.rounded-\\[66px\\]{border-radius:66px}.rounded-full{border-radius:3.40282e38px}.rounded-none{border-radius:0}.rounded-t-\\[40px\\]{border-top-left-radius:40px;border-top-right-radius:40px}.rounded-br-sm{border-bottom-right-radius:calc(var(--radius) - 4px)}.rounded-bl-sm{border-bottom-left-radius:calc(var(--radius) - 4px)}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-gray-200{border-color:var(--color-gray-200)}.bg-black{background-color:var(--color-black)}.bg-black\\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-400{background-color:var(--color-gray-400)}.bg-neutral-400{background-color:var(--color-neutral-400)}.bg-purple-accent{background-color:var(--color-purple-accent)}.bg-purple-accent\\/80{background-color:#544ec2cc}@supports (color:color-mix(in lab,red,red)){.bg-purple-accent\\/80{background-color:color-mix(in oklab,var(--color-purple-accent)80%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-white{background-color:var(--color-white)}.bg-white\\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-\\[linear-gradient\\(to_bottom\\,rgba\\(0\\,0\\,0\\,0\\.7\\)_0\\%\\,rgba\\(0\\,0\\,0\\,0\\.7\\)_20\\%\\,rgba\\(0\\,0\\,0\\,0\\.2\\)_60\\%\\,rgba\\(0\\,0\\,0\\,0\\)_100\\%\\)\\]{background-image:linear-gradient(#000000b3 0% 20%,#0003 60%,#0000)}.bg-\\[linear-gradient\\(to_top\\,rgba\\(0\\,0\\,0\\,0\\.5\\)_0\\%\\,rgba\\(0\\,0\\,0\\,0\\.5\\)_15\\%\\,rgba\\(0\\,0\\,0\\,0\\)_100\\%\\)\\]{background-image:linear-gradient(#0000,#00000080 85% 100%)}.object-cover{object-fit:cover}.object-center{object-position:center}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2\\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.pb-6{padding-bottom:calc(var(--spacing)*6)}.text-left{text-align:left}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-base\\/6{font-size:var(--text-base);line-height:calc(var(--spacing)*6)}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-4{--tw-leading:calc(var(--spacing)*4);line-height:calc(var(--spacing)*4)}.leading-5{--tw-leading:calc(var(--spacing)*5);line-height:calc(var(--spacing)*5)}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-7{--tw-leading:calc(var(--spacing)*7);line-height:calc(var(--spacing)*7)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-black{color:var(--color-black)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-purple-accent{color:var(--color-purple-accent)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-2{outline-style:var(--tw-outline-style);outline-width:2px}.outline-black\\/9{outline-color:#00000017}@supports (color:color-mix(in lab,red,red)){.outline-black\\/9{outline-color:color-mix(in oklab,var(--color-black)9%,transparent)}}.outline-white{outline-color:var(--color-white)}.outline-white\\/30{outline-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.outline-white\\/30{outline-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition-\\[clip-path\\]{transition-property:clip-path;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[width\\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-none{transition-property:none}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.outline-solid{--tw-outline-style:solid;outline-style:solid}.select-none{-webkit-user-select:none;user-select:none}.paused{animation-play-state:paused}@media(hover:hover){.group-hover\\:block:is(:where(.group):hover *){display:block}.group-hover\\:hidden:is(:where(.group):hover *){display:none}}.last\\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.data-active\\:bg-gray-100[data-active]{background-color:var(--color-gray-100)}.data-disabled\\:bg-white\\/20[data-disabled]{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.data-disabled\\:bg-white\\/20[data-disabled]{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.data-disabled\\:text-white\\/30[data-disabled]{color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.data-disabled\\:text-white\\/30[data-disabled]{color:color-mix(in oklab,var(--color-white)30%,transparent)}}.data-disabled\\:backdrop-blur-sm[data-disabled]{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.data-hover\\:bg-gray-100[data-hover]{background-color:var(--color-gray-100)}.data-hover\\:bg-white[data-hover]{background-color:var(--color-white)}.data-hover\\:text-purple-accent[data-hover]{color:var(--color-purple-accent)}@media(min-width:40rem){.sm\\:text-sm\\/6{font-size:var(--text-sm);line-height:calc(var(--spacing)*6)}}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}.bridge-ai-chat-widget{--radius:.625rem;-webkit-text-size-adjust:100%}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}';var Mae=typeof global=="object"&&global&&global.Object===Object&&global,wae=typeof self=="object"&&self&&self.Object===Object&&self,m8=Mae||wae||Function("return this")(),Sw=m8.Symbol,g8=Object.prototype,Aae=g8.hasOwnProperty,Cae=g8.toString,U1=Sw?Sw.toStringTag:void 0;function Rae(i){var e=Aae.call(i,U1),t=i[U1];try{i[U1]=void 0;var n=!0}catch{}var r=Cae.call(i);return n&&(e?i[U1]=t:delete i[U1]),r}var Dae=Object.prototype,Oae=Dae.toString;function Lae(i){return Oae.call(i)}var Nae="[object Null]",kae="[object Undefined]",v8=Sw?Sw.toStringTag:void 0;function Uae(i){return i==null?i===void 0?kae:Nae:v8&&v8 in Object(i)?Rae(i):Lae(i)}function Iae(i){return i!=null&&typeof i=="object"}var zae="[object Symbol]";function Bae(i){return typeof i=="symbol"||Iae(i)&&Uae(i)==zae}var Pae=/\s/;function Fae(i){for(var e=i.length;e--&&Pae.test(i.charAt(e)););return e}var Hae=/^\s+/;function Vae(i){return i&&i.slice(0,Fae(i)+1).replace(Hae,"")}function qO(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var y8=NaN,Gae=/^[-+]0x[0-9a-f]+$/i,jae=/^0b[01]+$/i,$ae=/^0o[0-7]+$/i,Xae=parseInt;function _8(i){if(typeof i=="number")return i;if(Bae(i))return y8;if(qO(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=qO(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Vae(i);var t=jae.test(i);return t||$ae.test(i)?Xae(i.slice(2),t?2:8):Gae.test(i)?y8:+i}var YO=function(){return m8.Date.now()},qae="Expected a function",Yae=Math.max,Wae=Math.min;function Zae(i,e,t){var n,r,o,l,u,h,m=0,_=!1,p=!1,y=!0;if(typeof i!="function")throw new TypeError(qae);e=_8(e)||0,qO(t)&&(_=!0,p="maxWait"in t,o=p?Yae(_8(t.maxWait)||0,e):o,y="trailing"in t?!!t.trailing:y);function x(P){var H=n,W=r;return n=r=void 0,m=P,l=i.apply(W,H),l}function T(P){return m=P,u=setTimeout(w,e),_?x(P):l}function M(P){var H=P-h,W=P-m,U=e-H;return p?Wae(U,o-W):U}function A(P){var H=P-h,W=P-m;return h===void 0||H>=e||H<0||p&&W>=o}function w(){var P=YO();if(A(P))return L(P);u=setTimeout(w,M(P))}function L(P){return u=void 0,y&&n?x(P):(n=r=void 0,l)}function N(){u!==void 0&&clearTimeout(u),m=0,n=h=r=u=void 0}function I(){return u===void 0?l:L(YO())}function z(){var P=YO(),H=A(P);if(n=arguments,r=this,h=P,H){if(u===void 0)return T(h);if(p)return clearTimeout(u),u=setTimeout(w,e),x(h)}return u===void 0&&(u=setTimeout(w,e)),l}return z.cancel=N,z.flush=I,z}const Ew="https://metamediastatic.com";class Kae extends EventTarget{root=null;shadowRoot;config;setOpenImpl=null;sendServiceMessageImpl=null;playAnimationImpl=null;resolveAssetPath;constructor(e){super();const t=300*1e3;if(this.onSessionExpired=Zae(this.onSessionExpired,t,{leading:!0}),!e.mountElementId)throw new Error("ChatWidget: mount element id is required");const n=document.getElementById(e.mountElementId);if(!n)throw new Error(`ChatWidget: mount element with id ${e.mountElementId} is not found on on the page`);this.shadowRoot=n.attachShadow({mode:"open"}),this.injectStyles(this.shadowRoot);const r=document.createElement("div");this.shadowRoot.appendChild(r),this.init(r,e)}async init(e,t){const r=await(await fetch(`${Ew}/manifest.json`)).json();this.resolveAssetPath=l=>`${Ew}/${r[l]}`,await this.fetchAndMergeRemoteConfig(t);const o={onAvatarReady:this.onAvatarReady,onSessionExpired:this.onSessionExpired,registerSetOpen:l=>{this.setOpenImpl=l},registerSendServiceMessage:l=>{this.sendServiceMessageImpl=l},resolveAssetPath:this.resolveAssetPath};this.root=Eae(e,this.config,o)}async fetchAndMergeRemoteConfig(e){if(!e.configName){this.config=e;return}try{const n=await(await fetch(this.resolveAssetPath(`configs/${e.configName}.json`))).json();this.config={...e,...n}}catch(t){In.error("Failed to fetch remote config",t),this.config={...this.config}}}onAvatarReady=e=>{this.playAnimation=e,this.dispatchEvent(new CustomEvent("avatar_ready"))};onSessionExpired=()=>{this.dispatchEvent(new CustomEvent("renew_session"))};injectStyles(e){const t=document.createElement("style");t.textContent=Tae,e.appendChild(t)}setOpen(e){this.setOpenImpl?this.setOpenImpl(e):In.debug(`setOpen(${e}) called, but the method is not initialized yet`)}playAnimation(e){this.playAnimationImpl?this.playAnimationImpl(e):In.debug(`playAnimation(${e}) called, but the method is not initialized yet`)}setCustomerInteractionSession(e){this.config.customerInteractionSession=e}sendServiceMessage(e,t){this.sendServiceMessageImpl?this.sendServiceMessageImpl(e,t):In.debug(`sendServiceMessage(${{message:e,animationName:t}}) called, but the method is not initialized yet`)}destroy(){this.setOpenImpl=null,this.sendServiceMessageImpl=null,this.playAnimationImpl=null,this.root?.unmount?.(),this.shadowRoot.innerHTML=""}}em.ASSETS_URL=Ew,em.ChatWidgetInstance=Kae,Object.defineProperty(em,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED