@auticlabs/bulut 1.3.0 → 1.3.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/embed.cjs +1 -1
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.js +1 -1
- package/dist/embed.js.map +1 -1
- package/package.json +1 -1
package/dist/embed.js
CHANGED
|
@@ -31,6 +31,6 @@ return W("div",{style:fq(V.isUser),children:V.text},V.id)})})}),
|
|
|
31
31
|
/* @__PURE__ */W("div",{style:{...Sq,transition:"opacity 0.2s ease-out"},children:G?/* @__PURE__ */W("span",{className:"bulut-status-dots",title:D,children:D}):t?/* @__PURE__ */W("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[
|
|
32
32
|
/* @__PURE__ */W("span",{style:{fontSize:"12px",opacity:"0.6",whiteSpace:"nowrap"},children:"Erişilebilirlik"}),
|
|
33
33
|
/* @__PURE__ */W("button",{type:"button",onClick:t,"aria-label":e?"Erişilebilirlik modunu kapat":"Erişilebilirlik modunu aç",style:{width:"36px",height:"20px",borderRadius:"10px",border:"none",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",backgroundColor:e?cV.primary:"hsla(215, 10%, 75%, 1)",transition:`background-color ${hV}`,flexShrink:"0"},children:/* @__PURE__ */W("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:"#ffffff",display:"block",transition:`transform ${hV}`,transform:e?"translateX(16px)":"translateX(0)",boxShadow:"0 1px 3px rgba(0,0,0,0.2)"}})})]}):null}),
|
|
34
|
-
/* @__PURE__ */W("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:"0"},children:[u?/* @__PURE__ */W("span",{style:Cq,children:Je(I)}):null,Qq?/* @__PURE__ */W("button",{type:"button",className:"bulut-footer-btn",style:Mq,onClick:mq,"aria-label":"Görevi durdur",title:"Görevi durdur",children:/* @__PURE__ */W(TV,{"aria-hidden":"true",width:22,height:22,style:{color:"hsla(215, 100%, 5%, 1)"}})}):bq?null:/* @__PURE__ */W("button",{type:"button",className:"bulut-footer-btn",style:Mq,onPointerDown:V=>{if(V.preventDefault(),!x.current)if(T.current)"vad"===oV.current?dq({discard:!0}):dq();else{if(_.current=Date.now(),nV.current=!1,qq(),V.currentTarget.setPointerCapture)try{V.currentTarget.setPointerCapture(V.pointerId)}catch{}$.current=window.setTimeout(()=>{null===_.current||x.current||T.current||(nV.current=!0,gq("press"))},250)}},onPointerUp:hq,onPointerCancel:V=>{hq(V)},disabled:Yq,"aria-label":Eq?"Kaydı iptal et":u?"Kaydı durdur":"Kaydı başlat",title:Eq?"Kaydı iptal et":u?"Kaydı durdur":"Dokun: VAD, Basılı tut: bırakınca gönder",children:/* @__PURE__ */W(Eq?KV:YV,{"aria-hidden":"true",width:22,height:22,style:{color:"hsla(215, 100%, 5%, 1)"}})})]})]})]})},Ne={backendBaseUrl:"
|
|
34
|
+
/* @__PURE__ */W("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:"0"},children:[u?/* @__PURE__ */W("span",{style:Cq,children:Je(I)}):null,Qq?/* @__PURE__ */W("button",{type:"button",className:"bulut-footer-btn",style:Mq,onClick:mq,"aria-label":"Görevi durdur",title:"Görevi durdur",children:/* @__PURE__ */W(TV,{"aria-hidden":"true",width:22,height:22,style:{color:"hsla(215, 100%, 5%, 1)"}})}):bq?null:/* @__PURE__ */W("button",{type:"button",className:"bulut-footer-btn",style:Mq,onPointerDown:V=>{if(V.preventDefault(),!x.current)if(T.current)"vad"===oV.current?dq({discard:!0}):dq();else{if(_.current=Date.now(),nV.current=!1,qq(),V.currentTarget.setPointerCapture)try{V.currentTarget.setPointerCapture(V.pointerId)}catch{}$.current=window.setTimeout(()=>{null===_.current||x.current||T.current||(nV.current=!0,gq("press"))},250)}},onPointerUp:hq,onPointerCancel:V=>{hq(V)},disabled:Yq,"aria-label":Eq?"Kaydı iptal et":u?"Kaydı durdur":"Kaydı başlat",title:Eq?"Kaydı iptal et":u?"Kaydı durdur":"Dokun: VAD, Basılı tut: bırakınca gönder",children:/* @__PURE__ */W(Eq?KV:YV,{"aria-hidden":"true",width:22,height:22,style:{color:"hsla(215, 100%, 5%, 1)"}})})]})]})]})},Ne={backendBaseUrl:"https://api.bulut.lu",projectId:"",model:"x-ai/grok-4.1-fast",voice:"alloy",baseColor:cV.primary,agentName:"Bulut"},je=V=>{const q=V.trim();if(!(V=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(V))(q))return Ne.baseColor;if(4===q.length){const V=q[1],e=q[2],t=q[3];return`#${V}${V}${e}${e}${t}${t}`.toLowerCase()}return q.toLowerCase()},Ze=(V,q)=>{const e=je(V).slice(1),t=V=>parseInt(e.slice(V,V+2),16),n=V=>V*(1+q),o=V=>{return(q=V,Math.max(0,Math.min(255,Math.round(q)))).toString(16).padStart(2,"0");var q},r=n(t(0)),i=n(t(2)),A=n(t(4));return`#${o(r)}${o(i)}${o(A)}`},Oe=V=>{const q=je(V);cV.primary=q,cV.primaryHover=Ze(q,-.15),cV.messageUser=q},He="bulut_accessibility_mode_enabled",ze="Geist",Xe="bulut-geist-font-stylesheet",Pe=({config:V})=>{const[q,e]=qV(V),[t,n]=qV(!1);eV(()=>{if(!V.projectId)return void n(!0);let q=!1;return(async(V,q)=>{try{const e=V.replace(/\/+$/,""),t=await fetch(`${e}/projects/${q}/config`);return t.ok?await t.json():null}catch{return null}})(V.backendBaseUrl,V.projectId).then(t=>{if(!q){if(t){const q={...V,baseColor:je(t.base_color||V.baseColor),model:t.model||V.model,agentName:t.agent_name||V.agentName,voice:"alloy"===t.voice||"zeynep"===t.voice||"ali"===t.voice?t.voice:V.voice};Oe(q.baseColor),e(q)}n(!0)}}),()=>{q=!0}},[V]);const[o,r]=qV(()=>"undefined"!=typeof localStorage&&"true"===localStorage.getItem("bulut_panel_open")),[i,A]=qV(!1),[l,a]=qV(()=>"undefined"!=typeof localStorage&&"true"===localStorage.getItem(He)),[s,c]=qV(!1),[u,d]=qV(!1),[g,p]=qV(null),[h,m]=qV(!1),y=tV(null),f=(S=V=>{p(V),null!==V&&m(!1)},j=8,nV(function(){return S},[]));var S;eV(()=>{if(l)return void A(!1);if(o)return;if("undefined"!=typeof localStorage&&"true"===localStorage.getItem("bulut_bubble_shown"))return;A(!0);const V=setTimeout(()=>{A(!1),"undefined"!=typeof localStorage&&localStorage.setItem("bulut_bubble_shown","true")},5e3);return()=>clearTimeout(V)},[o,l]);const B=()=>{const V=!o;r(V),A(!1),"undefined"!=typeof localStorage&&localStorage.setItem("bulut_panel_open",String(V))};return eV(()=>{const V=V=>{"Escape"===V.key&&o&&(r(!1),"undefined"!=typeof localStorage&&localStorage.setItem("bulut_panel_open","false"))};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[o]),t?/* @__PURE__ */W(w,{children:[!o&&/* @__PURE__ */W(RV,{onMicClick:()=>y.current?.startRecording(),onCancelRecording:()=>y.current?.cancelRecording(),onStopTask:()=>y.current?.stopTask(),isRecording:s,isBusy:u,accessibilityMode:l,showBubble:i,onBubbleClick:()=>{A(!1),B()},previewMessage:h?null:g,onPreviewClick:()=>B(),onPreviewClose:()=>m(!0)}),
|
|
35
35
|
/* @__PURE__ */W(ve,{onClose:()=>{r(!1),"undefined"!=typeof localStorage&&localStorage.setItem("bulut_panel_open","false"),console.info("Bulut chat window closed.")},config:q,accessibilityMode:l,onAccessibilityToggle:()=>{const V=!l;a(V),"undefined"!=typeof localStorage&&localStorage.setItem(He,String(V)),console.info(`[Bulut] accessibility mode toggled enabled=${V}`)},hidden:!o,actionsRef:y,onRecordingChange:c,onBusyChange:d,onPreviewChange:f})]}):null},_e=`\n :host {\n all: initial;\n contain: layout style paint;\n font-family: "${ze}", sans-serif;\n color: hsla(215, 100%, 5%, 1);\n font-size: 16px;\n line-height: 1.4;\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n }\n\n #bulut-shadow-mount {\n all: initial;\n color: inherit;\n font-family: "${ze}", sans-serif;\n font-size: inherit;\n line-height: inherit;\n }\n\n #bulut-shadow-mount * {\n font-family: "${ze}", sans-serif !important;\n color: inherit;\n }\n\n #bulut-shadow-mount *, #bulut-shadow-mount *::before, #bulut-shadow-mount *::after {\n box-sizing: border-box;\n }\n`;let $e=null,Vt=null,qt=!1,et=!1;const tt=(V={})=>{if(et)return void console.warn("Bulut is already initialized");(()=>{if("undefined"==typeof document)return;if(document.getElementById(Xe))return;const V=document.createElement("link");V.id=Xe,V.rel="stylesheet",V.href="https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap",document.head.appendChild(V)})();const q=(V=>({backendBaseUrl:V.backendBaseUrl||Ne.backendBaseUrl,projectId:V.projectId||Ne.projectId,model:Ne.model,voice:Ne.voice,baseColor:Ne.baseColor,agentName:Ne.agentName}))(V);if(Oe(q.baseColor),V.containerId?($e=document.getElementById(V.containerId),qt=!1):($e=document.createElement("div"),$e.id="bulut-container",document.body.appendChild($e),qt=!0),!$e)return void console.error("Bulut: Container not found");const e=$e.shadowRoot||$e.attachShadow({mode:"open"});e.replaceChildren();const t=document.createElement("style");t.textContent=_e;const n=document.createElement("div");n.id="bulut-shadow-mount",e.append(t,n),Vt=n,K(/* @__PURE__ */W(Pe,{config:q}),n),et=!0,console.log("Bulut initialized successfully")},nt=()=>{et&&(Vt&&(K(null,Vt),Vt=null),$e&&qt&&document.body.removeChild($e),$e=null,qt=!1,et=!1,console.log("Bulut destroyed"))},ot=()=>et,rt={init:tt,destroy:nt,isReady:ot};"undefined"!=typeof window&&(window.Bulut=rt);export{Pe as BulutWidget,RV as ChatButton,ve as ChatWindow,rt as default,nt as destroy,tt as init,ot as isReady};
|
|
36
36
|
//# sourceMappingURL=embed.js.map
|