PageSourceSearch

https://orygofrontend-production.up.railway.app/_next/static/chunk…/[agent_id]/widget-f9b1d1fc095ff3ed.js

js orygofrontend-production.up.railway.app collected 2026-10-03 12:14:49 UTC 65,026 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3353],{6178:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/agents/[agent_id]/widget",function(){return n(69582)}])},69582:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>el});var o=n(37876),i=n(19277),s=n(43123),l=n(95563),a=n(39822),r=n(20529),d=n(32485),c=n(14232),p=n(57175),h=n(30488),u=n(98991),g=n(72953),b=n(1924),m=n(92146),x=n(77362),f=n(63132),_=n(77005),j=n(8091),y=n(44448),v=n(76839),w=n(96356),k=n(79303),S=n(11382),z=n(74801),C=n(70294),E=n(55102),W=n(36582),I=n(7931);let T=(e,t)=>{if(!e)return null;let n=String(e).replace("#","");3===n.length&&(n=n[0]+n[0]+n[1]+n[1]+n[2]+n[2]);let o=parseInt(n,16);return Number.isNaN(o)?null:"rgba(".concat(o>>16&255,",").concat(o>>8&255,",").concat(255&o,",").concat(t,")")},F={none:"none",sm:"0 4px 14px rgba(0,0,0,0.28)",md:"0 12px 32px rgba(0,0,0,0.38)",lg:"0 22px 55px rgba(0,0,0,0.50)"},M=(e,t)=>{let n=e.replace("#",""),o=3===n.length?n.split("").map(e=>e+e).join(""):n,i=parseInt(o.slice(0,2),16),s=parseInt(o.slice(2,4),16),l=parseInt(o.slice(4,6),16);return"rgba(".concat(i,", ").concat(s,", ").concat(l,", ").concat(t,")")},B=e=>{var t,n,i,s,l,r,d,p,g,b,m,f,_,j,y,v,w,S,z,B,D,R,O,A,P;let[L,N]=(0,c.useState)(!!e.defaultOpen),[$,q]=(0,c.useState)(""),[X,H]=(0,c.useState)(!1),[G,Q]=(0,c.useState)("fullscreen"===e.desktop_default_mode),[U,J]=(0,c.useState)(!1),[Y,V]=(0,c.useState)(!1);(0,c.useEffect)(()=>{if(e.forceMobile)return;let t=window.matchMedia("(max-width: 640px)");V(t.matches);let n=e=>V(e.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[e.forceMobile]);let K=!!e.forceMobile||Y;(0,c.useEffect)(()=>{U||Q("fullscreen"===e.desktop_default_mode)},[e.desktop_default_mode,U]);let Z=e.body_background_color||e.background_color||(e.theme_color,"white"),ee=K?e.mobile_position:e.desktop_position,et=K?null!=(t=e.mobile_button_screen_margin)?t:16:null!=(n=e.desktop_button_screen_margin)?n:16,en=((e,t,n)=>{let o="".concat(null!=n?n:16,"px"),i={bottom_right:{top:"unset",bottom:o,left:"unset",right:o},middle_right:{top:"50%",bottom:"unset",left:"unset",right:o},middle_left:{top:"50%",bottom:"unset",left:o,right:"unset"},elevated_right:{top:"unset",bottom:t?"80px":"100px",left:"unset",right:o},bottom_center:{top:"unset",bottom:o,left:"50%",right:"unset"},elevated_center:{top:"unset",bottom:t?"80px":"100px",left:"50%",right:"unset"}};return i[e]||i.bottom_right})(ee,K,et),eo=K?null!=(i=e.mobile_button_border_radius)?i:24:null!=(s=e.desktop_button_border_radius)?s:24,ei=null!=(r=null!=(l=e.widget_border_radius)?l:e.desktop_chat_border_radius)?r:24,es=null!=(d=e.desktop_chat_screen_margin)?d:16,el=K?null!=(g=null!=(p=e.mobile_floating_button_type)?p:e.floating_button_type)?g:"bubble":null!=(m=null!=(b=e.desktop_floating_button_type)?b:e.floating_button_type)?m:"bubble",ea=null!=(f=e.bubble_rotation_interval_ms)?f:k.z$,er=c.useMemo(()=>{var t,n,o,i;let s=K?e.mobile_bubble_messages:e.desktop_bubble_messages,l=(null!=s?s:[]).map(e=>(null!=e?e:"").trim()).filter(Boolean);if(l.length>0)return l;let a=K?null!=(n=null!=(t=e.mobile_bubble_message)?t:e.bubble_message)?n:"":null!=(i=null!=(o=e.desktop_bubble_message)?o:e.bubble_message)?i:"";return a.trim().length>0?[a.trim()]:[]},[K,e.mobile_bubble_messages,e.desktop_bubble_messages,e.mobile_bubble_message,e.desktop_bubble_message,e.bubble_message]),[ed,ec]=(0,c.useState)(0);(0,c.useEffect)(()=>{if(ec(0),er.length<2||ea<=0)return;let e=setInterval(()=>{ec(e=>(e+1)%er.length)},ea);return()=>clearInterval(e)},[er,ea]);let ep=null!=(_=er[ed])?_:"",eh=ep.trim().length>0,eu=null!=(j=e.desktop_chat_position)?j:"right",eg=null!=(y=e.desktop_width)?y:500,eb=null!=(v=e.desktop_height)?v:0,em=null!=(w=e.desktop_width_unit)?w:"vw",ex=null!=(S=e.desktop_height_unit)?S:"vh",ef=null!=(z=e.bubble_border_color)?z:"transparent",e_=null!=(B=e.desktop_opaque_background)&&B,ej=null!=(D=e.prompt_bar_desktop_width)?D:null,ey=null!=(R=e.prompt_bar_mobile_width)?R:null,ev=K&&null!=ey,ew=K?null!=ey?"min(".concat(ey,"px, calc(100% - ").concat(2*et,"px))"):"auto":"min(".concat(null!=ej?ej:440,"px, calc(100% - ").concat(2*et,"px))"),ek=null!=(O=e.floating_button_shadow)?O:null,eS=ek?F[ek]:null,ez=()=>{let e=$.trim();N(!0),q(""),e&&setTimeout(()=>{window.postMessage({type:"open-with-options",message:e,newSession:!1,source:"prompt_bar"},"*")},120)},eC=(0,I.j)(e.resolved_language||e.default_language),eE=[!1!==e.new_chat_enabled&&{key:"new_chat",label:eC.newChat,icon:C.Pj4},!1!==e.chat_history_enabled&&{key:"history",label:eC.history,icon:C.Ohp},e.faqs_enabled&&{key:"faqs",label:eC.faqs,icon:C.lrG},e.forms_enabled&&{key:"ticket",label:eC.openTicket,icon:C.X6_},e.track_my_order_enabled&&{key:"track_order",label:eC.trackOrder,icon:C.est}
1].filter(Boolean),eW=T(e.prompt_bar_background_color,null!=(A=e.prompt_bar_background_opacity)?A:.75)||"rgba(255,255,255,".concat(null!=(P=e.prompt_bar_background_opacity)?P:.75,")"),eI=T(e.prompt_bar_background_color,1)||"#ffffff";(0,c.useEffect)(()=>{if(!X)return;let e=()=>H(!1);return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[X]),(0,c.useEffect)(()=>{e.hide_bubble&&N(!1)},[e.hide_bubble]);let eT=L&&!K&&!G&&("center"===eu||e_);return(0,o.jsxs)(o.Fragment,{children:[eT&&(0,o.jsx)(a.a,{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",bg:"rgba(0, 0, 0, 0.4)",zIndex:"2147483645",onClick:()=>N(!1),transition:"opacity 0.2s ease"}),(0,o.jsx)(a.a,{border:"none",position:"fixed",boxShadow:K||G?"rgba(150, 150, 150, 0.1) 0px 3px 6px 0px":"rgba(0, 0, 0, 0.15) 0px 5px 40px 0px",bottom:K||G?"0":"center"===eu?"50%":"".concat(es,"px"),top:K||G?"0":"center"===eu||eb>0?"unset":"".concat(es,"px"),right:K||G?"0":"right"===eu?"".concat(es,"px"):"unset",left:K||G?"0":"left"===eu?"".concat(es,"px"):"center"===eu?"50%":"unset",transform:K||G||"center"!==eu?void 0:"translate(-50%, 50%)",width:K||G?"100%":"".concat(eg).concat(em),height:K||G?"100%":eb>0?"".concat(eb).concat(ex):"auto",borderRadius:K||G?"0":"".concat(ei,"px"),display:L?"flex":"none",zIndex:"2147483646",overflow:"hidden",flexDirection:"column",justifyContent:"space-between",backgroundColor:Z,transition:"all 0.2s ease",children:(0,o.jsx)(W.c,{onClose:()=>N(!1),onFullscreenToggle:()=>{J(!0),Q(!G)},isFullscreen:G,isMobile:K,deviceType:K?"mobile":"desktop",...e})}),"prompt_bar"===el?(0,o.jsxs)(a.a,{position:"fixed",top:en.top,bottom:en.bottom,right:K?ev?"unset":"".concat(et,"px"):en.right,left:K?ev?"50%":"".concat(et,"px"):en.left,transform:ev?"translateX(-50%)":K||"50%"!==en.left?"50%"===en.top?"translateY(-50%)":"none":"translateX(-50%)",width:ew,height:"60px",px:"8px",borderRadius:"".concat(eo>0?eo:32,"px"),backgroundColor:eW,backdropFilter:"blur(16px) saturate(180%)",border:"transparent"!==ef?"1px solid ".concat(ef):"1px solid rgba(255,255,255,0.4)",boxShadow:null!=eS?eS:"0 8px 30px rgba(0,0,0,0.16), 0 2px 6px rgba(0,0,0,0.08)",zIndex:"2147483645",transition:"box-shadow 0.2s ease",display:L||e.hide_bubble?"none":"flex",alignItems:"center",justifyContent:"space-between",gap:"6px",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif",cursor:"text",children:[(0,o.jsx)(a.a,{as:"button",flexShrink:0,"aria-label":"More actions",boxSize:"42px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:X?"rgba(0,0,0,0.09)":"rgba(0,0,0,0.05)",color:"#111",lineHeight:"1",cursor:"pointer",transition:"background-color 0.15s ease",onClick:e=>{e.stopPropagation(),H(e=>!e)},children:e.floating_button_icon_url?(0,o.jsx)(u._,{src:e.floating_button_icon_url,alt:"",boxSize:"24px",objectFit:"contain","aria-hidden":"true"}):(0,o.jsx)(E.pCw,{size:20})}),X&&(0,o.jsx)(a.a,{position:"absolute",bottom:"calc(100% + 10px)",left:"4px",right:"4px",bg:eI,border:"transparent"!==ef?"1px solid ".concat(ef):"1px solid rgba(0,0,0,0.06)",borderRadius:"20px",boxShadow:"0 16px 48px rgba(0,0,0,0.20), 0 2px 8px rgba(0,0,0,0.08)",p:"8px",display:"flex",flexDirection:"column",gap:"1px",zIndex:0x7ffffffe,onClick:e=>e.stopPropagation(),children:eE.map(e=>(0,o.jsxs)(a.a,{as:"button",display:"flex",alignItems:"center",gap:"12px",w:"100%",px:"12px",py:"10px",borderRadius:"10px",cursor:"pointer",color:"#1d1d1f",fontSize:"14px",fontWeight:"500",textAlign:"left",bg:"transparent",_hover:{bg:"rgba(0,0,0,0.05)"},transition:"background-color 0.12s ease",onClick:()=>{var t;t=e.key,H(!1),N(!0),setTimeout(()=>{window.postMessage({type:"open-with-options",view:t,source:"prompt_bar"},"*")},120)},children:[(0,o.jsx)(a.a,{as:e.icon,boxSize:"18px",flexShrink:0}),(0,o.jsx)(h.E,{as:"span",flex:"1 1 auto",whiteSpace:"nowrap",children:e.label})]},e.key))}),(0,o.jsx)(x.p,{flex:"1 1 auto",minW:"0",h:"100%",border:"none",outline:"none",bg:"transparent",color:"#111",fontSize:"16px",px:"8px",_focusVisible:{boxShadow:"none",outline:"none"},_placeholder:{color:"#6b7280"},placeholder:ep,value:$,onChange:e=>q(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),ez())}}),(0,o.jsx)(a.a,{as:"button",flexShrink:0,boxSize:"42px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.accent_color,color:"white",lineHeight:"1",cursor:"pointer",onClick:ez,"aria-label":"Send",children:(0,o.jsx)(C.ei4,{size:20})})]}):(0,o.jsxs)(a.a,{position:"fixed",top:en.top,bottom:en.bottom,right:en.right,left:en.left,transform:"50%"===en.top?"translateY(-50%)":"50%"===en.left?"translateX(-50%)":"none",height:"48px",px:"14px",borderRadius:"".concat(eo,"px"),backgroundColor:e.accent_color,border:"transparent"!==ef?"2px solid ".concat(ef):"none",boxShadow:null!=eS?eS:"0 4px 14px ".concat(M(e.accent_color,.35),", 0 2px 6px rgba(0, 0, 0, 0.08)"),cursor:"pointer",zIndex:"2147483645",transition:"all 0.2s ease-in-out 0s",onClick:()=>N(e=>!e),display:L||e.hide_bubble?"none":"flex",alignItems:"center",justifyContent:"center",gap:eh?"8px":"0",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif",fontSize:"15px",fontWeight:"600",color:"white",whiteSpace:"nowrap",userSelect:"none",_hover:{filter:"brightness(1.1)",boxShadow:null!=eS?eS:"0 6px 20px ".concat(M(e.accent_color,.45),", 0 3px 8px rgba(0, 0, 0, 0.1)")},children:[e.floating_button_icon_url?(0,o.jsx)(u._,{src:e.floating_button_icon_url,alt:"",boxSize:"26px",flexShrink:0,objectFit:"contain",style:{pointerEvents:"none"},"aria-hidden":"true"}):(0,o.jsx)(u._,{src:"/logo/ai-technology.png",alt:"",boxSize:"26px",flexShrink:0,style:{pointerEvents:"none",filter:"brightness(0) invert(1)"},"aria-hidden":"true"}),eh&&(0,o.jsx)(h.E,{as:"span",mb:"1px",style:{pointerEvents:"none"},children:ep})]})]})};var D=n(83388),R=n(57913),O=n(61385),A=n(82703),P=n(80161),L=n(31881);let N=(0,p.B)("button"),$=["hide_bubble","floating_button_type","floating_button_icon_url","bubble_border_color","prompt_bar_background_opacity","floating_button_shadow","bubble_rotation_interval_ms","excluded_urls"],q=["desktop_floating_button_type","desktop_position","desktop_button_border_radius","desktop_button_screen_margin","desktop_bubble_message","desktop_bubble_messages","prompt_bar_desktop_width"],X=["mobile_floating_button_type","mobile_position","mobile_button_border_radius","mobile_button_screen_margin","mobile_bubble_message","mobile_bubble_messages","prompt_bar_mobile_width"],H=["floating_button_url_rules"],G=["widget_border_radius","desktop_chat_border_radius","desktop_chat_screen_margin","desktop_default_mode","desktop_chat_position","desktop_width","desktop_height","desktop_width_unit","desktop_height_unit","desktop_opaque_background"],Q=["widget_z_index"],U=["security_allowed_domains"],J=e=>{let{assetType:t,column:n,label:i,description:l,agentId:r,isDisabled:d,currentUrl:p,widgetColor:b,onUrlChange:m,onSaved:x}=e,{trigger:f,isMutating:_}=(0,z.BP)(r,t),{trigger:j,isMutating:y}=(0,z.X7)(r,t),v=(0,c.useRef)(null),k=async e=>{var t;let o=null==(t=e.target.files)?void 0:t[0];if(o){if(!["image/png","image/jpeg","image/jpg","image/svg+xml","
1image/webp"].includes(o.type))return void O.X.create({title:"Invalid file type",description:"Please upload a PNG, JPEG, SVG, or WebP image.",type:"error",duration:5e3,closable:!0});if(o.size>2097152)return void O.X.create({title:"File too large",description:"Please upload an image smaller than 2MB.",type:"error",duration:5e3,closable:!0});try{let e=await f(o);(null==e?void 0:e.url)&&(m(n,e.url),O.X.create({title:"Success",description:"".concat(i," uploaded successfully"),type:"success",duration:5e3,closable:!0}),null==x||x())}catch(e){O.X.create({title:"Error",description:e.message||"Failed to upload ".concat(i.toLowerCase()),type:"error",duration:5e3,closable:!0})}v.current&&(v.current.value="")}},S=async()=>{try{await j(),m(n,null),O.X.create({title:"Success",description:"".concat(i," deleted successfully"),type:"success",duration:5e3,closable:!0}),null==x||x()}catch(e){O.X.create({title:"Error",description:e.message||"Failed to delete ".concat(i.toLowerCase()),type:"error",duration:5e3,closable:!0})}};return(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:i}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:3,children:l}),(0,o.jsx)("input",{type:"file",ref:v,onChange:k,accept:"image/png,image/jpeg,image/jpg,image/svg+xml,image/webp",style:{display:"none"},disabled:d||_}),p&&(0,o.jsxs)(a.a,{mb:3,children:[(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Current:"}),(0,o.jsxs)(s.s,{alignItems:"center",gap:3,children:[(0,o.jsx)(a.a,{width:"50px",height:"50px",borderRadius:"50%",border:"1.5px solid",borderColor:b,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",bg:"white",children:(0,o.jsx)(u._,{src:p,alt:i,objectFit:"contain",maxWidth:"36px",maxHeight:"36px",loading:"lazy",decoding:"async"})}),(0,o.jsxs)(g.$,{size:"xs",colorPalette:"red",variant:"ghost",onClick:S,disabled:d||y,loading:y,children:[(0,o.jsx)(w.Mst,{}),"Delete"]})]})]}),(0,o.jsxs)(g.$,{size:"sm",variant:"outline",onClick:()=>{var e;return null==(e=v.current)?void 0:e.click()},disabled:d||_,loading:_,children:[(0,o.jsx)(w.d$j,{}),p?"Replace":"Upload"]})]})},Y=[{value:"bottom_right",label:"Bottom Right"},{value:"middle_right",label:"Middle Right"},{value:"middle_left",label:"Middle Left"},{value:"elevated_right",label:"Elevated Right"},{value:"bottom_center",label:"Bottom Center"},{value:"elevated_center",label:"Bottom Center (Elevated)"}],V=["bottom_center","elevated_center"],K=(e,t)=>{var n;return null!=(n=null!=e?e:t)?n:"bubble"},Z=e=>{let{label:t,description:n,messages:i,onChange:s,isDisabled:l,placeholder:r}=e,d=null!=i?i:[],c=d.length>=k.Z;return(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:t}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:n}),(0,o.jsxs)(b.T,{align:"stretch",gap:2,children:[d.map((e,t)=>(0,o.jsxs)(m.z,{gap:2,align:"center",children:[(0,o.jsx)(x.p,{type:"text",value:e,maxLength:k.jH,onChange:e=>((e,t)=>{let n=[...d];n[e]=t,s(n)})(t,e.target.value),disabled:l,variant:"subtle",size:"sm",w:"full",placeholder:null!=r?r:"e.g., How can we help?"}),(0,o.jsx)(N,{type:"button",onClick:()=>s(d.filter((e,n)=>n!==t)),disabled:l,"aria-label":"Remove message",style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:"32px",height:"32px",borderRadius:"6px",cursor:l?"not-allowed":"pointer",color:"#ef4444"},children:(0,o.jsx)(w.Mst,{})})]},t)),(0,o.jsxs)(g.$,{size:"xs",variant:"outline",alignSelf:"flex-start",onClick:()=>{c||s([...d,""])},disabled:l||c,children:[(0,o.jsx)(w._rf,{}),"Add message",c?" (max ".concat(k.Z,")"):""]})]})]})},ee=e=>{let{value:t,inheritedType:n,onChange:i,isDisabled:s}=e;return(0,o.jsx)(f.MQ,{width:"100%",size:"sm",children:(0,o.jsxs)(f.uT,{value:null!=t?t:"",onChange:e=>i(e.target.value||null),pointerEvents:s?"none":"auto",children:[(0,o.jsxs)("option",{value:"",children:["Same as default (","prompt_bar"===n?"Prompt bar":"Bubble",")"]}),(0,o.jsx)("option",{value:"prompt_bar",children:"Prompt bar"}),(0,o.jsx)("option",{value:"bubble",children:"Bubble"})]})})},et=e=>{let{value:t,effectiveType:n,onChange:i,isDisabled:s}=e,l="prompt_bar"===n?Y.filter(e=>V.includes(e.value)):Y,a=t&&l.some(e=>e.value===t)?t:"";return(0,o.jsx)(f.MQ,{width:"100%",size:"sm",children:(0,o.jsxs)(f.uT,{value:a,onChange:e=>
1i(e.target.value||null),pointerEvents:s?"none":"auto",children:[(0,o.jsx)("option",{value:"",children:"Same as default"}),l.map(e=>(0,o.jsx)("option",{value:e.value,children:e.label},e.value))]})})},en=e=>{let{rules:t,onChange:n,desktopFallbackType:i,mobileFallbackType:s,isDisabled:l}=e,r=null!=t?t:[],d=r.length>=k.Nh,c=(e,t)=>{n(r.map((n,o)=>{if(o!==e)return n;let l={...n,...t};return"prompt_bar"===K(l.desktop_floating_button_type,i)&&l.desktop_position&&!V.includes(l.desktop_position)&&(l.desktop_position=null),"prompt_bar"===K(l.mobile_floating_button_type,s)&&l.mobile_position&&!V.includes(l.mobile_position)&&(l.mobile_position=null),l}))};return(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"URL-specific overrides"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:'Change the launcher on matching pages — its messages, position, and style (e.g. move it to the bottom-center and show "Questions about this product?" only on product pages). Rules are evaluated top to bottom — the first match wins.'}),(0,o.jsxs)(b.T,{align:"stretch",gap:4,children:[r.map((e,t)=>{let d=K(e.desktop_floating_button_type,i),p=K(e.mobile_floating_button_type,s);return(0,o.jsxs)(a.a,{borderWidth:"1px",borderRadius:"md",p:3,children:[(0,o.jsxs)(m.z,{gap:2,align:"center",mb:3,children:[(0,o.jsx)(f.MQ,{width:"130px",size:"sm",children:(0,o.jsxs)(f.uT,{value:e.match_type,onChange:e=>c(t,{match_type:e.target.value}),pointerEvents:l?"none":"auto",children:[(0,o.jsx)("option",{value:"contains",children:"Contains"}),(0,o.jsx)("option",{value:"prefix",children:"Starts with"}),(0,o.jsx)("option",{value:"regex",children:"Regex"})]})}),(0,o.jsx)(x.p,{type:"text",value:e.pattern,maxLength:k.eK,onChange:e=>c(t,{pattern:e.target.value}),disabled:l,variant:"subtle",size:"sm",w:"full",placeholder:"/products/"}),(0,o.jsx)(N,{type:"button",onClick:()=>n(r.filter((e,n)=>n!==t)),disabled:l,"aria-label":"Remove rule",style:{display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:"32px",height:"32px",borderRadius:"6px",cursor:l?"not-allowed":"pointer",color:"#ef4444"},children:(0,o.jsx)(w.Mst,{})})]}),(0,o.jsxs)(_.x,{templateColumns:"repeat(2, 1fr)",gap:3,mb:3,children:[(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"xs",fontWeight:"semibold",color:"gray.600",mb:1,children:"Desktop style"}),(0,o.jsx)(ee,{value:e.desktop_floating_button_type,inheritedType:i,onChange:e=>c(t,{desktop_floating_button_type:e}),isDisabled:l})]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"xs",fontWeight:"semibold",color:"gray.600",mb:1,children:"Mobile style"}),(0,o.jsx)(ee,{value:e.mobile_floating_button_type,inheritedType:s,onChange:e=>c(t,{mobile_floating_button_type:e}),isDisabled:l})]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"xs",fontWeight:"semibold",color:"gray.600",mb:1,children:"Desktop position"}),(0,o.jsx)(et,{value:e.desktop_position,effectiveType:d,onChange:e=>c(t,{desktop_position:e}),isDisabled:l})]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"xs",fontWeight:"semibold",color:"gray.600",mb:1,children:"Mobile position"}),(0,o.jsx)(et,{value:e.mobile_position,effectiveType:p,onChange:e=>c(t,{mobile_position:e}),isDisabled:l})]})]}),(0,o.jsxs)(b.T,{align:"stretch",gap:3,children:[(0,o.jsx)(Z,{label:"Desktop messages",description:"Shown on desktop when this rule matches.",messages:e.desktop_messages,onChange:e=>c(t,{desktop_messages:e}),isDisabled:l,placeholder:"e.g., Questions about this product?"}),(0,o.jsx)(Z,{label:"Mobile messages (optional)",description:"Falls back to the desktop messages above when empty.",messages:e.mobile_messages,onChange:e=>c(t,{mobile_messages:e}),isDisabled:l,placeholder:"e.g., Ask about this product"})]})]},t)}),(0,o.jsxs)(g.$,{size:"sm",variant:"outline",alignSelf:"flex-start",onClick:()=>{d||n([...r,{match_type:"contains",pattern:"",desktop_messages:[],mobile_messages:[],desktop_position:null,mobile_position:null,desktop_floating_button_type:null,mobile_floating_button_type:null}])},disabled:l||d,children:[(0,o.jsx)(w._rf,{}),"Add URL rule",d?" (max ".concat(k.Nh,")"):""]})]})]})},eo=e=>{var t,n,i,l,r,d,p,u,C,E,W,I,T,F,M,N,et,eo,ei,es,el,ea,er,ed,ec,ep,eh,eu,eg,eb,em;let{widgetConfig:ex,isDisabled:ef=!1,onConfigSaved:e_,agentId:ej}=e,{resolvedTheme:ey}=(0,A.j)(),[ev,ew]=(0,c.useState)(ex),[ek,eS]=(0,c.useState)(""),[ez,eC]=(0,c.useState)(""),[eE,eW]=(0,c.useState)(null),[eI,eT]=(0,c.useState)("desktop"),[eF,eM]=(0,c.useState)("iphone_14"),eB=ej||ex.agent_id,eD="".concat("https://orygofrontend-production.up.railway.app","/api/embed/").concat(eB,"/widget.js"),eR='<script src="'.concat(eD,'" defer><\/script>');(0,c.useEffect)(()=>{ew(ex)},[ex]);let eO=e=>e.some(e=>ev[e]!==ex[e]),eA=e=>e.some(e=>{var t,n;return JSON.stringify(null!=(t=ev[e])?t:null)!==JSON.stringify(null!=(n=ex[e])?n:null)}),eP=eA($),eL=eA(q),eN=eA(X),e$=eA(H),eq=eO(G),eX=eO(Q),eH=eA(U),eG=eA(L.dg),eQ=eA(L.I$),eU=eA(L.lL),eJ=eA(L.dr),eY=eA(L.wI),eV=eA(L.ui),{trigger:eK,isMutating:eZ}=(0,z.f)(eB||null),e0=async()=>{try{let{powered_by_orygo_enabled:e,...t}=ev,n=await eK(t);O.X.create({title:"Success",description:n.message,type:"success",duration:5e3,closable:!0}),e_&&e_()}catch(e){console.error(e),O.X.create({title:"Error",description:e.message,type:"error",duration:9e3,closable:!0})}},e1=e=>{ew(t=>{let n={...t};
1return e.forEach(e=>{n[e]=ex[e]}),n})},e2={form:ev,set:e=>ew(t=>({...t,...e})),resolvedTheme:ey,isDisabled:ef,agentId:eB||null,onConfigSaved:e_,surface:"widget",isSaving:eZ,onSave:e0},e5=e=>()=>e1(e),e3=null!=(t=ev.floating_button_type)?t:"bubble",e4=K(ev.desktop_floating_button_type,ev.floating_button_type),e6=K(ev.mobile_floating_button_type,ev.floating_button_type),e8="prompt_bar"===e4||"prompt_bar"===e6,e9="prompt_bar"===e4?Y.filter(e=>V.includes(e.value)):Y,e7="prompt_bar"===e6?Y.filter(e=>V.includes(e.value)):Y,te=e=>{let t=K(e.desktop_floating_button_type,e.floating_button_type),n=K(e.mobile_floating_button_type,e.floating_button_type),o={};return"prompt_bar"!==t||V.includes(e.desktop_position)||(o.desktop_position="bottom_center"),"prompt_bar"!==n||V.includes(e.mobile_position)||(o.mobile_position="bottom_center"),{...e,...o}},tt=(e,t)=>{let n="desktop"===e?"desktop_floating_button_type":"mobile_floating_button_type";ew(e=>te({...e,[n]:t}))};return(0,o.jsx)(a.a,{children:(0,o.jsxs)(_.x,{templateColumns:"repeat(2, 1fr)",gap:6,children:[(0,o.jsxs)(b.T,{style:{opacity:ef?.5:1},resize:"horizontal",overflow:"auto",maxWidth:"100%",alignItems:"flex-start",gap:1,pb:8,children:[(0,o.jsx)(L.WL,{title:"Chat",description:"How the conversation looks and behaves."}),(0,o.jsx)(L.CZ,{...e2,hasChanges:eG,onCancel:e5(L.dg)}),(0,o.jsx)(j.w,{}),(0,o.jsx)(L.iZ,{...e2,hasChanges:eQ,onCancel:e5(L.I$)}),(0,o.jsx)(j.w,{}),(0,o.jsx)(L.JL,{...e2,hasChanges:eJ,onCancel:e5(L.dr)}),(0,o.jsx)(j.w,{}),(0,o.jsx)(L.GI,{...e2,hasChanges:eU,onCancel:e5(L.lL)}),(0,o.jsx)(j.w,{}),(0,o.jsx)(L.tQ,{...e2,hasChanges:eY,onCancel:e5(L.wI)}),(0,o.jsx)(j.w,{}),(0,o.jsx)(L.bI,{...e2,hasChanges:eV,onCancel:e5(L.ui)}),(0,o.jsx)(L.WL,{title:"Launcher",description:"The button on your site, and the desktop window it opens."}),(0,o.jsxs)(R.w,{title:"General",resolvedTheme:ey,hasChanges:eP,onSave:e0,onCancel:()=>e1($),isSaving:eZ,isDisabled:ef,children:[(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Show Floating Button"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:ev.hide_bubble?"Hidden — use custom buttons or links to open the widget.":"Visible on your website."}),(0,o.jsxs)(s.s,{alignItems:"center",gap:3,children:[(0,o.jsxs)(y.lq,{checked:!ev.hide_bubble,onCheckedChange:e=>{ef||ew(t=>({...t,hide_bubble:!e.checked}))},disabled:ef,colorPalette:"blue",children:[(0,o.jsx)(y.tD,{}),(0,o.jsx)(y.oO,{})]}),(0,o.jsx)(h.E,{fontSize:"sm",children:ev.hide_bubble?"Hidden":"Visible"})]})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Default Button Style"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"The default launcher style used on every device. The compact bubble is a classic chat pill; the prompt bar is a compact AI input where visitors can type a question and send it straight into the chat. Override it per device in the Desktop and Mobile sections below."}),(0,o.jsx)(m.z,{gap:3,align:"stretch",children:[{value:"prompt_bar",title:"Prompt bar",desc:"Compact AI input + send"},{value:"bubble",title:"Bubble",desc:"Compact chat pill"}].map(e=>{let t=e3===e.value;return(0,o.jsxs)(a.a,{as:"button",onClick:()=>{var t;ef||(t=e.value,ew(e=>te({...e,floating_button_type:t})))},flex:"1",textAlign:"left",p:3,borderWidth:"1px",borderRadius:"md",borderColor:t?"blue.500":"gray.200",boxShadow:t?"0 0 0 1px var(--chakra-colors-blue-500)":"none",cursor:ef?"not-allowed":"pointer",opacity:ef?.6:1,transition:"all 0.15s ease",children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:e.title}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",children:e.desc})]},e.value)})})]}),(0,o.jsx)(j.w,{}),(0,o.jsx)(J,{assetType:"floating_button_icon",column:"floating_button_icon_url",label:e8?"Floating Button / Prompt Bar Icon":"Floating Button Icon",description:e8?"Icon shown inside the floating chat button (and in the left button of the prompt bar). If empty, the default icon is used.":"Icon shown inside the floating chat button. If empty, the default chat icon is used.",agentId:eB||null,isDisabled:ef,currentUrl:ev.floating_button_icon_url,widgetColor:ev.accent_color,onUrlChange:(e,t)=>
1{ew(n=>({...n,[e]:t}))},onSaved:e_}),e8&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Prompt Bar Transparency"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"How transparent the prompt bar background is. 0% is fully see-through (frosted glass); 100% is solid. The color comes from the shared Background Color in Appearance."}),(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)("input",{type:"range",min:0,max:100,step:1,value:Math.round((null!=(n=ev.prompt_bar_background_opacity)?n:.75)*100),onChange:e=>ew(t=>({...t,prompt_bar_background_opacity:parseInt(e.target.value)/100})),disabled:ef,style:{width:"180px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,o.jsxs)(h.E,{fontSize:"sm",fontWeight:"medium",minW:"48px",children:[Math.round((null!=(i=ev.prompt_bar_background_opacity)?i:.75)*100),"%"]})]})]})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Button Shadow"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:'Drop shadow used to highlight the floating button. Applies to both the bubble and the prompt bar. "Default" keeps the built-in shadow.'}),(0,o.jsx)(f.MQ,{width:"220px",size:"sm",children:(0,o.jsxs)(f.uT,{value:null!=(l=ev.floating_button_shadow)?l:"",onChange:e=>{if(!ef){let t=e.target.value;ew(e=>({...e,floating_button_shadow:""===t?null:t}))}},pointerEvents:ef?"none":"auto",children:[(0,o.jsx)("option",{value:"",children:"Default"}),(0,o.jsx)("option",{value:"none",children:"None"}),(0,o.jsx)("option",{value:"sm",children:"Small"}),(0,o.jsx)("option",{value:"md",children:"Medium"}),(0,o.jsx)("option",{value:"lg",children:"Large"})]})})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Button Border Color"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Border color around the floating button. Leave transparent for no border."}),(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)(x.p,{type:"color",value:ev.bubble_border_color&&"transparent"!==ev.bubble_border_color?ev.bubble_border_color:"#000000",onChange:e=>ew(t=>({...t,bubble_border_color:e.target.value})),disabled:ef,width:"60px",height:"36px",p:0,border:"none",cursor:"pointer"}),(0,o.jsx)(g.$,{size:"xs",variant:"ghost",onClick:()=>ew(e=>({...e,bubble_border_color:"transparent"})),disabled:ef,children:"Clear (no border)"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",children:"transparent"!==ev.bubble_border_color&&ev.bubble_border_color?ev.bubble_border_color:"None"})]})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Message Rotation Speed"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"How often the launcher cycles through its messages. Only applies when more than one message is configured."}),(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)("input",{type:"range",min:k.In,max:k.sS,step:500,value:null!=(r=ev.bubble_rotation_interval_ms)?r:k.z$,onChange:e=>ew(t=>({...t,bubble_rotation_interval_ms:parseInt(e.target.value)})),disabled:ef,style:{width:"180px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,o.jsxs)(h.E,{fontSize:"sm",fontWeight:"medium",minW:"52px",children:[((null!=(d=ev.bubble_rotation_interval_ms)?d:k.z$)/1e3).toFixed(1),"s"]})]})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Page Visibility"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:'The widget will not appear on pages whose URL starts with any of these prefixes. For example, adding "https://example.com/checkout" will hide the widget on all checkout pages.'}),(0,o.jsxs)(m.z,{gap:2,mb:3,children:[(0,o.jsx)(x.p,{type:"text",value:ek,onChange:e=>eS(e.target.value),onKeyDown:e=>{if("Enter"===e.key){var t;e.preventDefault();let n=ek.trim();n&&!(null!=(t=ev.excluded_urls)?t:[]).includes(n)&&(ew(e=>{var t;return{...e,excluded_urls:[...null!=(t=e.excluded_urls)?t:[],n]}}),eS(""))}},disabled:ef,variant:"subtle",size:"sm",placeholder:"https://example.com/checkout",flex:1}),(0,o.jsxs)(g.$,{size:"sm",variant:"outline",disabled:ef||!ek.trim(),onClick:()=>{var e;let t=ek.trim();t&&!(null!=(e=ev.excluded_urls)?e:[]).includes(t)&&(ew(e=>{var n;return{...e,excluded_urls:[...null!=(n=e.excluded_urls)?n:[],t]}}),eS(""))},children:[(0,o.jsx)(w._rf,{}),"Add"]})]}),(null!=(p=ev.excluded_urls)?p:[]).length>0&&(0,o.jsx)(b.T,{gap:1,align:"stretch",children:(null!=(u=ev.excluded_urls)?u:[]).map((e,t)=>(0,o.jsxs)(m.z,{gap:2,py:1.5,px:3,borderRadius:"md",bg:"dark"===ey?P.kY.blockBgColor2.dark:P.kY.blockBgColor2.light,children:[(0,o.jsx)(h.E,{fontSize:"xs",fontFamily:"mono",flex:1,truncate:!0,children:e}),(0,o.jsx)(a.a,{as:"button",cursor:"pointer",color:"gray.500",_hover:{color:"red.500"},onClick:()=>{ef||ew(e=>{var n;return{...e,excluded_urls:(null!=(n=e.excluded_urls)?n:[]).filter((e,n
1)=>n!==t)}})},pointerEvents:ef?"none":"auto","aria-label":"Remove ".concat(e),children:(0,o.jsx)(w.SXS,{size:14})})]},t))})]})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(R.w,{title:"Desktop",resolvedTheme:ey,hasChanges:eL,onSave:e0,onCancel:()=>e1(q),isSaving:eZ,isDisabled:ef,children:[(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Button Style"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:'Launcher style on desktop. Leave on "Same as default" to use the style from General.'}),(0,o.jsx)(a.a,{maxW:"220px",children:(0,o.jsx)(ee,{value:ev.desktop_floating_button_type,inheritedType:e3,onChange:e=>tt("desktop",e),isDisabled:ef})})]}),(0,o.jsx)(j.w,{}),(0,o.jsx)(Z,{label:"prompt_bar"===e4?"Placeholder Messages":"Button Text",description:"prompt_bar"===e4?"Rotating placeholder shown in the desktop prompt bar. Add several to cycle through them.":"Text shown inside the desktop chat button. Add several to rotate between them.",messages:ev.desktop_bubble_messages,onChange:e=>ew(t=>({...t,desktop_bubble_messages:e})),isDisabled:ef,placeholder:"prompt_bar"===e4?"e.g., Propose an outfit for a premiere":"e.g., Chat with us"}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Position"}),(0,o.jsxs)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:["Where the floating button appears on desktop screens.","prompt_bar"===e4?" The prompt bar is docked at the bottom, so only bottom-centered positions are available.":""]}),(0,o.jsx)(f.MQ,{width:"220px",size:"sm",children:(0,o.jsx)(f.uT,{value:ev.desktop_position,onChange:e=>{ef||ew(t=>({...t,desktop_position:e.target.value}))},pointerEvents:ef?"none":"auto",children:e9.map(e=>(0,o.jsx)("option",{value:e.value,children:e.label},e.value))})})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Button Border Radius"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Roundness of the floating button on desktop."}),(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)("input",{type:"range",min:0,max:24,step:1,value:null!=(C=ev.desktop_button_border_radius)?C:24,onChange:e=>ew(t=>({...t,desktop_button_border_radius:parseInt(e.target.value)})),disabled:ef,style:{width:"180px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,o.jsxs)(h.E,{fontSize:"sm",fontWeight:"medium",minW:"40px",children:[null!=(E=ev.desktop_button_border_radius)?E:24,"px"]})]})]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Button Screen Margin"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Distance (px) of the floating button from the screen edge on desktop."}),(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)("input",{type:"range",min:0,max:48,step:2,value:null!=(W=ev.desktop_button_screen_margin)?W:16,onChange:e=>ew(t=>({...t,desktop_button_screen_margin:parseInt(e.target.value)})),disabled:ef,style:{width:"180px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,o.jsxs)(h.E,{fontSize:"sm",fontWeight:"medium",minW:"40px",children:[null!=(I=ev.desktop_button_screen_margin)?I:16,"px"]})]})]}),"prompt_bar"===e4&&(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Prompt Bar Width"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Width (px) of the prompt bar launcher on desktop. Leave empty for the responsive default (440px). Range 200–1200."}),(0,o.jsxs)(m.z,{gap:2,align:"center",children:[(0,o.jsx)(x.p,{type:"number",min:200,max:1200,step:10,width:"120px",size:"sm",placeholder:"Default",value:null!=(T=ev.prompt_bar_desktop_width)?T:"",onChange:e=>{let t=e.target.value,n=parseInt(t,10);ew(e=>({...e,prompt_bar_desktop_width:""===t||Number.isNaN(n)?null:n}))},disabled:ef}),(0,o.jsx)(h.E,{fontSize:"sm",color:"gray.500",children:"px"})]})]})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(R.w,{title:"Mobile",resolvedTheme:ey,hasChanges:eN,onSave:e0,onCancel:()=>e1(X),isSaving:eZ,isDisabled:ef,children:[(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Button Style"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:'Launcher style on mobile. Leave on "Same as default" to use the style from General.'}),(0,o.jsx)(a.a,{maxW:"220px",children:(0,o.jsx)(ee,{value:ev.mobile_floating_button_type,inheritedType:e3,onChange:e=>tt("mobile",e),isDisabled:ef})})]}),(0,o.jsx)(j.w,{}),(0,o.jsx)(Z,{label:"prompt_bar"===e6?"Placeholder Messages":"Button Text",description:"prompt_bar"===e6?"Rotating placeholder shown in the mobile prompt bar. Add several to cycle through them.":"Text shown inside the mobile chat button. Add several to rotate between them.",messages:ev.mobile_bubble_messages,onChange:e=>ew(t=>({...t,mobile_bubble_messages:e})),isDisabled:ef,placeholder:"prompt_bar"===e6?"e.g., Ask us anything":"e.g., Chat with us"}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Position"}),(0,o.jsxs)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:["Where the floating button appears on mobile devices.","prompt_bar"===e6?" The prompt bar is docked at the bottom, so only bottom-centered positions are available.":""]}),(0,o.jsx)(f.MQ,{width:"220px",size:"sm",children:(0,o.jsx)(f.uT,{value:ev.mobile_position,onChange:e=>{ef||ew(t=>({...t,mobile_position:e.target.value}))},pointerEvents:ef?"none":"auto",children:e7.map(e=>(0,o.jsx)("option",{value:e.value,children:e.label},e.value))})})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Button Border Radius"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Roundness of the floating button on mobile."}),(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)("input",{type:"range",min:0,max:24,step:1,value:null!=(F=ev.mobile_button_border_radius)?F:24,onChange:e=>ew(t=>({...t,mobile_button_border_radius:parseInt(e.target.value)})),disabled:ef,style:{width:"180px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,o.jsxs)(h.E,{fontSize:"sm",fontWeight:"medium",minW:"40px",children:[null!=(M=ev.mobile_button_border_radius)?M:24,"px"]})]})]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Button Screen Margin"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Distance (px) of the floating button from the screen edge on mobile."}),(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)("input",{type:"range",min:0,max:48,step:2,value:null!=(N=ev.mobile_button_screen_margin)?N:16,onChange:e=>ew(t=>({...t,mobile_button_screen_margin:parseInt(e.target.value)})),disabled:ef,style:{width:"180px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,o.jsxs)(h.E,{fontSize:"sm",fontWeight:"medium",minW:"40px",children:[null!=(et=ev.mobile_button_screen_margin)?et:16,"px"]})]})]}),"prompt_bar"===e6&&(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Prompt Bar Width"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Width (px) of the prompt bar launcher on mobile. Leave empty for the responsive default (full width). Range 200–1200."}),(0,o.jsxs)(m.z,{gap:2,align:"center",children:[(0,o.jsx)(x.p,{type:"number",min:200,max:1200,step:10,width:"120px",size:"sm",placeholder:"Default",value:null!=(eo=ev.prompt_bar_mobile_width)?eo:"",onCh
1ange:e=>{let t=e.target.value,n=parseInt(t,10);ew(e=>({...e,prompt_bar_mobile_width:""===t||Number.isNaN(n)?null:n}))},disabled:ef}),(0,o.jsx)(h.E,{fontSize:"sm",color:"gray.500",children:"px"})]})]})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(R.w,{title:"Chat Panel (Desktop)",resolvedTheme:ey,hasChanges:eq,onSave:e0,onCancel:()=>e1(G),isSaving:eZ,isDisabled:ef,children:[(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Chat Panel Position"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Which side of the screen the chat panel opens on."}),(0,o.jsx)(f.MQ,{width:"200px",size:"sm",children:(0,o.jsxs)(f.uT,{value:null!=(ei=ev.desktop_chat_position)?ei:"right",onChange:e=>{ef||ew(t=>({...t,desktop_chat_position:e.target.value}))},pointerEvents:ef?"none":"auto",children:[(0,o.jsx)("option",{value:"right",children:"Right"}),(0,o.jsx)("option",{value:"left",children:"Left"}),(0,o.jsx)("option",{value:"center",children:"Center"})]})})]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Default Mode"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Initial widget size when opened on desktop. Users can still toggle between modes manually."}),(0,o.jsx)(f.MQ,{width:"200px",size:"sm",children:(0,o.jsxs)(f.uT,{value:null!=(es=ev.desktop_default_mode)?es:"standard",onChange:e=>{ef||ew(t=>({...t,desktop_default_mode:e.target.value}))},pointerEvents:ef?"none":"auto",children:[(0,o.jsx)("option",{value:"standard",children:"Standard"}),(0,o.jsx)("option",{value:"fullscreen",children:"Fullscreen"})]})})]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Chat Panel Width"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Width of the chat window. Choose a fixed pixel value or a percentage of the viewport width (vw)."}),(()=>{var e,t;let n=null!=(e=ev.desktop_width_unit)?e:"vw",i="vw"===n,s=i?20:300,l=i?100:800,a=i?50:500,r=Math.min(Math.max(null!=(t=ev.desktop_width)?t:a,s),l);return(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)("input",{type:"range",min:s,max:l,step:i?1:10,value:r,onChange:e=>ew(t=>({...t,desktop_width:parseInt(e.target.value)})),disabled:ef,style:{width:"180px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,o.jsxs)(h.E,{fontSize:"sm",fontWeight:"medium",minW:"60px",children:[r,n]}),(0,o.jsx)(f.MQ,{width:"80px",size:"sm",children:(0,o.jsxs)(f.uT,{value:n,onChange:e=>{if(ef)return;let t=e.target.value;ew(e=>{var n;let o=null!=(n=e.desktop_width)?n:a,i="vw"===t?Math.min(Math.max(o,20),100):Math.min(Math.max(o,300),800);return{...e,desktop_width_unit:t,desktop_width:i}})},pointerEvents:ef?"none":"auto",children:[(0,o.jsx)("option",{value:"vw",children:"vw"}),(0,o.jsx)("option",{value:"px",children:"px"})]})})]})})()]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Chat Panel Height"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Height of the chat window. Choose a fixed pixel value or a percentage of the viewport height (vh). Set to 0 for auto (fills viewport minus margins)."}),(()=>{var e,t;let n=null!=(e=ev.desktop_height_unit)?e:"vh",i="vh"===n,s=i?100:900,l=Math.min(Math.max(null!=(t=ev.desktop_height)?t:0,0),s);return(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)("input",{type:"range",min:0,max:s,step:i?1:10,value:l,onChange:e=>ew(t=>({...t,desktop_height:parseInt(e.target.value)})),disabled:ef,style:{width:"180px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"medium",minW:"60px",children:0===l?"Auto":"".concat(l).concat(n)}),(0,o.jsx)(f.MQ,{width:"80px",size:"sm",children:(0,o.jsxs)(f.uT,{value:n,onChange:e=>{if(ef)return;let t=e.target.value;ew(e=>{var n;let o=null!=(n=e.desktop_height)?n:0,i=0===o?0:"vh"===t?Math.min(Math.max(o,1),100):Math.min(Math.max(o,1),900);return{...e,desktop_height_unit:t,desktop_height:i}})},pointerEvents:ef?"none":"auto",children:[(0,o.jsx)("option",{value:"vh",children:"vh"}),(0,o.jsx)("option",{value:"px",children:"px"})]})})]})})()]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Chat Panel Border Radius"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Roundness of the chat panel window on desktop."}),(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)("input",{type:"range",min:0,max:32,step:1,value:null!=(ea=null!=(el=ev.widget_border_radius)?el:ev.de
1sktop_chat_border_radius)?ea:24,onChange:e=>{let t=parseInt(e.target.value);ew(e=>({...e,widget_border_radius:t,desktop_chat_border_radius:t}))},disabled:ef,style:{width:"180px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,o.jsxs)(h.E,{fontSize:"sm",fontWeight:"medium",minW:"40px",children:[null!=(ed=null!=(er=ev.widget_border_radius)?er:ev.desktop_chat_border_radius)?ed:24,"px"]})]})]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Chat Panel Screen Margin"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Distance (px) of the chat panel from the screen edge on desktop."}),(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)("input",{type:"range",min:0,max:48,step:2,value:null!=(ec=ev.desktop_chat_screen_margin)?ec:16,onChange:e=>ew(t=>({...t,desktop_chat_screen_margin:parseInt(e.target.value)})),disabled:ef,style:{width:"180px",cursor:"pointer",accentColor:"#3B82F6"}}),(0,o.jsxs)(h.E,{fontSize:"sm",fontWeight:"medium",minW:"40px",children:[null!=(ep=ev.desktop_chat_screen_margin)?ep:16,"px"]})]})]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Opaque Background"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Show a dark overlay behind the chat panel on desktop. Helps focus attention on the chat."}),(0,o.jsxs)(s.s,{alignItems:"center",gap:3,children:[(0,o.jsxs)(y.lq,{checked:null!=(eh=ev.desktop_opaque_background)&&eh,onCheckedChange:e=>{ef||ew(t=>({...t,desktop_opaque_background:e.checked}))},disabled:ef,colorPalette:"blue",children:[(0,o.jsx)(y.tD,{}),(0,o.jsx)(y.oO,{})]}),(0,o.jsx)(h.E,{fontSize:"sm",children:null!=(eu=ev.desktop_opaque_background)&&eu?"Enabled":"Disabled"})]})]})]}),(0,o.jsx)(j.w,{}),(0,o.jsx)(R.w,{title:"URL Overrides",resolvedTheme:ey,hasChanges:e$,onSave:e0,onCancel:()=>e1(H),isSaving:eZ,isDisabled:ef,children:(0,o.jsx)(en,{rules:ev.floating_button_url_rules,onChange:e=>ew(t=>({...t,floating_button_url_rules:e})),desktopFallbackType:e4,mobileFallbackType:e6,isDisabled:ef})}),(0,o.jsx)(L.WL,{title:"Installation",description:"Add the widget to your site, plus developer options."}),(0,o.jsxs)(R.w,{title:"Embed Widget",resolvedTheme:ey,hasChanges:eX,onSave:e0,onCancel:()=>e1(Q),isSaving:eZ,isDisabled:ef,children:[(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Script Code"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Copy and paste this script tag into your website's HTML. This is always required, regardless of how the widget is triggered."}),(0,o.jsx)(m.z,{mb:2,children:(0,o.jsxs)(g.$,{size:"xs",variant:"outline",disabled:ef,onClick:()=>{navigator.clipboard.writeText(eR),O.X.create({title:"Copied!",description:"Script code copied to clipboard",type:"success",duration:3e3,closable:!0})},children:[(0,o.jsx)(w.$G0,{}),"Copy"]})}),(0,o.jsx)(v.T,{value:ef?"":eR,readOnly:!0,variant:"subtle",height:"60px",size:"sm",fontFamily:"mono",fontSize:"xs"})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Widget z-index"}),(0,o.jsxs)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:["Stacking order of the widget on your website. Default ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:999999})," sits above ordinary page content but below cookie/consent banners. Increase it if the widget appears behind elements of your site, decrease it if it covers consent banners or other modals."]}),(0,o.jsxs)(m.z,{gap:3,align:"center",children:[(0,o.jsx)(x.p,{type:"number",min:0,step:1,value:null!=(eg=ev.widget_z_index)?eg:999999,onChange:e=>{if(ef)return;let t=e.target.value;if(""===t)return void ew(e=>({...e,widget_z_index:void 0}));let n=parseInt(t,10);Number.isFinite(n)&&n>=0&&ew(e=>({...e,widget_z_index:n}))},disabled:ef,variant:"subtle",size:"sm",width:"180px"}),(0,o.jsx)(g.$,{size:"xs",variant:"ghost",onClick:()=>ew(e=>({...e,widget_z_index:999999})),disabled:ef,children:"Reset to default"})]})]})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(R.w,{title:"Custom Button",resolvedTheme:ey,children:[(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Custom Button"}),(0,o.jsxs)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:["Drop this anywhere on your site. All parameters are optional — combine any of them in a single"," ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"OrygoWidget.open(...)"})," call."]}),(0,o.jsx)(m.z,{mb:1,children:(0,o.jsxs)(g.$,{size:"xs",variant:"outline",disabled:ef,onClick:()=>{navigator.clipboard.writeText('<button onclick="OrygoWidget.open()">Chat with us</button>'),O.X.create({title:"Copied!",description:"Snippet copied to clipboard",type:"success",duration:3e3,closable:!0})},children:[(0,o.jsx)(w.$G0,{}),"Copy"]})}),(0,o.jsx)(v.T,{value:'<button onclick="OrygoWidget.open()">Chat with us</button>',readOnly:!0,variant:"subtle",height:"40px",size:"sm",fontFamily:"mono",fontSize:"xs"})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",mb:1,children:"Parameters"}),(0,o.jsxs)(h.E,{fontSize:"xs",color:"gray.500",mb:3,children:["Pass any combination of these inside the options object:"," ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"OrygoWidget.open({ ... })"}),"."]}),(0,o.jsx)(b.T,{align:"stretch",gap:3,children:[{name:"fullscreen",type:"boolean",desc:'Open the widget in 
1its fullscreen layout instead of the floating side panel. Ideal for hero CTAs, help-center entry points, or "Talk to our AI" pages where the chat should take over the screen. On mobile the layout is always fullscreen, so this is a no-op there.'},{name:"message",type:"string",desc:"Auto-send a first user message on the visitor’s behalf as soon as the widget opens. Perfect for an AI search bar — read your input field’s value and pass it here. The message is sent through the same pipeline as if the visitor had typed it themselves (rate limiter, tracking, streaming)."},{name:"newSession",type:"boolean",desc:"Start a fresh chat instead of continuing the visitor’s previous conversation. Recommended whenever you pass message so each query gets its own thread. If a previous AI reply is still streaming, it will be cancelled and superseded by the new query."}].map(e=>(0,o.jsxs)(a.a,{borderLeft:"3px solid",borderColor:"gray.300",pl:3,children:[(0,o.jsxs)(m.z,{gap:2,mb:1,alignItems:"baseline",children:[(0,o.jsx)(h.E,{fontFamily:"mono",fontSize:"sm",fontWeight:"semibold",children:e.name}),(0,o.jsx)(h.E,{fontFamily:"mono",fontSize:"xs",color:"gray.500",children:e.type})]}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.600",lineHeight:"1.55",children:e.desc})]},e.name))})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",mb:1,children:"Examples"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:3,children:"Copy-paste any of these snippets directly into your site."}),(0,o.jsx)(b.T,{align:"stretch",gap:4,children:[{title:"Open in fullscreen layout",desc:"Hero CTA / help-center entry point.",code:'<button onclick="OrygoWidget.open({ fullscreen: true })">Talk to our AI</button>',height:"40px"},{title:"Open with a prefilled message",desc:'Send a fixed question on click — useful for "Need help with returns?" style buttons.',code:"<button onclick=\"OrygoWidget.open({ message: 'I need help with my order' })\">Need help?</button>",height:"40px"},{title:"AI search bar (the full pattern)",desc:"Read the visitor’s query from your input, open in fullscreen, and start a fresh chat for it.",code:'<input id="ai-search" type="text" placeholder="Search with AI..." />\n<button onclick="OrygoWidget.open({\n  fullscreen: true,\n  message: document.getElementById(\'ai-search\').value,\n  newSession: true\n})">Search with AI</button>',height:"120px"}].map(e=>(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"xs",fontWeight:"semibold",mb:1,children:e.title}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:1,children:e.desc}),(0,o.jsx)(m.z,{mb:1,children:(0,o.jsxs)(g.$,{size:"xs",variant:"outline",disabled:ef,onClick:()=>{navigator.clipboard.writeText(e.code),O.X.create({title:"Copied!",description:"".concat(e.title," copied to clipboard"),type:"success",duration:3e3,closable:!0})},children:[(0,o.jsx)(w.$G0,{}),"Copy"]})}),(0,o.jsx)(v.T,{value:e.code,readOnly:!0,variant:"subtle",height:e.height,size:"sm",fontFamily:"mono",fontSize:"xs"})]},e.title))})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",mb:1,children:"Without JavaScript (data-attributes)"}),(0,o.jsxs)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:["Prefer a declarative approach? Add"," ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"data-orygo-open"})," to any element and configure it through sibling attributes — no JS required."]}),(0,o.jsx)(m.z,{mb:1,children:(0,o.jsxs)(g.$,{size:"xs",variant:"outline",disabled:ef,onClick:()=>{navigator.clipboard.writeText('<input id="ai-search" type="text" placeholder="Search with AI..." />\n<a href="#"\n   data-orygo-open\n   data-orygo-fullscreen\n   data-orygo-new-session\n   data-orygo-message-from="#ai-search">\n  Search with AI\n</a>'),O.X.create({title:"Copied!",description:"Data-attribute snippet copied to clipboard",type:"success",duration:3e3,closable:!0})},children:[(0,o.jsx)(w.$G0,{}),"Copy"]})}),(0,o.jsx)(v.T,{value:'<input id="ai-search" type="text" placeholder="Search with AI..." />\n<a href="#"\n   data-orygo-open\n   data-orygo-fullscreen\n   data-orygo-new-session\n   data-orygo-message-from="#ai-search">\n  Search with AI\n</a>',readOnly:!0,variant:"subtle",height:"140px",size:"sm",fontFamily:"mono",fontSize:"xs"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mt:3,mb:2,children:"Each parameter has a matching attribute:"}),(0,o.jsx)(b.T,{align:"stretch",gap:1,children:[["data-orygo-open","Marks the element as a widget trigger (required)."],["data-orygo-fullscreen","→ fullscreen: true"],["data-orygo-new-session","→ newSession: true"],['data-orygo-message="..."','→ message: "..." (literal string)'],['data-orygo-message-from="#input-id"',"→ message: read from the matching input/textarea value"]].map(e=>{let[t,n]=e;return(0,o.jsxs)(m.z,{gap:3,alignItems:"baseline",children:[(0,o.jsx)(h.E,{fontFamily:"mono",fontSize:"xs",minWidth:"240px",color:"gray.700",children:t}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.600",fontFamily:"mono",children:n})]},t)})})]}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Full JavaScript API"}),(0,o.jsxs)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:["Other methods exposed on"," ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"window.OrygoWidget"})," for programmatic control."]}),(0,o.jsx)(v.T,{value:"OrygoWidget.open(options?)    // Unified opener (see Parameters above)\nOrygoWidget.close()            // Close the chat widget\nOrygoWidget.toggle(
1)           // Toggle open/close\nOrygoWidget.isOpen()           // Returns true if widget is open\nOrygoWidget.setFullscreen(bool)// Switch layout without forcing the panel open\nOrygoWidget.isFullscreen()     // Returns true if currently in fullscreen layout\nOrygoWidget.on(evt, handler)   // Subscribe to a widget event (returns an unsubscribe fn)\nOrygoWidget.off(evt, handler)  // Remove a subscription",readOnly:!0,variant:"subtle",height:"160px",size:"sm",fontFamily:"mono",fontSize:"xs"}),(0,o.jsxs)(h.E,{fontSize:"xs",color:"gray.500",mt:3,children:["URL hash triggers also work for deep-linking from static pages:"," ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"#orygo-chat"})," and"," ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"#orygo-chat-fullscreen"}),"."]})]})]}),(0,o.jsx)(j.w,{}),(0,o.jsx)(R.w,{title:"Security",resolvedTheme:ey,hasChanges:eH,onSave:e0,onCancel:()=>e1(U),isSaving:eZ,isDisabled:ef,children:(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",children:"Allowed Domains"}),(0,o.jsxs)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:["Restrict the chat to only work when embedded on these domains. Leave empty to allow the widget everywhere (default). Add your storefront hostname, e.g. ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"www.mystore.com"}),", or a wildcard like ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"*.mystore.com"})," to include subdomains. Rate limiting and invisible bot protection are always on and managed by OrygoAI."]}),(0,o.jsxs)(m.z,{gap:2,mb:3,children:[(0,o.jsx)(x.p,{type:"text",value:ez,onChange:e=>eC(e.target.value),onKeyDown:e=>{if("Enter"===e.key){var t;e.preventDefault();let n=ez.trim().toLowerCase();n&&!(null!=(t=ev.security_allowed_domains)?t:[]).includes(n)&&(ew(e=>{var t;return{...e,security_allowed_domains:[...null!=(t=e.security_allowed_domains)?t:[],n]}}),eC(""))}},disabled:ef,variant:"subtle",size:"sm",placeholder:"www.mystore.com",flex:1}),(0,o.jsxs)(g.$,{size:"sm",variant:"outline",disabled:ef||!ez.trim(),onClick:()=>{var e;let t=ez.trim().toLowerCase();t&&!(null!=(e=ev.security_allowed_domains)?e:[]).includes(t)&&(ew(e=>{var n;return{...e,security_allowed_domains:[...null!=(n=e.security_allowed_domains)?n:[],t]}}),eC(""))},children:[(0,o.jsx)(w._rf,{}),"Add"]})]}),(null!=(eb=ev.security_allowed_domains)?eb:[]).length>0?(0,o.jsx)(b.T,{gap:1,align:"stretch",children:(null!=(em=ev.security_allowed_domains)?em:[]).map((e,t)=>(0,o.jsxs)(m.z,{gap:2,py:1.5,px:3,borderRadius:"md",bg:"dark"===ey?P.kY.blockBgColor2.dark:P.kY.blockBgColor2.light,children:[(0,o.jsx)(h.E,{fontSize:"xs",fontFamily:"mono",flex:1,truncate:!0,children:e}),(0,o.jsx)(a.a,{as:"button",cursor:"pointer",color:"gray.500",_hover:{color:"red.500"},onClick:()=>{ef||ew(e=>{var n;return{...e,security_allowed_domains:(null!=(n=e.security_allowed_domains)?n:[]).filter((e,n)=>n!==t)}})},pointerEvents:ef?"none":"auto","aria-label":"Remove ".concat(e),children:(0,o.jsx)(w.SXS,{size:14})})]},t))}):(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.400",children:"No domain restriction — the widget works on any site where it's embedded."})]})}),(0,o.jsx)(j.w,{}),(0,o.jsxs)(R.w,{title:"Analytics & Events",resolvedTheme:ey,children:[(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",mb:1,children:"Available Events"}),(0,o.jsxs)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:["Every event is dispatched on ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"window"})," as a"," ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"CustomEvent"})," named"," ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"orygo-widget-<name>"}),". The event payload is accessible via ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"event.detail"})," and always includes ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"agentId"})," and"," ",(0,o.jsx)(h.E,{as:"span",fontFamily:"mono",children:"timestamp"}),"."]}),(0,o.jsx)(v.T,{value:'script-loaded       - embed script initialized\nloaded              - widget iframe finished loading\nopened              - chat widget opened by the user\nclosed              - chat widget closed by the user\nonline / offline    - network connectivity change\nmessage-sent        - user sent a message   { messageId, message }\nmessage-received    - AI finished streaming  { messageId }\ncontact-submitted   - contact form submitted { name?, email?, phone? }\nquick-action-click  - quick-action button clicked { label, message }\nlearn-more-click    - internal "Scopri di pi\xf9" clicked { product_name }\nproduct-url-click   - product link clicked   { product_name, product_url, link_type: "internal"|"external" }\nexternal-link-click - link inside an AI reply clicked { href, label? }\nadd-to-cart-click   - Add to cart clicked    { product_url }\nprefill-injected    - host-page prefill auto-sent { newSession, messageLength }\nprefill-rejected    - host-page prefill dropped   { reason }\nerror               - runtime error          { messageId?, error }',readOnly:!0,variant:"subtle",height:"280px",size:"sm",fontFamily:"mono",fontSize:"xs"})]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",mb:1,children:"PostHog Snippet"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Drop this on pages where the widget is loaded and PostHog is initialized. Every widget event is forwarded to PostHog with the same payload."}),(0,o.jsx)(m.z,{mb:2,children:(0,o.jsxs)(g.$,{size:"xs",variant:"outline",disabled:ef,onClick:()=>{navigator.clipboard.writeText("<script>\n  (function () {\n    if (!window.OrygoWidget || !window.posthog) return;\n    var events = [\n      'opened', 'closed',\n      'message-sent', 'message-received',\n      'contact-submitted',\n      'quick-action-click',\n      'learn-more-click',\n      'product-url-click',\n      'external-link-click',\n      'add-to-cart-click',\n      'error'\n    ];
1\n    events.forEach(function (name) {\n      OrygoWidget.on(name, function (detail) {\n        posthog.capture('chat_' + name.replace(/-/g, '_'), detail || {});\n      });\n    });\n  })();\n<\/script>"),O.X.create({title:"Copied!",description:"PostHog snippet copied to clipboard",type:"success",duration:3e3,closable:!0})},children:[(0,o.jsx)(w.$G0,{}),"Copy"]})}),(0,o.jsx)(v.T,{value:"<script>\n  (function () {\n    if (!window.OrygoWidget || !window.posthog) return;\n    var events = [\n      'opened', 'closed',\n      'message-sent', 'message-received',\n      'contact-submitted',\n      'quick-action-click',\n      'learn-more-click',\n      'product-url-click',\n      'external-link-click',\n      'add-to-cart-click',\n      'error'\n    ];\n    events.forEach(function (name) {\n      OrygoWidget.on(name, function (detail) {\n        posthog.capture('chat_' + name.replace(/-/g, '_'), detail || {});\n      });\n    });\n  })();\n<\/script>",readOnly:!0,variant:"subtle",height:"260px",size:"sm",fontFamily:"mono",fontSize:"xs"})]}),(0,o.jsxs)(a.a,{children:[(0,o.jsx)(h.E,{fontSize:"sm",fontWeight:"semibold",mb:1,children:"Plain JavaScript"}),(0,o.jsx)(h.E,{fontSize:"xs",color:"gray.500",mb:2,children:"Works without any analytics SDK. Also usable directly from Google Tag Manager."}),(0,o.jsx)(v.T,{value:"// Using the helper API\nOrygoWidget.on('opened',          (d) => console.log('chat opened', d));\nOrygoWidget.on('message-sent',    (d) => console.log('message sent', d));\nOrygoWidget.on('product-url-click', (d) => console.log('product click', d));\n\n// Equivalent low-level listener\nwindow.addEventListener('orygo-widget-opened', (e) => {\n  console.log('chat opened', e.detail);\n});",readOnly:!0,variant:"subtle",height:"140px",size:"sm",fontFamily:"mono",fontSize:"xs"})]})]})]}),(0,o.jsxs)(a.a,{children:[(()=>{let e=(()=>{let e=Array.from(new Set((Array.isArray(ev.supported_languages)?ev.supported_languages:[]).map(e=>(0,S.JV)(e)).filter(Boolean))),t=(0,S.JV)(ev.default_language)||"it";return e.length>0?e:[t]})(),t="dark"===ey?P.kY.blockBorderColor.dark:P.kY.blockBorderColor.light,n=e.length>1;return(0,o.jsxs)(m.z,{gap:2,mb:3,alignItems:"center",flexWrap:"wrap",children:[(0,o.jsx)(m.z,{gap:0,border:"1px solid",borderColor:t,borderRadius:"md",overflow:"hidden",h:"28px",children:["desktop","mobile"].map(e=>{let t=eI===e;return(0,o.jsx)(g.$,{size:"xs",variant:t?"solid":"ghost",borderRadius:"0",h:"28px",px:2,title:"desktop"===e?"Desktop preview":"Mobile preview",onClick:()=>eT(e),children:"desktop"===e?(0,o.jsx)(w.MD9,{}):(0,o.jsx)(w.FSR,{})},e)})}),"mobile"===eI&&(0,o.jsx)(f.MQ,{width:"auto",size:"xs",minW:"140px",children:(0,o.jsx)(f.uT,{value:eF,onChange:e=>eM(e.target.value),title:"Simulated device viewport",children:D.j.map(e=>(0,o.jsx)("option",{value:e.id,children:e.label},e.id))})}),n&&(0,o.jsxs)(m.z,{gap:1,alignItems:"center",children:[(0,o.jsx)(a.a,{color:"gray.500",display:"inline-flex",alignItems:"center",children:(0,o.jsx)(w.xIS,{})}),(0,o.jsx)(f.MQ,{width:"auto",size:"xs",minW:"120px",children:(0,o.jsxs)(f.uT,{value:null!=eE?eE:"",onChange:e=>{eW((0,S.JV)(e.target.value)||null)},title:"Preview language",children:[(0,o.jsx)("option",{value:"",children:"Default"}),e.map(e=>(0,o.jsx)("option",{value:e,children:(e=>{let t=(0,S.JV)(e)||e,n=S.mN.find(e=>e.code===t);return n?"".concat(n.label," (").concat(n.code,")"):t})(e)},e))]})})]})]})})(),(0,o.jsx)(a.a,{h:"100%",w:"100%",id:"widget",children:eB&&(()=>{let e={...(0,S.kn)(ev,eE)};if("mobile"===eI){var t;let n=null!=(t=D.j.find(e=>e.id===eF))?t:D.j[2],i=Math.min(320/n.width,600/n.height),l=n.width*i,r=n.height*i;return(0,o.jsxs)(s.s,{direction:"column",alignItems:"center",w:"100%",py:4,gap:2,children:[(0,o.jsx)(a.a,{w:"".concat(l,"px"),h:"".concat(r,"px"),position:"relative",flexShrink:0,children:(0,o.jsx)(a.a,{w:"".concat(n.width,"px"),h:"".concat(n.height,"px"),transformOrigin:"top left",style:{transform:"scale(".concat(i,")")},borderRadius:"24px",border:"1px solid",borderColor:"dark"===ey?P.kY.blockBorderColor.dark:P.kY.blockBorderColor.light,bg:"white",overflow:"hidden",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.08)",children:(0,o.jsx)(B,{agentId:eB,welcomeMessage:e.welcome_message,agentName:e.chat_name,...e,language:e.resolved_language,forceMobile:!0},"preview-mobile-".concat(n.id))})}),(0,o.jsxs)(h.E,{fontSize:"2xs",color:"gray.500",children:[n.label," — ",n.width," \xd7 ",n.height," \xb7 ",Math.round(100*i),"%"]})]})}return(0,o.jsx)(B,{agentId:eB,welcomeMessage:e.welcome_message,agentName:e.chat_name,...e,language:e.resolved_language},"preview-desktop")})()})]})]})})};var ei=n(90096),es=n(54616);let el=(0,i.A)(function(){let e=(0,ei._)(),{data:t,isLoading:n,mutate:i}=(0,z.IC)(e);
1return(0,o.jsx)(es.G,{scope:"agent_config",excludeRoles:[3],children:n||!t?(0,o.jsx)(s.s,{justifyContent:"center",alignItems:"center",minHeight:"400px",children:(0,o.jsx)(l.y,{size:"xl"})}):(0,o.jsx)(s.s,{w:"100%",flexDirection:"column",alignItems:"center",children:(0,o.jsxs)(a.a,{w:"100%",position:"relative",children:[(0,o.jsx)(r.D,{size:"md",mb:"4",children:"Widget Configuration"}),(0,o.jsx)(eo,{widgetConfig:t,onConfigSaved:i,agentId:e}),(0,o.jsx)(d.h,{my:"2rem"})]})})})})}},e=>{e.O(0,[3302,5015,4e3,5276,3492,4112,2324,8293,2647,7017,2397,6379,8802,9897,636,6593,8792],()=>e(e.s=6178)),_N_E=e.O()}]);

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