1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1071,51010,e=>{"use strict";var t=e.i(43476),r=e.i(71645);e.s(["MessageBlocks",0,function({content:e}){return(0,t.jsx)(t.Fragment,{children:(function(e){let t=[];for(let r of(function(e){let t=[];for(let r of e.matchAll(/(?<=^|\s)(\d{1,2})\.(?=\s)/g))t.push({index:r.index,n:Number(r[1])});let r=[],a=1;for(let e of t)e.n===a&&(r.push(e.index),a++);if(r.length<3)return e;let n="",s=0;for(let t of r)(n+=e.slice(s,t).replace(/[ \t]+$/,""))&&!n.endsWith("\n")&&(n+="\n"),s=t;return n+e.slice(s)})(e).split(/\n\s*\n/)){let e=r.split("\n").map(e=>e.trim()).filter(Boolean);if(0===e.length)continue;let a=[],n=()=>{if(1===a.length)for(let e of function(e){if(e.length<=320)return[e];let t=e.split(/(?<=[.!?])\s+(?=[A-Z"â'â])/),r=[],a="";for(let e of t)a&&(a.length+e.length>320||a.split(/(?<=[.!?])\s+(?=[A-Z"â'â])/).length>=2)?(r.push(a),a=e):a=a?`${a} ${e}`:e;return a&&r.push(a),r}(a[0]))t.push({type:"text",lines:[e]});else a.length>1&&t.push({type:"text",lines:a});a=[]};for(let r of e){let e=/^[-*â¢]\s+(.*)$/.exec(r);if(e){n();let r=t[t.length-1];r?.type==="list"?r.items.push(e[1]):t.push({type:"list",items:[e[1]]})}else a.push(r)}n()}return t.length>0?t:[{type:"text",lines:[e]}]})(e).map((e,a)=>"list"===e.type?(0,t.jsx)("ul",{className:"space-y-1.5",children:e.items.map((e,r)=>(0,t.jsxs)("li",{className:"flex gap-2.5",children:[(0,t.jsx)("span",{className:"mt-[0.6em] h-1 w-1 shrink-0 rounded-full bg-brand"}),(0,t.jsx)("span",{children:e})]},r))},a):(0,t.jsx)("p",{children:e.lines.map((e,a)=>(0,t.jsxs)(r.Fragment,{children:[a>0&&(0,t.jsx)("br",{}),e]},a))},a))})}],1071);var a=e.i(38292),n=e.i(29272),s=e.i(45060);let l=` 2class SytedPcmTap extends AudioWorkletProcessor { 3 constructor() { 4 super() 5 this._buf = new Int16Array(2048) 6 this._at = 0 7 } 8 process(inputs) { 9 const channel = inputs[0] && inputs[0][0] 10 if (!channel) return true 11 for (let i = 0; i < channel.length; i++) { 12 const s = channel[i] < -1 ? -1 : channel[i] > 1 ? 1 : channel[i] 13 this._buf[this._at++] = s < 0 ? s * 0x8000 : s * 0x7fff 14 if (this._at === this._buf.length) { 15 const chunk = this._buf.slice() 16 this.port.postMessage(chunk.buffer, [chunk.buffer]) 17 this._at = 0 18 } 19 } 20 return true 21 } 22}
23registerProcessor('syted-pcm-tap', SytedPcmTap) 24`,i="Voice stopped. What you said so far is in the box.";function o(){return{stream:null,ctx:null,source:null,node:null,ws:null,queue:[],startedAt:0,tick:null,streamed:!1,closing:!1,logged:!1,languages:new Set}}function c(){return void 0!==window.AudioWorkletNode&&!!navigator.mediaDevices?.getUserMedia}function u(){return()=>{}}function d(e){let t=window.matchMedia("(prefers-reduced-motion: reduce)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function h(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function m(e){let t=Math.floor(e/60);return`${t}:${String(e%60).padStart(2,"0")}`}e.s(["VoiceTextarea",0,function({value:e,onChange:p,onEnter:f,disabled:x=!1,placeholder:g,surface:b,textareaRef:y,hint:w,children:v}){let j=(0,r.useRef)(null),k=(0,r.useRef)(null),N=(0,r.useCallback)(e=>{j.current=e,y&&(y.current=e)},[y]),S=(0,r.useSyncExternalStore)(d,h,()=>!0),E=function(e,t,a){let n=(0,r.useSyncExternalStore)(u,c,()=>!1),[s,d]=(0,r.useState)(!1),[h,m]=(0,r.useState)(!1),[p,f]=(0,r.useState)(""),[x,g]=(0,r.useState)(null),[b,y]=(0,r.useState)(0),w=(0,r.useRef)(o()),v=(0,r.useRef)(""),j=(0,r.useRef)(""),k=(0,r.useRef)(""),N=(0,r.useRef)(a),S=(0,r.useRef)(t);(0,r.useEffect)(()=>{N.current=a,S.current=t});let E=(0,r.useCallback)(()=>{let{value:e,pending:t}=function(e,t,r){let a=t+r,n=r.length;if(!e){let e=a.length;a=a.replace(/^\s+/,""),t||(n=Math.max(0,n-(e-a.length)))}let s=e&&a&&!/\s$/.test(e)&&!/^\s/.test(a)?" ":"",l=e+s+a;return{value:l,pending:n>0?l.slice(l.length-n):""}}(v.current,j.current,k.current);f(t),N.current(e)},[]),A=(0,r.useCallback)(()=>{let e=w.current;e.tick&&clearInterval(e.tick),e.tick=null,e.node&&(e.node.port.onmessage=null,e.node.disconnect()),e.source?.disconnect(),e.stream?.getTracks().forEach(e=>e.stop()),e.ctx&&"closed"!==e.ctx.state&&e.ctx.close().catch(()=>{}),e.ws&&(e.ws.onmessage=null,e.ws.onerror=null,e.ws.onclose=null,(e.ws.readyState===WebSocket.OPEN||e.ws.readyState===WebSocket.CONNECTING)&&e.ws.close()),e.node=null,e.source=null,e.stream=null,e.ctx=null,e.ws=null,e.queue=[]},[]),T=(0,r.useCallback)(()=>{let t=w.current;if(t.logged||!t.startedAt||!t.streamed)return;t.logged=!0;let r=Math.round((Date.now()-t.startedAt)/1e3);r<1||fetch("/api/voice",{method:"PUT",headers:{"content-type":"application/json"},keepalive:!0,body:JSON.stringify({seconds:r,surface:e,languages:[...t.languages].slice(0,5)})}).catch(()=>{})},[e]),C=(0,r.useCallback)(e=>{let t=w.current;(!t.closing||t.startedAt)&&(t.closing=!0,j.current+=k.current,k.current="",E(),T(),A(),w.current=o(),d(!1),m(!1),y(0),e&&g(e))},[E,T,A]),M=(0,r.useCallback)(()=>{let e=w.current;e.startedAt&&!e.closing&&(e.closing=!0,e.node&&(e.node.port.onmessage=null,e.node.disconnect()),e.source?.disconnect(),e.stream?.getTracks().forEach(e=>e.stop()),e.tick&&clearInterval(e.tick),e.tick=null,d(!1),e.ws?.readyState===WebSocket.OPEN?(e.ws.send(""),setTimeout(()=>{w.current===e&&C(null)},4e3)):C(null))},[C]),_=(0,r.useCallback)(async()=>{if(w.current.startedAt||h)return;if(g(null),!c())return void g("Dictation needs a recent browser on a secure connection. Typing works everywhere.");m(!0);let e=o();w.current=e;try{let t,r;try{t=new AudioContext({sampleRate:16e3})}catch{t=new AudioContext}e.ctx=t;let a=URL.createObjectURL(new Blob([l],{type:"text/javascript"})),n=t.audioWorklet.addModule(a);n.catch(()=>{}).finally(()=>URL.revokeObjectURL(a));try{e.stream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1}})}catch(t){let e=t?.name;C("NotAllowedError"===e||"SecurityError"===e?"Microphone blocked. Allow it in your browser, or just keep typing.":"NotFoundError"===e||"OverconstrainedError"===e?"No microphone found. Type your answer instead.":"Voice needs a secure connection. Type your answer instead.");return}if(await n,"suspended"===t.state&&await t.resume(),w.current!==e)return;let s=new AudioWorkletNode(t,"syted-pcm-tap");s.port.onmessage=t=>{if(w.current!==e)return;let r=e.ws;r?.readyState===WebSocket.OPEN?r.send(t.data):(!r||r.readyState===WebSocket.CONNECTING)&&e.queue.length<64&&e.queue.push(t.data)},e.source=t.createMediaStreamSource(e.stream),e.source.connect(s),e.node=s,v.current=S.current,j.current="",k.current="",e.startedAt=Date.now();try{let e=await fetch("/api/voice",{method:"POST"});if(!e.ok)throw Error(String(e.status));let t=await e.json();if(!t.apiKey)throw Error(t.error??"no key");r=t.apiKey}catch{C("Voice is unavailable right now. Type your answer instead.");return}if(w.current!==e)return;let o=Math.round(t.sampleRate),c=new WebSocket("wss://stt-rt.soniox.com/transcribe-websocket");e.ws=c,c.onopen=()=>
24{if(w.current===e){for(let t of(c.send(JSON.stringify({api_key:r,model:"stt-rt-v5",audio_format:"pcm_s16le",sample_rate:o,num_channels:1,enable_language_identification:!0})),e.queue))c.send(t);e.queue=[]}},c.onmessage=t=>{let r;if(w.current===e){try{r=JSON.parse(t.data)}catch{return}if(null!=r.error_code||r.error_message)return void C(i);if(e.streamed=!0,Array.isArray(r.tokens)){let t="",a="";for(let n of r.tokens)n.language&&e.languages.add(n.language),n.is_final?t+=n.text:a+=n.text;j.current+=t,k.current=a,E()}r.finished&&C(null)}},c.onerror=()=>{w.current===e&&C(i)},c.onclose=()=>{w.current!==e||e.closing||C(i)},e.tick=setInterval(()=>{if(w.current!==e)return;let t=Math.round((Date.now()-e.startedAt)/1e3);y(t),t>=120&&(M(),g("Two minutes is the limit â what you said is in the box."))},1e3),m(!1),d(!0)}catch{C(i)}},[E,C,h,M]),O=(0,r.useCallback)(e=>{v.current=e,j.current="",k.current="",g(e=>null===e?e:null)},[]);return(0,r.useEffect)(()=>{function e(){"hidden"===document.visibilityState&&w.current.startedAt&&M()}return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[M]),(0,r.useEffect)(()=>()=>{w.current.startedAt&&(T(),A(),w.current=o())},[T,A]),{supported:n,recording:s,starting:h,pending:p,error:x,seconds:b,start:()=>void _(),stop:M,rebase:O}}(b,e,p),A=E.recording;(0,r.useEffect)(()=>{let e=j.current;e&&(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,160)}px`,A&&(e.scrollTop=e.scrollHeight,k.current&&(k.current.scrollTop=e.scrollTop)))},[e,A]);let T=E.recording&&E.pending.length>0,C=T?e.slice(0,e.length-E.pending.length):e,M="w-full px-2 py-1.5 text-base leading-relaxed sm:text-sm";return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-end gap-2 rounded-xl border border-border-strong bg-bg p-2",children:[(0,t.jsxs)("div",{className:"relative min-w-0 flex-1",children:[T&&(0,t.jsxs)("div",{ref:k,"aria-hidden":!0,className:(0,s.cn)(M,"pointer-events-none absolute inset-0 overflow-hidden whitespace-pre-wrap break-words text-fg"),children:[C,(0,t.jsx)("span",{className:"text-faint",children:E.pending})]}),(0,t.jsx)("textarea",{ref:N,value:e,onChange:e=>{E.rebase(e.target.value),p(e.target.value)},onScroll:e=>{k.current&&(k.current.scrollTop=e.currentTarget.scrollTop)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||f(e)},rows:1,className:(0,s.cn)(M,"relative block max-h-40 resize-none bg-transparent outline-none placeholder:text-faint",T?"text-transparent caret-brand":"text-fg"),placeholder:g,disabled:x})]}),(0,t.jsx)("button",{type:"button",onClick:E.recording?E.stop:E.start,disabled:x||E.starting,"aria-label":E.recording?"Stop dictation":"Dictate your answer","aria-pressed":E.recording,className:(0,s.cn)("flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border transition-colors disabled:opacity-40",E.recording?"border-neg text-neg":"border-border-strong text-muted hover:border-brand hover:text-brand"),children:E.recording?(0,t.jsx)(n.Square,{className:"h-3 w-3 fill-current"}):(0,t.jsx)(a.Mic,{className:"h-4 w-4"})}),v]}),E.recording?(0,t.jsxs)("p",{className:"mt-2 flex items-center gap-2 text-xs text-muted",children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-neg",style:S?void 0:{animation:"ab-shimmer 1.4s ease-in-out infinite"}}),"Listening â ",m(E.seconds)," / ",m(120),". Tap the square to stop."]}):E.error?(0,t.jsx)("p",{className:"mt-2 text-xs text-neg",children:E.error}):w]})}],51010)},38292,29272,e=>{"use strict";var t=e.i(56420);let r=(0,t.default)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]);e.s(["Mic",0,r],38292);let a=(0,t.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);e.s(["Square",0,a],29272)},64801,78456,e=>{"use strict";let t=(0,e.i(56420).default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);e.s(["Paperclip",0,t],64801),e.s(["MAX_ATTACHMENTS_PER_MESSAGE",0,4,"MAX_BODY",0,4e3,"SUPPORT_STATUSES",0,["open","pending","closed"]],78456)},77071,e=>{"use strict";let t=(0,e.i(56420).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",0,t],77071)},24071,e=>{"use strict";let t=(0,e.i(56420).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",0,t],24071)},10844,e=>{"use strict";var t=e.i(43476),r=e.i(71645),a=e.i(24071),n=e.i(56420);let s=(0,n.default)("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]);var l=e.i(64801),i=e.i(77071);let o=(0,n.default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);var c=e.i(63676);function u({attachment:e}){return e.url?"image"===e.kind?(0,t.jsx)("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"block w-fit",children:(0,t.jsx)("img",{src:e.url,alt:e.name??"Screenshot",loading:"lazy",className:"max-h-64 w-auto max-w-full rounded-lg border border-border"})}):"audio"===e.kind?(0,t.jsx)("audio",{controls:!0,preload:"metadata",src:e.url,className:"h-10 w-64 max-w-full"}):(0,t.jsxs)("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"flex w-fit max-w-full items-center gap-2 rounded-lg border border-border px-3 py-2 text-xs text-fg underline-offset-2 hover:underline",children:[(0,t.jsx)("span",{className:"truncate",children:e.name??"Document"}),null!=e.bytes&&(0,t.jsxs)("span",{className:"shrink-0 text-faint",children:[Math.max(1,Math.round(e.bytes/1024))," KB"]}
24)]}):(0,t.jsx)("p",{className:"text-xs text-faint",children:"Attachment unavailable right now."})}var d=e.i(1071),h=e.i(51010),m=e.i(45060),p=e.i(78456);let f="syted-support-started";function x({ticket:e,onOpen:r}){let a,n,s=e.preview?`${"staff"===e.preview.author?"":"You: "}${e.preview.body.trim()||"Attachment"}`:"No message yet";return(0,t.jsxs)("button",{onClick:r,className:(0,m.cn)("flex w-full items-start gap-3 border-b border-border px-4 py-3 text-left transition-colors hover:bg-surface","closed"===e.status&&"opacity-60"),children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:(0,m.cn)("line-clamp-2 text-[13px] leading-snug",e.unread>0?"font-medium text-fg":"text-muted"),children:s}),(0,t.jsxs)("p",{className:"mt-1 text-[11px] text-faint",children:["closed"===e.status?"Closed · ":"",(a=new Date(e.lastMessageAt??e.createdAt),n=new Date,a.toDateString()===n.toDateString()?a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):a.toLocaleDateString(void 0,{day:"numeric",month:"short"}))]})]}),e.unread>0&&(0,t.jsx)("span",{"aria-hidden":!0,className:"mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-brand"})]})}function g({message:e}){let r="customer"===e.author;return(0,t.jsxs)("div",{className:(0,m.cn)("flex",r?"justify-end":"justify-start"),children:[!r&&(0,t.jsx)("img",{src:"/support-octave.jpg",alt:"",width:24,height:24,className:"mr-2 h-6 w-6 shrink-0 self-end rounded-full object-cover"}),(0,t.jsxs)("div",{className:(0,m.cn)("max-w-[85%] space-y-1.5",r&&"flex flex-col items-end"),children:[e.body.trim().length>0&&(0,t.jsx)("div",{className:(0,m.cn)("space-y-2 px-3.5 py-2 text-[13px] leading-relaxed",r?"rounded-2xl rounded-br-[4px] bg-brand text-brand-fg":"rounded-2xl rounded-bl-[4px] bg-surface-2 text-fg"),children:(0,t.jsx)(d.MessageBlocks,{content:e.body})}),e.attachments.map(e=>(0,t.jsx)(u,{attachment:e},e.path))]})]})}e.s(["SupportWidget",0,function({initial:e,side:n="left",home:u=!1}){let[d,b]=(0,r.useState)(e),[y,w]=(0,r.useState)(u?null:"site"),[v,j]=(0,r.useState)(!0),[k,N]=(0,r.useState)(""),[S,E]=(0,r.useState)(!1),[A,T]=(0,r.useState)("list"),[C,M]=(0,r.useState)([]),[_,O]=(0,r.useState)(!1),[R,P]=(0,r.useState)(null),[D,L]=(0,r.useState)([]),[U,W]=(0,r.useState)(!1),[I,F]=(0,r.useState)(""),[$,q]=(0,r.useState)(!1),[B,K]=(0,r.useState)(null),[X,z]=(0,r.useState)([]),[V,G]=(0,r.useState)(0),H=(0,r.useRef)(null),J=(0,r.useRef)(null),Y=(0,r.useRef)(null),Z=d?.unread??0,Q=d?.awaiting??!1,ee=(0,r.useCallback)(async(e,t)=>{let r={conversationId:e,...t?{page:window.location.pathname,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone??"",locale:navigator.language??""}:{}};try{await fetch("/api/support",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(r)}),M(t=>t.map(t=>t.id===e?{...t,unread:0}:t)),b(t=>t?{...t,unread:Math.max(0,t.unread-(C.find(t=>t.id===e)?.unread??0))}:t)}catch{}},[]),et=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/support");if(!e.ok)return null;let t=await e.json();return M(t.tickets??[]),b(t.summary??null),t.identity&&w(t.identity),"boolean"==typeof t.hasEmail&&j(t.hasEmail),O(!0),t}catch{return null}},[]),er=(0,r.useCallback)(async(e,t)=>{try{let r=await fetch(`/api/support?c=${e}`);if(!r.ok)return;let a=await r.json();L(a.messages??[]),W(!0),"boolean"==typeof a.hasEmail&&j(a.hasEmail),((a.ticket?.unread??0)>0||t)&&ee(e,t)}catch{}},[ee]),ea=(0,r.useCallback)(()=>{E(!0),K(null),et().then(e=>{let t,r,a,n=e?.tickets??[];if(0===n.length){P(null),L([]),W(!0),T("chat");return}let s=(t=Date.now(),r=e=>Date.parse(e.lastMessageAt??e.createdAt),(a=n.filter(e=>{if("open"===e.status||"pending"===e.status)return!0;let a=r(e);return Number.isFinite(a)&&t-a<864e5})).sort((e,t)=>r(t)-r(e)),a[0]??null);s?(T("chat"),P(s.id),L([]),W(!1),z([]),er(s.id,!0)):T("list")})},[et,er]);function en(){T("chat"),P(null),L([]),W(!0),K(null),z([])}async function es(e){if(!R)return void K("Send a first message, then you can attach files.");let t=p.MAX_ATTACHMENTS_PER_MESSAGE-X.length;for(let r of Array.from(e).slice(0,Math.max(0,t))){G(e=>e+1);try{let e=new FormData;e.set("conversationId",R),e.set("file",r);let t=await fetch("/api/support/upload",{method:"POST",body:e}),a=await t.json();if(!t.ok||!a.attachment)throw Error(a.error??"Upload failed.");z(e=>[...e,a.attachment]),K(null)}catch(e){K(e.message)}finally{G(e=>e-1)}}}async function el(){let e=I.trim();if((e||0!==X.length)&&!$&&!(V>0)){q(!0),K(null),F(""),z([]);
24try{let t="visitor"!==y||v?"":k.trim(),r=await fetch("/api/support",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({body:e,...R?{conversationId:R}:{},...t?{email:t}:{},...X.length?{attachments:X}:{}})}),a=await r.json();if(!r.ok||a.error)throw Error(a.error??"Message not sent.");a.ticket&&P(a.ticket.id),L(a.messages??[]),W(!0),a.identity&&w(a.identity),"boolean"==typeof a.hasEmail&&j(a.hasEmail),b(e=>({unread:e?.unread??0,awaiting:!0}));try{localStorage.setItem(f,"1")}catch{}}catch(t){F(e),z(X),K(t.message)}finally{q(!1),J.current?.focus()}}}return(0,r.useEffect)(()=>{let e,t=S?6e3:45e3*!!Q;if(0===t)return;let r=!1,a=()=>S&&"chat"===A&&R?er(R,!1):et().then(()=>void 0),n=()=>{clearTimeout(e),r||"visible"!==document.visibilityState||(e=setTimeout(()=>{a().then(n)},t))},s=()=>{"visible"===document.visibilityState?(a(),n()):clearTimeout(e)};return document.addEventListener("visibilitychange",s),n(),()=>{r=!0,clearTimeout(e),document.removeEventListener("visibilitychange",s)}},[S,A,R,Q,er,et]),(0,r.useEffect)(()=>{let e="open"===new URLSearchParams(window.location.search).get("support"),t=!1;try{t=!!localStorage.getItem(f)}catch{}if(!e&&(!u||!t))return;let r=setTimeout(()=>{e?ea():et()},0);return()=>clearTimeout(r)},[]),(0,r.useEffect)(()=>{S&&"chat"===A&&H.current?.scrollIntoView({behavior:"smooth",block:"end"})},[D,S,A]),(0,r.useEffect)(()=>{S&&"chat"===A&&J.current?.focus()},[S,A,R]),(0,t.jsxs)(t.Fragment,{children:[S&&(0,t.jsxs)("div",{className:(0,m.cn)("fixed inset-0 z-50 flex flex-col overflow-hidden bg-bg motion-safe:animate-[ab-rise_0.18s_ease-out_both] sm:inset-auto sm:bottom-24 sm:h-[min(38rem,calc(100dvh-7.5rem))] sm:w-[24rem] sm:rounded-2xl sm:shadow-[0_12px_48px_rgba(23,15,60,0.28)] sm:ring-1 sm:ring-border","left"===n?"sm:left-4":"sm:right-4"),role:"dialog","aria-label":"Support",children:[(0,t.jsxs)("div",{className:"flex shrink-0 items-start justify-between gap-3 bg-gradient-to-br from-brand to-brand-hover px-5 pb-5 pt-[max(1rem,env(safe-area-inset-top))] text-white sm:pt-4",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:["chat"===A&&C.length>0&&(0,t.jsx)("button",{onClick:function(){T("list"),K(null),z([]),et()},"aria-label":"Back to your tickets",className:"-ml-2 -mr-1 shrink-0 rounded-full p-1 text-white/80 transition-colors hover:bg-white/10 hover:text-white",children:(0,t.jsx)(a.ChevronLeft,{className:"h-5 w-5"})}),(0,t.jsxs)("span",{className:"relative shrink-0",children:[(0,t.jsx)("img",{src:"/support-octave.jpg",alt:"Octave",width:40,height:40,className:"h-10 w-10 rounded-full border-2 border-white/40 object-cover"}),(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute -bottom-0.5 -right-0.5 h-3 w-3 rounded-full bg-[#4ade80] ring-2 ring-white"})]}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-[17px] font-semibold tracking-tight",children:"Octave from syted.ai"}),(0,t.jsx)("p",{className:"mt-0.5 text-[13px] leading-snug text-white/75",children:"Founder â online, ask anything."})]})]}),(0,t.jsx)("button",{onClick:()=>E(!1),"aria-label":"Close support",className:"-mr-2 -mt-1 rounded-full p-1.5 text-white/70 transition-colors hover:bg-white/10 hover:text-white",children:(0,t.jsx)(c.X,{className:"h-4.5 w-4.5"})})]}),"list"===A?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"scroll-slim min-h-0 flex-1 overflow-y-auto",children:_?C.map(e=>(0,t.jsx)(x,{ticket:e,onOpen:()=>{T("chat"),P(e.id),L([]),W(!1),K(null),z([]),er(e.id,!0)}},e.id)):(0,t.jsx)("p",{className:"py-10 text-center text-xs text-faint",children:"Loadingâ¦"})}),(0,t.jsx)("div",{className:"shrink-0 border-t border-border p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",children:(0,t.jsxs)("button",{onClick:en,className:"flex w-full items-center justify-center gap-2 rounded-xl bg-brand py-2.5 text-sm font-medium text-brand-fg transition-colors hover:bg-brand-hover",children:[(0,t.jsx)(i.Plus,{className:"h-4 w-4"}),"New conversation"]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"scroll-slim min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-4",children:[U?0===D.length?(0,t.jsx)("p",{className:"mx-auto max-w-[16rem] py-8 text-center text-[13px] leading-relaxed text-faint",children:"Ask anything about your blog, your plan or your install."}):D.map(e=>(0,t.jsx)(g,{message:e},e.id)):(0,t.jsx)("p",{className:"py-8 text-center text-xs text-faint",children:"Loadingâ¦"}),U&&D.length>0&&"customer"===D[D.length-1].author&&(0,t.jsx)("p",{className:"mx-auto max-w-[16rem] pt-1 text-center text-[11px] leading-relaxed text-faint",children:"Octave usually replies within the hour. You can close this window â the reply also lands in your inbox."}),(0,t.jsx)("div",{ref:H})]}),(0,t.jsxs)("div",{className:"shrink-0 border-t border-border px-3 pb-[max(0.625rem,env(safe-area-inset-bottom))] pt-2.5",onPaste:e=>{let t=Array.from(e.clipboardData?.files??[]);t.length>0&&(e.preventDefault(),es(t))},children:[B&&(0,t.jsx)("p",{className:"px-2 pb-2 text-xs text-neg",children:B}),(X.length>0||V>0)&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 px-1 pb-2",children:[X.map(e=>(0,t.jsxs)("span",{className:"flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-[11px] text-muted",children:[(0,t.jsx)("span",{className:"max-w-[10rem] truncate",children:e.name??("image"===e.kind?"Screenshot":"File")}),(0,t.jsx)("button",{onClick:()=>z(t=>t.filter(t=>t.path!==e.path)),"aria-label":"Remove attachment",className:"text-faint transition-colors hover:text-fg",children:(0,t.jsx)(c.X,{className:"h-3 w-3"})})]},e.path)),V>0&&(0,t.jsx)("span",{className:"text-[11px] text-faint",children:"Uploadingâ¦"})]}),U&&"visitor"===y&&!v&&(0,t.jsx)("input",{type:"email",value:k,onChange:e=>N(e.target.value.slice(0,320)),placeholder:"Your email, so we can reply (optional)",className:"mb-1.5 w-full border-b border-border bg-transparent px-2 pb-2 pt-1 text-base text-fg outline-none placeholder:text-faint sm:text-xs"}
24),(0,t.jsxs)(h.VoiceTextarea,{value:I,onChange:e=>F(e.slice(0,p.MAX_BODY)),onEnter:e=>{e.preventDefault(),el()},placeholder:"Compose your messageâ¦",surface:"support",textareaRef:J,disabled:$,children:[(0,t.jsx)("button",{type:"button",onClick:()=>Y.current?.click(),"aria-label":"Attach a screenshot or a file",className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border-strong text-muted transition-colors hover:border-brand hover:text-brand",children:(0,t.jsx)(l.Paperclip,{className:"h-4 w-4"})}),(0,t.jsx)("input",{ref:Y,type:"file",hidden:!0,multiple:!0,accept:"image/png,image/jpeg,image/webp,image/gif,application/pdf,text/plain,text/csv,.docx,.xlsx",onChange:e=>{e.target.files?.length&&es(e.target.files),e.target.value=""}}),(0,t.jsx)("button",{onClick:()=>void el(),disabled:$||V>0||!I.trim()&&0===X.length,"aria-label":"Send",className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-brand text-brand-fg transition-colors hover:bg-brand-hover disabled:opacity-40",children:(0,t.jsx)(o,{className:"h-4 w-4 -translate-x-px translate-y-px"})})]}),R&&(0,t.jsxs)("p",{className:"pt-2 text-center text-[11px] text-faint",children:["Something unrelated?"," ",(0,t.jsx)("button",{type:"button",onClick:en,className:"underline decoration-border underline-offset-2 transition-colors hover:text-fg",children:"Start a new conversation"})]})]})]})]}),(0,t.jsxs)("button",{onClick:function(){S?E(!1):ea()},"aria-label":Z>0?"Support â new reply":"Support",className:(0,m.cn)("fixed bottom-5 z-40 flex h-14 w-14 items-center justify-center rounded-full bg-gradient-to-br from-brand to-brand-hover text-white shadow-[0_8px_24px_rgba(139,92,246,0.45)] transition-transform hover:scale-105 active:scale-95","left"===n?"left-5":"right-5",S&&"hidden sm:flex"),children:[S?(0,t.jsx)(c.X,{className:"h-6 w-6"}):(0,t.jsx)(s,{className:"h-[1.6rem] w-[1.6rem]",fill:"currentColor",strokeWidth:0}),Z>0&&!S&&(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute right-1 top-1 h-3 w-3 rounded-full bg-neg ring-2 ring-bg"})]})]})}],10844)}]);
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.