UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 3.48 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{BA as t,CC as n,TC as r,dj as i,mj as a,pj as o,zA as s}from"./control-ui-boot-shared-DFTSUQQ0.js";import{B as c,F as l,O as u,Rt as d,U as f,a as p,d as m,f as h,g,gt as _,j as v,l as y,m as b,s as x,u as S,x as C}from"./solid-runtime-C416s-HC.js";import{n as w,t as T}from"./en-chat-session-optional-iBUVV79A.js";function E(e){let t,[n,i]=c(!0),o=l(()=>e.enabled&&n()),f=()=>e.videoTitle.trim()||a(`chat.youtube.video`),x=l(()=>e.video?.watchUrl),[S,C]=c(()=>(x(),o(),!1)),[w,T]=c(()=>(x(),!1)),E,L=l(()=>{if(!e.video)return;let t=new URL(e.video.embedUrl);return t.searchParams.set(`autoplay`,`1`),t.href}),R=()=>{I.get(t.ownerDocument)===z&&I.delete(t.ownerDocument)},z=()=>{R(),C(!1)},B=()=>{I.get(t.ownerDocument)?.(),I.set(t.ownerDocument,z),C(!0)};_(()=>{let e=r([t],([e])=>{e&&i(e.contentRect.width>=200)});return()=>{e(),R()}});let V=()=>[v(u,{get when(){return!w()},get children(){var t=D();return t.addEventListener(`error`,()=>T(!0)),y(()=>e.video?.thumbnailUrl,e=>{g(t,`src`,e)}),t}}),(()=>{var e=O();return m(e,v(s,{get name(){return o()?`play`:`externalLink`}})),e})()];var H=N();return b(()=>e=>t=e,H),H._$owner=d(),m(H,v(u,{get when(){return e.video},get children(){var t=M(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,c=i.firstChild,l=c.nextSibling,x=i.nextSibling,C=x.firstChild,w=C.nextSibling,T=d();return m(n,v(u,{get when(){return h(()=>!!S())()?o():S()},get fallback(){return v(u,{get when(){return o()},get fallback(){var t=F(),n=d();return m(t,v(V,{})),y(()=>({e:e.video?.watchUrl,t:a(`chat.youtube.openVideo`,{title:f()})}),({e,t:r},i)=>{e!==i?.e&&g(t,`href`,e),r!==i?.t&&g(t,`aria-label`,r),p(t,n)}),t},get children(){var e=P();return e._$$click=B,b(()=>e=>{E=e},e),m(e,v(V,{})),y(()=>a(`chat.youtube.play`,{title:f()}),t=>{g(e,`aria-label`,t)}),e}})},get children(){var e=k();return y(()=>({e:L(),t:a(`chat.youtube.player`,{title:f()})}),({e:t,t:n},r)=>{t!==r?.e&&g(e,`src`,t),n!==r?.t&&g(e,`title`,n)}),e}})),m(c,()=>a(`chat.youtube.provider`)),m(l,f),m(x,()=>a(`chat.youtube.open`),C),m(x,v(s,{name:`externalLink`}),w),m(r,v(u,{get when(){return S()},get children(){var e=A();return e._$$click=()=>{z(),_(()=>E?.focus())},m(e,v(s,{name:`x`})),y(()=>a(`chat.youtube.close`),t=>{g(e,`aria-label`,t)}),e}}),null),m(t,v(u,{get when(){return!o()},get children(){var t=j();return m(t,()=>a(e.enabled?`chat.youtube.narrow`:`chat.youtube.strict`)),t}}),null),y(()=>({e:f(),t:e.video?.watchUrl}),({e,t:n},r)=>{e!==r?.e&&g(t,`aria-label`,e),n!==r?.t&&g(x,`href`,n),p(x,T)}),t}})),H}var D,O,k,A,j,M,N,P,F,I;function L(){return(L=e((()=>{S(),f(),t(),T(),i(),n(),D=C(`<img alt loading=lazy referrerpolicy=no-referrer>`,1),O=C(`<span class=play aria-hidden=true>`),k=C(`<iframe sandbox="allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox"allow="autoplay; encrypted-media; fullscreen; picture-in-picture"allowfullscreen referrerpolicy=strict-origin-when-cross-origin>`),A=C(`<button class=close type=button>`),j=C(`<p class=notice role=status>`),M=C(`<section class=card><div class=stage></div><div class=footer><div class=caption><span class=provider></span><p class=title></p></div><a class=watch target=_blank rel="noopener noreferrer"><!><!>`),N=C(`<openclaw-youtube-video>`,1),P=C(`<button class=preview type=button>`),F=C(`<a class=preview target=_blank rel="noopener noreferrer">`),o(w),I=new WeakMap,x([`click`])})))()}L();export{E as YouTubeVideoCard};