@akropolys/kiku 2.1.0 → 2.1.1

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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- "use strict";var Nh=Object.create;var ea=Object.defineProperty;var Ih=Object.getOwnPropertyDescriptor;var Ah=Object.getOwnPropertyNames;var Ph=Object.getPrototypeOf,Fh=Object.prototype.hasOwnProperty;var Se=(e,r)=>()=>(e&&(r=e(e=0)),r);var fs=(e,r)=>{for(var t in r)ea(e,t,{get:r[t],enumerable:!0})},ks=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Ah(r))!Fh.call(e,a)&&a!==t&&ea(e,a,{get:()=>r[a],enumerable:!(n=Ih(r,a))||n.enumerable});return e};var Wt=(e,r,t)=>(t=e!=null?Nh(Ph(e)):{},ks(r||!e||!e.__esModule?ea(t,"default",{value:e,enumerable:!0}):t,e)),_h=e=>ks(ea({},"__esModule",{value:!0}),e);function Ot(e,r){return e.details??(e.fields?(0,gs.resolveDisplayFields)(e.fields,r).details:[])}function Va(e){return e.length?` (${e.map(r=>`${r.label}: ${r.value}`).join(", ")})`:""}var gs,pn=Se(()=>{"use strict";gs=require("@akropolys/sdk")});function xs(e){var r,t,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(r=0;r<a;r++)e[r]&&(t=xs(e[r]))&&(n&&(n+=" "),n+=t)}else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function vs(){for(var e,r,t=0,n="",a=arguments.length;t<a;t++)(e=arguments[t])&&(r=xs(e))&&(n&&(n+=" "),n+=r);return n}var ys=Se(()=>{"use strict"});function de(...e){return vs(e)}var yt=Se(()=>{"use strict";ys()});function ta(){try{return localStorage.getItem(Ss)!=="off"}catch{return!0}}function Ms(e){try{localStorage.setItem(Ss,e?"on":"off")}catch{}e&&xr()}function xr(){if(typeof window>"u")return;try{let r=navigator.audioSession;r&&r.type!=="playback"&&(r.type="playback")}catch{}if(qe){qe.state==="suspended"&&qe.resume().catch(()=>{});return}let e=window.AudioContext||window.webkitAudioContext;if(e)try{qe=new e({latencyHint:"interactive"}),Jt=qe.createGain(),Jt.gain.value=.28,Jt.connect(qe.destination);let r=qe.createBuffer(1,1,qe.sampleRate),t=qe.createBufferSource();t.buffer=r,t.connect(qe.destination),t.start(0),qe.resume().catch(()=>{})}catch{qe=null}}function Qt(e,r,t,n,a){if(!qe||!Jt)return;let o=qe.createOscillator();o.type="sine",o.frequency.setValueAtTime(r,e),o.frequency.exponentialRampToValueAtTime(Math.max(40,r*t),e+n);let i=qe.createBiquadFilter();i.type="lowpass",i.Q.value=.9,i.frequency.setValueAtTime(Math.min(18e3,r*7),e),i.frequency.exponentialRampToValueAtTime(Math.max(80,r*1.5),e+n);let c=qe.createGain();c.gain.setValueAtTime(1e-4,e),c.gain.exponentialRampToValueAtTime(a,e+.006),c.gain.exponentialRampToValueAtTime(1e-4,e+n),o.connect(i),i.connect(c),c.connect(Jt),o.start(e),o.stop(e+n+.02)}function Ts(e,r){if(!qe||!Jt)return;let t=Math.floor(qe.sampleRate*.03),n=qe.createBuffer(1,t,qe.sampleRate),a=n.getChannelData(0);for(let s=0;s<t;s++)a[s]=(Math.random()*2-1)*Math.pow(1-s/t,3);let o=qe.createBufferSource();o.buffer=n;let i=qe.createBiquadFilter();i.type="bandpass",i.frequency.value=2600,i.Q.value=5;let c=qe.createGain();c.gain.value=r,o.connect(i),i.connect(c),c.connect(Jt),o.start(e)}function Rs(){return ta()?qe?qe.state:"unsupported":"off"}function Dh(e){!qe||!Jt||(Qt(e,587.33,.985,.16,.38),Qt(e+.048,739.99,.985,.18,.42),Qt(e+.096,880,.985,.28,.46),Qt(e+.105,1174.66,.985,.22,.22),Ts(e+.096,.16))}function Bh(e){!qe||!Jt||Qt(e,659.25,.97,.09,.26)}function Gt(e,r=!1){if(!r&&!ta()||(xr(),!qe||!Jt||qe.state==="closed"))return;qe.state==="suspended"&&qe.resume().catch(()=>{});let t=qe.currentTime+.01;switch(e){case"connect":Dh(t);break;case"heard":Bh(t);break;case"reply":Qt(t,440,.94,.13,.5),Qt(t+.09,660,.94,.16,.42);break;case"interrupt":Qt(t,520,.62,.17,.4);break;case"send":Qt(t,300,1.16,.1,.22);break;case"pin":Ts(t,.35),Qt(t+.02,880,.97,.07,.22);break}}var Ss,qe,Jt,Wr=Se(()=>{"use strict";Ss="hsk-sounds",qe=null,Jt=null});function ra(e){if(typeof e=="string")return{themeAttr:e,vars:void 0};if(!e)return{themeAttr:void 0,vars:void 0};let r={};return e.primaryColor&&(r["--hsk-primary"]=e.primaryColor),e.backgroundColor&&(r["--hsk-bg"]=e.backgroundColor,r["--hsk-chat-bg"]=e.backgroundColor),e.textColor&&(r["--hsk-text"]=e.textColor,r["--hsk-chat-text"]=e.textColor),e.fontFamily&&(r["--hsk-font"]=e.fontFamily),e.fontSize&&(r["--hsk-font-size"]=e.fontSize),e.mobileFontSize&&(r["--hsk-mobile-font-size"]=e.mobileFontSize),e.borderRadius&&(r["--hsk-border-radius"]=e.borderRadius),{themeAttr:void 0,vars:r}}var ja=Se(()=>{"use strict"});function Ya(e,r="hsk-font"){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return`${r}-${t.toString(36)}`}function Hh(e){let r=e.split("?")[0].split("#")[0].split(".").pop()?.toLowerCase();return r==="woff2"?"woff2":r==="woff"?"woff":r==="otf"?"opentype":r==="ttf"?"truetype":""}function Xa(e){let r=e.trim();return!r||/["'()\\\s]/.test(r)||/^(javascript|vbscript):/i.test(r)?null:r}function qh(e,r){(0,Ka.useEffect)(()=>{if(!e||!r||typeof document>"u")return;let t=Ya(e);if(_t.set(e,(_t.get(e)??0)+1),!document.getElementById(t)){let n=document.createElement("style");n.id=t,n.textContent=r,document.head.appendChild(n)}return()=>{let n=(_t.get(e)??1)-1;if(n>0){_t.set(e,n);return}_t.delete(e),document.getElementById(t)?.remove()}},[e,r])}function Ns(e){let r=zs(e.family);return r?e.faces.map(t=>{let n=Xa(t.url);return n?`@font-face{font-family:"${r}";font-style:normal;font-weight:${Ls(t.weight)};font-display:swap;src:url(${n}) format("woff2");`+(Es(t.unicodeRange)?`unicode-range:${Es(t.unicodeRange)};`:"")+"}":""}).join(""):""}function Qa(e){let r=e?.faces??[],t=e&&r.length?Ns(e):"";qh(t?`script|${e.family}|${r.map(n=>n.url).join("|")}`:"",t)}async function Dt(e,r=0){if(typeof document>"u"||!("fonts"in document))return;let t=Ns(e);if(!t)return;let n=`script|${e.family}|${e.faces.map(o=>o.url).join("|")}`;_t.set(n,(_t.get(n)??0)+1);let a=Ya(n);if(!document.getElementById(a)){let o=document.createElement("style");o.id=a,o.textContent=t,document.head.appendChild(o)}if(r>0){let o=document.fonts,i=e.family.replace(/^['"]|['"]$/g,""),c=Array.from(o||[]).filter(l=>l.family.replace(/^['"]|['"]$/g,"")===i),s=c.length>0?c.map(l=>l.load().catch(()=>{})):e.faces.map(l=>{let h=Xa(l.url);if(!h)return Promise.resolve();try{return new window.FontFace(i,`url(${h})`,{weight:Ls(l.weight),style:"normal"}).load().then(u=>{document.fonts?.add(u)}).catch(()=>{})}catch{return Promise.resolve()}});await Promise.race([Promise.all(s),new Promise(l=>setTimeout(l,r))])}}function As(e,r){let t=Array.from(new Set(Array.from(Object.values(r).join("")))).join(""),n=e.map(a=>`"${a.replace(/^['"]|['"]$/g,"")}"`).join(", ");return{text:t,stack:n}}function Ja(e,r){let t=typeof document<"u"?document.fonts:null,{text:n,stack:a}=As(e,r);if(!t?.check||!n||!a)return!0;try{return Is.every(o=>t.check(`${o} 16px ${a}`,n))}catch{return!0}}async function Za(e,r,t){let n=typeof document<"u"?document.fonts:null;if(!n?.load)return;let{text:a,stack:o}=As(e,r);!a||!o||await Promise.race([Promise.all(Is.map(i=>n.load(`${i} 16px ${o}`,a).catch(()=>{}))),new Promise(i=>setTimeout(i,t))])}function na(e){let r=typeof e=="object"&&e?e:void 0,t=zs(r?.fontFamily?.split(",")[0].trim().replace(/^['"]|['"]$/g,"")??""),n=typeof r?.fontUrl=="string"?{normal:r.fontUrl}:r?.fontUrl??{},a=n.normal??"",o=n.bold??"",i=n.variable??"";(0,Ka.useEffect)(()=>{if(!t||!a&&!o&&!i)return;let c=i?[["100 900",i]]:[["400",a],["700",o]],s=[];for(let[u,p]of c){if(!p)continue;let g=Xa(p);if(!g)continue;let f=Hh(g);s.push(`@font-face{font-family:"${t}";font-style:normal;font-weight:${u};font-display:swap;src:url(${g})${f?` format("${f}")`:""};}`)}if(s.length===0)return;let l=s.join(""),h=`${t}|${a}|${o}|${i}`,d=Ya(h,"hsk-host-font");if(_t.set(h,(_t.get(h)??0)+1),!document.getElementById(d)){let u=document.createElement("style");u.id=d,u.textContent=l,document.head.appendChild(u)}return()=>{let u=(_t.get(h)??1)-1;if(u>0){_t.set(h,u);return}_t.delete(h),document.getElementById(d)?.remove()}},[t,a,o,i])}var Ka,_t,zs,$h,Es,Ls,Is,un=Se(()=>{"use strict";Ka=require("react"),_t=new Map;zs=e=>/["\\{}<>;\n\r]/.test(e)?"":e.trim(),$h=/^[Uu]\+[0-9A-Fa-f?]{1,6}(-[0-9A-Fa-f]{1,6})?$/,Es=e=>{let r=e.split(",").map(t=>t.trim()).filter(Boolean);return r.length===0||!r.every(t=>$h.test(t))?"":r.join(", ")},Ls=e=>/^\d{3}( \d{3})?$/.test(e)?e:"400";Is=["400","500","600","700"]});var $,Uh,vr,Ps,Fs,_s,Or,aa,oa,Ds,sa,Bs,Hs,ia,eo,$s,mn,ca,Er,zr,bn,qs,to,Us,Ws,Os,Gs,Vs,js,Ks,Ys,Xs,Bt=Se(()=>{"use strict";yt();$=require("react/jsx-runtime"),Uh=({className:e,size:r=18,tight:t=!1})=>(0,$.jsx)("svg",{className:de("hsk-brand-mark",e),width:r,height:r,viewBox:t?"10.2 17.4 79.5 79.5":"0 0 100 100",xmlns:"http://www.w3.org/2000/svg","aria-label":"kiku",children:(0,$.jsxs)("g",{transform:"translate(22.7 19) scale(0.62)",fill:"currentColor",fillRule:"evenodd",children:[(0,$.jsx)("path",{d:"M39.4 10.4 Q44 0 48.6 10.4 L86.1 95.8 Q88 100 83.4 100 L4.6 100 Q0 100 1.9 95.8 Z M24 100 L24 65 Q24 60 27.4 56.3 Q44 38 60.6 56.3 Q64 60 64 65 L64 100 Z"}),(0,$.jsx)("circle",{cx:"55",cy:"82",r:"3.4"})]})}),vr=Uh,Ps=()=>(0,$.jsxs)("svg",{className:"hsk-stop-icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[(0,$.jsx)("circle",{className:"hsk-stop-ring",cx:"12",cy:"12",r:"9.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),(0,$.jsx)("rect",{className:"hsk-stop-core",x:"8.5",y:"8.5",width:"7",height:"7",rx:"1.8",fill:"currentColor"})]}),Fs=()=>(0,$.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),(0,$.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,$.jsx)("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),_s=()=>(0,$.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:(0,$.jsx)("path",{d:"M8 5v14l11-7z"})}),Or=()=>(0,$.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,$.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),aa=()=>(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{d:"m15 18-6-6 6-6"})}),oa=()=>(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{d:"m9 18 6-6-6-6"})}),Ds=()=>(0,$.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,$.jsx)("path",{d:"M3 3v5h5"}),(0,$.jsx)("path",{d:"M12 7v5l4 2"})]}),sa=()=>(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{d:"M19 21 12 16l-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),Bs=()=>(0,$.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M3 6h18"}),(0,$.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),Hs=()=>(0,$.jsx)("svg",{width:"19",height:"19",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,$.jsx)("path",{d:"M12 5v14M5 12h14"})}),ia=({size:e=18}={})=>(0,$.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M21 11.5a8.4 8.4 0 0 1-12.3 7.4L3 21l2.1-5.7A8.4 8.4 0 1 1 21 11.5Z"}),[8.9,12.6,16.3].map((r,t)=>(0,$.jsx)("circle",{className:"hsk-mimi-dot",style:{"--hsk-dot":t},cx:r,cy:"11.6",r:"1.15",fill:"currentColor",stroke:"none"},r))]}),eo=()=>(0,$.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),$s=()=>(0,$.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),(0,$.jsx)("circle",{className:"hsk-img-sun",cx:"9",cy:"9",r:"1.8"}),(0,$.jsx)("path",{className:"hsk-img-ridge",d:"m21 15-4.5-4.5L6 21"})]}),mn=({className:e,size:r=13}={})=>(0,$.jsxs)("svg",{className:de("hsk-retry-icon",e),width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{className:"hsk-retry-arrow",d:"M21.5 2v6h-6"}),(0,$.jsx)("path",{className:"hsk-retry-arc",d:"M21.34 15.57a10 10 0 1 1-.57-8.38l5.67-5.19"})]}),ca=({className:e,size:r=13}={})=>(0,$.jsxs)("svg",{className:de("hsk-edit-icon",e),width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{className:"hsk-edit-pencil",d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"}),(0,$.jsx)("path",{className:"hsk-edit-lead",d:"m15 5 4 4"})]}),Er=({className:e,size:r=13}={})=>(0,$.jsxs)("svg",{className:de("hsk-copy-icon",e),width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("rect",{className:"hsk-copy-sheet",x:"8.5",y:"7",width:"12",height:"14",rx:"3.5"}),(0,$.jsx)("path",{className:"hsk-copy-back",d:"M5 15H4.5A2.5 2.5 0 0 1 2 12.5V4.5A2.5 2.5 0 0 1 4.5 2h8A2.5 2.5 0 0 1 15 4.5V5"})]}),zr=({className:e,size:r=13}={})=>(0,$.jsx)("svg",{className:de("hsk-check-icon",e),width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("polyline",{className:"hsk-check-mark",points:"20 6 9 17 4 12"})}),bn=({className:e,size:r=18}={})=>(0,$.jsxs)("svg",{className:e,width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{className:"hsk-mic-cap",d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"}),(0,$.jsx)("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),(0,$.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]}),qs=()=>(0,$.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("line",{className:"hsk-mic-slash",x1:"2",y1:"2",x2:"22",y2:"22"}),(0,$.jsx)("path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2"}),(0,$.jsx)("path",{d:"M5 10v2a7 7 0 0 0 12 5"}),(0,$.jsx)("path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33"}),(0,$.jsx)("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12"}),(0,$.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]}),to=({active:e})=>(0,$.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{className:"hsk-wave-bar hsk-wave-bar--tip",style:{"--hsk-bar":0,"--hsk-amp":1.9,"--hsk-period":"1.24s"},d:"M2 12h2"}),(0,$.jsx)("path",{className:"hsk-wave-bar",style:{"--hsk-bar":1,"--hsk-amp":1.78,"--hsk-period":"0.94s"},d:"M6 8v8"}),(0,$.jsx)("path",{className:"hsk-wave-bar",style:{"--hsk-bar":2,"--hsk-amp":1.26,"--hsk-period":"1.42s"},d:"M10 4v16"}),(0,$.jsx)("path",{className:"hsk-wave-bar",style:{"--hsk-bar":3,"--hsk-amp":1.62,"--hsk-period":"1.08s"},d:"M14 7v10"}),(0,$.jsx)("path",{className:"hsk-wave-bar",style:{"--hsk-bar":4,"--hsk-amp":2.05,"--hsk-period":"0.86s"},d:"M18 9v6"}),(0,$.jsx)("path",{className:"hsk-wave-bar hsk-wave-bar--tip",style:{"--hsk-bar":5,"--hsk-amp":1.9,"--hsk-period":"1.32s"},d:"M22 12h-2"})]}),Us=()=>(0,$.jsxs)("svg",{className:"hsk-telegram-icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("polygon",{className:"hsk-kite-wing hsk-kite-wing--far",points:"22 2 11 13 2 9"}),(0,$.jsx)("polygon",{className:"hsk-kite-wing hsk-kite-wing--near",points:"22 2 15 22 11 13"}),(0,$.jsx)("line",{className:"hsk-kite-spine",x1:"22",y1:"2",x2:"11",y2:"13"})]}),Ws=()=>(0,$.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("circle",{className:"hsk-sun-core",cx:"12",cy:"12",r:"5"}),(0,$.jsxs)("g",{className:"hsk-sun-rays",children:[(0,$.jsx)("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),(0,$.jsx)("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),(0,$.jsx)("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),(0,$.jsx)("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),(0,$.jsx)("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),(0,$.jsx)("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),(0,$.jsx)("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),(0,$.jsx)("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})]}),Os=()=>(0,$.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{className:"hsk-moon-body",d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),Gs=()=>(0,$.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{className:"hsk-wood-layer",style:{"--hsk-layer":0},d:"M12 2L2 7l10 5 10-5-10-5z"}),(0,$.jsx)("path",{className:"hsk-wood-layer",style:{"--hsk-layer":2},d:"M2 17l10 5 10-5"}),(0,$.jsx)("path",{className:"hsk-wood-layer",style:{"--hsk-layer":1},d:"M2 12l10 5 10-5"})]}),Vs=()=>(0,$.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{className:"hsk-heart-body",d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})}),js=()=>(0,$.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M17 8h1a4 4 0 1 1 0 8h-1"}),(0,$.jsx)("path",{d:"M3 8h14v9a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4z"}),(0,$.jsx)("line",{className:"hsk-steam",style:{"--hsk-steam":0},x1:"6",y1:"1",x2:"6",y2:"4"}),(0,$.jsx)("line",{className:"hsk-steam",style:{"--hsk-steam":1},x1:"10",y1:"1",x2:"10",y2:"4"}),(0,$.jsx)("line",{className:"hsk-steam",style:{"--hsk-steam":2},x1:"14",y1:"1",x2:"14",y2:"4"})]}),Ks=()=>(0,$.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M12 3a6.5 6.5 0 0 0 9 9 9 9 0 1 1-9-9z"}),(0,$.jsx)("path",{className:"hsk-star-spark",d:"M18.5 2.5l.6 1.6 1.6.6-1.6.6-.6 1.6-.6-1.6-1.6-.6 1.6-.6z"})]}),Ys=({size:e=11})=>(0,$.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,$.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),Xs=({className:e,size:r=16,filled:t=!1}={})=>(0,$.jsxs)("svg",{className:de("hsk-pin-icon",e),width:r,height:r,viewBox:"0 0 24 24",fill:t?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"22"}),(0,$.jsx)("path",{d:"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17z"})]})});function no(e){return typeof e=="string"&&Lr.some(r=>r.id===e)}function ao(e){return Lr.find(r=>r.id===e)??Lr[0]}var Lr,ro,Qs,oo=Se(()=>{"use strict";Bt();Lr=[{id:"light",label:"Silver",Icon:Ws,dark:!1},{id:"dark",label:"Onyx",Icon:Os,dark:!0},{id:"mahogany",label:"Mahogany",Icon:Gs,dark:!0},{id:"blush",label:"Blush",Icon:Vs,dark:!1},{id:"coffee",label:"Coffee",Icon:js,dark:!1},{id:"midnight",label:"Midnight",Icon:Ks,dark:!0}],ro="dark",Qs="light"});function Wh(e,r,t=.55){return r<=0?0:e*r*t/(r+t*Math.abs(e))}function Oh({stiffness:e=500,damping:r=45,onFrame:t,onRest:n}){let a=0,o=0,i=0,c=null,s=0,l=d=>{let u=Math.min(.032,(d-s)/1e3)||.016666666666666666;s=d;let p=Math.max(1,Math.ceil(u/.008)),g=u/p;for(let f=0;f<p;f++){let k=-e*(a-i)-r*o;o+=k*g,a+=o*g}if(Math.abs(a-i)<.5&&Math.abs(o)<.5){a=i,o=0,c=null,t(a),n?.();return}t(a),c=requestAnimationFrame(l)},h=()=>{c===null&&(s=performance.now(),c=requestAnimationFrame(l))};return{track(d){c!==null&&(cancelAnimationFrame(c),c=null),a=d,o=0,t(a)},to(d,u=0){i=d,o=u,h()},get value(){return a},stop(){c!==null&&(cancelAnimationFrame(c),c=null)}}}function Js({panel:e,scroller:r,onDismiss:t,quiescent:n,enabled:a=!0}){let o=(0,la.useRef)(t);o.current=t,(0,la.useEffect)(()=>{if(!a)return;let i=e();if(!i||typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches)return;let c=!1,s=0,l=0,h=0,d=-1,u=0,p=0,g=0,f=!1,k=!1,b=Oh({onFrame:w=>{i.style.transform=w===0?"":`translate3d(0, ${w}px, 0)`;let H=i.parentElement;H&&(H.style.opacity=w===0?"":String(Math.max(.35,1-w/(i.offsetHeight||1)*1.1)))},onRest:()=>{i.style.willChange="",k&&(k=!1,o.current())}}),N=()=>{let w=r();return w&&w.scrollTop>0?!1:n?n():!0},M=w=>{w.pointerType==="mouse"||!w.isPrimary||(c=!1,f=!1,d=w.pointerId,s=u=w.clientY,l=w.clientX,p=w.timeStamp,g=0,h=b.value)},E=w=>{if(w.pointerId!==d)return;let H=w.clientY-s,Q=w.clientX-l;if(!f){if(Math.abs(H)<6&&Math.abs(Q)<6)return;if(f=!0,c=H>0&&Math.abs(H)>Math.abs(Q)&&N(),c){try{i.setPointerCapture(w.pointerId)}catch{}b.stop(),i.style.animation="none",i.style.willChange="transform"}}if(!c)return;let T=w.timeStamp-p;T>0&&(g=(w.clientY-u)/T*1e3),u=w.clientY,p=w.timeStamp;let A=h+H;b.track(A<0?-Wh(-A,i.offsetHeight||1):A),w.cancelable&&w.preventDefault()},F=w=>{if(w.pointerId!==d)return;try{i.hasPointerCapture(w.pointerId)&&i.releasePointerCapture(w.pointerId)}catch{}if(d=-1,!c)return;c=!1;let H=i.offsetHeight||1;b.value+g*.12>H*.3||g>900?(k=!0,i.style.pointerEvents="none",b.to(H,g)):b.to(0,g)};return i.addEventListener("pointerdown",M,{passive:!0}),i.addEventListener("pointermove",E,{passive:!1}),i.addEventListener("pointerup",F,{passive:!0}),i.addEventListener("pointercancel",F,{passive:!0}),()=>{b.stop(),i.removeEventListener("pointerdown",M),i.removeEventListener("pointermove",E),i.removeEventListener("pointerup",F),i.removeEventListener("pointercancel",F),i.style.transform="",i.style.willChange="",i.style.animation="",i.style.pointerEvents="";let w=i.parentElement;w&&(w.style.opacity="")}},[a,e,r,n])}var la,Zs=Se(()=>{"use strict";la=require("react")});function fn(e){return new Promise((r,t)=>{let n=new FileReader;n.onload=()=>r(n.result),n.onerror=()=>t(n.error??new Error("read failed")),n.readAsDataURL(e)})}async function ha(e){if(e.type==="image/gif"||e.type==="image/svg+xml"||e.size<=307200)return fn(e);try{let r=await createImageBitmap(e),t=Math.min(1,1536/Math.max(r.width,r.height)),n=Math.max(1,Math.round(r.width*t)),a=Math.max(1,Math.round(r.height*t));r.close?.();let o=await createImageBitmap(e,{resizeWidth:n,resizeHeight:a,resizeQuality:"high"});try{let i=document.createElement("canvas");i.width=n,i.height=a;let c=i.getContext("2d");if(!c)return fn(e);c.drawImage(o,0,0);let s=e.type==="image/png",l=await new Promise(h=>i.toBlob(h,s?"image/png":"image/jpeg",.85));return!l||l.size>=e.size?fn(e):fn(l)}finally{o.close?.()}}catch{return fn(e)}}var so=Se(()=>{"use strict"});function Gh(e){let r=0;for(let t=1;t<e.length;t++)r+=ei(e[t-1],e[t]);return r}function io(e){let r=1/0,t=1/0,n=-1/0,a=-1/0;for(let o of e)o.x<r&&(r=o.x),o.y<t&&(t=o.y),o.x>n&&(n=o.x),o.y>a&&(a=o.y);return{minX:r,minY:t,maxX:n,maxY:a}}function co(e,r,t){return[Gr(e.minY/t*1e3),Gr(e.minX/r*1e3),Gr(e.maxY/t*1e3),Gr(e.maxX/r*1e3)]}function Vh(e,r){let[t,n,a,o]=e,[i,c,s,l]=r,h=Math.min(o,l)-Math.max(n,c),d=Math.min(a,s)-Math.max(t,i);if(h<=0||d<=0)return!1;let u=Math.min((o-n)*(a-t),(l-c)*(s-i));return u>0&&h*d/u>.35}function Kh(e,r,t){if(e.length<2)return null;let n=io(e),a=co(n,r,t),o=Math.hypot(n.maxX-n.minX,n.maxY-n.minY);if(o<4)return null;let i=Gh(e),c=ei(e[0],e[e.length-1]),s=i/Math.max(c,1e-6);return c/o<.3&&i>o*1.8?{gesture:"ring",box:a,straight:!1}:s<1.25?{gesture:"arrow",box:a,to:[Gr(e[e.length-1].y/t*1e3),Gr(e[e.length-1].x/r*1e3)],straight:!0}:{gesture:"scribble",box:a,straight:!1}}function ti(e,r,t){if(!r||!t)return[];let n=[],a=[],o=[];for(let s of e){if(s.kind==="pin"&&typeof s.x=="number"&&typeof s.y=="number"){let l={x:s.x,y:s.y};o.push({gesture:"pin",id:s.id,text:s.label,box:co(io([l,l]),r,t)});continue}if(s.kind==="text"&&s.value&&typeof s.x=="number"&&typeof s.y=="number"){let l={x:s.x,y:s.y};a.push({gesture:"text",box:co(io([l,l]),r,t),text:s.value});continue}if(s.kind==="stroke"&&s.tool!=="eraser"&&s.points){let l=Kh(s.points,r,t);l&&n.push(l)}}let i=new Set,c=[];for(let s=0;s<n.length;s++){if(i.has(s))continue;let l=n[s];for(let h=s+1;h<n.length;h++)i.has(h)||!l.straight||!n[h].straight||Vh(l.box,n[h].box)&&(i.add(h),l={gesture:"cross",box:jh(l.box,n[h].box),straight:!1});i.add(s),c.push(l.gesture==="arrow"?{gesture:"arrow",box:l.box,to:l.to}:{gesture:l.gesture,box:l.box})}return[...o,...c,...a]}var ei,Gr,jh,ri=Se(()=>{"use strict";ei=(e,r)=>Math.hypot(e.x-r.x,e.y-r.y);Gr=e=>Math.max(0,Math.min(1e3,Math.round(e)));jh=(e,r)=>[Math.min(e[0],r[0]),Math.min(e[1],r[1]),Math.max(e[2],r[2]),Math.max(e[3],r[3])]});function Jh(e,r,t){let n=[],a="";for(let o of r.split(/\s+/)){let i=a?`${a} ${o}`:o;a&&e.measureText(i).width>t?(n.push(a),a=o):a=i}return a&&n.push(a),n.slice(0,3)}function Zh(e,r){let t=`${r}%`;return e<33?{top:t,left:8,transform:"translateY(-100%)"}:e>67?{top:t,right:8,transform:"translateY(-100%)"}:{top:t,left:`${e}%`,transform:"translate(-50%, -100%)"}}function ai({src:e,onCancel:r,onSend:t,t:n}){let[a,o]=(0,st.useState)(null),[i,c]=(0,st.useState)(!1),[s,l]=(0,st.useState)("pin"),h=(0,st.useRef)(0),[d,u]=(0,st.useState)(null),p=(0,st.useRef)(null),[g,f]=(0,st.useState)([{points:[],closed:!1}]),k=g[g.length-1],z=(0,st.useRef)(`selection-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`),b=(0,st.useRef)(null),N=x=>f(R=>[...R.slice(-66),x]),M=s==="select",[E,F]=(0,st.useState)([]),[w,H]=(0,st.useState)(!1),Q=(0,st.useRef)(null),T=(0,st.useRef)(null);(0,st.useEffect)(()=>{let x=new Image;return x.crossOrigin="anonymous",x.onload=()=>o(x),x.onerror=()=>c(!0),x.src=e,()=>{x.onload=null,x.onerror=null}},[e]);let A=(()=>{if(!a)return{w:0,h:0};let x=Math.min(1,Yh/Math.max(a.naturalWidth,a.naturalHeight));return{w:Math.round(a.naturalWidth*x),h:Math.round(a.naturalHeight*x)}})(),G=(0,st.useRef)(null),B=x=>{let R=Q.current;if(!R||!a)return;let m=R.getContext("2d");if(!m)return;G.current||(G.current=document.createElement("canvas"));let Z=G.current;Z.width=R.width,Z.height=R.height;let D=Z.getContext("2d"),O=x?[...E,x]:E;for(let y of O)y.kind==="stroke"&&(D.save(),D.globalCompositeOperation=y.tool==="eraser"?"destination-out":"source-over",D.strokeStyle=ni,D.lineWidth=y.tool==="eraser"?y.size*3:y.size,D.lineCap="round",D.lineJoin="round",D.beginPath(),y.points.forEach((P,q)=>q===0?D.moveTo(P.x,P.y):D.lineTo(P.x,P.y)),y.points.length===1&&D.lineTo(y.points[0].x+.01,y.points[0].y),D.stroke(),D.restore());m.clearRect(0,0,R.width,R.height),m.drawImage(a,0,0,R.width,R.height),m.drawImage(Z,0,0);let S=k.points.map((y,P)=>b.current?.index===P?b.current.point:y);S.length&&(m.save(),m.beginPath(),S.forEach((y,P)=>P?m.lineTo(y.x,y.y):m.moveTo(y.x,y.y)),k.closed&&(m.closePath(),m.fillStyle="#22c55e33",m.fill()),m.strokeStyle="#22c55e",m.lineWidth=Math.max(2,A.w/400),m.stroke(),m.restore());for(let y of S)m.beginPath(),m.arc(y.x,y.y,Math.max(3,A.w/260),0,Math.PI*2),m.fillStyle="#ffffff",m.fill(),m.strokeStyle="#15803d",m.stroke();for(let y of O){if(y.kind!=="pin")continue;let P=y.size;if(m.save(),m.beginPath(),m.moveTo(y.x,y.y),m.bezierCurveTo(y.x-P*2,y.y-P*2,y.x-P,y.y-P*3.5,y.x,y.y-P*3.5),m.bezierCurveTo(y.x+P,y.y-P*3.5,y.x+P*2,y.y-P*2,y.x,y.y),m.fillStyle=ni,m.fill(),m.lineWidth=Math.max(1,P/7),m.strokeStyle="#fff",m.stroke(),m.beginPath(),m.arc(y.x,y.y-P*2.2,P*.5,0,Math.PI*2),m.fillStyle="#fff",m.fill(),y.label){m.font=`600 ${P*1.2}px system-ui, sans-serif`,m.textAlign="center",m.textBaseline="middle";let q=Jh(m,y.label,R.width*.32),ce=P*1.5,ge=Math.min(R.width,Math.max(...q.map(te=>m.measureText(te).width))+P),me=q.length*ce+P*.4,ue=Math.max(ge/2,Math.min(R.width-ge/2,y.x)),j=Math.max(me,y.y-P*3.7);m.fillStyle="rgba(0,0,0,.8)",m.fillRect(ue-ge/2,j-me,ge,me),m.fillStyle="#fff",q.forEach((te,we)=>m.fillText(te,ue,j-me+P*.2+ce*(we+.5),ge-P))}m.restore()}};(0,st.useEffect)(()=>{B()},[a,E,k,A.w,A.h]);let X=x=>{let R=Q.current,m=R.getBoundingClientRect();return{x:Math.max(0,Math.min(R.width,(x.clientX-m.left)/m.width*R.width)),y:Math.max(0,Math.min(R.height,(x.clientY-m.top)/m.height*R.height))}},xe=()=>Math.max(4,Math.round(A.w/180)),se=x=>{F(R=>R.filter(m=>m.kind!=="pin"||m.id!==x)),u(null)},V=()=>{let x=E.find(R=>R.kind==="pin"&&R.id===d);x?.kind==="pin"&&!x.label.trim()?se(x.id):u(null)},re=x=>{if(!a)return;let R=X(x);if(s==="pin"){let m=E.find(O=>O.kind==="pin"&&Math.hypot(R.x-O.x,R.y-(O.y-O.size*1.7))<O.size*2);if(m?.kind==="pin"){u(m.id),x.currentTarget.setPointerCapture(x.pointerId),p.current={id:m.id,offset:{x:R.x-m.x,y:R.y-m.y}};return}if(d){V();return}if(E.filter(O=>O.kind==="pin").length>=Xh)return;let Z=`pin-${++h.current}`,D=Math.max(10,A.w/Q.current.getBoundingClientRect().width*9);F(O=>[...O,{kind:"pin",...R,id:Z,label:"",size:D}]),u(Z);return}if(s==="select"){let m=k.points[0],Z=Q.current.getBoundingClientRect(),D=12*A.w/Z.width;if(!k.closed&&m&&k.points.length>=3&&Math.hypot(R.x-m.x,R.y-m.y)<D)N({...k,closed:!0});else{let O=k.points.findIndex(S=>Math.hypot(R.x-S.x,R.y-S.y)<D);if(O>=0){x.currentTarget.setPointerCapture(x.pointerId),b.current={index:O,point:R};return}if(k.closed||k.points.length>=64)return;N({...k,points:[...k.points,R]})}return}x.target.setPointerCapture(x.pointerId),T.current={kind:"stroke",tool:s,size:xe(),points:[R]},B(T.current)},W=x=>{if(p.current){let{id:R,offset:m}=p.current,Z=X(x);F(D=>D.map(O=>O.kind==="pin"&&O.id===R?{...O,x:Math.max(0,Math.min(A.w,Z.x-m.x)),y:Math.max(0,Math.min(A.h,Z.y-m.y))}:O));return}if(b.current){b.current.point=X(x),B();return}T.current&&(T.current.points.push(X(x)),B(T.current))},_=()=>{if(p.current){p.current=null;return}if(b.current){let{index:R,point:m}=b.current;b.current=null,N({...k,points:k.points.map((Z,D)=>D===R?m:Z)});return}if(!T.current)return;let x=T.current;T.current=null,F(R=>[...R,x])},J=E.filter(x=>x.kind==="pin"),C=J.find(x=>x.id===d),L=!!a&&!(k.points.length>0&&!k.closed)&&J.length>0&&J.every(x=>x.label.trim()),I=()=>{if(!(!L||!a))try{let x=document.createElement("canvas");x.width=A.w,x.height=A.h;let R=x.getContext("2d");if(!R){H(!0);return}R.drawImage(a,0,0,A.w,A.h);let m=x.toDataURL("image/jpeg",.92),Z=Q.current?.toDataURL("image/jpeg",.85)||m,D=ti(E,A.w,A.h);if(k.closed){let O=y=>Math.round(y/A.w*1e3),S=y=>Math.round(y/A.h*1e3);D.unshift({gesture:"selection",id:z.current,box:[S(Math.min(...k.points.map(y=>y.y))),O(Math.min(...k.points.map(y=>y.x))),S(Math.max(...k.points.map(y=>y.y))),O(Math.max(...k.points.map(y=>y.x)))],points:k.points.map(y=>[O(y.x),S(y.y)])})}t(m,J.map(O=>O.label.trim()).join("; "),D,Z)}catch{H(!0)}},K=s==="pin"?"markupPinHint":s==="select"?k.closed?"markupSelectedHint":"markupOutlineHint":"markupSketchHint";return(0,Ke.jsxs)("div",{className:"hsk-markup",role:"dialog","aria-label":n("markupDialogLabel"),children:[(0,Ke.jsxs)("div",{className:"hsk-markup-head",children:[(0,Ke.jsx)("span",{className:"hsk-markup-title",role:"status",children:n(K)}),(0,Ke.jsx)("button",{className:"hsk-markup-cancel",onClick:r,children:n("markupCancel")})]}),(0,Ke.jsx)("div",{className:"hsk-markup-stage",children:i?(0,Ke.jsx)("div",{className:"hsk-markup-error",children:n("markupLoadError")}):a?(0,Ke.jsxs)("div",{className:"hsk-markup-canvas-wrap",children:[(0,Ke.jsx)("canvas",{ref:Q,width:A.w,height:A.h,className:`hsk-markup-canvas hsk-markup-canvas--${s}`,style:{touchAction:"none",cursor:M||s==="pin"?"crosshair":void 0},onPointerDown:re,onPointerMove:W,onPointerUp:_,onPointerCancel:()=>{p.current=null,b.current=null,T.current=null,B()}}),s==="pin"&&C&&(0,Ke.jsxs)("div",{className:"hsk-markup-pinlabel",style:Zh(C.x/A.w*100,Math.max(12,(C.y-C.size*4)/A.h*100)),children:[(0,Ke.jsx)("input",{autoFocus:!0,"aria-label":n("markupPinLabel"),placeholder:n("markupPinLabelHint"),value:C.label,maxLength:Qh,style:{width:`${Math.min(34,Math.max(16,C.label.length+2))}ch`},onChange:x=>F(R=>R.map(m=>m.kind==="pin"&&m.id===C.id?{...m,label:x.target.value}:m)),onKeyDown:x=>{(x.key==="Enter"||x.key==="Escape")&&V()}}),(0,Ke.jsx)("button",{"aria-label":n("markupRemovePin"),title:n("markupRemovePin"),onClick:()=>se(C.id),children:"\xD7"})]})]}):(0,Ke.jsx)("div",{className:"hsk-markup-loading",children:n("markupLoading")})}),(0,Ke.jsxs)("div",{className:"hsk-markup-tools",children:[(0,Ke.jsxs)("button",{className:`hsk-markup-tool${s==="pin"?" hsk-markup-tool--on":""}`,onClick:()=>l("pin"),children:[(0,Ke.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{verticalAlign:"middle",marginInlineEnd:5},"aria-hidden":"true",children:[(0,Ke.jsx)("path",{d:"M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z"}),(0,Ke.jsx)("circle",{cx:"12",cy:"10",r:"3"})]}),n("markupPin")]}),(0,Ke.jsx)("button",{className:`hsk-markup-tool${s==="select"?" hsk-markup-tool--on":""}`,onClick:()=>{u(null),l("select")},children:n("markupSelect")}),(0,Ke.jsx)("button",{className:"hsk-markup-tool",disabled:k.closed||k.points.length<3,onClick:()=>N({...k,closed:!0}),children:n("markupCloseOutline")}),(0,Ke.jsx)("button",{className:`hsk-markup-tool${s==="pen"?" hsk-markup-tool--on":""}`,onClick:()=>{u(null),l("pen")},children:n("markupSketch")}),(0,Ke.jsx)("button",{className:`hsk-markup-tool${s==="eraser"?" hsk-markup-tool--on":""}`,onClick:()=>{u(null),l("eraser")},children:n("markupEraser")}),(0,Ke.jsx)("button",{className:"hsk-markup-tool",onClick:()=>M?f(x=>x.length>1?x.slice(0,-1):x):F(x=>x.slice(0,-1)),disabled:M?g.length<2:E.length===0,children:n("markupUndo")}),(0,Ke.jsx)("button",{className:"hsk-markup-tool",onClick:()=>{F([]),u(null),f([{points:[],closed:!1}]),l("pin")},disabled:E.length===0&&!k.points.length,children:n("markupClear")}),(0,Ke.jsx)("button",{className:"hsk-markup-go",onClick:I,disabled:!L,children:n("markupSend")})]}),w&&(0,Ke.jsx)("div",{className:"hsk-markup-error",children:n("markupError")})]})}var st,Ke,ni,Yh,Xh,Qh,oi=Se(()=>{"use strict";st=require("react");ri();Ke=require("react/jsx-runtime"),ni="#ff5a5a",Yh=1280,Xh=4,Qh=80});function ui(e){let r=2166136261;for(let t=0;t<e.length;t++)r^=e.charCodeAt(t),r=Math.imul(r,16777619);return r>>>0}function gn(e){let r=e>>>0;return()=>{r=r+1831565813>>>0;let t=Math.imul(r^r>>>15,1|r);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function ed(e){let t=new Float32Array(65536);for(let a=0;a<t.length;a++)t[a]=e();let n=(a,o)=>t[(o&255)*256+(a&255)];return(a,o)=>{let i=Math.floor(a),c=Math.floor(o),s=si(a-i),l=si(o-c),h=n(i,c),d=n(i+1,c),u=n(i,c+1),p=n(i+1,c+1);return(h+(d-h)*s)*(1-l)+(u+(p-u)*s)*l}}function td(e,r,t,n){let a=t/Math.SQRT2,o=Math.ceil(e/a),i=Math.ceil(r/a),c=new Int32Array(o*i).fill(-1),s=[],l=[],h=(u,p)=>{let g=s.length;s.push([u,p]),c[Math.floor(p/a)*o+Math.floor(u/a)]=g,l.push(g)},d=(u,p)=>{if(u<0||p<0||u>=e||p>=r)return!1;let g=Math.floor(u/a),f=Math.floor(p/a);for(let k=Math.max(f-2,0);k<=Math.min(f+2,i-1);k++)for(let z=Math.max(g-2,0);z<=Math.min(g+2,o-1);z++){let b=c[k*o+z];if(b<0)continue;let N=s[b][0]-u,M=s[b][1]-p;if(N*N+M*M<t*t)return!1}return!0};for(h(n()*e,n()*r);l.length;){let u=n()*l.length|0,[p,g]=s[l[u]],f=!1;for(let k=0;k<24;k++){let z=n()*Math.PI*2,b=t*(1+n()),N=p+Math.cos(z)*b,M=g+Math.sin(z)*b;if(d(N,M)){h(N,M),f=!0;break}}f||l.splice(u,1)}return s}function ho(e,r,t){let n=li(e),a=li(r);return`rgb(${Math.round(n[0]+(a[0]-n[0])*t)},${Math.round(n[1]+(a[1]-n[1])*t)},${Math.round(n[2]+(a[2]-n[2])*t)})`}function mo(){for(let e of uo)e()}function mi(e){po.forEach(r=>r(e))}function od(e,r,t){return`hsl(${Math.round(r*300%360)}, ${t?72:68}%, ${t?58:46}%)`}function bi(e,r,t,n,a,o,i,c=r){let s=i?rd[i]:void 0,l=gn(a),h=ed(gn(a^2654435769)),d=e*r,p=Math.max(40,Math.min(520,Math.round(d/3100)))/.48,g=Math.max(26,Math.sqrt(.7*d/p)),f=td(e,r,g,l),k=4.4/Math.max(e,r),z=k*2.6,b=Math.hypot(e,r),N=l()*Math.PI*2,M=Math.cos(N),E=Math.sin(N),F=e*(.18+l()*.64),w=r*(.12+l()*.5),H=[],Q=Math.hypot(e,r)||1,T=gn(a^1540483477),A=o?e:0,G=Math.hypot(e,c)||1,[B,X,xe]=t.split(",").map(V=>parseFloat(V)||0),se=.2126*B+.7152*X+.0722*xe>128;for(let[V,re]of f){let W=h(V*k,re*k)*.72+h(V*z,re*z)*.28,_=Math.min(1,Math.max(0,(W-.26)/.44));if(l()>_*_*(3-2*_))continue;let J=l(),C=Math.max(0,1-Math.hypot(V-F,re-w)/(b*.72))**1.6,L=((V-e/2)*M+(re-r/2)*E)/b+.5,I=!se,x=((I?.055:.028)+l()*(I?.04:.025))*(.75+L*.55)*(1+C*.4),R=ho(t,n,C*.85),m=((o?e-V:V)+r-re)/(e+r||1),Z=l()*16777215|0,D=od(Z,m,se),O=0,S=I?1.05+l()*.35:.65+l()*.35,y=20,P=lo[0],q=1;J<.5?(O=it(l,.16),S=I?1.15+l()*.45:.7+l()*.35,y=20+l()*16,P=lo[l()*lo.length|0]):J<.82?(O=l()*Math.PI*2,S=I?.95+l()*.4:.6+l()*.4,y=16+l()*20,P=ii[l()*ii.length|0]):J<.95||!s?(O=l()*Math.PI*2,S=I?.85+l()*.35:.55+l()*.35,y=7+l()*7,P=ci[l()*ci.length|0]):(O=it(l,.3),S=I?1.1+l()*.3:.75+l()*.3,y=15+l()*9,P=s,q=2.6),H.push({x:V,y:re,roll:J,rotation:O,lineWidth:S,alpha:x*q,baseColor:R,shimmerColor:D,drawFn:P,size:y,seed:Z,normDist:m,bloom:Math.min(1,Math.hypot(V-A,re-c)/G)*.62+T()*.08,glow:se?.2:.06,ux:(V-A)/(Math.hypot(V-A,re-c)||1),uy:(re-c)/(Math.hypot(V-A,re-c)||1)})}return H}function id(e){return 1+(1.2+1)*(e-1)**3+1.2*(e-1)**2}function Nr(e,r,t,n,a,o=1,i){e.clearRect(0,0,t,n),e.lineCap="round",e.lineJoin="round";let c=a>=0&&a<=1.4,s=c?a*1.4-.2:-999,l=.3;for(let h of r){let d=h.alpha,u=h.baseColor,p=h.lineWidth,g=1,f=0,k=0;if(i!==void 0){let b=Math.min(1,Math.max(0,(i-h.bloom)/sd));if(b<=0)continue;let N=1-(1-b)**3,M=Math.sin(b*Math.PI)**2;d=h.alpha*N+M*h.glow,u=ho(h.baseColor,h.shimmerColor,M*(h.glow>.1?.85:.55)),p=h.lineWidth*(1+M*.35),g=.86+.14*id(b),f=-h.ux*(1-N)*9,k=-h.uy*(1-N)*9}else if(c){let b=h.normDist-s;if(b>l)d=h.alpha*.45,u=h.baseColor,p=h.lineWidth;else if(b<-l)d=h.alpha,u=h.baseColor,p=h.lineWidth;else{let N=Math.cos(b/l*(Math.PI/2))**2;d=h.alpha+N*.08,u=N>.08?ho(h.baseColor,h.shimmerColor,N*.65):h.baseColor,p=h.lineWidth*(1+N*.2)}}e.save(),e.translate(h.x+(h.dx??0)+f,h.y+(h.dy??0)+k),e.rotate(h.rotation+(h.dr??0)),g!==1&&e.scale(g,g),h.hop&&(e.scale(1+h.hop,1+h.hop),d*=1+h.hop*2),e.globalAlpha=Math.min(d*o,1),e.strokeStyle=u,e.fillStyle=u,e.lineWidth=p;let z=gn(h.seed);h.drawFn(e,h.size,z),e.restore()}}function ld({seed:e="",theme:r,alphaScale:t=1.8,weight:n=.6}){let a=(0,ft.useRef)(null);return(0,ft.useEffect)(()=>{let o=a.current,i=o?.getContext("2d");if(!o||!i)return;let c=0,s=()=>{let h=o.clientWidth,d=o.clientHeight,u=Math.min(window.devicePixelRatio||1,3);o.width=Math.round(h*u),o.height=Math.round(d*u);let p=getComputedStyle(o),g=p.getPropertyValue("--hsk-doodle-ink").trim()||"31,31,31",f=p.getPropertyValue("--hsk-doodle-tint").trim()||g,k=h*kn,z=d*kn,b=bi(k,z,g,f,ui(e||"kiku"),!1,r);for(let E of b)E.lineWidth*=kn*n;if(i.setTransform(u/kn,0,0,u/kn,0,0),window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches){Nr(i,b,k,z,-1,t);return}let N=performance.now(),M=E=>{let F=(E-N)%(pi*2)/pi,w=F<1?F:2-F;Nr(i,b,k,z,(1-Math.cos(w*Math.PI))/2*1.4,t),c=requestAnimationFrame(M)};c=requestAnimationFrame(M)},l=new ResizeObserver(()=>{c||!o.clientWidth||!o.clientHeight||(l.disconnect(),s())});return l.observe(o),()=>{l.disconnect(),cancelAnimationFrame(c)}},[e,r,t,n]),(0,xn.jsx)("canvas",{className:"hsk-doodle-shimmer",ref:a,"aria-hidden":"true"})}function Vr({active:e,seed:r,theme:t}){let[n,a]=(0,ft.useState)(e);return(0,ft.useEffect)(()=>{if(e){a(!0);return}let o=setTimeout(()=>a(!1),hd);return()=>clearTimeout(o)},[e]),n?(0,xn.jsx)("span",{className:`hsk-working-veil${e?"":" is-leaving"}`,"aria-hidden":"true",children:(0,xn.jsx)(ld,{seed:r,theme:t,alphaScale:18,weight:1.15})}):null}var ft,xn,si,it,lo,ii,ci,rd,li,po,uo,nd,hi,di,ad,sd,cd,kn,pi,hd,da,vn=Se(()=>{"use strict";ft=Wt(require("react")),xn=require("react/jsx-runtime");si=e=>e*e*(3-2*e);it=(e,r)=>(e()-.5)*r,lo=[(e,r,t)=>{let n=r*.5,a=r*(.14+t()*.04),o=r*.07;e.beginPath(),e.moveTo(-a-o*.6,-n),e.lineTo(a+o*.6,-n),e.moveTo(-a,-n+o),e.lineTo(a,-n+o),e.moveTo(-a,-n+o),e.lineTo(-a*.85,n-o),e.moveTo(a,-n+o),e.lineTo(a*.85,n-o),e.moveTo(0,-n+o*1.7),e.lineTo(0,n-o*1.7),e.moveTo(-a,n-o),e.lineTo(a,n-o),e.moveTo(-a-o*.6,n),e.lineTo(a+o*.6,n),e.stroke()},(e,r,t)=>{let n=r*.5,a=-n*(.18+t()*.1);e.beginPath(),e.moveTo(-n,a),e.lineTo(0,-n),e.lineTo(n,a),e.closePath(),e.moveTo(-n*.92,a+n*.16),e.lineTo(n*.92,a+n*.16);for(let o of[-.62,-.21,.21,.62])e.moveTo(n*o,a+n*.16),e.lineTo(n*o,n*.8);e.moveTo(-n,n*.8),e.lineTo(n,n*.8),e.stroke()},(e,r,t)=>{let n=r*.5,a=n*(.48+t()*.12);e.beginPath(),e.moveTo(-n*.2,-n*.86),e.lineTo(n*.2,-n*.86),e.moveTo(-n*.15,-n*.78),e.bezierCurveTo(-a,-n*.3,-a*.85,n*.6,0,n*.86),e.bezierCurveTo(a*.85,n*.6,a,-n*.3,n*.15,-n*.78),e.moveTo(-n*.17,-n*.64),e.quadraticCurveTo(-a*1.16,-n*.48,-a*.7,-n*.04),e.moveTo(n*.17,-n*.64),e.quadraticCurveTo(a*1.16,-n*.48,a*.7,-n*.04),e.stroke()},(e,r,t)=>{let n=r*.5;e.beginPath(),e.moveTo(-n*.9,n*.52),e.quadraticCurveTo(0,-n*.18,n*.9,-n*.58),e.stroke();let a=4+(t()*3|0);for(let o=0;o<a;o++){let i=.16+o/a*.8,c=-n*.9+i*n*1.8,s=n*.52-i*n*1.16+(1-i)*i*n*.3,l=o%2?1:-1,h=n*(.26+t()*.1);e.beginPath(),e.moveTo(c,s),e.quadraticCurveTo(c+h*.5,s+l*h*.66,c+h*.9,s+l*h*.08),e.quadraticCurveTo(c+h*.42,s+l*h*.04,c,s),e.stroke()}},(e,r,t)=>{let n=r*.5;e.beginPath(),e.moveTo(-n*.85,-n*.7),e.quadraticCurveTo(-n*.1,-n*.35,n*.2,n*.1),e.stroke();let a=[[-n*.45,-n*.12],[n*.05,n*.3],[n*.42,-n*.4]];for(let[o,i]of a)e.beginPath(),e.moveTo(o,i-n*.28),e.lineTo(o-n*.02,i-n*.16),e.stroke(),e.beginPath(),e.ellipse(o,i,n*(.15+t()*.04),n*.19,it(t,.5),0,Math.PI*2),e.stroke()},(e,r,t)=>{let n=r*.5;for(let a of[-1,1]){e.beginPath(),e.arc(0,0,n*.72,a>0?-1.25:1.25,a>0?1.25:Math.PI*2-1.25,a<0),e.stroke();for(let o=0;o<5;o++){let i=-1.05+o/4*2.1,c=Math.sin(i)*a*n*.72,s=Math.cos(i)*n*.72,l=n*(.2+t()*.08);e.beginPath(),e.moveTo(c,s),e.quadraticCurveTo(c+a*l*.9,s-l*.5,c+a*l*.6,s-l*1.05),e.stroke()}}},(e,r)=>{let t=r*.5;e.beginPath(),e.moveTo(-t,t*.6),e.lineTo(t*.55,t*.6),e.lineTo(t*.55,-t*.6),e.lineTo(-t*.45,-t*.6),e.lineTo(-t*.45,t*.15),e.lineTo(t*.1,t*.15),e.lineTo(t*.1,-t*.18),e.stroke()},(e,r)=>{let t=r*.5;e.beginPath(),e.moveTo(-t*.62,t*.8),e.lineTo(-t*.62,-t*.05),e.arc(0,-t*.05,t*.62,Math.PI,0),e.lineTo(t*.62,t*.8),e.stroke(),e.beginPath(),e.moveTo(-t*.86,t*.8),e.lineTo(t*.86,t*.8),e.stroke()},(e,r,t)=>{let n=r*.5;e.beginPath(),e.arc(0,0,n*.4,0,Math.PI*2),e.stroke();let a=t()*.5;for(let o=0;o<8;o++){let i=a+o/8*Math.PI*2;e.beginPath(),e.moveTo(Math.cos(i)*n*.6,Math.sin(i)*n*.6),e.lineTo(Math.cos(i)*n*.94,Math.sin(i)*n*.94),e.stroke()}},(e,r)=>{let t=r*.5;e.beginPath(),e.moveTo(-t*.44,t*.7),e.bezierCurveTo(-t,t*.2,-t*.8,-t*.7,-t*.3,-t*.6),e.moveTo(t*.44,t*.7),e.bezierCurveTo(t,t*.2,t*.8,-t*.7,t*.3,-t*.6),e.moveTo(-t*.32,-t*.64),e.lineTo(t*.32,-t*.64),e.moveTo(-t*.44,t*.7),e.lineTo(t*.44,t*.7);for(let n of[-.16,.02,.2])e.moveTo(t*n,-t*.56),e.lineTo(t*n,t*.62);e.stroke()},(e,r,t)=>{let n=r*.5,a=n*(.4+t()*.18);e.beginPath(),e.moveTo(-n,n*.16),e.quadraticCurveTo(-n*.5,-a,0,-n*.02),e.quadraticCurveTo(n*.5,-a,n,n*.16),e.stroke()}],ii=[(e,r,t)=>{let n=r*.5,a=-n+it(t,n*.3),o=it(t,n);e.beginPath(),e.moveTo(a,o);let i=4+(t()*4|0);for(let c=0;c<i;c++){let s=a+n*2/i+it(t,n*.5),l=it(t,n*1.5);e.quadraticCurveTo(a+it(t,n*.9),o+it(t,n*1.6),s,l),a=s,o=l}e.stroke()},(e,r,t)=>{let n=r*.5,a=2.2+t()*1.6,o=t()<.5?-1:1;e.beginPath();for(let i=0;i<=60;i++){let c=i/60,s=o*c*a*Math.PI*2,l=n*c*(.9+it(t,.06)),h=Math.cos(s)*l,d=Math.sin(s)*l;i===0?e.moveTo(h,d):e.lineTo(h,d)}e.stroke()},(e,r,t)=>{let n=r*.5,a=4+(t()*4|0),o=it(t,.7);for(let i=0;i<a;i++){let c=-n+i/(a-1)*n*2+it(t,n*.16),s=n*(.7+t()*.6);e.beginPath(),e.moveTo(c-o*s*.5,-s*.5),e.quadraticCurveTo(c+it(t,n*.2),0,c+o*s*.5,s*.5),e.stroke()}},(e,r,t)=>{let n=r*.5,a=2+(t()*3|0),o=n*2/a;e.beginPath(),e.moveTo(-n,n*.4);for(let i=0;i<a;i++){let c=-n+i*o,s=o*(.42+t()*.18);e.bezierCurveTo(c+s*.2,n*.4-s*2.1,c+o-s*.2,n*.4-s*2.1,c+o,n*.4+it(t,n*.14))}e.stroke()}],ci=[(e,r,t)=>{e.beginPath(),e.arc(0,0,r*.1+t()*r*.04,0,Math.PI*2),e.fill()},(e,r,t)=>{e.beginPath(),e.arc(it(t,r*.04),it(t,r*.04),r*.32,0,Math.PI*2),e.stroke()},(e,r,t)=>{let n=r*.4,a=n*(.2+t()*.12);e.beginPath(),e.moveTo(0,-n),e.quadraticCurveTo(a,-a,n,0),e.quadraticCurveTo(a,a,0,n),e.quadraticCurveTo(-a,a,-n,0),e.quadraticCurveTo(-a,-a,0,-n),e.stroke()},(e,r,t)=>{let n=r*.4;e.beginPath(),e.moveTo(-n,it(t,r*.08)),e.quadraticCurveTo(0,it(t,r*.16),n,it(t,r*.08)),e.stroke()}],rd={light:(e,r)=>{let t=r*.5;e.beginPath(),e.moveTo(0,-t),e.quadraticCurveTo(t*.16,-t*.16,t,0),e.quadraticCurveTo(t*.16,t*.16,0,t),e.quadraticCurveTo(-t*.16,t*.16,-t,0),e.quadraticCurveTo(-t*.16,-t*.16,0,-t),e.stroke()},dark:(e,r)=>{let t=r*.44;e.beginPath(),e.moveTo(-t*.6,-t*.5),e.lineTo(t*.6,-t*.5),e.lineTo(t,t*.05),e.lineTo(0,t),e.lineTo(-t,t*.05),e.closePath(),e.moveTo(-t,t*.05),e.lineTo(t,t*.05),e.moveTo(-t*.6,-t*.5),e.lineTo(-t*.3,t*.05),e.lineTo(0,t),e.moveTo(t*.6,-t*.5),e.lineTo(t*.3,t*.05),e.lineTo(0,t),e.stroke()},mahogany:(e,r)=>{let t=r*.5;e.beginPath(),e.moveTo(0,t),e.bezierCurveTo(-t*.9,t*.2,-t*.7,-t*.7,0,-t),e.bezierCurveTo(t*.7,-t*.7,t*.9,t*.2,0,t),e.moveTo(0,t*.86),e.lineTo(0,-t*.86);for(let n=0;n<3;n++){let a=-.34+n*.36;e.moveTo(0,t*a),e.lineTo(t*.44,t*(a-.26)),e.moveTo(0,t*a),e.lineTo(-t*.44,t*(a-.26))}e.stroke()},blush:(e,r)=>{let t=r*.5;for(let n=0;n<5;n++){let a=n/5*Math.PI*2-Math.PI/2;e.beginPath(),e.ellipse(Math.cos(a)*t*.52,Math.sin(a)*t*.52,t*.42,t*.26,a,0,Math.PI*2),e.stroke()}e.beginPath(),e.arc(0,0,t*.19,0,Math.PI*2),e.stroke()},coffee:(e,r)=>{let t=r*.5;e.beginPath(),e.ellipse(0,0,t*.6,t*.9,0,0,Math.PI*2),e.stroke(),e.beginPath(),e.moveTo(0,-t*.84),e.bezierCurveTo(t*.34,-t*.3,-t*.34,t*.3,0,t*.84),e.stroke()},midnight:(e,r)=>{let t=r*.5;e.beginPath();for(let n=0;n<10;n++){let a=n%2===0?t:t*.4,o=n/10*Math.PI*2-Math.PI/2,i=Math.cos(o)*a,c=Math.sin(o)*a;n===0?e.moveTo(i,c):e.lineTo(i,c)}e.closePath(),e.stroke()}},li=e=>{let r=e.split(",").map(t=>parseFloat(t.trim()));return[r[0]||0,r[1]||0,r[2]||0]};po=new Set,uo=new Set;nd=83,hi=[{k:.45,hop:1},{k:1.15,hop:.55},{k:.95,hop:.12},{k:1,hop:0}],di=7,ad=.28;sd=.3;cd=ft.default.memo(function({seed:r="",theme:t,dir:n,waitForContent:a=!1}){let o=(0,ft.useRef)(null),i=(0,ft.useRef)(!1),c=(0,ft.useRef)(0),s=(0,ft.useRef)(null),l=(0,ft.useRef)(0),h=(0,ft.useRef)(0),d=(0,ft.useRef)(a);return(0,ft.useEffect)(()=>{let u=o.current;if(!u)return;let p=ui(r||"kiku"),g=0,f=(T,A,G,B)=>X=>{let xe=X-T,se=Math.min(1,xe/A),V=u.clientWidth,re=u.clientHeight;if(V&&re){let W=Math.min(window.devicePixelRatio||1,3),_=Math.round(V*W),J=Math.round(re*W);(u.width!==_||u.height!==J)&&(u.width=_,u.height=J);let C=u.getContext("2d");C&&(C.setTransform(W,0,0,W,0,0),Nr(C,G,V,re,-1,1,se))}if(se<1)c.current=requestAnimationFrame(f(T,A,G,B));else{i.current=!1;let W=u.clientWidth,_=u.clientHeight,J=u.getContext("2d");if(J&&W&&_){let C=Math.min(window.devicePixelRatio||1,3);J.setTransform(C,0,0,C,0,0),Nr(J,G,W,_,-1)}}},k=()=>{let T=u.clientWidth,A=u.clientHeight;if(!T||!A)return;let G=Math.min(window.devicePixelRatio||1,3),B=u.getContext("2d");if(!B)return;let X=getComputedStyle(u),xe=X.getPropertyValue("--hsk-doodle-ink").trim()||"31,31,31",se=X.getPropertyValue("--hsk-doodle-tint").trim()||xe,V=n==="rtl"||X.direction==="rtl"||u.closest('[dir="rtl"]')!==null,re=typeof window<"u"?Math.max(A,window.innerHeight||0):A,W=bi(T,re,xe,se,p,V,t,A);s.current=W,l.current=T,h.current=re;let _=Math.round(T*G),J=Math.round(A*G);if((u.width!==_||u.height!==J)&&(u.width=_,u.height=J),B.setTransform(G,0,0,G,0,0),d.current){B.clearRect(0,0,T,A);return}if(window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches){Nr(B,W,T,A,-1);return}cancelAnimationFrame(c.current),i.current=!0;let L=1500,I=performance.now();c.current=requestAnimationFrame(f(I,L,W,V))},z=()=>{let T=s.current,A=u.clientWidth,G=u.clientHeight;if(T&&A===l.current&&G<=h.current){if(i.current||d.current||!G)return;let B=u.getContext("2d");if(!B)return;let X=Math.min(window.devicePixelRatio||1,3);u.width=Math.round(A*X),u.height=Math.round(G*X),B.setTransform(X,0,0,X,0,0),Nr(B,T,A,G,-1);return}clearTimeout(g),g=window.setTimeout(k,20)};k();let b=()=>{d.current&&(d.current=!1,k())};uo.add(b);let N=d.current?window.setTimeout(b,2e3):0,M=new ResizeObserver(z);M.observe(u);let E=window.matchMedia?.("(prefers-color-scheme: dark)"),F=()=>{k()};E?.addEventListener?.("change",F);let w=0,H=()=>{let T=s.current,A=u.getContext("2d"),G=u.clientWidth,B=u.clientHeight;if(!T||!A||!G||!B)return;let X=Math.min(window.devicePixelRatio||1,3);A.setTransform(X,0,0,X,0,0),Nr(A,T,G,B,-1)},Q=({x:T,y:A,strength:G})=>{let B=s.current;if(!B||window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches)return;cancelAnimationFrame(c.current),i.current=!1,clearTimeout(w);let X=u.getBoundingClientRect(),xe=T-X.left,se=A-X.top,V=gn(performance.now()*997|0),re=(C,L)=>Math.max(-L,Math.min(L,C)),W=B.map(C=>{let L=C.dx??0,I=C.dy??0,K=C.dr??0,x=C.x-xe,R=C.y-se,m=Math.hypot(x,R)||1,Z=G*(.18+.82*Math.exp(-m/220)),D=Z*(.6+V()*1.8),O=re(L+x/m*D+(V()-.5)*Z*2,di),S=re(I+R/m*D+(V()-.5)*Z*2,di),y=re(K+(V()-.5)*Z*.12,ad);return{g:C,fx:L,fy:I,fr:K,tx:O,ty:S,tr:y,lift:Z*.09}}),_=0,J=()=>{let C=hi[_];for(let L of W)L.g.dx=L.fx+(L.tx-L.fx)*C.k,L.g.dy=L.fy+(L.ty-L.fy)*C.k,L.g.dr=L.fr+(L.tr-L.fr)*C.k,L.g.hop=L.lift*C.hop;H(),++_<hi.length&&(w=window.setTimeout(J,nd))};J()};return po.add(Q),()=>{po.delete(Q),uo.delete(b),clearTimeout(N),clearTimeout(w),clearTimeout(g),cancelAnimationFrame(c.current),i.current=!1,M.disconnect(),E?.removeEventListener?.("change",F)}},[r,t,n]),(0,xn.jsx)("canvas",{className:"hsk-cb-doodles",ref:o,"aria-hidden":"true"})}),kn=3,pi=1800;hd=300;da=cd});function yn(e,r){if(!e)return;let t=e.trim();if(!t)return;let n=t.toLowerCase(),a=ua.find(c=>c.value.toLowerCase()===n||c.native.toLowerCase()===n||c.tag===n);if(a)return a.native;if(pa[n]?.endonym)return pa[n].endonym;let o=Object.values(pa).find(c=>c.endonym?.toLowerCase()===n);if(o?.endonym)return o.endonym;let i=r||(n.length<=3?n:void 0);if(i&&typeof Intl<"u"&&Intl.DisplayNames)try{let s=new Intl.DisplayNames([i],{type:"language"}).of(i);if(s&&s.toLowerCase()!==i.toLowerCase())return s}catch{}return t}function fi(e){for(let r of e){let t=r.codePointAt(0)??0;if(t>=1424&&t<=2303||t>=64285&&t<=65023||t>=65136&&t<=65279)return!0}return!1}function ki(e){let r=e.trim();return r?r.charAt(0).toUpperCase()+r.slice(1):"\u2026"}function Ir(e){if(!e)return{nativeName:"\u2026",preparing:"Preparing\u2026",changeLang:"\u2190",rtl:!1,known:!0};let r=e.trim().toLowerCase(),t=Object.entries(pa).find(([i,c])=>i===r||c.endonym?.toLowerCase()===r||yn(i)?.toLowerCase()===r);if(t)return{nativeName:t[1].endonym||yn(e)||ki(e),preparing:t[1].preparing,changeLang:t[1].changeLang,rtl:!!t[1].rtl||fi(t[1].preparing),known:!0};let n=yn(e)||e,a=ki(n),o=fi(a);return{nativeName:a,preparing:`Preparing in ${a}\u2026`,changeLang:o?"\u062A\u063A\u064A\u064A\u0631":"Change",rtl:o,known:!1}}function xi(e){let r=e.trim();if(!r||r.length>40||r.includes("?"))return null;r=r.replace(/^(hi|hey|hello|yo)[,!.\s]+/i,""),r=r.replace(/^(i['’]?m|im|my name is|call me|it['’]?s|this is|name['’]?s)\s+/i,""),r=r.trim().replace(/[.!,]+$/,"");let t=r.split(/\s+/);if(t.length===0||t.length>3||!/^[\p{L}][\p{L}\-'’ ]{0,30}$/u.test(r))return null;let n=r.toLowerCase();if(["phone","laptop","tv","cheap","best","under","buy","search","find","show","need","want","price","sofa","shoe","headphone","camera","gift","help"].some(i=>n.includes(i)))return null;let o=t[0];return o.charAt(0).toUpperCase()+o.slice(1)}var bo,wn,ua,pa,Cn,fo,yr,wt,ko,wr,gi,vi,yi,go,It=Se(()=>{"use strict";bo=Wt(require("react")),wn=[],ua=[{value:"English",native:"English",tag:"en",rtl:!1},{value:"Chinese",native:"\u4E2D\u6587",tag:"zh",rtl:!1},{value:"Spanish",native:"Espa\xF1ol",tag:"es",rtl:!1},{value:"Arabic",native:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",tag:"ar",rtl:!0},{value:"Hindi",native:"\u0939\u093F\u0928\u094D\u0926\u0940",tag:"hi",rtl:!1},{value:"French",native:"Fran\xE7ais",tag:"fr",rtl:!1},{value:"Swahili",native:"Kiswahili",tag:"sw",rtl:!1},{value:"Portuguese",native:"Portugu\xEAs",tag:"pt",rtl:!1},{value:"Japanese",native:"\u65E5\u672C\u8A9E",tag:"ja",rtl:!1},{value:"Urdu",native:"\u0627\u0631\u062F\u0648",tag:"ur",rtl:!0}];pa={english:{preparing:"Preparing in English\u2026",changeLang:"Change language",endonym:"English"},swahili:{preparing:"Inatayarisha kwa Kiswahili\u2026",changeLang:"Badilisha lugha",endonym:"Kiswahili"},french:{preparing:"Configuration en fran\xE7ais\u2026",changeLang:"Changer de langue",endonym:"Fran\xE7ais"},spanish:{preparing:"Configurando en espa\xF1ol\u2026",changeLang:"Cambiar idioma",endonym:"Espa\xF1ol"},arabic:{preparing:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0639\u062F\u0627\u062F \u0628\u0627\u0644\u0644\u063A\u0629 \u0627\u0644\u0639\u0631\u0628\u064A\u0629\u2026",changeLang:"\u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u0644\u063A\u0629",rtl:!0,endonym:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629"},portuguese:{preparing:"Configurando em portugu\xEAs\u2026",changeLang:"Alterar idioma",endonym:"Portugu\xEAs"},hindi:{preparing:"\u0939\u093F\u0928\u094D\u0926\u0940 \u092E\u0947\u0902 \u0924\u0948\u092F\u093E\u0930 \u0915\u093F\u092F\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948\u2026",changeLang:"\u092D\u093E\u0937\u093E \u092C\u0926\u0932\u0947\u0902",endonym:"\u0939\u093F\u0928\u094D\u0926\u0940"},chinese:{preparing:"\u6B63\u5728\u51C6\u5907\u4E2D\u6587\u73AF\u5883\u2026",changeLang:"\u66F4\u6539\u8BED\u8A00",endonym:"\u4E2D\u6587"},urdu:{preparing:"\u0627\u0631\u062F\u0648 \u0645\u06CC\u06BA \u062A\u06CC\u0627\u0631\u06CC \u062C\u0627\u0631\u06CC \u06C1\u06D2\u2026",changeLang:"\u0632\u0628\u0627\u0646 \u062A\u0628\u062F\u06CC\u0644 \u06A9\u0631\u06CC\u06BA",rtl:!0,endonym:"\u0627\u0631\u062F\u0648"},japanese:{preparing:"\u65E5\u672C\u8A9E\u3092\u8A2D\u5B9A\u4E2D\u2026",changeLang:"\u8A00\u8A9E\u3092\u5909\u66F4",endonym:"\u65E5\u672C\u8A9E"},german:{preparing:"Wird auf Deutsch eingerichtet\u2026",changeLang:"Sprache \xE4ndern",endonym:"Deutsch"},italian:{preparing:"Configurazione in italiano\u2026",changeLang:"Cambia lingua",endonym:"Italiano"},russian:{preparing:"\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430 \u043D\u0430 \u0440\u0443\u0441\u0441\u043A\u043E\u043C\u2026",changeLang:"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u044F\u0437\u044B\u043A",endonym:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},korean:{preparing:"\uD55C\uAD6D\uC5B4\uB85C \uC124\uC815 \uC911\u2026",changeLang:"\uC5B8\uC5B4 \uBCC0\uACBD",endonym:"\uD55C\uAD6D\uC5B4"},turkish:{preparing:"T\xFCrk\xE7e olarak haz\u0131rlan\u0131yor\u2026",changeLang:"Dili de\u011Fi\u015Ftir",endonym:"T\xFCrk\xE7e"},vietnamese:{preparing:"\u0110ang thi\u1EBFt l\u1EADp b\u1EB1ng Ti\u1EBFng Vi\u1EC7t\u2026",changeLang:"\u0110\u1ED5i ng\xF4n ng\u1EEF",endonym:"Ti\u1EBFng Vi\u1EC7t"},indonesian:{preparing:"Menyiapkan dalam Bahasa Indonesia\u2026",changeLang:"Ubah bahasa",endonym:"Bahasa Indonesia"},malay:{preparing:"Menyediakan dalam Bahasa Melayu\u2026",changeLang:"Tukar bahasa",endonym:"Bahasa Melayu"},bahasa:{preparing:"Menyediakan dalam Bahasa Melayu\u2026",changeLang:"Tukar bahasa",endonym:"Bahasa Melayu"},polish:{preparing:"Przygotowywanie w j\u0119zyku polskim\u2026",changeLang:"Zmie\u0144 j\u0119zyk",endonym:"Polski"},dutch:{preparing:"Instellen in het Nederlands\u2026",changeLang:"Taal wijzigen",endonym:"Nederlands"},thai:{preparing:"\u0E01\u0E33\u0E25\u0E31\u0E07\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E47\u0E19\u0E20\u0E32\u0E29\u0E32\u0E44\u0E17\u0E22\u2026",changeLang:"\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E20\u0E32\u0E29\u0E32",endonym:"\u0E44\u0E17\u0E22"},bengali:{preparing:"\u09AC\u09BE\u0982\u09B2\u09BE\u09AF\u09BC \u09AA\u09CD\u09B0\u09B8\u09CD\u09A4\u09C1\u09A4 \u0995\u09B0\u09BE \u09B9\u099A\u09CD\u099B\u09C7\u2026",changeLang:"\u09AD\u09BE\u09B7\u09BE \u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8 \u0995\u09B0\u09C1\u09A8",endonym:"\u09AC\u09BE\u0982\u09B2\u09BE"},tamil:{preparing:"\u0BA4\u0BAE\u0BBF\u0BB4\u0BBF\u0BB2\u0BCD \u0BA4\u0BAF\u0BBE\u0BB0\u0BCD \u0B9A\u0BC6\u0BAF\u0BCD\u0BAF\u0BAA\u0BCD\u0BAA\u0B9F\u0BC1\u0B95\u0BBF\u0BB1\u0BA4\u0BC1\u2026",changeLang:"\u0BAE\u0BCA\u0BB4\u0BBF\u0BAF\u0BC8 \u0BAE\u0BBE\u0BB1\u0BCD\u0BB1\u0BB5\u0BC1\u0BAE\u0BCD",endonym:"\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD"},telugu:{preparing:"\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41\u0C32\u0C4B \u0C38\u0C3F\u0C26\u0C4D\u0C27\u0C02 \u0C1A\u0C47\u0C38\u0C4D\u0C24\u0C4B\u0C02\u0C26\u0C3F\u2026",changeLang:"\u0C2D\u0C3E\u0C37\u0C28\u0C41 \u0C2E\u0C3E\u0C30\u0C4D\u0C1A\u0C02\u0C21\u0C3F",endonym:"\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41"},persian:{preparing:"\u062F\u0631 \u062D\u0627\u0644 \u0622\u0645\u0627\u062F\u0647\u200C\u0633\u0627\u0632\u06CC \u0628\u0647 \u0632\u0628\u0627\u0646 \u0641\u0627\u0631\u0633\u06CC\u2026",changeLang:"\u062A\u063A\u06CC\u06CC\u0631 \u0632\u0628\u0627\u0646",rtl:!0,endonym:"\u0641\u0627\u0631\u0633\u06CC"},farsi:{preparing:"\u062F\u0631 \u062D\u0627\u0644 \u0622\u0645\u0627\u062F\u0647\u200C\u0633\u0627\u0632\u06CC \u0628\u0647 \u0632\u0628\u0627\u0646 \u0641\u0627\u0631\u0633\u06CC\u2026",changeLang:"\u062A\u063A\u06CC\u06CC\u0631 \u0632\u0628\u0627\u0646",rtl:!0,endonym:"\u0641\u0627\u0631\u0633\u06CC"},greek:{preparing:"\u03A1\u03CD\u03B8\u03BC\u03B9\u03C3\u03B7 \u03C3\u03C4\u03B1 \u03B5\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC\u2026",changeLang:"\u0391\u03BB\u03BB\u03B1\u03B3\u03AE \u03B3\u03BB\u03CE\u03C3\u03C3\u03B1\u03C2",endonym:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"},hebrew:{preparing:"\u05DE\u05D2\u05D3\u05D9\u05E8 \u05D1\u05E2\u05D1\u05E8\u05D9\u05EA\u2026",changeLang:"\u05E9\u05E0\u05D4 \u05E9\u05E4\u05D4",rtl:!0,endonym:"\u05E2\u05D1\u05E8\u05D9\u05EA"},burmese:{preparing:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C\u1016\u103C\u1004\u1037\u103A \u1015\u103C\u1004\u103A\u1006\u1004\u103A\u1014\u1031\u101E\u100A\u103A\u2026",changeLang:"\u1018\u102C\u101E\u102C\u1005\u1000\u102C\u1038\u1015\u103C\u1031\u102C\u1004\u103A\u1038\u101B\u1014\u103A",endonym:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C"},burma:{preparing:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C\u1016\u103C\u1004\u1037\u103A \u1015\u103C\u1004\u103A\u1006\u1004\u103A\u1014\u1031\u101E\u100A\u103A\u2026",changeLang:"\u1018\u102C\u101E\u102C\u1005\u1000\u102C\u1038\u1015\u103C\u1031\u102C\u1004\u103A\u1038\u101B\u1014\u103A",endonym:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C"},myanmar:{preparing:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C\u1016\u103C\u1004\u1037\u103A \u1015\u103C\u1004\u103A\u1006\u1004\u103A\u1014\u1031\u101E\u100A\u103A\u2026",changeLang:"\u1018\u102C\u101E\u102C\u1005\u1000\u102C\u1038\u1015\u103C\u1031\u102C\u1004\u103A\u1038\u101B\u1014\u103A",endonym:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C"},khmer:{preparing:"\u1780\u17C6\u1796\u17BB\u1784\u179A\u17C0\u1794\u1785\u17C6\u1787\u17B6\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A\u2026",changeLang:"\u1794\u17D2\u178F\u17BC\u179A\u1797\u17B6\u179F\u17B6",endonym:"\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A"},cambodian:{preparing:"\u1780\u17C6\u1796\u17BB\u1784\u179A\u17C0\u1794\u1785\u17C6\u1787\u17B6\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A\u2026",changeLang:"\u1794\u17D2\u178F\u17BC\u179A\u1797\u17B6\u179F\u17B6",endonym:"\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A"},swedish:{preparing:"St\xE4ller in p\xE5 svenska\u2026",changeLang:"Byt spr\xE5k",endonym:"Svenska"},svenska:{preparing:"St\xE4ller in p\xE5 svenska\u2026",changeLang:"Byt spr\xE5k",endonym:"Svenska"},sv:{preparing:"St\xE4ller in p\xE5 svenska\u2026",changeLang:"Byt spr\xE5k",endonym:"Svenska"},kikuyu:{preparing:"G\u0129k\u0169y\u0169 g\u0129g\u0129thondekwo\u2026",changeLang:"Cenjia r\u0169thiomi",endonym:"G\u0129k\u0169y\u0169"},gikuyu:{preparing:"G\u0129k\u0169y\u0169 g\u0129g\u0129thondekwo\u2026",changeLang:"Cenjia r\u0169thiomi",endonym:"G\u0129k\u0169y\u0169"},akan:{preparing:"Y\u025Bresiesie w\u0254 Akan mu\u2026",changeLang:"Sesa kasa",endonym:"Akan"},twi:{preparing:"Y\u025Bresiesie w\u0254 Twi mu\u2026",changeLang:"Sesa kasa",endonym:"Twi"},yoruba:{preparing:"Ngbaradi ni \xC8d\xE8 Yor\xF9b\xE1\u2026",changeLang:"Yi ede pada",endonym:"\xC8d\xE8 Yor\xF9b\xE1"},amharic:{preparing:"\u1260\u12A0\u121B\u122D\u129B \u1260\u1218\u12D8\u130B\u1300\u1275 \u120B\u12ED\u2026",changeLang:"\u124B\u1295\u124B \u1240\u12ED\u122D",endonym:"\u12A0\u121B\u122D\u129B"},somali:{preparing:"Diyaarinta af Soomaali\u2026",changeLang:"Beddel luqadda",endonym:"Af-Soomaali"},soomaali:{preparing:"Diyaarinta af Soomaali\u2026",changeLang:"Beddel luqadda",endonym:"Af-Soomaali"},"af-soomaali":{preparing:"Diyaarinta af Soomaali\u2026",changeLang:"Beddel luqadda",endonym:"Af-Soomaali"},so:{preparing:"Diyaarinta af Soomaali\u2026",changeLang:"Beddel luqadda",endonym:"Af-Soomaali"},hausa:{preparing:"Shirya cikin Hausa\u2026",changeLang:"Canja harshe",endonym:"Hausa"},zulu:{preparing:"Ilungiselela ngesiZulu\u2026",changeLang:"Shintsha ulimi",endonym:"isiZulu"},oromo:{preparing:"Afaan Oromootiin qophaa'aa jira\u2026",changeLang:"Afaan jijjiiri",endonym:"Afaan Oromoo"},luganda:{preparing:"Tuteekateeka mu Oluganda\u2026",changeLang:"Kyusa olulimi",endonym:"Oluganda"},igbo:{preparing:"Na-akwadebe na As\u1EE5s\u1EE5 Igbo\u2026",changeLang:"Gbanwee as\u1EE5s\u1EE5",endonym:"As\u1EE5s\u1EE5 Igbo"},xhosa:{preparing:"Ilungiselela ngesiXhosa\u2026",changeLang:"Tshintsha ulwimi",endonym:"isiXhosa"},kinyarwanda:{preparing:"Guteza imbere mu Kinyarwanda\u2026",changeLang:"Hindura ururimi",endonym:"Ikinyarwanda"},lingala:{preparing:"Kozala na Ling\xE1la\u2026",changeLang:"Bongola lok\xF3t\xE1",endonym:"Ling\xE1la"},shona:{preparing:"Kugadzirira mu chiShona\u2026",changeLang:"Chinja mutauro",endonym:"chiShona"},tigrinya:{preparing:"\u1265\u1275\u130D\u122D\u129B \u12A3\u1265 \u121D\u12F5\u120B\u12CD \u12ED\u122D\u12A8\u1265\u2026",changeLang:"\u124B\u1295\u124B \u121D\u1255\u12EB\u122D",endonym:"\u1275\u130D\u122D\u129B"},wolof:{preparing:"Waajal ci Wolof\u2026",changeLang:"Soppi l\xE0kk",endonym:"Wolof"},afrikaans:{preparing:"Berei voor in Afrikaans\u2026",changeLang:"Verander taal",endonym:"Afrikaans"}};Cn=[{name:"Puck",trait:"Upbeat",gender:"male"},{name:"Charon",trait:"Informative",gender:"male"},{name:"Kore",trait:"Firm",gender:"female"},{name:"Aoede",trait:"Breezy",gender:"female"},{name:"Zephyr",trait:"Bright",gender:"female"},{name:"Fenrir",trait:"Excitable",gender:"male"},{name:"Leda",trait:"Youthful",gender:"female"},{name:"Orus",trait:"Firm",gender:"male"},{name:"Callirrhoe",trait:"Easy-going",gender:"female"},{name:"Autonoe",trait:"Bright",gender:"female"},{name:"Enceladus",trait:"Breathy",gender:"male"},{name:"Iapetus",trait:"Clear",gender:"male"},{name:"Umbriel",trait:"Easy-going",gender:"male"},{name:"Algieba",trait:"Smooth",gender:"male"},{name:"Despina",trait:"Smooth",gender:"female"},{name:"Erinome",trait:"Clear",gender:"female"},{name:"Algenib",trait:"Gravelly",gender:"male"},{name:"Rasalgethi",trait:"Informative",gender:"male"},{name:"Laomedeia",trait:"Upbeat",gender:"female"},{name:"Achernar",trait:"Soft",gender:"female"},{name:"Alnilam",trait:"Firm",gender:"male"},{name:"Schedar",trait:"Even",gender:"male"},{name:"Gacrux",trait:"Mature",gender:"female"},{name:"Pulcherrima",trait:"Forward",gender:"female"},{name:"Achird",trait:"Friendly",gender:"male"},{name:"Zubenelgenubi",trait:"Casual",gender:"male"},{name:"Vindemiatrix",trait:"Gentle",gender:"female"},{name:"Sadachbia",trait:"Lively",gender:"male"},{name:"Sadaltager",trait:"Knowledgeable",gender:"male"},{name:"Sulafat",trait:"Warm",gender:"female"}],fo="hsk-live-voice",yr={langPlaceholder:"Type your language\u2026",nameStepTitle:"Good to meet you.",nameStepAsk:"What should I call you?",namePlaceholder:"Type your name\u2026",howShouldResultsLook:"How do you want to see results?",entityLangIntro:"I will write to you in {lang}. Names stay as this website wrote them. For the other details, choose below.",asWritten:"Same as the website",inLanguage:"In {lang}",namesAsWritten:"Details stay exactly as the website wrote them.",detailsTranslated:"Details are translated. Numbers and links do not change.",entityLangPlaceholder:"Choose one, then press Continue\u2026",termsStepTitle:"Privacy and terms",termsStepSubtitle:"Please read how kiku works on this website.",termsPiiTitle:"Your contact details",termsPiiDesc:"kiku never asks for your email, phone number or real name. Any name or nickname is fine.",termsSessionTitle:"A random code",termsSessionDesc:"Your browser keeps a random code so kiku can remember your conversation. The code is not linked to your name.",termsMemoryTitle:"What is kept",termsMemoryDesc:"Your questions (not kiku's answers) are kept so this website can improve. Things you save with @kiku are kept at mimi.akropolys.cloud, and only your secret key opens them.",termsCookieTitle:"This website's own rules",termsCookieDesc:"This website may use cookies or collect more information. kiku does not control this.",termsAiTitle:"From this website, explained by AI",termsAiDesc:"kiku answers from what this website really lists. The facts are the website's own; how kiku summarises, compares or translates them is AI and may read them differently. Check anything that matters on the website itself.",termsAgreeButton:"I agree",termsAgreeCounting:"I agree ({seconds}s)",nameStepHint:"Any name or nickname is fine.",privacyMore:"Read our full terms at",continueButton:"Continue",termsPlaceholder:"Please read the notes above\u2026",allSet:"You are ready, {name}.",replyingOriginal:"I will write to you in {lang}. Results stay as this website wrote them. Ask me anything.",replyingTranslated:"I will write to you in {lang}. Results will be translated too. Ask me anything.",greetReturning:"Hello, {name}.",greetReturningLead:"What can I find for you today?",defaultPlaceholder:"Ask me anything\u2026"},wt={back:"Back",langPlaceholder:"Type your language\u2026",nameStepTitle:"Good to meet you.",nameStepAsk:"What should I call you?",namePlaceholder:"Type your name\u2026",attachImage:"Attach a photo",vizUnavailable:"The preview could not be loaded.",vizDisclaimerImage:"Generated using Artificial Intelligence \u2014 colours, size and placement may differ from the real product.",vizDisclaimerVideo:"Generated using Artificial Intelligence \u2014 colours, size and movement may differ from the real product.",calcDisclaimer:"This is a calculation from live figures, not a guarantee \u2014 the market can move against it.",staleTitle:"No longer available",staleRemoved:"{title} has been removed and is no longer on offer.",staleUnavailable:"{title} is currently unavailable.",keyPastePrompt:"Paste your public id \u2014 or create one",keyPastePlaceholder:"your public id\u2026",keyUseMine:"Use my id",keyCreating:"Creating\u2026",keyCreateNew:"I'm new \u2014 create one",keySecretTitle:"Your secret key \u2014 shown once",keyDismiss:"Dismiss",keyCopySecret:"Copy",keyCopied:"Copied",keySecretHint:"Keep it private. It unlocks your memory.",keyPublicTitle:"Your public id",keyCopyId:"Copy id",greetReturning:"Hello, {name}.",greetReturningLead:"What can I find for you today?",howShouldResultsLook:"How do you want to see results?",entityLangIntro:"I will write to you in {lang}. Names stay as this website wrote them. For the other details, choose below.",asWritten:"Same as the website",inLanguage:"In {lang}",namesAsWritten:"Details stay exactly as the website wrote them.",detailsTranslated:"Details are translated. Numbers and links do not change.",entityLangPlaceholder:"Choose one, then press Continue\u2026",termsStepTitle:"Privacy and terms",termsStepSubtitle:"Please read how kiku works on this website.",termsPiiTitle:"Your contact details",termsPiiDesc:"kiku never asks for your email, phone number or real name. Any name or nickname is fine.",termsSessionTitle:"A random code",termsSessionDesc:"Your browser keeps a random code so kiku can remember your conversation. The code is not linked to your name.",termsMemoryTitle:"What is kept",termsMemoryDesc:"Your questions (not kiku's answers) are kept so this website can improve. Things you save with @kiku are kept at mimi.akropolys.cloud, and only your secret key opens them.",termsCookieTitle:"This website's own rules",termsCookieDesc:"This website may use cookies or collect more information. kiku does not control this.",termsAiTitle:"From this website, explained by AI",termsAiDesc:"kiku answers from what this website really lists. The facts are the website's own; how kiku summarises, compares or translates them is AI and may read them differently. Check anything that matters on the website itself.",termsAgreeButton:"I agree",termsAgreeCounting:"I agree ({seconds}s)",nameStepHint:"Any name or nickname is fine.",privacyMore:"Read our full terms at",continueButton:"Continue",termsPlaceholder:"Please read the notes above\u2026",allSet:"You are ready, {name}.",replyingTranslated:"I will write to you in {lang}. Results will be translated too. Ask me anything.",replyingOriginal:"I will write to you in {lang}. Results stay as this website wrote them. Ask me anything.",defaultPlaceholder:"Ask me anything\u2026",voiceListening:"Listening\u2026 tap the mic to stop",voiceSending:"Got it \u2014 sending\u2026",voiceModeStart:"Hands-free conversation",voiceModeExit:"Leave hands-free",voicePhaseListening:"Listening",voicePhaseThinking:"Thinking",micDenied:"Microphone blocked. Allow mic access for this site, then try again.",micInsecure:"Voice needs a secure (https) connection.",micMissing:"No microphone found.",micLangUnsupported:"This browser cannot transcribe that language yet. Type instead.",micNetwork:"Couldn't reach voice. Try again in a moment.",voiceUnavailable:"Voice is unavailable right now. Try again in a moment.",voiceLimitReached:"You've used up today's voice time. It resets in a day \u2014 chat still works.",voiceSiteLimit:"Voice is out of allowance on this site for now. Chat still works.",voiceIdleEnded:"Voice closed after a quiet minute. Tap the mic to talk again.",voiceSessionEnded:"Voice session ended. Tap the mic to talk again.",voicePhotoFailed:"That photo couldn't be added. Try another one.",voiceAttachPhoto:"Attach a photo",voicePickerLabel:"Choose a voice",voiceFemale:"Female",voiceMale:"Male",voiceNewChat:"New voice chat",pillVoice:"{n} min voice",pillImages:"{n} images",pillVideos:"{n} videos",pillReplies:"{n} replies",micNoSpeech:"Didn't catch anything. Try again, a little closer to the mic.",micFailed:"Couldn't hear that. Try again.",clearChat:"Clear chat",thinking:"Thinking",thoughtForSeconds:"Thought for {duration}",thoughtProcess:"Thought process",reachingTeam:"Getting a person",passedToTeam:"Passed to a person",withTeam:"Sent to the team \xB7 a person will reply here",repliedIn:"Replied in {duration}",backWithKiku:"Kiku is back with you",teamClosed:"The team closed this conversation",teamJoined:"Another team member joined the conversation",leaveHumanWarning:"A person is replying here.",leaveHumanStay:"Stay",leaveHumanKeep:"Keep for later",leaveHumanConfirm:"End request",requestsTitle:"Your requests",requestWaiting:"Waiting for a person",requestHuman:"With a person",requestKiku:"Answered",requestClosed:"Closed",requestNewReply:"New reply",captureAndRemember:"kiku \u2014 capture & remember",captureCurrentPage:"Capture current page",captureAll:"Capture all ({count})",whatHaveYouSaved:"What have you saved?",deleteThis:"Delete this",errShopperReplyLimit:"You've reached this site's reply limit for your account.",errAccessRevoked:"Your access to the assistant has been revoked on this website.",errAccountRequired:"Please create an account to continue using the chat assistant.",errStreamInterrupted:"The reply was interrupted. Please try again.",errNetwork:"The assistant couldn't respond just now \u2014 please try again in a moment.",errGeneric:"Something went wrong. Please try again.",vizWorking:"Visualizing\u2026",vizMarkEdit:"Mark & edit",swatchTarget:"Your colour",markupCancel:"Cancel",markupSketch:"Sketch",markupPin:"Edit Pin",markupPinLabel:"What should happen here?",markupPinLabelHint:"e.g. move the sofa here",markupSketchHint:"Sketch around an area, then drop a pin saying what to do with it.",markupRemovePin:"Remove pin",markupPinHint:"Drop a pin and say what should happen there. Drag to move it. Up to 4 pins.",markupSelect:"Select outline",markupCloseOutline:"Close outline",markupOutlineHint:"Tap around the item, then close the outline. Undo removes the last point.",markupSelectedHint:"Drag the outline points to refine, then drop a pin saying what to do with it.",markupEraser:"Eraser",markupUndo:"Undo",markupClear:"Clear",markupSend:"Send",markupDialogLabel:"Mark up image",markupError:"Couldn't process this image \u2014 try a newer visualization.",markupLoadError:"This image can't be edited here.",markupLoading:"Loading image\u2026",openMemory:"Open my memory on MiMi",errTooManyRequests:"The assistant is currently receiving too many requests. Please try again in a few moments.",errTokenLimit:"You've reached your usage limit. Please update your billing limits in your dashboard to continue.",statusSent:"Sent",statusStopped:"Sent \xB7 reply stopped",queuedWaiting:"Queued",queuedSendNow:"Send now",jumpToLatest:"Scroll to latest",timelineLabel:"Questions in this conversation",voiceConnecting:"Connecting \u2014 wait for the tone before speaking",stoppedByYou:"You stopped this response.",stoppedInterrupted:"This response was interrupted.",continueGenerating:"Continue generating",generateResponse:"Generate response",pillCompareTop2:"Compare top 2",pillCompareTop2Query:"Compare the {a} and {b}",pillMoreOn:"More on {name}",pillMoreOnQuery:"Tell me more about the {name}",pillSimilarOptions:"Similar options",pillSimilarOptionsQuery:"Show me more like the {name}",pillWhichBest:"Which is best?",pillWhichBestQuery:"Which one would you recommend and why?",pillFindAlternatives:"Find alternatives",pillFindAlternativesQuery:"What are good alternatives to the {name}?",pillShowPopular:"Show popular items",pillShowPopularQuery:"What are your most popular items?",pillRecommend:"Recommend something",pillRecommendQuery:"What do you recommend for me?",cardClickAnswer:"The {name}",cardClickQuery:"Tell me more about the {name}{details} \u2014 what are its key details, who is it best suited for, and what should I know?",displayCapture:"capture {name}",displayCaptureAll:"capture all ({count} items)",displayViewHistory:"what have you saved?",displayDelete:"delete this",retry:"Retry",edit:"Edit",copy:"Copy",copied:"Copied",msgFailed:"Failed to send"},ko=bo.default.createContext((e,r)=>{let t=wt[e];if(r)for(let[n,a]of Object.entries(r))t=t.split(`{${n}}`).join(a);return t}),wr=()=>bo.default.useContext(ko);gi={shopper_reply_limit:"errShopperReplyLimit",RATE_LIMIT_EXCEEDED:"errShopperReplyLimit",access_revoked:"errAccessRevoked",account_required:"errAccountRequired",stream_interrupted:"errStreamInterrupted"},vi=(e,r)=>{let t=e&&typeof e=="object"?e.code:void 0;if(t&&gi[t])return r(gi[t]);let n="";if(typeof e=="string")n=e;else if(e&&typeof e=="object"&&e.message)n=e.message;else try{n=JSON.stringify(e)}catch{n=String(e)}let a=n.toLowerCase();if(a.includes("429")||a.includes("too many requests")||a.includes("requests per minute limit exceeded")||a.includes("too_many_requests_error")||a.includes("request_quota_exceeded")||a.includes("quota"))return r("errTooManyRequests");if(a.includes("token limit"))return r("errTokenLimit");if(a.includes("failed to fetch")||a.includes("networkerror")||a.includes("request failed"))return r("errNetwork");if(n)try{console.warn("[kiku] untranslated error:",n)}catch{}return r("errGeneric")},yi=()=>typeof window>"u"||window.isSecureContext!==!1,go=15});function Si(e){return e?Ci.get(e)??null:null}function xo(e){if(!e)return Promise.resolve(null);let r=wi.get(e);if(r)return r;let t=Promise.resolve().then(()=>e.baseFont?.()??null).then(n=>(n&&(Ci.set(e,n),Dt(n,0).catch(()=>{})),n)).catch(()=>null);return wi.set(e,t),t}function Mi(e,r,t){e&&(xo(e),r&&jr(e,r,t))}function jr(e,r,t){if(!(!e||!r))try{e.getUIStrings?.(r,t)?.then?.(n=>{n?.font&&Dt(n.font,1200).catch(()=>{})})?.catch?.(()=>{})}catch{}}var wi,Ci,ma=Se(()=>{"use strict";un();wi=new WeakMap,Ci=new WeakMap});function Kr(e){let r=e?dd[e.trim().toLowerCase()]:void 0;return r?{dir:r==="ar"||r==="ur"||r==="fa"?"rtl":"ltr",bcp47:r}:null}function pd(e){let r=/var\(\s*(--[\w-]+)/.exec(e)?.[1];if(!r||typeof document>"u")return"";for(let t of[document.documentElement,document.body]){let n=t?getComputedStyle(t).getPropertyValue(r).trim():"";if(n)return n.split(",")[0].trim()}return""}function Ei({shopperLanguage:e,theme:r,preloadedStrings:t}){let n=(0,Ri.useAkropolysContext)(),a=e?n?.getCachedUIStrings?.(e,wt)??n?.getCachedUIStrings?.(e,yr):null,o=t&&Object.keys(t).length>0?t:a?.strings??{},[i,c]=(0,Je.useState)(()=>o),[s,l]=(0,Je.useState)(()=>!e||t&&Object.keys(t).length>0||!!a?.complete),[h,d]=(0,Je.useState)(()=>t&&Object.keys(t).length>0||a?.complete?e:!e||Kr(e)?.bcp47==="en"?e||"en":""),u=!e||Kr(e)?.bcp47==="en",p=i;t&&Object.keys(t).length>0&&(p={...i,...t});let g=e?`akropolys_ui_dir_${e.toLowerCase()}`:"",[f,k]=(0,Je.useState)(()=>{if(a?.dir)return a.dir==="rtl";let C=Kr(e);if(C)return C.dir==="rtl";if(Ir(e)?.rtl)return!0;if(typeof window>"u"||!g)return!1;try{return localStorage.getItem(g)==="rtl"}catch{return!1}}),[z,b]=(0,Je.useState)(()=>a?.bcp47||Kr(e)?.bcp47||""),[N,M]=(0,Je.useState)(()=>a?.font??null),[E,F]=(0,Je.useState)(()=>Si(n)),[w,H]=(0,Je.useState)(!0),[Q,T]=(0,Je.useState)(!1),A=Je.default.useRef(e),[G,B]=(0,Je.useState)(e);if(e!==G){B(e);let C=Kr(e);C&&(k(C.dir==="rtl"),b(C.bcp47));let L=e?n?.getCachedUIStrings?.(e,wt)??n?.getCachedUIStrings?.(e,yr):null,I=t&&Object.keys(t).length>0?t:L?.strings;I&&Object.keys(I).length>0&&(c(I),p=I,L&&(L.font&&M(L.font),L.dir&&k(L.dir==="rtl"),L.bcp47&&b(L.bcp47)),L?.font&&Dt(L.font),T(!Ja([L?.font?.family,E?.family].filter(K=>!!K),I)),d(e),l(!0))}let X=u||!Q&&(h.toLowerCase()===e.toLowerCase()&&s||Object.keys(p).length>0);(0,Je.useEffect)(()=>{if(!e){b(""),M(null),c({}),d(""),l(!0),k(!1);return}let C=Kr(e),L=Ir(e),I=C?.bcp47==="en",K=!1,x=(Z,D)=>{let O=[Z?.family,E?.family].filter(S=>!!S);if(e===A.current||Ja(O,D)){T(!1);return}T(!0),Za(O,D,Ti).then(()=>{K||T(!1)})},R=n?.getCachedUIStrings?.(e,wt);if(R?.strings&&Object.keys(R.strings).length>0)return c(R.strings),k(R.dir==="rtl"),b(R.bcp47||C?.bcp47||""),R.font&&(Dt(R.font),M(R.font)),x(R.font,R.strings),d(e),l(!0),()=>{K=!0};let m=n?.getCachedUIStrings?.(e,yr);return m?.strings&&Object.keys(m.strings).length>0?(c(m.strings),k(m.dir==="rtl"),b(m.bcp47||C?.bcp47||""),m.font&&(Dt(m.font),M(m.font)),x(m.font,m.strings),d(e),l(!0)):(T(!1),c({}),C?(k(C.dir==="rtl"),b(C.bcp47)):L?.rtl&&k(!0),I||l(!1)),(async()=>{try{if(!m?.strings){let D=await n.getUIStrings?.(e,yr);if(!K&&D?.complete){T(!0),c(S=>({...S,...D.strings})),k(D.dir==="rtl"),b(D.bcp47||C?.bcp47||"");try{localStorage.setItem(g,D.dir)}catch{}D.font&&Dt(D.font);let O=[D.font?.family,E?.family].filter(S=>!!S);await Za(O,D.strings,Ti),K||(D.font&&M(D.font),d(e),l(!0),T(!1))}}let Z=await n.getUIStrings?.(e,wt);!K&&Z?.complete&&(c(D=>({...D,...Z.strings})),Z.font&&(await Dt(Z.font,1200),K||M(Z.font)))}catch{K||(d(e),l(!0),T(!1))}})(),()=>{K=!0}},[e,n,g]),(0,Je.useEffect)(()=>{let C=!1;return(async()=>{try{let L=await xo(n);!C&&L&&F(L)}catch{}C||H(!0)})(),()=>{C=!0}},[n]),Qa(N),Qa(E);let xe=Je.default.useMemo(()=>{let L=(typeof r=="object"&&r?.fontFamily?r.fontFamily:"").split(",")[0].trim(),I=/^var\(/i.test(L),K=L.replace(/^['"]|['"]$/g,""),x=I?pd(L):"",R=I?x?`${x}, `:"":K?`"${K}", `:"";if(N)return`"${N.family}", ${R}"Geist", system-ui, sans-serif`;let m=e?e.trim().toLowerCase():"";if(m==="japanese"||m==="ja"||m==="\u65E5\u672C\u8A9E")return`${R}"Geist", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif`;if(m==="chinese"||m==="zh"||m==="\u4E2D\u6587")return`${R}"Geist", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif`;if(m==="urdu"||m==="ur"||m==="\u0627\u0631\u062F\u0648")return`"Noto Nastaliq Urdu", ${R}"IBM Plex Sans Arabic", "Geist", system-ui, sans-serif`;if(m==="arabic"||m==="ar"||m==="\u0627\u0644\u0639\u0631\u0628\u064A\u0629")return`"IBM Plex Sans Arabic", ${R}"Geist", system-ui, sans-serif`;if(m==="hindi"||m==="hi"||m==="\u0939\u093F\u0928\u094D\u0926\u0940")return`"Hind", ${R}"Geist", system-ui, sans-serif`},[N,e,typeof r=="object"&&r?r.fontFamily:void 0]),se=Je.default.useMemo(()=>{let C=0,L=0;for(let I of Object.values(i))for(let K of I){let x=K.codePointAt(0)??0;x<192||/\p{L}/u.test(K)&&(x<=591?C++:L++)}return L>C},[i]),[V,re]=(0,Je.useState)(0);(0,Je.useEffect)(()=>{if(typeof document>"u"||!document.fonts?.ready)return;let C=!0;return document.fonts.ready.then(()=>{C&&re(L=>L+1)}),()=>{C=!1}},[N]);let W=Je.default.useMemo(()=>{if(!se||typeof document>"u")return!0;let L=(typeof r=="object"&&r?.fontFamily?r.fontFamily:"").split(",")[0].trim();if(!L)return!1;let I="";for(let x of Object.values(i))if(x){I=x;break}if(!I)return!0;let K=I.replace(/\s+/g,"");if(!K)return!0;try{let R=document.createElement("canvas").getContext("2d");if(!R)return!0;let m=L.startsWith("var(")&&getComputedStyle(document.documentElement).getPropertyValue(L.slice(4,-1).trim()).trim()||L;R.font=`16px ${m}, __akropolys_nonexistent_font__`;let Z=R.measureText(K).width;R.font="16px __akropolys_nonexistent_font__";let D=R.measureText(K).width;return Math.abs(Z-D)>1}catch{return!0}},[se,i,typeof r=="object"&&r?r.fontFamily:void 0,V]),_=(0,Je.useCallback)((C,L)=>{let I=p[C]||i[C]||wt[C]||C;if(L)for(let[K,x]of Object.entries(L))I=I.split(`{${K}}`).join(x);return I},[p,i]),J=(0,Je.useCallback)((C,L)=>(p[C]||i[C]||wt[C]||C).split(/(\{[a-zA-Z]+\})/g).map((K,x)=>{let R=K.match(/^\{([a-zA-Z]+)\}$/);return R&&L?.[R[1]]!==void 0?(0,vo.jsx)("bdi",{children:L[R[1]]},x):(0,vo.jsx)(Je.default.Fragment,{children:K},x)}),[p,i]);return{chromeStrings:i,chromeReady:X,isRTL:f,speechLang:z,scriptFont:N,fontStack:xe,isNonLatin:se,hostFontCovers:W,baseFontReady:w,t:_,tNode:J}}var Je,Ri,vo,dd,Ti,zi=Se(()=>{"use strict";Je=Wt(require("react")),Ri=require("@akropolys/sdk");un();ma();It();vo=require("react/jsx-runtime"),dd={english:"en",en:"en",swahili:"sw",kiswahili:"sw",sw:"sw",french:"fr",fran\u00E7ais:"fr",francais:"fr",fr:"fr",spanish:"es",espa\u00F1ol:"es",espanol:"es",es:"es",arabic:"ar",\u0627\u0644\u0639\u0631\u0628\u064A\u0629:"ar",ar:"ar",portuguese:"pt",portugu\u00EAs:"pt",pt:"pt",hindi:"hi",\u0939\u093F\u0928\u094D\u0926\u0940:"hi",hi:"hi",chinese:"zh",\u4E2D\u6587:"zh",zh:"zh",japanese:"ja",\u65E5\u672C\u8A9E:"ja",ja:"ja",urdu:"ur",\u0627\u0631\u062F\u0648:"ur",ur:"ur",burmese:"my",burma:"my",myanmar:"my","\u1019\u103C\u1014\u103A\u1019\u102C":"my","\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C":"my",my:"my",khmer:"km",cambodian:"km",\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A:"km",\u1781\u17D2\u1798\u17C2\u179A:"km",km:"km",persian:"fa",farsi:"fa",\u0641\u0627\u0631\u0633\u06CC:"fa",fa:"fa",fas:"fa",malay:"ms",bahasa:"ms",indonesian:"id","bahasa melayu":"ms","bahasa indonesia":"id",ms:"ms",id:"id",amharic:"am",\u12A0\u121B\u122D\u129B:"am",am:"am"};Ti=5e3});function Li({messages:e,loading:r,streaming:t,messageRefs:n}){let a=(0,Ee.useRef)(null),o=(0,Ee.useRef)(0),[i,c]=(0,Ee.useState)(!1),[s,l]=(0,Ee.useState)(1),[h,d]=(0,Ee.useState)(0),u=(0,Ee.useRef)(()=>{}),p=(0,Ee.useRef)(null),g=(0,Ee.useRef)(!1),f=(0,Ee.useRef)(!0),k=(0,Ee.useRef)(!1),z=(0,Ee.useRef)(null),b=(0,Ee.useRef)(null),N=(0,Ee.useRef)(e.length),M=(0,Ee.useRef)(!1),E=(0,Ee.useRef)(()=>{}),F=(0,Ee.useRef)(()=>{}),w=(0,Ee.useRef)(null),H=(0,Ee.useRef)(()=>{}),[Q,T]=(0,Ee.useState)(0),A=(0,Ee.useRef)(0),G=(0,Ee.useRef)(""),B=(0,Ee.useRef)(()=>{}),X=(0,Ee.useRef)(()=>{});(0,Ee.useEffect)(()=>{let S=a.current;if(!S)return;let y,P=()=>{clearTimeout(y),y=setTimeout(()=>{g.current=!1},150)},q=()=>{clearTimeout(y),g.current=!0,B.current()},ce=()=>{g.current&&P()};return S.addEventListener("touchstart",q,{passive:!0}),S.addEventListener("touchend",P,{passive:!0}),S.addEventListener("touchcancel",P,{passive:!0}),S.addEventListener("scroll",ce,{passive:!0}),()=>{clearTimeout(y),S.removeEventListener("touchstart",q),S.removeEventListener("touchend",P),S.removeEventListener("touchcancel",P),S.removeEventListener("scroll",ce)}},[]),(0,Ee.useEffect)(()=>{let S=a.current;if(!S)return;let y=160,P=8,q=0,ce=()=>{q=0;let ue=z.current?.offsetHeight??0,j=S.scrollHeight-ue-S.scrollTop-S.clientHeight,te=performance.now()-o.current<400;j<=P&&(!k.current||te)&&(f.current||X.current(),f.current=!0,k.current=!1,J.current()),c(j>y&&!f.current);let we=S.scrollHeight-S.clientHeight;l(we>8?Math.min(1,Math.max(0,S.scrollTop/we)):1);let $e=S.scrollTop+S.clientHeight*.33,ve=0;for(let _e=0;_e<n.current.length;_e++){let Oe=n.current[_e];Oe&&Oe.offsetTop<=$e&&(ve=_e)}d(ve)},ge=()=>{q||(q=requestAnimationFrame(ce))};ce(),S.addEventListener("scroll",ge,{passive:!0});let me=new ResizeObserver(()=>{b.current?E.current("sync"):f.current&&!g.current&&F.current(),ge()});me.observe(S);for(let ue of n.current)ue&&me.observe(ue);return()=>{q&&cancelAnimationFrame(q),S.removeEventListener("scroll",ge),me.disconnect()}},[e.length,n]);let xe=(0,Ee.useCallback)(S=>{let y=`${S}:${A.current}`;G.current!==y&&(G.current=y,T(P=>P+1))},[]),[se,V]=(0,Ee.useState)(!1),re=(0,Ee.useRef)(!1),W=(0,Ee.useCallback)(()=>{re.current||(re.current=!0,V(!0))},[]),_=(0,Ee.useCallback)(()=>{re.current&&(re.current=!1,V(!1))},[]),J=(0,Ee.useRef)(()=>{});J.current=_;let[C,L]=(0,Ee.useState)(!1),I=(0,Ee.useRef)(!1),K=(0,Ee.useRef)(0),x=(0,Ee.useCallback)(()=>{I.current=!1,L(!1)},[]),R=(0,Ee.useCallback)(()=>{G.current="",x(),_()},[x,_]),m=(0,Ee.useCallback)(()=>{I.current&&(performance.now()-K.current<700||x())},[x]);B.current=m,X.current=R,(0,Ee.useEffect)(()=>{if(Q===0)return;I.current=!0,K.current=performance.now(),L(!0);let S=setTimeout(x,4200);return()=>clearTimeout(S)},[Q,x]);let Z=(0,Ee.useCallback)(()=>{M.current=!1,b.current&&(b.current=null,z.current&&(z.current.style.height=""))},[]);H.current=Z,F.current=()=>{let S=a.current;if(!S)return;let y=S.scrollHeight-S.clientHeight;w.current?w.current(y):S.scrollTop=y},E.current=S=>{let y=a.current,P=z.current,q=b.current,ce=te=>{let we=S==="sync"?w.current:p.current;we?we(te):y&&(y.scrollTop=te)},ge=F.current;if(!y||!P||!q||!q.isConnected){Z(),f.current&&ge();return}let me=parseFloat(getComputedStyle(y).paddingTop)||0;P.offsetHeight<y.clientHeight&&(P.style.height=`${y.clientHeight}px`);let ue=Math.max(0,q.offsetTop-me),j=ue+y.clientHeight-(y.scrollHeight-P.offsetHeight);if(j<=0){Z(),f.current=!1,k.current=!0,ce(ue);return}j!==P.offsetHeight&&(P.style.height=`${j}px`),ce(ue)};let D=(0,Ee.useCallback)(S=>{let y=a.current,P=n.current[S];if(!y||!P)return;let q=P.offsetTop-Math.max(0,(y.clientHeight-P.clientHeight)/2),ce=Math.max(0,Math.min(y.scrollHeight-y.clientHeight,q));p.current?p.current(ce):y.scrollTo({top:ce,behavior:"smooth"})},[n]),O=(0,Ee.useCallback)(()=>{let S=a.current;if(!S)return;f.current=!0,k.current=!1,H.current(),X.current();let y=S.scrollHeight-S.clientHeight;p.current?p.current(y):S.scrollTo({top:y,behavior:"smooth"})},[]);return(0,Ee.useLayoutEffect)(()=>{let S=a.current;if(!S)return;let y=e.slice(N.current);if(N.current=e.length,y.some(q=>q.role==="user")&&(f.current=!0,k.current=!1,X.current(),b.current=null,M.current=!0),M.current){M.current=!1;for(let q=n.current.length-1;q>=0;q--){let ce=n.current[q];if(ce?.dataset.hskRole==="user"){b.current=ce;break}}if(b.current){E.current("glide");return}}if(b.current){E.current("glide");return}let P=S.scrollTop;if(!f.current)k.current||(W(),xe(e.length));else if(!g.current){F.current();return}S.scrollTop!==P&&u.current()},[e,r,t,n,xe,W]),(0,Ee.useEffect)(()=>{let S=a.current;if(!S||typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let y=7,P=16,q=1/(window.devicePixelRatio||1),ce=ye=>Math.round(ye/q)*q,ge=S.scrollTop,me=S.scrollTop,ue=S.scrollTop,j=0,te=null,we=ye=>{ye!==ue&&(S.scrollTop=ye,ue=S.scrollTop)},$e=()=>{te!==null&&(cancelAnimationFrame(te),te=null),S.classList.remove("hsk-scrolling"),ge=me=ue=S.scrollTop};u.current=$e,p.current=ye=>{Math.abs(S.scrollTop-ue)>1&&(ge=me=ue=S.scrollTop);let at=Math.round(Math.max(0,Math.min(S.scrollHeight-S.clientHeight,ye)));at!==ge&&(ge=at,te===null&&(j=performance.now(),te=requestAnimationFrame(ve)))},w.current=ye=>{let at=Math.round(Math.max(0,Math.min(S.scrollHeight-S.clientHeight,ye)));te!==null&&(cancelAnimationFrame(te),te=null,S.classList.remove("hsk-scrolling")),S.scrollTop=at,ge=me=ue=S.scrollTop};let ve=ye=>{let at=Math.min((ye-j)/1e3,.05);if(j=ye,me+=(ge-me)*(1-Math.exp(-y*at)),Math.abs(ge-me)<q){me=ge,we(Math.round(ge)),S.classList.remove("hsk-scrolling"),te=null;return}we(ce(me)),te=requestAnimationFrame(ve)},_e=ye=>{if(ye.ctrlKey)return;Math.abs(S.scrollTop-ue)>1&&(ge=me=ue=S.scrollTop),ye.deltaY<0&&(f.current&&(A.current+=1),f.current=!1,b.current=null),B.current();let at=ye.deltaMode===1?P:ye.deltaMode===2?S.clientHeight:1,ct=Math.max(0,S.scrollHeight-S.clientHeight),At=Math.round(Math.max(0,Math.min(ct,ge+ye.deltaY*at)));if(At===ge){ct>0&&ye.preventDefault();return}ye.preventDefault(),ge=At,te===null&&(j=performance.now(),S.classList.add("hsk-scrolling"),te=requestAnimationFrame(ve))},Oe=S.scrollTop,et=()=>{let ye=Math.abs(S.scrollTop-ue)>1;ye&&(o.current=performance.now(),S.scrollTop<Oe-1&&f.current&&(A.current+=1,f.current=!1,b.current=null)),Oe=S.scrollTop,te!==null&&ye&&(cancelAnimationFrame(te),te=null,S.classList.remove("hsk-scrolling"),ge=me=ue=S.scrollTop)};return S.addEventListener("wheel",_e,{passive:!1}),S.addEventListener("scroll",et,{passive:!0}),()=>{S.removeEventListener("scroll",et),S.removeEventListener("wheel",_e),te!==null&&cancelAnimationFrame(te),S.classList.remove("hsk-scrolling"),u.current=()=>{},p.current=null,w.current=null}},[]),{msgsContainerRef:a,spacerRef:z,lastExternalScrollRef:o,showJumpToBottom:i,scrollProgress:s,activeMsgIdx:h,jumpAlert:C,unreadBelow:se,jumpToMessage:D,jumpToBottom:O,resetAlertArming:R}}var Ee,Ni=Se(()=>{"use strict";Ee=require("react")});function Ii(e){let[r,t]=(0,Ht.useState)(e),n=(0,Ht.useRef)(e),a=(0,Ht.useRef)(e),o=(0,Ht.useRef)(0),i=(0,Ht.useRef)(0),c=(0,Ht.useRef)(0),s=(0,Ht.useRef)(null);return(0,Ht.useEffect)(()=>()=>{s.current!==null&&cancelAnimationFrame(s.current)},[]),(0,Ht.useEffect)(()=>{if(a.current=e,window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||!e.startsWith(n.current)){s.current!==null&&(cancelAnimationFrame(s.current),s.current=null),n.current=e,o.current=0,i.current=0,t(e);return}if(s.current!==null||n.current.length>=e.length)return;c.current=performance.now();let h=d=>{let u=Math.min(d-c.current,50);c.current=d;let p=a.current,g=p.length-n.current.length,f=Math.min(bd,Math.max(md,g*1e3/ud));o.current+=(f-o.current)*(1-Math.exp(-u/fd)),i.current+=o.current*u/1e3;let k=Math.floor(i.current);k>0&&(i.current-=k,n.current=p.slice(0,Math.min(p.length,n.current.length+k)),t(n.current)),n.current.length<a.current.length?s.current=requestAnimationFrame(h):(s.current=null,i.current=0)};s.current=requestAnimationFrame(h)},[e]),r}var Ht,ud,md,bd,fd,Ai=Se(()=>{"use strict";Ht=require("react"),ud=450,md=45,bd=900,fd=180});function Fi(e,r){let t=(0,Pi.useAkropolysContext)(),[n,a]=(0,Rt.useState)(""),[o,i]=(0,Rt.useState)("idle"),[c,s]=(0,Rt.useState)(null),[l,h]=(0,Rt.useState)(null),[d,u]=(0,Rt.useState)(null),[p,g]=(0,Rt.useState)(go),[f,k]=(0,Rt.useState)(!1),z=(0,Rt.useCallback)(async(M,E)=>{try{navigator.clipboard&&window.isSecureContext?await navigator.clipboard.writeText(M):kd(M),u(E),setTimeout(()=>u(null),2e3)}catch{}},[]);(0,Rt.useEffect)(()=>{e&&e.type==="request_kiku_key"&&(i("prompt_key"),a(""))},[e]),(0,Rt.useEffect)(()=>{if(!c)return;g(go);let M=setInterval(()=>{g(E=>E<=1?(clearInterval(M),s(null),h(null),0):E-1)},1e3);return()=>clearInterval(M)},[c]);let b=(0,Rt.useCallback)(async()=>{let M=n.trim();M&&(t.setKikuPub(M),a(""),i("idle"),await r())},[t,n,r]),N=(0,Rt.useCallback)(async()=>{if(!f){k(!0);try{let{secret:M,publicId:E}=await t.mintKikuKey();s(M),h(E),i("idle"),await r()}catch{}finally{k(!1)}}},[t,f,r]);return{keyInput:n,setKeyInput:a,keyPhase:o,setKeyPhase:i,mintedKey:c,setMintedKey:s,mintedPub:l,setMintedPub:h,copied:d,keyCountdown:p,minting:f,copyValue:z,handleUseExistingKey:b,handleCreateKey:N}}function kd(e){let r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.style.cssText="position:fixed;top:0;left:0;opacity:0;",document.body.appendChild(r),r.select(),r.setSelectionRange(0,e.length);let t=document.execCommand("copy");if(r.remove(),!t)throw new Error("copy failed")}var Rt,Pi,_i=Se(()=>{"use strict";Rt=require("react"),Pi=require("@akropolys/sdk");It()});function Di({attachments:e,setAttachments:r,setInput:t,send:n,t:a}){let o=(0,Sn.useCallback)(l=>{let h=l.name||"",d=`@kiku ${a("displayCapture",{name:h}).trim()}`,u=h||"capture current page";t("");let p=e;r([]),n(u,d,p.length>0?p:void 0,"capture")},[e,n,r,t,a]),i=(0,Sn.useCallback)(l=>{let h=l.filter(p=>p.id).map(p=>({name:p.name||"",url:p.url||"",image:p.image||""})),d=l.map(p=>p.name).filter(Boolean).join(", "),u=`@kiku ${a("displayCaptureAll",{count:String(l.length)})}`;t(""),r([]),n(d||"capture all",u,void 0,"capture_all",h)},[n,r,t,a]),c=(0,Sn.useCallback)(()=>{let l=`@kiku ${a("displayViewHistory")}`;t(""),r([]),n("show my saved items",l,void 0,"view_history")},[n,r,t,a]),s=(0,Sn.useCallback)(()=>{let l=`@kiku ${a("displayDelete")}`;t(""),r([]),n("delete this",l,void 0,"delete")},[n,r,t,a]);return{handleKikuCapture:o,handleKikuCaptureAll:i,handleKikuViewHistory:c,handleKikuDelete:s}}var Sn,Bi=Se(()=>{"use strict";Sn=require("react")});function Tn(e,r=130){let t=ba;if(!t||!fa)return;let n=fa.currentTime;t.gain.cancelScheduledValues(n),t.gain.setValueAtTime(t.gain.value,n),t.gain.linearRampToValueAtTime(Math.max(0,Math.min(1,e)),n+r/1e3)}function qi(){if(!$i)return Ar*=.85,Ar;if(!Hi||!Mn)return Ar;Hi.getByteTimeDomainData(Mn);let e=0;for(let n=0;n<Mn.length;n++){let a=(Mn[n]-128)/128;e+=a*a}let r=Math.sqrt(e/Mn.length),t=Math.min(1,r*3.2);return Ar+=(t-Ar)*(t>Ar?.6:.12),Ar}function Ui(){if($i=!1,ba&&fa&&(ba.gain.cancelScheduledValues(fa.currentTime),ba.gain.value=1),typeof window<"u"&&"speechSynthesis"in window)try{window.speechSynthesis.cancel()}catch{}}var fa,Hi,ba,Mn,$i,Ar,yo=Se(()=>{"use strict";fa=null,Hi=null,ba=null,Mn=null,$i=!1,Ar=0});function Gi({lang:e,onUtterance:r,onError:t,onBargeIn:n,silenceMs:a=gd,paused:o=!1}){let[i,c]=(0,Me.useState)(!1),[s,l]=(0,Me.useState)(!1),[h,d]=(0,Me.useState)(""),[u,p]=(0,Me.useState)(!1),g=(0,Me.useRef)(null),f=(0,Me.useRef)(null),k=(0,Me.useRef)(null),z=(0,Me.useRef)(null),b=(0,Me.useRef)(null),N=(0,Me.useRef)(null),M=(0,Me.useRef)(0),E=(0,Me.useRef)(.008),F=(0,Me.useRef)(0),w=(0,Me.useRef)(0),H=(0,Me.useRef)(""),Q=(0,Me.useRef)(0),T=(0,Me.useRef)(0),A=(0,Me.useRef)(!1),G=(0,Me.useRef)(o),B=(0,Me.useRef)(!1),X=(0,Me.useRef)(!1),xe=(0,Me.useRef)(r),se=(0,Me.useRef)(t),V=(0,Me.useRef)(n);(0,Me.useEffect)(()=>{xe.current=r},[r]),(0,Me.useEffect)(()=>{se.current=t},[t]),(0,Me.useEffect)(()=>{V.current=n},[n]),(0,Me.useEffect)(()=>{G.current=o},[o]),(0,Me.useEffect)(()=>{p(typeof window<"u"&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window)&&!!navigator.mediaDevices?.getUserMedia)},[]);let re=(0,Me.useCallback)(()=>M.current,[]),W=(0,Me.useCallback)(y=>{let P=z.current;return!P||y.length!==P.frequencyBinCount?!1:(P.getByteFrequencyData(y),!0)},[]),_=(0,Me.useCallback)(()=>z.current?.frequencyBinCount??0,[]),J=(0,Me.useRef)([]),C=(0,Me.useRef)(null),L=(0,Me.useRef)(!1),I=(0,Me.useRef)(0),K=(0,Me.useRef)(0),x=(0,Me.useCallback)(y=>{let P=z.current;if(!P)return 0;let q=J.current;q.push(y),q.length>Sd&&q.shift();let ce=0;if(q.length>=12){let Oe=0;for(let et of q)Oe+=et;if(Oe/=q.length,Oe>1e-4){let et=0;for(let ye of q)et+=(ye-Oe)*(ye-Oe);ce=Math.min(1,Math.sqrt(et/q.length)/Oe/.6)}}let ge=0;(!C.current||C.current.length!==P.frequencyBinCount)&&(C.current=new Uint8Array(P.frequencyBinCount));let me=C.current;P.getByteFrequencyData(me);let j=(k.current?.sampleRate??48e3)/2/me.length,te=Math.floor(300/j),we=Math.min(me.length-1,Math.ceil(3400/j)),$e=0,ve=0;for(let Oe=0;Oe<me.length;Oe++)ve+=me[Oe],Oe>=te&&Oe<=we&&($e+=me[Oe]);ve>0&&(ge=$e/ve);let _e=Math.min(1,y/(E.current+wo*3));return Md*_e+Td*ce+Rd*ge},[]),R=(0,Me.useCallback)(()=>{let y=H.current.trim();if(H.current="",Q.current=T.current,d(""),l(!1),y){B.current=!1;let P=g.current;g.current=null;try{P?.stop()}catch{}xe.current(y)}},[]),m=(0,Me.useCallback)(()=>{let y=z.current,P=N.current;if(!y||!P)return;y.getByteTimeDomainData(P);let q=0;for(let te=0;te<P.length;te++){let we=(P[te]-128)/128;q+=we*we}let ce=Math.sqrt(q/P.length),ge=Math.min(1,ce*4);M.current+=(ge-M.current)*(ge>M.current?.6:.12);let me=Date.now(),ue=G.current?qi()*vd:0;ce>E.current+wo+ue?(F.current=me,w.current||(w.current=me)):(w.current=0,E.current=Math.min(E.current*1.02+2e-5,Math.max(.004,ce))),G.current?L.current?(x(ce)>Oi?K.current+=1:K.current=Math.max(0,K.current-2),K.current>=Cd?(L.current=!1,K.current=0,Tn(1,0),V.current?.()):me-I.current>wd&&(L.current=!1,K.current=0,Tn(1,Wi*2))):w.current&&me-w.current>xd&&x(ce)>Oi&&(w.current=0,L.current=!0,I.current=me,K.current=0,Tn(yd,Wi)):H.current.trim()&&me-F.current>a&&R(),b.current=requestAnimationFrame(m)},[R,a,x]),Z=(0,Me.useCallback)(()=>{if(g.current||!A.current)return;let y=window.SpeechRecognition||window.webkitSpeechRecognition,P=new y;Q.current=0,T.current=0,P.lang=e||document.documentElement.lang||navigator.language||"en-US",P.interimResults=!0,P.maxAlternatives=1,P.continuous=!0,P.onresult=q=>{let ce="";for(let ge=Q.current;ge<q.results.length;ge++)ce+=q.results[ge][0].transcript;T.current=q.results.length,ce=ce.trim(),ce&&(H.current=ce,d(ce),l(!0))},P.onerror=q=>{let ce=q?.error||"";ce==="no-speech"||ce==="aborted"||se.current?.(ce)},P.onend=()=>{g.current=null,A.current&&B.current&&setTimeout(()=>{Z()},120)},g.current=P;try{P.start()}catch{g.current=null,se.current?.("failed-to-start")}},[e]),D=(0,Me.useCallback)(()=>{B.current=!1;let y=g.current;g.current=null;try{y?.stop()}catch{}},[]),O=(0,Me.useCallback)(()=>{A.current=!1,L.current=!1,K.current=0,J.current=[],Tn(1,0),B.current=!1,c(!1),l(!1),d(""),H.current="",M.current=0;let y=g.current;g.current=null;try{y?.abort()}catch{}b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),f.current?.getTracks().forEach(P=>P.stop()),f.current=null,z.current=null,k.current?.close().catch(()=>{}),k.current=null},[]),S=(0,Me.useCallback)(async()=>{if(!(A.current||!u)){A.current=!0,c(!0);try{let y=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});f.current=y;let P=window.AudioContext||window.webkitAudioContext,q=new P;k.current=q;let ce=q.createAnalyser();ce.fftSize=1024,ce.smoothingTimeConstant=.25,q.createMediaStreamSource(y).connect(ce),z.current=ce,N.current=new Uint8Array(ce.fftSize),E.current=.008,F.current=Date.now(),b.current=requestAnimationFrame(m)}catch(y){A.current=!1,c(!1),se.current?.(y?.name==="NotAllowedError"?"not-allowed":"audio-capture");return}B.current=!0,Z()}},[u,m,Z]);return(0,Me.useEffect)(()=>{i&&(o?(H.current="",d(""),L.current=!1,K.current=0,J.current=[],D()):(L.current=!1,F.current=Date.now(),B.current=!0,Z()))},[o,i,Z,D]),(0,Me.useEffect)(()=>{if(!i||o)return;let y=setInterval(()=>{let P=!!g.current,q=M.current>E.current+wo;P&&q&&H.current},2e3);return()=>clearInterval(y)},[i,o]),(0,Me.useEffect)(()=>()=>{O()},[O]),{supported:u,active:i,hearing:s,interim:h,micLevel:re,micSpectrum:W,spectrumBins:_,start:S,stop:O}}var Me,gd,wo,xd,vd,yd,Wi,wd,Cd,Sd,Md,Td,Rd,Oi,Vi=Se(()=>{"use strict";Me=require("react");yo();gd=1100,wo=.012,xd=320,vd=.09,yd=.25,Wi=130,wd=700,Cd=12,Sd=48,Md=.45,Td=.35,Rd=.2,Oi=.55});function Xi(e){let r=new Uint8Array(e);if(r.length<4)return new Float32Array(0);let t=new DataView(e).getInt16(0,!0),n=Co(r[2]),a=(r.length-4)*2;r[3]&1&&a>0&&a--;let o=new Float32Array(a);for(let i=0;i<a;i++){let c=r[4+(i>>1)]>>4*(i&1)&15,s=Ki[n],l=s>>3;c&4&&(l+=s),c&2&&(l+=s>>1),c&1&&(l+=s>>2),t=Yi(c&8?t-l:t+l),n=Co(n+ji[c]),o[i]=t/32768}return o}var ji,Ki,Co,Yi,Rn,Qi=Se(()=>{"use strict";ji=[-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8],Ki=[7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767],Co=e=>e<0?0:e>88?88:e,Yi=e=>e<-32768?-32768:e>32767?32767:e,Rn=class{constructor(){this.index=0}encode(r){let t=r.length,n=new Uint8Array(4+(t+1>>1));if(t===0)return n.buffer;let a=r[0];new DataView(n.buffer).setInt16(0,a,!0),n[2]=this.index,n[3]=t&1;let i=this.index;for(let c=0;c<t;c++){let s=Ki[i],l=r[c]-a,h=0;l<0&&(h=8,l=-l);let d=s>>3;l>=s&&(h|=4,l-=s,d+=s),s>>=1,l>=s&&(h|=2,l-=s,d+=s),s>>=1,l>=s&&(h|=1,d+=s),a=Yi(h&8?a-d:a+d),i=Co(i+ji[h]),n[4+(c>>1)]|=h<<4*(c&1)}return this.index=i,n.buffer}}});function Cr(e,r,t){for(let n=0;n<t.length;n++)e.setUint8(r+n,t.charCodeAt(n))}function Ji(e,r=24e3){let t=0;for(let s of e)t+=s.length;let n=new Float32Array(t),a=0;for(let s of e)n.set(s,a),a+=s.length;let o=new ArrayBuffer(44+t*2),i=new DataView(o);Cr(i,0,"RIFF"),i.setUint32(4,36+t*2,!0),Cr(i,8,"WAVE"),Cr(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,r,!0),i.setUint32(28,r*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),Cr(i,36,"data"),i.setUint32(40,t*2,!0);let c=44;for(let s=0;s<t;s++){let l=Math.max(-1,Math.min(1,n[s]));i.setInt16(c,l<0?l*32768:l*32767,!0),c+=2}return new Blob([o],{type:"audio/wav"})}function Zi(e,r=16e3){let t=0;for(let s of e)t+=s.length;let n=new Int16Array(t),a=0;for(let s of e)n.set(s,a),a+=s.length;let o=new ArrayBuffer(44+t*2),i=new DataView(o);Cr(i,0,"RIFF"),i.setUint32(4,36+t*2,!0),Cr(i,8,"WAVE"),Cr(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,r,!0),i.setUint32(28,r*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),Cr(i,36,"data"),i.setUint32(40,t*2,!0);let c=44;for(let s=0;s<t;s++)i.setInt16(c,n[s],!0),c+=2;return new Blob([o],{type:"audio/wav"})}var ec=Se(()=>{"use strict"});function tc(e,r){let t=e.apiUrl.replace(/\/+$/,""),n=t.endsWith("/voice/live")?t:t+"/voice/live",a=new URL(n,window.location.href);a.protocol=a.protocol==="https:"?"wss:":"ws:",a.searchParams.set("siteId",e.siteId),e.kikuId&&a.searchParams.set("kikuId",e.kikuId),e.sessionId&&a.searchParams.set("sessionId",e.sessionId),e.name&&a.searchParams.set("name",e.name),e.language&&a.searchParams.set("language",e.language),a.searchParams.set("codec","adpcm");let o=r||e.voice;return o&&a.searchParams.set("voice",o),a.toString()}function rc(e){let[r,t]=(0,le.useState)("idle"),[n,a]=(0,le.useState)(!1),[o,i]=(0,le.useState)([]),[c,s]=(0,le.useState)(null),[l,h]=(0,le.useState)(!1),d=(0,le.useRef)(null),u=(0,le.useRef)(!1),p=(0,le.useRef)(!1),g=(0,le.useRef)(null),f=(0,le.useRef)(0),k=(0,le.useRef)(!1),z=(0,le.useRef)(!1),b=(0,le.useRef)(null),N=(0,le.useRef)(null),M=(0,le.useRef)(null),E=(0,le.useRef)(null),F=(0,le.useRef)(0),w=(0,le.useRef)(!1),H=(0,le.useRef)([]),Q=(0,le.useRef)(0),T=(0,le.useRef)(new Set),A=(0,le.useRef)(null),G=(0,le.useRef)(null),B=(0,le.useRef)(ka),X=(0,le.useRef)(e);(0,le.useEffect)(()=>{X.current=e;let ne=N.current;if(ne)for(let he of ne.getAudioTracks())he.enabled=!e.muted},[e]);let xe=(0,le.useRef)(!1),se=(0,le.useRef)([]),V=(0,le.useRef)(new Rn),re=(0,le.useRef)(null),W=(0,le.useRef)(""),_=(0,le.useRef)(""),[J,C]=(0,le.useState)([]),L=(0,le.useRef)([]);L.current=J;let I=(0,le.useRef)([]),[K,x]=(0,le.useState)([]),R=(0,le.useRef)(0),m=(0,le.useRef)([]),Z=(0,le.useRef)(void 0),D=(0,le.useRef)(null),O=(0,le.useRef)([]),S=(0,le.useRef)([]),y=(0,le.useCallback)(()=>{let ne=W.current.trim(),he=_.current.trim(),fe=D.current?Math.max(.1,(Date.now()-D.current)/1e3):void 0,ae;if(O.current.length>0)try{let Le=Ji(O.current,B.current);ae=URL.createObjectURL(Le)}catch(Le){console.error("[kiku] failed to encode bot audio wav:",Le)}let ke;if(S.current.length>0)try{let Le=Zi(S.current,So);ke=URL.createObjectURL(Le)}catch(Le){console.error("[kiku] failed to encode user audio wav:",Le)}let pe=m.current.length?m.current:void 0,Re=Z.current;W.current="",_.current="",D.current=null,O.current=[],S.current=[],m.current=[],Z.current=void 0,!(!ne&&!he&&!pe&&!Re)&&X.current.onExchange?.({heard:ne,said:he,duration:fe,userAudioUrl:ke,audioUrl:ae,images:pe,visualization:Re})},[]),P=(0,le.useCallback)(()=>{},[]),q=(0,le.useCallback)(ne=>{if(X.current.muted)return;let he=new Int16Array(ne),fe=0;for(let ke=0;ke<he.length;ke+=8){let pe=Math.abs(he[ke]);pe>fe&&(fe=pe)}fe>1200&&(f.current=Date.now());let ae=d.current;!xe.current||!ae||ae.readyState!==WebSocket.OPEN||(S.current.push(new Int16Array(ne.slice(0))),ae.send(V.current.encode(new Int16Array(ne))))},[]),ce=(0,le.useCallback)(()=>{se.current=[]},[]),ge=(0,le.useCallback)(()=>{let ne=b.current;if(re.current&&ne&&ne.state!=="closed")return re.current;let he=window.AudioContext||window.webkitAudioContext;if(!he)return Promise.resolve(null);let fe=new he({latencyHint:"interactive",sampleRate:ka});b.current=fe;let ae=URL.createObjectURL(new Blob([Fd],{type:"application/javascript"}));return re.current=fe.audioWorklet.addModule(ae).then(()=>fe).catch(()=>null).finally(()=>URL.revokeObjectURL(ae)),re.current},[]),me=(0,le.useCallback)(()=>{typeof window>"u"||ge()},[ge]),ue=(0,le.useCallback)(()=>{let ne=E.current;if(!ne)return 0;let he=new Uint8Array(ne.fftSize);ne.getByteTimeDomainData(he);let fe=0;for(let ae=0;ae<he.length;ae++){let ke=(he[ae]-128)/128;fe+=ke*ke}return Math.min(1,Math.sqrt(fe/he.length)*4)},[]),j=r==="speaking"||r==="thinking",te=(0,le.useCallback)(ne=>{let he=j?A.current:E.current;return!he||ne.length!==he.frequencyBinCount?!1:(he.getByteFrequencyData(ne),!0)},[j]),we=(0,le.useCallback)(()=>(j?A.current:E.current)?.frequencyBinCount??0,[j]),$e=(0,le.useCallback)(()=>{let ne=G.current,he=b.current;if(!ne||!he||he.state==="closed"){F.current=0;for(let ke of T.current)try{ke.onended=null,ke.stop()}catch{}T.current.clear();return}let fe=he.currentTime,ae=fe+Nd;ne.gain.cancelScheduledValues(fe),ne.gain.setValueAtTime(ne.gain.value,fe),ne.gain.linearRampToValueAtTime(0,ae),ne.gain.setValueAtTime(1,ae);for(let ke of T.current)try{ke.onended=null,ke.stop(ae)}catch{}T.current.clear(),F.current=ae},[]),ve=(0,le.useCallback)(ne=>{let he=b.current,fe=A.current;if(!he||!fe||ne.length===0)return;he.state==="suspended"&&he.resume().catch(()=>{});let ae=he.createBuffer(1,ne.length,B.current);ae.getChannelData(0).set(ne);let ke=he.createBufferSource();ke.buffer=ae,ke.connect(fe);let pe=he.currentTime,Re=F.current>pe?F.current:pe+Ld;ke.start(Re),F.current=Re+ae.duration,T.current.add(ke),ke.onended=()=>{T.current.delete(ke),T.current.size===0&&(F.current=0,w.current=!1,t(Le=>Le==="speaking"?"listening":Le))},t(Le=>Le==="speaking"||Le==="idle"||Le==="ended"?Le:"speaking")},[]),_e=(0,le.useCallback)(()=>{let ne=H.current;H.current=[],Q.current=0;for(let he of ne)ve(he)},[ve]),Oe=(0,le.useCallback)(()=>{H.current=[],Q.current=0},[]),et=(0,le.useCallback)(ne=>{let he=b.current;if(!he||ne.length===0)return;if(F.current>he.currentTime&&H.current.length===0){ve(ne);return}let ae=w.current?zd:Ed;H.current.push(ne),Q.current+=ne.length/B.current,Q.current>=ae&&(w.current=!0,_e())},[ve,_e]),ye=(0,le.useRef)(null),at=(0,le.useRef)(null),ct=(0,le.useCallback)(()=>{ye.current&&(clearInterval(ye.current),ye.current=null);let ne=at.current,he=b.current;if(ne&&he&&he.state!=="closed"){let fe=he.currentTime;try{ne.gain.cancelScheduledValues(fe),ne.gain.setValueAtTime(ne.gain.value,fe),ne.gain.linearRampToValueAtTime(1e-4,fe+.04)}catch{}setTimeout(()=>{try{ne.disconnect()}catch{}at.current===ne&&(at.current=null)},50)}},[]),At=(0,le.useCallback)(()=>{},[]),mt=(0,le.useCallback)(ne=>{y(),d.current=null,xe.current=!1,se.current=[],re.current=null,w.current=!1,H.current=[],Q.current=0,ct(),$e(),M.current?.disconnect(),M.current=null,N.current?.getTracks().forEach(he=>he.stop()),N.current=null,E.current=null,A.current=null,G.current=null,b.current?.close().catch(()=>{}),b.current=null,t(ne),a(!1),i([]),u.current=!1,p.current=!1},[y,$e,ct]),Ye=(0,le.useCallback)(()=>{try{d.current?.send(JSON.stringify({type:"close"}))}catch{}try{d.current?.close()}catch{}mt("idle")},[mt]),Yt=(0,le.useCallback)(ne=>{let he=[...I.current,...L.current.filter(fe=>fe.done)].filter(fe=>fe.text).map(fe=>({role:fe.role,text:fe.text}));try{ne.send(JSON.stringify({type:"open",history:he}))}catch{}},[]),Lt=(0,le.useCallback)(ne=>{let he=!1;ne.binaryType="arraybuffer",V.current=new Rn,ne.onopen=()=>{d.current!==ne||!p.current||(p.current=!1,Yt(ne))},ne.onmessage=fe=>{if(fe.data instanceof ArrayBuffer){if(!k.current){k.current=!0;let pe=_.current.trim();pe&&C(Re=>{let Le=Re.slice();for(let Ne=Le.length-1;Ne>=0;Ne--)Le[Ne].role==="user"&&!Le[Ne].done&&(Le[Ne]={...Le[Ne],done:!0});return Le.push({role:"assistant",text:pe,done:!1}),Le})}!z.current&&f.current&&(z.current=!0,console.log("[kiku] wait from last speech to first audio: "+(Date.now()-f.current)+"ms")),ct();let ke=Xi(fe.data);O.current.push(ke.slice()),et(ke);return}let ae;try{ae=JSON.parse(fe.data)}catch{return}switch(ae.type){case"ready":ae.sampleRate&&(B.current=ae.sampleRate,ae.sampleRate!==ka&&console.warn(`[kiku] live audio rate ${ae.sampleRate} != context ${ka}; per-buffer resampling will click at every chunk seam`)),typeof ae.secondsLeft=="number"&&s(ae.secondsLeft),h(ae.photos===!0),xe.current=!0,t("listening"),ce(),g.current?.(),g.current=null,Gt("connect",!0);break;case"hearing":D.current||(D.current=Date.now()),a(!0);break;case"thinking":D.current||(D.current=Date.now()),a(!1),t("thinking"),At(),ae.tool==="visualize"&&x(ke=>ke.some(pe=>pe.pending)?ke:[...ke,{id:++R.current,url:"",pending:!0}]);break;case"viz":typeof ae.url=="string"&&ae.url?(Z.current=ae.url,x(ke=>ke.map(pe=>pe.pending?{...pe,url:ae.url,pending:!1}:pe))):x(ke=>ke.filter(pe=>!pe.pending));break;case"heard":T.current.size===0&&(F.current=0),D.current||(D.current=Date.now(),Gt("heard")),W.current+=ae.text,C(ke=>{let pe=ke.slice(),Re=pe[pe.length-1];return Re&&Re.role==="user"&&!Re.done?pe[pe.length-1]={...Re,text:W.current.trim()}:pe.push({role:"user",text:W.current.trim(),done:!1}),pe}),a(!1),t("thinking"),At();break;case"said":if(_.current+=ae.text,!k.current)break;C(ke=>{let pe=ke.slice();for(let Ne=pe.length-1;Ne>=0;Ne--)pe[Ne].role==="user"&&!pe[Ne].done&&(pe[Ne]={...pe[Ne],done:!0});let Re=pe[pe.length-1],Le=_.current.trim();return Re&&Re.role==="assistant"&&!Re.done?pe[pe.length-1]={...Re,text:Le}:pe.push({role:"assistant",text:Le,done:!1}),pe});break;case"interrupted":w.current=!1,Oe(),ct(),$e(),Gt("interrupt"),a(!1),t("listening");break;case"turn_complete":z.current=!1,k.current=!1,f.current=0,C(ke=>ke.map(pe=>pe.done?pe:{...pe,done:!0})),_e(),w.current=!1,ct(),a(!1),y();break;case"sources":Array.isArray(ae.sources)&&ae.sources.length&&i(ae.sources);break;case"seconds":typeof ae.secondsLeft=="number"&&s(ae.secondsLeft);break;case"refused":X.current.onRefused?.(ae.code||"guest"),Ye();break;case"error":X.current.onError?.(ae.code||"unavailable"),Ye();break}},ne.onclose=fe=>{d.current===ne&&(fe.code===4402&&(he=!0,X.current.onError?.(fe.reason==="site"?"siteLimit":"limit")),mt("ended"))},ne.onerror=()=>{!he&&d.current===ne&&X.current.onError?.("connection")}},[Oe,et,y,ce,$e,_e,Yt,At,ct,Ye,mt]),dr=(0,le.useCallback)(ne=>{let he=d.current;if(xe.current=!1,t("connecting"),$e(),ct(),he){try{he.send(JSON.stringify({type:"close"}))}catch{}try{he.close()}catch{}}let fe=X.current;p.current=!0;let ae=new WebSocket(tc(fe,ne),["akropolys.token."+fe.token]);d.current=ae,Lt(ae)},[Lt,$e,ct]),Xt=(0,le.useRef)(e.voice);(0,le.useEffect)(()=>{Xt.current!==e.voice&&(Xt.current=e.voice,d.current&&(r==="listening"||r==="thinking"||r==="speaking")&&dr(e.voice))},[e.voice,r,dr]);let pr=(0,le.useCallback)(async(ne=[])=>{if(u.current&&d.current)return;u.current=!0,t("connecting");let he=X.current;se.current=[],I.current=ne,L.current=[],C([]),x([]),W.current="",_.current="";let fe=ge();b.current?.resume().catch(()=>{}),xr();let ae=d.current;ae&&ae.readyState===WebSocket.OPEN?Yt(ae):ae&&ae.readyState===WebSocket.CONNECTING?p.current=!0:(ae=new WebSocket(tc(he),["akropolys.token."+he.token]),d.current=ae,p.current=!0,Lt(ae));let ke;try{if(!navigator.mediaDevices?.getUserMedia)throw{name:"NotAllowedError"};ke=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch(nt){try{ae.close()}catch{}d.current=null,t("idle"),he.onError?.(nt?.name==="NotAllowedError"?"not-allowed":"audio-capture");return}if(d.current!==ae){ke.getTracks().forEach(nt=>nt.stop());return}N.current=ke;for(let nt of ke.getAudioTracks())nt.enabled=!X.current.muted;let pe=await fe;if(d.current!==ae){ke.getTracks().forEach(nt=>nt.stop());return}if(!pe){X.current.onError?.("audio-worklet"),Ye();return}pe.state==="suspended"&&pe.resume().catch(()=>{});let Re=pe.createAnalyser();Re.fftSize=1024,Re.smoothingTimeConstant=.25,E.current=Re;let Le=pe.createGain();Le.gain.value=1,Le.connect(pe.destination),G.current=Le;let Ne=pe.createAnalyser();Ne.fftSize=1024,Ne.smoothingTimeConstant=.25,Ne.connect(Le),A.current=Ne;try{let nt=new AudioWorkletNode(pe,"kiku-capture");M.current=nt,nt.port.onmessage=Pt=>q(Pt.data);let nr=pe.createMediaStreamSource(ke),ot=()=>{if(!(d.current!==ae||!M.current)){try{nr.connect(Re)}catch{}try{nr.connect(nt)}catch{}}};xe.current?ot():g.current=ot}catch{X.current.onError?.("audio-worklet"),Ye()}},[Lt,ge,q,Yt,Ye]);(0,le.useEffect)(()=>{if(r!=="listening"){a(!1);return}let ne=0,he=!1,fe=Date.now(),ae=window.setInterval(()=>{let ke=Date.now();if(!X.current.muted&&ue()>Id&&(ne=ke),ke-Math.max(ne,fe)>Pd){window.clearInterval(ae),X.current.onError?.("idle"),Ye();return}let pe=ke-ne<Ad;pe!==he&&(he=pe,a(pe))},100);return()=>window.clearInterval(ae)},[r,ue,Ye]);let Ut=(0,le.useCallback)(()=>{me()},[me]);(0,le.useEffect)(()=>()=>{Ye()},[Ye]),(0,le.useEffect)(()=>{let ne=N.current;if(ne)for(let he of ne.getAudioTracks())he.enabled=!e.muted},[e.muted,r]);let ze=(0,le.useCallback)(async ne=>{let he=X.current.storeScene;if(!he||!ne.type.startsWith("image/"))return!1;let fe;try{fe=await ha(ne)}catch{return!1}let ae=++R.current;if(x(pe=>[...pe,{id:ae,url:fe,pending:!1,sending:!0}]),!await he(fe))return x(pe=>pe.filter(Re=>Re.id!==ae)),!1;x(pe=>pe.map(Re=>Re.id===ae?{...Re,sending:!1}:Re)),m.current.push(fe);let ke=d.current;return ke&&ke.readyState===WebSocket.OPEN&&ke.send(JSON.stringify({type:"text",text:"(The visitor just attached a photo. You cannot see it. In one short sentence, ask what they would like changed in it.)"})),!0},[]),Mt=(0,le.useCallback)(ne=>{let he=d.current;he&&he.readyState===WebSocket.OPEN&&ne.trim()&&he.send(JSON.stringify({type:"text",text:ne}))},[]);return{state:r,phase:r,hearing:n,sources:o,secondsLeft:c,photos:l,turns:J,images:K,micLevel:ue,micSpectrum:te,spectrumBins:we,start:pr,stop:Ye,prewarm:Ut,attachPhoto:ze,ask:Mt}}var le,So,ka,Ed,zd,Ld,Nd,Id,Ad,Pd,Fd,nc=Se(()=>{"use strict";le=require("react");Wr();Qi();ec();so();So=16e3,ka=24e3,Ed=.08,zd=.12,Ld=.03,Nd=.08,Id=.12,Ad=500,Pd=6e4,Fd=`
2
+ "use strict";var Nh=Object.create;var ea=Object.defineProperty;var Ih=Object.getOwnPropertyDescriptor;var Ah=Object.getOwnPropertyNames;var Ph=Object.getPrototypeOf,Fh=Object.prototype.hasOwnProperty;var Se=(e,r)=>()=>(e&&(r=e(e=0)),r);var fs=(e,r)=>{for(var t in r)ea(e,t,{get:r[t],enumerable:!0})},ks=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Ah(r))!Fh.call(e,a)&&a!==t&&ea(e,a,{get:()=>r[a],enumerable:!(n=Ih(r,a))||n.enumerable});return e};var Wt=(e,r,t)=>(t=e!=null?Nh(Ph(e)):{},ks(r||!e||!e.__esModule?ea(t,"default",{value:e,enumerable:!0}):t,e)),_h=e=>ks(ea({},"__esModule",{value:!0}),e);function Ot(e,r){return e.details??(e.fields?(0,gs.resolveDisplayFields)(e.fields,r).details:[])}function Va(e){return e.length?` (${e.map(r=>`${r.label}: ${r.value}`).join(", ")})`:""}var gs,pn=Se(()=>{"use strict";gs=require("@akropolys/sdk")});function xs(e){var r,t,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(r=0;r<a;r++)e[r]&&(t=xs(e[r]))&&(n&&(n+=" "),n+=t)}else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function vs(){for(var e,r,t=0,n="",a=arguments.length;t<a;t++)(e=arguments[t])&&(r=xs(e))&&(n&&(n+=" "),n+=r);return n}var ys=Se(()=>{"use strict"});function de(...e){return vs(e)}var yt=Se(()=>{"use strict";ys()});function ta(){try{return localStorage.getItem(Ss)!=="off"}catch{return!0}}function Ms(e){try{localStorage.setItem(Ss,e?"on":"off")}catch{}e&&xr()}function xr(){if(typeof window>"u")return;try{let r=navigator.audioSession;r&&r.type!=="playback"&&(r.type="playback")}catch{}if(qe){qe.state==="suspended"&&qe.resume().catch(()=>{});return}let e=window.AudioContext||window.webkitAudioContext;if(e)try{qe=new e({latencyHint:"interactive"}),Jt=qe.createGain(),Jt.gain.value=.28,Jt.connect(qe.destination);let r=qe.createBuffer(1,1,qe.sampleRate),t=qe.createBufferSource();t.buffer=r,t.connect(qe.destination),t.start(0),qe.resume().catch(()=>{})}catch{qe=null}}function Qt(e,r,t,n,a){if(!qe||!Jt)return;let o=qe.createOscillator();o.type="sine",o.frequency.setValueAtTime(r,e),o.frequency.exponentialRampToValueAtTime(Math.max(40,r*t),e+n);let i=qe.createBiquadFilter();i.type="lowpass",i.Q.value=.9,i.frequency.setValueAtTime(Math.min(18e3,r*7),e),i.frequency.exponentialRampToValueAtTime(Math.max(80,r*1.5),e+n);let c=qe.createGain();c.gain.setValueAtTime(1e-4,e),c.gain.exponentialRampToValueAtTime(a,e+.006),c.gain.exponentialRampToValueAtTime(1e-4,e+n),o.connect(i),i.connect(c),c.connect(Jt),o.start(e),o.stop(e+n+.02)}function Ts(e,r){if(!qe||!Jt)return;let t=Math.floor(qe.sampleRate*.03),n=qe.createBuffer(1,t,qe.sampleRate),a=n.getChannelData(0);for(let s=0;s<t;s++)a[s]=(Math.random()*2-1)*Math.pow(1-s/t,3);let o=qe.createBufferSource();o.buffer=n;let i=qe.createBiquadFilter();i.type="bandpass",i.frequency.value=2600,i.Q.value=5;let c=qe.createGain();c.gain.value=r,o.connect(i),i.connect(c),c.connect(Jt),o.start(e)}function Rs(){return ta()?qe?qe.state:"unsupported":"off"}function Dh(e){!qe||!Jt||(Qt(e,587.33,.985,.16,.38),Qt(e+.048,739.99,.985,.18,.42),Qt(e+.096,880,.985,.28,.46),Qt(e+.105,1174.66,.985,.22,.22),Ts(e+.096,.16))}function Bh(e){!qe||!Jt||Qt(e,659.25,.97,.09,.26)}function Gt(e,r=!1){if(!r&&!ta()||(xr(),!qe||!Jt||qe.state==="closed"))return;qe.state==="suspended"&&qe.resume().catch(()=>{});let t=qe.currentTime+.01;switch(e){case"connect":Dh(t);break;case"heard":Bh(t);break;case"reply":Qt(t,440,.94,.13,.5),Qt(t+.09,660,.94,.16,.42);break;case"interrupt":Qt(t,520,.62,.17,.4);break;case"send":Qt(t,300,1.16,.1,.22);break;case"pin":Ts(t,.35),Qt(t+.02,880,.97,.07,.22);break}}var Ss,qe,Jt,Wr=Se(()=>{"use strict";Ss="hsk-sounds",qe=null,Jt=null});function ra(e){if(typeof e=="string")return{themeAttr:e,vars:void 0};if(!e)return{themeAttr:void 0,vars:void 0};let r={};return e.primaryColor&&(r["--hsk-primary"]=e.primaryColor),e.backgroundColor&&(r["--hsk-bg"]=e.backgroundColor,r["--hsk-chat-bg"]=e.backgroundColor),e.textColor&&(r["--hsk-text"]=e.textColor,r["--hsk-chat-text"]=e.textColor),e.fontFamily&&(r["--hsk-font"]=e.fontFamily),e.fontSize&&(r["--hsk-font-size"]=e.fontSize),e.mobileFontSize&&(r["--hsk-mobile-font-size"]=e.mobileFontSize),e.borderRadius&&(r["--hsk-border-radius"]=e.borderRadius),{themeAttr:void 0,vars:r}}var ja=Se(()=>{"use strict"});function Ya(e,r="hsk-font"){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return`${r}-${t.toString(36)}`}function Hh(e){let r=e.split("?")[0].split("#")[0].split(".").pop()?.toLowerCase();return r==="woff2"?"woff2":r==="woff"?"woff":r==="otf"?"opentype":r==="ttf"?"truetype":""}function Xa(e){let r=e.trim();return!r||/["'()\\\s]/.test(r)||/^(javascript|vbscript):/i.test(r)?null:r}function qh(e,r){(0,Ka.useEffect)(()=>{if(!e||!r||typeof document>"u")return;let t=Ya(e);if(_t.set(e,(_t.get(e)??0)+1),!document.getElementById(t)){let n=document.createElement("style");n.id=t,n.textContent=r,document.head.appendChild(n)}return()=>{let n=(_t.get(e)??1)-1;if(n>0){_t.set(e,n);return}_t.delete(e),document.getElementById(t)?.remove()}},[e,r])}function Ns(e){let r=zs(e.family);return r?e.faces.map(t=>{let n=Xa(t.url);return n?`@font-face{font-family:"${r}";font-style:normal;font-weight:${Ls(t.weight)};font-display:swap;src:url(${n}) format("woff2");`+(Es(t.unicodeRange)?`unicode-range:${Es(t.unicodeRange)};`:"")+"}":""}).join(""):""}function Qa(e){let r=e?.faces??[],t=e&&r.length?Ns(e):"";qh(t?`script|${e.family}|${r.map(n=>n.url).join("|")}`:"",t)}async function Dt(e,r=0){if(typeof document>"u"||!("fonts"in document))return;let t=Ns(e);if(!t)return;let n=`script|${e.family}|${e.faces.map(o=>o.url).join("|")}`;_t.set(n,(_t.get(n)??0)+1);let a=Ya(n);if(!document.getElementById(a)){let o=document.createElement("style");o.id=a,o.textContent=t,document.head.appendChild(o)}if(r>0){let o=document.fonts,i=e.family.replace(/^['"]|['"]$/g,""),c=Array.from(o||[]).filter(l=>l.family.replace(/^['"]|['"]$/g,"")===i),s=c.length>0?c.map(l=>l.load().catch(()=>{})):e.faces.map(l=>{let h=Xa(l.url);if(!h)return Promise.resolve();try{return new window.FontFace(i,`url(${h})`,{weight:Ls(l.weight),style:"normal"}).load().then(u=>{document.fonts?.add(u)}).catch(()=>{})}catch{return Promise.resolve()}});await Promise.race([Promise.all(s),new Promise(l=>setTimeout(l,r))])}}function As(e,r){let t=Array.from(new Set(Array.from(Object.values(r).join("")))).join(""),n=e.map(a=>`"${a.replace(/^['"]|['"]$/g,"")}"`).join(", ");return{text:t,stack:n}}function Ja(e,r){let t=typeof document<"u"?document.fonts:null,{text:n,stack:a}=As(e,r);if(!t?.check||!n||!a)return!0;try{return Is.every(o=>t.check(`${o} 16px ${a}`,n))}catch{return!0}}async function Za(e,r,t){let n=typeof document<"u"?document.fonts:null;if(!n?.load)return;let{text:a,stack:o}=As(e,r);!a||!o||await Promise.race([Promise.all(Is.map(i=>n.load(`${i} 16px ${o}`,a).catch(()=>{}))),new Promise(i=>setTimeout(i,t))])}function na(e){let r=typeof e=="object"&&e?e:void 0,t=zs(r?.fontFamily?.split(",")[0].trim().replace(/^['"]|['"]$/g,"")??""),n=typeof r?.fontUrl=="string"?{normal:r.fontUrl}:r?.fontUrl??{},a=n.normal??"",o=n.bold??"",i=n.variable??"";(0,Ka.useEffect)(()=>{if(!t||!a&&!o&&!i)return;let c=i?[["100 900",i]]:[["400",a],["700",o]],s=[];for(let[u,p]of c){if(!p)continue;let g=Xa(p);if(!g)continue;let f=Hh(g);s.push(`@font-face{font-family:"${t}";font-style:normal;font-weight:${u};font-display:swap;src:url(${g})${f?` format("${f}")`:""};}`)}if(s.length===0)return;let l=s.join(""),h=`${t}|${a}|${o}|${i}`,d=Ya(h,"hsk-host-font");if(_t.set(h,(_t.get(h)??0)+1),!document.getElementById(d)){let u=document.createElement("style");u.id=d,u.textContent=l,document.head.appendChild(u)}return()=>{let u=(_t.get(h)??1)-1;if(u>0){_t.set(h,u);return}_t.delete(h),document.getElementById(d)?.remove()}},[t,a,o,i])}var Ka,_t,zs,$h,Es,Ls,Is,un=Se(()=>{"use strict";Ka=require("react"),_t=new Map;zs=e=>/["\\{}<>;\n\r]/.test(e)?"":e.trim(),$h=/^[Uu]\+[0-9A-Fa-f?]{1,6}(-[0-9A-Fa-f]{1,6})?$/,Es=e=>{let r=e.split(",").map(t=>t.trim()).filter(Boolean);return r.length===0||!r.every(t=>$h.test(t))?"":r.join(", ")},Ls=e=>/^\d{3}( \d{3})?$/.test(e)?e:"400";Is=["400","500","600","700"]});var $,Uh,vr,Ps,Fs,_s,Or,aa,oa,Ds,sa,Bs,Hs,ia,eo,$s,mn,ca,Er,zr,bn,qs,to,Us,Ws,Os,Gs,Vs,js,Ks,Ys,Xs,Bt=Se(()=>{"use strict";yt();$=require("react/jsx-runtime"),Uh=({className:e,size:r=18,tight:t=!1})=>(0,$.jsx)("svg",{className:de("hsk-brand-mark",e),width:r,height:r,viewBox:t?"10.2 17.4 79.5 79.5":"0 0 100 100",xmlns:"http://www.w3.org/2000/svg","aria-label":"kiku",children:(0,$.jsxs)("g",{transform:"translate(22.7 19) scale(0.62)",fill:"currentColor",fillRule:"evenodd",children:[(0,$.jsx)("path",{d:"M39.4 10.4 Q44 0 48.6 10.4 L86.1 95.8 Q88 100 83.4 100 L4.6 100 Q0 100 1.9 95.8 Z M24 100 L24 65 Q24 60 27.4 56.3 Q44 38 60.6 56.3 Q64 60 64 65 L64 100 Z"}),(0,$.jsx)("circle",{cx:"55",cy:"82",r:"3.4"})]})}),vr=Uh,Ps=()=>(0,$.jsxs)("svg",{className:"hsk-stop-icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[(0,$.jsx)("circle",{className:"hsk-stop-ring",cx:"12",cy:"12",r:"9.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),(0,$.jsx)("rect",{className:"hsk-stop-core",x:"8.5",y:"8.5",width:"7",height:"7",rx:"1.8",fill:"currentColor"})]}),Fs=()=>(0,$.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),(0,$.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,$.jsx)("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),_s=()=>(0,$.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"currentColor",children:(0,$.jsx)("path",{d:"M8 5v14l11-7z"})}),Or=()=>(0,$.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,$.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),aa=()=>(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{d:"m15 18-6-6 6-6"})}),oa=()=>(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{d:"m9 18 6-6-6-6"})}),Ds=()=>(0,$.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,$.jsx)("path",{d:"M3 3v5h5"}),(0,$.jsx)("path",{d:"M12 7v5l4 2"})]}),sa=()=>(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{d:"M19 21 12 16l-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})}),Bs=()=>(0,$.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M3 6h18"}),(0,$.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),Hs=()=>(0,$.jsx)("svg",{width:"19",height:"19",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,$.jsx)("path",{d:"M12 5v14M5 12h14"})}),ia=({size:e=18}={})=>(0,$.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M21 11.5a8.4 8.4 0 0 1-12.3 7.4L3 21l2.1-5.7A8.4 8.4 0 1 1 21 11.5Z"}),[8.9,12.6,16.3].map((r,t)=>(0,$.jsx)("circle",{className:"hsk-mimi-dot",style:{"--hsk-dot":t},cx:r,cy:"11.6",r:"1.15",fill:"currentColor",stroke:"none"},r))]}),eo=()=>(0,$.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),$s=()=>(0,$.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),(0,$.jsx)("circle",{className:"hsk-img-sun",cx:"9",cy:"9",r:"1.8"}),(0,$.jsx)("path",{className:"hsk-img-ridge",d:"m21 15-4.5-4.5L6 21"})]}),mn=({className:e,size:r=13}={})=>(0,$.jsxs)("svg",{className:de("hsk-retry-icon",e),width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{className:"hsk-retry-arrow",d:"M21.5 2v6h-6"}),(0,$.jsx)("path",{className:"hsk-retry-arc",d:"M21.34 15.57a10 10 0 1 1-.57-8.38l5.67-5.19"})]}),ca=({className:e,size:r=13}={})=>(0,$.jsxs)("svg",{className:de("hsk-edit-icon",e),width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{className:"hsk-edit-pencil",d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"}),(0,$.jsx)("path",{className:"hsk-edit-lead",d:"m15 5 4 4"})]}),Er=({className:e,size:r=13}={})=>(0,$.jsxs)("svg",{className:de("hsk-copy-icon",e),width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("rect",{className:"hsk-copy-sheet",x:"8.5",y:"7",width:"12",height:"14",rx:"3.5"}),(0,$.jsx)("path",{className:"hsk-copy-back",d:"M5 15H4.5A2.5 2.5 0 0 1 2 12.5V4.5A2.5 2.5 0 0 1 4.5 2h8A2.5 2.5 0 0 1 15 4.5V5"})]}),zr=({className:e,size:r=13}={})=>(0,$.jsx)("svg",{className:de("hsk-check-icon",e),width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("polyline",{className:"hsk-check-mark",points:"20 6 9 17 4 12"})}),bn=({className:e,size:r=18}={})=>(0,$.jsxs)("svg",{className:e,width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{className:"hsk-mic-cap",d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"}),(0,$.jsx)("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),(0,$.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]}),qs=()=>(0,$.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("line",{className:"hsk-mic-slash",x1:"2",y1:"2",x2:"22",y2:"22"}),(0,$.jsx)("path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2"}),(0,$.jsx)("path",{d:"M5 10v2a7 7 0 0 0 12 5"}),(0,$.jsx)("path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33"}),(0,$.jsx)("path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12"}),(0,$.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]}),to=({active:e})=>(0,$.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{className:"hsk-wave-bar hsk-wave-bar--tip",style:{"--hsk-bar":0,"--hsk-amp":1.9,"--hsk-period":"1.24s"},d:"M2 12h2"}),(0,$.jsx)("path",{className:"hsk-wave-bar",style:{"--hsk-bar":1,"--hsk-amp":1.78,"--hsk-period":"0.94s"},d:"M6 8v8"}),(0,$.jsx)("path",{className:"hsk-wave-bar",style:{"--hsk-bar":2,"--hsk-amp":1.26,"--hsk-period":"1.42s"},d:"M10 4v16"}),(0,$.jsx)("path",{className:"hsk-wave-bar",style:{"--hsk-bar":3,"--hsk-amp":1.62,"--hsk-period":"1.08s"},d:"M14 7v10"}),(0,$.jsx)("path",{className:"hsk-wave-bar",style:{"--hsk-bar":4,"--hsk-amp":2.05,"--hsk-period":"0.86s"},d:"M18 9v6"}),(0,$.jsx)("path",{className:"hsk-wave-bar hsk-wave-bar--tip",style:{"--hsk-bar":5,"--hsk-amp":1.9,"--hsk-period":"1.32s"},d:"M22 12h-2"})]}),Us=()=>(0,$.jsxs)("svg",{className:"hsk-telegram-icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("polygon",{className:"hsk-kite-wing hsk-kite-wing--far",points:"22 2 11 13 2 9"}),(0,$.jsx)("polygon",{className:"hsk-kite-wing hsk-kite-wing--near",points:"22 2 15 22 11 13"}),(0,$.jsx)("line",{className:"hsk-kite-spine",x1:"22",y1:"2",x2:"11",y2:"13"})]}),Ws=()=>(0,$.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("circle",{className:"hsk-sun-core",cx:"12",cy:"12",r:"5"}),(0,$.jsxs)("g",{className:"hsk-sun-rays",children:[(0,$.jsx)("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),(0,$.jsx)("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),(0,$.jsx)("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),(0,$.jsx)("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),(0,$.jsx)("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),(0,$.jsx)("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),(0,$.jsx)("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),(0,$.jsx)("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})]}),Os=()=>(0,$.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{className:"hsk-moon-body",d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),Gs=()=>(0,$.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{className:"hsk-wood-layer",style:{"--hsk-layer":0},d:"M12 2L2 7l10 5 10-5-10-5z"}),(0,$.jsx)("path",{className:"hsk-wood-layer",style:{"--hsk-layer":2},d:"M2 17l10 5 10-5"}),(0,$.jsx)("path",{className:"hsk-wood-layer",style:{"--hsk-layer":1},d:"M2 12l10 5 10-5"})]}),Vs=()=>(0,$.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,$.jsx)("path",{className:"hsk-heart-body",d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})}),js=()=>(0,$.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M17 8h1a4 4 0 1 1 0 8h-1"}),(0,$.jsx)("path",{d:"M3 8h14v9a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4z"}),(0,$.jsx)("line",{className:"hsk-steam",style:{"--hsk-steam":0},x1:"6",y1:"1",x2:"6",y2:"4"}),(0,$.jsx)("line",{className:"hsk-steam",style:{"--hsk-steam":1},x1:"10",y1:"1",x2:"10",y2:"4"}),(0,$.jsx)("line",{className:"hsk-steam",style:{"--hsk-steam":2},x1:"14",y1:"1",x2:"14",y2:"4"})]}),Ks=()=>(0,$.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("path",{d:"M12 3a6.5 6.5 0 0 0 9 9 9 9 0 1 1-9-9z"}),(0,$.jsx)("path",{className:"hsk-star-spark",d:"M18.5 2.5l.6 1.6 1.6.6-1.6.6-.6 1.6-.6-1.6-1.6-.6 1.6-.6z"})]}),Ys=({size:e=11})=>(0,$.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,$.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),Xs=({className:e,size:r=16,filled:t=!1}={})=>(0,$.jsxs)("svg",{className:de("hsk-pin-icon",e),width:r,height:r,viewBox:"0 0 24 24",fill:t?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,$.jsx)("line",{x1:"12",y1:"17",x2:"12",y2:"22"}),(0,$.jsx)("path",{d:"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17z"})]})});function no(e){return typeof e=="string"&&Lr.some(r=>r.id===e)}function ao(e){return Lr.find(r=>r.id===e)??Lr[0]}var Lr,ro,Qs,oo=Se(()=>{"use strict";Bt();Lr=[{id:"light",label:"Silver",Icon:Ws,dark:!1},{id:"dark",label:"Onyx",Icon:Os,dark:!0},{id:"mahogany",label:"Mahogany",Icon:Gs,dark:!0},{id:"blush",label:"Blush",Icon:Vs,dark:!1},{id:"coffee",label:"Coffee",Icon:js,dark:!1},{id:"midnight",label:"Midnight",Icon:Ks,dark:!0}],ro="dark",Qs="light"});function Wh(e,r,t=.55){return r<=0?0:e*r*t/(r+t*Math.abs(e))}function Oh({stiffness:e=500,damping:r=45,onFrame:t,onRest:n}){let a=0,o=0,i=0,c=null,s=0,l=d=>{let u=Math.min(.032,(d-s)/1e3)||.016666666666666666;s=d;let p=Math.max(1,Math.ceil(u/.008)),g=u/p;for(let f=0;f<p;f++){let k=-e*(a-i)-r*o;o+=k*g,a+=o*g}if(Math.abs(a-i)<.5&&Math.abs(o)<.5){a=i,o=0,c=null,t(a),n?.();return}t(a),c=requestAnimationFrame(l)},h=()=>{c===null&&(s=performance.now(),c=requestAnimationFrame(l))};return{track(d){c!==null&&(cancelAnimationFrame(c),c=null),a=d,o=0,t(a)},to(d,u=0){i=d,o=u,h()},get value(){return a},stop(){c!==null&&(cancelAnimationFrame(c),c=null)}}}function Js({panel:e,scroller:r,onDismiss:t,quiescent:n,enabled:a=!0}){let o=(0,la.useRef)(t);o.current=t,(0,la.useEffect)(()=>{if(!a)return;let i=e();if(!i||typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches)return;let c=!1,s=0,l=0,h=0,d=-1,u=0,p=0,g=0,f=!1,k=!1,b=Oh({onFrame:w=>{i.style.transform=w===0?"":`translate3d(0, ${w}px, 0)`;let H=i.parentElement;H&&(H.style.opacity=w===0?"":String(Math.max(.35,1-w/(i.offsetHeight||1)*1.1)))},onRest:()=>{i.style.willChange="",k&&(k=!1,o.current())}}),N=()=>{let w=r();return w&&w.scrollTop>0?!1:n?n():!0},M=w=>{w.pointerType==="mouse"||!w.isPrimary||(c=!1,f=!1,d=w.pointerId,s=u=w.clientY,l=w.clientX,p=w.timeStamp,g=0,h=b.value)},E=w=>{if(w.pointerId!==d)return;let H=w.clientY-s,Q=w.clientX-l;if(!f){if(Math.abs(H)<6&&Math.abs(Q)<6)return;if(f=!0,c=H>0&&Math.abs(H)>Math.abs(Q)&&N(),c){try{i.setPointerCapture(w.pointerId)}catch{}b.stop(),i.style.animation="none",i.style.willChange="transform"}}if(!c)return;let T=w.timeStamp-p;T>0&&(g=(w.clientY-u)/T*1e3),u=w.clientY,p=w.timeStamp;let A=h+H;b.track(A<0?-Wh(-A,i.offsetHeight||1):A),w.cancelable&&w.preventDefault()},F=w=>{if(w.pointerId!==d)return;try{i.hasPointerCapture(w.pointerId)&&i.releasePointerCapture(w.pointerId)}catch{}if(d=-1,!c)return;c=!1;let H=i.offsetHeight||1;b.value+g*.12>H*.3||g>900?(k=!0,i.style.pointerEvents="none",b.to(H,g)):b.to(0,g)};return i.addEventListener("pointerdown",M,{passive:!0}),i.addEventListener("pointermove",E,{passive:!1}),i.addEventListener("pointerup",F,{passive:!0}),i.addEventListener("pointercancel",F,{passive:!0}),()=>{b.stop(),i.removeEventListener("pointerdown",M),i.removeEventListener("pointermove",E),i.removeEventListener("pointerup",F),i.removeEventListener("pointercancel",F),i.style.transform="",i.style.willChange="",i.style.animation="",i.style.pointerEvents="";let w=i.parentElement;w&&(w.style.opacity="")}},[a,e,r,n])}var la,Zs=Se(()=>{"use strict";la=require("react")});function fn(e){return new Promise((r,t)=>{let n=new FileReader;n.onload=()=>r(n.result),n.onerror=()=>t(n.error??new Error("read failed")),n.readAsDataURL(e)})}async function ha(e){if(e.type==="image/gif"||e.type==="image/svg+xml"||e.size<=307200)return fn(e);try{let r=await createImageBitmap(e),t=Math.min(1,1536/Math.max(r.width,r.height)),n=Math.max(1,Math.round(r.width*t)),a=Math.max(1,Math.round(r.height*t));r.close?.();let o=await createImageBitmap(e,{resizeWidth:n,resizeHeight:a,resizeQuality:"high"});try{let i=document.createElement("canvas");i.width=n,i.height=a;let c=i.getContext("2d");if(!c)return fn(e);c.drawImage(o,0,0);let s=e.type==="image/png",l=await new Promise(h=>i.toBlob(h,s?"image/png":"image/jpeg",.85));return!l||l.size>=e.size?fn(e):fn(l)}finally{o.close?.()}}catch{return fn(e)}}var so=Se(()=>{"use strict"});function Gh(e){let r=0;for(let t=1;t<e.length;t++)r+=ei(e[t-1],e[t]);return r}function io(e){let r=1/0,t=1/0,n=-1/0,a=-1/0;for(let o of e)o.x<r&&(r=o.x),o.y<t&&(t=o.y),o.x>n&&(n=o.x),o.y>a&&(a=o.y);return{minX:r,minY:t,maxX:n,maxY:a}}function co(e,r,t){return[Gr(e.minY/t*1e3),Gr(e.minX/r*1e3),Gr(e.maxY/t*1e3),Gr(e.maxX/r*1e3)]}function Vh(e,r){let[t,n,a,o]=e,[i,c,s,l]=r,h=Math.min(o,l)-Math.max(n,c),d=Math.min(a,s)-Math.max(t,i);if(h<=0||d<=0)return!1;let u=Math.min((o-n)*(a-t),(l-c)*(s-i));return u>0&&h*d/u>.35}function Kh(e,r,t){if(e.length<2)return null;let n=io(e),a=co(n,r,t),o=Math.hypot(n.maxX-n.minX,n.maxY-n.minY);if(o<4)return null;let i=Gh(e),c=ei(e[0],e[e.length-1]),s=i/Math.max(c,1e-6);return c/o<.3&&i>o*1.8?{gesture:"ring",box:a,straight:!1}:s<1.25?{gesture:"arrow",box:a,to:[Gr(e[e.length-1].y/t*1e3),Gr(e[e.length-1].x/r*1e3)],straight:!0}:{gesture:"scribble",box:a,straight:!1}}function ti(e,r,t){if(!r||!t)return[];let n=[],a=[],o=[];for(let s of e){if(s.kind==="pin"&&typeof s.x=="number"&&typeof s.y=="number"){let l={x:s.x,y:s.y};o.push({gesture:"pin",id:s.id,text:s.label,box:co(io([l,l]),r,t)});continue}if(s.kind==="text"&&s.value&&typeof s.x=="number"&&typeof s.y=="number"){let l={x:s.x,y:s.y};a.push({gesture:"text",box:co(io([l,l]),r,t),text:s.value});continue}if(s.kind==="stroke"&&s.tool!=="eraser"&&s.points){let l=Kh(s.points,r,t);l&&n.push(l)}}let i=new Set,c=[];for(let s=0;s<n.length;s++){if(i.has(s))continue;let l=n[s];for(let h=s+1;h<n.length;h++)i.has(h)||!l.straight||!n[h].straight||Vh(l.box,n[h].box)&&(i.add(h),l={gesture:"cross",box:jh(l.box,n[h].box),straight:!1});i.add(s),c.push(l.gesture==="arrow"?{gesture:"arrow",box:l.box,to:l.to}:{gesture:l.gesture,box:l.box})}return[...o,...c,...a]}var ei,Gr,jh,ri=Se(()=>{"use strict";ei=(e,r)=>Math.hypot(e.x-r.x,e.y-r.y);Gr=e=>Math.max(0,Math.min(1e3,Math.round(e)));jh=(e,r)=>[Math.min(e[0],r[0]),Math.min(e[1],r[1]),Math.max(e[2],r[2]),Math.max(e[3],r[3])]});function Jh(e,r,t){let n=[],a="";for(let o of r.split(/\s+/)){let i=a?`${a} ${o}`:o;a&&e.measureText(i).width>t?(n.push(a),a=o):a=i}return a&&n.push(a),n.slice(0,3)}function Zh(e,r){let t=`${r}%`;return e<33?{top:t,left:8,transform:"translateY(-100%)"}:e>67?{top:t,right:8,transform:"translateY(-100%)"}:{top:t,left:`${e}%`,transform:"translate(-50%, -100%)"}}function ai({src:e,onCancel:r,onSend:t,t:n}){let[a,o]=(0,st.useState)(null),[i,c]=(0,st.useState)(!1),[s,l]=(0,st.useState)("pin"),h=(0,st.useRef)(0),[d,u]=(0,st.useState)(null),p=(0,st.useRef)(null),[g,f]=(0,st.useState)([{points:[],closed:!1}]),k=g[g.length-1],z=(0,st.useRef)(`selection-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`),b=(0,st.useRef)(null),N=x=>f(R=>[...R.slice(-66),x]),M=s==="select",[E,F]=(0,st.useState)([]),[w,H]=(0,st.useState)(!1),Q=(0,st.useRef)(null),T=(0,st.useRef)(null);(0,st.useEffect)(()=>{let x=new Image;return x.crossOrigin="anonymous",x.onload=()=>o(x),x.onerror=()=>c(!0),x.src=e,()=>{x.onload=null,x.onerror=null}},[e]);let A=(()=>{if(!a)return{w:0,h:0};let x=Math.min(1,Yh/Math.max(a.naturalWidth,a.naturalHeight));return{w:Math.round(a.naturalWidth*x),h:Math.round(a.naturalHeight*x)}})(),G=(0,st.useRef)(null),B=x=>{let R=Q.current;if(!R||!a)return;let m=R.getContext("2d");if(!m)return;G.current||(G.current=document.createElement("canvas"));let Z=G.current;Z.width=R.width,Z.height=R.height;let D=Z.getContext("2d"),O=x?[...E,x]:E;for(let y of O)y.kind==="stroke"&&(D.save(),D.globalCompositeOperation=y.tool==="eraser"?"destination-out":"source-over",D.strokeStyle=ni,D.lineWidth=y.tool==="eraser"?y.size*3:y.size,D.lineCap="round",D.lineJoin="round",D.beginPath(),y.points.forEach((P,q)=>q===0?D.moveTo(P.x,P.y):D.lineTo(P.x,P.y)),y.points.length===1&&D.lineTo(y.points[0].x+.01,y.points[0].y),D.stroke(),D.restore());m.clearRect(0,0,R.width,R.height),m.drawImage(a,0,0,R.width,R.height),m.drawImage(Z,0,0);let S=k.points.map((y,P)=>b.current?.index===P?b.current.point:y);S.length&&(m.save(),m.beginPath(),S.forEach((y,P)=>P?m.lineTo(y.x,y.y):m.moveTo(y.x,y.y)),k.closed&&(m.closePath(),m.fillStyle="#22c55e33",m.fill()),m.strokeStyle="#22c55e",m.lineWidth=Math.max(2,A.w/400),m.stroke(),m.restore());for(let y of S)m.beginPath(),m.arc(y.x,y.y,Math.max(3,A.w/260),0,Math.PI*2),m.fillStyle="#ffffff",m.fill(),m.strokeStyle="#15803d",m.stroke();for(let y of O){if(y.kind!=="pin")continue;let P=y.size;if(m.save(),m.beginPath(),m.moveTo(y.x,y.y),m.bezierCurveTo(y.x-P*2,y.y-P*2,y.x-P,y.y-P*3.5,y.x,y.y-P*3.5),m.bezierCurveTo(y.x+P,y.y-P*3.5,y.x+P*2,y.y-P*2,y.x,y.y),m.fillStyle=ni,m.fill(),m.lineWidth=Math.max(1,P/7),m.strokeStyle="#fff",m.stroke(),m.beginPath(),m.arc(y.x,y.y-P*2.2,P*.5,0,Math.PI*2),m.fillStyle="#fff",m.fill(),y.label){m.font=`600 ${P*1.2}px system-ui, sans-serif`,m.textAlign="center",m.textBaseline="middle";let q=Jh(m,y.label,R.width*.32),ce=P*1.5,ge=Math.min(R.width,Math.max(...q.map(te=>m.measureText(te).width))+P),me=q.length*ce+P*.4,ue=Math.max(ge/2,Math.min(R.width-ge/2,y.x)),j=Math.max(me,y.y-P*3.7);m.fillStyle="rgba(0,0,0,.8)",m.fillRect(ue-ge/2,j-me,ge,me),m.fillStyle="#fff",q.forEach((te,we)=>m.fillText(te,ue,j-me+P*.2+ce*(we+.5),ge-P))}m.restore()}};(0,st.useEffect)(()=>{B()},[a,E,k,A.w,A.h]);let X=x=>{let R=Q.current,m=R.getBoundingClientRect();return{x:Math.max(0,Math.min(R.width,(x.clientX-m.left)/m.width*R.width)),y:Math.max(0,Math.min(R.height,(x.clientY-m.top)/m.height*R.height))}},xe=()=>Math.max(4,Math.round(A.w/180)),se=x=>{F(R=>R.filter(m=>m.kind!=="pin"||m.id!==x)),u(null)},V=()=>{let x=E.find(R=>R.kind==="pin"&&R.id===d);x?.kind==="pin"&&!x.label.trim()?se(x.id):u(null)},re=x=>{if(!a)return;let R=X(x);if(s==="pin"){let m=E.find(O=>O.kind==="pin"&&Math.hypot(R.x-O.x,R.y-(O.y-O.size*1.7))<O.size*2);if(m?.kind==="pin"){u(m.id),x.currentTarget.setPointerCapture(x.pointerId),p.current={id:m.id,offset:{x:R.x-m.x,y:R.y-m.y}};return}if(d){V();return}if(E.filter(O=>O.kind==="pin").length>=Xh)return;let Z=`pin-${++h.current}`,D=Math.max(10,A.w/Q.current.getBoundingClientRect().width*9);F(O=>[...O,{kind:"pin",...R,id:Z,label:"",size:D}]),u(Z);return}if(s==="select"){let m=k.points[0],Z=Q.current.getBoundingClientRect(),D=12*A.w/Z.width;if(!k.closed&&m&&k.points.length>=3&&Math.hypot(R.x-m.x,R.y-m.y)<D)N({...k,closed:!0});else{let O=k.points.findIndex(S=>Math.hypot(R.x-S.x,R.y-S.y)<D);if(O>=0){x.currentTarget.setPointerCapture(x.pointerId),b.current={index:O,point:R};return}if(k.closed||k.points.length>=64)return;N({...k,points:[...k.points,R]})}return}x.target.setPointerCapture(x.pointerId),T.current={kind:"stroke",tool:s,size:xe(),points:[R]},B(T.current)},W=x=>{if(p.current){let{id:R,offset:m}=p.current,Z=X(x);F(D=>D.map(O=>O.kind==="pin"&&O.id===R?{...O,x:Math.max(0,Math.min(A.w,Z.x-m.x)),y:Math.max(0,Math.min(A.h,Z.y-m.y))}:O));return}if(b.current){b.current.point=X(x),B();return}T.current&&(T.current.points.push(X(x)),B(T.current))},_=()=>{if(p.current){p.current=null;return}if(b.current){let{index:R,point:m}=b.current;b.current=null,N({...k,points:k.points.map((Z,D)=>D===R?m:Z)});return}if(!T.current)return;let x=T.current;T.current=null,F(R=>[...R,x])},J=E.filter(x=>x.kind==="pin"),C=J.find(x=>x.id===d),L=!!a&&!(k.points.length>0&&!k.closed)&&J.length>0&&J.every(x=>x.label.trim()),I=()=>{if(!(!L||!a))try{let x=document.createElement("canvas");x.width=A.w,x.height=A.h;let R=x.getContext("2d");if(!R){H(!0);return}R.drawImage(a,0,0,A.w,A.h);let m=x.toDataURL("image/jpeg",.92),Z=Q.current?.toDataURL("image/jpeg",.85)||m,D=ti(E,A.w,A.h);if(k.closed){let O=y=>Math.round(y/A.w*1e3),S=y=>Math.round(y/A.h*1e3);D.unshift({gesture:"selection",id:z.current,box:[S(Math.min(...k.points.map(y=>y.y))),O(Math.min(...k.points.map(y=>y.x))),S(Math.max(...k.points.map(y=>y.y))),O(Math.max(...k.points.map(y=>y.x)))],points:k.points.map(y=>[O(y.x),S(y.y)])})}t(m,J.map(O=>O.label.trim()).join("; "),D,Z)}catch{H(!0)}},K=s==="pin"?"markupPinHint":s==="select"?k.closed?"markupSelectedHint":"markupOutlineHint":"markupSketchHint";return(0,Ke.jsxs)("div",{className:"hsk-markup",role:"dialog","aria-label":n("markupDialogLabel"),children:[(0,Ke.jsxs)("div",{className:"hsk-markup-head",children:[(0,Ke.jsx)("span",{className:"hsk-markup-title",role:"status",children:n(K)}),(0,Ke.jsx)("button",{className:"hsk-markup-cancel",onClick:r,children:n("markupCancel")})]}),(0,Ke.jsx)("div",{className:"hsk-markup-stage",children:i?(0,Ke.jsx)("div",{className:"hsk-markup-error",children:n("markupLoadError")}):a?(0,Ke.jsxs)("div",{className:"hsk-markup-canvas-wrap",children:[(0,Ke.jsx)("canvas",{ref:Q,width:A.w,height:A.h,className:`hsk-markup-canvas hsk-markup-canvas--${s}`,style:{touchAction:"none",cursor:M||s==="pin"?"crosshair":void 0},onPointerDown:re,onPointerMove:W,onPointerUp:_,onPointerCancel:()=>{p.current=null,b.current=null,T.current=null,B()}}),s==="pin"&&C&&(0,Ke.jsxs)("div",{className:"hsk-markup-pinlabel",style:Zh(C.x/A.w*100,Math.max(12,(C.y-C.size*4)/A.h*100)),children:[(0,Ke.jsx)("input",{autoFocus:!0,"aria-label":n("markupPinLabel"),placeholder:n("markupPinLabelHint"),value:C.label,maxLength:Qh,style:{width:`${Math.min(34,Math.max(16,C.label.length+2))}ch`},onChange:x=>F(R=>R.map(m=>m.kind==="pin"&&m.id===C.id?{...m,label:x.target.value}:m)),onKeyDown:x=>{(x.key==="Enter"||x.key==="Escape")&&V()}}),(0,Ke.jsx)("button",{"aria-label":n("markupRemovePin"),title:n("markupRemovePin"),onClick:()=>se(C.id),children:"\xD7"})]})]}):(0,Ke.jsx)("div",{className:"hsk-markup-loading",children:n("markupLoading")})}),(0,Ke.jsxs)("div",{className:"hsk-markup-tools",children:[(0,Ke.jsxs)("button",{className:`hsk-markup-tool${s==="pin"?" hsk-markup-tool--on":""}`,onClick:()=>l("pin"),children:[(0,Ke.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{verticalAlign:"middle",marginInlineEnd:5},"aria-hidden":"true",children:[(0,Ke.jsx)("path",{d:"M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0Z"}),(0,Ke.jsx)("circle",{cx:"12",cy:"10",r:"3"})]}),n("markupPin")]}),(0,Ke.jsx)("button",{className:`hsk-markup-tool${s==="select"?" hsk-markup-tool--on":""}`,onClick:()=>{u(null),l("select")},children:n("markupSelect")}),(0,Ke.jsx)("button",{className:"hsk-markup-tool",disabled:k.closed||k.points.length<3,onClick:()=>N({...k,closed:!0}),children:n("markupCloseOutline")}),(0,Ke.jsx)("button",{className:`hsk-markup-tool${s==="pen"?" hsk-markup-tool--on":""}`,onClick:()=>{u(null),l("pen")},children:n("markupSketch")}),(0,Ke.jsx)("button",{className:`hsk-markup-tool${s==="eraser"?" hsk-markup-tool--on":""}`,onClick:()=>{u(null),l("eraser")},children:n("markupEraser")}),(0,Ke.jsx)("button",{className:"hsk-markup-tool",onClick:()=>M?f(x=>x.length>1?x.slice(0,-1):x):F(x=>x.slice(0,-1)),disabled:M?g.length<2:E.length===0,children:n("markupUndo")}),(0,Ke.jsx)("button",{className:"hsk-markup-tool",onClick:()=>{F([]),u(null),f([{points:[],closed:!1}]),l("pin")},disabled:E.length===0&&!k.points.length,children:n("markupClear")}),(0,Ke.jsx)("button",{className:"hsk-markup-go",onClick:I,disabled:!L,children:n("markupSend")})]}),w&&(0,Ke.jsx)("div",{className:"hsk-markup-error",children:n("markupError")})]})}var st,Ke,ni,Yh,Xh,Qh,oi=Se(()=>{"use strict";st=require("react");ri();Ke=require("react/jsx-runtime"),ni="#ff5a5a",Yh=1280,Xh=4,Qh=80});function ui(e){let r=2166136261;for(let t=0;t<e.length;t++)r^=e.charCodeAt(t),r=Math.imul(r,16777619);return r>>>0}function gn(e){let r=e>>>0;return()=>{r=r+1831565813>>>0;let t=Math.imul(r^r>>>15,1|r);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function ed(e){let t=new Float32Array(65536);for(let a=0;a<t.length;a++)t[a]=e();let n=(a,o)=>t[(o&255)*256+(a&255)];return(a,o)=>{let i=Math.floor(a),c=Math.floor(o),s=si(a-i),l=si(o-c),h=n(i,c),d=n(i+1,c),u=n(i,c+1),p=n(i+1,c+1);return(h+(d-h)*s)*(1-l)+(u+(p-u)*s)*l}}function td(e,r,t,n){let a=t/Math.SQRT2,o=Math.ceil(e/a),i=Math.ceil(r/a),c=new Int32Array(o*i).fill(-1),s=[],l=[],h=(u,p)=>{let g=s.length;s.push([u,p]),c[Math.floor(p/a)*o+Math.floor(u/a)]=g,l.push(g)},d=(u,p)=>{if(u<0||p<0||u>=e||p>=r)return!1;let g=Math.floor(u/a),f=Math.floor(p/a);for(let k=Math.max(f-2,0);k<=Math.min(f+2,i-1);k++)for(let z=Math.max(g-2,0);z<=Math.min(g+2,o-1);z++){let b=c[k*o+z];if(b<0)continue;let N=s[b][0]-u,M=s[b][1]-p;if(N*N+M*M<t*t)return!1}return!0};for(h(n()*e,n()*r);l.length;){let u=n()*l.length|0,[p,g]=s[l[u]],f=!1;for(let k=0;k<24;k++){let z=n()*Math.PI*2,b=t*(1+n()),N=p+Math.cos(z)*b,M=g+Math.sin(z)*b;if(d(N,M)){h(N,M),f=!0;break}}f||l.splice(u,1)}return s}function ho(e,r,t){let n=li(e),a=li(r);return`rgb(${Math.round(n[0]+(a[0]-n[0])*t)},${Math.round(n[1]+(a[1]-n[1])*t)},${Math.round(n[2]+(a[2]-n[2])*t)})`}function mo(){for(let e of uo)e()}function mi(e){po.forEach(r=>r(e))}function od(e,r,t){return`hsl(${Math.round(r*300%360)}, ${t?72:68}%, ${t?58:46}%)`}function bi(e,r,t,n,a,o,i,c=r){let s=i?rd[i]:void 0,l=gn(a),h=ed(gn(a^2654435769)),d=e*r,p=Math.max(40,Math.min(520,Math.round(d/3100)))/.48,g=Math.max(26,Math.sqrt(.7*d/p)),f=td(e,r,g,l),k=4.4/Math.max(e,r),z=k*2.6,b=Math.hypot(e,r),N=l()*Math.PI*2,M=Math.cos(N),E=Math.sin(N),F=e*(.18+l()*.64),w=r*(.12+l()*.5),H=[],Q=Math.hypot(e,r)||1,T=gn(a^1540483477),A=o?e:0,G=Math.hypot(e,c)||1,[B,X,xe]=t.split(",").map(V=>parseFloat(V)||0),se=.2126*B+.7152*X+.0722*xe>128;for(let[V,re]of f){let W=h(V*k,re*k)*.72+h(V*z,re*z)*.28,_=Math.min(1,Math.max(0,(W-.26)/.44));if(l()>_*_*(3-2*_))continue;let J=l(),C=Math.max(0,1-Math.hypot(V-F,re-w)/(b*.72))**1.6,L=((V-e/2)*M+(re-r/2)*E)/b+.5,I=!se,x=((I?.055:.028)+l()*(I?.04:.025))*(.75+L*.55)*(1+C*.4),R=ho(t,n,C*.85),m=((o?e-V:V)+r-re)/(e+r||1),Z=l()*16777215|0,D=od(Z,m,se),O=0,S=I?1.05+l()*.35:.65+l()*.35,y=20,P=lo[0],q=1;J<.5?(O=it(l,.16),S=I?1.15+l()*.45:.7+l()*.35,y=20+l()*16,P=lo[l()*lo.length|0]):J<.82?(O=l()*Math.PI*2,S=I?.95+l()*.4:.6+l()*.4,y=16+l()*20,P=ii[l()*ii.length|0]):J<.95||!s?(O=l()*Math.PI*2,S=I?.85+l()*.35:.55+l()*.35,y=7+l()*7,P=ci[l()*ci.length|0]):(O=it(l,.3),S=I?1.1+l()*.3:.75+l()*.3,y=15+l()*9,P=s,q=2.6),H.push({x:V,y:re,roll:J,rotation:O,lineWidth:S,alpha:x*q,baseColor:R,shimmerColor:D,drawFn:P,size:y,seed:Z,normDist:m,bloom:Math.min(1,Math.hypot(V-A,re-c)/G)*.62+T()*.08,glow:se?.2:.06,ux:(V-A)/(Math.hypot(V-A,re-c)||1),uy:(re-c)/(Math.hypot(V-A,re-c)||1)})}return H}function id(e){return 1+(1.2+1)*(e-1)**3+1.2*(e-1)**2}function Nr(e,r,t,n,a,o=1,i){e.clearRect(0,0,t,n),e.lineCap="round",e.lineJoin="round";let c=a>=0&&a<=1.4,s=c?a*1.4-.2:-999,l=.3;for(let h of r){let d=h.alpha,u=h.baseColor,p=h.lineWidth,g=1,f=0,k=0;if(i!==void 0){let b=Math.min(1,Math.max(0,(i-h.bloom)/sd));if(b<=0)continue;let N=1-(1-b)**3,M=Math.sin(b*Math.PI)**2;d=h.alpha*N+M*h.glow,u=ho(h.baseColor,h.shimmerColor,M*(h.glow>.1?.85:.55)),p=h.lineWidth*(1+M*.35),g=.86+.14*id(b),f=-h.ux*(1-N)*9,k=-h.uy*(1-N)*9}else if(c){let b=h.normDist-s;if(b>l)d=h.alpha*.45,u=h.baseColor,p=h.lineWidth;else if(b<-l)d=h.alpha,u=h.baseColor,p=h.lineWidth;else{let N=Math.cos(b/l*(Math.PI/2))**2;d=h.alpha+N*.08,u=N>.08?ho(h.baseColor,h.shimmerColor,N*.65):h.baseColor,p=h.lineWidth*(1+N*.2)}}e.save(),e.translate(h.x+(h.dx??0)+f,h.y+(h.dy??0)+k),e.rotate(h.rotation+(h.dr??0)),g!==1&&e.scale(g,g),h.hop&&(e.scale(1+h.hop,1+h.hop),d*=1+h.hop*2),e.globalAlpha=Math.min(d*o,1),e.strokeStyle=u,e.fillStyle=u,e.lineWidth=p;let z=gn(h.seed);h.drawFn(e,h.size,z),e.restore()}}function ld({seed:e="",theme:r,alphaScale:t=1.8,weight:n=.6}){let a=(0,ft.useRef)(null);return(0,ft.useEffect)(()=>{let o=a.current,i=o?.getContext("2d");if(!o||!i)return;let c=0,s=()=>{let h=o.clientWidth,d=o.clientHeight,u=Math.min(window.devicePixelRatio||1,3);o.width=Math.round(h*u),o.height=Math.round(d*u);let p=getComputedStyle(o),g=p.getPropertyValue("--hsk-doodle-ink").trim()||"31,31,31",f=p.getPropertyValue("--hsk-doodle-tint").trim()||g,k=h*kn,z=d*kn,b=bi(k,z,g,f,ui(e||"kiku"),!1,r);for(let E of b)E.lineWidth*=kn*n;if(i.setTransform(u/kn,0,0,u/kn,0,0),window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches){Nr(i,b,k,z,-1,t);return}let N=performance.now(),M=E=>{let F=(E-N)%(pi*2)/pi,w=F<1?F:2-F;Nr(i,b,k,z,(1-Math.cos(w*Math.PI))/2*1.4,t),c=requestAnimationFrame(M)};c=requestAnimationFrame(M)},l=new ResizeObserver(()=>{c||!o.clientWidth||!o.clientHeight||(l.disconnect(),s())});return l.observe(o),()=>{l.disconnect(),cancelAnimationFrame(c)}},[e,r,t,n]),(0,xn.jsx)("canvas",{className:"hsk-doodle-shimmer",ref:a,"aria-hidden":"true"})}function Vr({active:e,seed:r,theme:t}){let[n,a]=(0,ft.useState)(e);return(0,ft.useEffect)(()=>{if(e){a(!0);return}let o=setTimeout(()=>a(!1),hd);return()=>clearTimeout(o)},[e]),n?(0,xn.jsx)("span",{className:`hsk-working-veil${e?"":" is-leaving"}`,"aria-hidden":"true",children:(0,xn.jsx)(ld,{seed:r,theme:t,alphaScale:18,weight:1.15})}):null}var ft,xn,si,it,lo,ii,ci,rd,li,po,uo,nd,hi,di,ad,sd,cd,kn,pi,hd,da,vn=Se(()=>{"use strict";ft=Wt(require("react")),xn=require("react/jsx-runtime");si=e=>e*e*(3-2*e);it=(e,r)=>(e()-.5)*r,lo=[(e,r,t)=>{let n=r*.5,a=r*(.14+t()*.04),o=r*.07;e.beginPath(),e.moveTo(-a-o*.6,-n),e.lineTo(a+o*.6,-n),e.moveTo(-a,-n+o),e.lineTo(a,-n+o),e.moveTo(-a,-n+o),e.lineTo(-a*.85,n-o),e.moveTo(a,-n+o),e.lineTo(a*.85,n-o),e.moveTo(0,-n+o*1.7),e.lineTo(0,n-o*1.7),e.moveTo(-a,n-o),e.lineTo(a,n-o),e.moveTo(-a-o*.6,n),e.lineTo(a+o*.6,n),e.stroke()},(e,r,t)=>{let n=r*.5,a=-n*(.18+t()*.1);e.beginPath(),e.moveTo(-n,a),e.lineTo(0,-n),e.lineTo(n,a),e.closePath(),e.moveTo(-n*.92,a+n*.16),e.lineTo(n*.92,a+n*.16);for(let o of[-.62,-.21,.21,.62])e.moveTo(n*o,a+n*.16),e.lineTo(n*o,n*.8);e.moveTo(-n,n*.8),e.lineTo(n,n*.8),e.stroke()},(e,r,t)=>{let n=r*.5,a=n*(.48+t()*.12);e.beginPath(),e.moveTo(-n*.2,-n*.86),e.lineTo(n*.2,-n*.86),e.moveTo(-n*.15,-n*.78),e.bezierCurveTo(-a,-n*.3,-a*.85,n*.6,0,n*.86),e.bezierCurveTo(a*.85,n*.6,a,-n*.3,n*.15,-n*.78),e.moveTo(-n*.17,-n*.64),e.quadraticCurveTo(-a*1.16,-n*.48,-a*.7,-n*.04),e.moveTo(n*.17,-n*.64),e.quadraticCurveTo(a*1.16,-n*.48,a*.7,-n*.04),e.stroke()},(e,r,t)=>{let n=r*.5;e.beginPath(),e.moveTo(-n*.9,n*.52),e.quadraticCurveTo(0,-n*.18,n*.9,-n*.58),e.stroke();let a=4+(t()*3|0);for(let o=0;o<a;o++){let i=.16+o/a*.8,c=-n*.9+i*n*1.8,s=n*.52-i*n*1.16+(1-i)*i*n*.3,l=o%2?1:-1,h=n*(.26+t()*.1);e.beginPath(),e.moveTo(c,s),e.quadraticCurveTo(c+h*.5,s+l*h*.66,c+h*.9,s+l*h*.08),e.quadraticCurveTo(c+h*.42,s+l*h*.04,c,s),e.stroke()}},(e,r,t)=>{let n=r*.5;e.beginPath(),e.moveTo(-n*.85,-n*.7),e.quadraticCurveTo(-n*.1,-n*.35,n*.2,n*.1),e.stroke();let a=[[-n*.45,-n*.12],[n*.05,n*.3],[n*.42,-n*.4]];for(let[o,i]of a)e.beginPath(),e.moveTo(o,i-n*.28),e.lineTo(o-n*.02,i-n*.16),e.stroke(),e.beginPath(),e.ellipse(o,i,n*(.15+t()*.04),n*.19,it(t,.5),0,Math.PI*2),e.stroke()},(e,r,t)=>{let n=r*.5;for(let a of[-1,1]){e.beginPath(),e.arc(0,0,n*.72,a>0?-1.25:1.25,a>0?1.25:Math.PI*2-1.25,a<0),e.stroke();for(let o=0;o<5;o++){let i=-1.05+o/4*2.1,c=Math.sin(i)*a*n*.72,s=Math.cos(i)*n*.72,l=n*(.2+t()*.08);e.beginPath(),e.moveTo(c,s),e.quadraticCurveTo(c+a*l*.9,s-l*.5,c+a*l*.6,s-l*1.05),e.stroke()}}},(e,r)=>{let t=r*.5;e.beginPath(),e.moveTo(-t,t*.6),e.lineTo(t*.55,t*.6),e.lineTo(t*.55,-t*.6),e.lineTo(-t*.45,-t*.6),e.lineTo(-t*.45,t*.15),e.lineTo(t*.1,t*.15),e.lineTo(t*.1,-t*.18),e.stroke()},(e,r)=>{let t=r*.5;e.beginPath(),e.moveTo(-t*.62,t*.8),e.lineTo(-t*.62,-t*.05),e.arc(0,-t*.05,t*.62,Math.PI,0),e.lineTo(t*.62,t*.8),e.stroke(),e.beginPath(),e.moveTo(-t*.86,t*.8),e.lineTo(t*.86,t*.8),e.stroke()},(e,r,t)=>{let n=r*.5;e.beginPath(),e.arc(0,0,n*.4,0,Math.PI*2),e.stroke();let a=t()*.5;for(let o=0;o<8;o++){let i=a+o/8*Math.PI*2;e.beginPath(),e.moveTo(Math.cos(i)*n*.6,Math.sin(i)*n*.6),e.lineTo(Math.cos(i)*n*.94,Math.sin(i)*n*.94),e.stroke()}},(e,r)=>{let t=r*.5;e.beginPath(),e.moveTo(-t*.44,t*.7),e.bezierCurveTo(-t,t*.2,-t*.8,-t*.7,-t*.3,-t*.6),e.moveTo(t*.44,t*.7),e.bezierCurveTo(t,t*.2,t*.8,-t*.7,t*.3,-t*.6),e.moveTo(-t*.32,-t*.64),e.lineTo(t*.32,-t*.64),e.moveTo(-t*.44,t*.7),e.lineTo(t*.44,t*.7);for(let n of[-.16,.02,.2])e.moveTo(t*n,-t*.56),e.lineTo(t*n,t*.62);e.stroke()},(e,r,t)=>{let n=r*.5,a=n*(.4+t()*.18);e.beginPath(),e.moveTo(-n,n*.16),e.quadraticCurveTo(-n*.5,-a,0,-n*.02),e.quadraticCurveTo(n*.5,-a,n,n*.16),e.stroke()}],ii=[(e,r,t)=>{let n=r*.5,a=-n+it(t,n*.3),o=it(t,n);e.beginPath(),e.moveTo(a,o);let i=4+(t()*4|0);for(let c=0;c<i;c++){let s=a+n*2/i+it(t,n*.5),l=it(t,n*1.5);e.quadraticCurveTo(a+it(t,n*.9),o+it(t,n*1.6),s,l),a=s,o=l}e.stroke()},(e,r,t)=>{let n=r*.5,a=2.2+t()*1.6,o=t()<.5?-1:1;e.beginPath();for(let i=0;i<=60;i++){let c=i/60,s=o*c*a*Math.PI*2,l=n*c*(.9+it(t,.06)),h=Math.cos(s)*l,d=Math.sin(s)*l;i===0?e.moveTo(h,d):e.lineTo(h,d)}e.stroke()},(e,r,t)=>{let n=r*.5,a=4+(t()*4|0),o=it(t,.7);for(let i=0;i<a;i++){let c=-n+i/(a-1)*n*2+it(t,n*.16),s=n*(.7+t()*.6);e.beginPath(),e.moveTo(c-o*s*.5,-s*.5),e.quadraticCurveTo(c+it(t,n*.2),0,c+o*s*.5,s*.5),e.stroke()}},(e,r,t)=>{let n=r*.5,a=2+(t()*3|0),o=n*2/a;e.beginPath(),e.moveTo(-n,n*.4);for(let i=0;i<a;i++){let c=-n+i*o,s=o*(.42+t()*.18);e.bezierCurveTo(c+s*.2,n*.4-s*2.1,c+o-s*.2,n*.4-s*2.1,c+o,n*.4+it(t,n*.14))}e.stroke()}],ci=[(e,r,t)=>{e.beginPath(),e.arc(0,0,r*.1+t()*r*.04,0,Math.PI*2),e.fill()},(e,r,t)=>{e.beginPath(),e.arc(it(t,r*.04),it(t,r*.04),r*.32,0,Math.PI*2),e.stroke()},(e,r,t)=>{let n=r*.4,a=n*(.2+t()*.12);e.beginPath(),e.moveTo(0,-n),e.quadraticCurveTo(a,-a,n,0),e.quadraticCurveTo(a,a,0,n),e.quadraticCurveTo(-a,a,-n,0),e.quadraticCurveTo(-a,-a,0,-n),e.stroke()},(e,r,t)=>{let n=r*.4;e.beginPath(),e.moveTo(-n,it(t,r*.08)),e.quadraticCurveTo(0,it(t,r*.16),n,it(t,r*.08)),e.stroke()}],rd={light:(e,r)=>{let t=r*.5;e.beginPath(),e.moveTo(0,-t),e.quadraticCurveTo(t*.16,-t*.16,t,0),e.quadraticCurveTo(t*.16,t*.16,0,t),e.quadraticCurveTo(-t*.16,t*.16,-t,0),e.quadraticCurveTo(-t*.16,-t*.16,0,-t),e.stroke()},dark:(e,r)=>{let t=r*.44;e.beginPath(),e.moveTo(-t*.6,-t*.5),e.lineTo(t*.6,-t*.5),e.lineTo(t,t*.05),e.lineTo(0,t),e.lineTo(-t,t*.05),e.closePath(),e.moveTo(-t,t*.05),e.lineTo(t,t*.05),e.moveTo(-t*.6,-t*.5),e.lineTo(-t*.3,t*.05),e.lineTo(0,t),e.moveTo(t*.6,-t*.5),e.lineTo(t*.3,t*.05),e.lineTo(0,t),e.stroke()},mahogany:(e,r)=>{let t=r*.5;e.beginPath(),e.moveTo(0,t),e.bezierCurveTo(-t*.9,t*.2,-t*.7,-t*.7,0,-t),e.bezierCurveTo(t*.7,-t*.7,t*.9,t*.2,0,t),e.moveTo(0,t*.86),e.lineTo(0,-t*.86);for(let n=0;n<3;n++){let a=-.34+n*.36;e.moveTo(0,t*a),e.lineTo(t*.44,t*(a-.26)),e.moveTo(0,t*a),e.lineTo(-t*.44,t*(a-.26))}e.stroke()},blush:(e,r)=>{let t=r*.5;for(let n=0;n<5;n++){let a=n/5*Math.PI*2-Math.PI/2;e.beginPath(),e.ellipse(Math.cos(a)*t*.52,Math.sin(a)*t*.52,t*.42,t*.26,a,0,Math.PI*2),e.stroke()}e.beginPath(),e.arc(0,0,t*.19,0,Math.PI*2),e.stroke()},coffee:(e,r)=>{let t=r*.5;e.beginPath(),e.ellipse(0,0,t*.6,t*.9,0,0,Math.PI*2),e.stroke(),e.beginPath(),e.moveTo(0,-t*.84),e.bezierCurveTo(t*.34,-t*.3,-t*.34,t*.3,0,t*.84),e.stroke()},midnight:(e,r)=>{let t=r*.5;e.beginPath();for(let n=0;n<10;n++){let a=n%2===0?t:t*.4,o=n/10*Math.PI*2-Math.PI/2,i=Math.cos(o)*a,c=Math.sin(o)*a;n===0?e.moveTo(i,c):e.lineTo(i,c)}e.closePath(),e.stroke()}},li=e=>{let r=e.split(",").map(t=>parseFloat(t.trim()));return[r[0]||0,r[1]||0,r[2]||0]};po=new Set,uo=new Set;nd=83,hi=[{k:.45,hop:1},{k:1.15,hop:.55},{k:.95,hop:.12},{k:1,hop:0}],di=7,ad=.28;sd=.3;cd=ft.default.memo(function({seed:r="",theme:t,dir:n,waitForContent:a=!1}){let o=(0,ft.useRef)(null),i=(0,ft.useRef)(!1),c=(0,ft.useRef)(0),s=(0,ft.useRef)(null),l=(0,ft.useRef)(0),h=(0,ft.useRef)(0),d=(0,ft.useRef)(a);return(0,ft.useEffect)(()=>{let u=o.current;if(!u)return;let p=ui(r||"kiku"),g=0,f=(T,A,G,B)=>X=>{let xe=X-T,se=Math.min(1,xe/A),V=u.clientWidth,re=u.clientHeight;if(V&&re){let W=Math.min(window.devicePixelRatio||1,3),_=Math.round(V*W),J=Math.round(re*W);(u.width!==_||u.height!==J)&&(u.width=_,u.height=J);let C=u.getContext("2d");C&&(C.setTransform(W,0,0,W,0,0),Nr(C,G,V,re,-1,1,se))}if(se<1)c.current=requestAnimationFrame(f(T,A,G,B));else{i.current=!1;let W=u.clientWidth,_=u.clientHeight,J=u.getContext("2d");if(J&&W&&_){let C=Math.min(window.devicePixelRatio||1,3);J.setTransform(C,0,0,C,0,0),Nr(J,G,W,_,-1)}}},k=()=>{let T=u.clientWidth,A=u.clientHeight;if(!T||!A)return;let G=Math.min(window.devicePixelRatio||1,3),B=u.getContext("2d");if(!B)return;let X=getComputedStyle(u),xe=X.getPropertyValue("--hsk-doodle-ink").trim()||"31,31,31",se=X.getPropertyValue("--hsk-doodle-tint").trim()||xe,V=n==="rtl"||X.direction==="rtl"||u.closest('[dir="rtl"]')!==null,re=typeof window<"u"?Math.max(A,window.innerHeight||0):A,W=bi(T,re,xe,se,p,V,t,A);s.current=W,l.current=T,h.current=re;let _=Math.round(T*G),J=Math.round(A*G);if((u.width!==_||u.height!==J)&&(u.width=_,u.height=J),B.setTransform(G,0,0,G,0,0),d.current){B.clearRect(0,0,T,A);return}if(window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches){Nr(B,W,T,A,-1);return}cancelAnimationFrame(c.current),i.current=!0;let L=1500,I=performance.now();c.current=requestAnimationFrame(f(I,L,W,V))},z=()=>{let T=s.current,A=u.clientWidth,G=u.clientHeight;if(T&&A===l.current&&G<=h.current){if(i.current||d.current||!G)return;let B=u.getContext("2d");if(!B)return;let X=Math.min(window.devicePixelRatio||1,3);u.width=Math.round(A*X),u.height=Math.round(G*X),B.setTransform(X,0,0,X,0,0),Nr(B,T,A,G,-1);return}clearTimeout(g),g=window.setTimeout(k,20)};k();let b=()=>{d.current&&(d.current=!1,k())};uo.add(b);let N=d.current?window.setTimeout(b,2e3):0,M=new ResizeObserver(z);M.observe(u);let E=window.matchMedia?.("(prefers-color-scheme: dark)"),F=()=>{k()};E?.addEventListener?.("change",F);let w=0,H=()=>{let T=s.current,A=u.getContext("2d"),G=u.clientWidth,B=u.clientHeight;if(!T||!A||!G||!B)return;let X=Math.min(window.devicePixelRatio||1,3);A.setTransform(X,0,0,X,0,0),Nr(A,T,G,B,-1)},Q=({x:T,y:A,strength:G})=>{let B=s.current;if(!B||window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches)return;cancelAnimationFrame(c.current),i.current=!1,clearTimeout(w);let X=u.getBoundingClientRect(),xe=T-X.left,se=A-X.top,V=gn(performance.now()*997|0),re=(C,L)=>Math.max(-L,Math.min(L,C)),W=B.map(C=>{let L=C.dx??0,I=C.dy??0,K=C.dr??0,x=C.x-xe,R=C.y-se,m=Math.hypot(x,R)||1,Z=G*(.18+.82*Math.exp(-m/220)),D=Z*(.6+V()*1.8),O=re(L+x/m*D+(V()-.5)*Z*2,di),S=re(I+R/m*D+(V()-.5)*Z*2,di),y=re(K+(V()-.5)*Z*.12,ad);return{g:C,fx:L,fy:I,fr:K,tx:O,ty:S,tr:y,lift:Z*.09}}),_=0,J=()=>{let C=hi[_];for(let L of W)L.g.dx=L.fx+(L.tx-L.fx)*C.k,L.g.dy=L.fy+(L.ty-L.fy)*C.k,L.g.dr=L.fr+(L.tr-L.fr)*C.k,L.g.hop=L.lift*C.hop;H(),++_<hi.length&&(w=window.setTimeout(J,nd))};J()};return po.add(Q),()=>{po.delete(Q),uo.delete(b),clearTimeout(N),clearTimeout(w),clearTimeout(g),cancelAnimationFrame(c.current),i.current=!1,M.disconnect(),E?.removeEventListener?.("change",F)}},[r,t,n]),(0,xn.jsx)("canvas",{className:"hsk-cb-doodles",ref:o,"aria-hidden":"true"})}),kn=3,pi=1800;hd=300;da=cd});function yn(e,r){if(!e)return;let t=e.trim();if(!t)return;let n=t.toLowerCase(),a=ua.find(c=>c.value.toLowerCase()===n||c.native.toLowerCase()===n||c.tag===n);if(a)return a.native;if(pa[n]?.endonym)return pa[n].endonym;let o=Object.values(pa).find(c=>c.endonym?.toLowerCase()===n);if(o?.endonym)return o.endonym;let i=r||(n.length<=3?n:void 0);if(i&&typeof Intl<"u"&&Intl.DisplayNames)try{let s=new Intl.DisplayNames([i],{type:"language"}).of(i);if(s&&s.toLowerCase()!==i.toLowerCase())return s}catch{}return t}function fi(e){for(let r of e){let t=r.codePointAt(0)??0;if(t>=1424&&t<=2303||t>=64285&&t<=65023||t>=65136&&t<=65279)return!0}return!1}function ki(e){let r=e.trim();return r?r.charAt(0).toUpperCase()+r.slice(1):"\u2026"}function Ir(e){if(!e)return{nativeName:"\u2026",preparing:"Preparing\u2026",changeLang:"\u2190",rtl:!1,known:!0};let r=e.trim().toLowerCase(),t=Object.entries(pa).find(([i,c])=>i===r||c.endonym?.toLowerCase()===r||yn(i)?.toLowerCase()===r);if(t)return{nativeName:t[1].endonym||yn(e)||ki(e),preparing:t[1].preparing,changeLang:t[1].changeLang,rtl:!!t[1].rtl||fi(t[1].preparing),known:!0};let n=yn(e)||e,a=ki(n),o=fi(a);return{nativeName:a,preparing:`Preparing in ${a}\u2026`,changeLang:o?"\u062A\u063A\u064A\u064A\u0631":"Change",rtl:o,known:!1}}function xi(e){let r=e.trim();if(!r||r.length>40||r.includes("?"))return null;r=r.replace(/^(hi|hey|hello|yo)[,!.\s]+/i,""),r=r.replace(/^(i['’]?m|im|my name is|call me|it['’]?s|this is|name['’]?s)\s+/i,""),r=r.trim().replace(/[.!,]+$/,"");let t=r.split(/\s+/);if(t.length===0||t.length>3||!/^[\p{L}][\p{L}\-'’ ]{0,30}$/u.test(r))return null;let n=r.toLowerCase();if(["phone","laptop","tv","cheap","best","under","buy","search","find","show","need","want","price","sofa","shoe","headphone","camera","gift","help"].some(i=>n.includes(i)))return null;let o=t[0];return o.charAt(0).toUpperCase()+o.slice(1)}var bo,wn,ua,pa,Cn,fo,yr,wt,ko,wr,gi,vi,yi,go,It=Se(()=>{"use strict";bo=Wt(require("react")),wn=[],ua=[{value:"English",native:"English",tag:"en",rtl:!1},{value:"Chinese",native:"\u4E2D\u6587",tag:"zh",rtl:!1},{value:"Spanish",native:"Espa\xF1ol",tag:"es",rtl:!1},{value:"Arabic",native:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",tag:"ar",rtl:!0},{value:"Hindi",native:"\u0939\u093F\u0928\u094D\u0926\u0940",tag:"hi",rtl:!1},{value:"French",native:"Fran\xE7ais",tag:"fr",rtl:!1},{value:"Swahili",native:"Kiswahili",tag:"sw",rtl:!1},{value:"Portuguese",native:"Portugu\xEAs",tag:"pt",rtl:!1},{value:"Japanese",native:"\u65E5\u672C\u8A9E",tag:"ja",rtl:!1},{value:"Urdu",native:"\u0627\u0631\u062F\u0648",tag:"ur",rtl:!0}];pa={english:{preparing:"Preparing in English\u2026",changeLang:"Change language",endonym:"English"},swahili:{preparing:"Inatayarisha kwa Kiswahili\u2026",changeLang:"Badilisha lugha",endonym:"Kiswahili"},french:{preparing:"Configuration en fran\xE7ais\u2026",changeLang:"Changer de langue",endonym:"Fran\xE7ais"},spanish:{preparing:"Configurando en espa\xF1ol\u2026",changeLang:"Cambiar idioma",endonym:"Espa\xF1ol"},arabic:{preparing:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0639\u062F\u0627\u062F \u0628\u0627\u0644\u0644\u063A\u0629 \u0627\u0644\u0639\u0631\u0628\u064A\u0629\u2026",changeLang:"\u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u0644\u063A\u0629",rtl:!0,endonym:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629"},portuguese:{preparing:"Configurando em portugu\xEAs\u2026",changeLang:"Alterar idioma",endonym:"Portugu\xEAs"},hindi:{preparing:"\u0939\u093F\u0928\u094D\u0926\u0940 \u092E\u0947\u0902 \u0924\u0948\u092F\u093E\u0930 \u0915\u093F\u092F\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948\u2026",changeLang:"\u092D\u093E\u0937\u093E \u092C\u0926\u0932\u0947\u0902",endonym:"\u0939\u093F\u0928\u094D\u0926\u0940"},chinese:{preparing:"\u6B63\u5728\u51C6\u5907\u4E2D\u6587\u73AF\u5883\u2026",changeLang:"\u66F4\u6539\u8BED\u8A00",endonym:"\u4E2D\u6587"},urdu:{preparing:"\u0627\u0631\u062F\u0648 \u0645\u06CC\u06BA \u062A\u06CC\u0627\u0631\u06CC \u062C\u0627\u0631\u06CC \u06C1\u06D2\u2026",changeLang:"\u0632\u0628\u0627\u0646 \u062A\u0628\u062F\u06CC\u0644 \u06A9\u0631\u06CC\u06BA",rtl:!0,endonym:"\u0627\u0631\u062F\u0648"},japanese:{preparing:"\u65E5\u672C\u8A9E\u3092\u8A2D\u5B9A\u4E2D\u2026",changeLang:"\u8A00\u8A9E\u3092\u5909\u66F4",endonym:"\u65E5\u672C\u8A9E"},german:{preparing:"Wird auf Deutsch eingerichtet\u2026",changeLang:"Sprache \xE4ndern",endonym:"Deutsch"},italian:{preparing:"Configurazione in italiano\u2026",changeLang:"Cambia lingua",endonym:"Italiano"},russian:{preparing:"\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430 \u043D\u0430 \u0440\u0443\u0441\u0441\u043A\u043E\u043C\u2026",changeLang:"\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u044F\u0437\u044B\u043A",endonym:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"},korean:{preparing:"\uD55C\uAD6D\uC5B4\uB85C \uC124\uC815 \uC911\u2026",changeLang:"\uC5B8\uC5B4 \uBCC0\uACBD",endonym:"\uD55C\uAD6D\uC5B4"},turkish:{preparing:"T\xFCrk\xE7e olarak haz\u0131rlan\u0131yor\u2026",changeLang:"Dili de\u011Fi\u015Ftir",endonym:"T\xFCrk\xE7e"},vietnamese:{preparing:"\u0110ang thi\u1EBFt l\u1EADp b\u1EB1ng Ti\u1EBFng Vi\u1EC7t\u2026",changeLang:"\u0110\u1ED5i ng\xF4n ng\u1EEF",endonym:"Ti\u1EBFng Vi\u1EC7t"},indonesian:{preparing:"Menyiapkan dalam Bahasa Indonesia\u2026",changeLang:"Ubah bahasa",endonym:"Bahasa Indonesia"},malay:{preparing:"Menyediakan dalam Bahasa Melayu\u2026",changeLang:"Tukar bahasa",endonym:"Bahasa Melayu"},bahasa:{preparing:"Menyediakan dalam Bahasa Melayu\u2026",changeLang:"Tukar bahasa",endonym:"Bahasa Melayu"},polish:{preparing:"Przygotowywanie w j\u0119zyku polskim\u2026",changeLang:"Zmie\u0144 j\u0119zyk",endonym:"Polski"},dutch:{preparing:"Instellen in het Nederlands\u2026",changeLang:"Taal wijzigen",endonym:"Nederlands"},thai:{preparing:"\u0E01\u0E33\u0E25\u0E31\u0E07\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32\u0E40\u0E1B\u0E47\u0E19\u0E20\u0E32\u0E29\u0E32\u0E44\u0E17\u0E22\u2026",changeLang:"\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E20\u0E32\u0E29\u0E32",endonym:"\u0E44\u0E17\u0E22"},bengali:{preparing:"\u09AC\u09BE\u0982\u09B2\u09BE\u09AF\u09BC \u09AA\u09CD\u09B0\u09B8\u09CD\u09A4\u09C1\u09A4 \u0995\u09B0\u09BE \u09B9\u099A\u09CD\u099B\u09C7\u2026",changeLang:"\u09AD\u09BE\u09B7\u09BE \u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8 \u0995\u09B0\u09C1\u09A8",endonym:"\u09AC\u09BE\u0982\u09B2\u09BE"},tamil:{preparing:"\u0BA4\u0BAE\u0BBF\u0BB4\u0BBF\u0BB2\u0BCD \u0BA4\u0BAF\u0BBE\u0BB0\u0BCD \u0B9A\u0BC6\u0BAF\u0BCD\u0BAF\u0BAA\u0BCD\u0BAA\u0B9F\u0BC1\u0B95\u0BBF\u0BB1\u0BA4\u0BC1\u2026",changeLang:"\u0BAE\u0BCA\u0BB4\u0BBF\u0BAF\u0BC8 \u0BAE\u0BBE\u0BB1\u0BCD\u0BB1\u0BB5\u0BC1\u0BAE\u0BCD",endonym:"\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD"},telugu:{preparing:"\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41\u0C32\u0C4B \u0C38\u0C3F\u0C26\u0C4D\u0C27\u0C02 \u0C1A\u0C47\u0C38\u0C4D\u0C24\u0C4B\u0C02\u0C26\u0C3F\u2026",changeLang:"\u0C2D\u0C3E\u0C37\u0C28\u0C41 \u0C2E\u0C3E\u0C30\u0C4D\u0C1A\u0C02\u0C21\u0C3F",endonym:"\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41"},persian:{preparing:"\u062F\u0631 \u062D\u0627\u0644 \u0622\u0645\u0627\u062F\u0647\u200C\u0633\u0627\u0632\u06CC \u0628\u0647 \u0632\u0628\u0627\u0646 \u0641\u0627\u0631\u0633\u06CC\u2026",changeLang:"\u062A\u063A\u06CC\u06CC\u0631 \u0632\u0628\u0627\u0646",rtl:!0,endonym:"\u0641\u0627\u0631\u0633\u06CC"},farsi:{preparing:"\u062F\u0631 \u062D\u0627\u0644 \u0622\u0645\u0627\u062F\u0647\u200C\u0633\u0627\u0632\u06CC \u0628\u0647 \u0632\u0628\u0627\u0646 \u0641\u0627\u0631\u0633\u06CC\u2026",changeLang:"\u062A\u063A\u06CC\u06CC\u0631 \u0632\u0628\u0627\u0646",rtl:!0,endonym:"\u0641\u0627\u0631\u0633\u06CC"},greek:{preparing:"\u03A1\u03CD\u03B8\u03BC\u03B9\u03C3\u03B7 \u03C3\u03C4\u03B1 \u03B5\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC\u2026",changeLang:"\u0391\u03BB\u03BB\u03B1\u03B3\u03AE \u03B3\u03BB\u03CE\u03C3\u03C3\u03B1\u03C2",endonym:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"},hebrew:{preparing:"\u05DE\u05D2\u05D3\u05D9\u05E8 \u05D1\u05E2\u05D1\u05E8\u05D9\u05EA\u2026",changeLang:"\u05E9\u05E0\u05D4 \u05E9\u05E4\u05D4",rtl:!0,endonym:"\u05E2\u05D1\u05E8\u05D9\u05EA"},burmese:{preparing:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C\u1016\u103C\u1004\u1037\u103A \u1015\u103C\u1004\u103A\u1006\u1004\u103A\u1014\u1031\u101E\u100A\u103A\u2026",changeLang:"\u1018\u102C\u101E\u102C\u1005\u1000\u102C\u1038\u1015\u103C\u1031\u102C\u1004\u103A\u1038\u101B\u1014\u103A",endonym:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C"},burma:{preparing:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C\u1016\u103C\u1004\u1037\u103A \u1015\u103C\u1004\u103A\u1006\u1004\u103A\u1014\u1031\u101E\u100A\u103A\u2026",changeLang:"\u1018\u102C\u101E\u102C\u1005\u1000\u102C\u1038\u1015\u103C\u1031\u102C\u1004\u103A\u1038\u101B\u1014\u103A",endonym:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C"},myanmar:{preparing:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C\u1016\u103C\u1004\u1037\u103A \u1015\u103C\u1004\u103A\u1006\u1004\u103A\u1014\u1031\u101E\u100A\u103A\u2026",changeLang:"\u1018\u102C\u101E\u102C\u1005\u1000\u102C\u1038\u1015\u103C\u1031\u102C\u1004\u103A\u1038\u101B\u1014\u103A",endonym:"\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C"},khmer:{preparing:"\u1780\u17C6\u1796\u17BB\u1784\u179A\u17C0\u1794\u1785\u17C6\u1787\u17B6\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A\u2026",changeLang:"\u1794\u17D2\u178F\u17BC\u179A\u1797\u17B6\u179F\u17B6",endonym:"\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A"},cambodian:{preparing:"\u1780\u17C6\u1796\u17BB\u1784\u179A\u17C0\u1794\u1785\u17C6\u1787\u17B6\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A\u2026",changeLang:"\u1794\u17D2\u178F\u17BC\u179A\u1797\u17B6\u179F\u17B6",endonym:"\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A"},swedish:{preparing:"St\xE4ller in p\xE5 svenska\u2026",changeLang:"Byt spr\xE5k",endonym:"Svenska"},svenska:{preparing:"St\xE4ller in p\xE5 svenska\u2026",changeLang:"Byt spr\xE5k",endonym:"Svenska"},sv:{preparing:"St\xE4ller in p\xE5 svenska\u2026",changeLang:"Byt spr\xE5k",endonym:"Svenska"},kikuyu:{preparing:"G\u0129k\u0169y\u0169 g\u0129g\u0129thondekwo\u2026",changeLang:"Cenjia r\u0169thiomi",endonym:"G\u0129k\u0169y\u0169"},gikuyu:{preparing:"G\u0129k\u0169y\u0169 g\u0129g\u0129thondekwo\u2026",changeLang:"Cenjia r\u0169thiomi",endonym:"G\u0129k\u0169y\u0169"},akan:{preparing:"Y\u025Bresiesie w\u0254 Akan mu\u2026",changeLang:"Sesa kasa",endonym:"Akan"},twi:{preparing:"Y\u025Bresiesie w\u0254 Twi mu\u2026",changeLang:"Sesa kasa",endonym:"Twi"},yoruba:{preparing:"Ngbaradi ni \xC8d\xE8 Yor\xF9b\xE1\u2026",changeLang:"Yi ede pada",endonym:"\xC8d\xE8 Yor\xF9b\xE1"},amharic:{preparing:"\u1260\u12A0\u121B\u122D\u129B \u1260\u1218\u12D8\u130B\u1300\u1275 \u120B\u12ED\u2026",changeLang:"\u124B\u1295\u124B \u1240\u12ED\u122D",endonym:"\u12A0\u121B\u122D\u129B"},somali:{preparing:"Diyaarinta af Soomaali\u2026",changeLang:"Beddel luqadda",endonym:"Af-Soomaali"},soomaali:{preparing:"Diyaarinta af Soomaali\u2026",changeLang:"Beddel luqadda",endonym:"Af-Soomaali"},"af-soomaali":{preparing:"Diyaarinta af Soomaali\u2026",changeLang:"Beddel luqadda",endonym:"Af-Soomaali"},so:{preparing:"Diyaarinta af Soomaali\u2026",changeLang:"Beddel luqadda",endonym:"Af-Soomaali"},hausa:{preparing:"Shirya cikin Hausa\u2026",changeLang:"Canja harshe",endonym:"Hausa"},zulu:{preparing:"Ilungiselela ngesiZulu\u2026",changeLang:"Shintsha ulimi",endonym:"isiZulu"},oromo:{preparing:"Afaan Oromootiin qophaa'aa jira\u2026",changeLang:"Afaan jijjiiri",endonym:"Afaan Oromoo"},luganda:{preparing:"Tuteekateeka mu Oluganda\u2026",changeLang:"Kyusa olulimi",endonym:"Oluganda"},igbo:{preparing:"Na-akwadebe na As\u1EE5s\u1EE5 Igbo\u2026",changeLang:"Gbanwee as\u1EE5s\u1EE5",endonym:"As\u1EE5s\u1EE5 Igbo"},xhosa:{preparing:"Ilungiselela ngesiXhosa\u2026",changeLang:"Tshintsha ulwimi",endonym:"isiXhosa"},kinyarwanda:{preparing:"Guteza imbere mu Kinyarwanda\u2026",changeLang:"Hindura ururimi",endonym:"Ikinyarwanda"},lingala:{preparing:"Kozala na Ling\xE1la\u2026",changeLang:"Bongola lok\xF3t\xE1",endonym:"Ling\xE1la"},shona:{preparing:"Kugadzirira mu chiShona\u2026",changeLang:"Chinja mutauro",endonym:"chiShona"},tigrinya:{preparing:"\u1265\u1275\u130D\u122D\u129B \u12A3\u1265 \u121D\u12F5\u120B\u12CD \u12ED\u122D\u12A8\u1265\u2026",changeLang:"\u124B\u1295\u124B \u121D\u1255\u12EB\u122D",endonym:"\u1275\u130D\u122D\u129B"},wolof:{preparing:"Waajal ci Wolof\u2026",changeLang:"Soppi l\xE0kk",endonym:"Wolof"},afrikaans:{preparing:"Berei voor in Afrikaans\u2026",changeLang:"Verander taal",endonym:"Afrikaans"}};Cn=[{name:"Puck",trait:"Upbeat",gender:"male"},{name:"Charon",trait:"Informative",gender:"male"},{name:"Kore",trait:"Firm",gender:"female"},{name:"Aoede",trait:"Breezy",gender:"female"},{name:"Zephyr",trait:"Bright",gender:"female"},{name:"Fenrir",trait:"Excitable",gender:"male"},{name:"Leda",trait:"Youthful",gender:"female"},{name:"Orus",trait:"Firm",gender:"male"},{name:"Callirrhoe",trait:"Easy-going",gender:"female"},{name:"Autonoe",trait:"Bright",gender:"female"},{name:"Enceladus",trait:"Breathy",gender:"male"},{name:"Iapetus",trait:"Clear",gender:"male"},{name:"Umbriel",trait:"Easy-going",gender:"male"},{name:"Algieba",trait:"Smooth",gender:"male"},{name:"Despina",trait:"Smooth",gender:"female"},{name:"Erinome",trait:"Clear",gender:"female"},{name:"Algenib",trait:"Gravelly",gender:"male"},{name:"Rasalgethi",trait:"Informative",gender:"male"},{name:"Laomedeia",trait:"Upbeat",gender:"female"},{name:"Achernar",trait:"Soft",gender:"female"},{name:"Alnilam",trait:"Firm",gender:"male"},{name:"Schedar",trait:"Even",gender:"male"},{name:"Gacrux",trait:"Mature",gender:"female"},{name:"Pulcherrima",trait:"Forward",gender:"female"},{name:"Achird",trait:"Friendly",gender:"male"},{name:"Zubenelgenubi",trait:"Casual",gender:"male"},{name:"Vindemiatrix",trait:"Gentle",gender:"female"},{name:"Sadachbia",trait:"Lively",gender:"male"},{name:"Sadaltager",trait:"Knowledgeable",gender:"male"},{name:"Sulafat",trait:"Warm",gender:"female"}],fo="hsk-live-voice",yr={langPlaceholder:"Type your language\u2026",nameStepTitle:"Good to meet you.",nameStepAsk:"What should I call you?",namePlaceholder:"Type your name\u2026",howShouldResultsLook:"How do you want to see results?",entityLangIntro:"I will write to you in {lang}. Names stay as this website wrote them. For the other details, choose below.",asWritten:"Same as the website",inLanguage:"In {lang}",namesAsWritten:"Details stay exactly as the website wrote them.",detailsTranslated:"Details are translated. Numbers and links do not change.",entityLangPlaceholder:"Choose one, then press Continue\u2026",termsStepTitle:"Privacy and terms",termsStepSubtitle:"Please read how kiku works on this website.",termsPiiTitle:"Your contact details",termsPiiDesc:"kiku never asks for your email, phone number or real name. Any name or nickname is fine.",termsSessionTitle:"A random code",termsSessionDesc:"Your browser keeps a random code so kiku can remember your conversation. The code is not linked to your name.",termsMemoryTitle:"What is kept",termsMemoryDesc:"Your questions (not kiku's answers) are kept so this website can improve. Things you save with @kiku are kept at mimi.akropolys.cloud, and only your secret key opens them.",termsCookieTitle:"This website's own rules",termsCookieDesc:"This website may use cookies or collect more information. kiku does not control this.",termsAiTitle:"From this website, explained by AI",termsAiDesc:"kiku answers from what this website really lists. The facts are the website's own; how kiku summarises, compares or translates them is AI and may read them differently. Check anything that matters on the website itself.",termsAgreeButton:"I agree",termsAgreeCounting:"I agree ({seconds}s)",nameStepHint:"Any name or nickname is fine.",privacyMore:"Read our full terms at",continueButton:"Continue",termsPlaceholder:"Please read the notes above\u2026",allSet:"You are ready, {name}.",replyingOriginal:"I will write to you in {lang}. Results stay as this website wrote them. Ask me anything.",replyingTranslated:"I will write to you in {lang}. Results will be translated too. Ask me anything.",greetReturning:"Hello, {name}.",greetReturningLead:"What can I find for you today?",defaultPlaceholder:"Ask me anything\u2026"},wt={back:"Back",langPlaceholder:"Type your language\u2026",nameStepTitle:"Good to meet you.",nameStepAsk:"What should I call you?",namePlaceholder:"Type your name\u2026",attachImage:"Attach a photo",vizUnavailable:"The preview could not be loaded.",vizDisclaimerImage:"Generated using Artificial Intelligence \u2014 colours, size and placement may differ from the real product.",vizDisclaimerVideo:"Generated using Artificial Intelligence \u2014 colours, size and movement may differ from the real product.",calcDisclaimer:"This is a calculation from live figures, not a guarantee \u2014 the market can move against it.",staleTitle:"No longer available",staleRemoved:"{title} has been removed and is no longer on offer.",staleUnavailable:"{title} is currently unavailable.",keyPastePrompt:"Paste your public id \u2014 or create one",keyPastePlaceholder:"your public id\u2026",keyUseMine:"Use my id",keyCreating:"Creating\u2026",keyCreateNew:"I'm new \u2014 create one",keySecretTitle:"Your secret key \u2014 shown once",keyDismiss:"Dismiss",keyCopySecret:"Copy",keyCopied:"Copied",keySecretHint:"Keep it private. It unlocks your memory.",keyPublicTitle:"Your public id",keyCopyId:"Copy id",greetReturning:"Hello, {name}.",greetReturningLead:"What can I find for you today?",howShouldResultsLook:"How do you want to see results?",entityLangIntro:"I will write to you in {lang}. Names stay as this website wrote them. For the other details, choose below.",asWritten:"Same as the website",inLanguage:"In {lang}",namesAsWritten:"Details stay exactly as the website wrote them.",detailsTranslated:"Details are translated. Numbers and links do not change.",entityLangPlaceholder:"Choose one, then press Continue\u2026",termsStepTitle:"Privacy and terms",termsStepSubtitle:"Please read how kiku works on this website.",termsPiiTitle:"Your contact details",termsPiiDesc:"kiku never asks for your email, phone number or real name. Any name or nickname is fine.",termsSessionTitle:"A random code",termsSessionDesc:"Your browser keeps a random code so kiku can remember your conversation. The code is not linked to your name.",termsMemoryTitle:"What is kept",termsMemoryDesc:"Your questions (not kiku's answers) are kept so this website can improve. Things you save with @kiku are kept at mimi.akropolys.cloud, and only your secret key opens them.",termsCookieTitle:"This website's own rules",termsCookieDesc:"This website may use cookies or collect more information. kiku does not control this.",termsAiTitle:"From this website, explained by AI",termsAiDesc:"kiku answers from what this website really lists. The facts are the website's own; how kiku summarises, compares or translates them is AI and may read them differently. Check anything that matters on the website itself.",termsAgreeButton:"I agree",termsAgreeCounting:"I agree ({seconds}s)",nameStepHint:"Any name or nickname is fine.",privacyMore:"Read our full terms at",continueButton:"Continue",termsPlaceholder:"Please read the notes above\u2026",allSet:"You are ready, {name}.",replyingTranslated:"I will write to you in {lang}. Results will be translated too. Ask me anything.",replyingOriginal:"I will write to you in {lang}. Results stay as this website wrote them. Ask me anything.",defaultPlaceholder:"Ask me anything\u2026",voiceListening:"Listening\u2026 tap the mic to stop",voiceSending:"Got it \u2014 sending\u2026",voiceModeStart:"Hands-free conversation",voiceModeExit:"Leave hands-free",voicePhaseListening:"Listening",voicePhaseThinking:"Thinking",micDenied:"Microphone blocked. Allow mic access for this site, then try again.",micInsecure:"Voice needs a secure (https) connection.",micMissing:"No microphone found.",micLangUnsupported:"This browser cannot transcribe that language yet. Type instead.",micNetwork:"Couldn't reach voice. Try again in a moment.",voiceUnavailable:"Voice is unavailable right now. Try again in a moment.",voiceLimitReached:"You've used up today's voice time. It resets in a day \u2014 chat still works.",voiceSiteLimit:"Voice is out of allowance on this site for now. Chat still works.",voiceIdleEnded:"Voice closed after a quiet minute. Tap the mic to talk again.",voiceSessionEnded:"Voice session ended. Tap the mic to talk again.",voicePhotoFailed:"That photo couldn't be added. Try another one.",voiceAttachPhoto:"Attach a photo",voicePickerLabel:"Choose a voice",voiceFemale:"Female",voiceMale:"Male",voiceNewChat:"New voice chat",pillVoice:"{n} min voice",pillImages:"{n} images",pillVideos:"{n} videos",pillReplies:"{n} replies",micNoSpeech:"Didn't catch anything. Try again, a little closer to the mic.",micFailed:"Couldn't hear that. Try again.",clearChat:"Clear chat",thinking:"Thinking",thoughtForSeconds:"Thought for {duration}",thoughtProcess:"Thought process",reachingTeam:"Getting a person",passedToTeam:"Passed to a person",withTeam:"Sent to the team \xB7 a person will reply here",repliedIn:"Replied in {duration}",backWithKiku:"Kiku is back with you",teamClosed:"The team closed this conversation",teamJoined:"Another team member joined the conversation",leaveHumanWarning:"A person is replying here.",leaveHumanStay:"Stay",leaveHumanKeep:"Keep for later",leaveHumanConfirm:"End request",requestsTitle:"Your requests",requestWaiting:"Waiting for a person",requestHuman:"With a person",requestKiku:"Answered",requestClosed:"Closed",requestNewReply:"New reply",captureAndRemember:"kiku \u2014 capture & remember",captureCurrentPage:"Capture current page",captureAll:"Capture all ({count})",whatHaveYouSaved:"What have you saved?",deleteThis:"Delete this",errShopperReplyLimit:"You've reached this site's reply limit.",errAccessRevoked:"Your access to the assistant has been revoked on this website.",errAccountRequired:"Please create an account to continue using the chat assistant.",errStreamInterrupted:"The reply was interrupted. Please try again.",errNetwork:"The assistant couldn't respond just now \u2014 please try again in a moment.",errGeneric:"Something went wrong. Please try again.",vizWorking:"Visualizing\u2026",vizMarkEdit:"Mark & edit",swatchTarget:"Your colour",markupCancel:"Cancel",markupSketch:"Sketch",markupPin:"Edit Pin",markupPinLabel:"What should happen here?",markupPinLabelHint:"e.g. move the sofa here",markupSketchHint:"Sketch around an area, then drop a pin saying what to do with it.",markupRemovePin:"Remove pin",markupPinHint:"Drop a pin and say what should happen there. Drag to move it. Up to 4 pins.",markupSelect:"Select outline",markupCloseOutline:"Close outline",markupOutlineHint:"Tap around the item, then close the outline. Undo removes the last point.",markupSelectedHint:"Drag the outline points to refine, then drop a pin saying what to do with it.",markupEraser:"Eraser",markupUndo:"Undo",markupClear:"Clear",markupSend:"Send",markupDialogLabel:"Mark up image",markupError:"Couldn't process this image \u2014 try a newer visualization.",markupLoadError:"This image can't be edited here.",markupLoading:"Loading image\u2026",openMemory:"Open my memory on MiMi",errTooManyRequests:"The assistant is currently receiving too many requests. Please try again in a few moments.",errTokenLimit:"You've reached your usage limit. Please update your billing limits in your dashboard to continue.",statusSent:"Sent",statusStopped:"Sent \xB7 reply stopped",queuedWaiting:"Queued",queuedSendNow:"Send now",jumpToLatest:"Scroll to latest",timelineLabel:"Questions in this conversation",voiceConnecting:"Connecting \u2014 wait for the tone before speaking",stoppedByYou:"You stopped this response.",stoppedInterrupted:"This response was interrupted.",continueGenerating:"Continue generating",generateResponse:"Generate response",pillCompareTop2:"Compare top 2",pillCompareTop2Query:"Compare the {a} and {b}",pillMoreOn:"More on {name}",pillMoreOnQuery:"Tell me more about the {name}",pillSimilarOptions:"Similar options",pillSimilarOptionsQuery:"Show me more like the {name}",pillWhichBest:"Which is best?",pillWhichBestQuery:"Which one would you recommend and why?",pillFindAlternatives:"Find alternatives",pillFindAlternativesQuery:"What are good alternatives to the {name}?",pillShowPopular:"Show popular items",pillShowPopularQuery:"What are your most popular items?",pillRecommend:"Recommend something",pillRecommendQuery:"What do you recommend for me?",cardClickAnswer:"The {name}",cardClickQuery:"Tell me more about the {name}{details} \u2014 what are its key details, who is it best suited for, and what should I know?",displayCapture:"capture {name}",displayCaptureAll:"capture all ({count} items)",displayViewHistory:"what have you saved?",displayDelete:"delete this",retry:"Retry",edit:"Edit",copy:"Copy",copied:"Copied",msgFailed:"Failed to send"},ko=bo.default.createContext((e,r)=>{let t=wt[e];if(r)for(let[n,a]of Object.entries(r))t=t.split(`{${n}}`).join(a);return t}),wr=()=>bo.default.useContext(ko);gi={shopper_reply_limit:"errShopperReplyLimit",RATE_LIMIT_EXCEEDED:"errShopperReplyLimit",access_revoked:"errAccessRevoked",account_required:"errAccountRequired",stream_interrupted:"errStreamInterrupted"},vi=(e,r)=>{let t=e&&typeof e=="object"?e.code:void 0;if(t&&gi[t])return r(gi[t]);let n="";if(typeof e=="string")n=e;else if(e&&typeof e=="object"&&e.message)n=e.message;else try{n=JSON.stringify(e)}catch{n=String(e)}let a=n.toLowerCase();if(a.includes("429")||a.includes("too many requests")||a.includes("requests per minute limit exceeded")||a.includes("too_many_requests_error")||a.includes("request_quota_exceeded")||a.includes("quota"))return r("errTooManyRequests");if(a.includes("token limit"))return r("errTokenLimit");if(a.includes("failed to fetch")||a.includes("networkerror")||a.includes("request failed"))return r("errNetwork");if(n)try{console.warn("[kiku] untranslated error:",n)}catch{}return r("errGeneric")},yi=()=>typeof window>"u"||window.isSecureContext!==!1,go=15});function Si(e){return e?Ci.get(e)??null:null}function xo(e){if(!e)return Promise.resolve(null);let r=wi.get(e);if(r)return r;let t=Promise.resolve().then(()=>e.baseFont?.()??null).then(n=>(n&&(Ci.set(e,n),Dt(n,0).catch(()=>{})),n)).catch(()=>null);return wi.set(e,t),t}function Mi(e,r,t){e&&(xo(e),r&&jr(e,r,t))}function jr(e,r,t){if(!(!e||!r))try{e.getUIStrings?.(r,t)?.then?.(n=>{n?.font&&Dt(n.font,1200).catch(()=>{})})?.catch?.(()=>{})}catch{}}var wi,Ci,ma=Se(()=>{"use strict";un();wi=new WeakMap,Ci=new WeakMap});function Kr(e){let r=e?dd[e.trim().toLowerCase()]:void 0;return r?{dir:r==="ar"||r==="ur"||r==="fa"?"rtl":"ltr",bcp47:r}:null}function pd(e){let r=/var\(\s*(--[\w-]+)/.exec(e)?.[1];if(!r||typeof document>"u")return"";for(let t of[document.documentElement,document.body]){let n=t?getComputedStyle(t).getPropertyValue(r).trim():"";if(n)return n.split(",")[0].trim()}return""}function Ei({shopperLanguage:e,theme:r,preloadedStrings:t}){let n=(0,Ri.useAkropolysContext)(),a=e?n?.getCachedUIStrings?.(e,wt)??n?.getCachedUIStrings?.(e,yr):null,o=t&&Object.keys(t).length>0?t:a?.strings??{},[i,c]=(0,Je.useState)(()=>o),[s,l]=(0,Je.useState)(()=>!e||t&&Object.keys(t).length>0||!!a?.complete),[h,d]=(0,Je.useState)(()=>t&&Object.keys(t).length>0||a?.complete?e:!e||Kr(e)?.bcp47==="en"?e||"en":""),u=!e||Kr(e)?.bcp47==="en",p=i;t&&Object.keys(t).length>0&&(p={...i,...t});let g=e?`akropolys_ui_dir_${e.toLowerCase()}`:"",[f,k]=(0,Je.useState)(()=>{if(a?.dir)return a.dir==="rtl";let C=Kr(e);if(C)return C.dir==="rtl";if(Ir(e)?.rtl)return!0;if(typeof window>"u"||!g)return!1;try{return localStorage.getItem(g)==="rtl"}catch{return!1}}),[z,b]=(0,Je.useState)(()=>a?.bcp47||Kr(e)?.bcp47||""),[N,M]=(0,Je.useState)(()=>a?.font??null),[E,F]=(0,Je.useState)(()=>Si(n)),[w,H]=(0,Je.useState)(!0),[Q,T]=(0,Je.useState)(!1),A=Je.default.useRef(e),[G,B]=(0,Je.useState)(e);if(e!==G){B(e);let C=Kr(e);C&&(k(C.dir==="rtl"),b(C.bcp47));let L=e?n?.getCachedUIStrings?.(e,wt)??n?.getCachedUIStrings?.(e,yr):null,I=t&&Object.keys(t).length>0?t:L?.strings;I&&Object.keys(I).length>0&&(c(I),p=I,L&&(L.font&&M(L.font),L.dir&&k(L.dir==="rtl"),L.bcp47&&b(L.bcp47)),L?.font&&Dt(L.font),T(!Ja([L?.font?.family,E?.family].filter(K=>!!K),I)),d(e),l(!0))}let X=u||!Q&&(h.toLowerCase()===e.toLowerCase()&&s||Object.keys(p).length>0);(0,Je.useEffect)(()=>{if(!e){b(""),M(null),c({}),d(""),l(!0),k(!1);return}let C=Kr(e),L=Ir(e),I=C?.bcp47==="en",K=!1,x=(Z,D)=>{let O=[Z?.family,E?.family].filter(S=>!!S);if(e===A.current||Ja(O,D)){T(!1);return}T(!0),Za(O,D,Ti).then(()=>{K||T(!1)})},R=n?.getCachedUIStrings?.(e,wt);if(R?.strings&&Object.keys(R.strings).length>0)return c(R.strings),k(R.dir==="rtl"),b(R.bcp47||C?.bcp47||""),R.font&&(Dt(R.font),M(R.font)),x(R.font,R.strings),d(e),l(!0),()=>{K=!0};let m=n?.getCachedUIStrings?.(e,yr);return m?.strings&&Object.keys(m.strings).length>0?(c(m.strings),k(m.dir==="rtl"),b(m.bcp47||C?.bcp47||""),m.font&&(Dt(m.font),M(m.font)),x(m.font,m.strings),d(e),l(!0)):(T(!1),c({}),C?(k(C.dir==="rtl"),b(C.bcp47)):L?.rtl&&k(!0),I||l(!1)),(async()=>{try{if(!m?.strings){let D=await n.getUIStrings?.(e,yr);if(!K&&D?.complete){T(!0),c(S=>({...S,...D.strings})),k(D.dir==="rtl"),b(D.bcp47||C?.bcp47||"");try{localStorage.setItem(g,D.dir)}catch{}D.font&&Dt(D.font);let O=[D.font?.family,E?.family].filter(S=>!!S);await Za(O,D.strings,Ti),K||(D.font&&M(D.font),d(e),l(!0),T(!1))}}let Z=await n.getUIStrings?.(e,wt);!K&&Z?.complete&&(c(D=>({...D,...Z.strings})),Z.font&&(await Dt(Z.font,1200),K||M(Z.font)))}catch{K||(d(e),l(!0),T(!1))}})(),()=>{K=!0}},[e,n,g]),(0,Je.useEffect)(()=>{let C=!1;return(async()=>{try{let L=await xo(n);!C&&L&&F(L)}catch{}C||H(!0)})(),()=>{C=!0}},[n]),Qa(N),Qa(E);let xe=Je.default.useMemo(()=>{let L=(typeof r=="object"&&r?.fontFamily?r.fontFamily:"").split(",")[0].trim(),I=/^var\(/i.test(L),K=L.replace(/^['"]|['"]$/g,""),x=I?pd(L):"",R=I?x?`${x}, `:"":K?`"${K}", `:"";if(N)return`"${N.family}", ${R}"Geist", system-ui, sans-serif`;let m=e?e.trim().toLowerCase():"";if(m==="japanese"||m==="ja"||m==="\u65E5\u672C\u8A9E")return`${R}"Geist", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif`;if(m==="chinese"||m==="zh"||m==="\u4E2D\u6587")return`${R}"Geist", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif`;if(m==="urdu"||m==="ur"||m==="\u0627\u0631\u062F\u0648")return`"Noto Nastaliq Urdu", ${R}"IBM Plex Sans Arabic", "Geist", system-ui, sans-serif`;if(m==="arabic"||m==="ar"||m==="\u0627\u0644\u0639\u0631\u0628\u064A\u0629")return`"IBM Plex Sans Arabic", ${R}"Geist", system-ui, sans-serif`;if(m==="hindi"||m==="hi"||m==="\u0939\u093F\u0928\u094D\u0926\u0940")return`"Hind", ${R}"Geist", system-ui, sans-serif`},[N,e,typeof r=="object"&&r?r.fontFamily:void 0]),se=Je.default.useMemo(()=>{let C=0,L=0;for(let I of Object.values(i))for(let K of I){let x=K.codePointAt(0)??0;x<192||/\p{L}/u.test(K)&&(x<=591?C++:L++)}return L>C},[i]),[V,re]=(0,Je.useState)(0);(0,Je.useEffect)(()=>{if(typeof document>"u"||!document.fonts?.ready)return;let C=!0;return document.fonts.ready.then(()=>{C&&re(L=>L+1)}),()=>{C=!1}},[N]);let W=Je.default.useMemo(()=>{if(!se||typeof document>"u")return!0;let L=(typeof r=="object"&&r?.fontFamily?r.fontFamily:"").split(",")[0].trim();if(!L)return!1;let I="";for(let x of Object.values(i))if(x){I=x;break}if(!I)return!0;let K=I.replace(/\s+/g,"");if(!K)return!0;try{let R=document.createElement("canvas").getContext("2d");if(!R)return!0;let m=L.startsWith("var(")&&getComputedStyle(document.documentElement).getPropertyValue(L.slice(4,-1).trim()).trim()||L;R.font=`16px ${m}, __akropolys_nonexistent_font__`;let Z=R.measureText(K).width;R.font="16px __akropolys_nonexistent_font__";let D=R.measureText(K).width;return Math.abs(Z-D)>1}catch{return!0}},[se,i,typeof r=="object"&&r?r.fontFamily:void 0,V]),_=(0,Je.useCallback)((C,L)=>{let I=p[C]||i[C]||wt[C]||C;if(L)for(let[K,x]of Object.entries(L))I=I.split(`{${K}}`).join(x);return I},[p,i]),J=(0,Je.useCallback)((C,L)=>(p[C]||i[C]||wt[C]||C).split(/(\{[a-zA-Z]+\})/g).map((K,x)=>{let R=K.match(/^\{([a-zA-Z]+)\}$/);return R&&L?.[R[1]]!==void 0?(0,vo.jsx)("bdi",{children:L[R[1]]},x):(0,vo.jsx)(Je.default.Fragment,{children:K},x)}),[p,i]);return{chromeStrings:i,chromeReady:X,isRTL:f,speechLang:z,scriptFont:N,fontStack:xe,isNonLatin:se,hostFontCovers:W,baseFontReady:w,t:_,tNode:J}}var Je,Ri,vo,dd,Ti,zi=Se(()=>{"use strict";Je=Wt(require("react")),Ri=require("@akropolys/sdk");un();ma();It();vo=require("react/jsx-runtime"),dd={english:"en",en:"en",swahili:"sw",kiswahili:"sw",sw:"sw",french:"fr",fran\u00E7ais:"fr",francais:"fr",fr:"fr",spanish:"es",espa\u00F1ol:"es",espanol:"es",es:"es",arabic:"ar",\u0627\u0644\u0639\u0631\u0628\u064A\u0629:"ar",ar:"ar",portuguese:"pt",portugu\u00EAs:"pt",pt:"pt",hindi:"hi",\u0939\u093F\u0928\u094D\u0926\u0940:"hi",hi:"hi",chinese:"zh",\u4E2D\u6587:"zh",zh:"zh",japanese:"ja",\u65E5\u672C\u8A9E:"ja",ja:"ja",urdu:"ur",\u0627\u0631\u062F\u0648:"ur",ur:"ur",burmese:"my",burma:"my",myanmar:"my","\u1019\u103C\u1014\u103A\u1019\u102C":"my","\u1019\u103C\u1014\u103A\u1019\u102C\u1018\u102C\u101E\u102C":"my",my:"my",khmer:"km",cambodian:"km",\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A:"km",\u1781\u17D2\u1798\u17C2\u179A:"km",km:"km",persian:"fa",farsi:"fa",\u0641\u0627\u0631\u0633\u06CC:"fa",fa:"fa",fas:"fa",malay:"ms",bahasa:"ms",indonesian:"id","bahasa melayu":"ms","bahasa indonesia":"id",ms:"ms",id:"id",amharic:"am",\u12A0\u121B\u122D\u129B:"am",am:"am"};Ti=5e3});function Li({messages:e,loading:r,streaming:t,messageRefs:n}){let a=(0,Ee.useRef)(null),o=(0,Ee.useRef)(0),[i,c]=(0,Ee.useState)(!1),[s,l]=(0,Ee.useState)(1),[h,d]=(0,Ee.useState)(0),u=(0,Ee.useRef)(()=>{}),p=(0,Ee.useRef)(null),g=(0,Ee.useRef)(!1),f=(0,Ee.useRef)(!0),k=(0,Ee.useRef)(!1),z=(0,Ee.useRef)(null),b=(0,Ee.useRef)(null),N=(0,Ee.useRef)(e.length),M=(0,Ee.useRef)(!1),E=(0,Ee.useRef)(()=>{}),F=(0,Ee.useRef)(()=>{}),w=(0,Ee.useRef)(null),H=(0,Ee.useRef)(()=>{}),[Q,T]=(0,Ee.useState)(0),A=(0,Ee.useRef)(0),G=(0,Ee.useRef)(""),B=(0,Ee.useRef)(()=>{}),X=(0,Ee.useRef)(()=>{});(0,Ee.useEffect)(()=>{let S=a.current;if(!S)return;let y,P=()=>{clearTimeout(y),y=setTimeout(()=>{g.current=!1},150)},q=()=>{clearTimeout(y),g.current=!0,B.current()},ce=()=>{g.current&&P()};return S.addEventListener("touchstart",q,{passive:!0}),S.addEventListener("touchend",P,{passive:!0}),S.addEventListener("touchcancel",P,{passive:!0}),S.addEventListener("scroll",ce,{passive:!0}),()=>{clearTimeout(y),S.removeEventListener("touchstart",q),S.removeEventListener("touchend",P),S.removeEventListener("touchcancel",P),S.removeEventListener("scroll",ce)}},[]),(0,Ee.useEffect)(()=>{let S=a.current;if(!S)return;let y=160,P=8,q=0,ce=()=>{q=0;let ue=z.current?.offsetHeight??0,j=S.scrollHeight-ue-S.scrollTop-S.clientHeight,te=performance.now()-o.current<400;j<=P&&(!k.current||te)&&(f.current||X.current(),f.current=!0,k.current=!1,J.current()),c(j>y&&!f.current);let we=S.scrollHeight-S.clientHeight;l(we>8?Math.min(1,Math.max(0,S.scrollTop/we)):1);let $e=S.scrollTop+S.clientHeight*.33,ve=0;for(let _e=0;_e<n.current.length;_e++){let Oe=n.current[_e];Oe&&Oe.offsetTop<=$e&&(ve=_e)}d(ve)},ge=()=>{q||(q=requestAnimationFrame(ce))};ce(),S.addEventListener("scroll",ge,{passive:!0});let me=new ResizeObserver(()=>{b.current?E.current("sync"):f.current&&!g.current&&F.current(),ge()});me.observe(S);for(let ue of n.current)ue&&me.observe(ue);return()=>{q&&cancelAnimationFrame(q),S.removeEventListener("scroll",ge),me.disconnect()}},[e.length,n]);let xe=(0,Ee.useCallback)(S=>{let y=`${S}:${A.current}`;G.current!==y&&(G.current=y,T(P=>P+1))},[]),[se,V]=(0,Ee.useState)(!1),re=(0,Ee.useRef)(!1),W=(0,Ee.useCallback)(()=>{re.current||(re.current=!0,V(!0))},[]),_=(0,Ee.useCallback)(()=>{re.current&&(re.current=!1,V(!1))},[]),J=(0,Ee.useRef)(()=>{});J.current=_;let[C,L]=(0,Ee.useState)(!1),I=(0,Ee.useRef)(!1),K=(0,Ee.useRef)(0),x=(0,Ee.useCallback)(()=>{I.current=!1,L(!1)},[]),R=(0,Ee.useCallback)(()=>{G.current="",x(),_()},[x,_]),m=(0,Ee.useCallback)(()=>{I.current&&(performance.now()-K.current<700||x())},[x]);B.current=m,X.current=R,(0,Ee.useEffect)(()=>{if(Q===0)return;I.current=!0,K.current=performance.now(),L(!0);let S=setTimeout(x,4200);return()=>clearTimeout(S)},[Q,x]);let Z=(0,Ee.useCallback)(()=>{M.current=!1,b.current&&(b.current=null,z.current&&(z.current.style.height=""))},[]);H.current=Z,F.current=()=>{let S=a.current;if(!S)return;let y=S.scrollHeight-S.clientHeight;w.current?w.current(y):S.scrollTop=y},E.current=S=>{let y=a.current,P=z.current,q=b.current,ce=te=>{let we=S==="sync"?w.current:p.current;we?we(te):y&&(y.scrollTop=te)},ge=F.current;if(!y||!P||!q||!q.isConnected){Z(),f.current&&ge();return}let me=parseFloat(getComputedStyle(y).paddingTop)||0;P.offsetHeight<y.clientHeight&&(P.style.height=`${y.clientHeight}px`);let ue=Math.max(0,q.offsetTop-me),j=ue+y.clientHeight-(y.scrollHeight-P.offsetHeight);if(j<=0){Z(),f.current=!1,k.current=!0,ce(ue);return}j!==P.offsetHeight&&(P.style.height=`${j}px`),ce(ue)};let D=(0,Ee.useCallback)(S=>{let y=a.current,P=n.current[S];if(!y||!P)return;let q=P.offsetTop-Math.max(0,(y.clientHeight-P.clientHeight)/2),ce=Math.max(0,Math.min(y.scrollHeight-y.clientHeight,q));p.current?p.current(ce):y.scrollTo({top:ce,behavior:"smooth"})},[n]),O=(0,Ee.useCallback)(()=>{let S=a.current;if(!S)return;f.current=!0,k.current=!1,H.current(),X.current();let y=S.scrollHeight-S.clientHeight;p.current?p.current(y):S.scrollTo({top:y,behavior:"smooth"})},[]);return(0,Ee.useLayoutEffect)(()=>{let S=a.current;if(!S)return;let y=e.slice(N.current);if(N.current=e.length,y.some(q=>q.role==="user")&&(f.current=!0,k.current=!1,X.current(),b.current=null,M.current=!0),M.current){M.current=!1;for(let q=n.current.length-1;q>=0;q--){let ce=n.current[q];if(ce?.dataset.hskRole==="user"){b.current=ce;break}}if(b.current){E.current("glide");return}}if(b.current){E.current("glide");return}let P=S.scrollTop;if(!f.current)k.current||(W(),xe(e.length));else if(!g.current){F.current();return}S.scrollTop!==P&&u.current()},[e,r,t,n,xe,W]),(0,Ee.useEffect)(()=>{let S=a.current;if(!S||typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let y=7,P=16,q=1/(window.devicePixelRatio||1),ce=ye=>Math.round(ye/q)*q,ge=S.scrollTop,me=S.scrollTop,ue=S.scrollTop,j=0,te=null,we=ye=>{ye!==ue&&(S.scrollTop=ye,ue=S.scrollTop)},$e=()=>{te!==null&&(cancelAnimationFrame(te),te=null),S.classList.remove("hsk-scrolling"),ge=me=ue=S.scrollTop};u.current=$e,p.current=ye=>{Math.abs(S.scrollTop-ue)>1&&(ge=me=ue=S.scrollTop);let at=Math.round(Math.max(0,Math.min(S.scrollHeight-S.clientHeight,ye)));at!==ge&&(ge=at,te===null&&(j=performance.now(),te=requestAnimationFrame(ve)))},w.current=ye=>{let at=Math.round(Math.max(0,Math.min(S.scrollHeight-S.clientHeight,ye)));te!==null&&(cancelAnimationFrame(te),te=null,S.classList.remove("hsk-scrolling")),S.scrollTop=at,ge=me=ue=S.scrollTop};let ve=ye=>{let at=Math.min((ye-j)/1e3,.05);if(j=ye,me+=(ge-me)*(1-Math.exp(-y*at)),Math.abs(ge-me)<q){me=ge,we(Math.round(ge)),S.classList.remove("hsk-scrolling"),te=null;return}we(ce(me)),te=requestAnimationFrame(ve)},_e=ye=>{if(ye.ctrlKey)return;Math.abs(S.scrollTop-ue)>1&&(ge=me=ue=S.scrollTop),ye.deltaY<0&&(f.current&&(A.current+=1),f.current=!1,b.current=null),B.current();let at=ye.deltaMode===1?P:ye.deltaMode===2?S.clientHeight:1,ct=Math.max(0,S.scrollHeight-S.clientHeight),At=Math.round(Math.max(0,Math.min(ct,ge+ye.deltaY*at)));if(At===ge){ct>0&&ye.preventDefault();return}ye.preventDefault(),ge=At,te===null&&(j=performance.now(),S.classList.add("hsk-scrolling"),te=requestAnimationFrame(ve))},Oe=S.scrollTop,et=()=>{let ye=Math.abs(S.scrollTop-ue)>1;ye&&(o.current=performance.now(),S.scrollTop<Oe-1&&f.current&&(A.current+=1,f.current=!1,b.current=null)),Oe=S.scrollTop,te!==null&&ye&&(cancelAnimationFrame(te),te=null,S.classList.remove("hsk-scrolling"),ge=me=ue=S.scrollTop)};return S.addEventListener("wheel",_e,{passive:!1}),S.addEventListener("scroll",et,{passive:!0}),()=>{S.removeEventListener("scroll",et),S.removeEventListener("wheel",_e),te!==null&&cancelAnimationFrame(te),S.classList.remove("hsk-scrolling"),u.current=()=>{},p.current=null,w.current=null}},[]),{msgsContainerRef:a,spacerRef:z,lastExternalScrollRef:o,showJumpToBottom:i,scrollProgress:s,activeMsgIdx:h,jumpAlert:C,unreadBelow:se,jumpToMessage:D,jumpToBottom:O,resetAlertArming:R}}var Ee,Ni=Se(()=>{"use strict";Ee=require("react")});function Ii(e){let[r,t]=(0,Ht.useState)(e),n=(0,Ht.useRef)(e),a=(0,Ht.useRef)(e),o=(0,Ht.useRef)(0),i=(0,Ht.useRef)(0),c=(0,Ht.useRef)(0),s=(0,Ht.useRef)(null);return(0,Ht.useEffect)(()=>()=>{s.current!==null&&cancelAnimationFrame(s.current)},[]),(0,Ht.useEffect)(()=>{if(a.current=e,window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||!e.startsWith(n.current)){s.current!==null&&(cancelAnimationFrame(s.current),s.current=null),n.current=e,o.current=0,i.current=0,t(e);return}if(s.current!==null||n.current.length>=e.length)return;c.current=performance.now();let h=d=>{let u=Math.min(d-c.current,50);c.current=d;let p=a.current,g=p.length-n.current.length,f=Math.min(bd,Math.max(md,g*1e3/ud));o.current+=(f-o.current)*(1-Math.exp(-u/fd)),i.current+=o.current*u/1e3;let k=Math.floor(i.current);k>0&&(i.current-=k,n.current=p.slice(0,Math.min(p.length,n.current.length+k)),t(n.current)),n.current.length<a.current.length?s.current=requestAnimationFrame(h):(s.current=null,i.current=0)};s.current=requestAnimationFrame(h)},[e]),r}var Ht,ud,md,bd,fd,Ai=Se(()=>{"use strict";Ht=require("react"),ud=450,md=45,bd=900,fd=180});function Fi(e,r){let t=(0,Pi.useAkropolysContext)(),[n,a]=(0,Rt.useState)(""),[o,i]=(0,Rt.useState)("idle"),[c,s]=(0,Rt.useState)(null),[l,h]=(0,Rt.useState)(null),[d,u]=(0,Rt.useState)(null),[p,g]=(0,Rt.useState)(go),[f,k]=(0,Rt.useState)(!1),z=(0,Rt.useCallback)(async(M,E)=>{try{navigator.clipboard&&window.isSecureContext?await navigator.clipboard.writeText(M):kd(M),u(E),setTimeout(()=>u(null),2e3)}catch{}},[]);(0,Rt.useEffect)(()=>{e&&e.type==="request_kiku_key"&&(i("prompt_key"),a(""))},[e]),(0,Rt.useEffect)(()=>{if(!c)return;g(go);let M=setInterval(()=>{g(E=>E<=1?(clearInterval(M),s(null),h(null),0):E-1)},1e3);return()=>clearInterval(M)},[c]);let b=(0,Rt.useCallback)(async()=>{let M=n.trim();M&&(t.setKikuPub(M),a(""),i("idle"),await r())},[t,n,r]),N=(0,Rt.useCallback)(async()=>{if(!f){k(!0);try{let{secret:M,publicId:E}=await t.mintKikuKey();s(M),h(E),i("idle"),await r()}catch{}finally{k(!1)}}},[t,f,r]);return{keyInput:n,setKeyInput:a,keyPhase:o,setKeyPhase:i,mintedKey:c,setMintedKey:s,mintedPub:l,setMintedPub:h,copied:d,keyCountdown:p,minting:f,copyValue:z,handleUseExistingKey:b,handleCreateKey:N}}function kd(e){let r=document.createElement("textarea");r.value=e,r.setAttribute("readonly",""),r.style.cssText="position:fixed;top:0;left:0;opacity:0;",document.body.appendChild(r),r.select(),r.setSelectionRange(0,e.length);let t=document.execCommand("copy");if(r.remove(),!t)throw new Error("copy failed")}var Rt,Pi,_i=Se(()=>{"use strict";Rt=require("react"),Pi=require("@akropolys/sdk");It()});function Di({attachments:e,setAttachments:r,setInput:t,send:n,t:a}){let o=(0,Sn.useCallback)(l=>{let h=l.name||"",d=`@kiku ${a("displayCapture",{name:h}).trim()}`,u=h||"capture current page";t("");let p=e;r([]),n(u,d,p.length>0?p:void 0,"capture")},[e,n,r,t,a]),i=(0,Sn.useCallback)(l=>{let h=l.filter(p=>p.id).map(p=>({name:p.name||"",url:p.url||"",image:p.image||""})),d=l.map(p=>p.name).filter(Boolean).join(", "),u=`@kiku ${a("displayCaptureAll",{count:String(l.length)})}`;t(""),r([]),n(d||"capture all",u,void 0,"capture_all",h)},[n,r,t,a]),c=(0,Sn.useCallback)(()=>{let l=`@kiku ${a("displayViewHistory")}`;t(""),r([]),n("show my saved items",l,void 0,"view_history")},[n,r,t,a]),s=(0,Sn.useCallback)(()=>{let l=`@kiku ${a("displayDelete")}`;t(""),r([]),n("delete this",l,void 0,"delete")},[n,r,t,a]);return{handleKikuCapture:o,handleKikuCaptureAll:i,handleKikuViewHistory:c,handleKikuDelete:s}}var Sn,Bi=Se(()=>{"use strict";Sn=require("react")});function Tn(e,r=130){let t=ba;if(!t||!fa)return;let n=fa.currentTime;t.gain.cancelScheduledValues(n),t.gain.setValueAtTime(t.gain.value,n),t.gain.linearRampToValueAtTime(Math.max(0,Math.min(1,e)),n+r/1e3)}function qi(){if(!$i)return Ar*=.85,Ar;if(!Hi||!Mn)return Ar;Hi.getByteTimeDomainData(Mn);let e=0;for(let n=0;n<Mn.length;n++){let a=(Mn[n]-128)/128;e+=a*a}let r=Math.sqrt(e/Mn.length),t=Math.min(1,r*3.2);return Ar+=(t-Ar)*(t>Ar?.6:.12),Ar}function Ui(){if($i=!1,ba&&fa&&(ba.gain.cancelScheduledValues(fa.currentTime),ba.gain.value=1),typeof window<"u"&&"speechSynthesis"in window)try{window.speechSynthesis.cancel()}catch{}}var fa,Hi,ba,Mn,$i,Ar,yo=Se(()=>{"use strict";fa=null,Hi=null,ba=null,Mn=null,$i=!1,Ar=0});function Gi({lang:e,onUtterance:r,onError:t,onBargeIn:n,silenceMs:a=gd,paused:o=!1}){let[i,c]=(0,Me.useState)(!1),[s,l]=(0,Me.useState)(!1),[h,d]=(0,Me.useState)(""),[u,p]=(0,Me.useState)(!1),g=(0,Me.useRef)(null),f=(0,Me.useRef)(null),k=(0,Me.useRef)(null),z=(0,Me.useRef)(null),b=(0,Me.useRef)(null),N=(0,Me.useRef)(null),M=(0,Me.useRef)(0),E=(0,Me.useRef)(.008),F=(0,Me.useRef)(0),w=(0,Me.useRef)(0),H=(0,Me.useRef)(""),Q=(0,Me.useRef)(0),T=(0,Me.useRef)(0),A=(0,Me.useRef)(!1),G=(0,Me.useRef)(o),B=(0,Me.useRef)(!1),X=(0,Me.useRef)(!1),xe=(0,Me.useRef)(r),se=(0,Me.useRef)(t),V=(0,Me.useRef)(n);(0,Me.useEffect)(()=>{xe.current=r},[r]),(0,Me.useEffect)(()=>{se.current=t},[t]),(0,Me.useEffect)(()=>{V.current=n},[n]),(0,Me.useEffect)(()=>{G.current=o},[o]),(0,Me.useEffect)(()=>{p(typeof window<"u"&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window)&&!!navigator.mediaDevices?.getUserMedia)},[]);let re=(0,Me.useCallback)(()=>M.current,[]),W=(0,Me.useCallback)(y=>{let P=z.current;return!P||y.length!==P.frequencyBinCount?!1:(P.getByteFrequencyData(y),!0)},[]),_=(0,Me.useCallback)(()=>z.current?.frequencyBinCount??0,[]),J=(0,Me.useRef)([]),C=(0,Me.useRef)(null),L=(0,Me.useRef)(!1),I=(0,Me.useRef)(0),K=(0,Me.useRef)(0),x=(0,Me.useCallback)(y=>{let P=z.current;if(!P)return 0;let q=J.current;q.push(y),q.length>Sd&&q.shift();let ce=0;if(q.length>=12){let Oe=0;for(let et of q)Oe+=et;if(Oe/=q.length,Oe>1e-4){let et=0;for(let ye of q)et+=(ye-Oe)*(ye-Oe);ce=Math.min(1,Math.sqrt(et/q.length)/Oe/.6)}}let ge=0;(!C.current||C.current.length!==P.frequencyBinCount)&&(C.current=new Uint8Array(P.frequencyBinCount));let me=C.current;P.getByteFrequencyData(me);let j=(k.current?.sampleRate??48e3)/2/me.length,te=Math.floor(300/j),we=Math.min(me.length-1,Math.ceil(3400/j)),$e=0,ve=0;for(let Oe=0;Oe<me.length;Oe++)ve+=me[Oe],Oe>=te&&Oe<=we&&($e+=me[Oe]);ve>0&&(ge=$e/ve);let _e=Math.min(1,y/(E.current+wo*3));return Md*_e+Td*ce+Rd*ge},[]),R=(0,Me.useCallback)(()=>{let y=H.current.trim();if(H.current="",Q.current=T.current,d(""),l(!1),y){B.current=!1;let P=g.current;g.current=null;try{P?.stop()}catch{}xe.current(y)}},[]),m=(0,Me.useCallback)(()=>{let y=z.current,P=N.current;if(!y||!P)return;y.getByteTimeDomainData(P);let q=0;for(let te=0;te<P.length;te++){let we=(P[te]-128)/128;q+=we*we}let ce=Math.sqrt(q/P.length),ge=Math.min(1,ce*4);M.current+=(ge-M.current)*(ge>M.current?.6:.12);let me=Date.now(),ue=G.current?qi()*vd:0;ce>E.current+wo+ue?(F.current=me,w.current||(w.current=me)):(w.current=0,E.current=Math.min(E.current*1.02+2e-5,Math.max(.004,ce))),G.current?L.current?(x(ce)>Oi?K.current+=1:K.current=Math.max(0,K.current-2),K.current>=Cd?(L.current=!1,K.current=0,Tn(1,0),V.current?.()):me-I.current>wd&&(L.current=!1,K.current=0,Tn(1,Wi*2))):w.current&&me-w.current>xd&&x(ce)>Oi&&(w.current=0,L.current=!0,I.current=me,K.current=0,Tn(yd,Wi)):H.current.trim()&&me-F.current>a&&R(),b.current=requestAnimationFrame(m)},[R,a,x]),Z=(0,Me.useCallback)(()=>{if(g.current||!A.current)return;let y=window.SpeechRecognition||window.webkitSpeechRecognition,P=new y;Q.current=0,T.current=0,P.lang=e||document.documentElement.lang||navigator.language||"en-US",P.interimResults=!0,P.maxAlternatives=1,P.continuous=!0,P.onresult=q=>{let ce="";for(let ge=Q.current;ge<q.results.length;ge++)ce+=q.results[ge][0].transcript;T.current=q.results.length,ce=ce.trim(),ce&&(H.current=ce,d(ce),l(!0))},P.onerror=q=>{let ce=q?.error||"";ce==="no-speech"||ce==="aborted"||se.current?.(ce)},P.onend=()=>{g.current=null,A.current&&B.current&&setTimeout(()=>{Z()},120)},g.current=P;try{P.start()}catch{g.current=null,se.current?.("failed-to-start")}},[e]),D=(0,Me.useCallback)(()=>{B.current=!1;let y=g.current;g.current=null;try{y?.stop()}catch{}},[]),O=(0,Me.useCallback)(()=>{A.current=!1,L.current=!1,K.current=0,J.current=[],Tn(1,0),B.current=!1,c(!1),l(!1),d(""),H.current="",M.current=0;let y=g.current;g.current=null;try{y?.abort()}catch{}b.current!==null&&(cancelAnimationFrame(b.current),b.current=null),f.current?.getTracks().forEach(P=>P.stop()),f.current=null,z.current=null,k.current?.close().catch(()=>{}),k.current=null},[]),S=(0,Me.useCallback)(async()=>{if(!(A.current||!u)){A.current=!0,c(!0);try{let y=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}});f.current=y;let P=window.AudioContext||window.webkitAudioContext,q=new P;k.current=q;let ce=q.createAnalyser();ce.fftSize=1024,ce.smoothingTimeConstant=.25,q.createMediaStreamSource(y).connect(ce),z.current=ce,N.current=new Uint8Array(ce.fftSize),E.current=.008,F.current=Date.now(),b.current=requestAnimationFrame(m)}catch(y){A.current=!1,c(!1),se.current?.(y?.name==="NotAllowedError"?"not-allowed":"audio-capture");return}B.current=!0,Z()}},[u,m,Z]);return(0,Me.useEffect)(()=>{i&&(o?(H.current="",d(""),L.current=!1,K.current=0,J.current=[],D()):(L.current=!1,F.current=Date.now(),B.current=!0,Z()))},[o,i,Z,D]),(0,Me.useEffect)(()=>{if(!i||o)return;let y=setInterval(()=>{let P=!!g.current,q=M.current>E.current+wo;P&&q&&H.current},2e3);return()=>clearInterval(y)},[i,o]),(0,Me.useEffect)(()=>()=>{O()},[O]),{supported:u,active:i,hearing:s,interim:h,micLevel:re,micSpectrum:W,spectrumBins:_,start:S,stop:O}}var Me,gd,wo,xd,vd,yd,Wi,wd,Cd,Sd,Md,Td,Rd,Oi,Vi=Se(()=>{"use strict";Me=require("react");yo();gd=1100,wo=.012,xd=320,vd=.09,yd=.25,Wi=130,wd=700,Cd=12,Sd=48,Md=.45,Td=.35,Rd=.2,Oi=.55});function Xi(e){let r=new Uint8Array(e);if(r.length<4)return new Float32Array(0);let t=new DataView(e).getInt16(0,!0),n=Co(r[2]),a=(r.length-4)*2;r[3]&1&&a>0&&a--;let o=new Float32Array(a);for(let i=0;i<a;i++){let c=r[4+(i>>1)]>>4*(i&1)&15,s=Ki[n],l=s>>3;c&4&&(l+=s),c&2&&(l+=s>>1),c&1&&(l+=s>>2),t=Yi(c&8?t-l:t+l),n=Co(n+ji[c]),o[i]=t/32768}return o}var ji,Ki,Co,Yi,Rn,Qi=Se(()=>{"use strict";ji=[-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8],Ki=[7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767],Co=e=>e<0?0:e>88?88:e,Yi=e=>e<-32768?-32768:e>32767?32767:e,Rn=class{constructor(){this.index=0}encode(r){let t=r.length,n=new Uint8Array(4+(t+1>>1));if(t===0)return n.buffer;let a=r[0];new DataView(n.buffer).setInt16(0,a,!0),n[2]=this.index,n[3]=t&1;let i=this.index;for(let c=0;c<t;c++){let s=Ki[i],l=r[c]-a,h=0;l<0&&(h=8,l=-l);let d=s>>3;l>=s&&(h|=4,l-=s,d+=s),s>>=1,l>=s&&(h|=2,l-=s,d+=s),s>>=1,l>=s&&(h|=1,d+=s),a=Yi(h&8?a-d:a+d),i=Co(i+ji[h]),n[4+(c>>1)]|=h<<4*(c&1)}return this.index=i,n.buffer}}});function Cr(e,r,t){for(let n=0;n<t.length;n++)e.setUint8(r+n,t.charCodeAt(n))}function Ji(e,r=24e3){let t=0;for(let s of e)t+=s.length;let n=new Float32Array(t),a=0;for(let s of e)n.set(s,a),a+=s.length;let o=new ArrayBuffer(44+t*2),i=new DataView(o);Cr(i,0,"RIFF"),i.setUint32(4,36+t*2,!0),Cr(i,8,"WAVE"),Cr(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,r,!0),i.setUint32(28,r*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),Cr(i,36,"data"),i.setUint32(40,t*2,!0);let c=44;for(let s=0;s<t;s++){let l=Math.max(-1,Math.min(1,n[s]));i.setInt16(c,l<0?l*32768:l*32767,!0),c+=2}return new Blob([o],{type:"audio/wav"})}function Zi(e,r=16e3){let t=0;for(let s of e)t+=s.length;let n=new Int16Array(t),a=0;for(let s of e)n.set(s,a),a+=s.length;let o=new ArrayBuffer(44+t*2),i=new DataView(o);Cr(i,0,"RIFF"),i.setUint32(4,36+t*2,!0),Cr(i,8,"WAVE"),Cr(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,r,!0),i.setUint32(28,r*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),Cr(i,36,"data"),i.setUint32(40,t*2,!0);let c=44;for(let s=0;s<t;s++)i.setInt16(c,n[s],!0),c+=2;return new Blob([o],{type:"audio/wav"})}var ec=Se(()=>{"use strict"});function tc(e,r){let t=e.apiUrl.replace(/\/+$/,""),n=t.endsWith("/voice/live")?t:t+"/voice/live",a=new URL(n,window.location.href);a.protocol=a.protocol==="https:"?"wss:":"ws:",a.searchParams.set("siteId",e.siteId),e.kikuId&&a.searchParams.set("kikuId",e.kikuId),e.sessionId&&a.searchParams.set("sessionId",e.sessionId),e.name&&a.searchParams.set("name",e.name),e.language&&a.searchParams.set("language",e.language),a.searchParams.set("codec","adpcm");let o=r||e.voice;return o&&a.searchParams.set("voice",o),a.toString()}function rc(e){let[r,t]=(0,le.useState)("idle"),[n,a]=(0,le.useState)(!1),[o,i]=(0,le.useState)([]),[c,s]=(0,le.useState)(null),[l,h]=(0,le.useState)(!1),d=(0,le.useRef)(null),u=(0,le.useRef)(!1),p=(0,le.useRef)(!1),g=(0,le.useRef)(null),f=(0,le.useRef)(0),k=(0,le.useRef)(!1),z=(0,le.useRef)(!1),b=(0,le.useRef)(null),N=(0,le.useRef)(null),M=(0,le.useRef)(null),E=(0,le.useRef)(null),F=(0,le.useRef)(0),w=(0,le.useRef)(!1),H=(0,le.useRef)([]),Q=(0,le.useRef)(0),T=(0,le.useRef)(new Set),A=(0,le.useRef)(null),G=(0,le.useRef)(null),B=(0,le.useRef)(ka),X=(0,le.useRef)(e);(0,le.useEffect)(()=>{X.current=e;let ne=N.current;if(ne)for(let he of ne.getAudioTracks())he.enabled=!e.muted},[e]);let xe=(0,le.useRef)(!1),se=(0,le.useRef)([]),V=(0,le.useRef)(new Rn),re=(0,le.useRef)(null),W=(0,le.useRef)(""),_=(0,le.useRef)(""),[J,C]=(0,le.useState)([]),L=(0,le.useRef)([]);L.current=J;let I=(0,le.useRef)([]),[K,x]=(0,le.useState)([]),R=(0,le.useRef)(0),m=(0,le.useRef)([]),Z=(0,le.useRef)(void 0),D=(0,le.useRef)(null),O=(0,le.useRef)([]),S=(0,le.useRef)([]),y=(0,le.useCallback)(()=>{let ne=W.current.trim(),he=_.current.trim(),fe=D.current?Math.max(.1,(Date.now()-D.current)/1e3):void 0,ae;if(O.current.length>0)try{let Le=Ji(O.current,B.current);ae=URL.createObjectURL(Le)}catch(Le){console.error("[kiku] failed to encode bot audio wav:",Le)}let ke;if(S.current.length>0)try{let Le=Zi(S.current,So);ke=URL.createObjectURL(Le)}catch(Le){console.error("[kiku] failed to encode user audio wav:",Le)}let pe=m.current.length?m.current:void 0,Re=Z.current;W.current="",_.current="",D.current=null,O.current=[],S.current=[],m.current=[],Z.current=void 0,!(!ne&&!he&&!pe&&!Re)&&X.current.onExchange?.({heard:ne,said:he,duration:fe,userAudioUrl:ke,audioUrl:ae,images:pe,visualization:Re})},[]),P=(0,le.useCallback)(()=>{},[]),q=(0,le.useCallback)(ne=>{if(X.current.muted)return;let he=new Int16Array(ne),fe=0;for(let ke=0;ke<he.length;ke+=8){let pe=Math.abs(he[ke]);pe>fe&&(fe=pe)}fe>1200&&(f.current=Date.now());let ae=d.current;!xe.current||!ae||ae.readyState!==WebSocket.OPEN||(S.current.push(new Int16Array(ne.slice(0))),ae.send(V.current.encode(new Int16Array(ne))))},[]),ce=(0,le.useCallback)(()=>{se.current=[]},[]),ge=(0,le.useCallback)(()=>{let ne=b.current;if(re.current&&ne&&ne.state!=="closed")return re.current;let he=window.AudioContext||window.webkitAudioContext;if(!he)return Promise.resolve(null);let fe=new he({latencyHint:"interactive",sampleRate:ka});b.current=fe;let ae=URL.createObjectURL(new Blob([Fd],{type:"application/javascript"}));return re.current=fe.audioWorklet.addModule(ae).then(()=>fe).catch(()=>null).finally(()=>URL.revokeObjectURL(ae)),re.current},[]),me=(0,le.useCallback)(()=>{typeof window>"u"||ge()},[ge]),ue=(0,le.useCallback)(()=>{let ne=E.current;if(!ne)return 0;let he=new Uint8Array(ne.fftSize);ne.getByteTimeDomainData(he);let fe=0;for(let ae=0;ae<he.length;ae++){let ke=(he[ae]-128)/128;fe+=ke*ke}return Math.min(1,Math.sqrt(fe/he.length)*4)},[]),j=r==="speaking"||r==="thinking",te=(0,le.useCallback)(ne=>{let he=j?A.current:E.current;return!he||ne.length!==he.frequencyBinCount?!1:(he.getByteFrequencyData(ne),!0)},[j]),we=(0,le.useCallback)(()=>(j?A.current:E.current)?.frequencyBinCount??0,[j]),$e=(0,le.useCallback)(()=>{let ne=G.current,he=b.current;if(!ne||!he||he.state==="closed"){F.current=0;for(let ke of T.current)try{ke.onended=null,ke.stop()}catch{}T.current.clear();return}let fe=he.currentTime,ae=fe+Nd;ne.gain.cancelScheduledValues(fe),ne.gain.setValueAtTime(ne.gain.value,fe),ne.gain.linearRampToValueAtTime(0,ae),ne.gain.setValueAtTime(1,ae);for(let ke of T.current)try{ke.onended=null,ke.stop(ae)}catch{}T.current.clear(),F.current=ae},[]),ve=(0,le.useCallback)(ne=>{let he=b.current,fe=A.current;if(!he||!fe||ne.length===0)return;he.state==="suspended"&&he.resume().catch(()=>{});let ae=he.createBuffer(1,ne.length,B.current);ae.getChannelData(0).set(ne);let ke=he.createBufferSource();ke.buffer=ae,ke.connect(fe);let pe=he.currentTime,Re=F.current>pe?F.current:pe+Ld;ke.start(Re),F.current=Re+ae.duration,T.current.add(ke),ke.onended=()=>{T.current.delete(ke),T.current.size===0&&(F.current=0,w.current=!1,t(Le=>Le==="speaking"?"listening":Le))},t(Le=>Le==="speaking"||Le==="idle"||Le==="ended"?Le:"speaking")},[]),_e=(0,le.useCallback)(()=>{let ne=H.current;H.current=[],Q.current=0;for(let he of ne)ve(he)},[ve]),Oe=(0,le.useCallback)(()=>{H.current=[],Q.current=0},[]),et=(0,le.useCallback)(ne=>{let he=b.current;if(!he||ne.length===0)return;if(F.current>he.currentTime&&H.current.length===0){ve(ne);return}let ae=w.current?zd:Ed;H.current.push(ne),Q.current+=ne.length/B.current,Q.current>=ae&&(w.current=!0,_e())},[ve,_e]),ye=(0,le.useRef)(null),at=(0,le.useRef)(null),ct=(0,le.useCallback)(()=>{ye.current&&(clearInterval(ye.current),ye.current=null);let ne=at.current,he=b.current;if(ne&&he&&he.state!=="closed"){let fe=he.currentTime;try{ne.gain.cancelScheduledValues(fe),ne.gain.setValueAtTime(ne.gain.value,fe),ne.gain.linearRampToValueAtTime(1e-4,fe+.04)}catch{}setTimeout(()=>{try{ne.disconnect()}catch{}at.current===ne&&(at.current=null)},50)}},[]),At=(0,le.useCallback)(()=>{},[]),mt=(0,le.useCallback)(ne=>{y(),d.current=null,xe.current=!1,se.current=[],re.current=null,w.current=!1,H.current=[],Q.current=0,ct(),$e(),M.current?.disconnect(),M.current=null,N.current?.getTracks().forEach(he=>he.stop()),N.current=null,E.current=null,A.current=null,G.current=null,b.current?.close().catch(()=>{}),b.current=null,t(ne),a(!1),i([]),u.current=!1,p.current=!1},[y,$e,ct]),Ye=(0,le.useCallback)(()=>{try{d.current?.send(JSON.stringify({type:"close"}))}catch{}try{d.current?.close()}catch{}mt("idle")},[mt]),Yt=(0,le.useCallback)(ne=>{let he=[...I.current,...L.current.filter(fe=>fe.done)].filter(fe=>fe.text).map(fe=>({role:fe.role,text:fe.text}));try{ne.send(JSON.stringify({type:"open",history:he}))}catch{}},[]),Lt=(0,le.useCallback)(ne=>{let he=!1;ne.binaryType="arraybuffer",V.current=new Rn,ne.onopen=()=>{d.current!==ne||!p.current||(p.current=!1,Yt(ne))},ne.onmessage=fe=>{if(fe.data instanceof ArrayBuffer){if(!k.current){k.current=!0;let pe=_.current.trim();pe&&C(Re=>{let Le=Re.slice();for(let Ne=Le.length-1;Ne>=0;Ne--)Le[Ne].role==="user"&&!Le[Ne].done&&(Le[Ne]={...Le[Ne],done:!0});return Le.push({role:"assistant",text:pe,done:!1}),Le})}!z.current&&f.current&&(z.current=!0,console.log("[kiku] wait from last speech to first audio: "+(Date.now()-f.current)+"ms")),ct();let ke=Xi(fe.data);O.current.push(ke.slice()),et(ke);return}let ae;try{ae=JSON.parse(fe.data)}catch{return}switch(ae.type){case"ready":ae.sampleRate&&(B.current=ae.sampleRate,ae.sampleRate!==ka&&console.warn(`[kiku] live audio rate ${ae.sampleRate} != context ${ka}; per-buffer resampling will click at every chunk seam`)),typeof ae.secondsLeft=="number"&&s(ae.secondsLeft),h(ae.photos===!0),xe.current=!0,t("listening"),ce(),g.current?.(),g.current=null,Gt("connect",!0);break;case"hearing":D.current||(D.current=Date.now()),a(!0);break;case"thinking":D.current||(D.current=Date.now()),a(!1),t("thinking"),At(),ae.tool==="visualize"&&x(ke=>ke.some(pe=>pe.pending)?ke:[...ke,{id:++R.current,url:"",pending:!0}]);break;case"viz":typeof ae.url=="string"&&ae.url?(Z.current=ae.url,x(ke=>ke.map(pe=>pe.pending?{...pe,url:ae.url,pending:!1}:pe))):x(ke=>ke.filter(pe=>!pe.pending));break;case"heard":T.current.size===0&&(F.current=0),D.current||(D.current=Date.now(),Gt("heard")),W.current+=ae.text,C(ke=>{let pe=ke.slice(),Re=pe[pe.length-1];return Re&&Re.role==="user"&&!Re.done?pe[pe.length-1]={...Re,text:W.current.trim()}:pe.push({role:"user",text:W.current.trim(),done:!1}),pe}),a(!1),t("thinking"),At();break;case"said":if(_.current+=ae.text,!k.current)break;C(ke=>{let pe=ke.slice();for(let Ne=pe.length-1;Ne>=0;Ne--)pe[Ne].role==="user"&&!pe[Ne].done&&(pe[Ne]={...pe[Ne],done:!0});let Re=pe[pe.length-1],Le=_.current.trim();return Re&&Re.role==="assistant"&&!Re.done?pe[pe.length-1]={...Re,text:Le}:pe.push({role:"assistant",text:Le,done:!1}),pe});break;case"interrupted":w.current=!1,Oe(),ct(),$e(),Gt("interrupt"),a(!1),t("listening");break;case"turn_complete":z.current=!1,k.current=!1,f.current=0,C(ke=>ke.map(pe=>pe.done?pe:{...pe,done:!0})),_e(),w.current=!1,ct(),a(!1),y();break;case"sources":Array.isArray(ae.sources)&&ae.sources.length&&i(ae.sources);break;case"seconds":typeof ae.secondsLeft=="number"&&s(ae.secondsLeft);break;case"refused":X.current.onRefused?.(ae.code||"guest"),Ye();break;case"error":X.current.onError?.(ae.code||"unavailable"),Ye();break}},ne.onclose=fe=>{d.current===ne&&(fe.code===4402&&(he=!0,X.current.onError?.(fe.reason==="site"?"siteLimit":"limit")),mt("ended"))},ne.onerror=()=>{!he&&d.current===ne&&X.current.onError?.("connection")}},[Oe,et,y,ce,$e,_e,Yt,At,ct,Ye,mt]),dr=(0,le.useCallback)(ne=>{let he=d.current;if(xe.current=!1,t("connecting"),$e(),ct(),he){try{he.send(JSON.stringify({type:"close"}))}catch{}try{he.close()}catch{}}let fe=X.current;p.current=!0;let ae=new WebSocket(tc(fe,ne),["akropolys.token."+fe.token]);d.current=ae,Lt(ae)},[Lt,$e,ct]),Xt=(0,le.useRef)(e.voice);(0,le.useEffect)(()=>{Xt.current!==e.voice&&(Xt.current=e.voice,d.current&&(r==="listening"||r==="thinking"||r==="speaking")&&dr(e.voice))},[e.voice,r,dr]);let pr=(0,le.useCallback)(async(ne=[])=>{if(u.current&&d.current)return;u.current=!0,t("connecting");let he=X.current;se.current=[],I.current=ne,L.current=[],C([]),x([]),W.current="",_.current="";let fe=ge();b.current?.resume().catch(()=>{}),xr();let ae=d.current;ae&&ae.readyState===WebSocket.OPEN?Yt(ae):ae&&ae.readyState===WebSocket.CONNECTING?p.current=!0:(ae=new WebSocket(tc(he),["akropolys.token."+he.token]),d.current=ae,p.current=!0,Lt(ae));let ke;try{if(!navigator.mediaDevices?.getUserMedia)throw{name:"NotAllowedError"};ke=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch(nt){try{ae.close()}catch{}d.current=null,t("idle"),he.onError?.(nt?.name==="NotAllowedError"?"not-allowed":"audio-capture");return}if(d.current!==ae){ke.getTracks().forEach(nt=>nt.stop());return}N.current=ke;for(let nt of ke.getAudioTracks())nt.enabled=!X.current.muted;let pe=await fe;if(d.current!==ae){ke.getTracks().forEach(nt=>nt.stop());return}if(!pe){X.current.onError?.("audio-worklet"),Ye();return}pe.state==="suspended"&&pe.resume().catch(()=>{});let Re=pe.createAnalyser();Re.fftSize=1024,Re.smoothingTimeConstant=.25,E.current=Re;let Le=pe.createGain();Le.gain.value=1,Le.connect(pe.destination),G.current=Le;let Ne=pe.createAnalyser();Ne.fftSize=1024,Ne.smoothingTimeConstant=.25,Ne.connect(Le),A.current=Ne;try{let nt=new AudioWorkletNode(pe,"kiku-capture");M.current=nt,nt.port.onmessage=Pt=>q(Pt.data);let nr=pe.createMediaStreamSource(ke),ot=()=>{if(!(d.current!==ae||!M.current)){try{nr.connect(Re)}catch{}try{nr.connect(nt)}catch{}}};xe.current?ot():g.current=ot}catch{X.current.onError?.("audio-worklet"),Ye()}},[Lt,ge,q,Yt,Ye]);(0,le.useEffect)(()=>{if(r!=="listening"){a(!1);return}let ne=0,he=!1,fe=Date.now(),ae=window.setInterval(()=>{let ke=Date.now();if(!X.current.muted&&ue()>Id&&(ne=ke),ke-Math.max(ne,fe)>Pd){window.clearInterval(ae),X.current.onError?.("idle"),Ye();return}let pe=ke-ne<Ad;pe!==he&&(he=pe,a(pe))},100);return()=>window.clearInterval(ae)},[r,ue,Ye]);let Ut=(0,le.useCallback)(()=>{me()},[me]);(0,le.useEffect)(()=>()=>{Ye()},[Ye]),(0,le.useEffect)(()=>{let ne=N.current;if(ne)for(let he of ne.getAudioTracks())he.enabled=!e.muted},[e.muted,r]);let ze=(0,le.useCallback)(async ne=>{let he=X.current.storeScene;if(!he||!ne.type.startsWith("image/"))return!1;let fe;try{fe=await ha(ne)}catch{return!1}let ae=++R.current;if(x(pe=>[...pe,{id:ae,url:fe,pending:!1,sending:!0}]),!await he(fe))return x(pe=>pe.filter(Re=>Re.id!==ae)),!1;x(pe=>pe.map(Re=>Re.id===ae?{...Re,sending:!1}:Re)),m.current.push(fe);let ke=d.current;return ke&&ke.readyState===WebSocket.OPEN&&ke.send(JSON.stringify({type:"text",text:"(The visitor just attached a photo. You cannot see it. In one short sentence, ask what they would like changed in it.)"})),!0},[]),Mt=(0,le.useCallback)(ne=>{let he=d.current;he&&he.readyState===WebSocket.OPEN&&ne.trim()&&he.send(JSON.stringify({type:"text",text:ne}))},[]);return{state:r,phase:r,hearing:n,sources:o,secondsLeft:c,photos:l,turns:J,images:K,micLevel:ue,micSpectrum:te,spectrumBins:we,start:pr,stop:Ye,prewarm:Ut,attachPhoto:ze,ask:Mt}}var le,So,ka,Ed,zd,Ld,Nd,Id,Ad,Pd,Fd,nc=Se(()=>{"use strict";le=require("react");Wr();Qi();ec();so();So=16e3,ka=24e3,Ed=.08,zd=.12,Ld=.03,Nd=.08,Id=.12,Ad=500,Pd=6e4,Fd=`
3
3
  class KikuCapture extends AudioWorkletProcessor {
4
4
  constructor() {
5
5
  super();