archy/demo/aiui/assets/index-Db_Wzg4I.js

50 lines
298 KiB
JavaScript
Raw Normal View History

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatPage-C2on_8FI.js","assets/chat-DlXHO11l.js","assets/ChatWindow.vue_vue_type_script_setup_true_lang-7vgqEAo_.js","assets/useNostr-r0q7Zk5I.js","assets/ChatWindow-CwFp9jEi.css","assets/FilmGrid.vue_vue_type_script_setup_true_lang-Cl2DU5il.js","assets/useContentImages-DEvPOTqY.js","assets/SongGrid.vue_vue_type_script_setup_true_lang-BIWcNOWf.js","assets/FilmDetail.vue_vue_type_script_setup_true_lang-BLBfc-Dd.js","assets/SongDetail.vue_vue_type_script_setup_true_lang-DDoNuI2v.js","assets/ChatPage-CA2cZZjS.css","assets/GuidePage-CdB1uP7p.js","assets/GuidePage-BvYaLEzG.css","assets/WidgetDemoPage-EOJpdsOy.js","assets/WidgetDemoPage-BSWX2CxO.css","assets/ConversationViewerPage-BeR2xi5F.js"])))=>i.map(i=>d[i]);
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(i){if(i.ep)return;i.ep=!0;const r=n(i);fetch(i.href,r)}})();const td="modulepreload",nd=function(e){return"/aiui/"+e},Bl={},tn=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let a=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=o?.nonce||o?.getAttribute("nonce");i=a(n.map(c=>{if(c=nd(c),c in Bl)return;Bl[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":td,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((p,v)=>{d.addEventListener("load",p),d.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&r(l.reason);return t().catch(r)})};function el(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Oe={},ys=[],sn=()=>{},Cc=()=>!1,Tr=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),tl=e=>e.startsWith("onUpdate:"),Je=Object.assign,nl=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},sd=Object.prototype.hasOwnProperty,Se=(e,t)=>sd.call(e,t),ie=Array.isArray,bs=e=>Ai(e)==="[object Map]",Rs=e=>Ai(e)==="[object Set]",Vl=e=>Ai(e)==="[object Date]",ue=e=>typeof e=="function",Be=e=>typeof e=="string",jt=e=>typeof e=="symbol",Ce=e=>e!==null&&typeof e=="object",kc=e=>(Ce(e)||ue(e))&&ue(e.then)&&ue(e.catch),Sc=Object.prototype.toString,Ai=e=>Sc.call(e),id=e=>Ai(e).slice(8,-1),Pc=e=>Ai(e)==="[object Object]",Er=e=>Be(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Qs=el(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),xr=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},rd=/-\w/g,Nt=xr(e=>e.replace(rd,t=>t.slice(1).toUpperCase())),od=/\B([A-Z])/g,Hn=xr(e=>e.replace(od,"-$1").toLowerCase()),Ar=xr(e=>e.charAt(0).toUpperCase()+e.slice(1)),qr=xr(e=>e?`on${Ar(e)}`:""),$n=(e,t)=>!Object.is(e,t),Ki=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Rc=(e,t,n,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},Cr=e=>{const t=parseFloat(e);return isNaN(t)?e:t},ld=e=>{const t=Be(e)?Number(e):NaN;return isNaN(t)?e:t};let zl;const kr=()=>zl||(zl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Dn(e){if(ie(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],i=Be(s)?fd(s):Dn(s);if(i)for(const r in i)t[r]=i[r]}return t}else if(Be(e)||Ce(e))return e}const ad=/;(?![^(]*\))/g,cd=/:([^]+)/,ud=/\/\*[^]*?\*\//g;function fd(e){const t={};return e.replace(ud,"").split(ad).forEach(n=>{if(n){const s=n.split(cd);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function qe(e){let t="";if(Be(e))t=e;else if(ie(e))for(let n=0;n<e.length;n++){const s=qe(e[n]);s&&(t+=s+" ")}else if(Ce(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const dd="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",hd=el(dd);functi
`);c.push(`**Installed apps on this node:**
${u}
You can view recent app logs by requesting the tail-logs action with an appId.`)}if(Gt.value.includes("system")&&Hs.value.name){const u=Hs.value;c.push(`**System:** ${u.name}${u.version?" v"+u.version:""}`)}if(Gt.value.includes("network")){const u=Bi.value;c.push(`**Network:** ${u.connected?"Connected":"Disconnected"}`)}if(Gt.value.includes("wallet")&&js.value.available){const u=js.value,f=[];u.alias&&f.push(u.alias),u.num_active_channels!==void 0&&f.push(`${u.num_active_channels} channels`),u.num_peers!==void 0&&f.push(`${u.num_peers} peers`),u.balance_sats!==void 0&&f.push(`On-chain: ${u.balance_sats.toLocaleString()} sats`),u.channel_balance_sats!==void 0&&f.push(`In channels: ${u.channel_balance_sats.toLocaleString()} sats`),u.synced_to_chain!==void 0&&f.push(u.synced_to_chain?"synced":"syncing"),c.push(`**Lightning (LND):** ${f.join(" | ")}`)}if(Gt.value.includes("bitcoin")&&Vs.value.available){const u=Vs.value,f=u.sync_progress?(u.sync_progress*100).toFixed(2)+"%":"unknown",d=[`Block ${u.block_height?.toLocaleString()??"?"}`,`${f} synced`];u.chain&&d.push(u.chain),u.mempool_tx_count&&d.push(`mempool: ${u.mempool_tx_count.toLocaleString()} txs`),c.push(`**Bitcoin:** ${d.join(", ")}`)}if(Gt.value.includes("files")&&Bs.value.length>0){const u=Bs.value,f=u.filter(E=>E.type==="folder"),d=u.filter(E=>E.type==="file"),p=d.filter(E=>/\.(jpg|jpeg|png|gif|webp|svg|heic|heif)$/i.test(E.name)),v=d.filter(E=>/\.(mp4|mkv|avi|mov|webm)$/i.test(E.name)),b=d.filter(E=>/\.(mp3|flac|wav|ogg|m4a|aac|opus)$/i.test(E.name)),I=d.filter(E=>/\.(pdf|doc|docx|txt|md|ods|xlsx|csv)$/i.test(E.name)),x=[`${u.length} items`];f.length>0&&x.push(`${f.length} folders (${f.map(E=>E.name).join(", ")})`),p.length>0&&x.push(`${p.length} images`),v.length>0&&x.push(`${v.length} videos`),b.length>0&&x.push(`${b.length} audio files`),I.length>0&&x.push(`${I.length} documents`);const w=d.slice(0,15).map(E=>E.name).join(", ");c.push(`**Files:** ${x.join(" | ")}
Recent: ${w}
You can read file contents by requesting the read-file action with a file path.`)}return c.length===0?"":`
**Archy Node Context** (this user is running AIUI on their Archipelago node):
${c.join(`
`)}
You can help the user manage their node, check service status, browse files, and recommend apps. Available actions: open an app (open-app), install an app (install-app), tail app logs (tail-logs), read a file (read-file), navigate in Archy (navigate). When recommending apps, use [[app_ext:...]] tags and check if they're already installed. When discussing the user's files, mention specific files you can see. If the user asks about their photos, videos, or music, reference the file counts above.`}function a(){for(const c of Vi)c();Vi=[],An.destroy(),Cn.value=!1}return{isEmbedded:St(co),isInitialized:St(Cn),permissions:St(Gt),accentColor:St(nc),installedApps:St(Fs),systemInfo:St(Hs),networkInfo:St(Bi),walletInfo:St(js),fileList:St(Bs),bitcoinInfo:St(Vs),init:e,destroy:a,refreshContext:n,requestAction:s,readFile:i,tailLogs:r,buildArchyContext:l}}function Qm(){const e=Q(0),t=Q(!1),n=Q(typeof window<"u"?window.innerHeight:0);let s=typeof window<"u"?window.innerHeight:0,i=null;function r(){i&&clearTimeout(i),i=setTimeout(()=>{const l=window.visualViewport;if(!l)return;const a=Math.max(0,s-l.height);e.value=a,t.value=a>100,n.value=l.height},50)}function o(){const l=window.visualViewport;l&&!t.value&&(s=l.height,n.value=l.height)}return is(()=>{const l=window.visualViewport;l&&(s=l.height,n.value=l.height,l.addEventListener("resize",r),l.addEventListener("scroll",r)),window.addEventListener("resize",o)}),Or(()=>{const l=window.visualViewport;l&&(l.removeEventListener("resize",r),l.removeEventListener("scroll",r)),window.removeEventListener("resize",o)}),{keyboardHeight:e,isKeyboardOpen:t,viewportHeight:n}}const Zm=/^https?:\/\//i,eg=Gu("articleOverlay",()=>{const e=Q(!1),t=Q(null),n=Q(""),s=Q(null),i=Q(null);function r(l,a="",c,u){const f=String(l??"").trim();if(Zm.test(f)){try{new URL(f)}catch{return}t.value=f,n.value=String(a??"Article").slice(0,200),s.value=typeof c=="string"&&c.trim().length>0?c.trim():null,i.value=typeof u=="string"&&u.trim().length>0?u.trim():null,e.value=!0}}function o(){e.value=!1,t.value=null,n.value="",s.value=null,i.value=null}return{isOpen:e,url:t,title:n,content:s,imgSrc:i,open:r,close:o}});const{entries:uf,setPrototypeOf:sc,isFrozen:tg,getPrototypeOf:ng,getOwnPropertyDescriptor:sg}=Object;let{freeze:wt,seal:Lt,create:Vo}=Object,{apply:zo,construct:qo}=typeof Reflect<"u"&&Reflect;wt||(wt=function(t){return t});Lt||(Lt=function(t){return t});zo||(zo=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),r=2;r<s;r++)i[r-2]=arguments[r];return t.apply(n,i)});qo||(qo=function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return new t(...s)});const zi=_t(Array.prototype.forEach),ig=_t(Array.prototype.lastIndexOf),ic=_t(Array.prototype.pop),zs=_t(Array.prototype.push),rg=_t(Array.prototype.splice),nr=_t(String.prototype.toLowerCase),uo=_t(String.prototype.toString),fo=_t(String.prototype.match),qs=_t(String.prototype.replace),og=_t(String.prototype.indexOf),lg=_t(String.prototype.trim),$t=_t(Object.prototype.hasOwnProperty),gt=_t(RegExp.prototype.test),Ws=ag(TypeError);function _t(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return zo(e,t,s)}}function ag(e){return function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return qo(e,n)}}function me(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nr;sc&&sc(e,null);let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){const r=n(i);r!==i&&(tg(t)||(t[s]=r),i=r)}e[i]=!0}return e}function cg(e){for(let t=0;t<e.length;t++)$t(e,t)||(e[t]=null);return e}function Xt(e){const t=Vo(null);for(const[n,s]of uf(e))$t(e,n)&&(Array.isArray(s)?t[n]=cg(s):s&&typeof s=="object"&&s.constructor===Object?t[n]=Xt(s):t[n]=s);return t}function Ks(e,t){for(;e!==null;){const s=sg(e,t);if(s){if(s.get)return _t(s.get);if(typeof s.value=="function")return _t(s.value)}e=ng(e)}function n(){return null}return n}const rc=wt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bd
`+Et),g&&zi([H,se,be],on=>{Et=qs(Et,on," ")}),T&&F?T.createHTML(Et):Et},t.setConfig=function(){let ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Br(ne),M=!0},t.clearConfig=function(){ls=null,M=!1},t.isValidAttribute=function(ne,y,U){ls||Br({});const Z=Ge(ne),Le=Ge(y);return Dl(Z,Le,U)},t.addHook=function(ne,y){typeof y=="function"&&zs(D[ne],y)},t.removeHook=function(ne,y){if(y!==void 0){const U=ig(D[ne],y);return U===-1?void 0:rg(D[ne],U,1)[0]}return ic(D[ne])},t.removeHooks=function(ne){D[ne]=[]},t.removeAllHooks=function(){D=uc()},t}var Tg=hf();function Eg(e){try{const t=new URL(e);return/^https?:$/i.test(t.protocol)}catch{return!1}}function qv(e){return!!e&&typeof e=="string"&&/^https?:\/\//i.test(e.trim())}const xg=["p","br","a","strong","em","b","i","ul","ol","li","blockquote","h1","h2","h3","h4","span","div"];function Ag(e){return Tg.sanitize(e,{ALLOWED_TAGS:xg,ALLOWED_ATTR:["href","src","target","rel"]})}function Cg(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Wv(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}const kg=["disabled"],Sg=["href"],Pg={class:"relative flex-1 min-h-0 bg-black/20 overflow-hidden"},Rg={class:"[&_p]:mb-3 [&_ul]:list-disc [&_ol]:list-decimal [&_li]:ml-4 [&_a]:underline [&_a]:underline-offset-2 [&_h1]:text-lg [&_h2]:text-base [&_h3]:text-sm [&_blockquote]:border-l-2 [&_blockquote]:pl-3 [&_blockquote]:italic"},Ig=["src","alt"],Og=["innerHTML"],Mg=["href"],Ng=["src"],Lg=jn({__name:"ArticleOverlay",setup(e){const t=eg(),{isDark:n}=cf(),s=je(()=>{const f=t.content;return f?/<[a-z][\s\S]*>/i.test(f)?Ag(f):`<p class="whitespace-pre-wrap">${Cg(f)}</p>`:""}),i=Q(null),r=Q(0),o=Q(!1);function l(){o.value=!0,r.value++}function a(){o.value=!1}function c(f){f.key==="Escape"&&t.isOpen&&(t.close(),f.preventDefault(),f.stopPropagation())}Ht(()=>t.isOpen,f=>{f||(o.value=!1)}),is(()=>{window.addEventListener("keydown",c,!0)}),Ir(()=>{window.removeEventListener("keydown",c,!0)});const u=["w-full max-w-[calc(100vw-3rem)] h-[80vh] max-h-[calc(100vh-5rem)]","md:max-w-[calc(100vw-5rem)]"];return(f,d)=>(de(),Un(dl,{to:"body"},[Ne(mr,{name:"app-launcher"},{default:di(()=>[V(t).isOpen?(de(),ve("div",{key:0,class:"fixed inset-0 z-[2400] flex items-center justify-center p-6 md:p-10",onClick:d[2]||(d[2]=dn(p=>V(t).close(),["self"]))},[d[7]||(d[7]=C("div",{class:"absolute inset-0 bg-black/60 backdrop-blur-md"},null,-1)),C("div",{class:qe(["article-overlay-panel relative z-10 flex flex-col overflow-hidden rounded-2xl shadow-2xl path-glass-card",u])},[C("div",{class:"flex items-center gap-3 px-4 py-3 shrink-0",style:Dn(V(n)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[V(t).content?mt("",!0):(de(),ve("button",{key:0,type:"button",class:qe(["flex items-center justify-center w-9 h-9 rounded-lg transition-colors transition-transform duration-300 disabled:opacity-70 disabled:cursor-not-allowed",V(n)?"hover:bg-white/10 text-white/70":"hover:bg-black/5 text-gray-600"]),"aria-label":"Refresh page",title:"Refresh",disabled:o.value,onClick:l},[(de(),ve("svg",{class:qe(["w-5 h-5",{"animate-spin":o.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},[...d[3]||(d[3]=[C("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)])],2))],10,kg)),C("span",{class:qe(["flex-1 truncate text-sm font-medium min-w-0",V(n)?"text-white/90":"text-gray-900"])},tt(V(t).title||"Article"),3),V(t).url?(de(),ve("a",{key:1,href:V(t).url,target:"_blank",rel:"noopener noreferrer",class:qe(["flex items-center justify-center w-9 h-9 rounded-lg transition-colors shrink-0",V(n)?"hover:bg-white/10 text-white/70":"hover:bg-black/5 text-gray-600"]),"aria-label":"Open in new tab",title:"Open in new tab",onClick:d[0]||(d[0]=dn(()=>{},["stop"]))},[...d[4]||(d[4]=[C("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[C("path",{"stroke-
`);if(n!==this.elements.captions.innerHTML){sr(this.elements.captions);const i=le("span",Qt(this.config.selectors.caption));i.innerHTML=n,this.elements.captions.appendChild(i),ae.call(this,this.media,"cuechange")}}},$f={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.8.4/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrappe
<rect width="200" height="200" fill="hsl(${s}, ${i}%, 28%)"/>
<rect x="3" y="3" width="194" height="194" rx="12" fill="none" stroke="hsl(${s}, ${i+5}%, 38%)" stroke-width="1"/>
<text x="100" y="82" text-anchor="middle" fill="hsl(${s}, ${i}%, 48%)" font-family="system-ui,sans-serif" font-size="10" font-weight="400" letter-spacing="4">${e}</text>
<line x1="60" y1="92" x2="140" y2="92" stroke="hsl(${s}, ${i+5}%, 40%)" stroke-width="1"/>
<text x="100" y="118" text-anchor="middle" fill="hsl(${s}, ${i+15}%, 78%)" font-family="system-ui,sans-serif" font-size="13" font-weight="700">${Ss(t.length>18?t.slice(0,16)+"…":t)}</text>
${n?`<text x="100" y="138" text-anchor="middle" fill="hsl(${s}, ${i}%, 60%)" font-family="system-ui,sans-serif" font-size="10" font-weight="300">${Ss(n.length>22?n.slice(0,20)+"…":n)}</text>`:""}
</svg>`;return`data:image/svg+xml,${encodeURIComponent(o)}`}function Kv(e,t){const n=[...e+(t??"")].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return Os("PODCAST",e,t,n,30)}function Gv(e,t){const n=[...e+(t??"")].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return Os("MUSIC",e,t,n,30)}function Yv(e,t){const n=[...e+(t??"")].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return Os("NEWS",e,t,n,22)}function Xv(e,t){const n=[...e+(t??"")].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return Os("WEBSITE",e,t,n,25)}function wb(e,t){const n=[...e].reduce((i,r)=>i+r.charCodeAt(0),0)%360,s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 342 513">
<rect width="342" height="513" fill="hsl(${n}, 25%, 28%)"/>
<rect x="3" y="3" width="336" height="507" rx="6" fill="none" stroke="hsl(${n}, 30%, 38%)" stroke-width="1"/>
<text x="171" y="210" text-anchor="middle" fill="hsl(${n}, 25%, 48%)" font-family="'Helvetica Neue',Helvetica,Arial,sans-serif" font-size="13" font-weight="400" letter-spacing="5">FILM</text>
<line x1="121" y1="225" x2="221" y2="225" stroke="hsl(${n}, 30%, 40%)" stroke-width="1"/>
<text x="171" y="265" text-anchor="middle" fill="hsl(${n}, 45%, 78%)" font-family="'Helvetica Neue',Helvetica,Arial,sans-serif" font-size="18" font-weight="700">
${Ss(e.length>20?e.slice(0,18)+"…":e)}
</text>
${t?`<text x="171" y="295" text-anchor="middle" fill="hsl(${n}, 30%, 60%)" font-family="'Helvetica Neue',Helvetica,Arial,sans-serif" font-size="14" font-weight="300">${t}</text>`:""}
</svg>`;return`data:image/svg+xml,${encodeURIComponent(s)}`}function Jv(e,t){const n=[...e].reduce((i,r)=>i+r.charCodeAt(0),0)%360,s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 342 513">
<rect width="342" height="513" fill="hsl(${n}, 22%, 28%)"/>
<rect x="3" y="3" width="336" height="507" rx="6" fill="none" stroke="hsl(${n}, 28%, 38%)" stroke-width="1"/>
<text x="171" y="210" text-anchor="middle" fill="hsl(${n}, 22%, 48%)" font-family="'SF Pro Display',system-ui,sans-serif" font-size="13" font-weight="400" letter-spacing="5">SERIES</text>
<line x1="111" y1="225" x2="231" y2="225" stroke="hsl(${n}, 28%, 40%)" stroke-width="1"/>
<text x="171" y="265" text-anchor="middle" fill="hsl(${n}, 40%, 78%)" font-family="'SF Pro Display',system-ui,sans-serif" font-size="18" font-weight="700">
${Ss(e.length>20?e.slice(0,18)+"…":e)}
</text>
${t?`<text x="171" y="295" text-anchor="middle" fill="hsl(${n}, 28%, 60%)" font-family="'SF Pro Display',system-ui,sans-serif" font-size="14" font-weight="300">${t}</text>`:""}
</svg>`;return`data:image/svg+xml,${encodeURIComponent(s)}`}function Ss(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}async function Vf(e,t,n){const s=`${e}:${Bf(t,n)}`,i=xi.get(s);if(i)return i;const r={posterUrl:null,backdropUrl:null};try{const o=new URLSearchParams({q:t.trim()});n&&n>0&&o.set("y",String(n));const l=await Sl(`/api/tmdb/${e}?${o}`);if(!l.ok)return r;const a=await l.json(),c={posterUrl:a.posterUrl??null,backdropUrl:a.backdropUrl??null};return(c.posterUrl||c.backdropUrl)&&(xi.set(s,c),yb()),c}catch{return r}}async function zf(e,t){return Vf("search",e,t)}async function Qv(e,t,n){const s=e.target;if(s.dataset.fallback==="done")return;const i=s.src;db.add(i);const r=Bf(t,n),o=xi.get(r);if(o?.posterUrl&&o.posterUrl!==i){s.dataset.fallback="tmdb",s.src=o.posterUrl;return}if(s.dataset.fallback!=="tmdb"){const{posterUrl:l}=await zf(t,n);if(l&&l!==i){s.dataset.fallback="tmdb",s.src=l;return}}if(s.dataset.fallback!=="wiki"){const l=await Ps(t,"film");if(l){s.dataset.fallback="wiki",s.src=l;return}}s.dataset.fallback="done",s.src=wb(t,n)}async function _b(e,t){return Vf("search-tv",e,t)}async function Zv(e,t){const n=pb(e,t),s=wr.get(n);if(s)return s;try{const i=t?`${e} ${t}`:e,r=await fetch(`https://itunes.apple.com/search?term=${encodeURIComponent(i.trim())}&media=podcast&limit=3`);if(!r.ok)return null;const a=(await r.json()).results?.[0]?.artworkUrl100;if(!a)return null;const c=a.replace(/100x100/g,"600x600");return wr.set(n,c),vb(),c}catch{return null}}const _r=new Map,qf="aiui-book-cover-cache";function Wf(e,t){return`${e.toLowerCase().trim()}|${t.toLowerCase().trim()}`}function Tb(){try{const e=sessionStorage.getItem(qf);if(e){const t=JSON.parse(e);Object.entries(t).forEach(([n,s])=>_r.set(n,s))}}catch{}}function Eb(){try{const e=[..._r.entries()].slice(-200);sessionStorage.setItem(qf,JSON.stringify(Object.fromEntries(e)))}catch{}}Tb();function ew(e,t){const n=[...e+(t??"")].reduce((i,r)=>i+r.charCodeAt(0),0)%360,s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 342 513">
<rect width="342" height="513" fill="hsl(${n}, 20%, 28%)"/>
<rect x="3" y="3" width="336" height="507" rx="6" fill="none" stroke="hsl(${n}, 25%, 38%)" stroke-width="1"/>
<text x="171" y="210" text-anchor="middle" fill="hsl(${n}, 18%, 48%)" font-family="Georgia,'Times New Roman',serif" font-size="13" font-weight="400" letter-spacing="5">BOOK</text>
<line x1="121" y1="225" x2="221" y2="225" stroke="hsl(${n}, 22%, 40%)" stroke-width="1"/>
<text x="171" y="265" text-anchor="middle" fill="hsl(${n}, 35%, 78%)" font-family="Georgia,'Times New Roman',serif" font-size="18" font-weight="700">
${Ss(e.length>20?e.slice(0,18)+"…":e)}
</text>
${t?`<text x="171" y="295" text-anchor="middle" fill="hsl(${n}, 22%, 60%)" font-family="Georgia,'Times New Roman',serif" font-size="14" font-weight="300">${Ss(t.length>24?t.slice(0,22)+"…":t)}</text>`:""}
</svg>`;return`data:image/svg+xml,${encodeURIComponent(s)}`}async function xb(e,t){const n=Wf(e,t),s=_r.get(n);if(s)return s;try{const i=`${e} ${t}`.trim(),r=await fetch(`https://openlibrary.org/search.json?q=${encodeURIComponent(i)}&limit=1&fields=cover_i`);if(!r.ok)return null;const l=(await r.json()).docs?.[0]?.cover_i;if(!l)return null;const a=`https://covers.openlibrary.org/b/id/${l}-L.jpg`;return _r.set(n,a),Eb(),a}catch{return null}}function tw(e,t){const n=[...e+(t??"")].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return Os("PLACE",e,t,n,20)}function nw(e,t){const n=[...e].reduce((s,i)=>s+i.charCodeAt(0),0)%360;return Os("RECIPE",e,t,n,30)}async function sw(e,t){if(t){const s=await Ps(e,t);if(s)return s}const n=await Ps(e,"restaurant");return n||null}async function Ab(e,t,n){const s=hb(t,e),i=gs.get(s);if(i)return i;try{const r="/aiui/",o=new URLSearchParams({q:e,title:e,artist:t}),l=await Sl(`${r}api/music/search?${o}`);if(l.ok){const a=await l.json();if(a.coverUrl)return gs.set(s,a.coverUrl),To(),a.coverUrl}}catch{}try{const r=`${e} ${t}`.trim(),o=await fetch(`https://wavlake.com/api/v1/content/search?term=${encodeURIComponent(r)}`,{headers:{Accept:"application/json"}});if(o.ok){const l=await o.json();if(Array.isArray(l)){const a=l.find(u=>u.type==="track"),c=a?.albumArtUrl??a?.artistArtUrl;if(c)return gs.set(s,c),To(),c}}}catch{}try{const r=`${t} ${e}`.trim().replace(/\s+/g,"+"),o=await fetch(`https://itunes.apple.com/search?term=${encodeURIComponent(r)}&media=music&limit=3`);if(!o.ok)return null;const c=(await o.json()).results?.[0]?.artworkUrl100;if(!c)return null;const u=c.replace(/100x100/g,"600x600");return gs.set(s,u),To(),u}catch{return null}}const _s=new Map;async function Ps(e,t){const n=`${e.toLowerCase().trim()}|${(t??"").toLowerCase()}`;if(_s.has(n))return _s.get(n)??null;const s=async r=>{try{const o=encodeURIComponent(r.trim().replace(/\s+/g,"_")),l=await fetch(`https://en.wikipedia.org/api/rest_v1/page/summary/${o}`);if(!l.ok)return null;const a=await l.json();return a.originalimage?.source??a.thumbnail?.source??null}catch{return null}};let i=null;return t&&(i=await s(`${e} (${t})`)),i||(i=await s(e)),_s.set(n,i),i}async function Cb(e,t){const s=`gbooks:${Wf(e,t??"")}`;if(_s.has(s))return _s.get(s)??null;try{const i=t?`intitle:${e}+inauthor:${t}`:`intitle:${e}`,r=await fetch(`https://www.googleapis.com/books/v1/volumes?q=${encodeURIComponent(i)}&maxResults=1`);if(!r.ok)return null;const l=(await r.json()).items?.[0]?.volumeInfo?.imageLinks;let a=l?.thumbnail??l?.smallThumbnail??null;return a&&(a=a.replace(/^http:/,"https:").replace(/&edge=curl/g,""),a.includes("zoom=")||(a+="&zoom=2")),_s.set(s,a),a}catch{return null}}async function iw(e,t){const n=await zf(e,t);if(n.posterUrl||n.backdropUrl)return n;const s=await Ps(e,"film");return s?{posterUrl:s,backdropUrl:null}:{posterUrl:null,backdropUrl:null}}async function rw(e,t){const n=await _b(e,t);if(n.posterUrl||n.backdropUrl)return n;const s=await Ps(e,"TV series");return s?{posterUrl:s,backdropUrl:null}:{posterUrl:null,backdropUrl:null}}async function ow(e,t){const n=await xb(e,t??"");if(n)return n;const s=await Cb(e,t);return s||await Ps(e,"novel")}const kb={key:0,class:"flex flex-col"},Sb={class:"flex items-center gap-3 px-3 py-2"},Pb={class:"w-10 h-10 rounded-lg overflow-hidden shrink-0 flex items-center justify-center path-glass-icon"},Rb=["src","alt"],Ib={key:1,class:"text-base"},Ob={class:"min-w-0 flex-1"},Mb={class:"text-sm font-semibold truncate text-white/90"},Nb={class:"text-xs truncate text-white/50"},Lb=["disabled"],$b={key:0,class:"w-6 h-6 animate-spin text-white/90",fill:"none",viewBox:"0 0 24 24"},Db={key:1,class:"w-6 h-6 text-white/90",fill:"currentColor",viewBox:"0 0 24 24"},Ub={key:2,class:"w-6 h-6 text-white/90",fill:"currentColor",viewBox:"0 0 24 24"},Fb=["disabled"],Hb={key:0,class:"text-xs text-red-400/60 px-3 pb-1 truncate"},jb={key:1,class:"flex items-center gap-4 px-4 py-3"},Bb={class:"flex items-center gap-3 min-w-0 flex-1 max-w-[280px]"},Vb={class:"w-12 h-12 rounded-lg overflow-hidden shrink-0 flex items-center justify-ce