PageSourceSearch

https://ailikeme.ai/static/2647.68532a5c24580e8bf701.js

js ailikeme.ai collected 2026-10-05 15:28:25 UTC 14,152 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkmy_webpack_project=self.webpackChunkmy_webpack_project||[]).push([[2647],{12647(e,t,n){n.r(t);var r=n(39471),a=n(18467),o=n(88477),c=n(28780),i=n(78854),l=n(32972),s=n(62064),u=n(29934),d=n(51794),f=n(82648),m=n(62077);function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,c,i=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(i.push(r.value),i.length!==t);l=!0);}catch(e){s=!0,a=e}finally{try{if(!l&&null!=n.return&&(c=n.return(),Object(c)!==c))return}finally{if(s)throw a}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return g(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,["default",0,e=>{var t;let n=e.text,g=(e.translatedText,e.streamTts),h=void 0===g?{gen:0,chunks:[],done:!1}:g,v=e.setIsPlaying,b=e.isPlaying,w=(e.wave,e.listening),y=e.onEnded,E=e.loading,k=e.setLoading,x=(e.token,e.handleTokenCount),S=e.onCloseClick,L=e.setSnackConfig,T=e.visionOptionsComponent,R=e.onStopAudio,A=e.waitingForGreeting,C=void 0!==A&&A,j=e.influencerName,O=void 0===j?"Influencer":j,N=e.onGreetingAudioStart,U=e.onAudioDurationChange,M=e.onAudioTimeUpdate;e.captionsEnabled,e.onCaptionToggle,e.selectedLanguageId,e.onLanguageChange,s.h3.criticalTokenCount,(0,f.R7)().languages;const P=p((0,r.useState)(null),2),_=(P[0],P[1],p((0,r.useState)(null),2)),J=_[0],B=_[1],I=(0,r.useRef)(null),F=(0,r.useRef)(!1),G=(0,r.useRef)(null),D=(0,r.useRef)(null),$=(0,r.useRef)(null),z=(0,l.Zp)(),W=(0,a.wA)(),q=(0,a.d4)(e=>e.auth),Y=(0,a.d4)(e=>e.user),Z=(null==Y||null===(t=Y.data)||void 0===t?void 0:t.available_token)<=10,H=q.data.key,K=(0,a.d4)(e=>e.chats.data).selected,Q=K.name,V=K.inf_id,X=K.custom;(0,r.useEffect)(()=>{const e=b?"".concat(Q," is speaking. Please wait"):C&&E?"".concat(O," has picked the call"):C?"Calling ".concat(O,"..."):E?"".concat(Q," is thinking..."):w?"Ready! Please speak now":"".concat(Q," is speaking.");try{window.dispatchEvent(new CustomEvent("pip-call-status",{detail:{text:e}}))}catch(e){}},[b,C,E,w,Q,O]),(0,r.useEffect)(()=>{var e;if(!Boolean(n))return;E||k(!0);const t="".concat("https://beta.ailikeme.ai/","interface/tts"),r={"Content-Type":"application/json",Authorization:"Token ".concat(H)};null===(e=D.current)||void 0===e||e.abort();const a=new AbortController;D.current=a;const o=()=>{(0,d.uT)().then(e=>{const t=e.data.available_token;W((0,u.Jy)(t))}).catch(()=>{})},c=()=>{k(!1),v(!0),C&&N&&!F.current&&(console.log("🎵 Greeting audio started playing, enabling microphone..."),F.current=!0,N())},i=e=>fetch(t,{method:"POST",headers:r,body:JSON.stringify({text:e,inf_id:V}),signal:a.signal});return(async()=>{try{const e=(e=>{const t=e.match(/[^.!?]*[.!?]+[\s]?|[^.!?]+$/g)||[e],n=[];let r="";for(const e of t)r+=e,r.length>=80&&(n.push(r.trim()),r="");return r.trim()&&(n.length>0&&r.trim().length<40?n[n.length-1]+=" "+r.trim():n.push(r.trim())),n.length>0?n:[e]})(n);console.log("[TTS] split into",e.length,"chunk(s)");const t=await i(e[0]);if(!t.ok){const e=await t.json().catch(()=>({}));throw new Error(JSON.stringify(e))}const r=(t.headers.get("Content-Type")||"").toLowerCase(),l=r.includes("mpeg")||r.includes("mp3"),s="undefined"!=typeof window&&void 0!==window.MediaSource&&window.MediaSource.isTypeSupported("audio/mpeg");if(l&&s&&t.body&&I.current){console.log("[TTS] streaming chunked playback via MediaSource");const n=new MediaSource;$.current=n,G.current&&(URL.revokeObjectURL(G.current),G.current=null);const r=URL.createObjectURL(n);
1if(G.current=r,I.current.src=r,await new Promise((e,t)=>{n.addEventListener("sourceopen",()=>e(),{once:!0}),n.addEventListener("error",()=>t(new Error("MediaSource error")),{once:!0}),a.signal.addEventListener("abort",()=>t(new DOMException("Aborted","AbortError")),{once:!0})}),a.signal.aborted)return;const l=n.addSourceBuffer("audio/mpeg");let s=!1;const u=e=>new Promise((t,n)=>{const r=()=>{l.removeEventListener("error",a),t()},a=e=>{l.removeEventListener("updateend",r),n(e)};l.addEventListener("updateend",r,{once:!0}),l.addEventListener("error",a,{once:!0});try{l.appendBuffer(e)}catch(e){l.removeEventListener("updateend",r),l.removeEventListener("error",a),n(e)}}),d=async e=>{const t=e.body.getReader();for(;;){const e=await t.read(),n=e.done,r=e.value;if(a.signal.aborted)return;if(n)break;await u(r),!s&&I.current&&(s=!0,I.current.play().catch(e=>{console.warn("[TTS] audio.play() rejected:",e)}),c())}};let f=e.length>1?i(e[1]):null;await d(t);for(let t=1;t<e.length;t++){if(a.signal.aborted)return;const n=await f;if(!n.ok){console.warn("[TTS] chunk",t,"failed — stopping chain");break}f=t+1<e.length?i(e[t+1]):null,await d(n)}if("open"===n.readyState&&!a.signal.aborted)try{n.endOfStream()}catch(e){}o()}else{console.log("[TTS] fallback buffered playback",{contentType:r});const e=await response.blob();if(a.signal.aborted)return;G.current&&(URL.revokeObjectURL(G.current),G.current=null);const t=URL.createObjectURL(e);G.current=t,B(t),k(!1),o()}}catch(e){(e=>{var t;if("AbortError"===(null==e?void 0:e.name))return;let n=null;try{n=JSON.parse(e.message)}catch(e){}null!==(t=n)&&void 0!==t&&t.insufficient_token?x():L({open:!0,message:"There was an error repeating the text. Please try again"})})(e)}})(),()=>{a.abort()}},[n]);const ee=(0,r.useRef)(h),te=(0,r.useRef)(null);(0,r.useEffect)(()=>{ee.current=h;const e=te.current;e&&(te.current=null,e())},[h]),(0,r.useEffect)(()=>{var e;const t=h.gen;if(!t)return;k(!0);const n="".concat("https://beta.ailikeme.ai/","interface/tts"),r={"Content-Type":"application/json",Authorization:"Token ".concat(H)};null===(e=D.current)||void 0===e||e.abort();const a=new AbortController;D.current=a;const o=()=>ee.current,c=()=>o().gen!==t||a.signal.aborted,i=()=>new Promise(e=>{a.signal.aborted?e():(te.current=e,a.signal.addEventListener("abort",()=>{te.current===e&&(te.current=null),e()},{once:!0}))}),l=e=>fetch(n,{method:"POST",headers:r,body:JSON.stringify({text:e,inf_id:V}),signal:a.signal}),s=()=>{(0,d.uT)().then(e=>{W((0,u.Jy)(e.data.available_token))}).catch(()=>{})},f=()=>{k(!1),v(!0),C&&N&&!F.current&&(console.log("🎵 Greeting audio started playing, enabling microphone..."),F.current=!0,N())};return(async()=>{try{for(;!c()&&0===o().chunks.length&&!o().done;)await i();if(c())return;var e;if(0===o().chunks.length&&o().done)return console.log("[TTS-STREAM] empty streamed reply — nothing to speak"),k(!1),void(null===(e=ne.current)||void 0===e||e.call(ne));if("undefined"==typeof window||void 0===window.MediaSource||!window.MediaSource.isTypeSupported("audio/mpeg")||!I.current){for(console.log("[TTS-STREAM] MSE unavailable — buffered fallback");!c()&&!o().done;)await i();if(c())return;const e=await l(o().chunks.join(" "));if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(JSON.stringify(t))}const t=await e.blob();if(c())return;G.current&&(URL.revokeObjectURL(G.current),G.current=null);const n=URL.createObjectURL(t);return G.current=n,B(n),k(!1),void s()}console.log("[TTS-STREAM] incremental playback via MediaSource, gen",t);const n=new MediaSource;$.current=n,G.current&&(URL.revokeObjectURL(G.current),G.current=null);const r=URL.createObjectURL(n);if(G.current=r,I.current.src=r,await new Promise((e,t)=>{n.addEventListener("sourceopen",()=>e(),{once:!0}),n.addEventListener("error",()=>t(new Error("MediaSource error")),{once:!0}),a.signal.addEventListener("abort",()=>t(new DOMException("Aborted","AbortError")),{once:!0})}),c())return;const u=n.addSourceBuffer("audio/mpeg");let d=!1;const m=e=>new Promise((t,n)=>{const r=()=>{u.removeEventListener("error",a),t()},a=e=>{u.removeEventListener("updateend",r),n(e)};u.addEventListener("updateend",r,{once:!0}),u.addEventListener("error",a,{once:!0});try{u.appendBuffer(e)}catch(e){u.removeEventListener("updateend",r),u.removeEventListener("error",a),n(e)}}),p=async e=>{const t=e.body.getReader();for(;;){const e=await t.read(),n=e.done,r=e.value;if(a.signal.aborted)return;if(n)break;await m(r),!d&&I.current&&(d=!0,I.current.play().catch(e=>{console.warn("[TTS-STREAM] audio.play() rejected:",e)}),f())}};let g=null;for(let e=0;;e++){for(;!c()&&e>=o().chunks.length&&!o().done;)await i();if(c())return;if(e>=o().chunks.length&&o().done)break;const t=o().chunks[e],n=await(g&&g.i===e?g.p:l(t));if(g=e+1<o().chunks.length?{i:e+1,p:l(o().chunks[e+1])}:null,!n.ok){if(console.warn("[TTS-STREAM] chunk",e,"failed — stopping chain"),!d){const e=await n.json().catch(()=>({}));throw new Error(JSON.stringify(e))}break}await p(n)}if("open"===n.readyState&&!a.signal.aborted)try{n.endOfStream()}catch(e){}s()}catch(e){(e=>{var t;if("AbortError"===(null==e?void 0:e.name))return;let n=null;try{n=JSON.parse(e.message)}catch(e){}null!==(t=n)&&void 0!==t&&t.insufficient_token?x():L({open:!0,message:"There was an error repeating the text. Please try again"})})(e)}})(),()=>{a.abort()}},[h.gen]),(0,r.useEffect)(()=>{C||(F.current=!1)},[C]),(0,r.useEffect)(()=>
1{if(!M)return;const e=I.current;if(!e)return;const t=()=>{M({currentTime:e.currentTime,duration:isFinite(e.duration)&&e.duration>0?e.duration:null})};return e.addEventListener("timeupdate",t),e.addEventListener("durationchange",t),e.addEventListener("loadedmetadata",t),e.addEventListener("play",t),e.addEventListener("seeked",t),()=>{e.removeEventListener("timeupdate",t),e.removeEventListener("durationchange",t),e.removeEventListener("loadedmetadata",t),e.removeEventListener("play",t),e.removeEventListener("seeked",t)}},[M]),(0,r.useEffect)(()=>{if(J&&I.current){I.current.src=J,v(!0),I.current.play();const e=()=>{if(I.current&&U){const e=I.current.duration;console.log("🎵 Audio duration:",e,"seconds"),U(e)}};return I.current.addEventListener("loadedmetadata",e),C&&N&&!F.current&&(console.log("🎵 Greeting audio started playing, enabling microphone..."),F.current=!0,N()),()=>{I.current&&I.current.removeEventListener("loadedmetadata",e)}}},[J,U]);const ne=(0,r.useRef)(y);return(0,r.useEffect)(()=>{ne.current=y},[y]),(0,r.useEffect)(()=>{R&&R(()=>{var e;if(console.log("🛑 Stopping audio element playback"),null===(e=D.current)||void 0===e||e.abort(),D.current=null,$.current){try{"open"===$.current.readyState&&$.current.endOfStream()}catch(e){}$.current=null}if(I.current){I.current.pause();try{I.current.currentTime=0}catch(e){}try{I.current.removeAttribute("src"),I.current.load()}catch(e){}}v(!1),G.current&&(URL.revokeObjectURL(G.current),G.current=null),B(null),ne.current&&ne.current()})},[R]),r.createElement("div",{className:"relative rounded-[20px] overflow-hidden h-full"},r.createElement("style",null,"\n          @keyframes wave {\n            0%, 100% {\n              height: 6px;\n              opacity: 0.8;\n            }\n            50% {\n              height: 18px;\n              opacity: 1;\n            }\n          }\n          .animate-wave {\n            animation: wave 1s ease-in-out infinite;\n          }\n        "),r.createElement("div",{className:"h-full box-border px-4 sm:px-6 py-10 grid place-items-center max-h-[80vh] overflow-y-auto overflow-x-hidden"},r.createElement("div",{className:"mb-5 text-center"},r.createElement("span",{className:"font-semibold text-sm sm:text-base"},"You are on the audio call with ",Q)),r.createElement("div",{className:"relative flex items-center justify-center w-full max-w-[19rem] aspect-square"},r.createElement("div",{className:"relative rounded-[20px] overflow-hidden transition-all duration-300 w-full h-full ".concat(b?"ring-8 ring-[#A0F9C6]":"border-[3px] border-transparent")},r.createElement("img",{src:null==X?void 0:X.profileUrl,alt:"profile-url",className:"w-full h-full object-cover rounded-[20px]"})),b&&r.createElement("div",{className:"absolute -bottom-5 sm:-bottom-6 flex justify-center w-full"},r.createElement("div",{className:"flex items-end justify-center gap-[4px] w-[80px] sm:w-[120px] bg-[#A0F9C6] px-3 py-[4px] rounded-[12px] border border-[#A0F9C6]"},[...Array(7)].map((e,t)=>r.createElement("span",{key:t,className:"w-[3px] sm:w-[4px] bg-black rounded-full animate-wave",style:{animationDelay:"".concat(.1*t,"s")}}))))),T&&r.createElement("div",{className:"w-full mt-2"},T),r.createElement("div",{className:"w-full text-center mt-2"},r.createElement("div",{className:"flex items-center justify-center gap-2 sm:gap-3"},E?r.createElement("div",{style:{width:"25px"}}):r.createElement("div",{className:"w-[22px] h-[22px] sm:w-[25px] sm:h-[25px] rounded-full bg-[#A0F9C6] flex items-center justify-center"},r.createElement("div",{className:"w-[5px] h-[5px] rounded-full animate-pulse bg-[#06BC5C]"})),r.createElement("span",{className:"max-w-[250px] text-sm sm:text-base"},b?"".concat(Q," is speaking. Please wait"):C&&E?"".concat(O," has picked the call"):C?"Calling ".concat(O,"..."):E?"".concat(Q," is thinking..."):w?"Ready! Please speak now":"".concat(Q," is speaking."))),r.createElement("div",{className:"w-full px-3 sm:px-5 py-5 text-xs sm:text-sm text-gray-700"},"Wait for the green light, our companions need a few moments to think."),Z?r.createElement(o.$n,{variant:"contained",label:"Buy Tokens",style:{width:"fit-content",color:"#fff"},startIcon:r.createElement(c.A,{style:{color:"#fff"}}),onClick:()=>z(i.bw.buyTokens.route)}):r.createElement(o.$n,{variant:"contained",label:"End Call",className:"alm-chip-teal",style:{width:"fit-content",minWidth:"100px"},onClick:()=>S(!0)})),r.createElement(m.A,{kind:"audio",id:"pip-audio-sink",mediaRef:I,hostClassName:"hidden",onEnded:()=>{console.log("🎵 Audio playback ended"),v(!1),$.current=null,G.current&&(URL.revokeObjectURL(G.current),G.current=null),B(null),y&&y()}})))}])}}]);

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